aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx3
-rw-r--r--src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx5
2 files changed, 8 insertions, 0 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index a3bc537d2..e4ffc5b13 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -67,6 +67,7 @@ export class CollectionSchemaView extends CollectionSubView() {
private _documentOptions: DocumentOptions = new DocumentOptions();
private _tableContentRef: HTMLDivElement | null = null;
private _menuTarget = React.createRef<HTMLDivElement>();
+ private _headerRefs: SchemaColumnHeader[] = [];
constructor(props: any) {
super(props);
@@ -411,6 +412,7 @@ export class CollectionSchemaView extends CollectionSubView() {
@action
dragColumn = (e: PointerEvent, index: number) => {
this.closeColumnMenu();
+ this._headerRefs.forEach(ref => ref.stopEditing());
this._draggedColIndex = index;
this.setColDrag(true);
const dragData = new DragManager.ColumnDragData(index);
@@ -1331,6 +1333,7 @@ export class CollectionSchemaView extends CollectionSubView() {
<SchemaColumnHeader
// eslint-disable-next-line react/no-array-index-key
//cleanupField={this.cleanupComputedField}
+ ref={r => r && this._headerRefs.push(r)}
keysDropdown={(this.keysDropdown)}
schemaView={this}
columnWidth={() => CollectionSchemaView._minColWidth} //TODO: update
diff --git a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
index e98a2c778..382d7487b 100644
--- a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
@@ -23,6 +23,7 @@ import { undoable } from '../../../util/UndoManager';
import { FInfo } from '../../../documents/Documents';
import { ColumnType } from '../../../../fields/SchemaHeaderField';
import { IconButton, Size } from 'browndash-components';
+import { TbHospital } from 'react-icons/tb';
export enum SchemaFieldType {
Header, Cell
@@ -72,6 +73,10 @@ export class SchemaColumnHeader extends ObservableReactComponent<SchemaColumnHea
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)