@cloudscape-design/components 3.0.44 → 3.0.47
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/autosuggest/internal.js +1 -1
- package/autosuggest/internal.js.map +1 -1
- package/autosuggest/styles.css.js +3 -5
- package/autosuggest/styles.scoped.css +3 -12
- package/autosuggest/styles.selectors.js +3 -5
- 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/{autosuggest/autosuggest-input.d.ts → internal/components/autosuggest-input/index.d.ts} +7 -7
- package/internal/components/autosuggest-input/index.d.ts.map +1 -0
- package/{autosuggest/autosuggest-input.js → internal/components/autosuggest-input/index.js} +11 -10
- package/internal/components/autosuggest-input/index.js.map +1 -0
- package/internal/components/autosuggest-input/styles.css.js +7 -0
- package/internal/components/autosuggest-input/styles.scoped.css +12 -0
- package/internal/components/autosuggest-input/styles.selectors.js +8 -0
- package/internal/environment.js +1 -1
- package/internal/generated/styles/tokens.d.ts +17 -0
- package/internal/generated/styles/tokens.js +17 -0
- package/internal/generated/theming/index.cjs +35 -1
- package/internal/generated/theming/index.cjs.d.ts +85 -0
- package/internal/generated/theming/index.d.ts +85 -0
- package/internal/generated/theming/index.js +35 -1
- package/package.json +1 -1
- package/property-filter/controller.d.ts +15 -29
- 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/property-filter-autosuggest.d.ts +1 -1
- package/property-filter/property-filter-autosuggest.d.ts.map +1 -1
- package/property-filter/property-filter-autosuggest.js +1 -1
- package/property-filter/property-filter-autosuggest.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
- package/test-utils/dom/internal/autosuggest-input.d.ts +8 -0
- package/test-utils/dom/internal/autosuggest-input.js +41 -0
- package/test-utils/dom/internal/autosuggest-input.js.map +1 -0
- package/test-utils/selectors/internal/autosuggest-input.d.ts +8 -0
- package/test-utils/selectors/internal/autosuggest-input.js +41 -0
- package/test-utils/selectors/internal/autosuggest-input.js.map +1 -0
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/autosuggest/autosuggest-input.d.ts.map +0 -1
- package/autosuggest/autosuggest-input.js.map +0 -1
|
@@ -210,4 +210,29 @@ export declare namespace PropertyFilterProps {
|
|
|
210
210
|
focus(): void;
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
+
export declare type Token = PropertyFilterProps.Token;
|
|
214
|
+
export declare type JoinOperation = PropertyFilterProps.JoinOperation;
|
|
215
|
+
export declare type ComparisonOperator = PropertyFilterProps.ComparisonOperator;
|
|
216
|
+
export declare type FilteringOption = PropertyFilterProps.FilteringOption;
|
|
217
|
+
export declare type FilteringProperty = PropertyFilterProps.FilteringProperty;
|
|
218
|
+
export declare type Query = PropertyFilterProps.Query;
|
|
219
|
+
export declare type LoadItemsDetail = PropertyFilterProps.LoadItemsDetail;
|
|
220
|
+
export declare type I18nStrings = PropertyFilterProps.I18nStrings;
|
|
221
|
+
export declare type GroupText = PropertyFilterProps.GroupText;
|
|
222
|
+
export declare type FilteringChangeDetail = PropertyFilterProps.FilteringChangeDetail;
|
|
223
|
+
export declare type Ref = PropertyFilterProps.Ref;
|
|
224
|
+
export declare type ParsedText = {
|
|
225
|
+
step: 'property';
|
|
226
|
+
property: FilteringProperty;
|
|
227
|
+
operator: ComparisonOperator;
|
|
228
|
+
value: string;
|
|
229
|
+
} | {
|
|
230
|
+
step: 'operator';
|
|
231
|
+
property: FilteringProperty;
|
|
232
|
+
operatorPrefix: string;
|
|
233
|
+
} | {
|
|
234
|
+
step: 'free-text';
|
|
235
|
+
operator?: ComparisonOperator;
|
|
236
|
+
value: string;
|
|
237
|
+
};
|
|
213
238
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM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AG,mBAAmB,CAAC,iBAAiB,CAAC;AACtE,oBAAY,KAAK,GAAG,mBAAmB,CAAC,KAAK,CAAC;AAC9C,oBAAY,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;AAClE,oBAAY,WAAW,GAAG,mBAAmB,CAAC,WAAW,CAAC;AAC1D,oBAAY,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;AACtD,oBAAY,qBAAqB,GAAG,mBAAmB,CAAC,qBAAqB,CAAC;AAC9E,oBAAY,GAAG,GAAG,mBAAmB,CAAC,GAAG,CAAC;AAI1C,oBAAY,UAAU,GAClB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,iBAAiB,CAAC;IAAC,QAAQ,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC9F;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,iBAAiB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GACzE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport {\n PropertyFilterOperator,\n PropertyFilterOperation,\n PropertyFilterToken,\n PropertyFilterProperty,\n PropertyFilterOption,\n} from '@cloudscape-design/collection-hooks';\n\nexport interface PropertyFilterProps extends BaseComponentProps, ExpandToViewport {\n /**\n * If set to `true`, the filtering input will be disabled.\n * Use it, for example, if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering query.\n */\n disabled?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings: PropertyFilterProps.I18nStrings;\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `query.tokens` isn't empty.\n */\n countText?: string;\n /**\n * An object representing the current query displayed in the property filter. Has two properties: `tokens` and `operation`.\n * `tokens` is an array of objects that will be displayed to the user beneath the filtering input.\n * Each token has the following properties:\n *\n * * value [string]: The string value of the token to be used as a filter.\n * * propertyKey [string]: The key of the corresponding property in filteringProperties.\n * * operator ['<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!=']: The operator which indicates how to filter the dataset using this token.\n *\n * `operation` has two valid values [and, or] and controls the join operation to be applied between tokens when filtering the items.\n */\n query: PropertyFilterProps.Query;\n /**\n * If hideOperations it set, the indicator of the operation (that is, `and` or `or`) and the selection of operations\n * (applied to the property and value token) are hidden from the user. Only use when you have a custom\n * filtering logic which combines tokens in different way than the default one. When used, ensure that\n * operations are communicated to the user in another way.\n */\n hideOperations?: boolean;\n /**\n * Fired when the `query` gets changed. Filter the dataset in response to this event using the values in the `detail` object.\n */\n onChange: NonCancelableEventHandler<PropertyFilterProps.Query>;\n /**\n * An array of properties by which the data set can be filtered. Each element has the following properties:\n *\n * * groupValuesLabel [string]: Localized string to display for the 'Values' group label for a specific property.\n * * key [string]: The identifier of this property.\n * * propertyLabel [string]: A human-readable string for the property.\n * * operators [Array]: A list of all operators supported by this property. If you omit the equals operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * group [string]: Optional identifier of a custom group that this filtering option is assigned to. Use to create additional groups below the default one. Make sure to also define labels for the group in the customGroupsText property. Notice that only one level of options nesting is supported.\n * * defaultOperator [ComparisonOperator]: Optional parameter that changes the default operator used with this filtering property. Use it only if your API does not support \"equals\" filtering terms with this property.\n */\n filteringProperties: ReadonlyArray<PropertyFilterProps.FilteringProperty>;\n /**\n * An array of possible values of the individual `filteringProperties`. Each element has the following properties:\n *\n * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.\n * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.\n */\n filteringOptions?: ReadonlyArray<PropertyFilterProps.FilteringOption>;\n /**\n * An array of objects that contain localized, human-readable strings for the labels of custom groups within the filtering dropdown. Use group property to associate the strings with your custom group of options. Define the following values for each group:\n *\n * * properties [string]: The group label in the filtering dropdown that contains the list of properties from this group. For example: Tags.\n * * values [string]: The group label in the filtering dropdown that contains the list of values from this group. For example: Tags values.\n * * group [string]: The identifier of a custom group.\n */\n customGroupsText?: PropertyFilterProps.GroupText[];\n /**\n * Set `disableFreeTextFiltering` only if you can’t filter the dataset using a filter that is applied to every column,\n * instead of a specific property. This would stop the user from creating such tokens.\n */\n disableFreeTextFiltering?: boolean;\n /**\n * Use this event to asynchronously load filteringOptions, component currently needs. The detail object contains following properties:\n *\n * * `filteringProperty` - The property for which you need to fetch the options.\n * * `filteringOperator` - The operator for which you need to fetch the options.\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options for a `filteringProperty` that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n */\n onLoadItems?: NonCancelableEventHandler<PropertyFilterProps.LoadItemsDetail>;\n /**\n * If you have more than 500 `filteringOptions`, enable this flag to apply a performance optimization that makes\n * the filtering experience smoother. We don't recommend enabling the feature if you have less than 500 options,\n * because the improvements to performance are offset by a visible scrolling lag. When you set this flag to true,\n * it removes options that are not currently in view from the DOM.\n */\n virtualScroll?: boolean;\n /**\n * A slot located before the filtering input. Use it if for a Select component if your dataset supports property\n * filter queries only after an initial filter is applied.\n */\n customControl?: React.ReactNode;\n /**\n * Set `asyncProperties` if you need to load `filteringProperties` asynchronousely. This would cause extra `onLoadMore`\n * events to fire calling for more properties.\n */\n asyncProperties?: boolean;\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n tokenLimit?: number;\n /**\n * Displayed when there are no options to display.\n * This is only shown when `statusType` is set to `finished` or not set at all.\n */\n filteringEmpty?: React.ReactNode;\n /**\n * Specifies the text to display when in the loading state.\n **/\n filteringLoadingText?: string;\n /**\n * Specifies the text to display at the bottom of the dropdown menu after pagination has reached the end.\n **/\n filteringFinishedText?: string;\n /**\n * Specifies the text to display when a data fetching error occurs. Make sure that you provide `recoveryText`.\n **/\n filteringErrorText?: string;\n /**\n * Specifies the text for the recovery button. The text is displayed next to the error text.\n * Use the `onLoadItems` event to perform a recovery action (for example, retrying the request).\n **/\n filteringRecoveryText?: string;\n /**\n * Specifies the current status of loading more options.\n * * `pending` - Indicates that no request in progress, but more options may be loaded.\n * * `loading` - Indicates that data fetching is in progress.\n * * `finished` - Indicates that pagination has finished and no more requests are expected.\n * * `error` - Indicates that an error occurred during fetch. You should use `recoveryText` to enable the user to recover.\n **/\n filteringStatusType?: DropdownStatusProps.StatusType;\n}\n\nexport namespace PropertyFilterProps {\n export type Token = PropertyFilterToken;\n export type JoinOperation = PropertyFilterOperation;\n export type ComparisonOperator = PropertyFilterOperator;\n export type FilteringOption = PropertyFilterOption;\n export interface FilteringProperty extends PropertyFilterProperty {\n groupValuesLabel: string;\n propertyLabel: string;\n group?: string;\n }\n\n export interface Query {\n tokens: ReadonlyArray<PropertyFilterProps.Token>;\n operation: PropertyFilterProps.JoinOperation;\n }\n\n export interface LoadItemsDetail {\n filteringProperty?: FilteringProperty;\n filteringOperator?: ComparisonOperator;\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n }\n\n export interface I18nStrings {\n /**\n * Label that will be passed down to the Autosuggest `ariaLabel` property.\n * See the [Autosuggest API](/system/components/autosuggest/?tabId=api) page for more details.\n */\n filteringAriaLabel: string;\n dismissAriaLabel: string;\n\n filteringPlaceholder?: string;\n groupValuesText: string;\n groupPropertiesText: string;\n operatorsText: string;\n\n operationAndText: string;\n operationOrText: string;\n\n operatorLessText: string;\n operatorLessOrEqualText: string;\n operatorGreaterText: string;\n operatorGreaterOrEqualText: string;\n operatorContainsText: string;\n operatorDoesNotContainText: string;\n operatorEqualsText: string;\n operatorDoesNotEqualText: string;\n\n editTokenHeader: string;\n propertyText: string;\n operatorText: string;\n valueText: string;\n cancelActionText: string;\n applyActionText: string;\n allPropertiesLabel: string;\n\n tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText: string;\n removeTokenButtonAriaLabel: (token: PropertyFilterProps.Token) => string;\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\n }\n\n export interface GroupText {\n properties: string;\n values: string;\n group: string;\n }\n\n export interface FilteringChangeDetail {\n filteringText: string;\n filteringProperty?: FilteringProperty;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport {\n PropertyFilterOperator,\n PropertyFilterOperation,\n PropertyFilterToken,\n PropertyFilterProperty,\n PropertyFilterOption,\n} from '@cloudscape-design/collection-hooks';\n\nexport interface PropertyFilterProps extends BaseComponentProps, ExpandToViewport {\n /**\n * If set to `true`, the filtering input will be disabled.\n * Use it, for example, if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering query.\n */\n disabled?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings: PropertyFilterProps.I18nStrings;\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `query.tokens` isn't empty.\n */\n countText?: string;\n /**\n * An object representing the current query displayed in the property filter. Has two properties: `tokens` and `operation`.\n * `tokens` is an array of objects that will be displayed to the user beneath the filtering input.\n * Each token has the following properties:\n *\n * * value [string]: The string value of the token to be used as a filter.\n * * propertyKey [string]: The key of the corresponding property in filteringProperties.\n * * operator ['<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!=']: The operator which indicates how to filter the dataset using this token.\n *\n * `operation` has two valid values [and, or] and controls the join operation to be applied between tokens when filtering the items.\n */\n query: PropertyFilterProps.Query;\n /**\n * If hideOperations it set, the indicator of the operation (that is, `and` or `or`) and the selection of operations\n * (applied to the property and value token) are hidden from the user. Only use when you have a custom\n * filtering logic which combines tokens in different way than the default one. When used, ensure that\n * operations are communicated to the user in another way.\n */\n hideOperations?: boolean;\n /**\n * Fired when the `query` gets changed. Filter the dataset in response to this event using the values in the `detail` object.\n */\n onChange: NonCancelableEventHandler<PropertyFilterProps.Query>;\n /**\n * An array of properties by which the data set can be filtered. Each element has the following properties:\n *\n * * groupValuesLabel [string]: Localized string to display for the 'Values' group label for a specific property.\n * * key [string]: The identifier of this property.\n * * propertyLabel [string]: A human-readable string for the property.\n * * operators [Array]: A list of all operators supported by this property. If you omit the equals operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * group [string]: Optional identifier of a custom group that this filtering option is assigned to. Use to create additional groups below the default one. Make sure to also define labels for the group in the customGroupsText property. Notice that only one level of options nesting is supported.\n * * defaultOperator [ComparisonOperator]: Optional parameter that changes the default operator used with this filtering property. Use it only if your API does not support \"equals\" filtering terms with this property.\n */\n filteringProperties: ReadonlyArray<PropertyFilterProps.FilteringProperty>;\n /**\n * An array of possible values of the individual `filteringProperties`. Each element has the following properties:\n *\n * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.\n * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.\n */\n filteringOptions?: ReadonlyArray<PropertyFilterProps.FilteringOption>;\n /**\n * An array of objects that contain localized, human-readable strings for the labels of custom groups within the filtering dropdown. Use group property to associate the strings with your custom group of options. Define the following values for each group:\n *\n * * properties [string]: The group label in the filtering dropdown that contains the list of properties from this group. For example: Tags.\n * * values [string]: The group label in the filtering dropdown that contains the list of values from this group. For example: Tags values.\n * * group [string]: The identifier of a custom group.\n */\n customGroupsText?: PropertyFilterProps.GroupText[];\n /**\n * Set `disableFreeTextFiltering` only if you can’t filter the dataset using a filter that is applied to every column,\n * instead of a specific property. This would stop the user from creating such tokens.\n */\n disableFreeTextFiltering?: boolean;\n /**\n * Use this event to asynchronously load filteringOptions, component currently needs. The detail object contains following properties:\n *\n * * `filteringProperty` - The property for which you need to fetch the options.\n * * `filteringOperator` - The operator for which you need to fetch the options.\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options for a `filteringProperty` that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n */\n onLoadItems?: NonCancelableEventHandler<PropertyFilterProps.LoadItemsDetail>;\n /**\n * If you have more than 500 `filteringOptions`, enable this flag to apply a performance optimization that makes\n * the filtering experience smoother. We don't recommend enabling the feature if you have less than 500 options,\n * because the improvements to performance are offset by a visible scrolling lag. When you set this flag to true,\n * it removes options that are not currently in view from the DOM.\n */\n virtualScroll?: boolean;\n /**\n * A slot located before the filtering input. Use it if for a Select component if your dataset supports property\n * filter queries only after an initial filter is applied.\n */\n customControl?: React.ReactNode;\n /**\n * Set `asyncProperties` if you need to load `filteringProperties` asynchronousely. This would cause extra `onLoadMore`\n * events to fire calling for more properties.\n */\n asyncProperties?: boolean;\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n tokenLimit?: number;\n /**\n * Displayed when there are no options to display.\n * This is only shown when `statusType` is set to `finished` or not set at all.\n */\n filteringEmpty?: React.ReactNode;\n /**\n * Specifies the text to display when in the loading state.\n **/\n filteringLoadingText?: string;\n /**\n * Specifies the text to display at the bottom of the dropdown menu after pagination has reached the end.\n **/\n filteringFinishedText?: string;\n /**\n * Specifies the text to display when a data fetching error occurs. Make sure that you provide `recoveryText`.\n **/\n filteringErrorText?: string;\n /**\n * Specifies the text for the recovery button. The text is displayed next to the error text.\n * Use the `onLoadItems` event to perform a recovery action (for example, retrying the request).\n **/\n filteringRecoveryText?: string;\n /**\n * Specifies the current status of loading more options.\n * * `pending` - Indicates that no request in progress, but more options may be loaded.\n * * `loading` - Indicates that data fetching is in progress.\n * * `finished` - Indicates that pagination has finished and no more requests are expected.\n * * `error` - Indicates that an error occurred during fetch. You should use `recoveryText` to enable the user to recover.\n **/\n filteringStatusType?: DropdownStatusProps.StatusType;\n}\n\nexport namespace PropertyFilterProps {\n export type Token = PropertyFilterToken;\n export type JoinOperation = PropertyFilterOperation;\n export type ComparisonOperator = PropertyFilterOperator;\n export type FilteringOption = PropertyFilterOption;\n export interface FilteringProperty extends PropertyFilterProperty {\n groupValuesLabel: string;\n propertyLabel: string;\n group?: string;\n }\n\n export interface Query {\n tokens: ReadonlyArray<PropertyFilterProps.Token>;\n operation: PropertyFilterProps.JoinOperation;\n }\n\n export interface LoadItemsDetail {\n filteringProperty?: FilteringProperty;\n filteringOperator?: ComparisonOperator;\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n }\n\n export interface I18nStrings {\n /**\n * Label that will be passed down to the Autosuggest `ariaLabel` property.\n * See the [Autosuggest API](/system/components/autosuggest/?tabId=api) page for more details.\n */\n filteringAriaLabel: string;\n dismissAriaLabel: string;\n\n filteringPlaceholder?: string;\n groupValuesText: string;\n groupPropertiesText: string;\n operatorsText: string;\n\n operationAndText: string;\n operationOrText: string;\n\n operatorLessText: string;\n operatorLessOrEqualText: string;\n operatorGreaterText: string;\n operatorGreaterOrEqualText: string;\n operatorContainsText: string;\n operatorDoesNotContainText: string;\n operatorEqualsText: string;\n operatorDoesNotEqualText: string;\n\n editTokenHeader: string;\n propertyText: string;\n operatorText: string;\n valueText: string;\n cancelActionText: string;\n applyActionText: string;\n allPropertiesLabel: string;\n\n tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText: string;\n removeTokenButtonAriaLabel: (token: PropertyFilterProps.Token) => string;\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\n }\n\n export interface GroupText {\n properties: string;\n values: string;\n group: string;\n }\n\n export interface FilteringChangeDetail {\n filteringText: string;\n filteringProperty?: FilteringProperty;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n\n// Re-exported namespace interfaces to use module-style imports internally\n\nexport type Token = PropertyFilterProps.Token;\nexport type JoinOperation = PropertyFilterProps.JoinOperation;\nexport type ComparisonOperator = PropertyFilterProps.ComparisonOperator;\nexport type FilteringOption = PropertyFilterProps.FilteringOption;\nexport type FilteringProperty = PropertyFilterProps.FilteringProperty;\nexport type Query = PropertyFilterProps.Query;\nexport type LoadItemsDetail = PropertyFilterProps.LoadItemsDetail;\nexport type I18nStrings = PropertyFilterProps.I18nStrings;\nexport type GroupText = PropertyFilterProps.GroupText;\nexport type FilteringChangeDetail = PropertyFilterProps.FilteringChangeDetail;\nexport type Ref = PropertyFilterProps.Ref;\n\n// Utility types\n\nexport type ParsedText =\n | { step: 'property'; property: FilteringProperty; operator: ComparisonOperator; value: string }\n | { step: 'operator'; property: FilteringProperty; operatorPrefix: string }\n | { step: 'free-text'; operator?: ComparisonOperator; value: string };\n"]}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { AutosuggestProps } from '../autosuggest/interfaces';
|
|
3
3
|
import { CancelableEventHandler } from '../internal/events';
|
|
4
4
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
5
|
-
import { AutosuggestInputRef } from '../
|
|
5
|
+
import { AutosuggestInputRef } from '../internal/components/autosuggest-input';
|
|
6
6
|
export interface PropertyFilterAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {
|
|
7
7
|
filterText?: string;
|
|
8
8
|
onOptionClick?: CancelableEventHandler<AutosuggestProps.Option>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-filter-autosuggest.d.ts","sourceRoot":"","sources":["../../../src/property-filter/property-filter-autosuggest.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAG3C,OAAO,EAAmB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAM9E,OAAO,EAEL,sBAAsB,EAGvB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAyB,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"property-filter-autosuggest.d.ts","sourceRoot":"","sources":["../../../src/property-filter/property-filter-autosuggest.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAG3C,OAAO,EAAmB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAM9E,OAAO,EAEL,sBAAsB,EAGvB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAyB,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAKjG,MAAM,WAAW,8BAA+B,SAAQ,gBAAgB,EAAE,0BAA0B;IAClG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChE,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,QAAA,MAAM,yBAAyB,4GAsJ9B,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -11,7 +11,7 @@ import styles from '../autosuggest/styles.css.js';
|
|
|
11
11
|
import { fireCancelableEvent } from '../internal/events/index';
|
|
12
12
|
import AutosuggestOptionsList from '../autosuggest/options-list';
|
|
13
13
|
import { useAutosuggestLoadMore } from '../autosuggest/load-more-controller';
|
|
14
|
-
import AutosuggestInput from '../
|
|
14
|
+
import AutosuggestInput from '../internal/components/autosuggest-input';
|
|
15
15
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
16
16
|
var DROPDOWN_WIDTH = 300;
|
|
17
17
|
var PropertyFilterAutosuggest = React.forwardRef(function (props, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-filter-autosuggest.js","sourceRoot":"","sources":["../../../src/property-filter/property-filter-autosuggest.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAO,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACL,sBAAsB,GAIvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,MAAM,MAAM,8BAA8B,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,sBAAsB,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,gBAAyC,MAAM,kCAAkC,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,IAAM,cAAc,GAAG,GAAG,CAAC;AAQ3B,IAAM,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EAClB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,MAAM,EACpB,oBAAoB,EAAE,mBAAmB,EACzC,gBAAgB,EAAE,qBAAqB,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EACxD,eAAe,EACb,oBAAC,sBAAsB,IACrB,qBAAqB,EAAE,qBAAqB,EAC5C,wBAAwB,EAAE,wBAAwB,EAClD,mBAAmB,EAAE,mBAAmB,EACxC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,2BAA2B,CAAC,oBAAoB,EAChE,iBAAiB,EAAE,cAAc,CAAC,OAAO,KAAK,IAAI,EAClD,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAC,cAAc,IAAC,OAAO,EAAE,cAAc,CAAC,OAAO,GAAI,CAAC,CAAC,CAAC,IAAI,GACjG,EAEJ,cAAc,EACZ,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CACxB,oBAAC,cAAc,IAAC,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GAAI,CACvG,CAAC,CAAC,CAAC,IAAI,EAEV,aAAa,EAAE,cAAc,EAC7B,eAAe,EAAE,mBAAmB,EACpC,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,IAC1B,IAAI,EACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,yBAAyB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useRef } from 'react';\n\nimport { useAutosuggestItems } from '../autosuggest/options-controller';\nimport { AutosuggestItem, AutosuggestProps } from '../autosuggest/interfaces';\n\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport DropdownFooter from '../internal/components/dropdown-footer';\n\nimport { generateUniqueId, useUniqueId } from '../internal/hooks/use-unique-id';\nimport {\n fireNonCancelableEvent,\n CancelableEventHandler,\n NonCancelableCustomEvent,\n BaseKeyDetail,\n} from '../internal/events';\nimport { BaseChangeDetail } from '../input/interfaces';\nimport styles from '../autosuggest/styles.css.js';\nimport { fireCancelableEvent } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport AutosuggestOptionsList from '../autosuggest/options-list';\nimport { useAutosuggestLoadMore } from '../autosuggest/load-more-controller';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../autosuggest/autosuggest-input';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nconst DROPDOWN_WIDTH = 300;\n\nexport interface PropertyFilterAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {\n filterText?: string;\n onOptionClick?: CancelableEventHandler<AutosuggestProps.Option>;\n hideEnteredTextOption?: boolean;\n}\n\nconst PropertyFilterAutosuggest = React.forwardRef(\n (props: PropertyFilterAutosuggestProps, ref: Ref<AutosuggestInputRef>) => {\n const {\n value,\n onChange,\n onFocus,\n onBlur,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n placeholder,\n disabled,\n ariaLabel,\n enteredTextLabel,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n filterText,\n onOptionClick,\n hideEnteredTextOption,\n ...rest\n } = props;\n const highlightText = filterText === undefined ? value : filterText;\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n const mergedRef = useMergeRefs(autosuggestInputRef, ref);\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: highlightText,\n filteringType,\n hideEnteredTextLabel: hideEnteredTextOption,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n const selectedCancelled = fireCancelableEvent(onOptionClick, option);\n if (!selectedCancelled) {\n autosuggestInputRef.current?.close();\n } else {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n }\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleFocus = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireCancelableEvent(onFocus, null);\n };\n\n const handleBlur = () => {\n fireCancelableEvent(onBlur, null);\n };\n\n const handleKeyDown = (e: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, e.detail);\n };\n\n const handlePressArrowDown = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const selfControlId = useUniqueId('input');\n const controlId = rest.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? generateUniqueId() : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const dropdownStatus = useDropdownStatus({ ...props, isEmpty, onRecoveryClick: handleRecoveryClick });\n\n return (\n <AutosuggestInput\n ref={mergedRef}\n className={styles.root}\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n ariaLabel={ariaLabel}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={autosuggestItemsState.items.length > 1}\n dropdownContent={\n <AutosuggestOptionsList\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={highlightText}\n listId={listId}\n controlId={controlId}\n enteredTextLabel={enteredTextLabel}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n listBottom={!dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} /> : null}\n />\n }\n dropdownFooter={\n dropdownStatus.isSticky ? (\n <DropdownFooter content={dropdownStatus.content} hasItems={autosuggestItemsState.items.length >= 1} />\n ) : null\n }\n dropdownWidth={DROPDOWN_WIDTH}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n {...rest}\n />\n );\n }\n);\n\nexport default PropertyFilterAutosuggest;\n"]}
|
|
1
|
+
{"version":3,"file":"property-filter-autosuggest.js","sourceRoot":"","sources":["../../../src/property-filter/property-filter-autosuggest.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAO,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO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,CAAC,CAAC,CACxB,oBAAC,cAAc,IAAC,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GAAI,CACvG,CAAC,CAAC,CAAC,IAAI,EAEV,aAAa,EAAE,cAAc,EAC7B,eAAe,EAAE,mBAAmB,EACpC,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,IAC1B,IAAI,EACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,yBAAyB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useRef } from 'react';\n\nimport { useAutosuggestItems } from '../autosuggest/options-controller';\nimport { AutosuggestItem, AutosuggestProps } from '../autosuggest/interfaces';\n\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\nimport DropdownFooter from '../internal/components/dropdown-footer';\n\nimport { generateUniqueId, useUniqueId } from '../internal/hooks/use-unique-id';\nimport {\n fireNonCancelableEvent,\n CancelableEventHandler,\n NonCancelableCustomEvent,\n BaseKeyDetail,\n} from '../internal/events';\nimport { BaseChangeDetail } from '../input/interfaces';\nimport styles from '../autosuggest/styles.css.js';\nimport { fireCancelableEvent } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport AutosuggestOptionsList from '../autosuggest/options-list';\nimport { useAutosuggestLoadMore } from '../autosuggest/load-more-controller';\nimport { OptionsLoadItemsDetail } from '../internal/components/dropdown/interfaces';\nimport AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nconst DROPDOWN_WIDTH = 300;\n\nexport interface PropertyFilterAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {\n filterText?: string;\n onOptionClick?: CancelableEventHandler<AutosuggestProps.Option>;\n hideEnteredTextOption?: boolean;\n}\n\nconst PropertyFilterAutosuggest = React.forwardRef(\n (props: PropertyFilterAutosuggestProps, ref: Ref<AutosuggestInputRef>) => {\n const {\n value,\n onChange,\n onFocus,\n onBlur,\n onLoadItems,\n options,\n filteringType = 'auto',\n statusType = 'finished',\n placeholder,\n disabled,\n ariaLabel,\n enteredTextLabel,\n onKeyDown,\n virtualScroll,\n expandToViewport,\n filterText,\n onOptionClick,\n hideEnteredTextOption,\n ...rest\n } = props;\n const highlightText = filterText === undefined ? value : filterText;\n\n const autosuggestInputRef = useRef<AutosuggestInputRef>(null);\n const mergedRef = useMergeRefs(autosuggestInputRef, ref);\n\n const [autosuggestItemsState, autosuggestItemsHandlers] = useAutosuggestItems({\n options: options || [],\n filterValue: value,\n filterText: highlightText,\n filteringType,\n hideEnteredTextLabel: hideEnteredTextOption,\n onSelectItem: (option: AutosuggestItem) => {\n const value = option.value || '';\n fireNonCancelableEvent(onChange, { value });\n const selectedCancelled = fireCancelableEvent(onOptionClick, option);\n if (!selectedCancelled) {\n autosuggestInputRef.current?.close();\n } else {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n }\n },\n });\n\n const autosuggestLoadMoreHandlers = useAutosuggestLoadMore({\n options,\n statusType,\n onLoadItems: (detail: OptionsLoadItemsDetail) => fireNonCancelableEvent(onLoadItems, detail),\n });\n\n const handleChange = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n fireNonCancelableEvent(onChange, event.detail);\n };\n\n const handleDelayedInput = (event: NonCancelableCustomEvent<BaseChangeDetail>) => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputChange(event.detail.value);\n };\n\n const handleFocus = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnInputFocus();\n fireCancelableEvent(onFocus, null);\n };\n\n const handleBlur = () => {\n fireCancelableEvent(onBlur, null);\n };\n\n const handleKeyDown = (e: CustomEvent<BaseKeyDetail>) => {\n fireCancelableEvent(onKeyDown, e.detail);\n };\n\n const handlePressArrowDown = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(1);\n };\n\n const handlePressArrowUp = () => {\n autosuggestItemsHandlers.moveHighlightWithKeyboard(-1);\n };\n\n const handlePressEnter = () => {\n return autosuggestItemsHandlers.selectHighlightedOptionWithKeyboard();\n };\n\n const handleCloseDropdown = () => {\n autosuggestItemsHandlers.resetHighlightWithKeyboard();\n };\n\n const handleRecoveryClick = () => {\n autosuggestLoadMoreHandlers.fireLoadMoreOnRecoveryClick();\n autosuggestInputRef.current?.focus();\n };\n\n const selfControlId = useUniqueId('input');\n const controlId = rest.controlId ?? selfControlId;\n const listId = useUniqueId('list');\n const highlightedOptionId = autosuggestItemsState.highlightedOption ? generateUniqueId() : undefined;\n\n const isEmpty = !value && !autosuggestItemsState.items.length;\n const dropdownStatus = useDropdownStatus({ ...props, isEmpty, onRecoveryClick: handleRecoveryClick });\n\n return (\n <AutosuggestInput\n ref={mergedRef}\n className={styles.root}\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n controlId={controlId}\n placeholder={placeholder}\n disabled={disabled}\n ariaLabel={ariaLabel}\n expandToViewport={expandToViewport}\n ariaControls={listId}\n ariaActivedescendant={highlightedOptionId}\n dropdownExpanded={autosuggestItemsState.items.length > 1}\n dropdownContent={\n <AutosuggestOptionsList\n autosuggestItemsState={autosuggestItemsState}\n autosuggestItemsHandlers={autosuggestItemsHandlers}\n highlightedOptionId={highlightedOptionId}\n highlightText={highlightText}\n listId={listId}\n controlId={controlId}\n enteredTextLabel={enteredTextLabel}\n handleLoadMore={autosuggestLoadMoreHandlers.fireLoadMoreOnScroll}\n hasDropdownStatus={dropdownStatus.content !== null}\n virtualScroll={virtualScroll}\n listBottom={!dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} /> : null}\n />\n }\n dropdownFooter={\n dropdownStatus.isSticky ? (\n <DropdownFooter content={dropdownStatus.content} hasItems={autosuggestItemsState.items.length >= 1} />\n ) : null\n }\n dropdownWidth={DROPDOWN_WIDTH}\n onCloseDropdown={handleCloseDropdown}\n onDelayedInput={handleDelayedInput}\n onPressArrowDown={handlePressArrowDown}\n onPressArrowUp={handlePressArrowUp}\n onPressEnter={handlePressEnter}\n {...rest}\n />\n );\n }\n);\n\nexport default PropertyFilterAutosuggest;\n"]}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
interface TokenEditorProps
|
|
6
|
-
|
|
2
|
+
import { FilteringOption, FilteringProperty, GroupText, I18nStrings, LoadItemsDetail, Token } from './interfaces';
|
|
3
|
+
import { NonCancelableEventHandler } from '../internal/events';
|
|
4
|
+
import { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';
|
|
5
|
+
interface TokenEditorProps {
|
|
6
|
+
asyncProperties?: boolean;
|
|
7
|
+
asyncProps: DropdownStatusProps;
|
|
8
|
+
customGroupsText: readonly GroupText[];
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
disableFreeTextFiltering?: boolean;
|
|
11
|
+
expandToViewport?: boolean;
|
|
12
|
+
filteringOptions: readonly FilteringOption[];
|
|
13
|
+
filteringProperties: readonly FilteringProperty[];
|
|
14
|
+
i18nStrings: I18nStrings;
|
|
15
|
+
onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;
|
|
16
|
+
setToken: (newToken: Token) => void;
|
|
17
|
+
token: Token;
|
|
7
18
|
triggerComponent?: React.ReactNode;
|
|
8
|
-
setToken: (newToken: PropertyFilterProps.Token) => void;
|
|
9
|
-
asyncProps: AsyncProps;
|
|
10
19
|
}
|
|
11
20
|
export declare const TokenEditor: ({ asyncProperties, asyncProps, customGroupsText, disableFreeTextFiltering, expandToViewport, filteringOptions, filteringProperties, i18nStrings, onLoadItems, setToken, token, triggerComponent, }: TokenEditorProps) => JSX.Element;
|
|
12
21
|
export {};
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"token-editor.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAWhD,OAAO,EAEL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,EACN,MAAM,cAAc,CAAC;AAUtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAIxF,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,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,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,KAAK,CAAC;IACb,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC;AA4KD,eAAO,MAAM,WAAW,uMAarB,gBAAgB,gBAiGlB,CAAC"}
|
|
@@ -66,10 +66,9 @@ function OperatorInput(_a) {
|
|
|
66
66
|
: null, onChange: function (e) { return onChangeOperator(e.detail.selectedOption.value); } }))));
|
|
67
67
|
}
|
|
68
68
|
function ValueInput(_a) {
|
|
69
|
-
var _b;
|
|
70
69
|
var propertyKey = _a.propertyKey, operator = _a.operator, value = _a.value, onChangeValue = _a.onChangeValue, asyncProps = _a.asyncProps, filteringProperties = _a.filteringProperties, filteringOptions = _a.filteringOptions, onLoadItems = _a.onLoadItems, i18nStrings = _a.i18nStrings;
|
|
71
70
|
var property = propertyKey !== undefined ? getPropertyByKey(filteringProperties, propertyKey) : undefined;
|
|
72
|
-
var valueOptions = property ?
|
|
71
|
+
var valueOptions = property ? getPropertyOptions(property, filteringOptions).map(function (_a) {
|
|
73
72
|
var value = _a.value;
|
|
74
73
|
return ({ value: value });
|
|
75
74
|
}) : [];
|
|
@@ -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;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAE1D,OAAO,eAAuC,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAEtB,IAAM,iBAAiB,GAA6C,CAAC,GAAG,EAAE,IAAI,CAAC,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BAAmB,EAAE,mBAAmB,EACxC,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,GACxB,CACmB;YAEvB,6BAAK,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC;gBAC5C,oBAAC,cAAc,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,EAAE,OAAO,EAAE,YAAY,IAC3F,WAAW,CAAC,gBAAgB,CACd;gBACjB,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,EACxC,OAAO,EAAE;wBACP,QAAQ,CAAC,cAA2C,CAAC,CAAC;wBACtD,YAAY,EAAE,CAAC;oBACjB,CAAC,IAEA,WAAW,CAAC,eAAe,CACb,CACb,CACF,IAGP,gBAAgB,CACD,CACnB,CAAC;AACJ,CAAC,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';\nimport clsx from 'clsx';\n\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport InternalAutosuggest from '../autosuggest/internal';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport InternalPopover, { InternalPopoverRef } from '../popover/internal';\nimport { InternalButton } from '../button/internal';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index';\n\nimport { PropertyFilterProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { useLoadItems } from './use-load-items';\nimport {\n getAllowedOperators,\n getPropertyOptions,\n getPropertyByKey,\n operatorToDescription,\n getPropertySuggestions,\n} from './controller';\n\nconst freeTextOperators: PropertyFilterProps.ComparisonOperator[] = [':', '!:'];\n\ntype AsyncProps = Pick<\n AutosuggestProps,\n 'empty' | 'loadingText' | 'finishedText' | 'errorText' | 'recoveryText' | 'statusType'\n>;\n\ninterface TokenEditorProps\n extends Pick<\n PropertyFilterProps,\n | 'filteringProperties'\n | 'filteringOptions'\n | 'onLoadItems'\n | 'i18nStrings'\n | 'asyncProperties'\n | 'customGroupsText'\n | 'disableFreeTextFiltering'\n | 'disabled'\n | 'expandToViewport'\n > {\n token: PropertyFilterProps.Token;\n triggerComponent?: React.ReactNode;\n setToken: (newToken: PropertyFilterProps.Token) => void;\n asyncProps: AsyncProps;\n}\n\ninterface PropertyInputProps\n extends Pick<\n PropertyFilterProps,\n 'filteringProperties' | 'onLoadItems' | 'i18nStrings' | 'customGroupsText' | 'disableFreeTextFiltering'\n > {\n propertyKey: undefined | string;\n onChangePropertyKey: (propertyKey: undefined | string) => void;\n asyncProps: null | AsyncProps;\n}\n\nfunction PropertyInput({\n propertyKey,\n onChangePropertyKey,\n asyncProps,\n filteringProperties,\n onLoadItems,\n customGroupsText,\n i18nStrings,\n disableFreeTextFiltering,\n}: PropertyInputProps) {\n const property = propertyKey !== undefined ? getPropertyByKey(filteringProperties, propertyKey) : undefined;\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 ({ propertyLabel, key }) => ({\n value: key,\n label: propertyLabel,\n dontCloseOnSelect: true,\n })\n );\n const allPropertiesOption = {\n label: i18nStrings.allPropertiesLabel,\n value: undefined,\n };\n if (!disableFreeTextFiltering) {\n propertyOptions.unshift(allPropertiesOption);\n }\n const controlId = useUniqueId('property');\n\n return (\n <div className={clsx(styles['token-editor-line'], styles['property-selector'])} key={i18nStrings.propertyText}>\n <label className={styles['token-editor-label']} htmlFor={controlId}>\n {i18nStrings.propertyText}\n </label>\n <div className={styles['token-editor-field']}>\n <InternalSelect\n controlId={controlId}\n options={propertyOptions}\n selectedOption={\n property\n ? {\n value: propertyKey ?? undefined,\n label: property.propertyLabel,\n }\n : allPropertiesOption\n }\n onChange={e => onChangePropertyKey(e.detail.selectedOption.value)}\n {...asyncPropertySelectProps}\n />\n </div>\n </div>\n );\n}\n\ninterface OperatorInputProps extends Pick<PropertyFilterProps, 'filteringProperties' | 'i18nStrings'> {\n propertyKey: undefined | string;\n operator: undefined | PropertyFilterProps.ComparisonOperator;\n onChangeOperator: (operator: PropertyFilterProps.ComparisonOperator) => void;\n}\n\nfunction OperatorInput({\n propertyKey,\n operator,\n onChangeOperator,\n filteringProperties,\n i18nStrings,\n}: OperatorInputProps) {\n const property = propertyKey !== undefined ? getPropertyByKey(filteringProperties, propertyKey) : undefined;\n const freeTextOperators: PropertyFilterProps.ComparisonOperator[] = [':', '!:'];\n const operatorOptions = (property ? getAllowedOperators(property) : freeTextOperators).map(operator => ({\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }));\n const contorlId = useUniqueId('operator');\n\n return (\n <div className={clsx(styles['token-editor-line'], styles['operator-selector'])} key={i18nStrings.operatorText}>\n <label className={styles['token-editor-label']} htmlFor={contorlId}>\n {i18nStrings.operatorText}\n </label>\n <div className={styles['token-editor-field']}>\n <InternalSelect\n controlId={contorlId}\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 PropertyFilterProps.ComparisonOperator)}\n />\n </div>\n </div>\n );\n}\n\ninterface ValueInputProps\n extends Pick<PropertyFilterProps, 'filteringProperties' | 'filteringOptions' | 'onLoadItems' | 'i18nStrings'> {\n propertyKey: undefined | string;\n operator: undefined | PropertyFilterProps.ComparisonOperator;\n value: undefined | string;\n onChangeValue: (value: string) => void;\n asyncProps: AsyncProps;\n}\n\nfunction ValueInput({\n propertyKey,\n operator,\n value,\n onChangeValue,\n asyncProps,\n filteringProperties,\n filteringOptions,\n onLoadItems,\n i18nStrings,\n}: ValueInputProps) {\n const property = propertyKey !== undefined ? getPropertyByKey(filteringProperties, propertyKey) : undefined;\n const valueOptions = property ? getPropertyOptions(property, filteringOptions)?.map(({ value }) => ({ value })) : [];\n const valueAutosuggestHandlers = useLoadItems(onLoadItems, '', property);\n const asyncValueAutosuggesProps = propertyKey\n ? { ...valueAutosuggestHandlers, ...asyncProps }\n : { empty: asyncProps.empty };\n const controlId = useUniqueId('value');\n\n return (\n <div className={clsx(styles['token-editor-line'], styles['value-selector'])} key={i18nStrings.valueText}>\n <label className={styles['token-editor-label']} htmlFor={controlId}>\n {i18nStrings.valueText}\n </label>\n <div className={styles['token-editor-field']}>\n <InternalAutosuggest\n controlId={controlId}\n enteredTextLabel={i18nStrings.enteredTextLabel}\n value={value ?? ''}\n onChange={e => onChangeValue(e.detail.value)}\n disabled={!operator}\n options={valueOptions}\n {...asyncValueAutosuggesProps}\n virtualScroll={true}\n />\n </div>\n </div>\n );\n}\n\nexport const TokenEditor = ({\n asyncProperties,\n asyncProps,\n customGroupsText,\n disableFreeTextFiltering,\n expandToViewport,\n filteringOptions,\n filteringProperties,\n i18nStrings,\n onLoadItems,\n setToken,\n token,\n triggerComponent,\n}: TokenEditorProps) => {\n const [temporaryToken, setTemporaryToken] = useState<PropertyFilterProps.Token>(token);\n const popoverRef = useRef<InternalPopoverRef>(null);\n const closePopover = () => {\n popoverRef.current && popoverRef.current.dismissPopover();\n };\n\n const propertyKey = temporaryToken.propertyKey;\n const onChangePropertyKey = (newPropertyKey: undefined | string) => {\n const filteringProperty = filteringProperties.reduce<PropertyFilterProps.FilteringProperty | undefined>(\n (acc, property) => (property.key === newPropertyKey ? property : acc),\n undefined\n );\n const allowedOperators = filteringProperty ? getAllowedOperators(filteringProperty) : freeTextOperators;\n const operator =\n temporaryToken.operator && allowedOperators.indexOf(temporaryToken.operator) !== -1\n ? temporaryToken.operator\n : allowedOperators[0];\n setTemporaryToken({ ...temporaryToken, propertyKey: newPropertyKey, operator });\n };\n\n const operator = temporaryToken.operator;\n const onChangeOperator = (newOperator: PropertyFilterProps.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 <InternalSpaceBetween size=\"l\">\n <PropertyInput\n propertyKey={propertyKey}\n onChangePropertyKey={onChangePropertyKey}\n asyncProps={asyncProperties ? asyncProps : null}\n filteringProperties={filteringProperties}\n onLoadItems={onLoadItems}\n customGroupsText={customGroupsText}\n i18nStrings={i18nStrings}\n disableFreeTextFiltering={disableFreeTextFiltering}\n />\n\n <OperatorInput\n propertyKey={propertyKey}\n operator={operator}\n onChangeOperator={onChangeOperator}\n filteringProperties={filteringProperties}\n i18nStrings={i18nStrings}\n />\n\n <ValueInput\n propertyKey={propertyKey}\n operator={operator}\n value={value}\n onChangeValue={onChangeValue}\n asyncProps={asyncProps}\n filteringProperties={filteringProperties}\n filteringOptions={filteringOptions}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n />\n </InternalSpaceBetween>\n\n <div className={styles['token-editor-actions']}>\n <InternalButton variant=\"link\" className={styles['token-editor-cancel']} onClick={closePopover}>\n {i18nStrings.cancelActionText}\n </InternalButton>\n <InternalButton\n className={styles['token-editor-submit']}\n onClick={() => {\n setToken(temporaryToken as PropertyFilterProps.Token);\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,q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affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { SelectProps } from '../select/interfaces';\nimport InternalSelect from '../select/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport InternalAutosuggest from '../autosuggest/internal';\nimport InternalPopover, { InternalPopoverRef } from '../popover/internal';\nimport { InternalButton } from '../button/internal';\nimport { useUniqueId } from '../internal/hooks/use-unique-id/index';\n\nimport {\n ComparisonOperator,\n FilteringOption,\n FilteringProperty,\n GroupText,\n I18nStrings,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport styles from './styles.css.js';\nimport { useLoadItems } from './use-load-items';\nimport {\n getAllowedOperators,\n getPropertyOptions,\n getPropertyByKey,\n operatorToDescription,\n getPropertySuggestions,\n} from './controller';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\n\nconst freeTextOperators: ComparisonOperator[] = [':', '!:'];\n\ninterface TokenEditorProps {\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 i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n setToken: (newToken: Token) => void;\n token: Token;\n triggerComponent?: React.ReactNode;\n}\n\ninterface PropertyInputProps {\n asyncProps: null | DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disableFreeTextFiltering?: boolean;\n filteringProperties: readonly FilteringProperty[];\n i18nStrings: I18nStrings;\n onChangePropertyKey: (propertyKey: undefined | string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n propertyKey: undefined | string;\n}\n\nfunction PropertyInput({\n propertyKey,\n onChangePropertyKey,\n asyncProps,\n filteringProperties,\n onLoadItems,\n customGroupsText,\n i18nStrings,\n disableFreeTextFiltering,\n}: PropertyInputProps) {\n const property = propertyKey !== undefined ? getPropertyByKey(filteringProperties, propertyKey) : undefined;\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 ({ propertyLabel, key }) => ({\n value: key,\n label: propertyLabel,\n dontCloseOnSelect: true,\n })\n );\n const allPropertiesOption = {\n label: i18nStrings.allPropertiesLabel,\n value: undefined,\n };\n if (!disableFreeTextFiltering) {\n propertyOptions.unshift(allPropertiesOption);\n }\n const controlId = useUniqueId('property');\n\n return (\n <div className={clsx(styles['token-editor-line'], styles['property-selector'])} key={i18nStrings.propertyText}>\n <label className={styles['token-editor-label']} htmlFor={controlId}>\n {i18nStrings.propertyText}\n </label>\n <div className={styles['token-editor-field']}>\n <InternalSelect\n controlId={controlId}\n options={propertyOptions}\n selectedOption={\n property\n ? {\n value: propertyKey ?? undefined,\n label: property.propertyLabel,\n }\n : allPropertiesOption\n }\n onChange={e => onChangePropertyKey(e.detail.selectedOption.value)}\n {...asyncPropertySelectProps}\n />\n </div>\n </div>\n );\n}\n\ninterface OperatorInputProps {\n filteringProperties: readonly FilteringProperty[];\n i18nStrings: I18nStrings;\n onChangeOperator: (operator: ComparisonOperator) => void;\n operator: undefined | ComparisonOperator;\n propertyKey: undefined | string;\n}\n\nfunction OperatorInput({\n propertyKey,\n operator,\n onChangeOperator,\n filteringProperties,\n i18nStrings,\n}: OperatorInputProps) {\n const property = propertyKey !== undefined ? getPropertyByKey(filteringProperties, propertyKey) : undefined;\n const freeTextOperators: ComparisonOperator[] = [':', '!:'];\n const operatorOptions = (property ? getAllowedOperators(property) : freeTextOperators).map(operator => ({\n value: operator,\n label: operator,\n description: operatorToDescription(operator, i18nStrings),\n }));\n const contorlId = useUniqueId('operator');\n\n return (\n <div className={clsx(styles['token-editor-line'], styles['operator-selector'])} key={i18nStrings.operatorText}>\n <label className={styles['token-editor-label']} htmlFor={contorlId}>\n {i18nStrings.operatorText}\n </label>\n <div className={styles['token-editor-field']}>\n <InternalSelect\n controlId={contorlId}\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 </div>\n </div>\n );\n}\n\ninterface ValueInputProps {\n asyncProps: DropdownStatusProps;\n filteringOptions: readonly FilteringOption[];\n filteringProperties: readonly FilteringProperty[];\n i18nStrings: I18nStrings;\n onChangeValue: (value: string) => void;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operator: undefined | ComparisonOperator;\n propertyKey: undefined | string;\n value: undefined | string;\n}\n\nfunction ValueInput({\n propertyKey,\n operator,\n value,\n onChangeValue,\n asyncProps,\n filteringProperties,\n filteringOptions,\n onLoadItems,\n i18nStrings,\n}: ValueInputProps) {\n const property = propertyKey !== undefined ? getPropertyByKey(filteringProperties, propertyKey) : undefined;\n const valueOptions = property ? getPropertyOptions(property, filteringOptions).map(({ value }) => ({ value })) : [];\n const valueAutosuggestHandlers = useLoadItems(onLoadItems, '', property);\n const asyncValueAutosuggesProps = propertyKey\n ? { ...valueAutosuggestHandlers, ...asyncProps }\n : { empty: asyncProps.empty };\n const controlId = useUniqueId('value');\n\n return (\n <div className={clsx(styles['token-editor-line'], styles['value-selector'])} key={i18nStrings.valueText}>\n <label className={styles['token-editor-label']} htmlFor={controlId}>\n {i18nStrings.valueText}\n </label>\n <div className={styles['token-editor-field']}>\n <InternalAutosuggest\n controlId={controlId}\n enteredTextLabel={i18nStrings.enteredTextLabel}\n value={value ?? ''}\n onChange={e => onChangeValue(e.detail.value)}\n disabled={!operator}\n options={valueOptions}\n {...asyncValueAutosuggesProps}\n virtualScroll={true}\n />\n </div>\n </div>\n );\n}\n\nexport const TokenEditor = ({\n asyncProperties,\n asyncProps,\n customGroupsText,\n disableFreeTextFiltering,\n expandToViewport,\n filteringOptions,\n filteringProperties,\n i18nStrings,\n onLoadItems,\n setToken,\n token,\n triggerComponent,\n}: TokenEditorProps) => {\n const [temporaryToken, setTemporaryToken] = useState<Token>(token);\n const popoverRef = useRef<InternalPopoverRef>(null);\n const closePopover = () => {\n popoverRef.current && popoverRef.current.dismissPopover();\n };\n\n const propertyKey = temporaryToken.propertyKey;\n const onChangePropertyKey = (newPropertyKey: undefined | string) => {\n const filteringProperty = filteringProperties.reduce<FilteringProperty | undefined>(\n (acc, property) => (property.key === newPropertyKey ? property : acc),\n undefined\n );\n const allowedOperators = filteringProperty ? getAllowedOperators(filteringProperty) : freeTextOperators;\n const operator =\n temporaryToken.operator && allowedOperators.indexOf(temporaryToken.operator) !== -1\n ? temporaryToken.operator\n : allowedOperators[0];\n setTemporaryToken({ ...temporaryToken, propertyKey: newPropertyKey, 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 <InternalSpaceBetween size=\"l\">\n <PropertyInput\n propertyKey={propertyKey}\n onChangePropertyKey={onChangePropertyKey}\n asyncProps={asyncProperties ? asyncProps : null}\n filteringProperties={filteringProperties}\n onLoadItems={onLoadItems}\n customGroupsText={customGroupsText}\n i18nStrings={i18nStrings}\n disableFreeTextFiltering={disableFreeTextFiltering}\n />\n\n <OperatorInput\n propertyKey={propertyKey}\n operator={operator}\n onChangeOperator={onChangeOperator}\n filteringProperties={filteringProperties}\n i18nStrings={i18nStrings}\n />\n\n <ValueInput\n propertyKey={propertyKey}\n operator={operator}\n value={value}\n onChangeValue={onChangeValue}\n asyncProps={asyncProps}\n filteringProperties={filteringProperties}\n filteringOptions={filteringOptions}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n />\n </InternalSpaceBetween>\n\n <div className={styles['token-editor-actions']}>\n <InternalButton variant=\"link\" className={styles['token-editor-cancel']} onClick={closePopover}>\n {i18nStrings.cancelActionText}\n </InternalButton>\n <InternalButton\n className={styles['token-editor-submit']}\n onClick={() => {\n setToken(temporaryToken as Token);\n closePopover();\n }}\n >\n {i18nStrings.applyActionText}\n </InternalButton>\n </div>\n </div>\n }\n >\n {triggerComponent}\n </InternalPopover>\n );\n};\n"]}
|
|
@@ -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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M,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC;gBACtC,oBAAC,YAAY,IAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,CAClF,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,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,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAA6B,MAAM,0BAA0B,CAAC;
|
|
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,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAA6B,MAAM,0BAA0B,CAAC;AAK7F;;;;;;GAMG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,UAC1B,WAAwD,EACxD,kBAA2B,EAC3B,wBAA4C,EAC5C,oBAA6B,EAC7B,wBAA6C;IAE7C,IAAM,OAAO,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;IACvC,IAAM,UAAU,GAAG;QACjB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IACzB,CAAC,CAAC;IACF,IAAM,aAAa,GAAG,UAAC,MAAyE;;QAC9F,sBAAsB,CAAC,WAAW,wBAC7B,MAAM,KACT,aAAa,EAAE,MAAA,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,MAAM,CAAC,aAAa,mCAAI,EAAE,EACjE,iBAAiB,EAAE,wBAAwB,EAC3C,iBAAiB,EAAE,wBAAwB,IAC3C,CAAC;QACH,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;IAC1B,CAAC,CAAC;IACF,IAAM,WAAW,GAAG;QAClB,IAAI,OAAO,CAAC,OAAO,EAAE;YACnB,aAAa,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC,CAAC;SACxF;IACH,CAAC,CAAC;IACF,IAAM,eAAe,GAAgE,UAAC,EAAU;YAAR,MAAM,YAAA;QAC5F,OAAA,aAAa,CAAC,MAAM,CAAC;IAArB,CAAqB,CAAC;IACxB,OAAO;QACL,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,WAAW;QACpB,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/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CACpC,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/property-filter/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CACpC,mBAAiD,EACjD,aAAqB;IAErB,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC;IAE5C,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,eAAe,GAA6B,IAAI,CAAC;IAErD,KAAuB,UAAmB,EAAnB,2CAAmB,EAAnB,iCAAmB,EAAnB,IAAmB,EAAE;QAAvC,IAAM,QAAQ,4BAAA;QACjB,IAAI,QAAQ,CAAC,aAAa,CAAC,MAAM,GAAG,SAAS,IAAI,UAAU,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,EAAE;YAChH,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC;YAC1C,eAAe,GAAG,QAAQ,CAAC;SAC5B;KACF;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,aAAa,CAC3B,gBAA+C,EAC/C,aAAqB;IAErB,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC;IAE5C,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,eAAe,GAA8B,IAAI,CAAC;IAEtD,KAAuB,UAAgB,EAAhB,qCAAgB,EAA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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"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentWrapper } from '@cloudscape-design/test-utils-core/dom';
|
|
2
|
+
import { InputWrapper } from '../index.js';
|
|
3
|
+
import DropdownWrapper from './dropdown.js';
|
|
4
|
+
export default class AutosuggestInputWrapper extends ComponentWrapper {
|
|
5
|
+
static rootSelector: string;
|
|
6
|
+
findInput(): InputWrapper;
|
|
7
|
+
findDropdown(): DropdownWrapper;
|
|
8
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
19
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
20
|
+
var dom_1 = require("@cloudscape-design/test-utils-core/dom");
|
|
21
|
+
var styles_selectors_js_1 = require("../../../input/styles.selectors.js");
|
|
22
|
+
var styles_selectors_js_2 = require("../../../internal/components/dropdown/styles.selectors.js");
|
|
23
|
+
var styles_selectors_js_3 = require("../../../internal/components/autosuggest-input/styles.selectors.js");
|
|
24
|
+
var index_js_1 = require("../index.js");
|
|
25
|
+
var dropdown_js_1 = require("./dropdown.js");
|
|
26
|
+
var AutosuggestInputWrapper = /** @class */ (function (_super) {
|
|
27
|
+
__extends(AutosuggestInputWrapper, _super);
|
|
28
|
+
function AutosuggestInputWrapper() {
|
|
29
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
+
}
|
|
31
|
+
AutosuggestInputWrapper.prototype.findInput = function () {
|
|
32
|
+
return this.findComponent(".".concat(styles_selectors_js_1.default['input-container']), index_js_1.InputWrapper);
|
|
33
|
+
};
|
|
34
|
+
AutosuggestInputWrapper.prototype.findDropdown = function () {
|
|
35
|
+
return this.findComponent(".".concat(styles_selectors_js_2.default.root), dropdown_js_1.default);
|
|
36
|
+
};
|
|
37
|
+
AutosuggestInputWrapper.rootSelector = styles_selectors_js_3.default.root;
|
|
38
|
+
return AutosuggestInputWrapper;
|
|
39
|
+
}(dom_1.ComponentWrapper));
|
|
40
|
+
exports.default = AutosuggestInputWrapper;
|
|
41
|
+
//# sourceMappingURL=autosuggest-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autosuggest-input.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/internal/autosuggest-input.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,8DAA0E;AAC1E,0EAA6D;AAC7D,iGAAuF;AACvF,0GAAwF;AACxF,wCAA2C;AAC3C,6CAA4C;AAE5C;IAAqD,2CAAgB;IAArE;;IAUA,CAAC;IAPC,2CAAS,GAAT;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,WAAI,6BAAW,CAAC,iBAAiB,CAAC,CAAE,EAAE,uBAAY,CAAE,CAAC;IACjF,CAAC;IAED,8CAAY,GAAZ;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,WAAI,6BAAc,CAAC,IAAI,CAAE,EAAE,qBAAe,CAAE,CAAC;IACzE,CAAC;IARM,oCAAY,GAAG,6BAAM,CAAC,IAAI,CAAC;IASpC,8BAAC;CAAA,AAVD,CAAqD,sBAAgB,GAUpE;kBAVoB,uBAAuB"}
|