From eb5c84093d0741a99aa416f01806c60152419603 Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 23 Mar 2023 18:11:56 -0400 Subject: fixed setting filter value in schema view by clicking done --- .../collectionSchema/CollectionSchemaView.tsx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index d92ccc344..839a5f911 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -631,13 +631,20 @@ export class CollectionSchemaView extends CollectionSubView() { }; @action - closeFilterMenu = () => { + closeFilterMenu = (setValue: boolean) => { + if (setValue) { + if (this._filterValue !== '') { + Doc.setDocFilter(this.Document, this.columnKeys[this._filterColumnIndex!], this._filterValue, 'check', false, undefined, false); + } else { + this.removeFieldFilters(this.columnKeys[this._filterColumnIndex!]); + } + } this._filterColumnIndex = undefined; }; openContextMenu = (x: number, y: number, index: number) => { this.closeColumnMenu(); - this.closeFilterMenu(); + this.closeFilterMenu(false); ContextMenu.Instance.clearItems(); ContextMenu.Instance.addItem({ description: 'Change field', @@ -682,15 +689,10 @@ export class CollectionSchemaView extends CollectionSubView() { onFilterKeyDown = (e: React.KeyboardEvent) => { switch (e.key) { case 'Enter': - if (this._filterValue !== '') { - Doc.setDocFilter(this.Document, this.columnKeys[this._filterColumnIndex!], this._filterValue, 'check', false, undefined, false); - } else { - this.removeFieldFilters(this.columnKeys[this._filterColumnIndex!]); - } - this.closeFilterMenu(); + this.closeFilterMenu(true); break; case 'Escape': - this.closeFilterMenu(); + this.closeFilterMenu(false); break; } }; @@ -863,7 +865,7 @@ export class CollectionSchemaView extends CollectionSubView() { className="schema-column-menu-button" onPointerDown={action(e => { e.stopPropagation(); - this.closeFilterMenu(); + this.closeFilterMenu(true); })}> done -- cgit v1.2.3-70-g09d2