From 08286d6b1245bf3c4d0f6479969a33f773a277af Mon Sep 17 00:00:00 2001 From: sergeyteleshev Date: Thu, 26 Dec 2024 13:16:57 +0100 Subject: [PATCH] CB-3753 adds autocomplete for where filters from result set column names --- .../InputAutocompletionMenu.module.css | 10 +----- .../InputField/InputAutocompletionMenu.tsx | 6 +--- .../core-ui/src/InlineEditor/InlineEditor.tsx | 2 +- .../TableHeader/TableWhereFilter.tsx | 1 + .../TableViewer/TableHeader/useWhereFilter.ts | 33 +++++++++++++++++-- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/webapp/packages/core-blocks/src/FormControls/InputField/InputAutocompletionMenu.module.css b/webapp/packages/core-blocks/src/FormControls/InputField/InputAutocompletionMenu.module.css index 8c6dc96feb..ac6d7ab5ec 100644 --- a/webapp/packages/core-blocks/src/FormControls/InputField/InputAutocompletionMenu.module.css +++ b/webapp/packages/core-blocks/src/FormControls/InputField/InputAutocompletionMenu.module.css @@ -29,17 +29,9 @@ position: relative; } - & .itemIcon { - position: relative; + & .iconOrImage { width: 16px; height: 16px; - overflow: hidden; - flex-shrink: 0; - - & .iconOrImage { - width: 100%; - height: 100%; - } } } diff --git a/webapp/packages/core-blocks/src/FormControls/InputField/InputAutocompletionMenu.tsx b/webapp/packages/core-blocks/src/FormControls/InputField/InputAutocompletionMenu.tsx index 78f7aa294b..9e4e0a2e88 100644 --- a/webapp/packages/core-blocks/src/FormControls/InputField/InputAutocompletionMenu.tsx +++ b/webapp/packages/core-blocks/src/FormControls/InputField/InputAutocompletionMenu.tsx @@ -100,11 +100,7 @@ export const InputAutocompletionMenu = observer( className={styles['menuItem']} onClick={event => handleSelect(item)} > - {item.icon && ( - - - - )} + {item.icon && } {item.displayString} ))} diff --git a/webapp/packages/core-ui/src/InlineEditor/InlineEditor.tsx b/webapp/packages/core-ui/src/InlineEditor/InlineEditor.tsx index cbc5c40dd4..226beb6ab3 100644 --- a/webapp/packages/core-ui/src/InlineEditor/InlineEditor.tsx +++ b/webapp/packages/core-ui/src/InlineEditor/InlineEditor.tsx @@ -173,7 +173,7 @@ export const InlineEditor = observer( )} - + ); }), diff --git a/webapp/packages/plugin-data-viewer/src/TableViewer/TableHeader/TableWhereFilter.tsx b/webapp/packages/plugin-data-viewer/src/TableViewer/TableHeader/TableWhereFilter.tsx index ecdfc0673b..e16612279b 100644 --- a/webapp/packages/plugin-data-viewer/src/TableViewer/TableHeader/TableWhereFilter.tsx +++ b/webapp/packages/plugin-data-viewer/src/TableViewer/TableHeader/TableWhereFilter.tsx @@ -28,6 +28,7 @@ export const TableWhereFilter: PlaceholderComponent ({ + title: column.label || '', + displayString: column.label || '', + replacementString: column.label || '', + icon: column.icon || '', + })); + }, get constraints() { const model = this.model as any; if (!model.source.hasResult(this.resultIndex) || !isResultSetDataModel(model)) { @@ -84,6 +111,8 @@ export function useWhereFilter(model: IDatabaseDataModel, resultIndex: number): model: observable.ref, resultIndex: observable.ref, filter: computed, + columns: computed, + hintProposals: computed, constraints: computed, disabled: computed, applicableFilter: computed,