@cloudscape-design/components 3.0.129 → 3.0.131

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.
@@ -1,5 +1,5 @@
1
1
 
2
- export var PACKAGE_VERSION = '3.0.0 (707ed43)';
2
+ export var PACKAGE_VERSION = '3.0.0 (59a1797)';
3
3
  export var THEME = 'open-source-visual-refresh';
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
5
5
 
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "707ed43e0765d33d02f644d07a5c2fa3515c3368"
2
+ "commit": "59a17971fb3a9644335f446c5fadf5d97f62e95e"
3
3
  }
package/package.json CHANGED
@@ -112,6 +112,6 @@
112
112
  "./internal/base-component/index.js",
113
113
  "./internal/base-component/styles.css.js"
114
114
  ],
115
- "version": "3.0.129",
115
+ "version": "3.0.131",
116
116
  "license": "Apache-2.0"
117
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pie-chart/index.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAS7C,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,QAAA,MAAM,QAAQ,yaA4Kb,CAAC;AAGF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pie-chart/index.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAS7C,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,QAAA,MAAM,QAAQ,yaAyKb,CAAC;AAGF,eAAe,QAAQ,CAAC"}
@@ -65,13 +65,10 @@ var PieChart = function PieChart(_a) {
65
65
  });
66
66
  }, [setVisibleSegments, onFilterChange]);
67
67
  var onHighlightChange = useCallback(function (segment) {
68
- if (pinnedSegment !== null) {
69
- return;
70
- }
71
68
  setLegendSegment(segment);
72
69
  setHighlightedSegment(segment);
73
70
  fireNonCancelableEvent(controlledOnHighlightChange, { highlightedSegment: segment });
74
- }, [pinnedSegment, controlledOnHighlightChange, setHighlightedSegment]);
71
+ }, [controlledOnHighlightChange, setHighlightedSegment]);
75
72
  var onBlur = function (event) {
76
73
  if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {
77
74
  highlightedSegment && onHighlightChange(null);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pie-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,MAA4B,MAAM,qCAAqC,CAAC;AAC/E,OAAO,MAA4B,MAAM,qCAAqC,CAAC;AAC/E,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,gBAAwC,MAAM,aAAa,CAAC;AAEnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,wBAAwB,MAAM,+CAA+C,CAAC;AACrF,OAAO,iBAAiB,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD,IAAM,QAAQ,GAAG,SAAS,QAAQ,CAAsD,EAkBrE;;IAjBj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,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,iBAAiB,IACpC;QAED,CAAC,UAAU,IAAI,CAAC,OAAO,IAAI,UAAU,KAAK,UAAU,IAAI,CACvD,oBAAC,WAAW,IAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;YAC/B,oBAAC,MAAM,IACL,MAAM,EAAE,WAAW,EACnB,iBAAiB,EAAE,aAAa,EAChC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,EACvC,iBAAiB,EAAE,iBAAiB,EACpC,gBAAgB,EAAE,YAAY,GAC9B,CACU,CACf,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACvC,eAAe,QAAQ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport Legend, { ChartLegendProps } from '../internal/components/chart-legend';\nimport Filter, { ChartFilterProps } from '../internal/components/chart-filter';\nimport InternalSpaceBetween from '../space-between/internal';\nimport InternalBox from '../box/internal';\n\nimport InternalPieChart, { InternalChartDatum } from './pie-chart';\nimport { PieChartProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport createCategoryColorScale from '../internal/utils/create-category-color-scale';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { nodeContains } from '../internal/utils/dom';\n\nexport { PieChartProps };\n\nconst PieChart = function PieChart<T extends PieChartProps.Datum = PieChartProps.Datum>({\n variant = 'pie',\n size = 'medium',\n hideTitles = false,\n hideDescriptions = false,\n hideLegend = false,\n hideFilter = false,\n statusType = 'finished',\n data: externalData = [],\n i18nStrings = {},\n highlightedSegment: controlledHighlightedSegment,\n visibleSegments: controlledVisibleSegments,\n onHighlightChange: controlledOnHighlightChange,\n onFilterChange,\n additionalFilters,\n legendTitle,\n detailPopoverSize = 'medium',\n ...props\n}: PieChartProps<T>) {\n const { __internalRootRef = null } = useBaseComponent('PieChart');\n const baseProps = getBaseProps(props);\n const isEmpty = !externalData || externalData.length === 0;\n const containerAttr = {\n ...baseProps,\n className: clsx(baseProps.className, styles.root),\n };\n const containerRef = useRef<HTMLDivElement>(null);\n const [containerWidth, measureRef] = useContainerWidth();\n\n const data: ReadonlyArray<InternalChartDatum<T>> = useMemo(() => {\n const colors = createCategoryColorScale(externalData, undefined, it => it.color || null);\n\n return externalData.map((datum, i) => ({\n index: i,\n color: colors[i],\n datum,\n }));\n }, [externalData]);\n\n const [highlightedSegment = null, setHighlightedSegment] = useControllable(\n controlledHighlightedSegment,\n controlledOnHighlightChange,\n null,\n {\n componentName: 'PieChart',\n controlledProp: 'highlightedSegment',\n changeHandler: 'onHighlightChange',\n }\n );\n const [legendSegment, setLegendSegment] = useState<null | T>(highlightedSegment);\n useEffect(() => {\n setLegendSegment(controlledHighlightedSegment || null);\n }, [controlledHighlightedSegment]);\n\n const [visibleSegments, setVisibleSegments] = useControllable(\n controlledVisibleSegments,\n onFilterChange,\n externalData,\n {\n componentName: 'PieChart',\n controlledProp: 'visibleSegments',\n changeHandler: 'onFilterChange',\n }\n );\n\n const [pinnedSegment, setPinnedSegment] = useState<T | null>(null);\n\n const visibleData = useMemo(\n () => data.filter(d => visibleSegments?.indexOf(d.datum) !== -1),\n [data, visibleSegments]\n );\n\n const filterItems: ChartFilterProps<T>['series'] = data?.map(data => ({\n label: data.datum.title,\n color: data.color,\n type: 'rectangle',\n datum: data.datum,\n }));\n\n const legendItems: ChartLegendProps<T>['series'] = filterItems.filter(d => visibleSegments?.indexOf(d.datum) !== -1);\n\n const filterChange = useCallback(\n (selectedSeries: ReadonlyArray<T>) => {\n setVisibleSegments(selectedSeries);\n fireNonCancelableEvent(onFilterChange, {\n visibleSegments: selectedSeries,\n });\n },\n [setVisibleSegments, onFilterChange]\n );\n\n const onHighlightChange = useCallback(\n (segment: T | null) => {\n if (pinnedSegment !== null) {\n return;\n }\n setLegendSegment(segment);\n setHighlightedSegment(segment);\n fireNonCancelableEvent(controlledOnHighlightChange, { highlightedSegment: segment });\n },\n [pinnedSegment, controlledOnHighlightChange, setHighlightedSegment]\n );\n\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {\n highlightedSegment && onHighlightChange(null);\n setLegendSegment(null);\n }\n };\n\n const mergedRef = useMergeRefs(containerRef, measureRef, __internalRootRef);\n\n return (\n <div {...containerAttr} ref={mergedRef} onBlur={onBlur}>\n {statusType === 'finished' && !isEmpty && (\n <InternalBox className={styles['filter-container']} margin={{ bottom: 'l' }}>\n <InternalSpaceBetween\n size=\"l\"\n direction=\"horizontal\"\n className={clsx({\n [styles['has-default-filter']]: !hideFilter,\n })}\n >\n {!hideFilter && (\n <Filter\n series={filterItems}\n onChange={filterChange}\n selectedSeries={visibleSegments}\n i18nStrings={i18nStrings}\n />\n )}\n {additionalFilters}\n </InternalSpaceBetween>\n </InternalBox>\n )}\n\n <InternalPieChart\n {...props}\n variant={variant}\n size={size}\n data={externalData}\n visibleData={visibleData}\n width={containerWidth}\n statusType={statusType}\n hideTitles={hideTitles}\n hideDescriptions={hideDescriptions}\n hideLegend={hideLegend}\n hideFilter={hideFilter}\n additionalFilters={additionalFilters}\n i18nStrings={i18nStrings}\n onHighlightChange={onHighlightChange}\n highlightedSegment={highlightedSegment}\n legendSegment={legendSegment}\n pinnedSegment={pinnedSegment}\n setPinnedSegment={setPinnedSegment}\n detailPopoverSize={detailPopoverSize}\n />\n\n {!hideLegend && !isEmpty && statusType === 'finished' && (\n <InternalBox margin={{ top: 'm' }}>\n <Legend<T>\n series={legendItems}\n highlightedSeries={legendSegment}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings?.legendAriaLabel}\n onHighlightChange={onHighlightChange}\n plotContainerRef={containerRef}\n />\n </InternalBox>\n )}\n </div>\n );\n};\n\napplyDisplayName(PieChart, 'PieChart');\nexport default PieChart;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pie-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,MAA4B,MAAM,qCAAqC,CAAC;AAC/E,OAAO,MAA4B,MAAM,qCAAqC,CAAC;AAC/E,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,gBAAwC,MAAM,aAAa,CAAC;AAEnE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,wBAAwB,MAAM,+CAA+C,CAAC;AACrF,OAAO,iBAAiB,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD,IAAM,QAAQ,GAAG,SA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,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,iBAAiB,IACpC;QAED,CAAC,UAAU,IAAI,CAAC,OAAO,IAAI,UAAU,KAAK,UAAU,IAAI,CACvD,oBAAC,WAAW,IAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;YAC/B,oBAAC,MAAM,IACL,MAAM,EAAE,WAAW,EACnB,iBAAiB,EAAE,aAAa,EAChC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,EACvC,iBAAiB,EAAE,iBAAiB,EACpC,gBAAgB,EAAE,YAAY,GAC9B,CACU,CACf,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACvC,eAAe,QAAQ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport Legend, { ChartLegendProps } from '../internal/components/chart-legend';\nimport Filter, { ChartFilterProps } from '../internal/components/chart-filter';\nimport InternalSpaceBetween from '../space-between/internal';\nimport InternalBox from '../box/internal';\n\nimport InternalPieChart, { InternalChartDatum } from './pie-chart';\nimport { PieChartProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport createCategoryColorScale from '../internal/utils/create-category-color-scale';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { nodeContains } from '../internal/utils/dom';\n\nexport { PieChartProps };\n\nconst PieChart = function PieChart<T extends PieChartProps.Datum = PieChartProps.Datum>({\n variant = 'pie',\n size = 'medium',\n hideTitles = false,\n hideDescriptions = false,\n hideLegend = false,\n hideFilter = false,\n statusType = 'finished',\n data: externalData = [],\n i18nStrings = {},\n highlightedSegment: controlledHighlightedSegment,\n visibleSegments: controlledVisibleSegments,\n onHighlightChange: controlledOnHighlightChange,\n onFilterChange,\n additionalFilters,\n legendTitle,\n detailPopoverSize = 'medium',\n ...props\n}: PieChartProps<T>) {\n const { __internalRootRef = null } = useBaseComponent('PieChart');\n const baseProps = getBaseProps(props);\n const isEmpty = !externalData || externalData.length === 0;\n const containerAttr = {\n ...baseProps,\n className: clsx(baseProps.className, styles.root),\n };\n const containerRef = useRef<HTMLDivElement>(null);\n const [containerWidth, measureRef] = useContainerWidth();\n\n const data: ReadonlyArray<InternalChartDatum<T>> = useMemo(() => {\n const colors = createCategoryColorScale(externalData, undefined, it => it.color || null);\n\n return externalData.map((datum, i) => ({\n index: i,\n color: colors[i],\n datum,\n }));\n }, [externalData]);\n\n const [highlightedSegment = null, setHighlightedSegment] = useControllable(\n controlledHighlightedSegment,\n controlledOnHighlightChange,\n null,\n {\n componentName: 'PieChart',\n controlledProp: 'highlightedSegment',\n changeHandler: 'onHighlightChange',\n }\n );\n const [legendSegment, setLegendSegment] = useState<null | T>(highlightedSegment);\n useEffect(() => {\n setLegendSegment(controlledHighlightedSegment || null);\n }, [controlledHighlightedSegment]);\n\n const [visibleSegments, setVisibleSegments] = useControllable(\n controlledVisibleSegments,\n onFilterChange,\n externalData,\n {\n componentName: 'PieChart',\n controlledProp: 'visibleSegments',\n changeHandler: 'onFilterChange',\n }\n );\n\n const [pinnedSegment, setPinnedSegment] = useState<T | null>(null);\n\n const visibleData = useMemo(\n () => data.filter(d => visibleSegments?.indexOf(d.datum) !== -1),\n [data, visibleSegments]\n );\n\n const filterItems: ChartFilterProps<T>['series'] = data?.map(data => ({\n label: data.datum.title,\n color: data.color,\n type: 'rectangle',\n datum: data.datum,\n }));\n\n const legendItems: ChartLegendProps<T>['series'] = filterItems.filter(d => visibleSegments?.indexOf(d.datum) !== -1);\n\n const filterChange = useCallback(\n (selectedSeries: ReadonlyArray<T>) => {\n setVisibleSegments(selectedSeries);\n fireNonCancelableEvent(onFilterChange, {\n visibleSegments: selectedSeries,\n });\n },\n [setVisibleSegments, onFilterChange]\n );\n\n const onHighlightChange = useCallback(\n (segment: T | null) => {\n setLegendSegment(segment);\n setHighlightedSegment(segment);\n fireNonCancelableEvent(controlledOnHighlightChange, { highlightedSegment: segment });\n },\n [controlledOnHighlightChange, setHighlightedSegment]\n );\n\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {\n highlightedSegment && onHighlightChange(null);\n setLegendSegment(null);\n }\n };\n\n const mergedRef = useMergeRefs(containerRef, measureRef, __internalRootRef);\n\n return (\n <div {...containerAttr} ref={mergedRef} onBlur={onBlur}>\n {statusType === 'finished' && !isEmpty && (\n <InternalBox className={styles['filter-container']} margin={{ bottom: 'l' }}>\n <InternalSpaceBetween\n size=\"l\"\n direction=\"horizontal\"\n className={clsx({\n [styles['has-default-filter']]: !hideFilter,\n })}\n >\n {!hideFilter && (\n <Filter\n series={filterItems}\n onChange={filterChange}\n selectedSeries={visibleSegments}\n i18nStrings={i18nStrings}\n />\n )}\n {additionalFilters}\n </InternalSpaceBetween>\n </InternalBox>\n )}\n\n <InternalPieChart\n {...props}\n variant={variant}\n size={size}\n data={externalData}\n visibleData={visibleData}\n width={containerWidth}\n statusType={statusType}\n hideTitles={hideTitles}\n hideDescriptions={hideDescriptions}\n hideLegend={hideLegend}\n hideFilter={hideFilter}\n additionalFilters={additionalFilters}\n i18nStrings={i18nStrings}\n onHighlightChange={onHighlightChange}\n highlightedSegment={highlightedSegment}\n legendSegment={legendSegment}\n pinnedSegment={pinnedSegment}\n setPinnedSegment={setPinnedSegment}\n detailPopoverSize={detailPopoverSize}\n />\n\n {!hideLegend && !isEmpty && statusType === 'finished' && (\n <InternalBox margin={{ top: 'm' }}>\n <Legend<T>\n series={legendItems}\n highlightedSeries={legendSegment}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings?.legendAriaLabel}\n onHighlightChange={onHighlightChange}\n plotContainerRef={containerRef}\n />\n </InternalBox>\n )}\n </div>\n );\n};\n\napplyDisplayName(PieChart, 'PieChart');\nexport default PieChart;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAElB,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,aAAa,EACb,UAAU,EACV,KAAK,EACL,KAAK,EACN,MAAM,cAAc,CAAC;AACtB,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAGvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,eAAO,MAAM,eAAe,UACnB,KAAK,YACF,0BAA0B,KAAK,CAAC,YAChC,MAAM,SAAS,CAAC,mBAAmB,CAAC;sBAKrB,MAAM,YAAY,KAAK;yBAOpB,MAAM;;yBASN,KAAK;iCAKG,aAAa;CAUlD,CAAC;AAEF,eAAO,MAAM,mBAAmB,aAAc,iBAAiB,KAAG,kBAAkB,EAQnF,CAAC;AAQF,eAAO,MAAM,SAAS,kBACL,MAAM,sIAEK,OAAO,KAChC,UA6CF,CAAC;AAEF,eAAO,MAAM,kBAAkB,sBACV,iBAAiB,oBAClB,SAAS,eAAe,EAAE,yEAG7C,CAAC;AAEF,UAAU,WAAW,CAAC,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,EAAE,CAAC;CACd;AAED,eAAO,MAAM,sBAAsB,qBACf,SAAS,eAAe,EAAE,uBACvB,SAAS,iBAAiB,EAAE,YACvC,kBAAkB,GAAG,SAAS,eAC3B,WAAW,oBACN,SAAS,SAAS,EAAE,uFAmCvC,CAAC;AAEF,eAAO,MAAM,gBAAgB,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AO,MAAM,qBAAqB,aAAc,kBAAkB,eAAe,WAAW,WAY3F,CAAC"}
@@ -79,16 +79,12 @@ export var parseText = function (filteringText, filteringProperties, disableFree
79
79
  if (operator) {
80
80
  var operatorLastIndex = textWithoutProperty.indexOf(operator) + operator.length;
81
81
  var textWithoutPropertyAndOperator = textWithoutProperty.slice(operatorLastIndex);
82
- return {
83
- step: 'property',
84
- property: property,
85
- operator: operator,
86
- // We need to remove the first leading space in case the user presses space
87
- // after the operator, for example: Owner: admin, will result in value of ` admin`
88
- // and we need to remove the first space, if the user added any more spaces only the
89
- // first one will be removed.
90
- value: trimFirstSpace(textWithoutPropertyAndOperator)
91
- };
82
+ // We need to remove the first leading space in case the user presses space
83
+ // after the operator, for example: Owner: admin, will result in value of ` admin`
84
+ // and we need to remove the first space, if the user added any more spaces only the
85
+ // first one will be removed.
86
+ var value = trimFirstSpace(textWithoutPropertyAndOperator);
87
+ return { step: 'property', property: property, operator: operator, value: value };
92
88
  }
93
89
  var operatorPrefix = matchOperatorPrefix(allowedOps, trimStart(textWithoutProperty));
94
90
  if (operatorPrefix !== null) {
@@ -110,6 +106,7 @@ export var getAllValueSuggestions = function (filteringOptions, filteringPropert
110
106
  };
111
107
  var customGroups = {};
112
108
  filteringOptions.forEach(function (filteringOption) {
109
+ var _a;
113
110
  var property = getPropertyByKey(filteringProperties, filteringOption.propertyKey);
114
111
  // given option refers to a non-existent filtering property
115
112
  if (!property) {
@@ -129,7 +126,7 @@ export var getAllValueSuggestions = function (filteringOptions, filteringPropert
129
126
  var propertyGroup = property.group ? customGroups[property.group] : defaultGroup;
130
127
  propertyGroup.options.push({
131
128
  value: property.propertyLabel + ' ' + (operator || '=') + ' ' + filteringOption.value,
132
- label: filteringOption.value,
129
+ label: (_a = filteringOption.label) !== null && _a !== void 0 ? _a : filteringOption.value,
133
130
  __labelPrefix: property.propertyLabel + ' ' + (operator || '=')
134
131
  });
135
132
  });
@@ -216,10 +213,10 @@ export var getAutosuggestOptions = function (parsedText, filteringOptions, filte
216
213
  options: [
217
214
  {
218
215
  options: options.map(function (_a) {
219
- var value = _a.value;
216
+ var label = _a.label, value = _a.value;
220
217
  return ({
221
218
  value: propertyLabel_1 + ' ' + parsedText.operator + ' ' + value,
222
- label: value,
219
+ label: label !== null && label !== void 0 ? label : value,
223
220
  __labelPrefix: propertyLabel_1 + ' ' + parsedText.operator
224
221
  });
225
222
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AActC,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB,CAAC;AAEvF,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGhH,MAAM,CAAC,IAAM,eAAe,GAAG,UAC7B,KAAY,EACZ,QAA0C,EAC1C,QAA8C;IAEtC,IAAA,MAAM,GAAgB,KAAK,OAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;IACpC,IAAM,YAAY,GAAG,UAAC,MAAwB,EAAE,SAAwB;QACtE,OAAA,sBAAsB,CAAC,QAAQ,EAAE,EAAE,MAAM,QAAA,EAAE,SAAS,WAAA,EAAE,CAAC;IAAvD,CAAuD,CAAC;IAC1D,IAAM,QAAQ,GAAG,UAAC,KAAa,EAAE,QAAe;QAC9C,IAAM,SAAS,qBAAO,MAAM,OAAC,CAAC;QAC9B,IAAI,SAAS,IAAI,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE;YACzC,SAAS,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;SAC7B;QACD,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC,CAAC;IACF,IAAM,WAAW,GAAG,UAAC,KAAa;;QAChC,IAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,C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QACD,KAAK,WAAW,CAAC,CAAC;YAChB,IAAM,qBAAqB,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;YACjD,IAAM,wBAAwB,GAAG,CAAC,CAAC,UAAU,CAAC,IAAI,KAAK,WAAW,IAAI,UAAU,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;YACpG,OAAO;gBACL,UAAU,EAAE,UAAU,CAAC,KAAK;gBAC5B,OAAO,kCACF,CAAC,wBAAwB;oBAC1B,CAAC,CAAC,sBAAsB,CACpB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,oCAAoC,CACrC;oBACH,CAAC,CAAC,EAAE,CAAC,SACJ,CAAC,qBAAqB;oBACvB,CAAC,CAAC,sBAAsB,CACpB,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,CAAC,QAAQ,EACnB,WAAW,EACX,gBAAgB,CACjB;oBACH,CAAC,CAAC,EAAE,CAAC,OACR;aACF,CAAC;SACH;KACF;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,qBAAqB,GAAG,UAAC,QAA4B,EAAE,WAAwB;;IAC1F,IAAM,OAAO;QACX,GAAC,GAAG,IAAG,WAAW,CAAC,gBAAgB;QACnC,GAAC,IAAI,IAAG,WAAW,CAAC,uBAAuB;QAC3C,GAAC,GAAG,IAAG,WAAW,CAAC,mBAAmB;QACtC,GAAC,IAAI,IAAG,WAAW,CAAC,0BAA0B;QAC9C,GAAC,GAAG,IAAG,WAAW,CAAC,oBAAoB;QACvC,GAAC,IAAI,IAAG,WAAW,CAAC,0BAA0B;QAC9C,GAAC,GAAG,IAAG,WAAW,CAAC,kBAAkB;QACrC,GAAC,IAAI,IAAG,WAAW,CAAC,wBAAwB;WAC7C,CAAC;IACF,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ComparisonOperator,\n ExtendedOperatorForm,\n FilteringOption,\n FilteringProperty,\n GroupText,\n I18nStrings,\n JoinOperation,\n ParsedText,\n Query,\n Token,\n} from './interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { matchFilteringProperty, matchOperator, matchOperatorPrefix, trimFirstSpace, trimStart } from './utils';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\n\nexport const getQueryActions = (\n query: Query,\n onChange: NonCancelableEventHandler<Query>,\n inputRef: React.RefObject<AutosuggestInputRef>\n) => {\n const { tokens, operation } = query;\n const fireOnChange = (tokens: readonly Token[], operation: JoinOperation) =>\n fireNonCancelableEvent(onChange, { tokens, operation });\n const setToken = (index: number, newToken: Token) => {\n const newTokens = [...tokens];\n if (newTokens && index < newTokens.length) {\n newTokens[index] = newToken;\n }\n fireOnChange(newTokens, operation);\n };\n const removeToken = (index: number) => {\n const newTokens = tokens.filter((_, i) => i !== index);\n fireOnChange(newTokens, operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const removeAllTokens = () => {\n fireOnChange([], operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const addToken = (newToken: Token) => {\n const newTokens = [...tokens];\n newTokens.push(newToken);\n fireOnChange(newTokens, operation);\n };\n const setOperation = (newOperation: JoinOperation) => {\n fireOnChange(tokens, newOperation);\n };\n return {\n setToken,\n removeToken,\n removeAllTokens,\n addToken,\n setOperation,\n };\n};\n\nexport const getAllowedOperators = (property: FilteringProperty): ComparisonOperator[] => {\n const { operators = [], defaultOperator } = property;\n const operatorOrder = ['=', '!=', ':', '!:', '>=', '<=', '<', '>'] as const;\n const operatorSet = new Set([\n defaultOperator ?? '=',\n ...operators.map(op => (typeof op === 'string' ? op : op.operator)),\n ]);\n return operatorOrder.filter(op => operatorSet.has(op));\n};\n\n/*\n * parses the value of the filtering input to figure out the current step of entering the token:\n * - \"property\": means that a filter on a particular column is being added, with operator already finalized\n * - \"operator\": means that a filter on a particular column is being added, with operator not yet finalized\n * - \"free-text\": means that a \"free text\" token is being added\n */\nexport const parseText = (\n filteringText: string,\n filteringProperties: readonly FilteringProperty[] = [],\n disableFreeTextFiltering: boolean\n): ParsedText => {\n const negatedGlobalQuery = /^(!:|!)(.*)/.exec(filteringText);\n if (!disableFreeTextFiltering && negatedGlobalQuery) {\n return {\n step: 'free-text',\n operator: '!:',\n value: negatedGlobalQuery[2],\n };\n }\n\n const property = matchFilteringProperty(filteringProperties, filteringText);\n if (!property) {\n return {\n step: 'free-text',\n value: filteringText,\n };\n }\n\n const allowedOps = getAllowedOperators(property);\n const textWithoutProperty = filteringText.substring(property.propertyLabel.length);\n const operator = matchOperator(allowedOps, trimStart(textWithoutProperty));\n if (operator) {\n const operatorLastIndex = textWithoutProperty.indexOf(operator) + operator.length;\n const textWithoutPropertyAndOperator = textWithoutProperty.slice(operatorLastIndex);\n return {\n step: 'property',\n property,\n operator,\n // We need to remove the first leading space in case the user presses space\n // after the operator, for example: Owner: admin, will result in value of ` admin`\n // and we need to remove the first space, if the user added any more spaces only the\n // first one will be removed.\n value: trimFirstSpace(textWithoutPropertyAndOperator),\n };\n }\n\n const operatorPrefix = matchOperatorPrefix(allowedOps, trimStart(textWithoutProperty));\n if (operatorPrefix !== null) {\n return { step: 'operator', property, operatorPrefix };\n }\n\n return {\n step: 'free-text',\n value: filteringText,\n };\n};\n\nexport const getPropertyOptions = (\n filteringProperty: FilteringProperty,\n filteringOptions: readonly FilteringOption[]\n) => {\n return filteringOptions.filter(option => option.propertyKey === filteringProperty.key);\n};\n\ninterface OptionGroup<T> {\n label: string;\n options: T[];\n}\n\nexport const getAllValueSuggestions = (\n filteringOptions: readonly FilteringOption[],\n filteringProperties: readonly FilteringProperty[],\n operator: ComparisonOperator | undefined = '=',\n i18nStrings: I18nStrings,\n customGroupsText: readonly GroupText[]\n) => {\n const defaultGroup: OptionGroup<AutosuggestProps.Option> = {\n label: i18nStrings.groupValuesText,\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<AutosuggestProps.Option> } = {};\n filteringOptions.forEach(filteringOption => {\n const property = getPropertyByKey(filteringProperties, filteringOption.propertyKey);\n // given option refers to a non-existent filtering property\n if (!property) {\n return;\n }\n // this option's filtering property does not support current operator\n if (getAllowedOperators(property).indexOf(operator) === -1) {\n return;\n }\n if (property.group && !customGroups[property.group]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === property.group ? customGroup.values : acc),\n ''\n );\n customGroups[property.group] = {\n label,\n options: [],\n };\n }\n const propertyGroup = property.group ? customGroups[property.group] : defaultGroup;\n propertyGroup.options.push({\n value: property.propertyLabel + ' ' + (operator || '=') + ' ' + filteringOption.value,\n label: filteringOption.value,\n __labelPrefix: property.propertyLabel + ' ' + (operator || '='),\n });\n });\n return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];\n};\n\nexport const getPropertyByKey = (filteringProperties: readonly FilteringProperty[], key: string) => {\n const propertyMap = filteringProperties.reduce<{ [K: string]: FilteringProperty }>((acc, property) => {\n acc[property.key] = property;\n return acc;\n }, {});\n return propertyMap[key] as FilteringProperty | undefined;\n};\n\nexport function getExtendedOperator(\n filteringProperties: readonly FilteringProperty[],\n property: string,\n operator: ComparisonOperator\n) {\n const matchedProperty = getPropertyByKey(filteringProperties, property);\n for (const matchedOperator of matchedProperty?.operators || []) {\n if (typeof matchedOperator === 'object' && matchedOperator.operator === operator) {\n return matchedOperator;\n }\n }\n return null;\n}\n\nexport function createPropertiesCompatibilityMap(\n filteringProperties: readonly FilteringProperty[]\n): (propertyA: string, propertyB: string) => boolean {\n const lookup: {\n [propertyKey: string]: { operator: string; form: ExtendedOperatorForm<any> | undefined }[];\n } = {};\n\n for (const property of filteringProperties) {\n lookup[property.key] = (property.operators || [])\n .map(operator =>\n typeof operator === 'object'\n ? { operator: operator.operator, form: operator.form }\n : { operator, form: undefined }\n )\n .sort((a, b) => a.operator.localeCompare(b.operator));\n }\n\n return (propertyA: string, propertyB: string) => {\n if (lookup[propertyA].length !== lookup[propertyB].length) {\n return false;\n }\n for (let i = 0; i < lookup[propertyA].length; i++) {\n if (lookup[propertyA][i].operator !== lookup[propertyB][i].operator) {\n return false;\n }\n if (lookup[propertyA][i].form !== lookup[propertyB][i].form) {\n return false;\n }\n }\n return true;\n };\n}\n\nconst filteringPropertyToAutosuggestOption = (filteringProperty: FilteringProperty) => ({\n value: filteringProperty.propertyLabel,\n label: filteringProperty.propertyLabel,\n keepOpenOnSelect: true,\n});\n\nexport function getPropertySuggestions<T>(\n filteringProperties: readonly FilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings,\n filteringPropertyToOption: (filteringProperty: FilteringProperty) => T\n) {\n const defaultGroup: OptionGroup<T> = {\n label: i18nStrings.groupPropertiesText,\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<T> } = {};\n\n filteringProperties.forEach(filteringProperty => {\n const { group } = filteringProperty;\n let optionsGroup = defaultGroup;\n if (group) {\n if (!customGroups[group]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === group ? customGroup.properties : acc),\n ''\n );\n customGroups[group] = { options: [], label };\n }\n optionsGroup = customGroups[group];\n }\n optionsGroup.options.push(filteringPropertyToOption(filteringProperty));\n });\n const defaultGroupArray = defaultGroup.options.length ? [defaultGroup] : [];\n const customGroupsArray = Object.keys(customGroups).map(groupKey => customGroups[groupKey]);\n return [...defaultGroupArray, ...customGroupsArray];\n}\n\nexport const getAutosuggestOptions = (\n parsedText: ParsedText,\n filteringOptions: readonly FilteringOption[],\n filteringProperties: readonly FilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings\n) => {\n switch (parsedText.step) {\n case 'property': {\n const { propertyLabel, groupValuesLabel } = parsedText.property;\n const options = getPropertyOptions(parsedText.property, filteringOptions);\n return {\n filterText: parsedText.value,\n options: [\n {\n options: options.map(({ value }) => ({\n value: propertyLabel + ' ' + parsedText.operator + ' ' + value,\n label: value,\n __labelPrefix: propertyLabel + ' ' + parsedText.operator,\n })),\n label: groupValuesLabel,\n },\n ],\n };\n }\n case 'operator': {\n return {\n filterText: parsedText.property.propertyLabel + ' ' + parsedText.operatorPrefix,\n options: [\n ...getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n ),\n {\n options: getAllowedOperators(parsedText.property).map(value => ({\n value: parsedText.property.propertyLabel + ' ' + value + ' ',\n label: parsedText.property.propertyLabel + ' ' + value,\n description: operatorToDescription(value, i18nStrings),\n keepOpenOnSelect: true,\n })),\n label: i18nStrings.operatorsText,\n },\n ],\n };\n }\n case 'free-text': {\n const needsValueSuggestions = !!parsedText.value;\n const needsPropertySuggestions = !(parsedText.step === 'free-text' && parsedText.operator === '!:');\n return {\n filterText: parsedText.value,\n options: [\n ...(needsPropertySuggestions\n ? getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n )\n : []),\n ...(needsValueSuggestions\n ? getAllValueSuggestions(\n filteringOptions,\n filteringProperties,\n parsedText.operator,\n i18nStrings,\n customGroupsText\n )\n : []),\n ],\n };\n }\n }\n};\n\nexport const operatorToDescription = (operator: ComparisonOperator, i18nStrings: I18nStrings) => {\n const mapping: { [K in ComparisonOperator]: string } = {\n ['<']: i18nStrings.operatorLessText,\n ['<=']: i18nStrings.operatorLessOrEqualText,\n ['>']: i18nStrings.operatorGreaterText,\n ['>=']: i18nStrings.operatorGreaterOrEqualText,\n [':']: i18nStrings.operatorContainsText,\n ['!:']: i18nStrings.operatorDoesNotContainText,\n ['=']: i18nStrings.operatorEqualsText,\n ['!=']: i18nStrings.operatorDoesNotEqualText,\n };\n return mapping[operator];\n};\n"]}
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AActC,OAAO,EAAE,sBAAsB,EAA6B,MAAM,oBAAoB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AwB;oBAC1B,CAAC,CAAC,sBAAsB,CACpB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,oCAAoC,CACrC;oBACH,CAAC,CAAC,EAAE,CAAC,SACJ,CAAC,qBAAqB;oBACvB,CAAC,CAAC,sBAAsB,CACpB,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,CAAC,QAAQ,EACnB,WAAW,EACX,gBAAgB,CACjB;oBACH,CAAC,CAAC,EAAE,CAAC,OACR;aACF,CAAC;SACH;KACF;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,qBAAqB,GAAG,UAAC,QAA4B,EAAE,WAAwB;;IAC1F,IAAM,OAAO;QACX,GAAC,GAAG,IAAG,WAAW,CAAC,gBAAgB;QACnC,GAAC,IAAI,IAAG,WAAW,CAAC,uBAAuB;QAC3C,GAAC,GAAG,IAAG,WAAW,CAAC,mBAAmB;QACtC,GAAC,IAAI,IAAG,WAAW,CAAC,0BAA0B;QAC9C,GAAC,GAAG,IAAG,WAAW,CAAC,oBAAoB;QACvC,GAAC,IAAI,IAAG,WAAW,CAAC,0BAA0B;QAC9C,GAAC,GAAG,IAAG,WAAW,CAAC,kBAAkB;QACrC,GAAC,IAAI,IAAG,WAAW,CAAC,wBAAwB;WAC7C,CAAC;IACF,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ComparisonOperator,\n ExtendedOperatorForm,\n FilteringOption,\n FilteringProperty,\n GroupText,\n I18nStrings,\n JoinOperation,\n ParsedText,\n Query,\n Token,\n} from './interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { matchFilteringProperty, matchOperator, matchOperatorPrefix, trimFirstSpace, trimStart } from './utils';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\n\nexport const getQueryActions = (\n query: Query,\n onChange: NonCancelableEventHandler<Query>,\n inputRef: React.RefObject<AutosuggestInputRef>\n) => {\n const { tokens, operation } = query;\n const fireOnChange = (tokens: readonly Token[], operation: JoinOperation) =>\n fireNonCancelableEvent(onChange, { tokens, operation });\n const setToken = (index: number, newToken: Token) => {\n const newTokens = [...tokens];\n if (newTokens && index < newTokens.length) {\n newTokens[index] = newToken;\n }\n fireOnChange(newTokens, operation);\n };\n const removeToken = (index: number) => {\n const newTokens = tokens.filter((_, i) => i !== index);\n fireOnChange(newTokens, operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const removeAllTokens = () => {\n fireOnChange([], operation);\n inputRef.current?.focus({ preventDropdown: true });\n };\n const addToken = (newToken: Token) => {\n const newTokens = [...tokens];\n newTokens.push(newToken);\n fireOnChange(newTokens, operation);\n };\n const setOperation = (newOperation: JoinOperation) => {\n fireOnChange(tokens, newOperation);\n };\n return {\n setToken,\n removeToken,\n removeAllTokens,\n addToken,\n setOperation,\n };\n};\n\nexport const getAllowedOperators = (property: FilteringProperty): ComparisonOperator[] => {\n const { operators = [], defaultOperator } = property;\n const operatorOrder = ['=', '!=', ':', '!:', '>=', '<=', '<', '>'] as const;\n const operatorSet = new Set([\n defaultOperator ?? '=',\n ...operators.map(op => (typeof op === 'string' ? op : op.operator)),\n ]);\n return operatorOrder.filter(op => operatorSet.has(op));\n};\n\n/*\n * parses the value of the filtering input to figure out the current step of entering the token:\n * - \"property\": means that a filter on a particular column is being added, with operator already finalized\n * - \"operator\": means that a filter on a particular column is being added, with operator not yet finalized\n * - \"free-text\": means that a \"free text\" token is being added\n */\nexport const parseText = (\n filteringText: string,\n filteringProperties: readonly FilteringProperty[] = [],\n disableFreeTextFiltering: boolean\n): ParsedText => {\n const negatedGlobalQuery = /^(!:|!)(.*)/.exec(filteringText);\n if (!disableFreeTextFiltering && negatedGlobalQuery) {\n return {\n step: 'free-text',\n operator: '!:',\n value: negatedGlobalQuery[2],\n };\n }\n\n const property = matchFilteringProperty(filteringProperties, filteringText);\n if (!property) {\n return {\n step: 'free-text',\n value: filteringText,\n };\n }\n\n const allowedOps = getAllowedOperators(property);\n const textWithoutProperty = filteringText.substring(property.propertyLabel.length);\n const operator = matchOperator(allowedOps, trimStart(textWithoutProperty));\n if (operator) {\n const operatorLastIndex = textWithoutProperty.indexOf(operator) + operator.length;\n const textWithoutPropertyAndOperator = textWithoutProperty.slice(operatorLastIndex);\n // We need to remove the first leading space in case the user presses space\n // after the operator, for example: Owner: admin, will result in value of ` admin`\n // and we need to remove the first space, if the user added any more spaces only the\n // first one will be removed.\n const value = trimFirstSpace(textWithoutPropertyAndOperator);\n return { step: 'property', property, operator, value };\n }\n\n const operatorPrefix = matchOperatorPrefix(allowedOps, trimStart(textWithoutProperty));\n if (operatorPrefix !== null) {\n return { step: 'operator', property, operatorPrefix };\n }\n\n return {\n step: 'free-text',\n value: filteringText,\n };\n};\n\nexport const getPropertyOptions = (\n filteringProperty: FilteringProperty,\n filteringOptions: readonly FilteringOption[]\n) => {\n return filteringOptions.filter(option => option.propertyKey === filteringProperty.key);\n};\n\ninterface OptionGroup<T> {\n label: string;\n options: T[];\n}\n\nexport const getAllValueSuggestions = (\n filteringOptions: readonly FilteringOption[],\n filteringProperties: readonly FilteringProperty[],\n operator: ComparisonOperator | undefined = '=',\n i18nStrings: I18nStrings,\n customGroupsText: readonly GroupText[]\n) => {\n const defaultGroup: OptionGroup<AutosuggestProps.Option> = {\n label: i18nStrings.groupValuesText,\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<AutosuggestProps.Option> } = {};\n filteringOptions.forEach(filteringOption => {\n const property = getPropertyByKey(filteringProperties, filteringOption.propertyKey);\n // given option refers to a non-existent filtering property\n if (!property) {\n return;\n }\n // this option's filtering property does not support current operator\n if (getAllowedOperators(property).indexOf(operator) === -1) {\n return;\n }\n if (property.group && !customGroups[property.group]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === property.group ? customGroup.values : acc),\n ''\n );\n customGroups[property.group] = {\n label,\n options: [],\n };\n }\n const propertyGroup = property.group ? customGroups[property.group] : defaultGroup;\n propertyGroup.options.push({\n value: property.propertyLabel + ' ' + (operator || '=') + ' ' + filteringOption.value,\n label: filteringOption.label ?? filteringOption.value,\n __labelPrefix: property.propertyLabel + ' ' + (operator || '='),\n });\n });\n return [defaultGroup, ...Object.keys(customGroups).map(group => customGroups[group])];\n};\n\nexport const getPropertyByKey = (filteringProperties: readonly FilteringProperty[], key: string) => {\n const propertyMap = filteringProperties.reduce<{ [K: string]: FilteringProperty }>((acc, property) => {\n acc[property.key] = property;\n return acc;\n }, {});\n return propertyMap[key] as FilteringProperty | undefined;\n};\n\nexport function getExtendedOperator(\n filteringProperties: readonly FilteringProperty[],\n property: string,\n operator: ComparisonOperator\n) {\n const matchedProperty = getPropertyByKey(filteringProperties, property);\n for (const matchedOperator of matchedProperty?.operators || []) {\n if (typeof matchedOperator === 'object' && matchedOperator.operator === operator) {\n return matchedOperator;\n }\n }\n return null;\n}\n\nexport function createPropertiesCompatibilityMap(\n filteringProperties: readonly FilteringProperty[]\n): (propertyA: string, propertyB: string) => boolean {\n const lookup: {\n [propertyKey: string]: { operator: string; form: ExtendedOperatorForm<any> | undefined }[];\n } = {};\n\n for (const property of filteringProperties) {\n lookup[property.key] = (property.operators || [])\n .map(operator =>\n typeof operator === 'object'\n ? { operator: operator.operator, form: operator.form }\n : { operator, form: undefined }\n )\n .sort((a, b) => a.operator.localeCompare(b.operator));\n }\n\n return (propertyA: string, propertyB: string) => {\n if (lookup[propertyA].length !== lookup[propertyB].length) {\n return false;\n }\n for (let i = 0; i < lookup[propertyA].length; i++) {\n if (lookup[propertyA][i].operator !== lookup[propertyB][i].operator) {\n return false;\n }\n if (lookup[propertyA][i].form !== lookup[propertyB][i].form) {\n return false;\n }\n }\n return true;\n };\n}\n\nconst filteringPropertyToAutosuggestOption = (filteringProperty: FilteringProperty) => ({\n value: filteringProperty.propertyLabel,\n label: filteringProperty.propertyLabel,\n keepOpenOnSelect: true,\n});\n\nexport function getPropertySuggestions<T>(\n filteringProperties: readonly FilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings,\n filteringPropertyToOption: (filteringProperty: FilteringProperty) => T\n) {\n const defaultGroup: OptionGroup<T> = {\n label: i18nStrings.groupPropertiesText,\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<T> } = {};\n\n filteringProperties.forEach(filteringProperty => {\n const { group } = filteringProperty;\n let optionsGroup = defaultGroup;\n if (group) {\n if (!customGroups[group]) {\n const label = customGroupsText.reduce<string>(\n (acc, customGroup) => (customGroup.group === group ? customGroup.properties : acc),\n ''\n );\n customGroups[group] = { options: [], label };\n }\n optionsGroup = customGroups[group];\n }\n optionsGroup.options.push(filteringPropertyToOption(filteringProperty));\n });\n const defaultGroupArray = defaultGroup.options.length ? [defaultGroup] : [];\n const customGroupsArray = Object.keys(customGroups).map(groupKey => customGroups[groupKey]);\n return [...defaultGroupArray, ...customGroupsArray];\n}\n\nexport const getAutosuggestOptions = (\n parsedText: ParsedText,\n filteringOptions: readonly FilteringOption[],\n filteringProperties: readonly FilteringProperty[],\n customGroupsText: readonly GroupText[],\n i18nStrings: I18nStrings\n) => {\n switch (parsedText.step) {\n case 'property': {\n const { propertyLabel, groupValuesLabel } = parsedText.property;\n const options = getPropertyOptions(parsedText.property, filteringOptions);\n return {\n filterText: parsedText.value,\n options: [\n {\n options: options.map(({ label, value }) => ({\n value: propertyLabel + ' ' + parsedText.operator + ' ' + value,\n label: label ?? value,\n __labelPrefix: propertyLabel + ' ' + parsedText.operator,\n })),\n label: groupValuesLabel,\n },\n ],\n };\n }\n case 'operator': {\n return {\n filterText: parsedText.property.propertyLabel + ' ' + parsedText.operatorPrefix,\n options: [\n ...getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n ),\n {\n options: getAllowedOperators(parsedText.property).map(value => ({\n value: parsedText.property.propertyLabel + ' ' + value + ' ',\n label: parsedText.property.propertyLabel + ' ' + value,\n description: operatorToDescription(value, i18nStrings),\n keepOpenOnSelect: true,\n })),\n label: i18nStrings.operatorsText,\n },\n ],\n };\n }\n case 'free-text': {\n const needsValueSuggestions = !!parsedText.value;\n const needsPropertySuggestions = !(parsedText.step === 'free-text' && parsedText.operator === '!:');\n return {\n filterText: parsedText.value,\n options: [\n ...(needsPropertySuggestions\n ? getPropertySuggestions(\n filteringProperties,\n customGroupsText,\n i18nStrings,\n filteringPropertyToAutosuggestOption\n )\n : []),\n ...(needsValueSuggestions\n ? getAllValueSuggestions(\n filteringOptions,\n filteringProperties,\n parsedText.operator,\n i18nStrings,\n customGroupsText\n )\n : []),\n ],\n };\n }\n }\n};\n\nexport const operatorToDescription = (operator: ComparisonOperator, i18nStrings: I18nStrings) => {\n const mapping: { [K in ComparisonOperator]: string } = {\n ['<']: i18nStrings.operatorLessText,\n ['<=']: i18nStrings.operatorLessOrEqualText,\n ['>']: i18nStrings.operatorGreaterText,\n ['>=']: i18nStrings.operatorGreaterOrEqualText,\n [':']: i18nStrings.operatorContainsText,\n ['!:']: i18nStrings.operatorDoesNotContainText,\n ['=']: i18nStrings.operatorEqualsText,\n ['!=']: i18nStrings.operatorDoesNotEqualText,\n };\n return mapping[operator];\n};\n"]}
@@ -25,7 +25,11 @@ function isGroup(optionOrGroup) {
25
25
  return 'options' in optionOrGroup;
26
26
  }
27
27
  function matchSingleOption(option, searchText) {
28
- var _a;
29
- return ((_a = option.label) !== null && _a !== void 0 ? _a : '').toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
28
+ var _a, _b;
29
+ searchText = searchText.toLowerCase();
30
+ var label = ((_a = option.label) !== null && _a !== void 0 ? _a : '').toLowerCase();
31
+ var labelPrefix = (_b = option.__labelPrefix) !== null && _b !== void 0 ? _b : '';
32
+ var value = (option.value ? option.value.slice(labelPrefix.length) : '').toLowerCase();
33
+ return label.indexOf(searchText) !== -1 || value.indexOf(searchText) !== -1;
30
34
  }
31
35
  //# sourceMappingURL=filter-options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-options.js","sourceRoot":"","sources":["../../../src/property-filter/filter-options.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAKtC,MAAM,UAAU,aAAa,CAC3B,OAA4E,EAC5E,UAAe;IAAf,2BAAA,EAAA,eAAe;IAEf,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,OAAO,CAAC;KAChB;IAED,IAAM,QAAQ,GAA+D,EAAE,CAAC;IAChF,KAAqB,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO,EAAE;QAAzB,IAAM,MAAM,gBAAA;QACf,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;YACnB,IAAM,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YAC/D,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,QAAQ,CAAC,IAAI,uBAAM,MAAM,KAAE,OAAO,EAAE,YAAY,IAAG,CAAC;aACrD;SACF;aAAM,IAAI,iBAAiB,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE;YAChD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACvB;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,OAAO,CAAC,aAAsC;IACrD,OAAO,SAAS,IAAI,aAAa,CAAC;AACpC,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAwB,EAAE,UAAkB;;IACrE,OAAO,CAAC,MAAA,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACrF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { OptionDefinition } from '../internal/components/option/interfaces';\n\nexport function filterOptions(\n options: readonly (AutosuggestProps.Option | AutosuggestProps.OptionGroup)[],\n searchText = ''\n): readonly (AutosuggestProps.Option | AutosuggestProps.OptionGroup)[] {\n if (!searchText) {\n return options;\n }\n\n const filtered: (AutosuggestProps.Option | AutosuggestProps.OptionGroup)[] = [];\n for (const option of options) {\n if (isGroup(option)) {\n const childOptions = filterOptions(option.options, searchText);\n if (childOptions.length > 0) {\n filtered.push({ ...option, options: childOptions });\n }\n } else if (matchSingleOption(option, searchText)) {\n filtered.push(option);\n }\n }\n return filtered;\n}\n\nfunction isGroup(optionOrGroup: AutosuggestProps.Option): optionOrGroup is AutosuggestProps.OptionGroup {\n return 'options' in optionOrGroup;\n}\n\nfunction matchSingleOption(option: OptionDefinition, searchText: string): boolean {\n return (option.label ?? '').toLowerCase().indexOf(searchText.toLowerCase()) !== -1;\n}\n"]}
1
+ {"version":3,"file":"filter-options.js","sourceRoot":"","sources":["../../../src/property-filter/filter-options.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAKtC,MAAM,UAAU,aAAa,CAC3B,OAA4E,EAC5E,UAAe;IAAf,2BAAA,EAAA,eAAe;IAEf,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,OAAO,CAAC;KAChB;IAED,IAAM,QAAQ,GAA+D,EAAE,CAAC;IAChF,KAAqB,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO,EAAE;QAAzB,IAAM,MAAM,gBAAA;QACf,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;YACnB,IAAM,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YAC/D,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,QAAQ,CAAC,IAAI,uBAAM,MAAM,KAAE,OAAO,EAAE,YAAY,IAAG,CAAC;aACrD;SACF;aAAM,IAAI,iBAAiB,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE;YAChD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACvB;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,OAAO,CAAC,aAAsC;IACrD,OAAO,SAAS,IAAI,aAAa,CAAC;AACpC,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAwB,EAAE,UAAkB;;IACrE,UAAU,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IAEtC,IAAM,KAAK,GAAG,CAAC,MAAA,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACjD,IAAM,WAAW,GAAG,MAAA,MAAM,CAAC,aAAa,mCAAI,EAAE,CAAC;IAC/C,IAAM,KAAK,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACzF,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { OptionDefinition } from '../internal/components/option/interfaces';\n\nexport function filterOptions(\n options: readonly (AutosuggestProps.Option | AutosuggestProps.OptionGroup)[],\n searchText = ''\n): readonly (AutosuggestProps.Option | AutosuggestProps.OptionGroup)[] {\n if (!searchText) {\n return options;\n }\n\n const filtered: (AutosuggestProps.Option | AutosuggestProps.OptionGroup)[] = [];\n for (const option of options) {\n if (isGroup(option)) {\n const childOptions = filterOptions(option.options, searchText);\n if (childOptions.length > 0) {\n filtered.push({ ...option, options: childOptions });\n }\n } else if (matchSingleOption(option, searchText)) {\n filtered.push(option);\n }\n }\n return filtered;\n}\n\nfunction isGroup(optionOrGroup: AutosuggestProps.Option): optionOrGroup is AutosuggestProps.OptionGroup {\n return 'options' in optionOrGroup;\n}\n\nfunction matchSingleOption(option: OptionDefinition, searchText: string): boolean {\n searchText = searchText.toLowerCase();\n\n const label = (option.label ?? '').toLowerCase();\n const labelPrefix = option.__labelPrefix ?? '';\n const value = (option.value ? option.value.slice(labelPrefix.length) : '').toLowerCase();\n return label.indexOf(searchText) !== -1 || value.indexOf(searchText) !== -1;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAW9E,OAAO,EAAE,mBAAmB,EAAiE,MAAM,cAAc,CAAC;AAgBlH,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,QAAA,MAAM,cAAc,qGAkRnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAW9E,OAAO,EAAE,mBAAmB,EAAiE,MAAM,cAAc,CAAC;AAiBlH,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,QAAA,MAAM,cAAc,qGAqRnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
@@ -18,6 +18,7 @@ import styles from './styles.css.js';
18
18
  import useBaseComponent from '../internal/hooks/use-base-component';
19
19
  import PropertyFilterAutosuggest from './property-filter-autosuggest';
20
20
  import { PropertyEditor } from './property-editor';
21
+ import { matchTokenValue } from './utils';
21
22
  var PropertyFilter = React.forwardRef(function (_a, ref) {
22
23
  var _b;
23
24
  var disabled = _a.disabled, i18nStrings = _a.i18nStrings, countText = _a.countText, query = _a.query, hideOperations = _a.hideOperations, onChange = _a.onChange, filteringProperties = _a.filteringProperties, _c = _a.filteringOptions, filteringOptions = _c === void 0 ? [] : _c, _d = _a.customGroupsText, customGroupsText = _d === void 0 ? [] : _d, _e = _a.disableFreeTextFiltering, disableFreeTextFiltering = _e === void 0 ? false : _e, onLoadItems = _a.onLoadItems, virtualScroll = _a.virtualScroll, customControl = _a.customControl, filteringEmpty = _a.filteringEmpty, filteringLoadingText = _a.filteringLoadingText, filteringFinishedText = _a.filteringFinishedText, filteringErrorText = _a.filteringErrorText, filteringRecoveryText = _a.filteringRecoveryText, filteringStatusType = _a.filteringStatusType, asyncProperties = _a.asyncProperties, tokenLimit = _a.tokenLimit, expandToViewport = _a.expandToViewport, rest = __rest(_a, ["disabled", "i18nStrings", "countText", "query", "hideOperations", "onChange", "filteringProperties", "filteringOptions", "customGroupsText", "disableFreeTextFiltering", "onLoadItems", "virtualScroll", "customControl", "filteringEmpty", "filteringLoadingText", "filteringFinishedText", "filteringErrorText", "filteringRecoveryText", "filteringStatusType", "asyncProperties", "tokenLimit", "expandToViewport"]);
@@ -36,11 +37,11 @@ var PropertyFilter = React.forwardRef(function (_a, ref) {
36
37
  var newToken;
37
38
  switch (parsedText.step) {
38
39
  case 'property': {
39
- newToken = {
40
+ newToken = matchTokenValue({
40
41
  propertyKey: parsedText.property.key,
41
42
  operator: parsedText.operator,
42
43
  value: parsedText.value
43
- };
44
+ }, filteringOptions);
44
45
  break;
45
46
  }
46
47
  case 'free-text': {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,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IAAK,OAAA,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAzB,CAAyB,EACxD,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,wBAAwB,EAAE,wBAAwB,EAClD,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAClC,CACH,EArBmC,CAqBnC,CAAC;gBACD,gBAAgB,IAAI,CACnB,6BAAK,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC;oBACxC,oBAAC,YAAY,IACX,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,UAAU,KAAK,CAAC,EAC3B,QAAQ,EAAE,cAAc,EACxB,qBAAqB,EAAE,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,EAC1D,WAAW,EAAE;4BACX,cAAc,EAAE,WAAW,CAAC,mBAAmB;4BAC/C,aAAa,EAAE,WAAW,CAAC,kBAAkB;yBAC9C,EACD,OAAO,EAAE,oBAAoB,GAC7B,CACE,CACP;gBACD,6BAAK,SAAS,EAAE,MAAM,CAAC,SAAS,GAAI;gBACpC,oBAAC,cAAc,IAAC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,IAC1F,WAAW,CAAC,gBAAgB,CACd,CACI,CACnB,CACP,CACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef, useState, useMemo, useImperativeHandle } from 'react';\n\nimport InternalSpaceBetween from '../space-between/internal';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { KeyCode } from '../internal/keycode';\nimport SelectToggle from '../token-group/toggle';\nimport { generateUniqueId } from '../internal/hooks/use-unique-id/index';\nimport { fireNonCancelableEvent } from '../internal/events';\n\nimport { PropertyFilterProps, ParsedText, Ref, FilteringProperty, ComparisonOperator, Token } from './interfaces';\nimport { TokenButton } from './token';\nimport {\n getQueryActions,\n parseText,\n getAutosuggestOptions,\n getAllowedOperators,\n getExtendedOperator,\n} from './controller';\nimport { useLoadItems } from './use-load-items';\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport PropertyFilterAutosuggest, { PropertyFilterAutosuggestProps } from './property-filter-autosuggest';\nimport { PropertyEditor } from './property-editor';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\n\nexport { PropertyFilterProps };\n\nconst PropertyFilter = React.forwardRef(\n (\n {\n disabled,\n i18nStrings,\n countText,\n query,\n hideOperations,\n onChange,\n filteringProperties,\n filteringOptions = [],\n customGroupsText = [],\n disableFreeTextFiltering = false,\n onLoadItems,\n virtualScroll,\n customControl,\n filteringEmpty,\n filteringLoadingText,\n filteringFinishedText,\n filteringErrorText,\n filteringRecoveryText,\n filteringStatusType,\n asyncProperties,\n tokenLimit,\n expandToViewport,\n ...rest\n }: PropertyFilterProps,\n ref: React.Ref<Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('PropertyFilter');\n const inputRef = useRef<AutosuggestInputRef>(null);\n const baseProps = getBaseProps(rest);\n useImperativeHandle(ref, () => ({ focus: () => inputRef.current?.focus() }), []);\n const { tokens, operation } = query;\n const showResults = tokens?.length && !disabled;\n const { addToken, removeToken, setToken, setOperation, removeAllTokens } = getQueryActions(\n query,\n onChange,\n inputRef\n );\n const [filteringText, setFilteringText] = useState<string>('');\n const parsedText = parseText(filteringText, filteringProperties, disableFreeTextFiltering);\n const autosuggestOptions = getAutosuggestOptions(\n parsedText,\n filteringOptions,\n filteringProperties,\n customGroupsText,\n i18nStrings\n );\n\n const createToken = (currentText: string) => {\n const parsedText = parseText(currentText, filteringProperties, disableFreeTextFiltering);\n let newToken: Token;\n switch (parsedText.step) {\n case 'property': {\n newToken = {\n propertyKey: parsedText.property.key,\n operator: parsedText.operator,\n value: parsedText.value,\n };\n break;\n }\n case 'free-text': {\n newToken = {\n operator: parsedText.operator || ':',\n value: parsedText.value,\n };\n break;\n }\n case 'operator': {\n newToken = {\n operator: ':',\n value: currentText,\n };\n break;\n }\n }\n if (disableFreeTextFiltering && !('propertyKey' in newToken)) {\n return;\n }\n addToken(newToken);\n setFilteringText('');\n };\n const ignoreKeyDown = useRef<boolean>(false);\n const handleKeyDown: PropertyFilterAutosuggestProps['onKeyDown'] = event => {\n if (filteringText && !ignoreKeyDown.current && event.detail.keyCode === KeyCode.enter) {\n createToken(filteringText);\n }\n };\n const getLoadMoreDetail = (parsedText: ParsedText, filteringText: string) => {\n const loadMoreDetail: {\n filteringProperty: FilteringProperty | undefined;\n filteringText: string;\n filteringOperator: ComparisonOperator | undefined;\n } = {\n filteringProperty: undefined,\n filteringText,\n filteringOperator: undefined,\n };\n if (parsedText.step === 'property') {\n loadMoreDetail.filteringProperty = parsedText.property;\n loadMoreDetail.filteringText = parsedText.value;\n loadMoreDetail.filteringOperator = parsedText.operator;\n }\n return loadMoreDetail;\n };\n const loadMoreDetail = getLoadMoreDetail(parsedText, filteringText);\n const inputLoadItemsHandlers = useLoadItems(\n onLoadItems,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringProperty,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringOperator\n );\n const asyncProps = {\n empty: filteringEmpty,\n loadingText: filteringLoadingText,\n finishedText: filteringFinishedText,\n errorText: filteringErrorText,\n recoveryText: filteringRecoveryText,\n statusType: filteringStatusType,\n };\n const asyncAutosuggestProps =\n !!filteringText.length || asyncProperties\n ? {\n ...inputLoadItemsHandlers,\n ...asyncProps,\n }\n : {};\n const handleSelected: PropertyFilterAutosuggestProps['onOptionClick'] = event => {\n // The ignoreKeyDown flag makes sure `createToken` routine runs only once. Autosuggest's `onKeyDown` fires,\n // when an item is selected from the list using \"enter\" key.\n ignoreKeyDown.current = true;\n setTimeout(() => {\n ignoreKeyDown.current = false;\n }, 0);\n const { detail: option } = event;\n const value = option.value || '';\n\n if (!('keepOpenOnSelect' in option)) {\n createToken(value);\n return;\n }\n\n // stop dropdown from closing\n event.preventDefault();\n\n const parsedText = parseText(value, filteringProperties, disableFreeTextFiltering);\n const loadMoreDetail = getLoadMoreDetail(parsedText, value);\n\n // Insert operator automatically if only one operator is defined for the given property.\n if (parsedText.step === 'operator') {\n const operators = getAllowedOperators(parsedText.property);\n if (value.trim() === parsedText.property.propertyLabel && operators.length === 1) {\n loadMoreDetail.filteringProperty = parsedText.property;\n loadMoreDetail.filteringOperator = operators[0];\n loadMoreDetail.filteringText = '';\n setFilteringText(parsedText.property.propertyLabel + ' ' + operators[0] + ' ');\n }\n }\n\n fireNonCancelableEvent(onLoadItems, { ...loadMoreDetail, firstPage: true, samePage: false });\n };\n const [tokensExpanded, setTokensExpanded] = useState(false);\n const toggleExpandedTokens = () => setTokensExpanded(!tokensExpanded);\n const hasHiddenOptions = tokenLimit !== undefined && tokens.length > tokenLimit;\n const slicedTokens = hasHiddenOptions && !tokensExpanded ? tokens.slice(0, tokenLimit) : tokens;\n const controlId = useMemo(() => generateUniqueId(), []);\n\n const operatorForm =\n parsedText.step === 'property' &&\n getExtendedOperator(filteringProperties, parsedText.property.key, parsedText.operator)?.form;\n\n return (\n <span {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div className={styles['search-field']}>\n {customControl && <div className={styles['custom-control']}>{customControl}</div>}\n <PropertyFilterAutosuggest\n ref={inputRef}\n virtualScroll={virtualScroll}\n enteredTextLabel={i18nStrings.enteredTextLabel}\n ariaLabel={i18nStrings.filteringAriaLabel}\n placeholder={i18nStrings.filteringPlaceholder}\n value={filteringText}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n {...autosuggestOptions}\n onChange={event => setFilteringText(event.detail.value)}\n empty={filteringEmpty}\n {...asyncAutosuggestProps}\n expandToViewport={expandToViewport}\n onOptionClick={handleSelected}\n customForm={\n operatorForm && (\n <PropertyEditor\n property={parsedText.property}\n operator={parsedText.operator}\n filter={parsedText.value}\n operatorForm={operatorForm}\n i18nStrings={i18nStrings}\n onCancel={() => {\n setFilteringText('');\n inputRef.current?.close();\n inputRef.current?.focus({ preventDropdown: true });\n }}\n onSubmit={token => {\n addToken(token);\n setFilteringText('');\n inputRef.current?.focus({ preventDropdown: true });\n inputRef.current?.close();\n }}\n />\n )\n }\n hideEnteredTextOption={disableFreeTextFiltering && parsedText.step !== 'property'}\n />\n <span\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className={clsx(styles.results, showResults && styles['results-visible'])}\n >\n {showResults ? countText : ''}\n </span>\n </div>\n {tokens && tokens.length > 0 && (\n <div className={styles.tokens}>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\" id={controlId}>\n {slicedTokens.map((token, index) => (\n <TokenButton\n token={token}\n first={index === 0}\n operation={operation}\n key={index}\n removeToken={() => removeToken(index)}\n setToken={(newToken: Token) => setToken(index, newToken)}\n setOperation={setOperation}\n filteringOptions={filteringOptions}\n filteringProperties={filteringProperties}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n hideOperations={hideOperations}\n customGroupsText={customGroupsText}\n disableFreeTextFiltering={disableFreeTextFiltering}\n disabled={disabled}\n expandToViewport={expandToViewport}\n />\n ))}\n {hasHiddenOptions && (\n <div className={styles['toggle-collapsed']}>\n <SelectToggle\n controlId={controlId}\n allHidden={tokenLimit === 0}\n expanded={tokensExpanded}\n numberOfHiddenOptions={tokens.length - slicedTokens.length}\n i18nStrings={{\n limitShowFewer: i18nStrings.tokenLimitShowFewer,\n limitShowMore: i18nStrings.tokenLimitShowMore,\n }}\n onClick={toggleExpandedTokens}\n />\n </div>\n )}\n <div className={styles.separator} />\n <InternalButton onClick={removeAllTokens} className={styles['remove-all']} disabled={disabled}>\n {i18nStrings.clearFiltersText}\n </InternalButton>\n </InternalSpaceBetween>\n </div>\n )}\n </span>\n );\n }\n);\n\napplyDisplayName(PropertyFilter, 'PropertyFilter');\nexport default PropertyFilter;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/property-filter/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EACL,eAAe,EACf,SAAS,EACT,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACp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AAC,YAAY,IACX,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,UAAU,KAAK,CAAC,EAC3B,QAAQ,EAAE,cAAc,EACxB,qBAAqB,EAAE,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,EAC1D,WAAW,EAAE;4BACX,cAAc,EAAE,WAAW,CAAC,mBAAmB;4BAC/C,aAAa,EAAE,WAAW,CAAC,kBAAkB;yBAC9C,EACD,OAAO,EAAE,oBAAoB,GAC7B,CACE,CACP;gBACD,6BAAK,SAAS,EAAE,MAAM,CAAC,SAAS,GAAI;gBACpC,oBAAC,cAAc,IAAC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,IAC1F,WAAW,CAAC,gBAAgB,CACd,CACI,CACnB,CACP,CACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AACnD,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef, useState, useMemo, useImperativeHandle } from 'react';\n\nimport InternalSpaceBetween from '../space-between/internal';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { KeyCode } from '../internal/keycode';\nimport SelectToggle from '../token-group/toggle';\nimport { generateUniqueId } from '../internal/hooks/use-unique-id/index';\nimport { fireNonCancelableEvent } from '../internal/events';\n\nimport { PropertyFilterProps, ParsedText, Ref, FilteringProperty, ComparisonOperator, Token } from './interfaces';\nimport { TokenButton } from './token';\nimport {\n getQueryActions,\n parseText,\n getAutosuggestOptions,\n getAllowedOperators,\n getExtendedOperator,\n} from './controller';\nimport { useLoadItems } from './use-load-items';\nimport styles from './styles.css.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport PropertyFilterAutosuggest, { PropertyFilterAutosuggestProps } from './property-filter-autosuggest';\nimport { PropertyEditor } from './property-editor';\nimport { AutosuggestInputRef } from '../internal/components/autosuggest-input';\nimport { matchTokenValue } from './utils';\n\nexport { PropertyFilterProps };\n\nconst PropertyFilter = React.forwardRef(\n (\n {\n disabled,\n i18nStrings,\n countText,\n query,\n hideOperations,\n onChange,\n filteringProperties,\n filteringOptions = [],\n customGroupsText = [],\n disableFreeTextFiltering = false,\n onLoadItems,\n virtualScroll,\n customControl,\n filteringEmpty,\n filteringLoadingText,\n filteringFinishedText,\n filteringErrorText,\n filteringRecoveryText,\n filteringStatusType,\n asyncProperties,\n tokenLimit,\n expandToViewport,\n ...rest\n }: PropertyFilterProps,\n ref: React.Ref<Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('PropertyFilter');\n const inputRef = useRef<AutosuggestInputRef>(null);\n const baseProps = getBaseProps(rest);\n useImperativeHandle(ref, () => ({ focus: () => inputRef.current?.focus() }), []);\n const { tokens, operation } = query;\n const showResults = tokens?.length && !disabled;\n const { addToken, removeToken, setToken, setOperation, removeAllTokens } = getQueryActions(\n query,\n onChange,\n inputRef\n );\n const [filteringText, setFilteringText] = useState<string>('');\n const parsedText = parseText(filteringText, filteringProperties, disableFreeTextFiltering);\n const autosuggestOptions = getAutosuggestOptions(\n parsedText,\n filteringOptions,\n filteringProperties,\n customGroupsText,\n i18nStrings\n );\n\n const createToken = (currentText: string) => {\n const parsedText = parseText(currentText, filteringProperties, disableFreeTextFiltering);\n let newToken: Token;\n switch (parsedText.step) {\n case 'property': {\n newToken = matchTokenValue(\n {\n propertyKey: parsedText.property.key,\n operator: parsedText.operator,\n value: parsedText.value,\n },\n filteringOptions\n );\n break;\n }\n case 'free-text': {\n newToken = {\n operator: parsedText.operator || ':',\n value: parsedText.value,\n };\n break;\n }\n case 'operator': {\n newToken = {\n operator: ':',\n value: currentText,\n };\n break;\n }\n }\n if (disableFreeTextFiltering && !('propertyKey' in newToken)) {\n return;\n }\n addToken(newToken);\n setFilteringText('');\n };\n const ignoreKeyDown = useRef<boolean>(false);\n const handleKeyDown: PropertyFilterAutosuggestProps['onKeyDown'] = event => {\n if (filteringText && !ignoreKeyDown.current && event.detail.keyCode === KeyCode.enter) {\n createToken(filteringText);\n }\n };\n const getLoadMoreDetail = (parsedText: ParsedText, filteringText: string) => {\n const loadMoreDetail: {\n filteringProperty: FilteringProperty | undefined;\n filteringText: string;\n filteringOperator: ComparisonOperator | undefined;\n } = {\n filteringProperty: undefined,\n filteringText,\n filteringOperator: undefined,\n };\n if (parsedText.step === 'property') {\n loadMoreDetail.filteringProperty = parsedText.property;\n loadMoreDetail.filteringText = parsedText.value;\n loadMoreDetail.filteringOperator = parsedText.operator;\n }\n return loadMoreDetail;\n };\n const loadMoreDetail = getLoadMoreDetail(parsedText, filteringText);\n const inputLoadItemsHandlers = useLoadItems(\n onLoadItems,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringProperty,\n loadMoreDetail.filteringText,\n loadMoreDetail.filteringOperator\n );\n const asyncProps = {\n empty: filteringEmpty,\n loadingText: filteringLoadingText,\n finishedText: filteringFinishedText,\n errorText: filteringErrorText,\n recoveryText: filteringRecoveryText,\n statusType: filteringStatusType,\n };\n const asyncAutosuggestProps =\n !!filteringText.length || asyncProperties\n ? {\n ...inputLoadItemsHandlers,\n ...asyncProps,\n }\n : {};\n const handleSelected: PropertyFilterAutosuggestProps['onOptionClick'] = event => {\n // The ignoreKeyDown flag makes sure `createToken` routine runs only once. Autosuggest's `onKeyDown` fires,\n // when an item is selected from the list using \"enter\" key.\n ignoreKeyDown.current = true;\n setTimeout(() => {\n ignoreKeyDown.current = false;\n }, 0);\n const { detail: option } = event;\n const value = option.value || '';\n\n if (!('keepOpenOnSelect' in option)) {\n createToken(value);\n return;\n }\n\n // stop dropdown from closing\n event.preventDefault();\n\n const parsedText = parseText(value, filteringProperties, disableFreeTextFiltering);\n const loadMoreDetail = getLoadMoreDetail(parsedText, value);\n\n // Insert operator automatically if only one operator is defined for the given property.\n if (parsedText.step === 'operator') {\n const operators = getAllowedOperators(parsedText.property);\n if (value.trim() === parsedText.property.propertyLabel && operators.length === 1) {\n loadMoreDetail.filteringProperty = parsedText.property;\n loadMoreDetail.filteringOperator = operators[0];\n loadMoreDetail.filteringText = '';\n setFilteringText(parsedText.property.propertyLabel + ' ' + operators[0] + ' ');\n }\n }\n\n fireNonCancelableEvent(onLoadItems, { ...loadMoreDetail, firstPage: true, samePage: false });\n };\n const [tokensExpanded, setTokensExpanded] = useState(false);\n const toggleExpandedTokens = () => setTokensExpanded(!tokensExpanded);\n const hasHiddenOptions = tokenLimit !== undefined && tokens.length > tokenLimit;\n const slicedTokens = hasHiddenOptions && !tokensExpanded ? tokens.slice(0, tokenLimit) : tokens;\n const controlId = useMemo(() => generateUniqueId(), []);\n\n const operatorForm =\n parsedText.step === 'property' &&\n getExtendedOperator(filteringProperties, parsedText.property.key, parsedText.operator)?.form;\n\n return (\n <span {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div className={styles['search-field']}>\n {customControl && <div className={styles['custom-control']}>{customControl}</div>}\n <PropertyFilterAutosuggest\n ref={inputRef}\n virtualScroll={virtualScroll}\n enteredTextLabel={i18nStrings.enteredTextLabel}\n ariaLabel={i18nStrings.filteringAriaLabel}\n placeholder={i18nStrings.filteringPlaceholder}\n value={filteringText}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n {...autosuggestOptions}\n onChange={event => setFilteringText(event.detail.value)}\n empty={filteringEmpty}\n {...asyncAutosuggestProps}\n expandToViewport={expandToViewport}\n onOptionClick={handleSelected}\n customForm={\n operatorForm && (\n <PropertyEditor\n property={parsedText.property}\n operator={parsedText.operator}\n filter={parsedText.value}\n operatorForm={operatorForm}\n i18nStrings={i18nStrings}\n onCancel={() => {\n setFilteringText('');\n inputRef.current?.close();\n inputRef.current?.focus({ preventDropdown: true });\n }}\n onSubmit={token => {\n addToken(token);\n setFilteringText('');\n inputRef.current?.focus({ preventDropdown: true });\n inputRef.current?.close();\n }}\n />\n )\n }\n hideEnteredTextOption={disableFreeTextFiltering && parsedText.step !== 'property'}\n />\n <span\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className={clsx(styles.results, showResults && styles['results-visible'])}\n >\n {showResults ? countText : ''}\n </span>\n </div>\n {tokens && tokens.length > 0 && (\n <div className={styles.tokens}>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\" id={controlId}>\n {slicedTokens.map((token, index) => (\n <TokenButton\n token={token}\n first={index === 0}\n operation={operation}\n key={index}\n removeToken={() => removeToken(index)}\n setToken={(newToken: Token) => setToken(index, newToken)}\n setOperation={setOperation}\n filteringOptions={filteringOptions}\n filteringProperties={filteringProperties}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n hideOperations={hideOperations}\n customGroupsText={customGroupsText}\n disableFreeTextFiltering={disableFreeTextFiltering}\n disabled={disabled}\n expandToViewport={expandToViewport}\n />\n ))}\n {hasHiddenOptions && (\n <div className={styles['toggle-collapsed']}>\n <SelectToggle\n controlId={controlId}\n allHidden={tokenLimit === 0}\n expanded={tokensExpanded}\n numberOfHiddenOptions={tokens.length - slicedTokens.length}\n i18nStrings={{\n limitShowFewer: i18nStrings.tokenLimitShowFewer,\n limitShowMore: i18nStrings.tokenLimitShowMore,\n }}\n onClick={toggleExpandedTokens}\n />\n </div>\n )}\n <div className={styles.separator} />\n <InternalButton onClick={removeAllTokens} className={styles['remove-all']} disabled={disabled}>\n {i18nStrings.clearFiltersText}\n </InternalButton>\n </InternalSpaceBetween>\n </div>\n )}\n </span>\n );\n }\n);\n\napplyDisplayName(PropertyFilter, 'PropertyFilter');\nexport default PropertyFilter;\n"]}
@@ -63,6 +63,21 @@ export interface PropertyFilterProps extends BaseComponentProps, ExpandToViewpor
63
63
  *
64
64
  * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.
65
65
  * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.
66
+ * * `label` [string]: Optional suggestion label to be matched instead of the value.
67
+ *
68
+ * Filtering options that require labels can only use `=` and `!=` operators. The token value must be labelled separately, for example:
69
+ * ```
70
+ * const filteringProperty = {
71
+ * key: 'state',
72
+ * propertyLabel: 'State',
73
+ * operators: ['=', '!='].map(operator => ({ operator, format: getStateLabel }))
74
+ * }
75
+ * const filteringOptions = [
76
+ * { propertyKey: 'state', value: 'STOPPED', label: getStateLabel('STOPPED') },
77
+ * { propertyKey: 'state', value: 'STOPPING', label: getStateLabel('STOPPING') },
78
+ * { propertyKey: 'state', value: 'RUNNING', label: getStateLabel('RUNNING') },
79
+ * ]
80
+ * ```
66
81
  */
67
82
  filteringOptions?: ReadonlyArray<PropertyFilterProps.FilteringOption>;
68
83
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,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,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,0BAA0B,EAC1B,4BAA4B,EAC5B,+BAA+B,EAC/B,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,qCAAqC,CAAC;AAE7C,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB,EAAE,gBAAgB;IAC/E;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,WAAW,EAAE,mBAAmB,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F;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":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\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 PropertyFilterOperation,\n PropertyFilterOperator,\n PropertyFilterOperatorExtended,\n PropertyFilterOperatorForm,\n PropertyFilterOperatorFormat,\n PropertyFilterOperatorFormProps,\n PropertyFilterOption,\n PropertyFilterProperty,\n PropertyFilterToken,\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 ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\n export type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\n export type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\n export type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\n export type FilteringOption = PropertyFilterOption;\n export type FilteringProperty = PropertyFilterProperty;\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 tokenOperatorAriaLabel?: 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 ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\nexport type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\nexport type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\nexport type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\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"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\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 PropertyFilterOperation,\n PropertyFilterOperator,\n PropertyFilterOperatorExtended,\n PropertyFilterOperatorForm,\n PropertyFilterOperatorFormat,\n PropertyFilterOperatorFormProps,\n PropertyFilterOption,\n PropertyFilterProperty,\n PropertyFilterToken,\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 * * `label` [string]: Optional suggestion label to be matched instead of the value.\n *\n * Filtering options that require labels can only use `=` and `!=` operators. The token value must be labelled separately, for example:\n * ```\n * const filteringProperty = {\n * key: 'state',\n * propertyLabel: 'State',\n * operators: ['=', '!='].map(operator => ({ operator, format: getStateLabel }))\n * }\n * const filteringOptions = [\n * { propertyKey: 'state', value: 'STOPPED', label: getStateLabel('STOPPED') },\n * { propertyKey: 'state', value: 'STOPPING', label: getStateLabel('STOPPING') },\n * { propertyKey: 'state', value: 'RUNNING', label: getStateLabel('RUNNING') },\n * ]\n * ```\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 ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\n export type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\n export type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\n export type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\n export type FilteringOption = PropertyFilterOption;\n export type FilteringProperty = PropertyFilterProperty;\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 tokenOperatorAriaLabel?: 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 ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\nexport type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\nexport type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\nexport type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"token-editor.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAMhD,OAAO,EAEL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,EACN,MAAM,cAAc,CAAC;AAYtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAoKxF,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;AAED,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,QAAQ,EACR,KAAK,EACL,gBAAgB,GACjB,EAAE,gBAAgB,eAuGlB"}
1
+ {"version":3,"file":"token-editor.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token-editor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAMhD,OAAO,EAEL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,EACN,MAAM,cAAc,CAAC;AAYtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAwKxF,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;AAED,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,QAAQ,EACR,KAAK,EACL,gBAAgB,GACjB,EAAE,gBAAgB,eAuGlB"}