@cloudscape-design/components 3.0.406 → 3.0.407

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/breadcrumb-group/internal.d.ts.map +1 -1
  2. package/breadcrumb-group/internal.js +2 -1
  3. package/breadcrumb-group/internal.js.map +1 -1
  4. package/breadcrumb-group/item/item.d.ts.map +1 -1
  5. package/breadcrumb-group/item/item.js +8 -8
  6. package/breadcrumb-group/item/item.js.map +1 -1
  7. package/header/internal.d.ts.map +1 -1
  8. package/header/internal.js +1 -1
  9. package/header/internal.js.map +1 -1
  10. package/header/styles.css.js +34 -33
  11. package/header/styles.scoped.css +53 -49
  12. package/header/styles.selectors.js +34 -33
  13. package/internal/environment.js +1 -1
  14. package/internal/environment.json +1 -1
  15. package/internal/manifest.json +1 -1
  16. package/package.json +1 -1
  17. package/property-filter/controller.d.ts +3 -4
  18. package/property-filter/controller.d.ts.map +1 -1
  19. package/property-filter/controller.js +7 -10
  20. package/property-filter/controller.js.map +1 -1
  21. package/property-filter/index.d.ts.map +1 -1
  22. package/property-filter/index.js +48 -37
  23. package/property-filter/index.js.map +1 -1
  24. package/property-filter/interfaces.d.ts +10 -1
  25. package/property-filter/interfaces.d.ts.map +1 -1
  26. package/property-filter/interfaces.js.map +1 -1
  27. package/property-filter/token-editor.d.ts +4 -4
  28. package/property-filter/token-editor.d.ts.map +1 -1
  29. package/property-filter/token-editor.js +25 -20
  30. package/property-filter/token-editor.js.map +1 -1
  31. package/property-filter/token.d.ts +4 -4
  32. package/property-filter/token.d.ts.map +1 -1
  33. package/property-filter/token.js +6 -5
  34. package/property-filter/token.js.map +1 -1
  35. package/property-filter/utils.d.ts +4 -5
  36. package/property-filter/utils.d.ts.map +1 -1
  37. package/property-filter/utils.js +11 -16
  38. package/property-filter/utils.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"token.js","sourceRoot":"lib/default/","sources":["property-filter/token.tsx"],"names":[],"m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AAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,cAAc,CAAC,KAAK,GAAI,CACrG,EAET,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAmB,EACxC,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,wBAAwB,EAAE,wBAAwB,EAClD,gBAAgB,EAAE,gBAAgB,GAClC,CACa,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,EACpB,QAAQ,EACR,QAAQ,EACR,KAAK,GAKN,EAAE,EAAE;IACH,IAAI,QAAQ,EAAE;QACZ,QAAQ,IAAI,GAAG,CAAC;KACjB;IACD,MAAM,qBAAqB,GAAG,QAAQ,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC5D,MAAM,YAAY,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC;IACjE,OAAO,CACL;QACG,QAAQ;QACT,8BAAM,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAG,YAAY,CAAQ;QAC/D,KAAK,CACL,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport {\n ComparisonOperator,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n JoinOperation,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport styles from './styles.css.js';\nimport { TokenEditor } from './token-editor';\n\nimport FilteringToken from '../internal/components/filtering-token';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport { getFormattedToken } from './utils';\n\ninterface TokenProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n disableFreeTextFiltering?: boolean;\n expandToViewport?: boolean;\n filteringOptions: readonly InternalFilteringOption[];\n filteringProperties: readonly InternalFilteringProperty[];\n first?: boolean;\n hideOperations?: boolean;\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operation: JoinOperation;\n removeToken: () => void;\n setOperation: (newOperation: JoinOperation) => void;\n setToken: (newToken: Token) => void;\n token: Token;\n}\n\nexport const TokenButton = ({\n token,\n operation = 'and',\n first,\n removeToken,\n setToken,\n setOperation,\n filteringOptions,\n filteringProperties,\n asyncProps,\n onLoadItems,\n i18nStrings,\n asyncProperties,\n hideOperations,\n customGroupsText,\n disabled,\n disableFreeTextFiltering,\n expandToViewport,\n}: TokenProps) => {\n const formattedToken = getFormattedToken(filteringProperties, token);\n return (\n <FilteringToken\n ariaLabel={formattedToken.label}\n showOperation={!first && !hideOperations}\n operation={operation}\n andText={i18nStrings.operationAndText ?? ''}\n orText={i18nStrings.operationOrText ?? ''}\n dismissAriaLabel={i18nStrings?.removeTokenButtonAriaLabel?.(token)}\n operatorAriaLabel={i18nStrings.tokenOperatorAriaLabel}\n onChange={setOperation}\n onDismiss={removeToken}\n disabled={disabled}\n >\n <TokenEditor\n setToken={setToken}\n triggerComponent={\n <span className={styles['token-trigger']}>\n <TokenTrigger property={formattedToken.property} operator={token.operator} value={formattedToken.value} />\n </span>\n }\n filteringOptions={filteringOptions}\n filteringProperties={filteringProperties}\n token={token}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n customGroupsText={customGroupsText}\n disableFreeTextFiltering={disableFreeTextFiltering}\n expandToViewport={expandToViewport}\n />\n </FilteringToken>\n );\n};\n\nconst TokenTrigger = ({\n property,\n operator,\n value,\n}: {\n property?: string;\n operator?: ComparisonOperator;\n value: string;\n}) => {\n if (property) {\n property += ' ';\n }\n const freeTextContainsToken = operator === ':' && !property;\n const operatorText = freeTextContainsToken ? '' : operator + ' ';\n return (\n <>\n {property}\n <span className={styles['token-operator']}>{operatorText}</span>\n {value}\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"token.js","sourceRoot":"lib/default/","sources":["property-filter/token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAsB5C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,SAAS,GAAG,KAAK,EACjB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,WAAW,EACX,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,wBAAwB,EACxB,gBAAgB,GACL,EAAE,EAAE;;IACf,MAAM,aAAa,mCAAQ,KAAK,KAAE,WAAW,EAAE,MAAA,KAAK,CAAC,QAAQ,0CAAE,WAAW,GAAE,CAAC;IAC7E,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAChD,OAAO,CACL,oBAAC,cAAc,IACb,SAAS,EAAE,cAAc,CAAC,KAAK,EAC/B,aAAa,EAAE,CAAC,KAAK,IAAI,CAAC,cAAc,EACxC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,MAAA,WAAW,CAAC,gBAAgB,mCAAI,EAAE,EAC3C,MAAM,EAAE,MAAA,WAAW,CAAC,eAAe,mCAAI,EAAE,EACzC,gBAAgB,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,0BA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-2.0\nimport React from 'react';\nimport {\n ComparisonOperator,\n GroupText,\n I18nStrings,\n InternalFilteringOption,\n InternalFilteringProperty,\n InternalToken,\n JoinOperation,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport styles from './styles.css.js';\nimport { TokenEditor } from './token-editor';\n\nimport FilteringToken from '../internal/components/filtering-token';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\nimport { getFormattedToken } from './utils';\n\ninterface TokenProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n disableFreeTextFiltering?: boolean;\n expandToViewport?: boolean;\n filteringProperties: readonly InternalFilteringProperty[];\n filteringOptions: readonly InternalFilteringOption[];\n first?: boolean;\n hideOperations?: boolean;\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operation: JoinOperation;\n removeToken: () => void;\n setOperation: (newOperation: JoinOperation) => void;\n setToken: (newToken: Token) => void;\n token: InternalToken;\n}\n\nexport const TokenButton = ({\n token,\n operation = 'and',\n first,\n removeToken,\n setToken,\n setOperation,\n filteringProperties,\n filteringOptions,\n asyncProps,\n onLoadItems,\n i18nStrings,\n asyncProperties,\n hideOperations,\n customGroupsText,\n disabled,\n disableFreeTextFiltering,\n expandToViewport,\n}: TokenProps) => {\n const externalToken = { ...token, propertyKey: token.property?.propertyKey };\n const formattedToken = getFormattedToken(token);\n return (\n <FilteringToken\n ariaLabel={formattedToken.label}\n showOperation={!first && !hideOperations}\n operation={operation}\n andText={i18nStrings.operationAndText ?? ''}\n orText={i18nStrings.operationOrText ?? ''}\n dismissAriaLabel={i18nStrings?.removeTokenButtonAriaLabel?.(externalToken)}\n operatorAriaLabel={i18nStrings.tokenOperatorAriaLabel}\n onChange={setOperation}\n onDismiss={removeToken}\n disabled={disabled}\n >\n <TokenEditor\n setToken={setToken}\n triggerComponent={\n <span className={styles['token-trigger']}>\n <TokenTrigger property={formattedToken.property} operator={token.operator} value={formattedToken.value} />\n </span>\n }\n filteringProperties={filteringProperties}\n filteringOptions={filteringOptions}\n token={token}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n customGroupsText={customGroupsText}\n disableFreeTextFiltering={disableFreeTextFiltering}\n expandToViewport={expandToViewport}\n />\n </FilteringToken>\n );\n};\n\nconst TokenTrigger = ({\n property,\n operator,\n value,\n}: {\n property?: string;\n operator?: ComparisonOperator;\n value: string;\n}) => {\n if (property) {\n property += ' ';\n }\n const freeTextContainsToken = operator === ':' && !property;\n const operatorText = freeTextContainsToken ? '' : operator + ' ';\n return (\n <>\n {property}\n <span className={styles['token-operator']}>{operatorText}</span>\n {value}\n </>\n );\n};\n"]}
@@ -1,11 +1,10 @@
1
- import { ComparisonOperator, InternalFilteringOption, InternalFilteringProperty, Token } from './interfaces';
1
+ import { ComparisonOperator, InternalFilteringOption, InternalFilteringProperty, InternalToken, Token } from './interfaces';
2
2
  export declare function matchFilteringProperty(filteringProperties: readonly InternalFilteringProperty[], filteringText: string): null | InternalFilteringProperty;
3
3
  export declare function matchOperator(allowedOperators: readonly ComparisonOperator[], filteringText: string): null | ComparisonOperator;
4
4
  export declare function matchOperatorPrefix(allowedOperators: readonly ComparisonOperator[], filteringText: string): null | string;
5
- export declare function matchTokenValue(token: Token, filteringOptions: readonly InternalFilteringOption[]): Token;
6
- export declare function getPropertyByKey(filteringProperties: readonly InternalFilteringProperty[], key: string): InternalFilteringProperty<any> | undefined;
7
- export declare function getFormattedToken(filteringProperties: readonly InternalFilteringProperty[], token: Token): {
8
- property: string | undefined;
5
+ export declare function matchTokenValue({ property, operator, value }: InternalToken, filteringOptions: readonly InternalFilteringOption[]): Token;
6
+ export declare function getFormattedToken(token: InternalToken): {
7
+ property: string;
9
8
  operator: string;
10
9
  value: any;
11
10
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"lib/default/","sources":["property-filter/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG7G,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,EACzD,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,yBAAyB,CAgBlC;AAGD,wBAAgB,aAAa,CAC3B,gBAAgB,EAAE,SAAS,kBAAkB,EAAE,EAC/C,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,kBAAkB,CAc3B;AAGD,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,SAAS,kBAAkB,EAAE,EAC/C,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,MAAM,CAUf;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,GAAG,KAAK,CAqBzG;AAED,wBAAgB,gBAAgB,CAAC,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,EAAE,GAAG,EAAE,MAAM,8CAGtG;AAED,wBAAgB,iBAAiB,CAAC,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,EAAE,KAAK,EAAE,KAAK;;;;;EAOxG;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUhD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"lib/default/","sources":["property-filter/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EACzB,aAAa,EACb,KAAK,EACN,MAAM,cAAc,CAAC;AAGtB,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,SAAS,yBAAyB,EAAE,EACzD,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,yBAAyB,CAgBlC;AAGD,wBAAgB,aAAa,CAC3B,gBAAgB,EAAE,SAAS,kBAAkB,EAAE,EAC/C,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,kBAAkB,CAc3B;AAGD,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,SAAS,kBAAkB,EAAE,EAC/C,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,MAAM,CAUf;AAED,wBAAgB,eAAe,CAC7B,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,aAAa,EAC5C,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,GACnD,KAAK,CAkBP;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa;;;;;EAMrD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUhD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
@@ -39,36 +39,31 @@ export function matchOperatorPrefix(allowedOperators, filteringText) {
39
39
  }
40
40
  return null;
41
41
  }
42
- export function matchTokenValue(token, filteringOptions) {
42
+ export function matchTokenValue({ property, operator, value }, filteringOptions) {
43
43
  var _a, _b;
44
- const propertyOptions = filteringOptions.filter(option => option.propertyKey === token.propertyKey);
45
- const bestMatch = Object.assign({}, token);
44
+ const propertyOptions = filteringOptions.filter(option => option.property === property);
45
+ const bestMatch = { propertyKey: property === null || property === void 0 ? void 0 : property.propertyKey, operator, value };
46
46
  for (const option of propertyOptions) {
47
- if ((option.label && option.label === token.value) || (!option.label && option.value === token.value)) {
47
+ if ((option.label && option.label === value) || (!option.label && option.value === value)) {
48
48
  // exact match found: return it
49
- return Object.assign(Object.assign({}, token), { value: option.value });
49
+ return { propertyKey: property === null || property === void 0 ? void 0 : property.propertyKey, operator, value: option.value };
50
50
  }
51
51
  // By default, the token value is a string, but when a custom property is used,
52
52
  // the token value can be any, therefore we need to check for its type before calling toLowerCase()
53
- if (typeof token.value === 'string' &&
54
- token.value.toLowerCase() === ((_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.value) !== null && _b !== void 0 ? _b : '').toLowerCase()) {
53
+ if (typeof value === 'string' && value.toLowerCase() === ((_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.value) !== null && _b !== void 0 ? _b : '').toLowerCase()) {
55
54
  // non-exact match: save and keep running in case exact match found later
56
55
  bestMatch.value = option.value;
57
56
  }
58
57
  }
59
58
  return bestMatch;
60
59
  }
61
- export function getPropertyByKey(filteringProperties, key) {
62
- const propertyMap = new Map(filteringProperties.map(prop => [prop.propertyKey, prop]));
63
- return propertyMap.get(key);
64
- }
65
- export function getFormattedToken(filteringProperties, token) {
66
- const property = token.propertyKey ? getPropertyByKey(filteringProperties, token.propertyKey) : undefined;
67
- const valueFormatter = property === null || property === void 0 ? void 0 : property.getValueFormatter(token.operator);
68
- const propertyLabel = property && property.propertyLabel;
60
+ export function getFormattedToken(token) {
61
+ var _a;
62
+ const valueFormatter = (_a = token.property) === null || _a === void 0 ? void 0 : _a.getValueFormatter(token.operator);
63
+ const propertyLabel = token.property && token.property.propertyLabel;
69
64
  const tokenValue = valueFormatter ? valueFormatter(token.value) : token.value;
70
65
  const label = `${propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : ''} ${token.operator} ${tokenValue}`;
71
- return { property: propertyLabel, operator: token.operator, value: tokenValue, label };
66
+ return { property: propertyLabel !== null && propertyLabel !== void 0 ? propertyLabel : '', operator: token.operator, value: tokenValue, label };
72
67
  }
73
68
  export function trimStart(source) {
74
69
  let spacesLength = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"lib/default/","sources":["property-filter/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CACpC,mBAAyD,EACzD,aAAqB;IAErB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,eAAe,GAAqC,IAAI,CAAC;IAE7D,KAAK,MAAM,QA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,CAAC;AACtD,CAAC;AAED,SAAS,UAAU,CAAC,MAAc,EAAE,MAAc;IAChD,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ComparisonOperator, InternalFilteringOption, InternalFilteringProperty, Token } from './interfaces';\n\n// Finds the longest property the filtering text starts from.\nexport function matchFilteringProperty(\n filteringProperties: readonly InternalFilteringProperty[],\n filteringText: string\n): null | InternalFilteringProperty {\n let maxLength = 0;\n let matchedProperty: null | InternalFilteringProperty = null;\n\n for (const property of filteringProperties) {\n if (\n (property.propertyLabel.length >= maxLength && startsWith(filteringText, property.propertyLabel)) ||\n (property.propertyLabel.length > maxLength &&\n startsWith(filteringText.toLowerCase(), property.propertyLabel.toLowerCase()))\n ) {\n maxLength = property.propertyLabel.length;\n matchedProperty = property;\n }\n }\n\n return matchedProperty;\n}\n\n// Finds the longest operator the filtering text starts from.\nexport function matchOperator(\n allowedOperators: readonly ComparisonOperator[],\n filteringText: string\n): null | ComparisonOperator {\n filteringText = filteringText.toLowerCase();\n\n let maxLength = 0;\n let matchedOperator: null | ComparisonOperator = null;\n\n for (const operator of allowedOperators) {\n if (operator.length > maxLength && startsWith(filteringText, operator.toLowerCase())) {\n maxLength = operator.length;\n matchedOperator = operator;\n }\n }\n\n return matchedOperator;\n}\n\n// Finds if the filtering text matches any operator prefix.\nexport function matchOperatorPrefix(\n allowedOperators: readonly ComparisonOperator[],\n filteringText: string\n): null | string {\n if (filteringText.trim().length === 0) {\n return '';\n }\n for (const operator of allowedOperators) {\n if (startsWith(operator.toLowerCase(), filteringText.toLowerCase())) {\n return filteringText;\n }\n }\n return null;\n}\n\nexport function matchTokenValue(token: Token, filteringOptions: readonly InternalFilteringOption[]): Token {\n const propertyOptions = filteringOptions.filter(option => option.propertyKey === token.propertyKey);\n const bestMatch = { ...token };\n for (const option of propertyOptions) {\n if ((option.label && option.label === token.value) || (!option.label && option.value === token.value)) {\n // exact match found: return it\n return { ...token, value: option.value };\n }\n\n // By default, the token value is a string, but when a custom property is used,\n // the token value can be any, therefore we need to check for its type before calling toLowerCase()\n if (\n typeof token.value === 'string' &&\n token.value.toLowerCase() === (option.label ?? option.value ?? '').toLowerCase()\n ) {\n // non-exact match: save and keep running in case exact match found later\n bestMatch.value = option.value;\n }\n }\n\n return bestMatch;\n}\n\nexport function getPropertyByKey(filteringProperties: readonly InternalFilteringProperty[], key: string) {\n const propertyMap = new Map(filteringProperties.map(prop => [prop.propertyKey, prop]));\n return propertyMap.get(key) as InternalFilteringProperty | undefined;\n}\n\nexport function getFormattedToken(filteringProperties: readonly InternalFilteringProperty[], token: Token) {\n const property = token.propertyKey ? getPropertyByKey(filteringProperties, token.propertyKey) : undefined;\n const valueFormatter = property?.getValueFormatter(token.operator);\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\nexport function trimStart(source: string): string {\n let spacesLength = 0;\n for (let i = 0; i < source.length; i++) {\n if (source[i] === ' ') {\n spacesLength++;\n } else {\n break;\n }\n }\n return source.slice(spacesLength);\n}\n\nexport function trimFirstSpace(source: string): string {\n return source[0] === ' ' ? source.slice(1) : source;\n}\n\nfunction startsWith(source: string, target: string): boolean {\n return source.indexOf(target) === 0;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"lib/default/","sources":["property-filter/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAUtC,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CACpC,mBAAyD,EACzD,aAAqB;IAErB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,eAAe,GAAqC,IAAI,CAAC;IAE7D,KAAK,MAAM,QAAQ,IAA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alFilteringOption,\n InternalFilteringProperty,\n InternalToken,\n Token,\n} from './interfaces';\n\n// Finds the longest property the filtering text starts from.\nexport function matchFilteringProperty(\n filteringProperties: readonly InternalFilteringProperty[],\n filteringText: string\n): null | InternalFilteringProperty {\n let maxLength = 0;\n let matchedProperty: null | InternalFilteringProperty = null;\n\n for (const property of filteringProperties) {\n if (\n (property.propertyLabel.length >= maxLength && startsWith(filteringText, property.propertyLabel)) ||\n (property.propertyLabel.length > maxLength &&\n startsWith(filteringText.toLowerCase(), property.propertyLabel.toLowerCase()))\n ) {\n maxLength = property.propertyLabel.length;\n matchedProperty = property;\n }\n }\n\n return matchedProperty;\n}\n\n// Finds the longest operator the filtering text starts from.\nexport function matchOperator(\n allowedOperators: readonly ComparisonOperator[],\n filteringText: string\n): null | ComparisonOperator {\n filteringText = filteringText.toLowerCase();\n\n let maxLength = 0;\n let matchedOperator: null | ComparisonOperator = null;\n\n for (const operator of allowedOperators) {\n if (operator.length > maxLength && startsWith(filteringText, operator.toLowerCase())) {\n maxLength = operator.length;\n matchedOperator = operator;\n }\n }\n\n return matchedOperator;\n}\n\n// Finds if the filtering text matches any operator prefix.\nexport function matchOperatorPrefix(\n allowedOperators: readonly ComparisonOperator[],\n filteringText: string\n): null | string {\n if (filteringText.trim().length === 0) {\n return '';\n }\n for (const operator of allowedOperators) {\n if (startsWith(operator.toLowerCase(), filteringText.toLowerCase())) {\n return filteringText;\n }\n }\n return null;\n}\n\nexport function matchTokenValue(\n { property, operator, value }: InternalToken,\n filteringOptions: readonly InternalFilteringOption[]\n): Token {\n const propertyOptions = filteringOptions.filter(option => option.property === property);\n const bestMatch: Token = { propertyKey: property?.propertyKey, operator, value };\n for (const option of propertyOptions) {\n if ((option.label && option.label === value) || (!option.label && option.value === value)) {\n // exact match found: return it\n return { propertyKey: property?.propertyKey, operator, value: option.value };\n }\n\n // By default, the token value is a string, but when a custom property is used,\n // the token value can be any, therefore we need to check for its type before calling toLowerCase()\n if (typeof value === 'string' && value.toLowerCase() === (option.label ?? option.value ?? '').toLowerCase()) {\n // non-exact match: save and keep running in case exact match found later\n bestMatch.value = option.value;\n }\n }\n\n return bestMatch;\n}\n\nexport function getFormattedToken(token: InternalToken) {\n const valueFormatter = token.property?.getValueFormatter(token.operator);\n const propertyLabel = token.property && token.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\nexport function trimStart(source: string): string {\n let spacesLength = 0;\n for (let i = 0; i < source.length; i++) {\n if (source[i] === ' ') {\n spacesLength++;\n } else {\n break;\n }\n }\n return source.slice(spacesLength);\n}\n\nexport function trimFirstSpace(source: string): string {\n return source[0] === ' ' ? source.slice(1) : source;\n}\n\nfunction startsWith(source: string, target: string): boolean {\n return source.indexOf(target) === 0;\n}\n"]}