Skip to content

Commit c3c8f4b

Browse files
committed
feat(PowerSearch): list value-only matches in the sheet's content search
In the sheet presentation, Add filter's content search lists the value-only matches of opted-in operators (component:PowerSearch FR30), after its other suggestions, field by field, at most three per field and then a "More {field} matching '{text}'" row. - The sheet asks no source. A search-source field lists its rows that need no source, after the fields that need none, then its "More" row in place of its source rows. - A value row adds its filter to the draft, as a suggestion that carries a value does. - A "More" row opens the value step on the typed text: a text field holds it as its value, a search source's typeahead and a list value's Tokenizer sheet open on it, and an enum list shows in full. - A people field's "More" row (its first opted-in operator takes an entity_list value with a searchSource) opens that operator's Tokenizer sheet directly above Add filter, already searching the text. Save adds one filter, closes the sheet and Add filter together, shows Filters with focus on the new row, and announces it there. An empty Save or a dismissal returns to Add filter with the text kept and focus on the content search. - The value-only module loads as the flow opens, and Add filter lists the rows once it lands. The FR30 status cell moves from the implementation gap to its evidence.
1 parent cc833fb commit c3c8f4b

10 files changed

Lines changed: 789 additions & 41 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[feat] `PowerSearch`: in the sheet presentation, Add filter's content search lists the value-only matches of operators that set `isValueOnlyMatchAllowed` (`component:PowerSearch` FR30), after its other suggestions, at most three per field and then a "More {field} matching '{text}'" row. It asks no search source: a field with a search-source operator lists its rows that need no source, then its "More" row. A "More" row opens the value step on the typed text (a text field's value, a search source's query, or the query a list value's Tokenizer sheet opens with). A people field's "More" row, where the first opted-in operator takes an `entity_list` value with a `searchSource`, opens that operator's Tokenizer sheet directly above Add filter, already searching the text; its Save adds the filter and shows Filters, and an empty Save or a dismissal returns to Add filter with the text kept.
6+
7+
@imdreamrunner

‎.changeset/powersearch-value-only-matches.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
'@astryxdesign/core': patch
33
---
44

5-
[feat] `PowerSearch`: an operator's new `isValueOnlyMatchAllowed: true` suggests its complete filters for a typed value alone, with no field label before it (`component:PowerSearch` FR27–FR29, DEC-8). Typing "fiction" offers `Genre is Fiction` after the field and field-and-operator rows: a `string` or `string_list` operator without a `searchSource` offers the typed text, an `enum` or `enum_list` operator the values with a word that starts with it (ignoring case and accents, whole-label matches first), and an operator with a `searchSource` the items that source returns. Each distinct source is asked once per query, once the text has rested 150 ms, and its rows append below the others. A field shows at most three of these rows from two characters (or its `typeaheadMinQueryLength`), then a "More {field} matching '{text}'" row that opens that field's value editor, carrying the typed text into an editor that searches (an `enum` field's editor opens on its full list). They do not count toward `maxSearchResults`. The option is off by default, so a config that opts no operator in keeps every list as it is; a field's `isValueMatchAllowed: false` turns these rows off too, and an opt-in under it warns once in development. The sheet presentation's content search does not list them.
5+
[feat] `PowerSearch`: an operator's new `isValueOnlyMatchAllowed: true` suggests its complete filters for a typed value alone, with no field label before it (`component:PowerSearch` FR27–FR29, DEC-8). Typing "fiction" offers `Genre is Fiction` after the field and field-and-operator rows: a `string` or `string_list` operator without a `searchSource` offers the typed text, an `enum` or `enum_list` operator the values with a word that starts with it (ignoring case and accents, whole-label matches first), and an operator with a `searchSource` the items that source returns. Each distinct source is asked once per query, once the text has rested 150 ms, and its rows append below the others. A field shows at most three of these rows from two characters (or its `typeaheadMinQueryLength`), then a "More {field} matching '{text}'" row that opens that field's value editor, carrying the typed text into an editor that searches (an `enum` field's editor opens on its full list). They do not count toward `maxSearchResults`. The option is off by default, so a config that opts no operator in keeps every list as it is; a field's `isValueMatchAllowed: false` turns these rows off too, and an opt-in under it warns once in development.
66

77
@imdreamrunner

‎apps/storybook/stories/PowerSearch.stories.tsx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,18 @@ export const ValueOnlyMatches: Story = {
17791779
name: 'Value-only matches',
17801780
};
17811781

1782+
// The sheet presentation lists the same rows without asking the people
1783+
// source: Assignee lists its "More" row, which opens the people search on the
1784+
// typed text.
1785+
export const ValueOnlyMatchesSheet: Story = {
1786+
...ValueOnlyMatches,
1787+
args: {
1788+
...ValueOnlyMatches.args,
1789+
presentation: 'bottom-sheet',
1790+
},
1791+
name: 'Value-only matches (sheet)',
1792+
};
1793+
17821794
export const SizeVariants: Story = {
17831795
render: () => {
17841796
const [smFilters, setSmFilters] = useState<PowerSearchFilter[]>([

‎docs/specs/components/PowerSearch/PowerSearch.spec.md‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎packages/core/src/PowerSearch/PowerSearch.tsx‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ import {isFocusDetached} from '../utils/isFocusDetached';
7777
import {isRenderable} from '../utils/isRenderable';
7878
import {useInternalConfig} from './useInternalConfig';
7979
import {usePowerSearchSource} from './usePowerSearchSource';
80-
import {findDisallowedOptIns} from './valueOnlyMatchLoader';
80+
import {
81+
findDisallowedOptIns,
82+
hasValueOnlyOptIn,
83+
loadValueOnlyMatches,
84+
} from './valueOnlyMatchLoader';
8185
import {formatDateRange, formatFilterValueForRender} from './formatFilterValue';
8286
import {NestedEditor, PowerSearchEditPopover} from './PowerSearchEditPopover';
8387
import {PowerSearchValueEditor} from './PowerSearchValueEditor';
@@ -1550,9 +1554,13 @@ export function PowerSearch({
15501554
// The flow restores focus to the element that was active when it opened;
15511555
// make sure that is the trigger even for a tap on a token.
15521556
triggerRef.current?.focus({preventScroll: true});
1557+
// Opening the flow is the first intent for Add filter's value-only rows.
1558+
if (hasValueOnlyOptIn(config)) {
1559+
loadValueOnlyMatches().catch(() => {});
1560+
}
15531561
setIsSheetPresented(true);
15541562
setIsSheetOpen(true);
1555-
}, [isDisabled]);
1563+
}, [config, isDisabled]);
15561564

15571565
// The field's end lane — the result count and `endContent` — sits outside
15581566
// the trigger button: a caller's action button there keeps its own tab stop

0 commit comments

Comments
 (0)