@cloudscape-design/components 3.0.45 → 3.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/code-editor/index.d.ts.map +1 -1
- package/code-editor/index.js +14 -13
- package/code-editor/index.js.map +1 -1
- package/code-editor/styles.css.js +33 -32
- package/code-editor/styles.scoped.css +122 -116
- package/code-editor/styles.selectors.js +33 -32
- package/container/internal.d.ts +2 -1
- package/container/internal.d.ts.map +1 -1
- package/container/internal.js +3 -2
- package/container/internal.js.map +1 -1
- package/container/styles.css.js +16 -15
- package/container/styles.scoped.css +29 -24
- package/container/styles.selectors.js +16 -15
- package/date-picker/styles.css.js +24 -24
- package/date-picker/styles.scoped.css +41 -41
- package/date-picker/styles.selectors.js +24 -24
- package/date-range-picker/styles.css.js +41 -41
- package/date-range-picker/styles.scoped.css +50 -50
- package/date-range-picker/styles.selectors.js +41 -41
- package/expandable-section/expandable-section-container.d.ts.map +1 -1
- package/expandable-section/expandable-section-container.js +1 -1
- package/expandable-section/expandable-section-container.js.map +1 -1
- package/icon/interfaces.d.ts +1 -1
- package/icon/interfaces.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/generated/styles/tokens.d.ts +16 -0
- package/internal/generated/styles/tokens.js +16 -0
- package/internal/generated/theming/index.cjs +33 -1
- package/internal/generated/theming/index.cjs.d.ts +80 -0
- package/internal/generated/theming/index.d.ts +80 -0
- package/internal/generated/theming/index.js +33 -1
- package/package.json +1 -1
- package/property-filter/controller.d.ts +14 -28
- package/property-filter/controller.d.ts.map +1 -1
- package/property-filter/controller.js +8 -8
- package/property-filter/controller.js.map +1 -1
- package/property-filter/index.d.ts.map +1 -1
- package/property-filter/index.js +6 -7
- package/property-filter/index.js.map +1 -1
- package/property-filter/interfaces.d.ts +25 -0
- package/property-filter/interfaces.d.ts.map +1 -1
- package/property-filter/interfaces.js.map +1 -1
- package/property-filter/token-editor.d.ts +16 -7
- package/property-filter/token-editor.d.ts.map +1 -1
- package/property-filter/token-editor.js +1 -2
- package/property-filter/token-editor.js.map +1 -1
- package/property-filter/token.d.ts +20 -9
- package/property-filter/token.d.ts.map +1 -1
- package/property-filter/token.js +1 -1
- package/property-filter/token.js.map +1 -1
- package/property-filter/use-load-items.d.ts +1 -2
- package/property-filter/use-load-items.d.ts.map +1 -1
- package/property-filter/use-load-items.js.map +1 -1
- package/property-filter/utils.d.ts +4 -4
- package/property-filter/utils.d.ts.map +1 -1
- package/property-filter/utils.js.map +1 -1
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { FilteringOption, FilteringProperty, GroupText, I18nStrings, JoinOperation, LoadItemsDetail, Token } from './interfaces';
|
|
2
|
+
import { NonCancelableEventHandler } from '../internal/events';
|
|
3
|
+
import { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';
|
|
4
|
+
interface TokenProps {
|
|
5
|
+
asyncProperties?: boolean;
|
|
6
|
+
asyncProps: DropdownStatusProps;
|
|
7
|
+
customGroupsText: readonly GroupText[];
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
disableFreeTextFiltering?: boolean;
|
|
10
|
+
expandToViewport?: boolean;
|
|
11
|
+
filteringOptions: readonly FilteringOption[];
|
|
12
|
+
filteringProperties: readonly FilteringProperty[];
|
|
6
13
|
first?: boolean;
|
|
14
|
+
hideOperations?: boolean;
|
|
15
|
+
i18nStrings: I18nStrings;
|
|
16
|
+
onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;
|
|
17
|
+
operation: JoinOperation;
|
|
7
18
|
removeToken: () => void;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
19
|
+
setOperation: (newOperation: JoinOperation) => void;
|
|
20
|
+
setToken: (newToken: Token) => void;
|
|
21
|
+
token: Token;
|
|
11
22
|
}
|
|
12
|
-
export declare const
|
|
23
|
+
export declare const TokenButton: ({ token, operation, first, removeToken, setToken, setOperation, filteringOptions, filteringProperties, asyncProps, onLoadItems, i18nStrings, asyncProperties, hideOperations, customGroupsText, disabled, disableFreeTextFiltering, expandToViewport, }: TokenProps) => JSX.Element;
|
|
13
24
|
export {};
|
|
14
25
|
//# sourceMappingURL=token.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,KAAK,EACN,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAExF,UAAU,UAAU;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,mBAAmB,CAAC;IAChC,gBAAgB,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,mBAAmB,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAC;IACzD,SAAS,EAAE,aAAa,CAAC;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,YAAY,EAAE,CAAC,YAAY,EAAE,aAAa,KAAK,IAAI,CAAC;IACpD,QAAQ,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IACpC,KAAK,EAAE,KAAK,CAAC;CACd;AAED,eAAO,MAAM,WAAW,4PAkBrB,UAAU,gBAkCZ,CAAC"}
|
package/property-filter/token.js
CHANGED
|
@@ -5,7 +5,7 @@ import styles from './styles.css.js';
|
|
|
5
5
|
import { TokenEditor } from './token-editor';
|
|
6
6
|
import { getPropertyByKey } from './controller';
|
|
7
7
|
import FilteringToken from '../internal/components/filtering-token';
|
|
8
|
-
export var
|
|
8
|
+
export var TokenButton = function (_a) {
|
|
9
9
|
var token = _a.token, _b = _a.operation, operation = _b === void 0 ? 'and' : _b, first = _a.first, removeToken = _a.removeToken, setToken = _a.setToken, setOperation = _a.setOperation, filteringOptions = _a.filteringOptions, filteringProperties = _a.filteringProperties, asyncProps = _a.asyncProps, onLoadItems = _a.onLoadItems, i18nStrings = _a.i18nStrings, asyncProperties = _a.asyncProperties, hideOperations = _a.hideOperations, customGroupsText = _a.customGroupsText, disabled = _a.disabled, disableFreeTextFiltering = _a.disableFreeTextFiltering, expandToViewport = _a.expandToViewport;
|
|
10
10
|
var property = token.propertyKey && getPropertyByKey(filteringProperties, token.propertyKey);
|
|
11
11
|
var propertyLabel = property && property.propertyLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAA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C,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,IAAM,YAAY,GAAG,UAAC,EAAsF;QAApF,QAAQ,cAAA,EAAE,QAAQ,cAAA,EAAE,KAAK,WAAA;IAC/C,IAAI,QAAQ,EAAE;QACZ,QAAQ,IAAI,GAAG,CAAC;KACjB;IACD,IAAM,qBAAqB,GAAG,QAAQ,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC5D,IAAM,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 FilteringOption,\n FilteringProperty,\n GroupText,\n I18nStrings,\n JoinOperation,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport styles from './styles.css.js';\nimport { TokenEditor } from './token-editor';\nimport { getPropertyByKey } from './controller';\n\nimport FilteringToken from '../internal/components/filtering-token';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\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 FilteringOption[];\n filteringProperties: readonly FilteringProperty[];\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 property = token.propertyKey && getPropertyByKey(filteringProperties, token.propertyKey);\n const propertyLabel = property && property.propertyLabel;\n return (\n <FilteringToken\n showOperation={!first && !hideOperations}\n operation={operation}\n andText={i18nStrings.operationAndText}\n orText={i18nStrings.operationOrText}\n dismissAriaLabel={i18nStrings.removeTokenButtonAriaLabel(token)}\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={propertyLabel} operator={token.operator} value={token.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 = ({ property, operator, value }: { property?: string; operator?: string; value: string }) => {\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,5 +1,4 @@
|
|
|
1
1
|
import { NonCancelableEventHandler } from '../internal/events/index';
|
|
2
|
-
import { PropertyFilterProps } from './interfaces';
|
|
3
2
|
/**
|
|
4
3
|
* This hook generates `onBlur`, `onFocus` and `onLoadItems` handlers that make sure an `onLoadItems` event
|
|
5
4
|
* fires exactly once every time control they are used on gets focused.
|
|
@@ -7,7 +6,7 @@ import { PropertyFilterProps } from './interfaces';
|
|
|
7
6
|
* the same event from firing twice in a row. This means, refocusing the control sometimes results in
|
|
8
7
|
* `onLoadItems` firing, but sometimes not.
|
|
9
8
|
*/
|
|
10
|
-
export declare const useLoadItems: (onLoadItems
|
|
9
|
+
export declare const useLoadItems: (onLoadItems?: NonCancelableEventHandler<import("./interfaces").PropertyFilterProps.LoadItemsDetail> | undefined, focusFilteringText?: string | undefined, currentFilteringProperty?: import("./interfaces").PropertyFilterProps.FilteringProperty | undefined, currentFilteringText?: string | undefined, currentFilteringOperator?: import("@cloudscape-design/collection-hooks").PropertyFilterOperator | undefined) => {
|
|
11
10
|
onBlur: () => void;
|
|
12
11
|
onFocus: () => void;
|
|
13
12
|
onLoadItems: NonCancelableEventHandler<import("../internal/components/dropdown/interfaces").OptionsLoadItemsDetail>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-load-items.d.ts","sourceRoot":"","sources":["../../../src/property-filter/use-load-items.ts"],"names":[],"mappings":"AAIA,OAAO,EAA0B,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"use-load-items.d.ts","sourceRoot":"","sources":["../../../src/property-filter/use-load-items.ts"],"names":[],"mappings":"AAIA,OAAO,EAA0B,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAK7F;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;CAgCxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-load-items.js","sourceRoot":"","sources":["../../../src/property-filter/use-load-items.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM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ACpB,WAAW,EAAE,eAAe;KAC7B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useRef } from 'react';\n\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events/index';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\n\nimport { ComparisonOperator, FilteringProperty, LoadItemsDetail } from './interfaces';\n\n/**\n * This hook generates `onBlur`, `onFocus` and `onLoadItems` handlers that make sure an `onLoadItems` event\n * fires exactly once every time control they are used on gets focused.\n * It is neccesary to do this because Autosuggest and Select dedupe their `onLoadItems` events stopping\n * the same event from firing twice in a row. This means, refocusing the control sometimes results in\n * `onLoadItems` firing, but sometimes not.\n */\nexport const useLoadItems = (\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>,\n focusFilteringText?: string,\n currentFilteringProperty?: FilteringProperty,\n currentFilteringText?: string,\n currentFilteringOperator?: ComparisonOperator\n) => {\n const focusIn = useRef<boolean>(false);\n const handleBlur = () => {\n focusIn.current = true;\n };\n const fireLoadItems = (detail: { firstPage: boolean; samePage: boolean; filteringText?: string }) => {\n fireNonCancelableEvent(onLoadItems, {\n ...detail,\n filteringText: currentFilteringText ?? detail.filteringText ?? '',\n filteringProperty: currentFilteringProperty,\n filteringOperator: currentFilteringOperator,\n });\n focusIn.current = false;\n };\n const handleFocus = () => {\n if (focusIn.current) {\n fireLoadItems({ firstPage: true, samePage: false, filteringText: focusFilteringText });\n }\n };\n const handleLoadItems: NonCancelableEventHandler<AutosuggestProps.LoadItemsDetail> = ({ detail }) =>\n fireLoadItems(detail);\n return {\n onBlur: handleBlur,\n onFocus: handleFocus,\n onLoadItems: handleLoadItems,\n };\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function matchFilteringProperty(filteringProperties: readonly
|
|
3
|
-
export declare function matchOperator(allowedOperators: readonly
|
|
4
|
-
export declare function matchOperatorPrefix(allowedOperators: readonly
|
|
1
|
+
import { ComparisonOperator, FilteringProperty } from './interfaces';
|
|
2
|
+
export declare function matchFilteringProperty(filteringProperties: readonly FilteringProperty[], filteringText: string): null | FilteringProperty;
|
|
3
|
+
export declare function matchOperator(allowedOperators: readonly ComparisonOperator[], filteringText: string): null | ComparisonOperator;
|
|
4
|
+
export declare function matchOperatorPrefix(allowedOperators: readonly ComparisonOperator[], filteringText: string): null | string;
|
|
5
5
|
export declare function trimStart(source: string): string;
|
|
6
6
|
export declare function trimFirstSpace(source: string): string;
|
|
7
7
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/property-filter/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/property-filter/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGrE,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,SAAS,iBAAiB,EAAE,EACjD,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,iBAAiB,CAc1B;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,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUhD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/property-filter/ut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,QAAQ,CAAC;SAC5B;KACF;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,mBAAmB,CACjC,gBAA+C,EAC/C,aAAqB;IAErB,IAAI,aAAa,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;QACrC,OAAO,EAAE,CAAC;KACX;IACD,KAAuB,UAAgB,EAAhB,qCAAgB,EAAhB,8BAAgB,EAAhB,IAAgB,EAAE;QAApC,IAAM,QAAQ,yBAAA;QACjB,IAAI,UAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,aAAa,CAAC,WAAW,EAAE,CAAC,EAAE;YACnE,OAAO,aAAa,CAAC;SACtB;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YACrB,YAAY,EAAE,CAAC;SAChB;aAAM;YACL,MAAM;SACP;KACF;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,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, FilteringProperty } from './interfaces';\n\n// Finds the longest property the filtering text starts from.\nexport function matchFilteringProperty(\n filteringProperties: readonly FilteringProperty[],\n filteringText: string\n): null | FilteringProperty {\n filteringText = filteringText.toLowerCase();\n\n let maxLength = 0;\n let matchedProperty: null | FilteringProperty = null;\n\n for (const property of filteringProperties) {\n if (property.propertyLabel.length > maxLength && startsWith(filteringText, property.propertyLabel.toLowerCase())) {\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 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"]}
|