From 22343f6ceb3175ff1794c4ff0ecda0471a7594af Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:17:50 -0400 Subject: key search on update --- .../collections/collectionSchema/CollectionSchemaView.tsx | 7 ++----- .../views/collections/collectionSchema/SchemaColumnHeader.tsx | 11 +++++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/client/views/collections') diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 92cc58f54..f5422bce1 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -791,9 +791,8 @@ export class CollectionSchemaView extends CollectionSubView() { }; @action - updateKeySearch = (e: React.ChangeEvent) => { - this._menuValue = e.target.value; - this._menuKeys = this.documentKeys.filter(value => value.toLowerCase().includes(this._menuValue.toLowerCase())); + updateKeySearch = (val: string) => { + this._menuKeys = this.documentKeys.filter(value => value.toLowerCase().includes(val.toLowerCase())); }; getFieldFilters = (field: string) => StrListCast(this.Document._childFilters).filter(filter => filter.split(Doc.FilterSep)[0] === field); @@ -920,7 +919,6 @@ export class CollectionSchemaView extends CollectionSubView() { const x = this._columnMenuIndex! === -1 ? 0 : this.displayColumnWidths.reduce((total, curr, index) => total + (index < this._columnMenuIndex! ? curr : 0), CollectionSchemaView._rowMenuWidth); return (
- e.stopPropagation()} /> {this._makeNewField ? this.newFieldMenu : this.keysDropdown}
); @@ -929,7 +927,6 @@ export class CollectionSchemaView extends CollectionSubView() { get renderKeysMenu() { return (
- e.stopPropagation()} /> {this._makeNewField ? this.newFieldMenu : this.keysDropdown}
); diff --git a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx index 4f9d53d18..32abc1780 100644 --- a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx +++ b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx @@ -61,6 +61,7 @@ export class SchemaColumnHeader extends ObservableReactComponent 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 sortClicked = (e: React.PointerEvent) => { @@ -76,8 +77,10 @@ export class SchemaColumnHeader extends ObservableReactComponent { - this._props.schemaView.openColumnMenu(this._props.columnIndex, false) - this._displayKeysDropdown = true; + if (this.isDefaultTitle(this.fieldKey)){ + this._props.schemaView.openColumnMenu(this._props.columnIndex, false) + this._displayKeysDropdown = true; + } } @action @@ -122,7 +125,7 @@ export class SchemaColumnHeader extends ObservableReactComponent this._props.schemaView.openColumnMenu(this._props.columnIndex, false)} + return
this.openKeyDropdown()} style={{ color, width: '100%', @@ -136,6 +139,7 @@ export class SchemaColumnHeader extends ObservableReactComponent { if (this.isDefaultTitle(this.fieldKey)) return ''; @@ -149,7 +153,6 @@ export class SchemaColumnHeader extends ObservableReactComponent