-
Notifications
You must be signed in to change notification settings - Fork 119
query-builder: typeahead for filter and post-filter #1381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 41c834b The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
43a0239
to
e1d939c
Compare
ba4f34e
to
c69b6ef
Compare
Codecov Report
@@ Coverage Diff @@
## master #1381 +/- ##
==========================================
+ Coverage 41.89% 42.10% +0.21%
==========================================
Files 1176 1179 +3
Lines 52484 52643 +159
Branches 11922 11966 +44
==========================================
+ Hits 21987 22167 +180
+ Misses 30422 30400 -22
- Partials 75 76 +1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite an elegant solution! Besides most of the suggested refactor, I think typeahead
should be treated as one word.
packages/legend-application/src/components/shared/BasicValueSpecificationEditor.tsx
Outdated
Show resolved
Hide resolved
packages/legend-application-query/src/stores/QueryBuilderFilterState.ts
Outdated
Show resolved
Hide resolved
packages/legend-application-query/src/components/QueryBuilderFilterPanel.tsx
Outdated
Show resolved
Hide resolved
packages/legend-application-query/src/components/QueryBuilderPostFilterPanel.tsx
Outdated
Show resolved
Hide resolved
noOptionsMessage={noOptionsMessage} | ||
/> | ||
) : ( | ||
<input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of styling, from the video, I notice the discrepancy in height of the custom selector component and the height of its container causes a jump when users input, let's fix that.
Also, I think we should consider whether we should show the caret down
here as it suggests auto-complete is available as people type and it's sort of distracting. What we want to do here is just let people have the feeling like they are typing some text value per usual, and happen to have these suggestions popping up.
packages/legend-application/src/components/shared/BasicValueSpecificationEditor.tsx
Show resolved
Hide resolved
packages/legend-application/src/components/shared/BasicValueSpecificationEditor.tsx
Outdated
Show resolved
Hide resolved
packages/legend-application/src/components/shared/BasicValueSpecificationEditor.tsx
Show resolved
Hide resolved
packages/legend-application/src/components/shared/BasicValueSpecificationEditor.tsx
Outdated
Show resolved
Hide resolved
cad7f0e
to
6ace4d2
Compare
2013830
to
b1f2bea
Compare
.../legend-application-query/src/stores/__tests__/TEST_DATA__QueryBuilder_TestTypeaheadSarch.ts
Outdated
Show resolved
Hide resolved
.../legend-application-query/src/stores/__tests__/TEST_DATA__QueryBuilder_TestTypeaheadSarch.ts
Outdated
Show resolved
Hide resolved
packages/legend-application-query/src/components/QueryEditorComponentTestUtils.tsx
Outdated
Show resolved
Hide resolved
72e00f4
to
cde8767
Compare
cde8767
to
9553c5e
Compare
9553c5e
to
0ebd8cc
Compare
d152784
to
41c834b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice stuff! I left some comments, let's address them after merging.
packages/legend-application-query/src/stores/QueryBuilderTypeaheadHelper.ts
Show resolved
Hide resolved
packages/legend-application-query/src/stores/QueryBuilderTypeaheadHelper.ts
Show resolved
Hide resolved
packages/legend-application-query/src/stores/QueryBuilderTypeaheadHelper.ts
Show resolved
Hide resolved
packages/legend-application-query/src/stores/QueryBuilderTypeaheadHelper.ts
Show resolved
Hide resolved
packages/legend-application-query/src/stores/QueryBuilderTypeaheadHelper.ts
Show resolved
Hide resolved
@@ -604,6 +684,16 @@ export const BasicValueSpecificationEditor: React.FC<{ | |||
className?: string | undefined; | |||
setValueSpecification: (val: ValueSpecification) => void; | |||
resetValue: () => void; | |||
selectorConfig?: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely convinced of this approach, I think what we should do is just let people pass in a function to return Promise<string[]>
and we keep all the other states (loading, results) as part of this component or so.
packages/legend-application-query/src/stores/QueryBuilderOperatorLoader.ts
Show resolved
Hide resolved
packages/legend-application-query/src/stores/QueryBuilderFetchStructureState.ts
Show resolved
Hide resolved
packages/legend-application-query/src/stores/__tests__/QueryBuilder_Typeahead.test.ts
Show resolved
Hide resolved
@@ -466,6 +474,26 @@ const QueryBuilderPostFilterConditionEditor = observer( | |||
node.condition.operator.getDefaultFilterConditionValue(node.condition), | |||
); | |||
}; | |||
const debouncedTypeaheadSearch = useMemo( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to simplify the API of BasicValueSpecification
further here. Also, I just thought of a case I don't know if we need to handle, that is what happens if we do typeahead search and the returns are booleans
or numbers
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can further enhance that for numbers.
Maybe not yet for booleans.
Summary
Fixes #1382
typeAhead.mp4