@cloudscape-design/components 3.0.273 → 3.0.274

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 (34) hide show
  1. package/internal/environment.js +1 -1
  2. package/internal/manifest.json +1 -1
  3. package/package.json +1 -1
  4. package/property-filter/controller.d.ts +8 -16
  5. package/property-filter/controller.d.ts.map +1 -1
  6. package/property-filter/controller.js +17 -48
  7. package/property-filter/controller.js.map +1 -1
  8. package/property-filter/index.d.ts.map +1 -1
  9. package/property-filter/index.js +38 -14
  10. package/property-filter/index.js.map +1 -1
  11. package/property-filter/interfaces.d.ts +18 -2
  12. package/property-filter/interfaces.d.ts.map +1 -1
  13. package/property-filter/interfaces.js.map +1 -1
  14. package/property-filter/property-editor.d.ts +4 -4
  15. package/property-filter/property-editor.d.ts.map +1 -1
  16. package/property-filter/property-editor.js +1 -1
  17. package/property-filter/property-editor.js.map +1 -1
  18. package/property-filter/token-editor.d.ts +3 -3
  19. package/property-filter/token-editor.d.ts.map +1 -1
  20. package/property-filter/token-editor.js +11 -11
  21. package/property-filter/token-editor.js.map +1 -1
  22. package/property-filter/token.d.ts +3 -3
  23. package/property-filter/token.d.ts.map +1 -1
  24. package/property-filter/token.js +1 -1
  25. package/property-filter/token.js.map +1 -1
  26. package/property-filter/use-load-items.d.ts +1 -1
  27. package/property-filter/use-load-items.js +1 -1
  28. package/property-filter/use-load-items.js.map +1 -1
  29. package/property-filter/utils.d.ts +10 -3
  30. package/property-filter/utils.d.ts.map +1 -1
  31. package/property-filter/utils.js +12 -0
  32. package/property-filter/utils.js.map +1 -1
  33. package/top-navigation/interfaces.d.ts +1 -1
  34. package/top-navigation/interfaces.js.map +1 -1
@@ -1,6 +1,6 @@
1
1
 
2
2
  export var PACKAGE_SOURCE = 'components';
3
- export var PACKAGE_VERSION = '3.0.0 (d741109)';
3
+ export var PACKAGE_VERSION = '3.0.0 (78d0b88)';
4
4
  export var THEME = 'open-source-visual-refresh';
5
5
  export var ALWAYS_VISUAL_REFRESH = true;
6
6
 
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "d74110990d93b30f9795add3baadff4c705c3f6b"
2
+ "commit": "78d0b886f9223de8848764a977321d74bb072d16"
3
3
  }
package/package.json CHANGED
@@ -109,7 +109,7 @@
109
109
  "./internal/base-component/index.js",
110
110
  "./internal/base-component/styles.css.js"
111
111
  ],
112
- "version": "3.0.273",
112
+ "version": "3.0.274",
113
113
  "repository": {
114
114
  "type": "git",
115
115
  "url": "https://github.com/cloudscape-design/components.git"
@@ -1,4 +1,4 @@
1
- import { ComparisonOperator, FilteringOption, FilteringProperty, GroupText, I18nStrings, JoinOperation, ParsedText, Query, Token } from './interfaces';
1
+ import { ComparisonOperator, GroupText, I18nStrings, InternalFilteringOption, InternalFilteringProperty, JoinOperation, ParsedText, Query, Token } from './interfaces';
2
2
  import { NonCancelableEventHandler } from '../internal/events';
3
3
  import { AutosuggestInputRef } from '../internal/components/autosuggest-input';
4
4
  export declare const getQueryActions: (query: Query, onChange: NonCancelableEventHandler<Query>, inputRef: React.RefObject<AutosuggestInputRef>) => {
@@ -8,19 +8,17 @@ export declare const getQueryActions: (query: Query, onChange: NonCancelableEven
8
8
  addToken: (newToken: Token) => void;
9
9
  setOperation: (newOperation: JoinOperation) => void;
10
10
  };
11
- export declare const getAllowedOperators: (property: FilteringProperty) => ComparisonOperator[];
12
- export declare const parseText: (filteringText: string, filteringProperties: readonly import("./interfaces").PropertyFilterProps.FilteringProperty[] | undefined, disableFreeTextFiltering: boolean) => ParsedText;
13
- export declare const getPropertyOptions: (filteringProperty: FilteringProperty, filteringOptions: readonly FilteringOption[]) => import("@cloudscape-design/collection-hooks").PropertyFilterOption[];
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[];
14
14
  interface OptionGroup<T> {
15
15
  label: string;
16
16
  options: T[];
17
17
  }
18
- export declare const getAllValueSuggestions: (filteringOptions: readonly FilteringOption[], filteringProperties: readonly FilteringProperty[], operator: ComparisonOperator | undefined, i18nStrings: I18nStrings, customGroupsText: readonly GroupText[]) => OptionGroup<import("../internal/components/option/interfaces").OptionDefinition>[];
19
- export declare const getPropertyByKey: (filteringProperties: readonly FilteringProperty[], key: string) => import("./interfaces").PropertyFilterProps.FilteringProperty | undefined;
20
- export declare function getExtendedOperator(filteringProperties: readonly FilteringProperty[], property: string, operator: ComparisonOperator): import("@cloudscape-design/collection-hooks").PropertyFilterOperatorExtended<any> | null;
21
- export declare function createPropertiesCompatibilityMap(filteringProperties: readonly FilteringProperty[]): (propertyA: string, propertyB: string) => boolean;
22
- export declare function getPropertySuggestions<T>(filteringProperties: readonly FilteringProperty[], customGroupsText: readonly GroupText[], i18nStrings: I18nStrings, filteringPropertyToOption: (filteringProperty: FilteringProperty) => T): OptionGroup<T>[];
23
- export declare const getAutosuggestOptions: (parsedText: ParsedText, filteringOptions: readonly FilteringOption[], filteringProperties: readonly FilteringProperty[], customGroupsText: readonly GroupText[], i18nStrings: I18nStrings) => {
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>[];
19
+ export declare function createPropertiesCompatibilityMap(filteringProperties: readonly InternalFilteringProperty[]): (propertyA: string, propertyB: string) => boolean;
20
+ 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) => {
24
22
  filterText: string;
25
23
  options: {
26
24
  options: {
@@ -54,11 +52,5 @@ export declare const getAutosuggestOptions: (parsedText: ParsedText, filteringOp
54
52
  }>)[];
55
53
  };
56
54
  export declare const operatorToDescription: (operator: ComparisonOperator, i18nStrings: I18nStrings) => string | undefined;
57
- export declare function getFormattedToken(filteringProperties: readonly FilteringProperty[], token: Token): {
58
- property: string | undefined;
59
- operator: import("@cloudscape-design/collection-hooks").PropertyFilterOperator;
60
- value: any;
61
- label: string;
62
- };
63
55
  export {};
64
56
  //# sourceMappingURL=controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"lib/default/","sources":["property-filter/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAElB,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,aAAa,EACb,UAAU,EACV,KAAK,EACL,KAAK,EACN,MAAM,cAAc,CAAC;AACtB,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAGvF,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,iBAAiB,KAAG,kBAAkB,EAQnF,CAAC;AAQF,eAAO,MAAM,SAAS,kBACL,MAAM,sIAEK,OAAO,KAChC,UAyCF,CAAC;AAEF,eAAO,MAAM,kBAAkB,sBACV,iBAAiB,oBAClB,SAAS,eAAe,EAAE,yEAG7C,CAAC;AAEF,UAAU,WAAW,CAAC,CAAC;IACrB,KAAK,EAAE,M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AAM,qBAAqB,eACpB,UAAU,oBACJ,SAAS,uBAAuB,EAAE,uBAC/B,SAAS,yBAAyB,EAAE,oBACvC,SAAS,SAAS,EAAE,eACzB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEzB,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,kBAAkB,eAAe,WAAW,uBAY3F,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 { matchFilteringProperty, matchOperator, matchOperatorPrefix, trimFirstSpace, trimStart } from './utils';
4
+ import { getPropertyByKey, 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 });
@@ -42,10 +42,7 @@ export const getQueryActions = (query, onChange, inputRef) => {
42
42
  export const getAllowedOperators = (property) => {
43
43
  const { operators = [], defaultOperator } = property;
44
44
  const operatorOrder = ['=', '!=', ':', '!:', '>=', '<=', '<', '>'];
45
- const operatorSet = new Set([
46
- defaultOperator !== null && defaultOperator !== void 0 ? defaultOperator : '=',
47
- ...operators.map(op => (typeof op === 'string' ? op : op.operator)),
48
- ]);
45
+ const operatorSet = new Set([defaultOperator, ...operators]);
49
46
  return operatorOrder.filter(op => operatorSet.has(op));
50
47
  };
51
48
  /*
@@ -93,7 +90,7 @@ export const parseText = (filteringText, filteringProperties = [], disableFreeTe
93
90
  };
94
91
  };
95
92
  export const getPropertyOptions = (filteringProperty, filteringOptions) => {
96
- return filteringOptions.filter(option => option.propertyKey === filteringProperty.key);
93
+ return filteringOptions.filter(option => option.propertyKey === filteringProperty.propertyKey);
97
94
  };
98
95
  export const getAllValueSuggestions = (filteringOptions, filteringProperties, operator = '=', i18nStrings, customGroupsText) => {
99
96
  var _a;
@@ -103,7 +100,6 @@ export const getAllValueSuggestions = (filteringOptions, filteringProperties, op
103
100
  };
104
101
  const customGroups = {};
105
102
  filteringOptions.forEach(filteringOption => {
106
- var _a;
107
103
  const property = getPropertyByKey(filteringProperties, filteringOption.propertyKey);
108
104
  // given option refers to a non-existent filtering property
109
105
  if (!property) {
@@ -113,45 +109,27 @@ export const getAllValueSuggestions = (filteringOptions, filteringProperties, op
113
109
  if (getAllowedOperators(property).indexOf(operator) === -1) {
114
110
  return;
115
111
  }
116
- if (property.group && !customGroups[property.group]) {
117
- const label = customGroupsText.reduce((acc, customGroup) => (customGroup.group === property.group ? customGroup.values : acc), '');
118
- customGroups[property.group] = {
112
+ if (property.propertyGroup && !customGroups[property.propertyGroup]) {
113
+ const label = customGroupsText.reduce((acc, customGroup) => (customGroup.group === property.propertyGroup ? customGroup.values : acc), '');
114
+ customGroups[property.propertyGroup] = {
119
115
  label,
120
116
  options: [],
121
117
  };
122
118
  }
123
- const propertyGroup = property.group ? customGroups[property.group] : defaultGroup;
119
+ const propertyGroup = property.propertyGroup ? customGroups[property.propertyGroup] : defaultGroup;
124
120
  propertyGroup.options.push({
125
121
  value: property.propertyLabel + ' ' + (operator || '=') + ' ' + filteringOption.value,
126
- label: (_a = filteringOption.label) !== null && _a !== void 0 ? _a : filteringOption.value,
122
+ label: filteringOption.label,
127
123
  __labelPrefix: property.propertyLabel + ' ' + (operator || '='),
128
124
  });
129
125
  });
130
126
  return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];
131
127
  };
132
- export const getPropertyByKey = (filteringProperties, key) => {
133
- const propertyMap = filteringProperties.reduce((acc, property) => {
134
- acc[property.key] = property;
135
- return acc;
136
- }, {});
137
- return propertyMap[key];
138
- };
139
- export function getExtendedOperator(filteringProperties, property, operator) {
140
- const matchedProperty = getPropertyByKey(filteringProperties, property);
141
- for (const matchedOperator of (matchedProperty === null || matchedProperty === void 0 ? void 0 : matchedProperty.operators) || []) {
142
- if (typeof matchedOperator === 'object' && matchedOperator.operator === operator) {
143
- return matchedOperator;
144
- }
145
- }
146
- return null;
147
- }
148
128
  export function createPropertiesCompatibilityMap(filteringProperties) {
149
129
  const lookup = {};
150
130
  for (const property of filteringProperties) {
151
- lookup[property.key] = (property.operators || [])
152
- .map(operator => typeof operator === 'object'
153
- ? { operator: operator.operator, form: operator.form }
154
- : { operator, form: undefined })
131
+ lookup[property.propertyKey] = (property.operators || [])
132
+ .map(operator => ({ operator, form: property.getValueFormRenderer(operator) }))
155
133
  .sort((a, b) => a.operator.localeCompare(b.operator));
156
134
  }
157
135
  return (propertyA, propertyB) => {
@@ -182,14 +160,14 @@ export function getPropertySuggestions(filteringProperties, customGroupsText, i1
182
160
  };
183
161
  const customGroups = {};
184
162
  filteringProperties.forEach(filteringProperty => {
185
- const { group } = filteringProperty;
163
+ const { propertyGroup } = filteringProperty;
186
164
  let optionsGroup = defaultGroup;
187
- if (group) {
188
- if (!customGroups[group]) {
189
- const label = customGroupsText.reduce((acc, customGroup) => (customGroup.group === group ? customGroup.properties : acc), '');
190
- customGroups[group] = { options: [], label };
165
+ if (propertyGroup) {
166
+ if (!customGroups[propertyGroup]) {
167
+ const label = customGroupsText.reduce((acc, customGroup) => (customGroup.group === propertyGroup ? customGroup.properties : acc), '');
168
+ customGroups[propertyGroup] = { options: [], label };
191
169
  }
192
- optionsGroup = customGroups[group];
170
+ optionsGroup = customGroups[propertyGroup];
193
171
  }
194
172
  optionsGroup.options.push(filteringPropertyToOption(filteringProperty));
195
173
  });
@@ -208,7 +186,7 @@ export const getAutosuggestOptions = (parsedText, filteringOptions, filteringPro
208
186
  {
209
187
  options: options.map(({ label, value }) => ({
210
188
  value: propertyLabel + ' ' + parsedText.operator + ' ' + value,
211
- label: label !== null && label !== void 0 ? label : value,
189
+ label: label,
212
190
  __labelPrefix: propertyLabel + ' ' + parsedText.operator,
213
191
  })),
214
192
  label: groupValuesLabel,
@@ -263,13 +241,4 @@ export const operatorToDescription = (operator, i18nStrings) => {
263
241
  };
264
242
  return mapping[operator];
265
243
  };
266
- export function getFormattedToken(filteringProperties, token) {
267
- var _a;
268
- const valueFormatter = token.propertyKey && ((_a = getExtendedOperator(filteringProperties, token.propertyKey, token.operator)) === null || _a === void 0 ? void 0 : _a.format);
269
- const property = token.propertyKey && getPropertyByKey(filteringProperties, token.propertyKey);
270
- const propertyLabel = property && property.propertyLabel;
271
- const tokenValue = valueFormatter ? valueFormatter(token.value) : token.value;
272
- const label = `${propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : ''} ${token.operator} ${tokenValue}`;
273
- return { property: propertyLabel, operator: token.operator, value: tokenValue, label };
274
- }
275
244
  //# sourceMappingURL=controller.js.map
@@ -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,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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C,EAAE,WAAW,CAAC,kBAAkB;QACrC,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,wBAAwB;KAC7C,CAAC;IACF,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,mBAAiD,EAAE,KAAY;;IAC/F,MAAM,cAAc,GAClB,KAAK,CAAC,WAAW,KAAI,MAAA,mBAAmB,CAAC,mBAAmB,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,0CAAE,MAAM,CAAA,CAAC;IAC3G,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,IAAI,gBAAgB,CAAC,mBAAmB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC/F,MAAM,aAAa,GAAG,QAAQ,IAAI,QAAQ,CAAC,aAAa,CAAC;IACzD,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IAC9E,MAAM,KAAK,GAAG,GAAG,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,IAAI,KAAK,CAAC,QAAQ,IAAI,UAAU,EAAE,CAAC;IACvE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;AACzF,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 FilteringOption,\n FilteringProperty,\n GroupText,\n I18nStrings,\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: FilteringProperty): ComparisonOperator[] => {\n const { operators = [], defaultOperator } = property;\n const operatorOrder = ['=', '!=', ':', '!:', '>=', '<=', '<', '>'] as const;\n const operatorSet = new Set([\n defaultOperator ?? '=',\n ...operators.map(op => (typeof op === 'string' ? op : op.operator)),\n ]);\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 FilteringProperty[] = [],\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 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: FilteringProperty,\n filteringOptions: readonly FilteringOption[]\n) => {\n return filteringOptions.filter(option => option.propertyKey === filteringProperty.key);\n};\n\ninterface OptionGroup<T> {\n label: string;\n options: T[];\n}\n\nexport const getAllValueSuggestions = (\n filteringOptions: readonly FilteringOption[],\n filteringProperties: readonly FilteringProperty[],\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.group && !customGroups[property.group]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === property.group ? customGroup.values : acc),\n ''\n );\n customGroups[property.group] = {\n label,\n options: [],\n };\n }\n const propertyGroup = property.group ? customGroups[property.group] : defaultGroup;\n propertyGroup.options.push({\n value: property.propertyLabel + ' ' + (operator || '=') + ' ' + filteringOption.value,\n label: filteringOption.label ?? filteringOption.value,\n __labelPrefix: property.propertyLabel + ' ' + (operator || '='),\n });\n });\n return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];\n};\n\nexport const getPropertyByKey = (filteringProperties: readonly FilteringProperty[], key: string) => {\n const propertyMap = filteringProperties.reduce<{ [K: string]: FilteringProperty }>((acc, property) => {\n acc[property.key] = property;\n return acc;\n }, {});\n return propertyMap[key] as FilteringProperty | undefined;\n};\n\nexport function getExtendedOperator(\n filteringProperties: readonly FilteringProperty[],\n property: string,\n operator: ComparisonOperator\n) {\n const matchedProperty = getPropertyByKey(filteringProperties, property);\n for (const matchedOperator of matchedProperty?.operators || []) {\n if (typeof matchedOperator === 'object' && matchedOperator.operator === operator) {\n return matchedOperator;\n }\n }\n return null;\n}\n\nexport function createPropertiesCompatibilityMap(\n filteringProperties: readonly FilteringProperty[]\n): (propertyA: string, propertyB: string) => boolean {\n const lookup: {\n [propertyKey: string]: { operator: string; form: ExtendedOperatorForm<any> | undefined }[];\n } = {};\n\n for (const property of filteringProperties) {\n lookup[property.key] = (property.operators || [])\n .map(operator =>\n typeof operator === 'object'\n ? { operator: operator.operator, form: operator.form }\n : { operator, form: undefined }\n )\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: FilteringProperty) => ({\n value: filteringProperty.propertyLabel,\n label: filteringProperty.propertyLabel,\n keepOpenOnSelect: true,\n});\n\nexport function getPropertySuggestions<T>(\n filteringProperties: readonly FilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings,\n filteringPropertyToOption: (filteringProperty: FilteringProperty) => 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 { group } = filteringProperty;\n let optionsGroup = defaultGroup;\n if (group) {\n if (!customGroups[group]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === group ? customGroup.properties : acc),\n ''\n );\n customGroups[group] = { options: [], label };\n }\n optionsGroup = customGroups[group];\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 FilteringOption[],\n filteringProperties: readonly FilteringProperty[],\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 ?? value,\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 const mapping: { [K in ComparisonOperator]: string | undefined } = {\n ['<']: i18nStrings.operatorLessText,\n ['<=']: i18nStrings.operatorLessOrEqualText,\n ['>']: i18nStrings.operatorGreaterText,\n ['>=']: i18nStrings.operatorGreaterOrEqualText,\n [':']: i18nStrings.operatorContainsText,\n ['!:']: i18nStrings.operatorDoesNotContainText,\n ['=']: i18nStrings.operatorEqualsText,\n ['!=']: i18nStrings.operatorDoesNotEqualText,\n };\n return mapping[operator];\n};\n\nexport function getFormattedToken(filteringProperties: readonly FilteringProperty[], token: Token) {\n const valueFormatter =\n token.propertyKey && getExtendedOperator(filteringProperties, token.propertyKey, token.operator)?.format;\n const property = token.propertyKey && getPropertyByKey(filteringProperties, token.propertyKey);\n const propertyLabel = property && property.propertyLabel;\n const tokenValue = valueFormatter ? valueFormatter(token.value) : token.value;\n const label = `${propertyLabel ?? ''} ${token.operator} ${tokenValue}`;\n return { property: propertyLabel, operator: token.operator, value: tokenValue, label };\n}\n"]}
1
+ {"version":3,"file":"controller.js","source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AAU,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;YACpG,OAAO;gBACL,UAAU,EAAE,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,CACpB,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,CAAC,QAAQ,EACnB,WAAW,EACX,gBAAgB,CACjB;wBACH,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,MAAM,OAAO,GAAsD;QACjE,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,gBAAgB;QACnC,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,uBAAuB;QAC3C,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,mBAAmB;QACtC,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,0BAA0B;QAC9C,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,oBAAoB;QACvC,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,0BAA0B;QAC9C,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,kBAAkB;QACrC,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,wBAAwB;KAC7C,CAAC;IACF,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,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 const mapping: { [K in ComparisonOperator]: string | undefined } = {\n ['<']: i18nStrings.operatorLessText,\n ['<=']: i18nStrings.operatorLessOrEqualText,\n ['>']: i18nStrings.operatorGreaterText,\n ['>=']: i18nStrings.operatorGreaterOrEqualText,\n [':']: i18nStrings.operatorContainsText,\n ['!:']: i18nStrings.operatorDoesNotContainText,\n ['=']: i18nStrings.operatorEqualsText,\n ['!=']: i18nStrings.operatorDoesNotEqualText,\n };\n return mapping[operator];\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;AAWrE,OAAO,EAAE,mBAAmB,EAAiE,MAAM,cAAc,CAAC;AAoBlH,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAa/B,QAAA,MAAM,cAAc,qGA8TnB,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,EASpB,MAAM,cAAc,CAAC;AAetB,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAa/B,QAAA,MAAM,cAAc,qGA2VnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
@@ -11,7 +11,7 @@ import { KeyCode } from '../internal/keycode';
11
11
  import { useUniqueId } from '../internal/hooks/use-unique-id/index';
12
12
  import { fireNonCancelableEvent } from '../internal/events';
13
13
  import { TokenButton } from './token';
14
- import { getQueryActions, parseText, getAutosuggestOptions, getAllowedOperators, getExtendedOperator, } from './controller';
14
+ import { getQueryActions, parseText, getAutosuggestOptions, getAllowedOperators } from './controller';
15
15
  import { useLoadItems } from './use-load-items';
16
16
  import styles from './styles.css.js';
17
17
  import useBaseComponent from '../internal/hooks/use-base-component';
@@ -32,7 +32,7 @@ const OPERATOR_I18N_MAPPING = {
32
32
  '!:': 'not_contains',
33
33
  };
34
34
  const PropertyFilter = React.forwardRef((_a, ref) => {
35
- var _b, _c;
35
+ var _b;
36
36
  var { disabled, countText, query, hideOperations, onChange, filteringProperties, filteringOptions = [], customGroupsText = [], disableFreeTextFiltering = false, onLoadItems, virtualScroll, customControl, 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", "filteringEmpty", "filteringLoadingText", "filteringFinishedText", "filteringErrorText", "filteringRecoveryText", "filteringStatusType", "asyncProperties", "tokenLimit", "expandToViewport"]);
37
37
  const { __internalRootRef } = useBaseComponent('PropertyFilter');
38
38
  const [removedTokenIndex, setRemovedTokenIndex] = useState(null);
@@ -52,18 +52,43 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
52
52
  const showResults = !!(tokens === null || tokens === void 0 ? void 0 : tokens.length) && !disabled && !!countText;
53
53
  const { addToken, removeToken, setToken, setOperation, removeAllTokens } = getQueryActions(query, onChange, inputRef);
54
54
  const [filteringText, setFilteringText] = useState('');
55
- const parsedText = parseText(filteringText, filteringProperties, disableFreeTextFiltering);
56
- const autosuggestOptions = getAutosuggestOptions(parsedText, filteringOptions, filteringProperties, customGroupsText, i18nStrings);
55
+ const internalFilteringProperties = filteringProperties.map(property => {
56
+ var _a, _b, _c, _d, _e;
57
+ const extendedOperators = ((_a = property.operators) !== null && _a !== void 0 ? _a : []).reduce((acc, operator) => (typeof operator === 'object' ? acc.set(operator.operator, operator) : acc), new Map());
58
+ return {
59
+ propertyKey: property.key,
60
+ propertyLabel: (_b = property.propertyLabel) !== null && _b !== void 0 ? _b : '',
61
+ groupValuesLabel: (_c = property.groupValuesLabel) !== null && _c !== void 0 ? _c : '',
62
+ propertyGroup: property.group,
63
+ operators: ((_d = property.operators) !== null && _d !== void 0 ? _d : []).map(op => (typeof op === 'string' ? op : op.operator)),
64
+ defaultOperator: (_e = property.defaultOperator) !== null && _e !== void 0 ? _e : '=',
65
+ 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); },
66
+ 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); },
67
+ externalProperty: property,
68
+ };
69
+ });
70
+ const propertyByKey = new Map(internalFilteringProperties.map(p => [p.propertyKey, p]));
71
+ const internalFilteringOptions = filteringOptions.map(option => {
72
+ var _a, _b, _c;
73
+ const formatter = (_a = propertyByKey.get(option.propertyKey)) === null || _a === void 0 ? void 0 : _a.getValueFormatter();
74
+ return {
75
+ propertyKey: option.propertyKey,
76
+ value: option.value,
77
+ label: formatter ? formatter(option.value) : (_c = (_b = option.label) !== null && _b !== void 0 ? _b : option.value) !== null && _c !== void 0 ? _c : '',
78
+ };
79
+ });
80
+ const parsedText = parseText(filteringText, internalFilteringProperties, disableFreeTextFiltering);
81
+ const autosuggestOptions = getAutosuggestOptions(parsedText, internalFilteringOptions, internalFilteringProperties, customGroupsText, i18nStrings);
57
82
  const createToken = (currentText) => {
58
- const parsedText = parseText(currentText, filteringProperties, disableFreeTextFiltering);
83
+ const parsedText = parseText(currentText, internalFilteringProperties, disableFreeTextFiltering);
59
84
  let newToken;
60
85
  switch (parsedText.step) {
61
86
  case 'property': {
62
87
  newToken = matchTokenValue({
63
- propertyKey: parsedText.property.key,
88
+ propertyKey: parsedText.property.propertyKey,
64
89
  operator: parsedText.operator,
65
90
  value: parsedText.value,
66
- }, filteringOptions);
91
+ }, internalFilteringOptions);
67
92
  break;
68
93
  }
69
94
  case 'free-text': {
@@ -100,7 +125,7 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
100
125
  filteringOperator: undefined,
101
126
  };
102
127
  if (parsedText.step === 'property') {
103
- loadMoreDetail.filteringProperty = parsedText.property;
128
+ loadMoreDetail.filteringProperty = parsedText.property.externalProperty;
104
129
  loadMoreDetail.filteringText = parsedText.value;
105
130
  loadMoreDetail.filteringOperator = parsedText.operator;
106
131
  }
@@ -133,13 +158,13 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
133
158
  }
134
159
  // stop dropdown from closing
135
160
  event.preventDefault();
136
- const parsedText = parseText(value, filteringProperties, disableFreeTextFiltering);
161
+ const parsedText = parseText(value, internalFilteringProperties, disableFreeTextFiltering);
137
162
  const loadMoreDetail = getLoadMoreDetail(parsedText, value);
138
163
  // Insert operator automatically if only one operator is defined for the given property.
139
164
  if (parsedText.step === 'operator') {
140
165
  const operators = getAllowedOperators(parsedText.property);
141
166
  if (value.trim() === parsedText.property.propertyLabel && operators.length === 1) {
142
- loadMoreDetail.filteringProperty = parsedText.property;
167
+ loadMoreDetail.filteringProperty = parsedText.property.externalProperty;
143
168
  loadMoreDetail.filteringOperator = operators[0];
144
169
  loadMoreDetail.filteringText = '';
145
170
  setFilteringText(parsedText.property.propertyLabel + ' ' + operators[0] + ' ');
@@ -147,13 +172,12 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
147
172
  }
148
173
  fireNonCancelableEvent(onLoadItems, Object.assign(Object.assign({}, loadMoreDetail), { firstPage: true, samePage: false }));
149
174
  };
150
- const operatorForm = parsedText.step === 'property' &&
151
- ((_b = getExtendedOperator(filteringProperties, parsedText.property.key, parsedText.operator)) === null || _b === void 0 ? void 0 : _b.form);
175
+ const operatorForm = parsedText.step === 'property' && parsedText.property.getValueFormRenderer(parsedText.operator);
152
176
  const searchResultsId = useUniqueId('property-filter-search-results');
153
177
  return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }),
154
178
  React.createElement("div", { className: styles['search-field'] },
155
179
  customControl && React.createElement("div", { className: styles['custom-control'] }, customControl),
156
- React.createElement(PropertyFilterAutosuggest, Object.assign({ ref: inputRef, virtualScroll: virtualScroll, enteredTextLabel: (_c = i18nStrings.enteredTextLabel) !== null && _c !== void 0 ? _c : (value => value), ariaLabel: i18nStrings.filteringAriaLabel, placeholder: i18nStrings.filteringPlaceholder, ariaLabelledby: rest.ariaLabelledby, ariaDescribedby: rest.ariaDescribedby, controlId: rest.controlId, value: filteringText, disabled: disabled, onKeyDown: handleKeyDown }, autosuggestOptions, { onChange: event => setFilteringText(event.detail.value), empty: filteringEmpty }, asyncAutosuggestProps, { expandToViewport: expandToViewport, onOptionClick: handleSelected, customForm: operatorForm && (React.createElement(PropertyEditor, { property: parsedText.property, operator: parsedText.operator, filter: parsedText.value, operatorForm: operatorForm, i18nStrings: i18nStrings, onCancel: () => {
180
+ React.createElement(PropertyFilterAutosuggest, Object.assign({ ref: inputRef, virtualScroll: virtualScroll, enteredTextLabel: (_b = i18nStrings.enteredTextLabel) !== null && _b !== void 0 ? _b : (value => value), ariaLabel: i18nStrings.filteringAriaLabel, placeholder: i18nStrings.filteringPlaceholder, ariaLabelledby: rest.ariaLabelledby, ariaDescribedby: rest.ariaDescribedby, controlId: rest.controlId, value: filteringText, disabled: disabled, onKeyDown: handleKeyDown }, autosuggestOptions, { onChange: event => setFilteringText(event.detail.value), empty: filteringEmpty }, asyncAutosuggestProps, { expandToViewport: expandToViewport, onOptionClick: handleSelected, customForm: operatorForm && (React.createElement(PropertyEditor, { property: parsedText.property, operator: parsedText.operator, filter: parsedText.value, operatorForm: operatorForm, i18nStrings: i18nStrings, onCancel: () => {
157
181
  var _a, _b;
158
182
  setFilteringText('');
159
183
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.close();
@@ -171,7 +195,7 @@ const PropertyFilter = React.forwardRef((_a, ref) => {
171
195
  React.createElement(TokenList, { alignment: "inline", limit: tokenLimit, items: tokens, renderItem: (token, tokenIndex) => (React.createElement(TokenButton, { token: token, first: tokenIndex === 0, operation: operation, removeToken: () => {
172
196
  removeToken(tokenIndex);
173
197
  setRemovedTokenIndex(tokenIndex);
174
- }, setToken: (newToken) => setToken(tokenIndex, newToken), setOperation: setOperation, filteringOptions: filteringOptions, filteringProperties: filteringProperties, asyncProps: asyncProps, onLoadItems: onLoadItems, i18nStrings: i18nStrings, asyncProperties: asyncProperties, hideOperations: hideOperations, customGroupsText: customGroupsText, disableFreeTextFiltering: disableFreeTextFiltering, disabled: disabled, expandToViewport: expandToViewport })), i18nStrings: {
198
+ }, 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: {
175
199
  limitShowFewer: i18nStrings.tokenLimitShowFewer,
176
200
  limitShowMore: i18nStrings.tokenLimitShowMore,
177
201
  }, after: React.createElement(InternalButton, { onClick: removeAllTokens, className: styles['remove-all'], disabled: disabled }, i18nStrings.clearFiltersText), removedItemIndex: removedTokenIndex }))))));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["property-filter/index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cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef, useState, useImperativeHandle } from 'react';\n\nimport InternalSpaceBetween from '../space-between/internal';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index';\nimport { fireNonCancelableEvent } from '../internal/events';\n\nimport { PropertyFilterOperator } from '@cloudscape-design/collection-hooks';\nimport { PropertyFilterProps, ParsedText, Ref, FilteringProperty, ComparisonOperator, Token } from './interfaces';\nimport { TokenButton } from './token';\nimport {\n getQueryActions,\n parseText,\n getAutosuggestOptions,\n getAllowedOperators,\n getExtendedOperator,\n} from './controller';\nimport { useLoadItems } from './use-load-items';\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport PropertyFilterAutosuggest, { PropertyFilterAutosuggestProps } from './property-filter-autosuggest';\nimport { PropertyEditor } from './property-editor';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { matchTokenValue } from './utils';\nimport { useInternalI18n } from '../internal/i18n/context';\nimport TokenList from '../internal/components/token-list';\nimport { SearchResults } from '../text-filter/search-results';\n\nexport { PropertyFilterProps };\n\nconst OPERATOR_I18N_MAPPING: Record<PropertyFilterOperator, string> = {\n '=': 'equals',\n '!=': 'not_equals',\n '>': 'greater_than',\n '>=': 'greater_than_equal',\n '<': 'less_than',\n '<=': 'less_than_equal',\n ':': 'contains',\n '!:': 'not_contains',\n};\n\nconst PropertyFilter = React.forwardRef(\n (\n {\n disabled,\n countText,\n query,\n hideOperations,\n onChange,\n filteringProperties,\n filteringOptions = [],\n customGroupsText = [],\n disableFreeTextFiltering = false,\n onLoadItems,\n virtualScroll,\n customControl,\n filteringEmpty,\n filteringLoadingText,\n filteringFinishedText,\n filteringErrorText,\n filteringRecoveryText,\n filteringStatusType,\n asyncProperties,\n tokenLimit,\n expandToViewport,\n ...rest\n }: PropertyFilterProps,\n ref: React.Ref<Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('PropertyFilter');\n const [removedTokenIndex, setRemovedTokenIndex] = useState<null | number>(null);\n\n const inputRef = useRef<AutosuggestInputRef>(null);\n const baseProps = getBaseProps(rest);\n\n const i18n = useInternalI18n('property-filter');\n const i18nStrings: PropertyFilterProps.I18nStrings = {\n ...rest.i18nStrings,\n allPropertiesLabel: i18n('i18nStrings.allPropertiesLabel', rest.i18nStrings.allPropertiesLabel),\n applyActionText: i18n('i18nStrings.applyActionText', rest.i18nStrings.applyActionText),\n cancelActionText: i18n('i18nStrings.cancelActionText', rest.i18nStrings.cancelActionText),\n clearFiltersText: i18n('i18nStrings.clearFiltersText', rest.i18nStrings.clearFiltersText),\n editTokenHeader: i18n('i18nStrings.editTokenHeader', rest.i18nStrings.editTokenHeader),\n enteredTextLabel: i18n('i18nStrings.enteredTextLabel', rest.i18nStrings.enteredTextLabel),\n groupPropertiesText: i18n('i18nStrings.groupPropertiesText', rest.i18nStrings.groupPropertiesText),\n groupValuesText: i18n('i18nStrings.groupValuesText', rest.i18nStrings.groupValuesText),\n operationAndText: i18n('i18nStrings.operationAndText', rest.i18nStrings.operationAndText),\n operationOrText: i18n('i18nStrings.operationOrText', rest.i18nStrings.operationOrText),\n operatorContainsText: i18n('i18nStrings.operatorContainsText', rest.i18nStrings.operatorContainsText),\n operatorDoesNotContainText: i18n(\n 'i18nStrings.operatorDoesNotContainText',\n rest.i18nStrings.operatorDoesNotContainText\n ),\n operatorDoesNotEqualText: i18n('i18nStrings.operatorDoesNotEqualText', rest.i18nStrings.operatorDoesNotEqualText),\n operatorEqualsText: i18n('i18nStrings.operatorEqualsText', rest.i18nStrings.operatorEqualsText),\n operatorGreaterOrEqualText: i18n(\n 'i18nStrings.operatorGreaterOrEqualText',\n rest.i18nStrings.operatorGreaterOrEqualText\n ),\n operatorGreaterText: i18n('i18nStrings.operatorGreaterText', rest.i18nStrings.operatorGreaterText),\n operatorLessOrEqualText: i18n('i18nStrings.operatorLessOrEqualText', rest.i18nStrings.operatorLessOrEqualText),\n operatorLessText: i18n('i18nStrings.operatorLessText', rest.i18nStrings.operatorLessText),\n operatorText: i18n('i18nStrings.operatorText', rest.i18nStrings.operatorText),\n operatorsText: i18n('i18nStrings.operatorsText', rest.i18nStrings.operatorsText),\n propertyText: i18n('i18nStrings.propertyText', rest.i18nStrings.propertyText),\n tokenLimitShowFewer: i18n('i18nStrings.tokenLimitShowFewer', rest.i18nStrings.tokenLimitShowFewer),\n tokenLimitShowMore: i18n('i18nStrings.tokenLimitShowMore', rest.i18nStrings.tokenLimitShowMore),\n valueText: i18n('i18nStrings.valueText', rest.i18nStrings.valueText),\n removeTokenButtonAriaLabel: i18n(\n 'i18nStrings.removeTokenButtonAriaLabel',\n rest.i18nStrings.removeTokenButtonAriaLabel,\n format => token =>\n format({\n token__operator: OPERATOR_I18N_MAPPING[token.operator],\n token__propertyKey: token.propertyKey ?? '',\n token__value: token.value,\n })\n ),\n };\n\n useImperativeHandle(ref, () => ({ focus: () => inputRef.current?.focus() }), []);\n const { tokens, operation } = query;\n const showResults = !!tokens?.length && !disabled && !!countText;\n const { addToken, removeToken, setToken, setOperation, removeAllTokens } = getQueryActions(\n query,\n onChange,\n inputRef\n );\n const [filteringText, setFilteringText] = useState<string>('');\n const parsedText = parseText(filteringText, filteringProperties, disableFreeTextFiltering);\n const autosuggestOptions = getAutosuggestOptions(\n parsedText,\n filteringOptions,\n filteringProperties,\n customGroupsText,\n i18nStrings\n );\n\n const createToken = (currentText: string) => {\n const parsedText = parseText(currentText, filteringProperties, disableFreeTextFiltering);\n let newToken: Token;\n switch (parsedText.step) {\n case 'property': {\n newToken = matchTokenValue(\n {\n propertyKey: parsedText.property.key,\n operator: parsedText.operator,\n value: parsedText.value,\n },\n filteringOptions\n );\n break;\n }\n case 'free-text': {\n newToken = {\n operator: parsedText.operator || ':',\n value: parsedText.value,\n };\n break;\n }\n case 'operator': {\n newToken = {\n operator: ':',\n value: currentText,\n };\n break;\n }\n }\n if (disableFreeTextFiltering && !('propertyKey' in newToken)) {\n return;\n }\n addToken(newToken);\n setFilteringText('');\n };\n const ignoreKeyDown = useRef<boolean>(false);\n const handleKeyDown: PropertyFilterAutosuggestProps['onKeyDown'] = event => {\n if (filteringText && !ignoreKeyDown.current && event.detail.keyCode === KeyCode.enter) {\n createToken(filteringText);\n }\n };\n const getLoadMoreDetail = (parsedText: ParsedText, filteringText: string) => {\n const loadMoreDetail: {\n filteringProperty: FilteringProperty | undefined;\n filteringText: string;\n filteringOperator: ComparisonOperator | undefined;\n } = {\n filteringProperty: undefined,\n filteringText,\n filteringOperator: undefined,\n };\n if (parsedText.step === 'property') {\n loadMoreDetail.filteringProperty = parsedText.property;\n loadMoreDetail.filteringText = parsedText.value;\n loadMoreDetail.filteringOperator = parsedText.operator;\n }\n return loadMoreDetail;\n };\n const loadMoreDetail = getLoadMoreDetail(parsedText, filteringText);\n const inputLoadItemsHandlers = useLoadItems(\n onLoadItems,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringProperty,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringOperator\n );\n const asyncProps = {\n empty: filteringEmpty,\n loadingText: filteringLoadingText,\n finishedText: filteringFinishedText,\n errorText: filteringErrorText,\n recoveryText: filteringRecoveryText,\n statusType: filteringStatusType,\n };\n const asyncAutosuggestProps =\n !!filteringText.length || asyncProperties\n ? {\n ...inputLoadItemsHandlers,\n ...asyncProps,\n }\n : {};\n const handleSelected: PropertyFilterAutosuggestProps['onOptionClick'] = event => {\n // The ignoreKeyDown flag makes sure `createToken` routine runs only once. Autosuggest's `onKeyDown` fires,\n // when an item is selected from the list using \"enter\" key.\n ignoreKeyDown.current = true;\n setTimeout(() => {\n ignoreKeyDown.current = false;\n }, 0);\n const { detail: option } = event;\n const value = option.value || '';\n\n if (!('keepOpenOnSelect' in option)) {\n createToken(value);\n return;\n }\n\n // stop dropdown from closing\n event.preventDefault();\n\n const parsedText = parseText(value, filteringProperties, disableFreeTextFiltering);\n const loadMoreDetail = getLoadMoreDetail(parsedText, value);\n\n // Insert operator automatically if only one operator is defined for the given property.\n if (parsedText.step === 'operator') {\n const operators = getAllowedOperators(parsedText.property);\n if (value.trim() === parsedText.property.propertyLabel && operators.length === 1) {\n loadMoreDetail.filteringProperty = parsedText.property;\n loadMoreDetail.filteringOperator = operators[0];\n loadMoreDetail.filteringText = '';\n setFilteringText(parsedText.property.propertyLabel + ' ' + operators[0] + ' ');\n }\n }\n\n fireNonCancelableEvent(onLoadItems, { ...loadMoreDetail, firstPage: true, samePage: false });\n };\n\n const operatorForm =\n parsedText.step === 'property' &&\n getExtendedOperator(filteringProperties, parsedText.property.key, parsedText.operator)?.form;\n\n const searchResultsId = useUniqueId('property-filter-search-results');\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div className={styles['search-field']}>\n {customControl && <div className={styles['custom-control']}>{customControl}</div>}\n <PropertyFilterAutosuggest\n ref={inputRef}\n virtualScroll={virtualScroll}\n enteredTextLabel={i18nStrings.enteredTextLabel ?? (value => value)}\n ariaLabel={i18nStrings.filteringAriaLabel}\n placeholder={i18nStrings.filteringPlaceholder}\n ariaLabelledby={rest.ariaLabelledby}\n ariaDescribedby={rest.ariaDescribedby}\n controlId={rest.controlId}\n value={filteringText}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n {...autosuggestOptions}\n onChange={event => setFilteringText(event.detail.value)}\n empty={filteringEmpty}\n {...asyncAutosuggestProps}\n expandToViewport={expandToViewport}\n onOptionClick={handleSelected}\n customForm={\n operatorForm && (\n <PropertyEditor\n property={parsedText.property}\n operator={parsedText.operator}\n filter={parsedText.value}\n operatorForm={operatorForm}\n i18nStrings={i18nStrings}\n onCancel={() => {\n setFilteringText('');\n inputRef.current?.close();\n inputRef.current?.focus({ preventDropdown: true });\n }}\n onSubmit={token => {\n addToken(token);\n setFilteringText('');\n inputRef.current?.focus({ preventDropdown: true });\n inputRef.current?.close();\n }}\n />\n )\n }\n hideEnteredTextOption={disableFreeTextFiltering && parsedText.step !== 'property'}\n clearAriaLabel={i18nStrings.clearAriaLabel}\n searchResultsId={showResults ? searchResultsId : undefined}\n />\n {showResults ? <SearchResults id={searchResultsId}>{countText}</SearchResults> : null}\n </div>\n {tokens && tokens.length > 0 && (\n <div className={styles.tokens}>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n <TokenList\n alignment=\"inline\"\n limit={tokenLimit}\n items={tokens}\n renderItem={(token, tokenIndex) => (\n <TokenButton\n token={token}\n first={tokenIndex === 0}\n operation={operation}\n removeToken={() => {\n removeToken(tokenIndex);\n setRemovedTokenIndex(tokenIndex);\n }}\n setToken={(newToken: Token) => setToken(tokenIndex, newToken)}\n setOperation={setOperation}\n filteringOptions={filteringOptions}\n filteringProperties={filteringProperties}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n hideOperations={hideOperations}\n customGroupsText={customGroupsText}\n disableFreeTextFiltering={disableFreeTextFiltering}\n disabled={disabled}\n expandToViewport={expandToViewport}\n />\n )}\n i18nStrings={{\n limitShowFewer: i18nStrings.tokenLimitShowFewer,\n limitShowMore: i18nStrings.tokenLimitShowMore,\n }}\n after={\n <InternalButton onClick={removeAllTokens} className={styles['remove-all']} disabled={disabled}>\n {i18nStrings.clearFiltersText}\n </InternalButton>\n }\n removedItemIndex={removedTokenIndex}\n />\n </InternalSpaceBetween>\n </div>\n )}\n </div>\n );\n }\n);\n\napplyDisplayName(PropertyFilter, 'PropertyFilter');\nexport default PropertyFilter;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["property-filter/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAC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B,EAC1C,mBAAmB,EAAE,2BAA2B,EAChD,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,wBAAwB,EAAE,wBAAwB,EAClD,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAClC,CACH,EACD,WAAW,EAAE;wBACX,cAAc,EAAE,WAAW,CAAC,mBAAmB;wBAC/C,aAAa,EAAE,WAAW,CAAC,kBAAkB;qBAC9C,EACD,KAAK,EACH,oBAAC,cAAc,IAAC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,IAC1F,WAAW,CAAC,gBAAgB,CACd,EAEnB,gBAAgB,EAAE,iBAAiB,GACnC,CACmB,CACnB,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef, useState, useImperativeHandle } from 'react';\n\nimport InternalSpaceBetween from '../space-between/internal';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index';\nimport { fireNonCancelableEvent } from '../internal/events';\n\nimport {\n PropertyFilterProps,\n ParsedText,\n Ref,\n ComparisonOperator,\n Token,\n InternalFilteringProperty,\n InternalFilteringOption,\n FilteringProperty,\n ExtendedOperator,\n} from './interfaces';\nimport { TokenButton } from './token';\nimport { getQueryActions, parseText, getAutosuggestOptions, getAllowedOperators } from './controller';\nimport { useLoadItems } from './use-load-items';\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport PropertyFilterAutosuggest, { PropertyFilterAutosuggestProps } from './property-filter-autosuggest';\nimport { PropertyEditor } from './property-editor';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { matchTokenValue } from './utils';\nimport { PropertyFilterOperator } from '@cloudscape-design/collection-hooks';\nimport { useInternalI18n } from '../internal/i18n/context';\nimport TokenList from '../internal/components/token-list';\nimport { SearchResults } from '../text-filter/search-results';\n\nexport { PropertyFilterProps };\n\nconst OPERATOR_I18N_MAPPING: Record<PropertyFilterOperator, string> = {\n '=': 'equals',\n '!=': 'not_equals',\n '>': 'greater_than',\n '>=': 'greater_than_equal',\n '<': 'less_than',\n '<=': 'less_than_equal',\n ':': 'contains',\n '!:': 'not_contains',\n};\n\nconst PropertyFilter = React.forwardRef(\n (\n {\n disabled,\n countText,\n query,\n hideOperations,\n onChange,\n filteringProperties,\n filteringOptions = [],\n customGroupsText = [],\n disableFreeTextFiltering = false,\n onLoadItems,\n virtualScroll,\n customControl,\n filteringEmpty,\n filteringLoadingText,\n filteringFinishedText,\n filteringErrorText,\n filteringRecoveryText,\n filteringStatusType,\n asyncProperties,\n tokenLimit,\n expandToViewport,\n ...rest\n }: PropertyFilterProps,\n ref: React.Ref<Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('PropertyFilter');\n const [removedTokenIndex, setRemovedTokenIndex] = useState<null | number>(null);\n\n const inputRef = useRef<AutosuggestInputRef>(null);\n const baseProps = getBaseProps(rest);\n\n const i18n = useInternalI18n('property-filter');\n const i18nStrings: PropertyFilterProps.I18nStrings = {\n ...rest.i18nStrings,\n allPropertiesLabel: i18n('i18nStrings.allPropertiesLabel', rest.i18nStrings.allPropertiesLabel),\n applyActionText: i18n('i18nStrings.applyActionText', rest.i18nStrings.applyActionText),\n cancelActionText: i18n('i18nStrings.cancelActionText', rest.i18nStrings.cancelActionText),\n clearFiltersText: i18n('i18nStrings.clearFiltersText', rest.i18nStrings.clearFiltersText),\n editTokenHeader: i18n('i18nStrings.editTokenHeader', rest.i18nStrings.editTokenHeader),\n enteredTextLabel: i18n('i18nStrings.enteredTextLabel', rest.i18nStrings.enteredTextLabel),\n groupPropertiesText: i18n('i18nStrings.groupPropertiesText', rest.i18nStrings.groupPropertiesText),\n groupValuesText: i18n('i18nStrings.groupValuesText', rest.i18nStrings.groupValuesText),\n operationAndText: i18n('i18nStrings.operationAndText', rest.i18nStrings.operationAndText),\n operationOrText: i18n('i18nStrings.operationOrText', rest.i18nStrings.operationOrText),\n operatorContainsText: i18n('i18nStrings.operatorContainsText', rest.i18nStrings.operatorContainsText),\n operatorDoesNotContainText: i18n(\n 'i18nStrings.operatorDoesNotContainText',\n rest.i18nStrings.operatorDoesNotContainText\n ),\n operatorDoesNotEqualText: i18n('i18nStrings.operatorDoesNotEqualText', rest.i18nStrings.operatorDoesNotEqualText),\n operatorEqualsText: i18n('i18nStrings.operatorEqualsText', rest.i18nStrings.operatorEqualsText),\n operatorGreaterOrEqualText: i18n(\n 'i18nStrings.operatorGreaterOrEqualText',\n rest.i18nStrings.operatorGreaterOrEqualText\n ),\n operatorGreaterText: i18n('i18nStrings.operatorGreaterText', rest.i18nStrings.operatorGreaterText),\n operatorLessOrEqualText: i18n('i18nStrings.operatorLessOrEqualText', rest.i18nStrings.operatorLessOrEqualText),\n operatorLessText: i18n('i18nStrings.operatorLessText', rest.i18nStrings.operatorLessText),\n operatorText: i18n('i18nStrings.operatorText', rest.i18nStrings.operatorText),\n operatorsText: i18n('i18nStrings.operatorsText', rest.i18nStrings.operatorsText),\n propertyText: i18n('i18nStrings.propertyText', rest.i18nStrings.propertyText),\n tokenLimitShowFewer: i18n('i18nStrings.tokenLimitShowFewer', rest.i18nStrings.tokenLimitShowFewer),\n tokenLimitShowMore: i18n('i18nStrings.tokenLimitShowMore', rest.i18nStrings.tokenLimitShowMore),\n valueText: i18n('i18nStrings.valueText', rest.i18nStrings.valueText),\n removeTokenButtonAriaLabel: i18n(\n 'i18nStrings.removeTokenButtonAriaLabel',\n rest.i18nStrings.removeTokenButtonAriaLabel,\n format => token =>\n format({\n token__operator: OPERATOR_I18N_MAPPING[token.operator],\n token__propertyKey: token.propertyKey ?? '',\n token__value: token.value,\n })\n ),\n };\n\n useImperativeHandle(ref, () => ({ focus: () => inputRef.current?.focus() }), []);\n const { tokens, operation } = query;\n const showResults = !!tokens?.length && !disabled && !!countText;\n const { addToken, removeToken, setToken, setOperation, removeAllTokens } = getQueryActions(\n query,\n onChange,\n inputRef\n );\n const [filteringText, setFilteringText] = useState<string>('');\n\n const internalFilteringProperties: readonly InternalFilteringProperty[] = filteringProperties.map(property => {\n const extendedOperators = (property.operators ?? []).reduce(\n (acc, operator) => (typeof operator === 'object' ? acc.set(operator.operator, operator) : acc),\n new Map<PropertyFilterOperator, null | ExtendedOperator<any>>()\n );\n return {\n propertyKey: property.key,\n propertyLabel: property.propertyLabel ?? '',\n groupValuesLabel: property.groupValuesLabel ?? '',\n propertyGroup: property.group,\n operators: (property.operators ?? []).map(op => (typeof op === 'string' ? op : op.operator)),\n defaultOperator: property.defaultOperator ?? '=',\n getValueFormatter: operator => (operator ? extendedOperators.get(operator)?.format ?? null : null),\n getValueFormRenderer: operator => (operator ? extendedOperators.get(operator)?.form ?? null : null),\n externalProperty: property,\n };\n });\n\n const propertyByKey = new Map(internalFilteringProperties.map(p => [p.propertyKey, p]));\n\n const internalFilteringOptions: readonly InternalFilteringOption[] = filteringOptions.map(option => {\n const formatter = propertyByKey.get(option.propertyKey)?.getValueFormatter();\n return {\n propertyKey: option.propertyKey,\n value: option.value,\n label: formatter ? formatter(option.value) : option.label ?? option.value ?? '',\n };\n });\n\n const parsedText = parseText(filteringText, internalFilteringProperties, disableFreeTextFiltering);\n const autosuggestOptions = getAutosuggestOptions(\n parsedText,\n internalFilteringOptions,\n internalFilteringProperties,\n customGroupsText,\n i18nStrings\n );\n\n const createToken = (currentText: string) => {\n const parsedText = parseText(currentText, internalFilteringProperties, disableFreeTextFiltering);\n let newToken: Token;\n switch (parsedText.step) {\n case 'property': {\n newToken = matchTokenValue(\n {\n propertyKey: parsedText.property.propertyKey,\n operator: parsedText.operator,\n value: parsedText.value,\n },\n internalFilteringOptions\n );\n break;\n }\n case 'free-text': {\n newToken = {\n operator: parsedText.operator || ':',\n value: parsedText.value,\n };\n break;\n }\n case 'operator': {\n newToken = {\n operator: ':',\n value: currentText,\n };\n break;\n }\n }\n if (disableFreeTextFiltering && !('propertyKey' in newToken)) {\n return;\n }\n addToken(newToken);\n setFilteringText('');\n };\n const ignoreKeyDown = useRef<boolean>(false);\n const handleKeyDown: PropertyFilterAutosuggestProps['onKeyDown'] = event => {\n if (filteringText && !ignoreKeyDown.current && event.detail.keyCode === KeyCode.enter) {\n createToken(filteringText);\n }\n };\n const getLoadMoreDetail = (parsedText: ParsedText, filteringText: string) => {\n const loadMoreDetail: {\n filteringProperty: FilteringProperty | undefined;\n filteringText: string;\n filteringOperator: ComparisonOperator | undefined;\n } = {\n filteringProperty: undefined,\n filteringText,\n filteringOperator: undefined,\n };\n if (parsedText.step === 'property') {\n loadMoreDetail.filteringProperty = parsedText.property.externalProperty;\n loadMoreDetail.filteringText = parsedText.value;\n loadMoreDetail.filteringOperator = parsedText.operator;\n }\n return loadMoreDetail;\n };\n const loadMoreDetail = getLoadMoreDetail(parsedText, filteringText);\n const inputLoadItemsHandlers = useLoadItems(\n onLoadItems,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringProperty,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringOperator\n );\n const asyncProps = {\n empty: filteringEmpty,\n loadingText: filteringLoadingText,\n finishedText: filteringFinishedText,\n errorText: filteringErrorText,\n recoveryText: filteringRecoveryText,\n statusType: filteringStatusType,\n };\n const asyncAutosuggestProps =\n !!filteringText.length || asyncProperties\n ? {\n ...inputLoadItemsHandlers,\n ...asyncProps,\n }\n : {};\n const handleSelected: PropertyFilterAutosuggestProps['onOptionClick'] = event => {\n // The ignoreKeyDown flag makes sure `createToken` routine runs only once. Autosuggest's `onKeyDown` fires,\n // when an item is selected from the list using \"enter\" key.\n ignoreKeyDown.current = true;\n setTimeout(() => {\n ignoreKeyDown.current = false;\n }, 0);\n const { detail: option } = event;\n const value = option.value || '';\n\n if (!('keepOpenOnSelect' in option)) {\n createToken(value);\n return;\n }\n\n // stop dropdown from closing\n event.preventDefault();\n\n const parsedText = parseText(value, internalFilteringProperties, disableFreeTextFiltering);\n const loadMoreDetail = getLoadMoreDetail(parsedText, value);\n\n // Insert operator automatically if only one operator is defined for the given property.\n if (parsedText.step === 'operator') {\n const operators = getAllowedOperators(parsedText.property);\n if (value.trim() === parsedText.property.propertyLabel && operators.length === 1) {\n loadMoreDetail.filteringProperty = parsedText.property.externalProperty;\n loadMoreDetail.filteringOperator = operators[0];\n loadMoreDetail.filteringText = '';\n setFilteringText(parsedText.property.propertyLabel + ' ' + operators[0] + ' ');\n }\n }\n\n fireNonCancelableEvent(onLoadItems, { ...loadMoreDetail, firstPage: true, samePage: false });\n };\n\n const operatorForm =\n parsedText.step === 'property' && parsedText.property.getValueFormRenderer(parsedText.operator);\n\n const searchResultsId = useUniqueId('property-filter-search-results');\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div className={styles['search-field']}>\n {customControl && <div className={styles['custom-control']}>{customControl}</div>}\n <PropertyFilterAutosuggest\n ref={inputRef}\n virtualScroll={virtualScroll}\n enteredTextLabel={i18nStrings.enteredTextLabel ?? (value => value)}\n ariaLabel={i18nStrings.filteringAriaLabel}\n placeholder={i18nStrings.filteringPlaceholder}\n ariaLabelledby={rest.ariaLabelledby}\n ariaDescribedby={rest.ariaDescribedby}\n controlId={rest.controlId}\n value={filteringText}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n {...autosuggestOptions}\n onChange={event => setFilteringText(event.detail.value)}\n empty={filteringEmpty}\n {...asyncAutosuggestProps}\n expandToViewport={expandToViewport}\n onOptionClick={handleSelected}\n customForm={\n operatorForm && (\n <PropertyEditor\n property={parsedText.property}\n operator={parsedText.operator}\n filter={parsedText.value}\n operatorForm={operatorForm}\n i18nStrings={i18nStrings}\n onCancel={() => {\n setFilteringText('');\n inputRef.current?.close();\n inputRef.current?.focus({ preventDropdown: true });\n }}\n onSubmit={token => {\n addToken(token);\n setFilteringText('');\n inputRef.current?.focus({ preventDropdown: true });\n inputRef.current?.close();\n }}\n />\n )\n }\n hideEnteredTextOption={disableFreeTextFiltering && parsedText.step !== 'property'}\n clearAriaLabel={i18nStrings.clearAriaLabel}\n searchResultsId={showResults ? searchResultsId : undefined}\n />\n {showResults ? <SearchResults id={searchResultsId}>{countText}</SearchResults> : null}\n </div>\n {tokens && tokens.length > 0 && (\n <div className={styles.tokens}>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n <TokenList\n alignment=\"inline\"\n limit={tokenLimit}\n items={tokens}\n renderItem={(token, tokenIndex) => (\n <TokenButton\n token={token}\n first={tokenIndex === 0}\n operation={operation}\n removeToken={() => {\n removeToken(tokenIndex);\n setRemovedTokenIndex(tokenIndex);\n }}\n setToken={(newToken: Token) => setToken(tokenIndex, newToken)}\n setOperation={setOperation}\n filteringOptions={internalFilteringOptions}\n filteringProperties={internalFilteringProperties}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n hideOperations={hideOperations}\n customGroupsText={customGroupsText}\n disableFreeTextFiltering={disableFreeTextFiltering}\n disabled={disabled}\n expandToViewport={expandToViewport}\n />\n )}\n i18nStrings={{\n limitShowFewer: i18nStrings.tokenLimitShowFewer,\n limitShowMore: i18nStrings.tokenLimitShowMore,\n }}\n after={\n <InternalButton onClick={removeAllTokens} className={styles['remove-all']} disabled={disabled}>\n {i18nStrings.clearFiltersText}\n </InternalButton>\n }\n removedItemIndex={removedTokenIndex}\n />\n </InternalSpaceBetween>\n </div>\n )}\n </div>\n );\n }\n);\n\napplyDisplayName(PropertyFilter, 'PropertyFilter');\nexport default PropertyFilter;\n"]}