@navikt/ds-react 8.6.0 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/data/drag-and-drop/item/DataDragAndDropItem.d.ts +27 -0
- package/cjs/data/drag-and-drop/item/DataDragAndDropItem.js +91 -0
- package/cjs/data/drag-and-drop/item/DataDragAndDropItem.js.map +1 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.d.ts +5 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.js +6 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.js.map +1 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.d.ts +24 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.js +111 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.js.map +1 -0
- package/cjs/data/table/helpers/table-keyboard.d.ts +1 -0
- package/cjs/data/table/helpers/table-keyboard.js +5 -3
- package/cjs/data/table/helpers/table-keyboard.js.map +1 -1
- package/cjs/data/table/root/DataTableRoot.context.d.ts +8 -0
- package/cjs/data/table/root/DataTableRoot.context.js +11 -0
- package/cjs/data/table/root/DataTableRoot.context.js.map +1 -0
- package/cjs/data/table/root/DataTableRoot.js +5 -3
- package/cjs/data/table/root/DataTableRoot.js.map +1 -1
- package/cjs/data/table/th/DataTableTh.d.ts +18 -2
- package/cjs/data/table/th/DataTableTh.js +45 -20
- package/cjs/data/table/th/DataTableTh.js.map +1 -1
- package/cjs/data/table/tr/DataTableTr.js +9 -2
- package/cjs/data/table/tr/DataTableTr.js.map +1 -1
- package/cjs/data/token-filter/AutoSuggest.d.ts +6 -2
- package/cjs/data/token-filter/AutoSuggest.js +46 -11
- package/cjs/data/token-filter/AutoSuggest.js.map +1 -1
- package/cjs/data/token-filter/TokenFilter.d.ts +5 -5
- package/cjs/data/token-filter/TokenFilter.js +105 -42
- package/cjs/data/token-filter/TokenFilter.js.map +1 -1
- package/cjs/data/token-filter/TokenFilter.types.d.ts +51 -33
- package/cjs/data/token-filter/helpers/generate-autocomplete-options.d.ts +2 -3
- package/cjs/data/token-filter/helpers/generate-autocomplete-options.js +11 -15
- package/cjs/data/token-filter/helpers/generate-autocomplete-options.js.map +1 -1
- package/cjs/data/token-filter/helpers/operators.d.ts +6 -6
- package/cjs/data/token-filter/helpers/operators.js +3 -4
- package/cjs/data/token-filter/helpers/operators.js.map +1 -1
- package/cjs/data/token-filter/helpers/parse-query-text.d.ts +2 -20
- package/cjs/data/token-filter/helpers/parse-query-text.js +1 -1
- package/cjs/data/token-filter/helpers/parse-query-text.js.map +1 -1
- package/cjs/data/token-filter/helpers/query-builder.d.ts +2 -2
- package/cjs/data/token-filter/helpers/query-builder.js.map +1 -1
- package/cjs/date/Date.Dialog.d.ts +5 -1
- package/cjs/date/Date.Dialog.js +6 -2
- package/cjs/date/Date.Dialog.js.map +1 -1
- package/cjs/date/datepicker/DatePicker.js +3 -2
- package/cjs/date/datepicker/DatePicker.js.map +1 -1
- package/cjs/date/datepicker/hooks/useDatepicker.js +5 -2
- package/cjs/date/datepicker/hooks/useDatepicker.js.map +1 -1
- package/cjs/date/datepicker/hooks/useRangeDatepicker.js +3 -1
- package/cjs/date/datepicker/hooks/useRangeDatepicker.js.map +1 -1
- package/cjs/date/datepicker/parts/DatePicker.Months.d.ts +2 -1
- package/cjs/date/datepicker/parts/DatePicker.Months.js +3 -3
- package/cjs/date/datepicker/parts/DatePicker.Months.js.map +1 -1
- package/cjs/date/datepicker/parts/DatePicker.RDP.d.ts +5 -1
- package/cjs/date/datepicker/parts/DatePicker.RDP.js +2 -2
- package/cjs/date/datepicker/parts/DatePicker.RDP.js.map +1 -1
- package/cjs/date/monthpicker/MonthPicker.js +3 -2
- package/cjs/date/monthpicker/MonthPicker.js.map +1 -1
- package/cjs/date/monthpicker/hooks/useMonthPicker.js +3 -1
- package/cjs/date/monthpicker/hooks/useMonthPicker.js.map +1 -1
- package/cjs/date/monthpicker/parts/MonthPicker.Caption.d.ts +4 -1
- package/cjs/date/monthpicker/parts/MonthPicker.Caption.js +3 -2
- package/cjs/date/monthpicker/parts/MonthPicker.Caption.js.map +1 -1
- package/cjs/dropdown/Toggle.js +5 -12
- package/cjs/dropdown/Toggle.js.map +1 -1
- package/cjs/form/combobox/Input/Input.js +1 -1
- package/cjs/form/combobox/Input/Input.js.map +1 -1
- package/cjs/inline-message/root/InlineMessage.js +2 -2
- package/cjs/inline-message/root/InlineMessage.js.map +1 -1
- package/cjs/provider/Provider.d.ts +2 -2
- package/cjs/tooltip/Tooltip.js +1 -3
- package/cjs/tooltip/Tooltip.js.map +1 -1
- package/cjs/utils/components/HighlightText/HighlightText.d.ts +8 -0
- package/cjs/utils/components/HighlightText/HighlightText.js +27 -0
- package/cjs/utils/components/HighlightText/HighlightText.js.map +1 -0
- package/cjs/utils/components/Listbox/group/ListboxGroup.d.ts +7 -0
- package/cjs/utils/components/Listbox/group/ListboxGroup.js +15 -0
- package/cjs/utils/components/Listbox/group/ListboxGroup.js.map +1 -0
- package/cjs/utils/components/Listbox/input-slot/ListboxInputSlot.d.ts +7 -0
- package/cjs/utils/components/Listbox/input-slot/ListboxInputSlot.js +15 -0
- package/cjs/utils/components/Listbox/input-slot/ListboxInputSlot.js.map +1 -0
- package/cjs/utils/components/Listbox/item/ListboxItem.d.ts +24 -0
- package/cjs/utils/components/Listbox/item/ListboxItem.js +33 -0
- package/cjs/utils/components/Listbox/item/ListboxItem.js.map +1 -0
- package/cjs/utils/components/Listbox/list/ListboxList.d.ts +8 -0
- package/cjs/utils/components/Listbox/list/ListboxList.js +32 -0
- package/cjs/utils/components/Listbox/list/ListboxList.js.map +1 -0
- package/cjs/utils/components/Listbox/root/ListboxRoot.d.ts +20 -0
- package/cjs/utils/components/Listbox/root/ListboxRoot.js +84 -0
- package/cjs/utils/components/Listbox/root/ListboxRoot.js.map +1 -0
- package/cjs/utils/components/Listbox/root/domHelpers.d.ts +3 -0
- package/cjs/utils/components/Listbox/root/domHelpers.js +53 -0
- package/cjs/utils/components/Listbox/root/domHelpers.js.map +1 -0
- package/cjs/utils/components/focus-boundary/FocusBoundary.js +9 -64
- package/cjs/utils/components/focus-boundary/FocusBoundary.js.map +1 -1
- package/cjs/utils/helpers/focus.d.ts +14 -0
- package/cjs/utils/helpers/focus.js +63 -0
- package/cjs/utils/helpers/focus.js.map +1 -0
- package/cjs/utils/hooks/useDeferredValue.d.ts +1 -0
- package/cjs/utils/hooks/useDeferredValue.js +14 -0
- package/cjs/utils/hooks/useDeferredValue.js.map +1 -0
- package/esm/data/drag-and-drop/item/DataDragAndDropItem.d.ts +27 -0
- package/esm/data/drag-and-drop/item/DataDragAndDropItem.js +55 -0
- package/esm/data/drag-and-drop/item/DataDragAndDropItem.js.map +1 -0
- package/esm/data/drag-and-drop/root/DataDragAndDrop.context.d.ts +5 -0
- package/esm/data/drag-and-drop/root/DataDragAndDrop.context.js +3 -0
- package/esm/data/drag-and-drop/root/DataDragAndDrop.context.js.map +1 -0
- package/esm/data/drag-and-drop/root/DataDragAndDropRoot.d.ts +24 -0
- package/esm/data/drag-and-drop/root/DataDragAndDropRoot.js +71 -0
- package/esm/data/drag-and-drop/root/DataDragAndDropRoot.js.map +1 -0
- package/esm/data/table/helpers/table-keyboard.d.ts +1 -0
- package/esm/data/table/helpers/table-keyboard.js +5 -3
- package/esm/data/table/helpers/table-keyboard.js.map +1 -1
- package/esm/data/table/root/DataTableRoot.context.d.ts +8 -0
- package/esm/data/table/root/DataTableRoot.context.js +7 -0
- package/esm/data/table/root/DataTableRoot.context.js.map +1 -0
- package/esm/data/table/root/DataTableRoot.js +5 -3
- package/esm/data/table/root/DataTableRoot.js.map +1 -1
- package/esm/data/table/th/DataTableTh.d.ts +18 -2
- package/esm/data/table/th/DataTableTh.js +46 -21
- package/esm/data/table/th/DataTableTh.js.map +1 -1
- package/esm/data/table/tr/DataTableTr.js +9 -2
- package/esm/data/table/tr/DataTableTr.js.map +1 -1
- package/esm/data/token-filter/AutoSuggest.d.ts +6 -2
- package/esm/data/token-filter/AutoSuggest.js +45 -13
- package/esm/data/token-filter/AutoSuggest.js.map +1 -1
- package/esm/data/token-filter/TokenFilter.d.ts +5 -5
- package/esm/data/token-filter/TokenFilter.js +105 -42
- package/esm/data/token-filter/TokenFilter.js.map +1 -1
- package/esm/data/token-filter/TokenFilter.types.d.ts +51 -33
- package/esm/data/token-filter/helpers/generate-autocomplete-options.d.ts +2 -3
- package/esm/data/token-filter/helpers/generate-autocomplete-options.js +11 -15
- package/esm/data/token-filter/helpers/generate-autocomplete-options.js.map +1 -1
- package/esm/data/token-filter/helpers/operators.d.ts +6 -6
- package/esm/data/token-filter/helpers/operators.js +3 -4
- package/esm/data/token-filter/helpers/operators.js.map +1 -1
- package/esm/data/token-filter/helpers/parse-query-text.d.ts +2 -20
- package/esm/data/token-filter/helpers/parse-query-text.js +1 -1
- package/esm/data/token-filter/helpers/parse-query-text.js.map +1 -1
- package/esm/data/token-filter/helpers/query-builder.d.ts +2 -2
- package/esm/data/token-filter/helpers/query-builder.js.map +1 -1
- package/esm/date/Date.Dialog.d.ts +5 -1
- package/esm/date/Date.Dialog.js +6 -2
- package/esm/date/Date.Dialog.js.map +1 -1
- package/esm/date/datepicker/DatePicker.js +3 -2
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/hooks/useDatepicker.js +5 -2
- package/esm/date/datepicker/hooks/useDatepicker.js.map +1 -1
- package/esm/date/datepicker/hooks/useRangeDatepicker.js +3 -1
- package/esm/date/datepicker/hooks/useRangeDatepicker.js.map +1 -1
- package/esm/date/datepicker/parts/DatePicker.Months.d.ts +2 -1
- package/esm/date/datepicker/parts/DatePicker.Months.js +3 -3
- package/esm/date/datepicker/parts/DatePicker.Months.js.map +1 -1
- package/esm/date/datepicker/parts/DatePicker.RDP.d.ts +5 -1
- package/esm/date/datepicker/parts/DatePicker.RDP.js +2 -2
- package/esm/date/datepicker/parts/DatePicker.RDP.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.js +3 -2
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/date/monthpicker/hooks/useMonthPicker.js +3 -1
- package/esm/date/monthpicker/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/monthpicker/parts/MonthPicker.Caption.d.ts +4 -1
- package/esm/date/monthpicker/parts/MonthPicker.Caption.js +3 -2
- package/esm/date/monthpicker/parts/MonthPicker.Caption.js.map +1 -1
- package/esm/dropdown/Toggle.js +5 -12
- package/esm/dropdown/Toggle.js.map +1 -1
- package/esm/form/combobox/Input/Input.js +1 -1
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/inline-message/root/InlineMessage.js +3 -3
- package/esm/inline-message/root/InlineMessage.js.map +1 -1
- package/esm/provider/Provider.d.ts +2 -2
- package/esm/tooltip/Tooltip.js +1 -3
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/utils/components/HighlightText/HighlightText.d.ts +8 -0
- package/esm/utils/components/HighlightText/HighlightText.js +21 -0
- package/esm/utils/components/HighlightText/HighlightText.js.map +1 -0
- package/esm/utils/components/Listbox/group/ListboxGroup.d.ts +7 -0
- package/esm/utils/components/Listbox/group/ListboxGroup.js +10 -0
- package/esm/utils/components/Listbox/group/ListboxGroup.js.map +1 -0
- package/esm/utils/components/Listbox/input-slot/ListboxInputSlot.d.ts +7 -0
- package/esm/utils/components/Listbox/input-slot/ListboxInputSlot.js +9 -0
- package/esm/utils/components/Listbox/input-slot/ListboxInputSlot.js.map +1 -0
- package/esm/utils/components/Listbox/item/ListboxItem.d.ts +24 -0
- package/esm/utils/components/Listbox/item/ListboxItem.js +27 -0
- package/esm/utils/components/Listbox/item/ListboxItem.js.map +1 -0
- package/esm/utils/components/Listbox/list/ListboxList.d.ts +8 -0
- package/esm/utils/components/Listbox/list/ListboxList.js +27 -0
- package/esm/utils/components/Listbox/list/ListboxList.js.map +1 -0
- package/esm/utils/components/Listbox/root/ListboxRoot.d.ts +20 -0
- package/esm/utils/components/Listbox/root/ListboxRoot.js +79 -0
- package/esm/utils/components/Listbox/root/ListboxRoot.js.map +1 -0
- package/esm/utils/components/Listbox/root/domHelpers.d.ts +3 -0
- package/esm/utils/components/Listbox/root/domHelpers.js +50 -0
- package/esm/utils/components/Listbox/root/domHelpers.js.map +1 -0
- package/esm/utils/components/focus-boundary/FocusBoundary.js +8 -63
- package/esm/utils/components/focus-boundary/FocusBoundary.js.map +1 -1
- package/esm/utils/helpers/focus.d.ts +14 -0
- package/esm/utils/helpers/focus.js +60 -0
- package/esm/utils/helpers/focus.js.map +1 -0
- package/esm/utils/hooks/useDeferredValue.d.ts +1 -0
- package/esm/utils/hooks/useDeferredValue.js +7 -0
- package/esm/utils/hooks/useDeferredValue.js.map +1 -0
- package/package.json +7 -7
- package/src/data/drag-and-drop/item/DataDragAndDropItem.tsx +101 -0
- package/src/data/drag-and-drop/root/DataDragAndDrop.context.tsx +9 -0
- package/src/data/drag-and-drop/root/DataDragAndDropRoot.tsx +98 -0
- package/src/data/table/helpers/table-keyboard.ts +7 -3
- package/src/data/table/root/DataTableRoot.context.ts +13 -0
- package/src/data/table/root/DataTableRoot.tsx +16 -13
- package/src/data/table/th/DataTableTh.tsx +110 -54
- package/src/data/table/tr/DataTableTr.tsx +13 -2
- package/src/data/token-filter/AutoSuggest.tsx +142 -29
- package/src/data/token-filter/TokenFilter.tsx +174 -79
- package/src/data/token-filter/TokenFilter.types.ts +70 -42
- package/src/data/token-filter/helpers/generate-autocomplete-options.test.ts +97 -97
- package/src/data/token-filter/helpers/generate-autocomplete-options.ts +31 -38
- package/src/data/token-filter/helpers/operators.test.ts +29 -29
- package/src/data/token-filter/helpers/operators.ts +16 -16
- package/src/data/token-filter/helpers/parse-query-text.test.ts +37 -35
- package/src/data/token-filter/helpers/parse-query-text.ts +7 -26
- package/src/data/token-filter/helpers/query-builder.ts +2 -2
- package/src/date/Date.Dialog.tsx +15 -0
- package/src/date/datepicker/DatePicker.tsx +3 -0
- package/src/date/datepicker/hooks/useDatepicker.tsx +7 -2
- package/src/date/datepicker/hooks/useRangeDatepicker.tsx +5 -1
- package/src/date/datepicker/parts/DatePicker.Months.tsx +9 -1
- package/src/date/datepicker/parts/DatePicker.RDP.tsx +7 -1
- package/src/date/monthpicker/MonthPicker.tsx +3 -1
- package/src/date/monthpicker/hooks/useMonthPicker.tsx +5 -1
- package/src/date/monthpicker/parts/MonthPicker.Caption.tsx +20 -2
- package/src/dropdown/Toggle.tsx +6 -12
- package/src/form/combobox/Input/Input.tsx +2 -2
- package/src/inline-message/root/InlineMessage.tsx +5 -5
- package/src/provider/Provider.tsx +2 -2
- package/src/tooltip/Tooltip.tsx +1 -3
- package/src/utils/components/HighlightText/HighlightText.tsx +34 -0
- package/src/utils/components/Listbox/group/ListboxGroup.tsx +26 -0
- package/src/utils/components/Listbox/input-slot/ListboxInputSlot.tsx +22 -0
- package/src/utils/components/Listbox/item/ListboxItem.tsx +57 -0
- package/src/utils/components/Listbox/list/ListboxList.tsx +38 -0
- package/src/utils/components/Listbox/root/ListboxRoot.tsx +104 -0
- package/src/utils/components/Listbox/root/domHelpers.ts +59 -0
- package/src/utils/components/focus-boundary/FocusBoundary.tsx +8 -78
- package/src/utils/helpers/focus.ts +75 -0
- package/src/utils/hooks/useDeferredValue.ts +12 -0
- package/cjs/data/table/th/DataTableThSortHandle.d.ts +0 -6
- package/cjs/data/table/th/DataTableThSortHandle.js +0 -82
- package/cjs/data/table/th/DataTableThSortHandle.js.map +0 -1
- package/esm/data/table/th/DataTableThSortHandle.d.ts +0 -6
- package/esm/data/table/th/DataTableThSortHandle.js +0 -47
- package/esm/data/table/th/DataTableThSortHandle.js.map +0 -1
- package/src/data/table/th/DataTableThSortHandle.tsx +0 -67
|
@@ -1,51 +1,53 @@
|
|
|
1
1
|
import { describe, expect, test } from "vitest";
|
|
2
2
|
import type { AutoCompleteOption } from "../AutoSuggest.types";
|
|
3
3
|
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
ExternalOption,
|
|
5
|
+
ExternalPropertyDefinition,
|
|
6
|
+
InternalParsedTextState,
|
|
7
|
+
InternalPropertyDefinition,
|
|
8
|
+
InternalPropertyOption,
|
|
8
9
|
} from "../TokenFilter.types";
|
|
9
10
|
import { generateAutoCompleteOptions } from "./generate-autocomplete-options";
|
|
10
|
-
import type { ParsedText } from "./parse-query-text";
|
|
11
11
|
|
|
12
|
-
const properties:
|
|
12
|
+
const properties: ExternalPropertyDefinition[] = [
|
|
13
13
|
{
|
|
14
|
-
|
|
14
|
+
groupLabel: "Status values",
|
|
15
15
|
group: "Metadata",
|
|
16
16
|
key: "status",
|
|
17
|
-
|
|
17
|
+
label: "Status",
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
|
|
20
|
+
groupLabel: "Region values",
|
|
21
21
|
group: "Location",
|
|
22
22
|
key: "region",
|
|
23
|
-
|
|
23
|
+
label: "Region",
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
|
|
26
|
+
groupLabel: "Type values",
|
|
27
27
|
group: "",
|
|
28
28
|
key: "type",
|
|
29
|
-
|
|
29
|
+
label: "Type",
|
|
30
30
|
},
|
|
31
31
|
];
|
|
32
32
|
|
|
33
|
-
const parsedProperties:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
const parsedProperties: InternalPropertyDefinition[] = properties.map(
|
|
34
|
+
(prop) => ({
|
|
35
|
+
key: prop.key,
|
|
36
|
+
label: prop.label,
|
|
37
|
+
groupLabel: prop.groupLabel ?? "",
|
|
38
|
+
group: prop.group ?? "",
|
|
39
|
+
externalProperty: prop,
|
|
40
|
+
operators: prop.operators ?? [],
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const statusOptions: ExternalOption[] = [
|
|
43
45
|
{ propertyKey: "status", value: "active", label: "Active" },
|
|
44
46
|
{ propertyKey: "status", value: "pending", label: "Pending" },
|
|
45
47
|
{ propertyKey: "status", value: "inactive", label: "Inactive" },
|
|
46
48
|
];
|
|
47
49
|
|
|
48
|
-
const regionOptions:
|
|
50
|
+
const regionOptions: ExternalOption[] = [
|
|
49
51
|
{
|
|
50
52
|
propertyKey: "region",
|
|
51
53
|
value: "us-east-1",
|
|
@@ -60,12 +62,10 @@ const regionOptions: QueryFilteringOption[] = [
|
|
|
60
62
|
},
|
|
61
63
|
];
|
|
62
64
|
|
|
63
|
-
const allOptions:
|
|
65
|
+
const allOptions: ExternalOption[] = [...statusOptions, ...regionOptions];
|
|
64
66
|
|
|
65
|
-
const parsedOptions:
|
|
66
|
-
const property = parsedProperties.find(
|
|
67
|
-
(p) => p.propertyKey === option.propertyKey,
|
|
68
|
-
);
|
|
67
|
+
const parsedOptions: InternalPropertyOption[] = allOptions.map((option) => {
|
|
68
|
+
const property = parsedProperties.find((p) => p.key === option.propertyKey);
|
|
69
69
|
return {
|
|
70
70
|
property: property || null,
|
|
71
71
|
value: option.value,
|
|
@@ -77,7 +77,7 @@ const parsedOptions: ParsedOption[] = allOptions.map((option) => {
|
|
|
77
77
|
describe("generateAutoCompleteOptions v2", () => {
|
|
78
78
|
describe("free-text step", () => {
|
|
79
79
|
test("empty value: should return all properties", () => {
|
|
80
|
-
const queryState:
|
|
80
|
+
const queryState: InternalParsedTextState = {
|
|
81
81
|
step: "free-text",
|
|
82
82
|
value: "",
|
|
83
83
|
};
|
|
@@ -102,7 +102,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
test("non-empty value: should return filtered properties and values", () => {
|
|
105
|
-
const queryState:
|
|
105
|
+
const queryState: InternalParsedTextState = {
|
|
106
106
|
step: "free-text",
|
|
107
107
|
value: "statu",
|
|
108
108
|
};
|
|
@@ -124,7 +124,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
test("non-empty value with operator '!:': should skip property suggestions", () => {
|
|
127
|
-
const queryState:
|
|
127
|
+
const queryState: InternalParsedTextState = {
|
|
128
128
|
step: "free-text",
|
|
129
129
|
value: "test",
|
|
130
130
|
operator: "!:",
|
|
@@ -144,7 +144,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
144
144
|
});
|
|
145
145
|
|
|
146
146
|
test("non-empty value: case-insensitive filtering", () => {
|
|
147
|
-
const queryState:
|
|
147
|
+
const queryState: InternalParsedTextState = {
|
|
148
148
|
step: "free-text",
|
|
149
149
|
value: "STATU",
|
|
150
150
|
};
|
|
@@ -166,7 +166,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
166
166
|
});
|
|
167
167
|
|
|
168
168
|
test("non-empty value: should match tags", () => {
|
|
169
|
-
const queryState:
|
|
169
|
+
const queryState: InternalParsedTextState = {
|
|
170
170
|
step: "free-text",
|
|
171
171
|
value: "europe",
|
|
172
172
|
};
|
|
@@ -183,12 +183,12 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
183
183
|
expect(valueGroup).toBeDefined();
|
|
184
184
|
expect(valueGroup?.options).toHaveLength(1);
|
|
185
185
|
expect((valueGroup?.options[0] as AutoCompleteOption).label).toBe(
|
|
186
|
-
"
|
|
186
|
+
"Region = eu-west-1",
|
|
187
187
|
);
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
test("non-empty value: whitespace-aware matching", () => {
|
|
191
|
-
const queryState:
|
|
191
|
+
const queryState: InternalParsedTextState = {
|
|
192
192
|
step: "free-text",
|
|
193
193
|
value: "us east",
|
|
194
194
|
};
|
|
@@ -205,7 +205,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
205
205
|
expect(valueGroup).toBeDefined();
|
|
206
206
|
expect(valueGroup?.options).toHaveLength(1);
|
|
207
207
|
expect((valueGroup?.options[0] as AutoCompleteOption).label).toBe(
|
|
208
|
-
"
|
|
208
|
+
"Region = us-east-1",
|
|
209
209
|
);
|
|
210
210
|
});
|
|
211
211
|
});
|
|
@@ -214,7 +214,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
214
214
|
const statusProperty = parsedProperties[0];
|
|
215
215
|
|
|
216
216
|
test("empty value: should return all values for selected property", () => {
|
|
217
|
-
const queryState:
|
|
217
|
+
const queryState: InternalParsedTextState = {
|
|
218
218
|
step: "property",
|
|
219
219
|
property: statusProperty,
|
|
220
220
|
operator: "=",
|
|
@@ -234,7 +234,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
234
234
|
});
|
|
235
235
|
|
|
236
236
|
test("non-empty value: should return filtered values", () => {
|
|
237
|
-
const queryState:
|
|
237
|
+
const queryState: InternalParsedTextState = {
|
|
238
238
|
step: "property",
|
|
239
239
|
property: statusProperty,
|
|
240
240
|
operator: "=",
|
|
@@ -251,12 +251,12 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
251
251
|
expect(result.options).toHaveLength(1);
|
|
252
252
|
expect(result.options[0].options).toHaveLength(2);
|
|
253
253
|
const labels = result.options[0].options.map((o) => o.label);
|
|
254
|
-
expect(labels).toContain("
|
|
255
|
-
expect(labels).toContain("
|
|
254
|
+
expect(labels).toContain("Status = active");
|
|
255
|
+
expect(labels).toContain("Status = inactive");
|
|
256
256
|
});
|
|
257
257
|
|
|
258
258
|
test("should use specified operator in value suggestions", () => {
|
|
259
|
-
const queryState:
|
|
259
|
+
const queryState: InternalParsedTextState = {
|
|
260
260
|
step: "property",
|
|
261
261
|
property: statusProperty,
|
|
262
262
|
operator: "!=",
|
|
@@ -279,7 +279,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
279
279
|
const statusProperty = parsedProperties[0];
|
|
280
280
|
|
|
281
281
|
test("empty prefix: should return all operators", () => {
|
|
282
|
-
const queryState:
|
|
282
|
+
const queryState: InternalParsedTextState = {
|
|
283
283
|
step: "operator",
|
|
284
284
|
property: statusProperty,
|
|
285
285
|
operatorPrefix: "",
|
|
@@ -297,7 +297,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
297
297
|
});
|
|
298
298
|
|
|
299
299
|
test("operator prefix '!': should filter operators starting with '!'", () => {
|
|
300
|
-
const queryState:
|
|
300
|
+
const queryState: InternalParsedTextState = {
|
|
301
301
|
step: "operator",
|
|
302
302
|
property: statusProperty,
|
|
303
303
|
operatorPrefix: "!",
|
|
@@ -319,7 +319,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
319
319
|
});
|
|
320
320
|
|
|
321
321
|
test("operator prefix '>=': should filter to single operator", () => {
|
|
322
|
-
const queryState:
|
|
322
|
+
const queryState: InternalParsedTextState = {
|
|
323
323
|
step: "operator",
|
|
324
324
|
property: statusProperty,
|
|
325
325
|
operatorPrefix: ">=",
|
|
@@ -339,7 +339,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
339
339
|
});
|
|
340
340
|
|
|
341
341
|
test("invalid prefix: should return empty suggestions", () => {
|
|
342
|
-
const queryState:
|
|
342
|
+
const queryState: InternalParsedTextState = {
|
|
343
343
|
step: "operator",
|
|
344
344
|
property: statusProperty,
|
|
345
345
|
operatorPrefix: "invalid",
|
|
@@ -358,7 +358,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
358
358
|
|
|
359
359
|
describe("operator filtering by description", () => {
|
|
360
360
|
test("should filter operators by description text", () => {
|
|
361
|
-
const queryState:
|
|
361
|
+
const queryState: InternalParsedTextState = {
|
|
362
362
|
step: "operator",
|
|
363
363
|
property: parsedProperties[0],
|
|
364
364
|
operatorPrefix: "",
|
|
@@ -379,7 +379,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
379
379
|
|
|
380
380
|
describe("empty groups filtering", () => {
|
|
381
381
|
test("should not return empty option groups", () => {
|
|
382
|
-
const queryState:
|
|
382
|
+
const queryState: InternalParsedTextState = {
|
|
383
383
|
step: "free-text",
|
|
384
384
|
value: "nonexistent",
|
|
385
385
|
};
|
|
@@ -398,7 +398,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
398
398
|
|
|
399
399
|
describe("value suggestions use correct operator", () => {
|
|
400
400
|
test("free-text step uses '=' operator for all values", () => {
|
|
401
|
-
const queryState:
|
|
401
|
+
const queryState: InternalParsedTextState = {
|
|
402
402
|
step: "free-text",
|
|
403
403
|
value: "active",
|
|
404
404
|
};
|
|
@@ -419,7 +419,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
419
419
|
});
|
|
420
420
|
|
|
421
421
|
test("property step uses selected operator", () => {
|
|
422
|
-
const queryState:
|
|
422
|
+
const queryState: InternalParsedTextState = {
|
|
423
423
|
step: "property",
|
|
424
424
|
property: parsedProperties[0],
|
|
425
425
|
operator: "!:",
|
|
@@ -440,20 +440,20 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
440
440
|
|
|
441
441
|
describe("custom operators configuration", () => {
|
|
442
442
|
test("property with string-format operators should filter to only those operators", () => {
|
|
443
|
-
const propertyWithCustomOps:
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
443
|
+
const propertyWithCustomOps: InternalPropertyDefinition = {
|
|
444
|
+
key: "custom",
|
|
445
|
+
label: "Custom",
|
|
446
|
+
groupLabel: "Custom values",
|
|
447
|
+
group: "Custom",
|
|
448
448
|
operators: ["=", "!="],
|
|
449
449
|
externalProperty: {
|
|
450
450
|
key: "custom",
|
|
451
|
-
|
|
451
|
+
label: "Custom",
|
|
452
452
|
operators: ["=", "!="],
|
|
453
453
|
},
|
|
454
454
|
};
|
|
455
455
|
|
|
456
|
-
const queryState:
|
|
456
|
+
const queryState: InternalParsedTextState = {
|
|
457
457
|
step: "operator",
|
|
458
458
|
property: propertyWithCustomOps,
|
|
459
459
|
operatorPrefix: "",
|
|
@@ -473,26 +473,26 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
473
473
|
});
|
|
474
474
|
|
|
475
475
|
test("property with object-format operators should extract operator strings", () => {
|
|
476
|
-
const propertyWithObjectOps:
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
476
|
+
const propertyWithObjectOps: InternalPropertyDefinition = {
|
|
477
|
+
key: "custom2",
|
|
478
|
+
label: "Custom2",
|
|
479
|
+
groupLabel: "Custom2 values",
|
|
480
|
+
group: "Custom",
|
|
481
481
|
operators: [
|
|
482
|
-
{ operator: ":",
|
|
483
|
-
{ operator: "!:",
|
|
482
|
+
{ operator: ":", type: "single" },
|
|
483
|
+
{ operator: "!:", type: "single" },
|
|
484
484
|
],
|
|
485
485
|
externalProperty: {
|
|
486
486
|
key: "custom2",
|
|
487
|
-
|
|
487
|
+
label: "Custom2",
|
|
488
488
|
operators: [
|
|
489
|
-
{ operator: ":",
|
|
490
|
-
{ operator: "!:",
|
|
489
|
+
{ operator: ":", type: "single" },
|
|
490
|
+
{ operator: "!:", type: "single" },
|
|
491
491
|
],
|
|
492
492
|
},
|
|
493
493
|
};
|
|
494
494
|
|
|
495
|
-
const queryState:
|
|
495
|
+
const queryState: InternalParsedTextState = {
|
|
496
496
|
step: "operator",
|
|
497
497
|
property: propertyWithObjectOps,
|
|
498
498
|
operatorPrefix: "",
|
|
@@ -512,28 +512,28 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
512
512
|
});
|
|
513
513
|
|
|
514
514
|
test("property with mixed operator formats should normalize and filter", () => {
|
|
515
|
-
const propertyWithMixedOps:
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
515
|
+
const propertyWithMixedOps: InternalPropertyDefinition = {
|
|
516
|
+
key: "mixed",
|
|
517
|
+
label: "Mixed",
|
|
518
|
+
groupLabel: "Mixed values",
|
|
519
|
+
group: "Custom",
|
|
520
520
|
operators: [
|
|
521
521
|
"=",
|
|
522
|
-
{ operator: "!=",
|
|
522
|
+
{ operator: "!=", type: "single" },
|
|
523
523
|
"invalid-operator",
|
|
524
524
|
],
|
|
525
525
|
externalProperty: {
|
|
526
526
|
key: "mixed",
|
|
527
|
-
|
|
527
|
+
label: "Mixed",
|
|
528
528
|
operators: [
|
|
529
529
|
"=",
|
|
530
|
-
{ operator: "!=",
|
|
530
|
+
{ operator: "!=", type: "single" },
|
|
531
531
|
"invalid-operator",
|
|
532
532
|
],
|
|
533
533
|
},
|
|
534
534
|
};
|
|
535
535
|
|
|
536
|
-
const queryState:
|
|
536
|
+
const queryState: InternalParsedTextState = {
|
|
537
537
|
step: "operator",
|
|
538
538
|
property: propertyWithMixedOps,
|
|
539
539
|
operatorPrefix: "",
|
|
@@ -555,7 +555,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
555
555
|
|
|
556
556
|
describe("edge case: operator without value", () => {
|
|
557
557
|
test("should return empty options when operator is present but value is empty", () => {
|
|
558
|
-
const queryState:
|
|
558
|
+
const queryState: InternalParsedTextState = {
|
|
559
559
|
step: "free-text",
|
|
560
560
|
value: "",
|
|
561
561
|
operator: "!=",
|
|
@@ -572,7 +572,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
572
572
|
});
|
|
573
573
|
|
|
574
574
|
test("should return empty options when operator-start input has no value", () => {
|
|
575
|
-
const queryState:
|
|
575
|
+
const queryState: InternalParsedTextState = {
|
|
576
576
|
step: "free-text",
|
|
577
577
|
value: "",
|
|
578
578
|
operator: ":",
|
|
@@ -593,7 +593,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
593
593
|
test("scoped to property should only show values from that property", () => {
|
|
594
594
|
const statusProperty = parsedProperties[0];
|
|
595
595
|
|
|
596
|
-
const queryState:
|
|
596
|
+
const queryState: InternalParsedTextState = {
|
|
597
597
|
step: "property",
|
|
598
598
|
property: statusProperty,
|
|
599
599
|
operator: "=",
|
|
@@ -615,7 +615,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
615
615
|
});
|
|
616
616
|
|
|
617
617
|
test("non-scoped (free-text) with empty value should show all properties", () => {
|
|
618
|
-
const queryState:
|
|
618
|
+
const queryState: InternalParsedTextState = {
|
|
619
619
|
step: "free-text",
|
|
620
620
|
value: "",
|
|
621
621
|
};
|
|
@@ -635,7 +635,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
635
635
|
test("scoped property search should not include property labels in search fields", () => {
|
|
636
636
|
const statusProperty = parsedProperties[0];
|
|
637
637
|
|
|
638
|
-
const queryState:
|
|
638
|
+
const queryState: InternalParsedTextState = {
|
|
639
639
|
step: "property",
|
|
640
640
|
property: statusProperty,
|
|
641
641
|
operator: "=",
|
|
@@ -652,7 +652,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
652
652
|
});
|
|
653
653
|
|
|
654
654
|
test("non-scoped search should include property labels in search", () => {
|
|
655
|
-
const queryState:
|
|
655
|
+
const queryState: InternalParsedTextState = {
|
|
656
656
|
step: "free-text",
|
|
657
657
|
value: "region",
|
|
658
658
|
};
|
|
@@ -672,19 +672,19 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
672
672
|
|
|
673
673
|
describe("properties with no groupValuesLabel", () => {
|
|
674
674
|
test("should default to 'Values' when groupValuesLabel is empty", () => {
|
|
675
|
-
const propertyWithoutGroupLabel:
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
675
|
+
const propertyWithoutGroupLabel: InternalPropertyDefinition = {
|
|
676
|
+
key: "nogroup",
|
|
677
|
+
label: "NoGroup",
|
|
678
|
+
groupLabel: "",
|
|
679
|
+
group: "Custom",
|
|
680
680
|
operators: [],
|
|
681
681
|
externalProperty: {
|
|
682
682
|
key: "nogroup",
|
|
683
|
-
|
|
683
|
+
label: "NoGroup",
|
|
684
684
|
},
|
|
685
685
|
};
|
|
686
686
|
|
|
687
|
-
const optionsForProperty:
|
|
687
|
+
const optionsForProperty: InternalPropertyOption[] = [
|
|
688
688
|
{
|
|
689
689
|
property: propertyWithoutGroupLabel,
|
|
690
690
|
value: "val1",
|
|
@@ -693,7 +693,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
693
693
|
},
|
|
694
694
|
];
|
|
695
695
|
|
|
696
|
-
const queryState:
|
|
696
|
+
const queryState: InternalParsedTextState = {
|
|
697
697
|
step: "property",
|
|
698
698
|
property: propertyWithoutGroupLabel,
|
|
699
699
|
operator: "=",
|
|
@@ -712,7 +712,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
712
712
|
|
|
713
713
|
describe("null or missing property references", () => {
|
|
714
714
|
test("should skip options with null property reference", () => {
|
|
715
|
-
const optionsWithNull:
|
|
715
|
+
const optionsWithNull: InternalPropertyOption[] = [
|
|
716
716
|
{
|
|
717
717
|
property: null,
|
|
718
718
|
value: "orphaned",
|
|
@@ -722,7 +722,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
722
722
|
...parsedOptions,
|
|
723
723
|
];
|
|
724
724
|
|
|
725
|
-
const queryState:
|
|
725
|
+
const queryState: InternalParsedTextState = {
|
|
726
726
|
step: "free-text",
|
|
727
727
|
value: "orphaned",
|
|
728
728
|
};
|
|
@@ -740,7 +740,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
740
740
|
});
|
|
741
741
|
|
|
742
742
|
test("should skip properties with no data", () => {
|
|
743
|
-
const queryState:
|
|
743
|
+
const queryState: InternalParsedTextState = {
|
|
744
744
|
step: "free-text",
|
|
745
745
|
value: "",
|
|
746
746
|
};
|
|
@@ -753,7 +753,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
753
753
|
|
|
754
754
|
describe("operator prefix filtering", () => {
|
|
755
755
|
test("prefix ':' should match ':' and '!:' operators", () => {
|
|
756
|
-
const queryState:
|
|
756
|
+
const queryState: InternalParsedTextState = {
|
|
757
757
|
step: "operator",
|
|
758
758
|
property: parsedProperties[0],
|
|
759
759
|
operatorPrefix: ":",
|
|
@@ -773,7 +773,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
773
773
|
});
|
|
774
774
|
|
|
775
775
|
test("prefix '>' should match '>', '>=', '!>' operators", () => {
|
|
776
|
-
const queryState:
|
|
776
|
+
const queryState: InternalParsedTextState = {
|
|
777
777
|
step: "operator",
|
|
778
778
|
property: parsedProperties[0],
|
|
779
779
|
operatorPrefix: ">",
|
|
@@ -796,7 +796,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
796
796
|
|
|
797
797
|
describe("buildQueryString integration", () => {
|
|
798
798
|
test("query string should contain property, operator, and value", () => {
|
|
799
|
-
const queryState:
|
|
799
|
+
const queryState: InternalParsedTextState = {
|
|
800
800
|
step: "property",
|
|
801
801
|
property: parsedProperties[0],
|
|
802
802
|
operator: "=",
|
|
@@ -818,7 +818,7 @@ describe("generateAutoCompleteOptions v2", () => {
|
|
|
818
818
|
});
|
|
819
819
|
|
|
820
820
|
test("operator-step value should only contain property and operator", () => {
|
|
821
|
-
const queryState:
|
|
821
|
+
const queryState: InternalParsedTextState = {
|
|
822
822
|
step: "operator",
|
|
823
823
|
property: parsedProperties[0],
|
|
824
824
|
operatorPrefix: "=",
|