@cloudscape-design/components 3.0.677 → 3.0.679

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.
@@ -9602,6 +9602,7 @@ module.exports.preset = {
9602
9602
  "colorBackgroundLayoutToggleSelectedHover",
9603
9603
  "colorBackgroundNotificationBlue",
9604
9604
  "colorBackgroundNotificationGreen",
9605
+ "colorBackgroundNotificationGrey",
9605
9606
  "colorBackgroundNotificationRed",
9606
9607
  "colorBackgroundNotificationYellow",
9607
9608
  "colorBackgroundPopover",
@@ -9917,6 +9918,7 @@ module.exports.preset = {
9917
9918
  "colorBackgroundLayoutToggleSelectedHover",
9918
9919
  "colorBackgroundNotificationBlue",
9919
9920
  "colorBackgroundNotificationGreen",
9921
+ "colorBackgroundNotificationGrey",
9920
9922
  "colorBackgroundNotificationRed",
9921
9923
  "colorBackgroundNotificationYellow",
9922
9924
  "colorBackgroundPopover",
@@ -93,6 +93,7 @@ export declare interface TypedOverride {
93
93
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
94
94
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
95
95
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
96
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
96
97
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
97
98
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
98
99
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -317,6 +318,7 @@ export declare interface TypedOverride {
317
318
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
318
319
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
319
320
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
321
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
320
322
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
321
323
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
322
324
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -541,6 +543,7 @@ export declare interface TypedOverride {
541
543
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
542
544
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
543
545
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
546
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
544
547
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
545
548
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
546
549
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -765,6 +768,7 @@ export declare interface TypedOverride {
765
768
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
766
769
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
767
770
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
771
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
768
772
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
769
773
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
770
774
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -989,6 +993,7 @@ export declare interface TypedOverride {
989
993
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
990
994
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
991
995
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
996
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
992
997
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
993
998
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
994
999
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1213,6 +1218,7 @@ export declare interface TypedOverride {
1213
1218
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1214
1219
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1215
1220
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1221
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1216
1222
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1217
1223
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1218
1224
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1437,6 +1443,7 @@ export declare interface TypedOverride {
1437
1443
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1438
1444
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1439
1445
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1446
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1440
1447
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1441
1448
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1442
1449
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1661,6 +1668,7 @@ export declare interface TypedOverride {
1661
1668
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1662
1669
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1663
1670
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1671
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1664
1672
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1665
1673
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1666
1674
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -93,6 +93,7 @@ export declare interface TypedOverride {
93
93
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
94
94
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
95
95
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
96
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
96
97
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
97
98
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
98
99
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -317,6 +318,7 @@ export declare interface TypedOverride {
317
318
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
318
319
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
319
320
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
321
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
320
322
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
321
323
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
322
324
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -541,6 +543,7 @@ export declare interface TypedOverride {
541
543
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
542
544
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
543
545
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
546
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
544
547
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
545
548
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
546
549
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -765,6 +768,7 @@ export declare interface TypedOverride {
765
768
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
766
769
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
767
770
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
771
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
768
772
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
769
773
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
770
774
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -989,6 +993,7 @@ export declare interface TypedOverride {
989
993
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
990
994
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
991
995
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
996
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
992
997
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
993
998
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
994
999
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1213,6 +1218,7 @@ export declare interface TypedOverride {
1213
1218
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1214
1219
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1215
1220
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1221
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1216
1222
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1217
1223
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1218
1224
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1437,6 +1443,7 @@ export declare interface TypedOverride {
1437
1443
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1438
1444
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1439
1445
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1446
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1440
1447
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1441
1448
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1442
1449
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1661,6 +1668,7 @@ export declare interface TypedOverride {
1661
1668
  colorBackgroundLayoutToggleSelectedHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1662
1669
  colorBackgroundNotificationBlue?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1663
1670
  colorBackgroundNotificationGreen?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1671
+ colorBackgroundNotificationGrey?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1664
1672
  colorBackgroundNotificationRed?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1665
1673
  colorBackgroundNotificationYellow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1666
1674
  colorBackgroundPopover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -9602,6 +9602,7 @@ export var preset = {
9602
9602
  "colorBackgroundLayoutToggleSelectedHover",
9603
9603
  "colorBackgroundNotificationBlue",
9604
9604
  "colorBackgroundNotificationGreen",
9605
+ "colorBackgroundNotificationGrey",
9605
9606
  "colorBackgroundNotificationRed",
9606
9607
  "colorBackgroundNotificationYellow",
9607
9608
  "colorBackgroundPopover",
@@ -9917,6 +9918,7 @@ export var preset = {
9917
9918
  "colorBackgroundLayoutToggleSelectedHover",
9918
9919
  "colorBackgroundNotificationBlue",
9919
9920
  "colorBackgroundNotificationGreen",
9921
+ "colorBackgroundNotificationGrey",
9920
9922
  "colorBackgroundNotificationRed",
9921
9923
  "colorBackgroundNotificationYellow",
9922
9924
  "colorBackgroundPopover",
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "fcd9ab11a71083f7476ba2c5f0a494ef7c047398"
2
+ "commit": "882dda893e981bba3206d07f1b6b7f7a72a02daf"
3
3
  }
package/package.json CHANGED
@@ -120,7 +120,7 @@
120
120
  "./internal/base-component/index.js",
121
121
  "./internal/base-component/styles.css.js"
122
122
  ],
123
- "version": "3.0.677",
123
+ "version": "3.0.679",
124
124
  "repository": {
125
125
  "type": "git",
126
126
  "url": "https://github.com/cloudscape-design/components.git"
@@ -15,7 +15,6 @@ interface OptionGroup<T> {
15
15
  options: T[];
16
16
  }
17
17
  export declare const getAllValueSuggestions: (filteringOptions: readonly InternalFilteringOption[], operator: ComparisonOperator | undefined, i18nStrings: I18nStrings, customGroupsText: readonly GroupText[]) => OptionGroup<import("../internal/components/option/interfaces").OptionDefinition>[];
18
- export declare function createPropertiesCompatibilityMap(filteringProperties: readonly InternalFilteringProperty[]): (propertyA: string, propertyB: string) => boolean;
19
18
  export declare function getPropertySuggestions<T>(filteringProperties: readonly InternalFilteringProperty[], customGroupsText: readonly GroupText[], i18nStrings: I18nStrings, filteringPropertyToOption: (filteringProperty: InternalFilteringProperty) => T): OptionGroup<T>[];
20
19
  export declare const getAutosuggestOptions: (parsedText: ParsedText, filteringProperties: readonly InternalFilteringProperty[], filteringOptions: readonly InternalFilteringOption[], customGroupsText: readonly GroupText[], i18nStrings: I18nStrings) => {
21
20
  filterText: string;
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAElB,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,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,K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EF,eAAO,MAAM,qBAAqB,aAAc,kBAAkB,eAAe,WAAW,uBA4B3F,CAAC"}
@@ -126,28 +126,6 @@ export const getAllValueSuggestions = (filteringOptions, operator = '=', i18nStr
126
126
  });
127
127
  return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];
128
128
  };
129
- export function createPropertiesCompatibilityMap(filteringProperties) {
130
- const lookup = {};
131
- for (const property of filteringProperties) {
132
- lookup[property.propertyKey] = (property.operators || [])
133
- .map(operator => ({ operator, form: property.getValueFormRenderer(operator) }))
134
- .sort((a, b) => a.operator.localeCompare(b.operator));
135
- }
136
- return (propertyA, propertyB) => {
137
- if (lookup[propertyA].length !== lookup[propertyB].length) {
138
- return false;
139
- }
140
- for (let i = 0; i < lookup[propertyA].length; i++) {
141
- if (lookup[propertyA][i].operator !== lookup[propertyB][i].operator) {
142
- return false;
143
- }
144
- if (lookup[propertyA][i].form !== lookup[propertyB][i].form) {
145
- return false;
146
- }
147
- }
148
- return true;
149
- };
150
- }
151
129
  const filteringPropertyToAutosuggestOption = (filteringProperty) => ({
152
130
  value: filteringProperty.propertyLabel,
153
131
  label: filteringProperty.propertyLabel,
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAetC,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,EAA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C,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,KAAK,IAAI;YACP,OAAO,WAAW,CAAC,4BAA4B,CAAC;QAClD,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 InternalFreeTextFiltering,\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, removeOperator, 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 freeTextFiltering: InternalFreeTextFiltering\n): ParsedText => {\n const property = matchFilteringProperty(filteringProperties, filteringText);\n if (!property) {\n if (!freeTextFiltering.disabled) {\n // For free text filtering, we allow ! as a shortcut for !:\n const freeTextOperators =\n freeTextFiltering.operators.indexOf('!:') >= 0\n ? ['!', ...freeTextFiltering.operators]\n : freeTextFiltering.operators;\n const operator = matchOperator(freeTextOperators, filteringText);\n if (operator) {\n return {\n step: 'free-text',\n operator: operator === '!' ? '!:' : operator,\n value: removeOperator(filteringText, operator),\n };\n }\n }\n\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 return {\n step: 'property',\n property,\n operator,\n value: removeOperator(textWithoutProperty, operator),\n };\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 case '!^':\n return i18nStrings.operatorDoesNotStartWithText;\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":"","sources":["../../../src/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,M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BAA4B,CAAC;QAClD,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 GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\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, removeOperator, 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 freeTextFiltering: InternalFreeTextFiltering\n): ParsedText => {\n const property = matchFilteringProperty(filteringProperties, filteringText);\n if (!property) {\n if (!freeTextFiltering.disabled) {\n // For free text filtering, we allow ! as a shortcut for !:\n const freeTextOperators =\n freeTextFiltering.operators.indexOf('!:') >= 0\n ? ['!', ...freeTextFiltering.operators]\n : freeTextFiltering.operators;\n const operator = matchOperator(freeTextOperators, filteringText);\n if (operator) {\n return {\n step: 'free-text',\n operator: operator === '!' ? '!:' : operator,\n value: removeOperator(filteringText, operator),\n };\n }\n }\n\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 return {\n step: 'property',\n property,\n operator,\n value: removeOperator(textWithoutProperty, operator),\n };\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\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 case '!^':\n return i18nStrings.operatorDoesNotStartWithText;\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":"token-editor.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAMhD,OAAO,EAEL,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,eAAe,EACf,KAAK,EACN,MAAM,cAAc,CAAC;AAStB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AA8JxF,UAAU,gBAAgB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,mBAAmB,CAAC;IAChC,gBAAgB,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAC1D,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACrD,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAC;IACzD,QAAQ,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IACpC,KAAK,EAAE,aAAa,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC;AAED,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,QAAQ,EACR,KAAK,EACL,gBAAgB,GACjB,EAAE,gBAAgB,eA6GlB"}
1
+ {"version":3,"file":"token-editor.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAMhD,OAAO,EAEL,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,eAAe,EACf,KAAK,EACN,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAkJxF,UAAU,gBAAgB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,mBAAmB,CAAC;IAChC,gBAAgB,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAC1D,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACrD,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAC;IACzD,QAAQ,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IACpC,KAAK,EAAE,aAAa,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC;AAED,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,QAAQ,EACR,KAAK,EACL,gBAAgB,GACjB,EAAE,gBAAgB,eA6GlB"}
@@ -6,7 +6,7 @@ import InternalAutosuggest from '../autosuggest/internal';
6
6
  import InternalPopover from '../popover/internal';
7
7
  import styles from './styles.css.js';
8
8
  import { useLoadItems } from './use-load-items';
9
- import { createPropertiesCompatibilityMap, getAllowedOperators, operatorToDescription, getPropertySuggestions, } from './controller';
9
+ import { getAllowedOperators, operatorToDescription, getPropertySuggestions } from './controller';
10
10
  import InternalButton from '../button/internal';
11
11
  import InternalFormField from '../form-field/internal';
12
12
  import { matchTokenValue } from './utils';
@@ -19,17 +19,6 @@ function PropertyInput({ property, onChangePropertyKey, asyncProps, filteringPro
19
19
  label: propertyLabel,
20
20
  dontCloseOnSelect: true,
21
21
  }));
22
- // Disallow selecting properties that have different representation.
23
- const checkPropertiesCompatible = createPropertiesCompatibilityMap(filteringProperties);
24
- propertyOptions.forEach(optionGroup => {
25
- if ('options' in optionGroup) {
26
- optionGroup.options.forEach(option => {
27
- if ((property === null || property === void 0 ? void 0 : property.propertyKey) && option.value) {
28
- option.disabled = !checkPropertiesCompatible(option.value, property.propertyKey);
29
- }
30
- });
31
- }
32
- });
33
22
  const allPropertiesOption = {
34
23
  label: i18nStrings.allPropertiesLabel,
35
24
  value: undefined,
@@ -87,7 +76,7 @@ export function TokenEditor({ asyncProperties, asyncProps, customGroupsText, fre
87
76
  ? temporaryToken.operator
88
77
  : allowedOperators[0];
89
78
  const matchedProperty = (_a = filteringProperties.find(property => property.propertyKey === newPropertyKey)) !== null && _a !== void 0 ? _a : null;
90
- setTemporaryToken(Object.assign(Object.assign({}, temporaryToken), { property: matchedProperty, operator }));
79
+ setTemporaryToken(Object.assign(Object.assign({}, temporaryToken), { property: matchedProperty, operator, value: null }));
91
80
  };
92
81
  const operator = temporaryToken.operator;
93
82
  const onChangeOperator = (newOperator) => {
@@ -1 +1 @@
1
- {"version":3,"file":"token-editor.js","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAC1D,OAAO,eAAuC,MAAM,qBAAqB,CAAC;AAY1E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,gCAAgC,EAChC,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAGtB,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAa1C,SAAS,aAAa,CAAC,EACrB,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,iBAAiB,GACE;;IACnB,MAAM,sBAAsB,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,wBAAwB,GAAG,UAAU,CAAC,CAAC,iCAAM,UAAU,GAAK,sBAAsB,EAAG,CAAC,CAAC,EAAE,CAAC;IAChG,MAAM,eAAe,GAAqD,sBAAsB,CAC9F,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;QACnC,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,aAAa;QACpB,iBAAiB,EAAE,I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: Apache-2.0\nimport React, { useState, useRef } from 'react';\n\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport InternalAutosuggest from '../autosuggest/internal';\nimport InternalPopover, { InternalPopoverRef } from '../popover/internal';\nimport {\n ComparisonOperator,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalToken,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport styles from './styles.css.js';\nimport { useLoadItems } from './use-load-items';\nimport {\n createPropertiesCompatibilityMap,\n getAllowedOperators,\n operatorToDescription,\n getPropertySuggestions,\n} from './controller';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport InternalButton from '../button/internal';\nimport InternalFormField from '../form-field/internal';\nimport { matchTokenValue } from './utils';\n\ninterface PropertyInputProps {\n asyncProps: null | DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n freeTextFiltering: InternalFreeTextFiltering;\n filteringProperties: readonly InternalFilteringProperty[];\n i18nStrings: I18nStrings;\n onChangePropertyKey: (propertyKey: undefined | string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n property: null | InternalFilteringProperty;\n}\n\nfunction PropertyInput({\n property,\n onChangePropertyKey,\n asyncProps,\n filteringProperties,\n onLoadItems,\n customGroupsText,\n i18nStrings,\n freeTextFiltering,\n}: PropertyInputProps) {\n const propertySelectHandlers = useLoadItems(onLoadItems);\n const asyncPropertySelectProps = asyncProps ? { ...asyncProps, ...propertySelectHandlers } : {};\n const propertyOptions: (SelectProps.Option | SelectProps.OptionGroup)[] = getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n ({ propertyKey, propertyLabel }) => ({\n value: propertyKey,\n label: propertyLabel,\n dontCloseOnSelect: true,\n })\n );\n\n // Disallow selecting properties that have different representation.\n const checkPropertiesCompatible = createPropertiesCompatibilityMap(filteringProperties);\n propertyOptions.forEach(optionGroup => {\n if ('options' in optionGroup) {\n optionGroup.options.forEach(option => {\n if (property?.propertyKey && option.value) {\n option.disabled = !checkPropertiesCompatible(option.value, property.propertyKey);\n }\n });\n }\n });\n\n const allPropertiesOption = {\n label: i18nStrings.allPropertiesLabel,\n value: undefined,\n };\n if (!freeTextFiltering.disabled) {\n propertyOptions.unshift(allPropertiesOption);\n }\n return (\n <InternalSelect\n options={propertyOptions}\n selectedOption={\n property\n ? {\n value: property.propertyKey ?? undefined,\n label: property.propertyLabel,\n }\n : allPropertiesOption\n }\n onChange={e => onChangePropertyKey(e.detail.selectedOption.value)}\n {...asyncPropertySelectProps}\n />\n );\n}\n\ninterface OperatorInputProps {\n i18nStrings: I18nStrings;\n onChangeOperator: (operator: ComparisonOperator) => void;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n freeTextFiltering: InternalFreeTextFiltering;\n}\n\nfunction OperatorInput({ property, operator, onChangeOperator, i18nStrings, freeTextFiltering }: OperatorInputProps) {\n const operatorOptions = (property ? getAllowedOperators(property) : freeTextFiltering.operators).map(operator => ({\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }));\n return (\n <InternalSelect\n options={operatorOptions}\n triggerVariant=\"option\"\n selectedOption={\n operator\n ? {\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }\n : null\n }\n onChange={e => onChangeOperator(e.detail.selectedOption.value as ComparisonOperator)}\n />\n );\n}\n\ninterface ValueInputProps {\n asyncProps: DropdownStatusProps;\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onChangeValue: (value: string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n value: undefined | string;\n}\n\nfunction ValueInput({\n property,\n operator,\n value,\n onChangeValue,\n asyncProps,\n filteringOptions,\n onLoadItems,\n i18nStrings,\n}: ValueInputProps) {\n const valueOptions = property\n ? filteringOptions\n .filter(option => option.property?.propertyKey === property.propertyKey)\n .map(({ label, value }) => ({ label, value }))\n : [];\n\n const valueAutosuggestHandlers = useLoadItems(onLoadItems, '', property?.externalProperty);\n const asyncValueAutosuggestProps = property?.propertyKey\n ? { ...valueAutosuggestHandlers, ...asyncProps }\n : { empty: asyncProps.empty };\n const [matchedOption] = valueOptions.filter(option => option.value === value);\n\n const OperatorForm = property?.propertyKey && operator && property?.getValueFormRenderer(operator);\n\n return OperatorForm ? (\n <OperatorForm value={value} onChange={onChangeValue} operator={operator} />\n ) : (\n <InternalAutosuggest\n enteredTextLabel={i18nStrings.enteredTextLabel ?? (value => value)}\n value={matchedOption?.label ?? value ?? ''}\n clearAriaLabel={i18nStrings.clearAriaLabel}\n onChange={e => onChangeValue(e.detail.value)}\n disabled={!operator}\n options={valueOptions}\n {...asyncValueAutosuggestProps}\n virtualScroll={true}\n />\n );\n}\n\ninterface TokenEditorProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n freeTextFiltering: InternalFreeTextFiltering;\n expandToViewport?: boolean;\n filteringProperties: readonly InternalFilteringProperty[];\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n setToken: (newToken: Token) => void;\n token: InternalToken;\n triggerComponent?: React.ReactNode;\n}\n\nexport function TokenEditor({\n asyncProperties,\n asyncProps,\n customGroupsText,\n freeTextFiltering,\n expandToViewport,\n filteringProperties,\n filteringOptions,\n i18nStrings,\n onLoadItems,\n setToken,\n token,\n triggerComponent,\n}: TokenEditorProps) {\n const [temporaryToken, setTemporaryToken] = useState<InternalToken>(token);\n const popoverRef = useRef<InternalPopoverRef>(null);\n const closePopover = () => {\n popoverRef.current && popoverRef.current.dismissPopover();\n };\n\n const property = temporaryToken.property;\n const onChangePropertyKey = (newPropertyKey: undefined | string) => {\n const filteringProperty = filteringProperties.reduce<InternalFilteringProperty | undefined>(\n (acc, property) => (property.propertyKey === newPropertyKey ? property : acc),\n undefined\n );\n const allowedOperators = filteringProperty ? getAllowedOperators(filteringProperty) : freeTextFiltering.operators;\n const operator =\n temporaryToken.operator && allowedOperators.indexOf(temporaryToken.operator) !== -1\n ? temporaryToken.operator\n : allowedOperators[0];\n const matchedProperty = filteringProperties.find(property => property.propertyKey === newPropertyKey) ?? null;\n setTemporaryToken({ ...temporaryToken, property: matchedProperty, operator });\n };\n\n const operator = temporaryToken.operator;\n const onChangeOperator = (newOperator: ComparisonOperator) => {\n setTemporaryToken({ ...temporaryToken, operator: newOperator });\n };\n\n const value = temporaryToken.value;\n const onChangeValue = (newValue: string) => {\n setTemporaryToken({ ...temporaryToken, value: newValue });\n };\n\n return (\n <InternalPopover\n ref={popoverRef}\n className={styles['token-label']}\n triggerType=\"text\"\n header={i18nStrings.editTokenHeader}\n size=\"large\"\n position=\"right\"\n dismissAriaLabel={i18nStrings.dismissAriaLabel}\n __onOpen={() => setTemporaryToken(token)}\n renderWithPortal={expandToViewport}\n content={\n <div className={styles['token-editor']}>\n <div className={styles['token-editor-form']}>\n <InternalFormField label={i18nStrings.propertyText} className={styles['token-editor-field-property']}>\n <PropertyInput\n property={property}\n onChangePropertyKey={onChangePropertyKey}\n asyncProps={asyncProperties ? asyncProps : null}\n filteringProperties={filteringProperties}\n onLoadItems={onLoadItems}\n customGroupsText={customGroupsText}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField label={i18nStrings.operatorText} className={styles['token-editor-field-operator']}>\n <OperatorInput\n property={property}\n operator={operator}\n onChangeOperator={onChangeOperator}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField label={i18nStrings.valueText} className={styles['token-editor-field-value']}>\n <ValueInput\n property={property}\n operator={operator}\n value={value}\n onChangeValue={onChangeValue}\n asyncProps={asyncProps}\n filteringOptions={filteringOptions}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n />\n </InternalFormField>\n </div>\n\n <div className={styles['token-editor-actions']}>\n <InternalButton\n formAction=\"none\"\n variant=\"link\"\n className={styles['token-editor-cancel']}\n onClick={closePopover}\n >\n {i18nStrings.cancelActionText}\n </InternalButton>\n <InternalButton\n className={styles['token-editor-submit']}\n formAction=\"none\"\n onClick={() => {\n setToken(matchTokenValue(temporaryToken, filteringOptions));\n closePopover();\n }}\n >\n {i18nStrings.applyActionText}\n </InternalButton>\n </div>\n </div>\n }\n >\n {triggerComponent}\n </InternalPopover>\n );\n}\n"]}
1
+ {"version":3,"file":"token-editor.js","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAC1D,OAAO,eAAuC,MAAM,qBAAqB,CAAC;AAY1E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGlG,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAa1C,SAAS,aAAa,CAAC,EACrB,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,iBAAiB,GACE;;IACnB,MAAM,sBAAsB,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,wBAAwB,GAAG,UAAU,CAAC,CAAC,iCAAM,UAAU,GAAK,sBAAsB,EA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gB,EAClC,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,GACpC,CACgB;gBAEpB,oBAAC,iBAAiB,IAAC,KAAK,EAAE,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC;oBAC5F,oBAAC,UAAU,IACT,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,GACxB,CACgB,CAChB;YAEN,6BAAK,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC;gBAC5C,oBAAC,cAAc,IACb,UAAU,EAAC,MAAM,EACjB,OAAO,EAAC,MAAM,EACd,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,EACxC,OAAO,EAAE,YAAY,IAEpB,WAAW,CAAC,gBAAgB,CACd;gBACjB,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,EACxC,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE;wBACZ,QAAQ,CAAC,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC,CAAC;wBAC5D,YAAY,EAAE,CAAC;oBACjB,CAAC,IAEA,WAAW,CAAC,eAAe,CACb,CACb,CACF,IAGP,gBAAgB,CACD,CACnB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useRef } from 'react';\n\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport InternalAutosuggest from '../autosuggest/internal';\nimport InternalPopover, { InternalPopoverRef } from '../popover/internal';\nimport {\n ComparisonOperator,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalFreeTextFiltering,\n InternalToken,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport styles from './styles.css.js';\nimport { useLoadItems } from './use-load-items';\nimport { getAllowedOperators, operatorToDescription, getPropertySuggestions } from './controller';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport InternalButton from '../button/internal';\nimport InternalFormField from '../form-field/internal';\nimport { matchTokenValue } from './utils';\n\ninterface PropertyInputProps {\n asyncProps: null | DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n freeTextFiltering: InternalFreeTextFiltering;\n filteringProperties: readonly InternalFilteringProperty[];\n i18nStrings: I18nStrings;\n onChangePropertyKey: (propertyKey: undefined | string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n property: null | InternalFilteringProperty;\n}\n\nfunction PropertyInput({\n property,\n onChangePropertyKey,\n asyncProps,\n filteringProperties,\n onLoadItems,\n customGroupsText,\n i18nStrings,\n freeTextFiltering,\n}: PropertyInputProps) {\n const propertySelectHandlers = useLoadItems(onLoadItems);\n const asyncPropertySelectProps = asyncProps ? { ...asyncProps, ...propertySelectHandlers } : {};\n const propertyOptions: (SelectProps.Option | SelectProps.OptionGroup)[] = getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n ({ propertyKey, propertyLabel }) => ({\n value: propertyKey,\n label: propertyLabel,\n dontCloseOnSelect: true,\n })\n );\n\n const allPropertiesOption = {\n label: i18nStrings.allPropertiesLabel,\n value: undefined,\n };\n if (!freeTextFiltering.disabled) {\n propertyOptions.unshift(allPropertiesOption);\n }\n return (\n <InternalSelect\n options={propertyOptions}\n selectedOption={\n property\n ? {\n value: property.propertyKey ?? undefined,\n label: property.propertyLabel,\n }\n : allPropertiesOption\n }\n onChange={e => onChangePropertyKey(e.detail.selectedOption.value)}\n {...asyncPropertySelectProps}\n />\n );\n}\n\ninterface OperatorInputProps {\n i18nStrings: I18nStrings;\n onChangeOperator: (operator: ComparisonOperator) => void;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n freeTextFiltering: InternalFreeTextFiltering;\n}\n\nfunction OperatorInput({ property, operator, onChangeOperator, i18nStrings, freeTextFiltering }: OperatorInputProps) {\n const operatorOptions = (property ? getAllowedOperators(property) : freeTextFiltering.operators).map(operator => ({\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }));\n return (\n <InternalSelect\n options={operatorOptions}\n triggerVariant=\"option\"\n selectedOption={\n operator\n ? {\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }\n : null\n }\n onChange={e => onChangeOperator(e.detail.selectedOption.value as ComparisonOperator)}\n />\n );\n}\n\ninterface ValueInputProps {\n asyncProps: DropdownStatusProps;\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onChangeValue: (value: string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operator: undefined | ComparisonOperator;\n property: null | InternalFilteringProperty;\n value: undefined | string;\n}\n\nfunction ValueInput({\n property,\n operator,\n value,\n onChangeValue,\n asyncProps,\n filteringOptions,\n onLoadItems,\n i18nStrings,\n}: ValueInputProps) {\n const valueOptions = property\n ? filteringOptions\n .filter(option => option.property?.propertyKey === property.propertyKey)\n .map(({ label, value }) => ({ label, value }))\n : [];\n\n const valueAutosuggestHandlers = useLoadItems(onLoadItems, '', property?.externalProperty);\n const asyncValueAutosuggestProps = property?.propertyKey\n ? { ...valueAutosuggestHandlers, ...asyncProps }\n : { empty: asyncProps.empty };\n const [matchedOption] = valueOptions.filter(option => option.value === value);\n\n const OperatorForm = property?.propertyKey && operator && property?.getValueFormRenderer(operator);\n\n return OperatorForm ? (\n <OperatorForm value={value} onChange={onChangeValue} operator={operator} />\n ) : (\n <InternalAutosuggest\n enteredTextLabel={i18nStrings.enteredTextLabel ?? (value => value)}\n value={matchedOption?.label ?? value ?? ''}\n clearAriaLabel={i18nStrings.clearAriaLabel}\n onChange={e => onChangeValue(e.detail.value)}\n disabled={!operator}\n options={valueOptions}\n {...asyncValueAutosuggestProps}\n virtualScroll={true}\n />\n );\n}\n\ninterface TokenEditorProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n freeTextFiltering: InternalFreeTextFiltering;\n expandToViewport?: boolean;\n filteringProperties: readonly InternalFilteringProperty[];\n filteringOptions: readonly InternalFilteringOption[];\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n setToken: (newToken: Token) => void;\n token: InternalToken;\n triggerComponent?: React.ReactNode;\n}\n\nexport function TokenEditor({\n asyncProperties,\n asyncProps,\n customGroupsText,\n freeTextFiltering,\n expandToViewport,\n filteringProperties,\n filteringOptions,\n i18nStrings,\n onLoadItems,\n setToken,\n token,\n triggerComponent,\n}: TokenEditorProps) {\n const [temporaryToken, setTemporaryToken] = useState<InternalToken>(token);\n const popoverRef = useRef<InternalPopoverRef>(null);\n const closePopover = () => {\n popoverRef.current && popoverRef.current.dismissPopover();\n };\n\n const property = temporaryToken.property;\n const onChangePropertyKey = (newPropertyKey: undefined | string) => {\n const filteringProperty = filteringProperties.reduce<InternalFilteringProperty | undefined>(\n (acc, property) => (property.propertyKey === newPropertyKey ? property : acc),\n undefined\n );\n const allowedOperators = filteringProperty ? getAllowedOperators(filteringProperty) : freeTextFiltering.operators;\n const operator =\n temporaryToken.operator && allowedOperators.indexOf(temporaryToken.operator) !== -1\n ? temporaryToken.operator\n : allowedOperators[0];\n const matchedProperty = filteringProperties.find(property => property.propertyKey === newPropertyKey) ?? null;\n setTemporaryToken({ ...temporaryToken, property: matchedProperty, operator, value: null });\n };\n\n const operator = temporaryToken.operator;\n const onChangeOperator = (newOperator: ComparisonOperator) => {\n setTemporaryToken({ ...temporaryToken, operator: newOperator });\n };\n\n const value = temporaryToken.value;\n const onChangeValue = (newValue: string) => {\n setTemporaryToken({ ...temporaryToken, value: newValue });\n };\n\n return (\n <InternalPopover\n ref={popoverRef}\n className={styles['token-label']}\n triggerType=\"text\"\n header={i18nStrings.editTokenHeader}\n size=\"large\"\n position=\"right\"\n dismissAriaLabel={i18nStrings.dismissAriaLabel}\n __onOpen={() => setTemporaryToken(token)}\n renderWithPortal={expandToViewport}\n content={\n <div className={styles['token-editor']}>\n <div className={styles['token-editor-form']}>\n <InternalFormField label={i18nStrings.propertyText} className={styles['token-editor-field-property']}>\n <PropertyInput\n property={property}\n onChangePropertyKey={onChangePropertyKey}\n asyncProps={asyncProperties ? asyncProps : null}\n filteringProperties={filteringProperties}\n onLoadItems={onLoadItems}\n customGroupsText={customGroupsText}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField label={i18nStrings.operatorText} className={styles['token-editor-field-operator']}>\n <OperatorInput\n property={property}\n operator={operator}\n onChangeOperator={onChangeOperator}\n i18nStrings={i18nStrings}\n freeTextFiltering={freeTextFiltering}\n />\n </InternalFormField>\n\n <InternalFormField label={i18nStrings.valueText} className={styles['token-editor-field-value']}>\n <ValueInput\n property={property}\n operator={operator}\n value={value}\n onChangeValue={onChangeValue}\n asyncProps={asyncProps}\n filteringOptions={filteringOptions}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n />\n </InternalFormField>\n </div>\n\n <div className={styles['token-editor-actions']}>\n <InternalButton\n formAction=\"none\"\n variant=\"link\"\n className={styles['token-editor-cancel']}\n onClick={closePopover}\n >\n {i18nStrings.cancelActionText}\n </InternalButton>\n <InternalButton\n className={styles['token-editor-submit']}\n formAction=\"none\"\n onClick={() => {\n setToken(matchTokenValue(temporaryToken, filteringOptions));\n closePopover();\n }}\n >\n {i18nStrings.applyActionText}\n </InternalButton>\n </div>\n </div>\n }\n >\n {triggerComponent}\n </InternalPopover>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM/D,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,QAAA,MAAM,KAAK,qBAmDa,CAAC;AAGzB,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM/D,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,QAAA,MAAM,KAAK,qBAoDa,CAAC;AAGzB,eAAe,KAAK,CAAC"}
package/table/index.js CHANGED
@@ -21,6 +21,7 @@ const Table = React.forwardRef((_a, ref) => {
21
21
  },
22
22
  metadata: {
23
23
  expandableRows: !!props.expandableRows,
24
+ progressiveLoading: !!props.getLoadingStatus,
24
25
  inlineEdit: props.columnDefinitions.some(def => !!def.editConfig),
25
26
  disabledInlineEdit: props.columnDefinitions.some(def => { var _a; return !!((_a = def.editConfig) === null || _a === void 0 ? void 0 : _a.disabledReason); }),
26
27
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,aAAa,EAAE,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAG3F,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CACE,EAOgB,EAChB,GAA8B,EAC9B,EAAE;QATF,EACE,KAAK,GAAG,EAAE,EACV,aAAa,GAAG,EAAE,EAClB,OAAO,GAAG,WAAW,EACrB,cAAc,GAAG,aAAa,EAC9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.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { TableForwardRefType, TableProps } from './interfaces';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalTable, { InternalTableAsSubstep } from './internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\n\nexport { TableProps };\nconst Table = React.forwardRef(\n <T,>(\n {\n items = [],\n selectedItems = [],\n variant = 'container',\n contentDensity = 'comfortable',\n firstIndex = 1,\n ...props\n }: TableProps<T>,\n ref: React.Ref<TableProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Table', {\n props: {\n contentDensity,\n resizableColumns: props.resizableColumns,\n selectionType: props.selectionType,\n stickyHeader: props.stickyHeader,\n stripedRows: props.stripedRows,\n variant,\n wrapLines: props.wrapLines,\n enableKeyboardNavigation: props.enableKeyboardNavigation,\n },\n metadata: {\n expandableRows: !!props.expandableRows,\n inlineEdit: props.columnDefinitions.some(def => !!def.editConfig),\n disabledInlineEdit: props.columnDefinitions.some(def => !!def.editConfig?.disabledReason),\n },\n });\n\n const tableProps: Parameters<typeof InternalTable<T>>[0] = {\n items,\n selectedItems,\n variant,\n contentDensity,\n firstIndex,\n ...props,\n ...baseComponentProps,\n ref,\n };\n\n if (variant === 'borderless' || variant === 'embedded') {\n return <InternalTable {...tableProps} />;\n }\n\n return (\n <AnalyticsFunnelSubStep>\n <InternalTableAsSubstep {...tableProps} />\n </AnalyticsFunnelSubStep>\n );\n }\n) as TableForwardRefType;\n\napplyDisplayName(Table, 'Table');\nexport default Table;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,aAAa,EAAE,EAAE,sBAAsB,EAAE,MAAM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EF,IAAI,OAAO,KAAK,YAAY,IAAI,OAAO,KAAK,UAAU,EAAE;QACtD,OAAO,oBAAC,aAAa,oBAAK,UAAU,EAAI,CAAC;KAC1C;IAED,OAAO,CACL,oBAAC,sBAAsB;QACrB,oBAAC,sBAAsB,oBAAK,UAAU,EAAI,CACnB,CAC1B,CAAC;AACJ,CAAC,CACqB,CAAC;AAEzB,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjC,eAAe,KAAK,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { TableForwardRefType, TableProps } from './interfaces';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalTable, { InternalTableAsSubstep } from './internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\n\nexport { TableProps };\nconst Table = React.forwardRef(\n <T,>(\n {\n items = [],\n selectedItems = [],\n variant = 'container',\n contentDensity = 'comfortable',\n firstIndex = 1,\n ...props\n }: TableProps<T>,\n ref: React.Ref<TableProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Table', {\n props: {\n contentDensity,\n resizableColumns: props.resizableColumns,\n selectionType: props.selectionType,\n stickyHeader: props.stickyHeader,\n stripedRows: props.stripedRows,\n variant,\n wrapLines: props.wrapLines,\n enableKeyboardNavigation: props.enableKeyboardNavigation,\n },\n metadata: {\n expandableRows: !!props.expandableRows,\n progressiveLoading: !!props.getLoadingStatus,\n inlineEdit: props.columnDefinitions.some(def => !!def.editConfig),\n disabledInlineEdit: props.columnDefinitions.some(def => !!def.editConfig?.disabledReason),\n },\n });\n\n const tableProps: Parameters<typeof InternalTable<T>>[0] = {\n items,\n selectedItems,\n variant,\n contentDensity,\n firstIndex,\n ...props,\n ...baseComponentProps,\n ref,\n };\n\n if (variant === 'borderless' || variant === 'embedded') {\n return <InternalTable {...tableProps} />;\n }\n\n return (\n <AnalyticsFunnelSubStep>\n <InternalTableAsSubstep {...tableProps} />\n </AnalyticsFunnelSubStep>\n );\n }\n) as TableForwardRefType;\n\napplyDisplayName(Table, 'Table');\nexport default Table;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/top-navigation/internal.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMlF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAQlD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,MAAM,MAAM,0BAA0B,GAAG,YAAY,CAAC,kBAAkB,EAAE,WAAW,CAAC,GAAG,0BAA0B,CAAC;AAEpH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,EACN,GAAG,SAAS,EACb,EAAE,0BAA0B,eA2O5B"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/top-navigation/internal.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMlF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAQlD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKjD,MAAM,MAAM,0BAA0B,GAAG,YAAY,CAAC,kBAAkB,EAAE,WAAW,CAAC,GAAG,0BAA0B,CAAC;AAEpH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,EACN,GAAG,SAAS,EACb,EAAE,0BAA0B,eAyO5B"}
@@ -15,6 +15,7 @@ import styles from './styles.css.js';
15
15
  import { checkSafeUrl } from '../internal/utils/check-safe-url';
16
16
  import { useInternalI18n } from '../i18n/context';
17
17
  import { isDevelopment, warnOnce } from '@cloudscape-design/component-toolkit/internal';
18
+ import { hasCheckboxItems } from '../button-dropdown/utils/utils';
18
19
  export default function InternalTopNavigation(_a) {
19
20
  var { __internalRootRef, identity, i18nStrings, utilities, search } = _a, restProps = __rest(_a, ["__internalRootRef", "identity", "i18nStrings", "utilities", "search"]);
20
21
  checkSafeUrl('TopNavigation', identity.href);
@@ -29,8 +30,8 @@ export default function InternalTopNavigation(_a) {
29
30
  // ButtonDropdown supports checkbox items but we don't support these in TopNavigation. Shown an error in development mode
30
31
  // to alert users of this and that it might change in the future.
31
32
  if (isDevelopment) {
32
- if (utilities.some(item => item.type === 'menu-dropdown' && item.items.some(item => item.itemType === 'checkbox'))) {
33
- warnOnce('TopNavigation', 'The TopNavigation component does not support menu-dropdown items with `itemType` equal to `checkbox`, this might change in the future.');
33
+ if (utilities.some(item => item.type === 'menu-dropdown' && hasCheckboxItems(item.items))) {
34
+ warnOnce('TopNavigation', 'The TopNavigation component does not support menu-dropdown items with `itemType` equal to `checkbox`.');
34
35
  }
35
36
  }
36
37
  const onIdentityClick = (event) => {