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

---
 .../views/collections/collectionSchema/SchemaColumnHeader.tsx | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx')

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<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
     sortClicked = (e: React.PointerEvent) => {
@@ -76,8 +77,10 @@ export class SchemaColumnHeader extends ObservableReactComponent<SchemaColumnHea
     };
 
     openKeyDropdown = () => {
-        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<SchemaColumnHea
     @computed get editableView() {
         const { color, fieldProps, pointerEvents } = this.renderProps(this._props); 
 
-        return <div className='schema-column-edit-wrapper' onPointerUp={() => this._props.schemaView.openColumnMenu(this._props.columnIndex, false)}
+        return <div className='schema-column-edit-wrapper' onPointerUp={() => this.openKeyDropdown()}
         style={{
             color,
             width: '100%',
@@ -136,6 +139,7 @@ export class SchemaColumnHeader extends ObservableReactComponent<SchemaColumnHea
                 fieldContents={fieldProps}
                 editing={undefined}  
                 updateAlt={this.updateAlt} // alternate title to display
+                updateSearch={this.updateKeyDropdown}
                 showKeyNotVal={true} // tells the EditableView to display the fieldKey itself, and not its value
                 GetValue={() => {
                     if (this.isDefaultTitle(this.fieldKey)) return '';
@@ -149,7 +153,6 @@ export class SchemaColumnHeader extends ObservableReactComponent<SchemaColumnHea
                         this._props.finishEdit?.();
                         return true;
                     } else if (enterKey) this.updateAlt(value);
-                    
                     this._props.finishEdit?.(); 
                     return true;
                 }, 'edit column header')}
-- 
cgit v1.2.3-70-g09d2

