diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-06-30 19:08:37 -0400 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-06-30 19:08:37 -0400 |
commit | c528298bf2375daff4ba8de170870eddf331aa4e (patch) | |
tree | 0d6ea8926398cd3b2ae90d2bdef0600ab6c80a71 | |
parent | 821e10405c13e125ea439450b7a66090f0c118fa (diff) |
removing column closes menu and stops editing
-rw-r--r-- | src/client/views/collections/collectionSchema/CollectionSchemaView.tsx | 6 | ||||
-rw-r--r-- | src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx | 14 |
2 files changed, 9 insertions, 11 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 49cb86732..1b23e3c40 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -358,6 +358,10 @@ export class CollectionSchemaView extends CollectionSubView() { @undoBatch removeColumn = (index: number) => { if (this.columnKeys.length === 1) return; + if (this._columnMenuIndex === index) { + this._headerRefs[index].toggleEditing(false); + this.closeColumnMenu(); + } const currWidths = this.storedColumnWidths.slice(); currWidths.splice(index, 1); const newDesiredTableWidth = currWidths.reduce((w, cw) => w + cw, 0); @@ -425,7 +429,7 @@ export class CollectionSchemaView extends CollectionSubView() { @action dragColumn = (e: PointerEvent, index: number) => { this.closeColumnMenu(); - this._headerRefs.forEach(ref => ref.stopEditing()); + this._headerRefs.forEach(ref => ref.toggleEditing(false)); this._draggedColIndex = index; this.setColDrag(true); const dragData = new DragManager.ColumnDragData(index); diff --git a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx index 70db3d1f5..2b56ae881 100644 --- a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx +++ b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx @@ -71,15 +71,9 @@ export class SchemaColumnHeader extends ObservableReactComponent<SchemaColumnHea getFinfo = computedFn((fieldKey: string) => this._props.schemaView?.fieldInfos.get(fieldKey)); setColumnValues = (field: string, defaultValue: string) => {this._props.schemaView?.setKey(field, defaultValue, this._props.columnIndex);} @action updateAlt = (newAlt: string) => {this._altTitle = newAlt;} - @action updateKeyDropdown = (value: string) => {this._props.schemaView.updateKeySearch(value)} - @action stopEditing = () => { - this._inputRef?.setIsEditing(false); - this._inputRef?.setIsFocused(false); - } - - openKeyDropdown = () => { - this._props.schemaView.openColumnMenu(this._props.columnIndex, false) - } + updateKeyDropdown = (value: string) => {this._props.schemaView.updateKeySearch(value)} + toggleEditing = (editing: boolean) => {this._inputRef?.setIsEditing(editing); this._inputRef?.setIsFocused(editing);} + openKeyDropdown = () => {this._props.schemaView.openColumnMenu(this._props.columnIndex, false)} @action setupDrag = (e: React.PointerEvent) => { @@ -89,7 +83,7 @@ export class SchemaColumnHeader extends ObservableReactComponent<SchemaColumnHea renderProps = (props: SchemaColumnHeaderProps) => { const { columnKeys, columnWidth, Document } = props; const fieldKey = columnKeys[props.columnIndex]; - const color = 'black'; // color of text in cells + const color = 'black'; const fieldProps: FieldViewProps = { childFilters: returnEmptyFilter, childFiltersByRanges: returnEmptyFilter, |