@cloudscape-design/components 3.0.406 → 3.0.407

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.
Files changed (38) hide show
  1. package/breadcrumb-group/internal.d.ts.map +1 -1
  2. package/breadcrumb-group/internal.js +2 -1
  3. package/breadcrumb-group/internal.js.map +1 -1
  4. package/breadcrumb-group/item/item.d.ts.map +1 -1
  5. package/breadcrumb-group/item/item.js +8 -8
  6. package/breadcrumb-group/item/item.js.map +1 -1
  7. package/header/internal.d.ts.map +1 -1
  8. package/header/internal.js +1 -1
  9. package/header/internal.js.map +1 -1
  10. package/header/styles.css.js +34 -33
  11. package/header/styles.scoped.css +53 -49
  12. package/header/styles.selectors.js +34 -33
  13. package/internal/environment.js +1 -1
  14. package/internal/environment.json +1 -1
  15. package/internal/manifest.json +1 -1
  16. package/package.json +1 -1
  17. package/property-filter/controller.d.ts +3 -4
  18. package/property-filter/controller.d.ts.map +1 -1
  19. package/property-filter/controller.js +7 -10
  20. package/property-filter/controller.js.map +1 -1
  21. package/property-filter/index.d.ts.map +1 -1
  22. package/property-filter/index.js +48 -37
  23. package/property-filter/index.js.map +1 -1
  24. package/property-filter/interfaces.d.ts +10 -1
  25. package/property-filter/interfaces.d.ts.map +1 -1
  26. package/property-filter/interfaces.js.map +1 -1
  27. package/property-filter/token-editor.d.ts +4 -4
  28. package/property-filter/token-editor.d.ts.map +1 -1
  29. package/property-filter/token-editor.js +25 -20
  30. package/property-filter/token-editor.js.map +1 -1
  31. package/property-filter/token.d.ts +4 -4
  32. package/property-filter/token.d.ts.map +1 -1
  33. package/property-filter/token.js +6 -5
  34. package/property-filter/token.js.map +1 -1
  35. package/property-filter/utils.d.ts +4 -5
  36. package/property-filter/utils.d.ts.map +1 -1
  37. package/property-filter/utils.js +11 -16
  38. package/property-filter/utils.js.map +1 -1
@@ -2,38 +2,39 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_2qdw9_d8n9o_93",
6
- "refresh": "awsui_refresh_2qdw9_d8n9o_110",
7
- "root-no-actions": "awsui_root-no-actions_2qdw9_d8n9o_110",
8
- "root-variant-h2": "awsui_root-variant-h2_2qdw9_d8n9o_113",
9
- "root-variant-h3": "awsui_root-variant-h3_2qdw9_d8n9o_113",
10
- "root-has-description": "awsui_root-has-description_2qdw9_d8n9o_113",
11
- "root-variant-h1": "awsui_root-variant-h1_2qdw9_d8n9o_122",
12
- "main": "awsui_main_2qdw9_d8n9o_132",
13
- "no-wrap": "awsui_no-wrap_2qdw9_d8n9o_142",
14
- "main-variant-h1": "awsui_main-variant-h1_2qdw9_d8n9o_148",
15
- "actions": "awsui_actions_2qdw9_d8n9o_156",
16
- "actions-variant-h1": "awsui_actions-variant-h1_2qdw9_d8n9o_160",
17
- "actions-variant-h2": "awsui_actions-variant-h2_2qdw9_d8n9o_163",
18
- "actions-variant-h3": "awsui_actions-variant-h3_2qdw9_d8n9o_166",
19
- "title": "awsui_title_2qdw9_d8n9o_179",
20
- "title-variant-h1": "awsui_title-variant-h1_2qdw9_d8n9o_184",
21
- "title-variant-h2": "awsui_title-variant-h2_2qdw9_d8n9o_191",
22
- "title-variant-h3": "awsui_title-variant-h3_2qdw9_d8n9o_197",
23
- "virtual-space": "awsui_virtual-space_2qdw9_d8n9o_218",
24
- "info": "awsui_info_2qdw9_d8n9o_224",
25
- "description": "awsui_description_2qdw9_d8n9o_228",
26
- "description-variant-h1": "awsui_description-variant-h1_2qdw9_d8n9o_233",
27
- "description-variant-h2": "awsui_description-variant-h2_2qdw9_d8n9o_237",
28
- "description-variant-h3": "awsui_description-variant-h3_2qdw9_d8n9o_244",
29
- "heading": "awsui_heading_2qdw9_d8n9o_253",
30
- "heading-variant-h1": "awsui_heading-variant-h1_2qdw9_d8n9o_262",
31
- "heading-variant-h2": "awsui_heading-variant-h2_2qdw9_d8n9o_267",
32
- "heading-variant-h3": "awsui_heading-variant-h3_2qdw9_d8n9o_272",
33
- "heading-text": "awsui_heading-text_2qdw9_d8n9o_278",
34
- "heading-text-variant-h1": "awsui_heading-text-variant-h1_2qdw9_d8n9o_281",
35
- "heading-text-variant-h2": "awsui_heading-text-variant-h2_2qdw9_d8n9o_289",
36
- "heading-text-variant-h3": "awsui_heading-text-variant-h3_2qdw9_d8n9o_297",
37
- "counter": "awsui_counter_2qdw9_d8n9o_306"
5
+ "root": "awsui_root_2qdw9_1xihu_93",
6
+ "refresh": "awsui_refresh_2qdw9_1xihu_110",
7
+ "root-no-actions": "awsui_root-no-actions_2qdw9_1xihu_110",
8
+ "root-variant-h2": "awsui_root-variant-h2_2qdw9_1xihu_113",
9
+ "root-variant-h3": "awsui_root-variant-h3_2qdw9_1xihu_113",
10
+ "root-has-description": "awsui_root-has-description_2qdw9_1xihu_113",
11
+ "root-variant-h1": "awsui_root-variant-h1_2qdw9_1xihu_122",
12
+ "main": "awsui_main_2qdw9_1xihu_132",
13
+ "no-wrap": "awsui_no-wrap_2qdw9_1xihu_142",
14
+ "main-variant-h1": "awsui_main-variant-h1_2qdw9_1xihu_148",
15
+ "actions": "awsui_actions_2qdw9_1xihu_156",
16
+ "actions-centered": "awsui_actions-centered_2qdw9_1xihu_161",
17
+ "actions-variant-h1": "awsui_actions-variant-h1_2qdw9_1xihu_164",
18
+ "actions-variant-h2": "awsui_actions-variant-h2_2qdw9_1xihu_167",
19
+ "actions-variant-h3": "awsui_actions-variant-h3_2qdw9_1xihu_170",
20
+ "title": "awsui_title_2qdw9_1xihu_183",
21
+ "title-variant-h1": "awsui_title-variant-h1_2qdw9_1xihu_188",
22
+ "title-variant-h2": "awsui_title-variant-h2_2qdw9_1xihu_195",
23
+ "title-variant-h3": "awsui_title-variant-h3_2qdw9_1xihu_201",
24
+ "virtual-space": "awsui_virtual-space_2qdw9_1xihu_222",
25
+ "info": "awsui_info_2qdw9_1xihu_228",
26
+ "description": "awsui_description_2qdw9_1xihu_232",
27
+ "description-variant-h1": "awsui_description-variant-h1_2qdw9_1xihu_237",
28
+ "description-variant-h2": "awsui_description-variant-h2_2qdw9_1xihu_241",
29
+ "description-variant-h3": "awsui_description-variant-h3_2qdw9_1xihu_248",
30
+ "heading": "awsui_heading_2qdw9_1xihu_257",
31
+ "heading-variant-h1": "awsui_heading-variant-h1_2qdw9_1xihu_266",
32
+ "heading-variant-h2": "awsui_heading-variant-h2_2qdw9_1xihu_271",
33
+ "heading-variant-h3": "awsui_heading-variant-h3_2qdw9_1xihu_276",
34
+ "heading-text": "awsui_heading-text_2qdw9_1xihu_282",
35
+ "heading-text-variant-h1": "awsui_heading-text-variant-h1_2qdw9_1xihu_285",
36
+ "heading-text-variant-h2": "awsui_heading-text-variant-h2_2qdw9_1xihu_293",
37
+ "heading-text-variant-h3": "awsui_heading-text-variant-h3_2qdw9_1xihu_301",
38
+ "counter": "awsui_counter_2qdw9_1xihu_310"
38
39
  };
39
40
 
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (34c95dd9)";
2
+ export var PACKAGE_VERSION = "3.0.0 (73ce333a)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (34c95dd9)",
3
+ "PACKAGE_VERSION": "3.0.0 (73ce333a)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "34c95dd9f736f9079e384902b006a705cc62dea7"
2
+ "commit": "73ce333aa6aeee360c1119b1e1d57549e905d112"
3
3
  }
package/package.json CHANGED
@@ -112,7 +112,7 @@
112
112
  "./internal/base-component/index.js",
113
113
  "./internal/base-component/styles.css.js"
114
114
  ],
115
- "version": "3.0.406",
115
+ "version": "3.0.407",
116
116
  "repository": {
117
117
  "type": "git",
118
118
  "url": "https://github.com/cloudscape-design/components.git"
@@ -9,16 +9,15 @@ export declare const getQueryActions: (query: Query, onChange: NonCancelableEven
9
9
  setOperation: (newOperation: JoinOperation) => void;
10
10
  };
11
11
  export declare const getAllowedOperators: (property: InternalFilteringProperty) => ComparisonOperator[];
12
- export declare const parseText: (filteringText: string, filteringProperties: readonly InternalFilteringProperty<any>[] | undefined, disableFreeTextFiltering: boolean) => ParsedText;
13
- export declare const getPropertyOptions: (filteringProperty: InternalFilteringProperty, filteringOptions: readonly InternalFilteringOption[]) => InternalFilteringOption[];
12
+ export declare const parseText: (filteringText: string, filteringProperties: readonly InternalFilteringProperty[], disableFreeTextFiltering: boolean) => ParsedText;
14
13
  interface OptionGroup<T> {
15
14
  label: string;
16
15
  options: T[];
17
16
  }
18
- export declare const getAllValueSuggestions: (filteringOptions: readonly InternalFilteringOption[], filteringProperties: readonly InternalFilteringProperty[], operator: ComparisonOperator | undefined, i18nStrings: I18nStrings, customGroupsText: readonly GroupText[]) => OptionGroup<import("../internal/components/option/interfaces").OptionDefinition>[];
17
+ export declare const getAllValueSuggestions: (filteringOptions: readonly InternalFilteringOption[], operator: ComparisonOperator | undefined, i18nStrings: I18nStrings, customGroupsText: readonly GroupText[]) => OptionGroup<import("../internal/components/option/interfaces").OptionDefinition>[];
19
18
  export declare function createPropertiesCompatibilityMap(filteringProperties: readonly InternalFilteringProperty[]): (propertyA: string, propertyB: string) => boolean;
20
19
  export declare function getPropertySuggestions<T>(filteringProperties: readonly InternalFilteringProperty[], customGroupsText: readonly GroupText[], i18nStrings: I18nStrings, filteringPropertyToOption: (filteringProperty: InternalFilteringProperty) => T): OptionGroup<T>[];
21
- export declare const getAutosuggestOptions: (parsedText: ParsedText, filteringOptions: readonly InternalFilteringOption[], filteringProperties: readonly InternalFilteringProperty[], customGroupsText: readonly GroupText[], i18nStrings: I18nStrings) => {
20
+ export declare const getAutosuggestOptions: (parsedText: ParsedText, filteringProperties: readonly InternalFilteringProperty[], filteringOptions: readonly InternalFilteringOption[], customGroupsText: readonly GroupText[], i18nStrings: I18nStrings) => {
22
21
  filterText: string;
23
22
  options: {
24
23
  options: {
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"lib/default/","sources":["property-filter/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAElB,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,aAAa,EACb,UAAU,EACV,KAAK,EACL,KAAK,EACN,MAAM,cAAc,CAAC;AACtB,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAUvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,eAAO,MAAM,eAAe,UACnB,KAAK,YACF,0BAA0B,KAAK,CAAC,YAChC,MAAM,SAAS,CAAC,mBAAmB,CAAC;sBAKrB,MAAM,YAAY,KAAK;yBAOpB,MAAM;;yBASN,KAAK;iCAKG,aAAa;CAUlD,CAAC;AAEF,eAAO,MAAM,mBAAmB,aAAc,yBAAyB,KAAG,kBAAkB,EAK3F,CAAC;AAQF,eAAO,MAAM,SAAS,kBACL,MAAM,wGAEK,OAAO,KAChC,UA0CF,CAAC;AAEF,eAAO,MAAM,kBAAkB,sBACV,yBAAyB,oBAC1B,SAAS,uBAAuB,EAAE,8BAGrD,CAAC;AAEF,UAAU,WAAW,CAAC,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,EAAE,CAAC;CACd;AAED,eAAO,MAAM,sBAAsB,qBACf,SAAS,uBAAuB,EAAE,uBAC/B,SAAS,yBAAyB,EAAE,YAC/C,kBAAkB,GAAG,SAAS,eAC3B,WAAW,oBACN,SAAS,SAAS,EAAE,uFAmCvC,CAAC;AAEF,wBAAgB,gCAAgC,CAC9C,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,GACxD,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAA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AAE,CAAC;CACd;AAED,eAAO,MAAM,sBAAsB,qBACf,SAAS,uBAAuB,EAAE,YAC1C,kBAAkB,GAAG,SAAS,eAC3B,WAAW,oBACN,SAAS,SAAS,EAAE,uFAmCvC,CAAC;AAEF,wBAAgB,gCAAgC,CAC9C,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,GACxD,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAyBnD;AAQD,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,EACzD,gBAAgB,EAAE,SAAS,SAAS,EAAE,EACtC,WAAW,EAAE,WAAW,EACxB,yBAAyB,EAAE,CAAC,iBAAiB,EAAE,yBAAyB,KAAK,CAAC,oBA0B/E;AAED,eAAO,MAAM,qBAAqB,eACpB,UAAU,uBACD,SAAS,yBAAyB,EAAE,oBACvC,SAAS,uBAAuB,EAAE,oBAClC,SAAS,SAAS,EAAE,eACzB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DzB,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,kBAAkB,eAAe,WAAW,uBA0B3F,CAAC"}
@@ -1,7 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { fireNonCancelableEvent } from '../internal/events';
4
- import { getPropertyByKey, matchFilteringProperty, matchOperator, matchOperatorPrefix, trimFirstSpace, trimStart, } from './utils';
4
+ import { matchFilteringProperty, matchOperator, matchOperatorPrefix, trimFirstSpace, trimStart } from './utils';
5
5
  export const getQueryActions = (query, onChange, inputRef) => {
6
6
  const { tokens, operation } = query;
7
7
  const fireOnChange = (tokens, operation) => fireNonCancelableEvent(onChange, { tokens, operation });
@@ -51,7 +51,7 @@ export const getAllowedOperators = (property) => {
51
51
  * - "operator": means that a filter on a particular column is being added, with operator not yet finalized
52
52
  * - "free-text": means that a "free text" token is being added
53
53
  */
54
- export const parseText = (filteringText, filteringProperties = [], disableFreeTextFiltering) => {
54
+ export const parseText = (filteringText, filteringProperties, disableFreeTextFiltering) => {
55
55
  const negatedGlobalQuery = /^(!:|!)(.*)/.exec(filteringText);
56
56
  if (!disableFreeTextFiltering && negatedGlobalQuery) {
57
57
  return {
@@ -89,10 +89,7 @@ export const parseText = (filteringText, filteringProperties = [], disableFreeTe
89
89
  value: filteringText,
90
90
  };
91
91
  };
92
- export const getPropertyOptions = (filteringProperty, filteringOptions) => {
93
- return filteringOptions.filter(option => option.propertyKey === filteringProperty.propertyKey);
94
- };
95
- export const getAllValueSuggestions = (filteringOptions, filteringProperties, operator = '=', i18nStrings, customGroupsText) => {
92
+ export const getAllValueSuggestions = (filteringOptions, operator = '=', i18nStrings, customGroupsText) => {
96
93
  var _a;
97
94
  const defaultGroup = {
98
95
  label: (_a = i18nStrings.groupValuesText) !== null && _a !== void 0 ? _a : '',
@@ -100,7 +97,7 @@ export const getAllValueSuggestions = (filteringOptions, filteringProperties, op
100
97
  };
101
98
  const customGroups = {};
102
99
  filteringOptions.forEach(filteringOption => {
103
- const property = getPropertyByKey(filteringProperties, filteringOption.propertyKey);
100
+ const property = filteringOption.property;
104
101
  // given option refers to a non-existent filtering property
105
102
  if (!property) {
106
103
  return;
@@ -175,11 +172,11 @@ export function getPropertySuggestions(filteringProperties, customGroupsText, i1
175
172
  const customGroupsArray = Object.keys(customGroups).map(groupKey => customGroups[groupKey]);
176
173
  return [...defaultGroupArray, ...customGroupsArray];
177
174
  }
178
- export const getAutosuggestOptions = (parsedText, filteringOptions, filteringProperties, customGroupsText, i18nStrings) => {
175
+ export const getAutosuggestOptions = (parsedText, filteringProperties, filteringOptions, customGroupsText, i18nStrings) => {
179
176
  switch (parsedText.step) {
180
177
  case 'property': {
181
178
  const { propertyLabel, groupValuesLabel } = parsedText.property;
182
- const options = getPropertyOptions(parsedText.property, filteringOptions);
179
+ const options = filteringOptions.filter(o => o.property === parsedText.property);
183
180
  return {
184
181
  filterText: parsedText.value,
185
182
  options: [
@@ -221,7 +218,7 @@ export const getAutosuggestOptions = (parsedText, filteringOptions, filteringPro
221
218
  ? getPropertySuggestions(filteringProperties, customGroupsText, i18nStrings, filteringPropertyToAutosuggestOption)
222
219
  : []),
223
220
  ...(needsValueSuggestions
224
- ? getAllValueSuggestions(filteringOptions, filteringProperties, parsedText.operator, i18nStrings, customGroupsText)
221
+ ? getAllValueSuggestions(filteringOptions, parsedText.operator, i18nStrings, customGroupsText)
225
222
  : []),
226
223
  ],
227
224
  };
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"lib/default/","sources":["property-filter/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AActC,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AAEvF,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,SAAS,GACV,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAY,EACZ,QAA0C,EAC1C,QAA8C,EAC9C,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,YAAY,GAAG,CAAC,MAAwB,EAAE,SAAwB,EAAE,EAAE,CAC1E,sBAAsB,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,QAAe,EAAE,EAAE;QAClD,MAAM,SAAS,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;QAC9B,IAAI,SAAS,IAAI,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE;YACzC,SAAS,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;SAC7B;QACD,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC,CAAC;IACF,MAAM,W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,CAAC,oBAAoB,CAAC;QAC1C,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,0BAA0B,CAAC;QAChD,KAAK,GAAG;YACN,OAAO,WAAW,CAAC,kBAAkB,CAAC;QACxC,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,wBAAwB,CAAC;QAC9C,KAAK,GAAG;YACN,OAAO,WAAW,CAAC,sBAAsB,CAAC;QAC5C,iEAAiE;QACjE,sFAAsF;QACtF,0BAA0B;QAC1B;YACE,OAAO,EAAE,CAAC;KACb;AACH,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ComparisonOperator,\n ExtendedOperatorForm,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n JoinOperation,\n ParsedText,\n Query,\n Token,\n} from './interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport {\n getPropertyByKey,\n matchFilteringProperty,\n matchOperator,\n matchOperatorPrefix,\n trimFirstSpace,\n trimStart,\n} from './utils';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\n\nexport const getQueryActions = (\n query: Query,\n onChange: NonCancelableEventHandler<Query>,\n inputRef: React.RefObject<AutosuggestInputRef>\n) => {\n const { tokens, operation } = query;\n const fireOnChange = (tokens: readonly Token[], operation: JoinOperation) =>\n fireNonCancelableEvent(onChange, { tokens, operation });\n const setToken = (index: number, newToken: Token) => {\n const newTokens = [...tokens];\n if (newTokens && index < newTokens.length) {\n newTokens[index] = newToken;\n }\n fireOnChange(newTokens, operation);\n };\n const removeToken = (index: number) => {\n const newTokens = tokens.filter((_, i) => i !== index);\n fireOnChange(newTokens, operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const removeAllTokens = () => {\n fireOnChange([], operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const addToken = (newToken: Token) => {\n const newTokens = [...tokens];\n newTokens.push(newToken);\n fireOnChange(newTokens, operation);\n };\n const setOperation = (newOperation: JoinOperation) => {\n fireOnChange(tokens, newOperation);\n };\n return {\n setToken,\n removeToken,\n removeAllTokens,\n addToken,\n setOperation,\n };\n};\n\nexport const getAllowedOperators = (property: InternalFilteringProperty): ComparisonOperator[] => {\n const { operators = [], defaultOperator } = property;\n const operatorOrder = ['=', '!=', ':', '!:', '^', '>=', '<=', '<', '>'] as const;\n const operatorSet = new Set([defaultOperator, ...operators]);\n return operatorOrder.filter(op => operatorSet.has(op));\n};\n\n/*\n * parses the value of the filtering input to figure out the current step of entering the token:\n * - \"property\": means that a filter on a particular column is being added, with operator already finalized\n * - \"operator\": means that a filter on a particular column is being added, with operator not yet finalized\n * - \"free-text\": means that a \"free text\" token is being added\n */\nexport const parseText = (\n filteringText: string,\n filteringProperties: readonly InternalFilteringProperty[] = [],\n disableFreeTextFiltering: boolean\n): ParsedText => {\n const negatedGlobalQuery = /^(!:|!)(.*)/.exec(filteringText);\n if (!disableFreeTextFiltering && negatedGlobalQuery) {\n return {\n step: 'free-text',\n operator: '!:',\n value: negatedGlobalQuery[2],\n };\n }\n\n const property = matchFilteringProperty(filteringProperties, filteringText);\n if (!property) {\n return {\n step: 'free-text',\n value: filteringText,\n };\n }\n\n const allowedOps = getAllowedOperators(property);\n\n const textWithoutProperty = filteringText.substring(property.propertyLabel.length);\n const operator = matchOperator(allowedOps, trimStart(textWithoutProperty));\n if (operator) {\n const operatorLastIndex = textWithoutProperty.indexOf(operator) + operator.length;\n const textWithoutPropertyAndOperator = textWithoutProperty.slice(operatorLastIndex);\n // We need to remove the first leading space in case the user presses space\n // after the operator, for example: Owner: admin, will result in value of ` admin`\n // and we need to remove the first space, if the user added any more spaces only the\n // first one will be removed.\n const value = trimFirstSpace(textWithoutPropertyAndOperator);\n return { step: 'property', property, operator, value };\n }\n\n const operatorPrefix = matchOperatorPrefix(allowedOps, trimStart(textWithoutProperty));\n if (operatorPrefix !== null) {\n return { step: 'operator', property, operatorPrefix };\n }\n\n return {\n step: 'free-text',\n value: filteringText,\n };\n};\n\nexport const getPropertyOptions = (\n filteringProperty: InternalFilteringProperty,\n filteringOptions: readonly InternalFilteringOption[]\n) => {\n return filteringOptions.filter(option => option.propertyKey === filteringProperty.propertyKey);\n};\n\ninterface OptionGroup<T> {\n label: string;\n options: T[];\n}\n\nexport const getAllValueSuggestions = (\n filteringOptions: readonly InternalFilteringOption[],\n filteringProperties: readonly InternalFilteringProperty[],\n operator: ComparisonOperator | undefined = '=',\n i18nStrings: I18nStrings,\n customGroupsText: readonly GroupText[]\n) => {\n const defaultGroup: OptionGroup<AutosuggestProps.Option> = {\n label: i18nStrings.groupValuesText ?? '',\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<AutosuggestProps.Option> } = {};\n filteringOptions.forEach(filteringOption => {\n const property = getPropertyByKey(filteringProperties, filteringOption.propertyKey);\n // given option refers to a non-existent filtering property\n if (!property) {\n return;\n }\n // this option's filtering property does not support current operator\n if (getAllowedOperators(property).indexOf(operator) === -1) {\n return;\n }\n if (property.propertyGroup && !customGroups[property.propertyGroup]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === property.propertyGroup ? customGroup.values : acc),\n ''\n );\n customGroups[property.propertyGroup] = {\n label,\n options: [],\n };\n }\n const propertyGroup = property.propertyGroup ? customGroups[property.propertyGroup] : defaultGroup;\n propertyGroup.options.push({\n value: property.propertyLabel + ' ' + (operator || '=') + ' ' + filteringOption.value,\n label: filteringOption.label,\n __labelPrefix: property.propertyLabel + ' ' + (operator || '='),\n });\n });\n return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];\n};\n\nexport function createPropertiesCompatibilityMap(\n filteringProperties: readonly InternalFilteringProperty[]\n): (propertyA: string, propertyB: string) => boolean {\n const lookup: {\n [propertyKey: string]: { operator: string; form: ExtendedOperatorForm<any> | null }[];\n } = {};\n\n for (const property of filteringProperties) {\n lookup[property.propertyKey] = (property.operators || [])\n .map(operator => ({ operator, form: property.getValueFormRenderer(operator) }))\n .sort((a, b) => a.operator.localeCompare(b.operator));\n }\n\n return (propertyA: string, propertyB: string) => {\n if (lookup[propertyA].length !== lookup[propertyB].length) {\n return false;\n }\n for (let i = 0; i < lookup[propertyA].length; i++) {\n if (lookup[propertyA][i].operator !== lookup[propertyB][i].operator) {\n return false;\n }\n if (lookup[propertyA][i].form !== lookup[propertyB][i].form) {\n return false;\n }\n }\n return true;\n };\n}\n\nconst filteringPropertyToAutosuggestOption = (filteringProperty: InternalFilteringProperty) => ({\n value: filteringProperty.propertyLabel,\n label: filteringProperty.propertyLabel,\n keepOpenOnSelect: true,\n});\n\nexport function getPropertySuggestions<T>(\n filteringProperties: readonly InternalFilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings,\n filteringPropertyToOption: (filteringProperty: InternalFilteringProperty) => T\n) {\n const defaultGroup: OptionGroup<T> = {\n label: i18nStrings.groupPropertiesText ?? '',\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<T> } = {};\n\n filteringProperties.forEach(filteringProperty => {\n const { propertyGroup } = filteringProperty;\n let optionsGroup = defaultGroup;\n if (propertyGroup) {\n if (!customGroups[propertyGroup]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === propertyGroup ? customGroup.properties : acc),\n ''\n );\n customGroups[propertyGroup] = { options: [], label };\n }\n optionsGroup = customGroups[propertyGroup];\n }\n optionsGroup.options.push(filteringPropertyToOption(filteringProperty));\n });\n const defaultGroupArray = defaultGroup.options.length ? [defaultGroup] : [];\n const customGroupsArray = Object.keys(customGroups).map(groupKey => customGroups[groupKey]);\n return [...defaultGroupArray, ...customGroupsArray];\n}\n\nexport const getAutosuggestOptions = (\n parsedText: ParsedText,\n filteringOptions: readonly InternalFilteringOption[],\n filteringProperties: readonly InternalFilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings\n) => {\n switch (parsedText.step) {\n case 'property': {\n const { propertyLabel, groupValuesLabel } = parsedText.property;\n const options = getPropertyOptions(parsedText.property, filteringOptions);\n return {\n filterText: parsedText.value,\n options: [\n {\n options: options.map(({ label, value }) => ({\n value: propertyLabel + ' ' + parsedText.operator + ' ' + value,\n label: label,\n __labelPrefix: propertyLabel + ' ' + parsedText.operator,\n })),\n label: groupValuesLabel,\n },\n ],\n };\n }\n case 'operator': {\n return {\n filterText: parsedText.property.propertyLabel + ' ' + parsedText.operatorPrefix,\n options: [\n ...getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n ),\n {\n options: getAllowedOperators(parsedText.property).map(value => ({\n value: parsedText.property.propertyLabel + ' ' + value + ' ',\n label: parsedText.property.propertyLabel + ' ' + value,\n description: operatorToDescription(value, i18nStrings),\n keepOpenOnSelect: true,\n })),\n label: i18nStrings.operatorsText,\n },\n ],\n };\n }\n case 'free-text': {\n const needsValueSuggestions = !!parsedText.value;\n const needsPropertySuggestions = !(parsedText.step === 'free-text' && parsedText.operator === '!:');\n return {\n filterText: parsedText.value,\n options: [\n ...(needsPropertySuggestions\n ? getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n )\n : []),\n ...(needsValueSuggestions\n ? getAllValueSuggestions(\n filteringOptions,\n filteringProperties,\n parsedText.operator,\n i18nStrings,\n customGroupsText\n )\n : []),\n ],\n };\n }\n }\n};\n\nexport const operatorToDescription = (operator: ComparisonOperator, i18nStrings: I18nStrings) => {\n switch (operator) {\n case '<':\n return i18nStrings.operatorLessText;\n case '<=':\n return i18nStrings.operatorLessOrEqualText;\n case '>':\n return i18nStrings.operatorGreaterText;\n case '>=':\n return i18nStrings.operatorGreaterOrEqualText;\n case ':':\n return i18nStrings.operatorContainsText;\n case '!:':\n return i18nStrings.operatorDoesNotContainText;\n case '=':\n return i18nStrings.operatorEqualsText;\n case '!=':\n return i18nStrings.operatorDoesNotEqualText;\n case '^':\n return i18nStrings.operatorStartsWithText;\n // The line is ignored from coverage because it is not reachable.\n // The purpose of it is to prevent TS errors if ComparisonOperator type gets extended.\n /* istanbul ignore next */\n default:\n return '';\n }\n};\n"]}
1
+ {"version":3,"file":"controller.js","sourceRoot":"lib/default/","sources":["property-filter/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AActC,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AAEvF,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGhH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAY,EACZ,QAA0C,EAC1C,QAA8C,EAC9C,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,YAAY,GAAG,CAAC,MAAwB,EAAE,SAAwB,EAAE,EAAE,CAC1E,sBAAsB,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,QAAe,EAAE,EAAE;QAClD,MAAM,SAAS,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;QAC9B,IAAI,SAAS,IAAI,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE;YACzC,SAAS,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;SAC7B;QACD,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC,CAAC;IACF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE;;QACpC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;QACvD,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACnC,MAAA,QAAQ,CAAC,OAAO,0CAAE,KAAK,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UAAU,CAAC,KAAK;gBAC5B,OAAO,EAAE;oBACP,GAAG,CAAC,wBAAwB;wBAC1B,CAAC,CAAC,sBAAsB,CACpB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,oCAAoC,CACrC;wBACH,CAAC,CAAC,EAAE,CAAC;oBACP,GAAG,CAAC,qBAAqB;wBACvB,CAAC,CAAC,sBAAsB,CAAC,gBAAgB,EAAE,UAAU,CAAC,QAAQ,EAAE,WAAW,EAAE,gBAAgB,CAAC;wBAC9F,CAAC,CAAC,EAAE,CAAC;iBACR;aACF,CAAC;SACH;KACF;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAA4B,EAAE,WAAwB,EAAE,EAAE;IAC9F,QAAQ,QAAQ,EAAE;QAChB,KAAK,GAAG;YACN,OAAO,WAAW,CAAC,gBAAgB,CAAC;QACtC,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,uBAAuB,CAAC;QAC7C,KAAK,GAAG;YACN,OAAO,WAAW,CAAC,mBAAmB,CAAC;QACzC,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,0BAA0B,CAAC;QAChD,KAAK,GAAG;YACN,OAAO,WAAW,CAAC,oBAAoB,CAAC;QAC1C,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,0BAA0B,CAAC;QAChD,KAAK,GAAG;YACN,OAAO,WAAW,CAAC,kBAAkB,CAAC;QACxC,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,wBAAwB,CAAC;QAC9C,KAAK,GAAG;YACN,OAAO,WAAW,CAAC,sBAAsB,CAAC;QAC5C,iEAAiE;QACjE,sFAAsF;QACtF,0BAA0B;QAC1B;YACE,OAAO,EAAE,CAAC;KACb;AACH,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ComparisonOperator,\n ExtendedOperatorForm,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n JoinOperation,\n ParsedText,\n Query,\n Token,\n} from './interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { matchFilteringProperty, matchOperator, matchOperatorPrefix, trimFirstSpace, trimStart } from './utils';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\n\nexport const getQueryActions = (\n query: Query,\n onChange: NonCancelableEventHandler<Query>,\n inputRef: React.RefObject<AutosuggestInputRef>\n) => {\n const { tokens, operation } = query;\n const fireOnChange = (tokens: readonly Token[], operation: JoinOperation) =>\n fireNonCancelableEvent(onChange, { tokens, operation });\n const setToken = (index: number, newToken: Token) => {\n const newTokens = [...tokens];\n if (newTokens && index < newTokens.length) {\n newTokens[index] = newToken;\n }\n fireOnChange(newTokens, operation);\n };\n const removeToken = (index: number) => {\n const newTokens = tokens.filter((_, i) => i !== index);\n fireOnChange(newTokens, operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const removeAllTokens = () => {\n fireOnChange([], operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const addToken = (newToken: Token) => {\n const newTokens = [...tokens];\n newTokens.push(newToken);\n fireOnChange(newTokens, operation);\n };\n const setOperation = (newOperation: JoinOperation) => {\n fireOnChange(tokens, newOperation);\n };\n return {\n setToken,\n removeToken,\n removeAllTokens,\n addToken,\n setOperation,\n };\n};\n\nexport const getAllowedOperators = (property: InternalFilteringProperty): ComparisonOperator[] => {\n const { operators = [], defaultOperator } = property;\n const operatorOrder = ['=', '!=', ':', '!:', '^', '>=', '<=', '<', '>'] as const;\n const operatorSet = new Set([defaultOperator, ...operators]);\n return operatorOrder.filter(op => operatorSet.has(op));\n};\n\n/*\n * parses the value of the filtering input to figure out the current step of entering the token:\n * - \"property\": means that a filter on a particular column is being added, with operator already finalized\n * - \"operator\": means that a filter on a particular column is being added, with operator not yet finalized\n * - \"free-text\": means that a \"free text\" token is being added\n */\nexport const parseText = (\n filteringText: string,\n filteringProperties: readonly InternalFilteringProperty[],\n disableFreeTextFiltering: boolean\n): ParsedText => {\n const negatedGlobalQuery = /^(!:|!)(.*)/.exec(filteringText);\n if (!disableFreeTextFiltering && negatedGlobalQuery) {\n return {\n step: 'free-text',\n operator: '!:',\n value: negatedGlobalQuery[2],\n };\n }\n\n const property = matchFilteringProperty(filteringProperties, filteringText);\n if (!property) {\n return {\n step: 'free-text',\n value: filteringText,\n };\n }\n\n const allowedOps = getAllowedOperators(property);\n\n const textWithoutProperty = filteringText.substring(property.propertyLabel.length);\n const operator = matchOperator(allowedOps, trimStart(textWithoutProperty));\n if (operator) {\n const operatorLastIndex = textWithoutProperty.indexOf(operator) + operator.length;\n const textWithoutPropertyAndOperator = textWithoutProperty.slice(operatorLastIndex);\n // We need to remove the first leading space in case the user presses space\n // after the operator, for example: Owner: admin, will result in value of ` admin`\n // and we need to remove the first space, if the user added any more spaces only the\n // first one will be removed.\n const value = trimFirstSpace(textWithoutPropertyAndOperator);\n return { step: 'property', property, operator, value };\n }\n\n const operatorPrefix = matchOperatorPrefix(allowedOps, trimStart(textWithoutProperty));\n if (operatorPrefix !== null) {\n return { step: 'operator', property, operatorPrefix };\n }\n\n return {\n step: 'free-text',\n value: filteringText,\n };\n};\n\ninterface OptionGroup<T> {\n label: string;\n options: T[];\n}\n\nexport const getAllValueSuggestions = (\n filteringOptions: readonly InternalFilteringOption[],\n operator: ComparisonOperator | undefined = '=',\n i18nStrings: I18nStrings,\n customGroupsText: readonly GroupText[]\n) => {\n const defaultGroup: OptionGroup<AutosuggestProps.Option> = {\n label: i18nStrings.groupValuesText ?? '',\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<AutosuggestProps.Option> } = {};\n filteringOptions.forEach(filteringOption => {\n const property = filteringOption.property;\n // given option refers to a non-existent filtering property\n if (!property) {\n return;\n }\n // this option's filtering property does not support current operator\n if (getAllowedOperators(property).indexOf(operator) === -1) {\n return;\n }\n if (property.propertyGroup && !customGroups[property.propertyGroup]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === property.propertyGroup ? customGroup.values : acc),\n ''\n );\n customGroups[property.propertyGroup] = {\n label,\n options: [],\n };\n }\n const propertyGroup = property.propertyGroup ? customGroups[property.propertyGroup] : defaultGroup;\n propertyGroup.options.push({\n value: property.propertyLabel + ' ' + (operator || '=') + ' ' + filteringOption.value,\n label: filteringOption.label,\n __labelPrefix: property.propertyLabel + ' ' + (operator || '='),\n });\n });\n return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];\n};\n\nexport function createPropertiesCompatibilityMap(\n filteringProperties: readonly InternalFilteringProperty[]\n): (propertyA: string, propertyB: string) => boolean {\n const lookup: {\n [propertyKey: string]: { operator: string; form: ExtendedOperatorForm<any> | null }[];\n } = {};\n\n for (const property of filteringProperties) {\n lookup[property.propertyKey] = (property.operators || [])\n .map(operator => ({ operator, form: property.getValueFormRenderer(operator) }))\n .sort((a, b) => a.operator.localeCompare(b.operator));\n }\n\n return (propertyA: string, propertyB: string) => {\n if (lookup[propertyA].length !== lookup[propertyB].length) {\n return false;\n }\n for (let i = 0; i < lookup[propertyA].length; i++) {\n if (lookup[propertyA][i].operator !== lookup[propertyB][i].operator) {\n return false;\n }\n if (lookup[propertyA][i].form !== lookup[propertyB][i].form) {\n return false;\n }\n }\n return true;\n };\n}\n\nconst filteringPropertyToAutosuggestOption = (filteringProperty: InternalFilteringProperty) => ({\n value: filteringProperty.propertyLabel,\n label: filteringProperty.propertyLabel,\n keepOpenOnSelect: true,\n});\n\nexport function getPropertySuggestions<T>(\n filteringProperties: readonly InternalFilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings,\n filteringPropertyToOption: (filteringProperty: InternalFilteringProperty) => T\n) {\n const defaultGroup: OptionGroup<T> = {\n label: i18nStrings.groupPropertiesText ?? '',\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<T> } = {};\n\n filteringProperties.forEach(filteringProperty => {\n const { propertyGroup } = filteringProperty;\n let optionsGroup = defaultGroup;\n if (propertyGroup) {\n if (!customGroups[propertyGroup]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === propertyGroup ? customGroup.properties : acc),\n ''\n );\n customGroups[propertyGroup] = { options: [], label };\n }\n optionsGroup = customGroups[propertyGroup];\n }\n optionsGroup.options.push(filteringPropertyToOption(filteringProperty));\n });\n const defaultGroupArray = defaultGroup.options.length ? [defaultGroup] : [];\n const customGroupsArray = Object.keys(customGroups).map(groupKey => customGroups[groupKey]);\n return [...defaultGroupArray, ...customGroupsArray];\n}\n\nexport const getAutosuggestOptions = (\n parsedText: ParsedText,\n filteringProperties: readonly InternalFilteringProperty[],\n filteringOptions: readonly InternalFilteringOption[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings\n) => {\n switch (parsedText.step) {\n case 'property': {\n const { propertyLabel, groupValuesLabel } = parsedText.property;\n const options = filteringOptions.filter(o => o.property === parsedText.property);\n return {\n filterText: parsedText.value,\n options: [\n {\n options: options.map(({ label, value }) => ({\n value: propertyLabel + ' ' + parsedText.operator + ' ' + value,\n label: label,\n __labelPrefix: propertyLabel + ' ' + parsedText.operator,\n })),\n label: groupValuesLabel,\n },\n ],\n };\n }\n case 'operator': {\n return {\n filterText: parsedText.property.propertyLabel + ' ' + parsedText.operatorPrefix,\n options: [\n ...getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n ),\n {\n options: getAllowedOperators(parsedText.property).map(value => ({\n value: parsedText.property.propertyLabel + ' ' + value + ' ',\n label: parsedText.property.propertyLabel + ' ' + value,\n description: operatorToDescription(value, i18nStrings),\n keepOpenOnSelect: true,\n })),\n label: i18nStrings.operatorsText,\n },\n ],\n };\n }\n case 'free-text': {\n const needsValueSuggestions = !!parsedText.value;\n const needsPropertySuggestions = !(parsedText.step === 'free-text' && parsedText.operator === '!:');\n return {\n filterText: parsedText.value,\n options: [\n ...(needsPropertySuggestions\n ? getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n )\n : []),\n ...(needsValueSuggestions\n ? getAllValueSuggestions(filteringOptions, parsedText.operator, i18nStrings, customGroupsText)\n : []),\n ],\n };\n }\n }\n};\n\nexport const operatorToDescription = (operator: ComparisonOperator, i18nStrings: I18nStrings) => {\n switch (operator) {\n case '<':\n return i18nStrings.operatorLessText;\n case '<=':\n return i18nStrings.operatorLessOrEqualText;\n case '>':\n return i18nStrings.operatorGreaterText;\n case '>=':\n return i18nStrings.operatorGreaterOrEqualText;\n case ':':\n return i18nStrings.operatorContainsText;\n case '!:':\n return i18nStrings.operatorDoesNotContainText;\n case '=':\n return i18nStrings.operatorEqualsText;\n case '!=':\n return i18nStrings.operatorDoesNotEqualText;\n case '^':\n return i18nStrings.operatorStartsWithText;\n // The line is ignored from coverage because it is not reachable.\n // The purpose of it is to prevent TS errors if ComparisonOperator type gets extended.\n /* istanbul ignore next */\n default:\n return '';\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["property-filter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgD,MAAM,OAAO,CAAC;AAUrE,OAAO,EACL,mBAAmB,EASpB,MAAM,cAAc,CAAC;AAetB,OAAO,EAAE,mBAAmB,EAAE,CAAC;AA8B/B,QAAA,MAAM,cAAc,qGA8WnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["property-filter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAgD,MAAM,OAAO,CAAC;AAUrE,OAAO,EACL,mBAAmB,EAUpB,MAAM,cAAc,CAAC;AAetB,OAAO,EAAE,mBAAmB,EAAE,CAAC;AA8B/B,QAAA,MAAM,cAAc,qGAwXnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
@@ -49,7 +49,7 @@ function getOperatorI18nString(operator) {
49
49
  }
50
50
  }
51
51
  const PropertyFilter = React.forwardRef((_a, ref) => {
52
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
52
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
53
53
  var { disabled, countText, query, hideOperations, onChange, filteringProperties, filteringOptions = [], customGroupsText = [], disableFreeTextFiltering = false, onLoadItems, virtualScroll, customControl, customFilterActions, filteringPlaceholder, filteringAriaLabel, filteringEmpty, filteringLoadingText, filteringFinishedText, filteringErrorText, filteringRecoveryText, filteringStatusType, asyncProperties, tokenLimit, expandToViewport } = _a, rest = __rest(_a, ["disabled", "countText", "query", "hideOperations", "onChange", "filteringProperties", "filteringOptions", "customGroupsText", "disableFreeTextFiltering", "onLoadItems", "virtualScroll", "customControl", "customFilterActions", "filteringPlaceholder", "filteringAriaLabel", "filteringEmpty", "filteringLoadingText", "filteringFinishedText", "filteringErrorText", "filteringRecoveryText", "filteringStatusType", "asyncProperties", "tokenLimit", "expandToViewport"]);
54
54
  const { __internalRootRef } = useBaseComponent('PropertyFilter');
55
55
  const [removedTokenIndex, setRemovedTokenIndex] = useState(null);
@@ -65,47 +65,57 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
65
65
  });
66
66
  }) });
67
67
  useImperativeHandle(ref, () => ({ focus: () => { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }), []);
68
- const { tokens, operation } = query;
69
- const showResults = !!(tokens === null || tokens === void 0 ? void 0 : tokens.length) && !disabled && !!countText;
68
+ const showResults = !!((_2 = query.tokens) === null || _2 === void 0 ? void 0 : _2.length) && !disabled && !!countText;
70
69
  const { addToken, removeToken, setToken, setOperation, removeAllTokens } = getQueryActions(query, onChange, inputRef);
71
70
  const [filteringText, setFilteringText] = useState('');
72
- const internalFilteringProperties = filteringProperties.map(property => {
73
- var _a, _b, _c, _d, _e;
74
- const extendedOperators = ((_a = property.operators) !== null && _a !== void 0 ? _a : []).reduce((acc, operator) => (typeof operator === 'object' ? acc.set(operator.operator, operator) : acc), new Map());
75
- return {
76
- propertyKey: property.key,
77
- propertyLabel: (_b = property.propertyLabel) !== null && _b !== void 0 ? _b : '',
78
- groupValuesLabel: (_c = property.groupValuesLabel) !== null && _c !== void 0 ? _c : '',
79
- propertyGroup: property.group,
80
- operators: ((_d = property.operators) !== null && _d !== void 0 ? _d : []).map(op => (typeof op === 'string' ? op : op.operator)),
81
- defaultOperator: (_e = property.defaultOperator) !== null && _e !== void 0 ? _e : '=',
82
- getValueFormatter: operator => { var _a, _b; return (operator ? (_b = (_a = extendedOperators.get(operator)) === null || _a === void 0 ? void 0 : _a.format) !== null && _b !== void 0 ? _b : null : null); },
83
- getValueFormRenderer: operator => { var _a, _b; return (operator ? (_b = (_a = extendedOperators.get(operator)) === null || _a === void 0 ? void 0 : _a.form) !== null && _b !== void 0 ? _b : null : null); },
84
- externalProperty: property,
85
- };
86
- });
87
- const propertyByKey = new Map(internalFilteringProperties.map(p => [p.propertyKey, p]));
88
- const internalFilteringOptions = filteringOptions.map(option => {
89
- var _a, _b, _c;
90
- const formatter = (_a = propertyByKey.get(option.propertyKey)) === null || _a === void 0 ? void 0 : _a.getValueFormatter();
91
- return {
92
- propertyKey: option.propertyKey,
93
- value: option.value,
94
- label: formatter ? formatter(option.value) : (_c = (_b = option.label) !== null && _b !== void 0 ? _b : option.value) !== null && _c !== void 0 ? _c : '',
71
+ const { internalProperties, internalOptions, internalQuery } = (() => {
72
+ const propertyByKey = filteringProperties.reduce((acc, property) => {
73
+ var _a, _b, _c, _d, _e;
74
+ const extendedOperators = ((_a = property === null || property === void 0 ? void 0 : property.operators) !== null && _a !== void 0 ? _a : []).reduce((acc, operator) => (typeof operator === 'object' ? acc.set(operator.operator, operator) : acc), new Map());
75
+ acc.set(property.key, {
76
+ propertyKey: property.key,
77
+ propertyLabel: (_b = property === null || property === void 0 ? void 0 : property.propertyLabel) !== null && _b !== void 0 ? _b : '',
78
+ groupValuesLabel: (_c = property === null || property === void 0 ? void 0 : property.groupValuesLabel) !== null && _c !== void 0 ? _c : '',
79
+ propertyGroup: property === null || property === void 0 ? void 0 : property.group,
80
+ operators: ((_d = property === null || property === void 0 ? void 0 : property.operators) !== null && _d !== void 0 ? _d : []).map(op => (typeof op === 'string' ? op : op.operator)),
81
+ defaultOperator: (_e = property === null || property === void 0 ? void 0 : property.defaultOperator) !== null && _e !== void 0 ? _e : '=',
82
+ getValueFormatter: operator => { var _a, _b; return (operator ? (_b = (_a = extendedOperators.get(operator)) === null || _a === void 0 ? void 0 : _a.format) !== null && _b !== void 0 ? _b : null : null); },
83
+ getValueFormRenderer: operator => { var _a, _b; return (operator ? (_b = (_a = extendedOperators.get(operator)) === null || _a === void 0 ? void 0 : _a.form) !== null && _b !== void 0 ? _b : null : null); },
84
+ externalProperty: property,
85
+ });
86
+ return acc;
87
+ }, new Map());
88
+ const getProperty = (propertyKey) => { var _a; return (_a = propertyByKey.get(propertyKey)) !== null && _a !== void 0 ? _a : null; };
89
+ const internalOptions = filteringOptions.map(option => {
90
+ var _a, _b;
91
+ return ({
92
+ property: getProperty(option.propertyKey),
93
+ value: option.value,
94
+ label: (_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.value) !== null && _b !== void 0 ? _b : '',
95
+ });
96
+ });
97
+ const internalQuery = {
98
+ operation: query.operation,
99
+ tokens: query.tokens.map(token => ({
100
+ property: token.propertyKey ? getProperty(token.propertyKey) : null,
101
+ operator: token.operator,
102
+ value: token.value,
103
+ })),
95
104
  };
96
- });
97
- const parsedText = parseText(filteringText, internalFilteringProperties, disableFreeTextFiltering);
98
- const autosuggestOptions = getAutosuggestOptions(parsedText, internalFilteringOptions, internalFilteringProperties, customGroupsText, i18nStrings);
105
+ return { internalProperties: [...propertyByKey.values()], internalOptions, internalQuery };
106
+ })();
107
+ const parsedText = parseText(filteringText, internalProperties, disableFreeTextFiltering);
108
+ const autosuggestOptions = getAutosuggestOptions(parsedText, internalProperties, internalOptions, customGroupsText, i18nStrings);
99
109
  const createToken = (currentText) => {
100
- const parsedText = parseText(currentText, internalFilteringProperties, disableFreeTextFiltering);
110
+ const parsedText = parseText(currentText, internalProperties, disableFreeTextFiltering);
101
111
  let newToken;
102
112
  switch (parsedText.step) {
103
113
  case 'property': {
104
114
  newToken = matchTokenValue({
105
- propertyKey: parsedText.property.propertyKey,
115
+ property: parsedText.property,
106
116
  operator: parsedText.operator,
107
117
  value: parsedText.value,
108
- }, internalFilteringOptions);
118
+ }, internalOptions);
109
119
  break;
110
120
  }
111
121
  case 'free-text': {
@@ -161,6 +171,7 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
161
171
  const asyncAutosuggestProps = !!filteringText.length || asyncProperties
162
172
  ? Object.assign(Object.assign({}, inputLoadItemsHandlers), asyncProps) : {};
163
173
  const handleSelected = event => {
174
+ var _a;
164
175
  // The ignoreKeyDown flag makes sure `createToken` routine runs only once. Autosuggest's `onKeyDown` fires,
165
176
  // when an item is selected from the list using "enter" key.
166
177
  ignoreKeyDown.current = true;
@@ -175,13 +186,13 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
175
186
  }
176
187
  // stop dropdown from closing
177
188
  event.preventDefault();
178
- const parsedText = parseText(value, internalFilteringProperties, disableFreeTextFiltering);
189
+ const parsedText = parseText(value, internalProperties, disableFreeTextFiltering);
179
190
  const loadMoreDetail = getLoadMoreDetail(parsedText, value);
180
191
  // Insert operator automatically if only one operator is defined for the given property.
181
192
  if (parsedText.step === 'operator') {
182
193
  const operators = getAllowedOperators(parsedText.property);
183
194
  if (value.trim() === parsedText.property.propertyLabel && operators.length === 1) {
184
- loadMoreDetail.filteringProperty = parsedText.property.externalProperty;
195
+ loadMoreDetail.filteringProperty = (_a = parsedText.property.externalProperty) !== null && _a !== void 0 ? _a : undefined;
185
196
  loadMoreDetail.filteringOperator = operators[0];
186
197
  loadMoreDetail.filteringText = '';
187
198
  setFilteringText(parsedText.property.propertyLabel + ' ' + operators[0] + ' ');
@@ -208,12 +219,12 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
208
219
  } })), hideEnteredTextOption: disableFreeTextFiltering && parsedText.step !== 'property', clearAriaLabel: i18nStrings.clearAriaLabel, searchResultsId: showResults ? searchResultsId : undefined })),
209
220
  showResults ? (React.createElement("div", { className: styles.results },
210
221
  React.createElement(SearchResults, { id: searchResultsId }, countText))) : null),
211
- tokens && tokens.length > 0 && (React.createElement("div", { className: styles.tokens },
222
+ internalQuery.tokens && internalQuery.tokens.length > 0 && (React.createElement("div", { className: styles.tokens },
212
223
  React.createElement(InternalSpaceBetween, { size: "xs", direction: "horizontal" },
213
- React.createElement(TokenList, { alignment: "inline", limit: tokenLimit, items: tokens, renderItem: (token, tokenIndex) => (React.createElement(TokenButton, { token: token, first: tokenIndex === 0, operation: operation, removeToken: () => {
224
+ React.createElement(TokenList, { alignment: "inline", limit: tokenLimit, items: internalQuery.tokens, renderItem: (token, tokenIndex) => (React.createElement(TokenButton, { token: token, first: tokenIndex === 0, operation: internalQuery.operation, removeToken: () => {
214
225
  removeToken(tokenIndex);
215
226
  setRemovedTokenIndex(tokenIndex);
216
- }, setToken: (newToken) => setToken(tokenIndex, newToken), setOperation: setOperation, filteringOptions: internalFilteringOptions, filteringProperties: internalFilteringProperties, asyncProps: asyncProps, onLoadItems: onLoadItems, i18nStrings: i18nStrings, asyncProperties: asyncProperties, hideOperations: hideOperations, customGroupsText: customGroupsText, disableFreeTextFiltering: disableFreeTextFiltering, disabled: disabled, expandToViewport: expandToViewport })), i18nStrings: {
227
+ }, setToken: (newToken) => setToken(tokenIndex, newToken), setOperation: setOperation, filteringProperties: internalProperties, filteringOptions: internalOptions, asyncProps: asyncProps, onLoadItems: onLoadItems, i18nStrings: i18nStrings, asyncProperties: asyncProperties, hideOperations: hideOperations, customGroupsText: customGroupsText, disableFreeTextFiltering: disableFreeTextFiltering, disabled: disabled, expandToViewport: expandToViewport })), i18nStrings: {
217
228
  limitShowFewer: i18nStrings.tokenLimitShowFewer,
218
229
  limitShowMore: i18nStrings.tokenLimitShowMore,
219
230
  }, after: customFilterActions ? (React.createElement("div", { className: styles['custom-filter-actions'] }, customFilterActions)) : (React.createElement(InternalButton, { formAction: "none", onClick: removeAllTokens, className: styles['remove-all'], disabled: disabled }, i18nStrings.clearFiltersText)), removedItemIndex: removedTokenIndex }))))));