@cloudscape-design/components 3.0.32 → 3.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-layout/interfaces.d.ts +2 -0
- package/app-layout/interfaces.d.ts.map +1 -1
- package/app-layout/interfaces.js.map +1 -1
- package/app-layout/styles.css.js +37 -37
- package/app-layout/styles.scoped.css +51 -51
- package/app-layout/styles.selectors.js +37 -37
- package/app-layout/visual-refresh/styles.css.js +59 -59
- package/app-layout/visual-refresh/styles.scoped.css +147 -147
- package/app-layout/visual-refresh/styles.selectors.js +59 -59
- package/autosuggest/autosuggest-option.d.ts +2 -1
- package/autosuggest/autosuggest-option.d.ts.map +1 -1
- package/autosuggest/autosuggest-option.js +2 -2
- package/autosuggest/autosuggest-option.js.map +1 -1
- package/autosuggest/controller.d.ts +3 -3
- package/autosuggest/controller.d.ts.map +1 -1
- package/autosuggest/controller.js +2 -4
- package/autosuggest/controller.js.map +1 -1
- package/autosuggest/internal.d.ts.map +1 -1
- package/autosuggest/internal.js +13 -15
- package/autosuggest/internal.js.map +1 -1
- package/autosuggest/options-controller.d.ts +9 -13
- package/autosuggest/options-controller.d.ts.map +1 -1
- package/autosuggest/options-controller.js +10 -15
- package/autosuggest/options-controller.js.map +1 -1
- package/autosuggest/options-list.d.ts +4 -7
- package/autosuggest/options-list.d.ts.map +1 -1
- package/autosuggest/options-list.js +8 -9
- package/autosuggest/options-list.js.map +1 -1
- package/autosuggest/plain-list.d.ts +4 -6
- package/autosuggest/plain-list.d.ts.map +1 -1
- package/autosuggest/plain-list.js +7 -7
- package/autosuggest/plain-list.js.map +1 -1
- package/autosuggest/virtual-list.d.ts +1 -1
- package/autosuggest/virtual-list.d.ts.map +1 -1
- package/autosuggest/virtual-list.js +9 -9
- package/autosuggest/virtual-list.js.map +1 -1
- package/breadcrumb-group/item/item.d.ts.map +1 -1
- package/breadcrumb-group/item/item.js +1 -1
- package/breadcrumb-group/item/item.js.map +1 -1
- package/checkbox/internal.js +1 -1
- package/checkbox/internal.js.map +1 -1
- package/checkbox/styles.css.js +3 -3
- package/checkbox/styles.scoped.css +5 -8
- package/checkbox/styles.selectors.js +3 -3
- package/{internal/components/content-layout → content-layout}/index.d.ts +1 -1
- package/content-layout/index.d.ts.map +1 -0
- package/content-layout/index.js +39 -0
- package/content-layout/index.js.map +1 -0
- package/content-layout/interfaces.d.ts +19 -0
- package/content-layout/interfaces.d.ts.map +1 -0
- package/{internal/components/content-layout → content-layout}/interfaces.js +0 -0
- package/content-layout/interfaces.js.map +1 -0
- package/content-layout/styles.css.js +12 -0
- package/{internal/components/content-layout → content-layout}/styles.scoped.css +21 -16
- package/content-layout/styles.selectors.js +13 -0
- package/date-range-picker/embedded.d.ts.map +1 -1
- package/date-range-picker/embedded.js +3 -4
- package/date-range-picker/embedded.js.map +1 -1
- package/date-range-picker/index.d.ts.map +1 -1
- package/date-range-picker/index.js +7 -6
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/time-offset.d.ts +2 -2
- package/date-range-picker/time-offset.d.ts.map +1 -1
- package/date-range-picker/time-offset.js +2 -3
- package/date-range-picker/time-offset.js.map +1 -1
- package/date-range-picker/use-date-range-picker.d.ts +1 -1
- package/date-range-picker/use-date-range-picker.d.ts.map +1 -1
- package/date-range-picker/use-date-range-picker.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/internal/base-component/styles.scoped.css +2 -2
- package/internal/components/abstract-switch/index.d.ts +2 -1
- package/internal/components/abstract-switch/index.d.ts.map +1 -1
- package/internal/components/abstract-switch/index.js +3 -3
- package/internal/components/abstract-switch/index.js.map +1 -1
- package/internal/components/abstract-switch/styles.css.js +12 -11
- package/internal/components/abstract-switch/styles.scoped.css +27 -17
- package/internal/components/abstract-switch/styles.selectors.js +12 -11
- package/internal/components/options-list/utils/use-highlight-option.d.ts +17 -15
- package/internal/components/options-list/utils/use-highlight-option.d.ts.map +1 -1
- package/internal/components/options-list/utils/use-highlight-option.js +36 -37
- package/internal/components/options-list/utils/use-highlight-option.js.map +1 -1
- package/internal/components/options-list/utils/use-keyboard.d.ts +0 -2
- package/internal/components/options-list/utils/use-keyboard.d.ts.map +1 -1
- package/internal/components/options-list/utils/use-keyboard.js +4 -6
- package/internal/components/options-list/utils/use-keyboard.js.map +1 -1
- package/internal/components/selectable-item/index.d.ts +2 -1
- package/internal/components/selectable-item/index.d.ts.map +1 -1
- package/internal/components/selectable-item/index.js +2 -2
- package/internal/components/selectable-item/index.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/generated/theming/index.cjs +6 -6
- package/internal/generated/theming/index.js +6 -6
- package/internal/utils/date-time/format-timezone-offset.d.ts +1 -1
- package/internal/utils/date-time/format-timezone-offset.d.ts.map +1 -1
- package/internal/utils/date-time/format-timezone-offset.js +2 -1
- package/internal/utils/date-time/format-timezone-offset.js.map +1 -1
- package/internal/utils/date-time/index.d.ts +0 -1
- package/internal/utils/date-time/index.d.ts.map +1 -1
- package/internal/utils/date-time/index.js +0 -1
- package/internal/utils/date-time/index.js.map +1 -1
- package/internal/utils/date-time/parse-timezone-offset.d.ts +1 -1
- package/internal/utils/date-time/parse-timezone-offset.d.ts.map +1 -1
- package/internal/utils/date-time/parse-timezone-offset.js +7 -7
- package/internal/utils/date-time/parse-timezone-offset.js.map +1 -1
- package/internal/utils/date-time/shift-timezone-offset.d.ts +1 -1
- package/internal/utils/date-time/shift-timezone-offset.d.ts.map +1 -1
- package/internal/utils/date-time/shift-timezone-offset.js +2 -1
- package/internal/utils/date-time/shift-timezone-offset.js.map +1 -1
- package/multiselect/internal.d.ts.map +1 -1
- package/multiselect/internal.js +2 -3
- package/multiselect/internal.js.map +1 -1
- package/package.json +2 -1
- package/property-filter/controller.d.ts +2 -2
- package/property-filter/controller.d.ts.map +1 -1
- package/property-filter/controller.js +6 -1
- package/property-filter/controller.js.map +1 -1
- package/property-filter/interfaces.d.ts +5 -1
- package/property-filter/interfaces.d.ts.map +1 -1
- package/property-filter/interfaces.js.map +1 -1
- package/property-filter/property-filter-autosuggest.d.ts.map +1 -1
- package/property-filter/property-filter-autosuggest.js +12 -14
- package/property-filter/property-filter-autosuggest.js.map +1 -1
- package/property-filter/token-editor.d.ts +3 -2
- package/property-filter/token-editor.d.ts.map +1 -1
- package/property-filter/token-editor.js +66 -76
- package/property-filter/token-editor.js.map +1 -1
- package/property-filter/use-load-items.d.ts +1 -1
- package/radio-group/radio-button.js +1 -1
- package/radio-group/radio-button.js.map +1 -1
- package/radio-group/styles.css.js +9 -9
- package/radio-group/styles.scoped.css +15 -18
- package/radio-group/styles.selectors.js +9 -9
- package/select/internal.d.ts.map +1 -1
- package/select/internal.js +3 -4
- package/select/internal.js.map +1 -1
- package/select/parts/item.d.ts +2 -1
- package/select/parts/item.d.ts.map +1 -1
- package/select/parts/item.js +2 -2
- package/select/parts/item.js.map +1 -1
- package/select/parts/multiselect-item.d.ts +2 -1
- package/select/parts/multiselect-item.d.ts.map +1 -1
- package/select/parts/multiselect-item.js +2 -2
- package/select/parts/multiselect-item.js.map +1 -1
- package/select/parts/plain-list.d.ts +2 -1
- package/select/parts/plain-list.d.ts.map +1 -1
- package/select/parts/plain-list.js +4 -4
- package/select/parts/plain-list.js.map +1 -1
- package/select/parts/virtual-list.js +4 -4
- package/select/parts/virtual-list.js.map +1 -1
- package/select/utils/render-options.d.ts +3 -2
- package/select/utils/render-options.d.ts.map +1 -1
- package/select/utils/render-options.js +2 -2
- package/select/utils/render-options.js.map +1 -1
- package/select/utils/use-native-search.d.ts +1 -2
- package/select/utils/use-native-search.d.ts.map +1 -1
- package/select/utils/use-native-search.js +1 -2
- package/select/utils/use-native-search.js.map +1 -1
- package/select/utils/use-select.d.ts +2 -3
- package/select/utils/use-select.d.ts.map +1 -1
- package/select/utils/use-select.js +16 -22
- package/select/utils/use-select.js.map +1 -1
- package/tabs/tab-header-bar.d.ts.map +1 -1
- package/tabs/tab-header-bar.js +2 -2
- package/tabs/tab-header-bar.js.map +1 -1
- package/test-utils/dom/content-layout/index.d.ts +6 -0
- package/test-utils/dom/content-layout/index.js +37 -0
- package/test-utils/dom/content-layout/index.js.map +1 -0
- package/test-utils/dom/index.d.ts +3 -0
- package/test-utils/dom/index.js +10 -2
- package/test-utils/dom/index.js.map +1 -1
- package/test-utils/selectors/content-layout/index.d.ts +6 -0
- package/test-utils/selectors/content-layout/index.js +37 -0
- package/test-utils/selectors/content-layout/index.js.map +1 -0
- package/test-utils/selectors/index.d.ts +3 -0
- package/test-utils/selectors/index.js +10 -2
- package/test-utils/selectors/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/toggle/internal.js +1 -1
- package/toggle/internal.js.map +1 -1
- package/toggle/styles.css.js +8 -8
- package/toggle/styles.scoped.css +13 -16
- package/toggle/styles.selectors.js +8 -8
- package/internal/components/content-layout/index.d.ts.map +0 -1
- package/internal/components/content-layout/index.js +0 -24
- package/internal/components/content-layout/index.js.map +0 -1
- package/internal/components/content-layout/interfaces.d.ts +0 -7
- package/internal/components/content-layout/interfaces.d.ts.map +0 -1
- package/internal/components/content-layout/interfaces.js.map +0 -1
- package/internal/components/content-layout/styles.css.js +0 -12
- package/internal/components/content-layout/styles.selectors.js +0 -13
- package/internal/utils/date-time/get-browser-timezone-offset.d.ts +0 -7
- package/internal/utils/date-time/get-browser-timezone-offset.d.ts.map +0 -1
- package/internal/utils/date-time/get-browser-timezone-offset.js +0 -11
- package/internal/utils/date-time/get-browser-timezone-offset.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-timezone-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-timezone-offset.ts"],"names":[],"mappings":"AAKA,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"format-timezone-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-timezone-offset.ts"],"names":[],"mappings":"AAKA,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,UAS7E"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { padLeftZeros } from '../strings';
|
|
4
|
-
export function formatTimezoneOffset(offsetInMinutes) {
|
|
4
|
+
export function formatTimezoneOffset(isoDate, offsetInMinutes) {
|
|
5
|
+
offsetInMinutes = offsetInMinutes !== null && offsetInMinutes !== void 0 ? offsetInMinutes : 0 - new Date(isoDate).getTimezoneOffset();
|
|
5
6
|
var hoursOffset = padLeftZeros(Math.floor(Math.abs(offsetInMinutes) / 60).toFixed(0), 2);
|
|
6
7
|
var minuteOffset = padLeftZeros(Math.abs(offsetInMinutes % 60).toFixed(0), 2);
|
|
7
8
|
var sign = offsetInMinutes < 0 ? '-' : '+';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-timezone-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-timezone-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,UAAU,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"format-timezone-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-timezone-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,eAAwB;IAC5E,eAAe,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAC/E,IAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3F,IAAM,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEhF,IAAM,IAAI,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAC7C,IAAM,eAAe,GAAG,UAAG,IAAI,SAAG,WAAW,cAAI,YAAY,CAAE,CAAC;IAEhE,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { padLeftZeros } from '../strings';\n\nexport function formatTimezoneOffset(isoDate: string, offsetInMinutes?: number) {\n offsetInMinutes = offsetInMinutes ?? 0 - new Date(isoDate).getTimezoneOffset();\n const hoursOffset = padLeftZeros(Math.floor(Math.abs(offsetInMinutes) / 60).toFixed(0), 2);\n const minuteOffset = padLeftZeros(Math.abs(offsetInMinutes % 60).toFixed(0), 2);\n\n const sign = offsetInMinutes < 0 ? '-' : '+';\n const formattedOffset = `${sign}${hoursOffset}:${minuteOffset}`;\n\n return formattedOffset;\n}\n"]}
|
|
@@ -2,7 +2,6 @@ export { isoToDisplay, displayToIso } from './display-format';
|
|
|
2
2
|
export { formatDate } from './format-date';
|
|
3
3
|
export { formatTime } from './format-time';
|
|
4
4
|
export { formatTimezoneOffset } from './format-timezone-offset';
|
|
5
|
-
export { getBrowserTimezoneOffset } from './get-browser-timezone-offset';
|
|
6
5
|
export { isIsoDateOnly } from './is-iso-date-only';
|
|
7
6
|
export { joinDateTime } from './join-date-time';
|
|
8
7
|
export { parseDate } from './parse-date';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -4,7 +4,6 @@ export { isoToDisplay, displayToIso } from './display-format';
|
|
|
4
4
|
export { formatDate } from './format-date';
|
|
5
5
|
export { formatTime } from './format-time';
|
|
6
6
|
export { formatTimezoneOffset } from './format-timezone-offset';
|
|
7
|
-
export { getBrowserTimezoneOffset } from './get-browser-timezone-offset';
|
|
8
7
|
export { isIsoDateOnly } from './is-iso-date-only';
|
|
9
8
|
export { joinDateTime } from './join-date-time';
|
|
10
9
|
export { parseDate } from './parse-date';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport { isoToDisplay, displayToIso } from './display-format';\nexport { formatDate } from './format-date';\nexport { formatTime } from './format-time';\nexport { formatTimezoneOffset } from './format-timezone-offset';\nexport { isIsoDateOnly } from './is-iso-date-only';\nexport { joinDateTime } from './join-date-time';\nexport { parseDate } from './parse-date';\nexport { parseTimezoneOffset } from './parse-timezone-offset';\nexport { shiftTimezoneOffset } from './shift-timezone-offset';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-timezone-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/parse-timezone-offset.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-timezone-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/parse-timezone-offset.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAgB3D"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { getBrowserTimezoneOffset } from './get-browser-timezone-offset';
|
|
4
3
|
/**
|
|
5
4
|
* Extracts timezone offset from ISO8601 date string.
|
|
6
5
|
*/
|
|
7
|
-
export function parseTimezoneOffset(
|
|
8
|
-
var _a =
|
|
9
|
-
var
|
|
6
|
+
export function parseTimezoneOffset(isoDate) {
|
|
7
|
+
var _a = isoDate.split('T'), _b = _a[1], time = _b === void 0 ? '' : _b;
|
|
8
|
+
var _c = time.split(/(-|\+)/), signCharacter = _c[1], offsetPart = _c[2];
|
|
10
9
|
if (signCharacter && offsetPart) {
|
|
11
|
-
var
|
|
10
|
+
var _d = offsetPart.split(':'), offsetHours = _d[0], offsetMinutes = _d[1];
|
|
12
11
|
return Number(signCharacter + '1') * (Number(offsetHours) * 60 + Number(offsetMinutes));
|
|
13
12
|
}
|
|
14
|
-
var utcTimezoneIndicator =
|
|
13
|
+
var utcTimezoneIndicator = isoDate.indexOf('Z');
|
|
15
14
|
if (utcTimezoneIndicator !== -1) {
|
|
16
15
|
return 0;
|
|
17
16
|
}
|
|
18
|
-
|
|
17
|
+
var date = new Date(isoDate);
|
|
18
|
+
return 0 - date.getTimezoneOffset();
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=parse-timezone-offset.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-timezone-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/parse-timezone-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC
|
|
1
|
+
{"version":3,"file":"parse-timezone-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/parse-timezone-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe;IAC3C,IAAA,KAAgB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAA/B,UAAS,EAAT,IAAI,mBAAG,EAAE,KAAsB,CAAC;IACnC,IAAA,KAAgC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAjD,aAAa,QAAA,EAAE,UAAU,QAAwB,CAAC;IAE3D,IAAI,aAAa,IAAI,UAAU,EAAE;QACzB,IAAA,KAA+B,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAAnD,WAAW,QAAA,EAAE,aAAa,QAAyB,CAAC;QAC3D,OAAO,MAAM,CAAC,aAAa,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;KACzF;IAED,IAAM,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClD,IAAI,oBAAoB,KAAK,CAAC,CAAC,EAAE;QAC/B,OAAO,CAAC,CAAC;KACV;IAED,IAAM,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;AACtC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Extracts timezone offset from ISO8601 date string.\n */\nexport function parseTimezoneOffset(isoDate: string): number {\n const [, time = ''] = isoDate.split('T');\n const [, signCharacter, offsetPart] = time.split(/(-|\\+)/);\n\n if (signCharacter && offsetPart) {\n const [offsetHours, offsetMinutes] = offsetPart.split(':');\n return Number(signCharacter + '1') * (Number(offsetHours) * 60 + Number(offsetMinutes));\n }\n\n const utcTimezoneIndicator = isoDate.indexOf('Z');\n if (utcTimezoneIndicator !== -1) {\n return 0;\n }\n\n const date = new Date(isoDate);\n return 0 - date.getTimezoneOffset();\n}\n"]}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* shiftTimezoneOffset("2020-01-01T09:00:00+03:00", 2 * 60) === "2020-01-01T08:00:00"
|
|
9
9
|
* ```
|
|
10
10
|
*/
|
|
11
|
-
export declare function shiftTimezoneOffset(dateString: string, targetTimezoneOffset
|
|
11
|
+
export declare function shiftTimezoneOffset(dateString: string, targetTimezoneOffset?: number): string;
|
|
12
12
|
//# sourceMappingURL=shift-timezone-offset.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shift-timezone-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/shift-timezone-offset.ts"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"shift-timezone-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/shift-timezone-offset.ts"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,UAWpF"}
|
|
@@ -16,11 +16,12 @@ import { parseTimezoneOffset } from './parse-timezone-offset';
|
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
export function shiftTimezoneOffset(dateString, targetTimezoneOffset) {
|
|
19
|
-
var _a = dateString.split('T'), datePart = _a[0],
|
|
19
|
+
var _a = dateString.split('T'), datePart = _a[0], _b = _a[1], timeAndOffsetPart = _b === void 0 ? '' : _b;
|
|
20
20
|
var timePart = timeAndOffsetPart.split(/-|\+|Z/)[0];
|
|
21
21
|
var valueWithoutOffset = joinDateTime(datePart, timePart);
|
|
22
22
|
var originalTimezoneOffset = parseTimezoneOffset(dateString);
|
|
23
23
|
var date = new Date(valueWithoutOffset);
|
|
24
|
+
targetTimezoneOffset = targetTimezoneOffset !== null && targetTimezoneOffset !== void 0 ? targetTimezoneOffset : 0 - date.getTimezoneOffset();
|
|
24
25
|
var adjustedDate = addMinutes(date, targetTimezoneOffset - originalTimezoneOffset);
|
|
25
26
|
return joinDateTime(formatDate(adjustedDate), formatTime(adjustedDate));
|
|
26
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shift-timezone-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/shift-timezone-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"shift-timezone-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/shift-timezone-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAkB,EAAE,oBAA6B;IAC7E,IAAA,KAAqC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAAzD,QAAQ,QAAA,EAAE,UAAsB,EAAtB,iBAAiB,mBAAG,EAAE,KAAyB,CAAC;IAC1D,IAAA,QAAQ,GAAI,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,GAArC,CAAsC;IACrD,IAAM,kBAAkB,GAAG,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC5D,IAAM,sBAAsB,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAE/D,IAAM,IAAI,GAAG,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC1C,oBAAoB,GAAG,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,CAAC,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC5E,IAAM,YAAY,GAAG,UAAU,CAAC,IAAI,EAAE,oBAAoB,GAAG,sBAAsB,CAAC,CAAC;IAErF,OAAO,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { addMinutes } from 'date-fns';\nimport { joinDateTime } from '.';\nimport { formatDate } from './format-date';\nimport { formatTime } from './format-time';\nimport { parseTimezoneOffset } from './parse-timezone-offset';\n\n/**\n * Re-formats an ISO8601 date string so that it is expressed using the\n * target timezone offset. The returned date string still represents the\n * same instant in time, but contains no visible offset.\n *\n * Example:\n * ```\n * shiftTimezoneOffset(\"2020-01-01T09:00:00+03:00\", 2 * 60) === \"2020-01-01T08:00:00\"\n * ```\n */\nexport function shiftTimezoneOffset(dateString: string, targetTimezoneOffset?: number) {\n const [datePart, timeAndOffsetPart = ''] = dateString.split('T');\n const [timePart] = timeAndOffsetPart.split(/-|\\+|Z/);\n const valueWithoutOffset = joinDateTime(datePart, timePart);\n const originalTimezoneOffset = parseTimezoneOffset(dateString);\n\n const date = new Date(valueWithoutOffset);\n targetTimezoneOffset = targetTimezoneOffset ?? 0 - date.getTimezoneOffset();\n const adjustedDate = addMinutes(date, targetTimezoneOffset - originalTimezoneOffset);\n\n return joinDateTime(formatDate(adjustedDate), formatTime(adjustedDate));\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AA0B3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AA0B3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,QAAA,MAAM,mBAAmB,4HA0QxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/multiselect/internal.js
CHANGED
|
@@ -90,13 +90,12 @@ var InternalMultiselect = React.forwardRef(function (_a, externalRef) {
|
|
|
90
90
|
fireLoadItems: fireLoadItems,
|
|
91
91
|
setFilteringValue: setFilteringValue,
|
|
92
92
|
useInteractiveGroups: useInteractiveGroups
|
|
93
|
-
}), isOpen = _o.isOpen,
|
|
93
|
+
}), isOpen = _o.isOpen, highlightType = _o.highlightType, highlightedOption = _o.highlightedOption, highlightedIndex = _o.highlightedIndex, getTriggerProps = _o.getTriggerProps, getFilterProps = _o.getFilterProps, getMenuProps = _o.getMenuProps, getOptionProps = _o.getOptionProps, highlightOption = _o.highlightOption, announceSelected = _o.announceSelected;
|
|
94
94
|
var handleNativeSearch = useNativeSearch({
|
|
95
95
|
isEnabled: filteringType === 'none' && isOpen,
|
|
96
96
|
options: filteredOptions,
|
|
97
97
|
highlightOption: highlightOption,
|
|
98
98
|
highlightedOption: highlightedOption === null || highlightedOption === void 0 ? void 0 : highlightedOption.option,
|
|
99
|
-
isKeyboard: isKeyboard,
|
|
100
99
|
useInteractiveGroups: useInteractiveGroups
|
|
101
100
|
});
|
|
102
101
|
var isEmpty = !options || options.length === 0;
|
|
@@ -164,7 +163,7 @@ var InternalMultiselect = React.forwardRef(function (_a, externalRef) {
|
|
|
164
163
|
var mergedRef = useMergeRefs(rootRef, __internalRootRef);
|
|
165
164
|
return (React.createElement("div", __assign({}, baseProps, { ref: mergedRef, className: clsx(styles.root, baseProps.className), onKeyPress: handleNativeSearch }),
|
|
166
165
|
React.createElement(Dropdown, { open: isOpen, trigger: trigger, header: filter, onMouseDown: handleMouseDown, footer: dropdownStatus.isSticky ? React.createElement(DropdownFooter, { content: dropdownStatus.content }) : null, expandToViewport: expandToViewport },
|
|
167
|
-
React.createElement(ListComponent, { listBottom: !dropdownStatus.isSticky ? React.createElement(DropdownFooter, { content: dropdownStatus.content }) : null, menuProps: menuProps, getOptionProps: getOptionProps, filteredOptions: filteredOptions, filteringValue: filteringValue, ref: scrollToIndex, hasDropdownStatus: dropdownStatus.content !== null, checkboxes: true, useInteractiveGroups: useInteractiveGroups, screenReaderContent: announcement,
|
|
166
|
+
React.createElement(ListComponent, { listBottom: !dropdownStatus.isSticky ? React.createElement(DropdownFooter, { content: dropdownStatus.content }) : null, menuProps: menuProps, getOptionProps: getOptionProps, filteredOptions: filteredOptions, filteringValue: filteringValue, ref: scrollToIndex, hasDropdownStatus: dropdownStatus.content !== null, checkboxes: true, useInteractiveGroups: useInteractiveGroups, screenReaderContent: announcement, highlightType: highlightType })),
|
|
168
167
|
showTokens && (React.createElement(TokenGroup, { limit: tokenLimit, items: tokens, onDismiss: handleTokenDismiss, i18nStrings: tokenGroupI18nStrings }))));
|
|
169
168
|
});
|
|
170
169
|
export default InternalMultiselect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,oDAAoD,CAAC;AAE7E,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAErF,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAa,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iCA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AAqB,GAClC,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { isGroup } from '../internal/components/option/utils/filter-options';\n\nimport DropdownFooter from '../internal/components/dropdown-footer/index.js';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport Dropdown from '../internal/components/dropdown';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\n\nimport { useSelect, MenuProps } from '../select/utils/use-select';\nimport { useNativeSearch } from '../select/utils/use-native-search';\nimport { useLoadItems } from '../select/utils/use-load-items';\nimport { useAnnouncement } from '../select/utils/use-announcement';\nimport { findOptionIndex } from '../select/utils/connect-options';\nimport PlainList, { SelectListProps } from '../select/parts/plain-list';\nimport VirtualList from '../select/parts/virtual-list';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field.js';\nimport Filter from '../select/parts/filter';\nimport Trigger from '../select/parts/trigger';\n\nimport TokenGroup, { TokenGroupProps } from '../token-group/index.js';\n\nimport { MultiselectProps } from './interfaces';\nimport styles from './styles.css.js';\n\ntype InternalMultiselectProps = MultiselectProps & InternalBaseComponentProps;\n\nconst InternalMultiselect = React.forwardRef(\n (\n {\n options = [],\n filteringType = 'none',\n filteringPlaceholder,\n filteringAriaLabel,\n ariaRequired,\n placeholder,\n disabled,\n ariaLabel,\n statusType = 'finished',\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n noMatch,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n selectedOptions = [],\n deselectAriaLabel,\n keepOpen = true,\n tokenLimit,\n i18nStrings,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n virtualScroll,\n hideTokens = false,\n expandToViewport,\n __internalRootRef = null,\n ...restProps\n }: InternalMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n checkOptionValueField('Multiselect', 'options', options);\n\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n const useInteractiveGroups = true;\n const [filteringValue, setFilteringValue] = useState('');\n const { filteredOptions, parentMap } = prepareOptions(options, filteringType, filteringValue);\n\n const updateSelectedOption = useCallback(\n (option: OptionDefinition | OptionGroup) => {\n const filtered = filteredOptions.filter(item => item.type !== 'parent').map(item => item.option);\n\n // switch between selection and deselection behavior, ignores disabled options to prevent\n // getting stuck on one behavior when an option is disabled and its state cannot be changed\n const isAllChildrenSelected = (optionsArray: OptionDefinition[]) =>\n optionsArray.every(item => findOptionIndex(selectedOptions, item) > -1 || item.disabled);\n const intersection = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) > -1 && !item.disabled);\n const union = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) === -1).concat(options);\n const select = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return union(selectedOptions, options);\n };\n const unselect = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return selectedOptions.filter(option => findOptionIndex(options, option) === -1);\n };\n let newSelectedOptions = [...selectedOptions];\n\n if (isGroup(option)) {\n const visibleOptions = intersection([...option.options], filtered);\n newSelectedOptions = isAllChildrenSelected(visibleOptions)\n ? unselect(visibleOptions, newSelectedOptions)\n : select(visibleOptions, newSelectedOptions);\n } else {\n newSelectedOptions = isAllChildrenSelected([option])\n ? unselect([option], newSelectedOptions)\n : select([option], newSelectedOptions);\n }\n\n fireNonCancelableEvent(onChange, {\n selectedOptions: newSelectedOptions,\n });\n },\n [onChange, selectedOptions, filteredOptions]\n );\n\n const rootRef = useRef<HTMLDivElement>(null);\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightedOption,\n highlightedIndex,\n highlightedType,\n getTriggerProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n isKeyboard,\n highlightOption,\n announceSelected,\n } = useSelect({\n selectedOptions,\n updateSelectedOption,\n options: filteredOptions,\n filteringType,\n onFocus,\n onBlur,\n externalRef,\n keepOpen,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups,\n });\n\n const handleNativeSearch = useNativeSearch({\n isEnabled: filteringType === 'none' && isOpen,\n options: filteredOptions,\n highlightOption: highlightOption,\n highlightedOption: highlightedOption?.option,\n isKeyboard,\n useInteractiveGroups,\n });\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n onRecoveryClick: handleRecoveryClick,\n });\n\n const filter = (\n <Filter\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n {...getFilterProps()}\n />\n );\n\n const trigger = (\n <Trigger\n placeholder={placeholder}\n disabled={disabled}\n ariaLabel={ariaLabel}\n triggerProps={getTriggerProps(disabled)}\n selectedOption={null}\n isOpen={isOpen}\n {...formFieldContext}\n controlId={controlId}\n />\n );\n\n const menuProps: MenuProps = {\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: controlId,\n };\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({\n label: option.label,\n disabled: disabled || option.disabled,\n labelTag: option.labelTag,\n description: option.description,\n iconAlt: option.iconAlt,\n iconName: option.iconName,\n iconUrl: option.iconUrl,\n iconSvg: option.iconSvg,\n tags: option.tags,\n dismissLabel: deselectAriaLabel ? deselectAriaLabel(option) : undefined,\n }));\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const handleMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const showTokens = !hideTokens && tokens.length > 0;\n const handleTokenDismiss: TokenGroupProps['onDismiss'] = ({ detail }) => {\n const optionToDeselect = selectedOptions[detail.itemIndex];\n updateSelectedOption(optionToDeselect);\n const targetRef = getTriggerProps().ref;\n if (targetRef.current) {\n targetRef.current.focus();\n }\n };\n\n const tokenGroupI18nStrings: TokenGroupProps.I18nStrings = {\n limitShowFewer: i18nStrings?.tokenLimitShowFewer,\n limitShowMore: i18nStrings?.tokenLimitShowMore,\n };\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(styles.root, baseProps.className)}\n onKeyPress={handleNativeSearch}\n >\n <Dropdown\n open={isOpen}\n trigger={trigger}\n header={filter}\n onMouseDown={handleMouseDown}\n footer={dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} /> : null}\n expandToViewport={expandToViewport}\n >\n <ListComponent\n listBottom={!dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} /> : null}\n menuProps={menuProps}\n getOptionProps={getOptionProps}\n filteredOptions={filteredOptions}\n filteringValue={filteringValue}\n ref={scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n checkboxes={true}\n useInteractiveGroups={useInteractiveGroups}\n screenReaderContent={announcement}\n highlightedType={highlightedType}\n />\n </Dropdown>\n {showTokens && (\n <TokenGroup\n limit={tokenLimit}\n items={tokens}\n onDismiss={handleTokenDismiss}\n i18nStrings={tokenGroupI18nStrings}\n />\n )}\n </div>\n );\n }\n);\n\nexport default InternalMultiselect;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/multiselect/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,oDAAoD,CAAC;AAE7E,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAErF,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAa,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,eAA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AAE,kBAAkB,EAC7B,WAAW,EAAE,qBAAqB,GAClC,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { isGroup } from '../internal/components/option/utils/filter-options';\n\nimport DropdownFooter from '../internal/components/dropdown-footer/index.js';\nimport { prepareOptions } from '../internal/components/option/utils/prepare-options';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport Dropdown from '../internal/components/dropdown';\nimport { useDropdownStatus } from '../internal/components/dropdown-status';\n\nimport { useSelect, MenuProps } from '../select/utils/use-select';\nimport { useNativeSearch } from '../select/utils/use-native-search';\nimport { useLoadItems } from '../select/utils/use-load-items';\nimport { useAnnouncement } from '../select/utils/use-announcement';\nimport { findOptionIndex } from '../select/utils/connect-options';\nimport PlainList, { SelectListProps } from '../select/parts/plain-list';\nimport VirtualList from '../select/parts/virtual-list';\nimport { checkOptionValueField } from '../select/utils/check-option-value-field.js';\nimport Filter from '../select/parts/filter';\nimport Trigger from '../select/parts/trigger';\n\nimport TokenGroup, { TokenGroupProps } from '../token-group/index.js';\n\nimport { MultiselectProps } from './interfaces';\nimport styles from './styles.css.js';\n\ntype InternalMultiselectProps = MultiselectProps & InternalBaseComponentProps;\n\nconst InternalMultiselect = React.forwardRef(\n (\n {\n options = [],\n filteringType = 'none',\n filteringPlaceholder,\n filteringAriaLabel,\n ariaRequired,\n placeholder,\n disabled,\n ariaLabel,\n statusType = 'finished',\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n noMatch,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n selectedOptions = [],\n deselectAriaLabel,\n keepOpen = true,\n tokenLimit,\n i18nStrings,\n onBlur,\n onFocus,\n onLoadItems,\n onChange,\n virtualScroll,\n hideTokens = false,\n expandToViewport,\n __internalRootRef = null,\n ...restProps\n }: InternalMultiselectProps,\n externalRef: React.Ref<MultiselectProps.Ref>\n ) => {\n checkOptionValueField('Multiselect', 'options', options);\n\n const baseProps = getBaseProps(restProps);\n const formFieldContext = useFormFieldContext(restProps);\n\n const { handleLoadMore, handleRecoveryClick, fireLoadItems } = useLoadItems({\n onLoadItems,\n options,\n statusType,\n });\n const useInteractiveGroups = true;\n const [filteringValue, setFilteringValue] = useState('');\n const { filteredOptions, parentMap } = prepareOptions(options, filteringType, filteringValue);\n\n const updateSelectedOption = useCallback(\n (option: OptionDefinition | OptionGroup) => {\n const filtered = filteredOptions.filter(item => item.type !== 'parent').map(item => item.option);\n\n // switch between selection and deselection behavior, ignores disabled options to prevent\n // getting stuck on one behavior when an option is disabled and its state cannot be changed\n const isAllChildrenSelected = (optionsArray: OptionDefinition[]) =>\n optionsArray.every(item => findOptionIndex(selectedOptions, item) > -1 || item.disabled);\n const intersection = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) > -1 && !item.disabled);\n const union = (visibleOptions: OptionDefinition[], options: OptionDefinition[]) =>\n visibleOptions.filter(item => findOptionIndex(options, item) === -1).concat(options);\n const select = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return union(selectedOptions, options);\n };\n const unselect = (options: OptionDefinition[], selectedOptions: OptionDefinition[]) => {\n return selectedOptions.filter(option => findOptionIndex(options, option) === -1);\n };\n let newSelectedOptions = [...selectedOptions];\n\n if (isGroup(option)) {\n const visibleOptions = intersection([...option.options], filtered);\n newSelectedOptions = isAllChildrenSelected(visibleOptions)\n ? unselect(visibleOptions, newSelectedOptions)\n : select(visibleOptions, newSelectedOptions);\n } else {\n newSelectedOptions = isAllChildrenSelected([option])\n ? unselect([option], newSelectedOptions)\n : select([option], newSelectedOptions);\n }\n\n fireNonCancelableEvent(onChange, {\n selectedOptions: newSelectedOptions,\n });\n },\n [onChange, selectedOptions, filteredOptions]\n );\n\n const rootRef = useRef<HTMLDivElement>(null);\n\n const selfControlId = useUniqueId('trigger');\n const controlId = formFieldContext.controlId ?? selfControlId;\n\n const scrollToIndex = useRef<SelectListProps.SelectListRef>(null);\n const {\n isOpen,\n highlightType,\n highlightedOption,\n highlightedIndex,\n getTriggerProps,\n getFilterProps,\n getMenuProps,\n getOptionProps,\n highlightOption,\n announceSelected,\n } = useSelect({\n selectedOptions,\n updateSelectedOption,\n options: filteredOptions,\n filteringType,\n onFocus,\n onBlur,\n externalRef,\n keepOpen,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups,\n });\n\n const handleNativeSearch = useNativeSearch({\n isEnabled: filteringType === 'none' && isOpen,\n options: filteredOptions,\n highlightOption: highlightOption,\n highlightedOption: highlightedOption?.option,\n useInteractiveGroups,\n });\n\n const isEmpty = !options || options.length === 0;\n const isNoMatch = filteredOptions && filteredOptions.length === 0;\n const dropdownStatus = useDropdownStatus({\n statusType,\n empty,\n loadingText,\n finishedText,\n errorText,\n recoveryText,\n isEmpty,\n isNoMatch,\n noMatch,\n onRecoveryClick: handleRecoveryClick,\n });\n\n const filter = (\n <Filter\n filteringType={filteringType}\n placeholder={filteringPlaceholder}\n ariaLabel={filteringAriaLabel}\n ariaRequired={ariaRequired}\n value={filteringValue}\n {...getFilterProps()}\n />\n );\n\n const trigger = (\n <Trigger\n placeholder={placeholder}\n disabled={disabled}\n ariaLabel={ariaLabel}\n triggerProps={getTriggerProps(disabled)}\n selectedOption={null}\n isOpen={isOpen}\n {...formFieldContext}\n controlId={controlId}\n />\n );\n\n const menuProps: MenuProps = {\n ...getMenuProps(),\n onLoadMore: handleLoadMore,\n ariaLabelledby: controlId,\n };\n\n const announcement = useAnnouncement({\n announceSelected,\n highlightedOption,\n getParent: option => parentMap.get(option)?.option as undefined | OptionGroup,\n selectedAriaLabel,\n renderHighlightedAriaLive,\n });\n\n const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({\n label: option.label,\n disabled: disabled || option.disabled,\n labelTag: option.labelTag,\n description: option.description,\n iconAlt: option.iconAlt,\n iconName: option.iconName,\n iconUrl: option.iconUrl,\n iconSvg: option.iconSvg,\n tags: option.tags,\n dismissLabel: deselectAriaLabel ? deselectAriaLabel(option) : undefined,\n }));\n\n useEffect(() => {\n scrollToIndex.current?.(highlightedIndex);\n }, [highlightedIndex]);\n\n const ListComponent = virtualScroll ? VirtualList : PlainList;\n\n const handleMouseDown = (event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (target !== document.activeElement) {\n // prevent currently focused element from losing it\n event.preventDefault();\n }\n };\n\n const showTokens = !hideTokens && tokens.length > 0;\n const handleTokenDismiss: TokenGroupProps['onDismiss'] = ({ detail }) => {\n const optionToDeselect = selectedOptions[detail.itemIndex];\n updateSelectedOption(optionToDeselect);\n const targetRef = getTriggerProps().ref;\n if (targetRef.current) {\n targetRef.current.focus();\n }\n };\n\n const tokenGroupI18nStrings: TokenGroupProps.I18nStrings = {\n limitShowFewer: i18nStrings?.tokenLimitShowFewer,\n limitShowMore: i18nStrings?.tokenLimitShowMore,\n };\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(styles.root, baseProps.className)}\n onKeyPress={handleNativeSearch}\n >\n <Dropdown\n open={isOpen}\n trigger={trigger}\n header={filter}\n onMouseDown={handleMouseDown}\n footer={dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} /> : null}\n expandToViewport={expandToViewport}\n >\n <ListComponent\n listBottom={!dropdownStatus.isSticky ? <DropdownFooter content={dropdownStatus.content} /> : null}\n menuProps={menuProps}\n getOptionProps={getOptionProps}\n filteredOptions={filteredOptions}\n filteringValue={filteringValue}\n ref={scrollToIndex}\n hasDropdownStatus={dropdownStatus.content !== null}\n checkboxes={true}\n useInteractiveGroups={useInteractiveGroups}\n screenReaderContent={announcement}\n highlightType={highlightType}\n />\n </Dropdown>\n {showTokens && (\n <TokenGroup\n limit={tokenLimit}\n items={tokens}\n onDismiss={handleTokenDismiss}\n i18nStrings={tokenGroupI18nStrings}\n />\n )}\n </div>\n );\n }\n);\n\nexport default InternalMultiselect;\n"]}
|
package/package.json
CHANGED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"./collection-preferences": "./collection-preferences/index.js",
|
|
49
49
|
"./column-layout": "./column-layout/index.js",
|
|
50
50
|
"./container": "./container/index.js",
|
|
51
|
+
"./content-layout": "./content-layout/index.js",
|
|
51
52
|
"./date-picker": "./date-picker/index.js",
|
|
52
53
|
"./date-range-picker": "./date-range-picker/index.js",
|
|
53
54
|
"./expandable-section": "./expandable-section/index.js",
|
|
@@ -110,6 +111,6 @@
|
|
|
110
111
|
"./internal/base-component/index.js",
|
|
111
112
|
"./internal/base-component/styles.css.js"
|
|
112
113
|
],
|
|
113
|
-
"version": "3.0.
|
|
114
|
+
"version": "3.0.35",
|
|
114
115
|
"license": "Apache-2.0"
|
|
115
116
|
}
|
|
@@ -23,7 +23,7 @@ export declare type ParsedText = {
|
|
|
23
23
|
value: string;
|
|
24
24
|
};
|
|
25
25
|
export declare const getAllowedOperators: (property: PropertyFilterProps.FilteringProperty) => PropertyFilterProps.ComparisonOperator[];
|
|
26
|
-
export declare const parseText: (filteringText: string, filteringProperties: readonly
|
|
26
|
+
export declare const parseText: (filteringText: string, filteringProperties: readonly PropertyFilterProps.FilteringProperty[] | undefined, disableFreeTextFiltering: boolean) => ParsedText;
|
|
27
27
|
export declare const getPropertyOptions: (filteringProperty: PropertyFilterProps.FilteringProperty, filteringOptions: PropertyFilterProps['filteringOptions']) => import("@cloudscape-design/collection-hooks").PropertyFilterOption[] | undefined;
|
|
28
28
|
interface OptionGroup<T> {
|
|
29
29
|
label: string;
|
|
@@ -33,7 +33,7 @@ interface ExtendedAutosuggestOption extends AutosuggestProps.Option {
|
|
|
33
33
|
tokenValue: string;
|
|
34
34
|
}
|
|
35
35
|
export declare const getAllValueSuggestions: (filteringOptions: PropertyFilterProps['filteringOptions'], filteringProperties: PropertyFilterProps['filteringProperties'], operator: PropertyFilterProps.ComparisonOperator | undefined, i18nStrings: Pick<PropertyFilterProps.I18nStrings, 'groupValuesText'>, customGroupsText: PropertyFilterProps['customGroupsText']) => OptionGroup<ExtendedAutosuggestOption>[];
|
|
36
|
-
export declare const getPropertyByKey: (filteringProperties: PropertyFilterProps['filteringProperties'], key: string) =>
|
|
36
|
+
export declare const getPropertyByKey: (filteringProperties: PropertyFilterProps['filteringProperties'], key: string) => PropertyFilterProps.FilteringProperty | undefined;
|
|
37
37
|
export declare function getPropertySuggestions<T>(filteringProperties: PropertyFilterProps['filteringProperties'], customGroupsText: PropertyFilterProps['customGroupsText'], i18nStrings: Pick<PropertyFilterProps['i18nStrings'], 'groupPropertiesText'>, filteringPropertyToOption: (filteringProperty: PropertyFilterProps.FilteringProperty) => T): OptionGroup<T>[];
|
|
38
38
|
export declare type OperatorStrings = 'operatorLessText' | 'operatorLessOrEqualText' | 'operatorGreaterText' | 'operatorGreaterOrEqualText' | 'operatorContainsText' | 'operatorDoesNotContainText' | 'operatorEqualsText' | 'operatorDoesNotEqualText';
|
|
39
39
|
export declare const getAutosuggestOptions: (parsedText: ParsedText, filteringOptions: PropertyFilterProps['filteringOptions'], filteringProperties: PropertyFilterProps['filteringProperties'], customGroupsText: PropertyFilterProps['customGroupsText'], i18nStrings: Pick<PropertyFilterProps['i18nStrings'], 'groupPropertiesText' | 'groupValuesText' | 'operatorsText' | OperatorStrings>) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":"AA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AkB,GAAG,SAAS,eAC/C,KAAK,oBAAoB,WAAW,EAAE,iBAAiB,CAAC,oBACnD,mBAAmB,CAAC,kBAAkB,CAAC,6CAoC1D,CAAC;AAEF,eAAO,MAAM,gBAAgB,wBAAyB,mBAAmB,CAAC,qBAAqB,CAAC,OAAO,MAAM,sDAS5G,CAAC;AAOF,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,mBAAmB,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,EAC/D,gBAAgB,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,EACzD,WAAW,EAAE,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,EAAE,qBAAqB,CAAC,EAC5E,yBAAyB,EAAE,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,iBAAiB,KAAK,CAAC,oBA2B3F;AAED,oBAAY,eAAe,GACvB,kBAAkB,GAClB,yBAAyB,GACzB,qBAAqB,GACrB,4BAA4B,GAC5B,sBAAsB,GACtB,4BAA4B,GAC5B,oBAAoB,GACpB,0BAA0B,CAAC;AAC/B,eAAO,MAAM,qBAAqB,eACpB,UAAU,oBACJ,mBAAmB,CAAC,kBAAkB,CAAC,uBACpC,mBAAmB,CAAC,qBAAqB,CAAC,oBAC7C,mBAAmB,CAAC,kBAAkB,CAAC,eAC5C,KACX,mBAAmB,CAAC,aAAa,CAAC,EAClC,qBAAqB,GAAG,iBAAiB,GAAG,eAAe,GAAG,eAAe,CAC9E;;;;;;;;;;;;;;;;CAqEF,CAAC;AAEF,eAAO,MAAM,qBAAqB,aACtB,oBAAoB,kBAAkB,eACnC,KAAK,mBAAmB,CAAC,aAAa,CAAC,EAAE,eAAe,CAAC,WAavE,CAAC"}
|
|
@@ -47,7 +47,12 @@ export var getAllowedOperators = function (property) {
|
|
|
47
47
|
var operators = property.operators, defaultOperator = property.defaultOperator;
|
|
48
48
|
var operatorOrder = ['=', '!=', ':', '!:', '>=', '<=', '<', '>'];
|
|
49
49
|
var operatorSet = (_a = {}, _a[defaultOperator !== null && defaultOperator !== void 0 ? defaultOperator : '='] = true, _a);
|
|
50
|
-
|
|
50
|
+
// TODO: remove unknown type annotation once extended operators are supported.
|
|
51
|
+
operators === null || operators === void 0 ? void 0 : operators.forEach(function (op) {
|
|
52
|
+
if (typeof op === 'string') {
|
|
53
|
+
operatorSet[op] = true;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
51
56
|
return operatorOrder.filter(function (op) { return operatorSet[op]; });
|
|
52
57
|
};
|
|
53
58
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/property-filter/controller.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEhH,MAAM,CAAC,IAAM,eAAe,GAAG,UAC7B,KAAmC,EACnC,QAAyC,EACzC,QAAyC,EACzC,YAA6C;IAErC,IAAA,MAAM,GAAgB,KAAK,OAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;IACpC,IAAM,YAAY,GAAG,UAAC,MAA4C,EAAE,SAA4C;QAC9G,OAAA,sBAAsB,CAAC,QAAQ,EAAE,EAAE,MAAM,QAAA,EAAE,SAAS,WAAA,EAAE,CAAC;IAAvD,CAAuD,CAAC;IAC1D,IAAM,QAAQ,GAAG,UAAC,KAAa,EAAE,QAAmC;QAClE,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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BAAqB;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,UACnC,QAAgD,EAChD,WAAsE;;IAEtE,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\nimport { PropertyFilterProps } from './interfaces';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { InputProps } from '../input/interfaces';\nimport { matchFilteringProperty, matchOperator, matchOperatorPrefix, trimFirstSpace, trimStart } from './utils';\n\nexport const getQueryActions = (\n query: PropertyFilterProps['query'],\n onChange: PropertyFilterProps['onChange'],\n inputRef: React.RefObject<InputProps.Ref>,\n preventFocus: React.MutableRefObject<boolean>\n) => {\n const { tokens, operation } = query;\n const fireOnChange = (tokens: readonly PropertyFilterProps.Token[], operation: PropertyFilterProps.JoinOperation) =>\n fireNonCancelableEvent(onChange, { tokens, operation });\n const setToken = (index: number, newToken: PropertyFilterProps.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 preventFocus.current = true;\n inputRef.current?.focus();\n };\n const removeAllTokens = () => {\n fireOnChange([], operation);\n preventFocus.current = true;\n inputRef.current?.focus();\n };\n const addToken = (newToken: PropertyFilterProps.Token) => {\n const newTokens = [...tokens];\n newTokens.push(newToken);\n fireOnChange(newTokens, operation);\n };\n const setOperation = (newOperation: PropertyFilterProps.JoinOperation) => {\n fireOnChange(tokens, newOperation);\n };\n return {\n setToken,\n removeToken,\n removeAllTokens,\n addToken,\n setOperation,\n };\n};\n\nexport type ParsedText =\n | {\n step: 'property';\n property: PropertyFilterProps.FilteringProperty;\n operator: PropertyFilterProps.ComparisonOperator;\n value: string;\n }\n | { step: 'operator'; property: PropertyFilterProps.FilteringProperty; operatorPrefix: string }\n | { step: 'free-text'; operator?: PropertyFilterProps.ComparisonOperator; value: string };\n\nexport const getAllowedOperators = (\n property: PropertyFilterProps.FilteringProperty\n): PropertyFilterProps.ComparisonOperator[] => {\n const { operators, defaultOperator } = property;\n const operatorOrder = ['=', '!=', ':', '!:', '>=', '<=', '<', '>'] as const;\n const operatorSet: { [key: string]: true } = { [defaultOperator ?? '=']: true };\n operators?.forEach(op => (operatorSet[op] = true));\n return operatorOrder.filter(op => operatorSet[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: PropertyFilterProps['filteringProperties'] = [],\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: PropertyFilterProps.FilteringProperty,\n filteringOptions: PropertyFilterProps['filteringOptions']\n) => {\n return filteringOptions?.filter(option => option.propertyKey === filteringProperty.key);\n};\n\ninterface OptionGroup<T> {\n label: string;\n options: T[];\n}\n\ninterface ExtendedAutosuggestOption extends AutosuggestProps.Option {\n tokenValue: string;\n}\n\nexport const getAllValueSuggestions = (\n filteringOptions: PropertyFilterProps['filteringOptions'],\n filteringProperties: PropertyFilterProps['filteringProperties'],\n operator: PropertyFilterProps.ComparisonOperator | undefined = '=',\n i18nStrings: Pick<PropertyFilterProps.I18nStrings, 'groupValuesText'>,\n customGroupsText: PropertyFilterProps['customGroupsText']\n) => {\n const defaultGroup: OptionGroup<ExtendedAutosuggestOption> = {\n label: i18nStrings.groupValuesText,\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<ExtendedAutosuggestOption> } = {};\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 =\n 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 tokenValue: 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: PropertyFilterProps['filteringProperties'], key: string) => {\n const propertyMap = filteringProperties.reduce<{ [K: string]: PropertyFilterProps.FilteringProperty }>(\n (acc, property) => {\n acc[property.key] = property;\n return acc;\n },\n {}\n );\n return propertyMap[key] as PropertyFilterProps.FilteringProperty | undefined;\n};\n\nconst filteringPropertyToAutosuggestOption = (filteringProperty: PropertyFilterProps.FilteringProperty) => ({\n value: filteringProperty.propertyLabel,\n keepOpenOnSelect: true,\n});\n\nexport function getPropertySuggestions<T>(\n filteringProperties: PropertyFilterProps['filteringProperties'],\n customGroupsText: PropertyFilterProps['customGroupsText'],\n i18nStrings: Pick<PropertyFilterProps['i18nStrings'], 'groupPropertiesText'>,\n filteringPropertyToOption: (filteringProperty: PropertyFilterProps.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 =\n 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 type OperatorStrings =\n | 'operatorLessText'\n | 'operatorLessOrEqualText'\n | 'operatorGreaterText'\n | 'operatorGreaterOrEqualText'\n | 'operatorContainsText'\n | 'operatorDoesNotContainText'\n | 'operatorEqualsText'\n | 'operatorDoesNotEqualText';\nexport const getAutosuggestOptions = (\n parsedText: ParsedText,\n filteringOptions: PropertyFilterProps['filteringOptions'],\n filteringProperties: PropertyFilterProps['filteringProperties'],\n customGroupsText: PropertyFilterProps['customGroupsText'],\n i18nStrings: Pick<\n PropertyFilterProps['i18nStrings'],\n 'groupPropertiesText' | 'groupValuesText' | 'operatorsText' | OperatorStrings\n >\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 tokenValue: 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 = (\n operator: PropertyFilterProps.ComparisonOperator,\n i18nStrings: Pick<PropertyFilterProps['i18nStrings'], OperatorStrings>\n) => {\n const mapping: { [K in PropertyFilterProps.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":";AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEhH,MAAM,CAAC,IAAM,eAAe,GAAG,UAC7B,KAAmC,EACnC,QAAyC,EACzC,QAAyC,EACzC,YAA6C;IAErC,IAAA,MAAM,GAAgB,KAAK,OAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;IACpC,IAAM,YAAY,GAAG,UAAC,MAA4C,EAAE,SAA4C;QAC9G,OAAA,sBAAsB,CAAC,QAAQ,EAAE,EAAE,MAAM,QAAA,EAAE,SAA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AAC;SACH;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,UACnC,QAAgD,EAChD,WAAsE;;IAEtE,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\nimport { PropertyFilterProps } from './interfaces';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { InputProps } from '../input/interfaces';\nimport { matchFilteringProperty, matchOperator, matchOperatorPrefix, trimFirstSpace, trimStart } from './utils';\n\nexport const getQueryActions = (\n query: PropertyFilterProps['query'],\n onChange: PropertyFilterProps['onChange'],\n inputRef: React.RefObject<InputProps.Ref>,\n preventFocus: React.MutableRefObject<boolean>\n) => {\n const { tokens, operation } = query;\n const fireOnChange = (tokens: readonly PropertyFilterProps.Token[], operation: PropertyFilterProps.JoinOperation) =>\n fireNonCancelableEvent(onChange, { tokens, operation });\n const setToken = (index: number, newToken: PropertyFilterProps.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 preventFocus.current = true;\n inputRef.current?.focus();\n };\n const removeAllTokens = () => {\n fireOnChange([], operation);\n preventFocus.current = true;\n inputRef.current?.focus();\n };\n const addToken = (newToken: PropertyFilterProps.Token) => {\n const newTokens = [...tokens];\n newTokens.push(newToken);\n fireOnChange(newTokens, operation);\n };\n const setOperation = (newOperation: PropertyFilterProps.JoinOperation) => {\n fireOnChange(tokens, newOperation);\n };\n return {\n setToken,\n removeToken,\n removeAllTokens,\n addToken,\n setOperation,\n };\n};\n\nexport type ParsedText =\n | {\n step: 'property';\n property: PropertyFilterProps.FilteringProperty;\n operator: PropertyFilterProps.ComparisonOperator;\n value: string;\n }\n | { step: 'operator'; property: PropertyFilterProps.FilteringProperty; operatorPrefix: string }\n | { step: 'free-text'; operator?: PropertyFilterProps.ComparisonOperator; value: string };\n\nexport const getAllowedOperators = (\n property: PropertyFilterProps.FilteringProperty\n): PropertyFilterProps.ComparisonOperator[] => {\n const { operators, defaultOperator } = property;\n const operatorOrder = ['=', '!=', ':', '!:', '>=', '<=', '<', '>'] as const;\n const operatorSet: { [key: string]: true } = { [defaultOperator ?? '=']: true };\n // TODO: remove unknown type annotation once extended operators are supported.\n operators?.forEach((op: unknown) => {\n if (typeof op === 'string') {\n operatorSet[op] = true;\n }\n });\n return operatorOrder.filter(op => operatorSet[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: PropertyFilterProps['filteringProperties'] = [],\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: PropertyFilterProps.FilteringProperty,\n filteringOptions: PropertyFilterProps['filteringOptions']\n) => {\n return filteringOptions?.filter(option => option.propertyKey === filteringProperty.key);\n};\n\ninterface OptionGroup<T> {\n label: string;\n options: T[];\n}\n\ninterface ExtendedAutosuggestOption extends AutosuggestProps.Option {\n tokenValue: string;\n}\n\nexport const getAllValueSuggestions = (\n filteringOptions: PropertyFilterProps['filteringOptions'],\n filteringProperties: PropertyFilterProps['filteringProperties'],\n operator: PropertyFilterProps.ComparisonOperator | undefined = '=',\n i18nStrings: Pick<PropertyFilterProps.I18nStrings, 'groupValuesText'>,\n customGroupsText: PropertyFilterProps['customGroupsText']\n) => {\n const defaultGroup: OptionGroup<ExtendedAutosuggestOption> = {\n label: i18nStrings.groupValuesText,\n options: [],\n };\n const customGroups: { [K in string]: OptionGroup<ExtendedAutosuggestOption> } = {};\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 =\n 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 tokenValue: 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: PropertyFilterProps['filteringProperties'], key: string) => {\n const propertyMap = filteringProperties.reduce<{ [K: string]: PropertyFilterProps.FilteringProperty }>(\n (acc, property) => {\n acc[property.key] = property;\n return acc;\n },\n {}\n );\n return propertyMap[key] as PropertyFilterProps.FilteringProperty | undefined;\n};\n\nconst filteringPropertyToAutosuggestOption = (filteringProperty: PropertyFilterProps.FilteringProperty) => ({\n value: filteringProperty.propertyLabel,\n keepOpenOnSelect: true,\n});\n\nexport function getPropertySuggestions<T>(\n filteringProperties: PropertyFilterProps['filteringProperties'],\n customGroupsText: PropertyFilterProps['customGroupsText'],\n i18nStrings: Pick<PropertyFilterProps['i18nStrings'], 'groupPropertiesText'>,\n filteringPropertyToOption: (filteringProperty: PropertyFilterProps.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 =\n 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 type OperatorStrings =\n | 'operatorLessText'\n | 'operatorLessOrEqualText'\n | 'operatorGreaterText'\n | 'operatorGreaterOrEqualText'\n | 'operatorContainsText'\n | 'operatorDoesNotContainText'\n | 'operatorEqualsText'\n | 'operatorDoesNotEqualText';\nexport const getAutosuggestOptions = (\n parsedText: ParsedText,\n filteringOptions: PropertyFilterProps['filteringOptions'],\n filteringProperties: PropertyFilterProps['filteringProperties'],\n customGroupsText: PropertyFilterProps['customGroupsText'],\n i18nStrings: Pick<\n PropertyFilterProps['i18nStrings'],\n 'groupPropertiesText' | 'groupValuesText' | 'operatorsText' | OperatorStrings\n >\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 tokenValue: 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 = (\n operator: PropertyFilterProps.ComparisonOperator,\n i18nStrings: Pick<PropertyFilterProps['i18nStrings'], OperatorStrings>\n) => {\n const mapping: { [K in PropertyFilterProps.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"]}
|
|
@@ -143,8 +143,12 @@ export declare namespace PropertyFilterProps {
|
|
|
143
143
|
type Token = PropertyFilterToken;
|
|
144
144
|
type JoinOperation = PropertyFilterOperation;
|
|
145
145
|
type ComparisonOperator = PropertyFilterOperator;
|
|
146
|
-
type FilteringProperty = PropertyFilterProperty;
|
|
147
146
|
type FilteringOption = PropertyFilterOption;
|
|
147
|
+
interface FilteringProperty extends PropertyFilterProperty {
|
|
148
|
+
groupValuesLabel: string;
|
|
149
|
+
propertyLabel: string;
|
|
150
|
+
group?: string;
|
|
151
|
+
}
|
|
148
152
|
interface Query {
|
|
149
153
|
tokens: ReadonlyArray<PropertyFilterProps.Token>;
|
|
150
154
|
operation: PropertyFilterProps.JoinOperation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,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,CAAC,WAAW,CAAC;IAC7C;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;OAUG;IACH,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC;IACjC;;;;;OAKG;IACH,cAAc,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E,iBAAiB,CAAC;KACvC;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport {\n PropertyFilterOperator,\n PropertyFilterOperation,\n PropertyFilterToken,\n PropertyFilterProperty,\n PropertyFilterOption,\n} from '@cloudscape-design/collection-hooks';\n\nexport interface PropertyFilterProps extends BaseComponentProps, ExpandToViewport {\n /**\n * If set to `true`, the filtering input will be disabled.\n * Use it, for example, if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering query.\n */\n disabled?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings: PropertyFilterProps.I18nStrings;\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `query.tokens` isn't empty.\n */\n countText?: string;\n /**\n * An object representing the current query displayed in the property filter. Has two properties: `tokens` and `operation`.\n * `tokens` is an array of objects that will be displayed to the user beneath the filtering input.\n * Each token has the following properties:\n *\n * * value [string]: The string value of the token to be used as a filter.\n * * propertyKey [string]: The key of the corresponding property in filteringProperties.\n * * operator ['<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!=']: The operator which indicates how to filter the dataset using this token.\n *\n * `operation` has two valid values [and, or] and controls the join operation to be applied between tokens when filtering the items.\n */\n query: PropertyFilterProps.Query;\n /**\n * If hideOperations it set, the indicator of the operation (that is, `and` or `or`) and the selection of operations\n * (applied to the property and value token) are hidden from the user. Only use when you have a custom\n * filtering logic which combines tokens in different way than the default one. When used, ensure that\n * operations are communicated to the user in another way.\n */\n hideOperations?: boolean;\n /**\n * Fired when the `query` gets changed. Filter the dataset in response to this event using the values in the `detail` object.\n */\n onChange: NonCancelableEventHandler<PropertyFilterProps.Query>;\n /**\n * An array of properties by which the data set can be filtered. Each element has the following properties:\n *\n * * groupValuesLabel [string]: Localized string to display for the 'Values' group label for a specific property.\n * * key [string]: The identifier of this property.\n * * propertyLabel [string]: A human-readable string for the property.\n * * operators [Array]: A list of all operators supported by this property. If you omit the equals operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * group [string]: Optional identifier of a custom group that this filtering option is assigned to. Use to create additional groups below the default one. Make sure to also define labels for the group in the customGroupsText property. Notice that only one level of options nesting is supported.\n * * defaultOperator [ComparisonOperator]: Optional parameter that changes the default operator used with this filtering property. Use it only if your API does not support \"equals\" filtering terms with this property.\n */\n filteringProperties: ReadonlyArray<PropertyFilterProps.FilteringProperty>;\n /**\n * An array of possible values of the individual `filteringProperties`. Each element has the following properties:\n *\n * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.\n * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.\n */\n filteringOptions?: ReadonlyArray<PropertyFilterProps.FilteringOption>;\n /**\n * An array of objects that contain localized, human-readable strings for the labels of custom groups within the filtering dropdown. Use group property to associate the strings with your custom group of options. Define the following values for each group:\n *\n * * properties [string]: The group label in the filtering dropdown that contains the list of properties from this group. For example: Tags.\n * * values [string]: The group label in the filtering dropdown that contains the list of values from this group. For example: Tags values.\n * * group [string]: The identifier of a custom group.\n */\n customGroupsText?: PropertyFilterProps.GroupText[];\n /**\n * Set `disableFreeTextFiltering` only if you can’t filter the dataset using a filter that is applied to every column,\n * instead of a specific property. This would stop the user from creating such tokens.\n */\n disableFreeTextFiltering?: boolean;\n /**\n * Use this event to asynchronously load filteringOptions, component currently needs. The detail object contains following properties:\n *\n * * `filteringProperty` - The property for which you need to fetch the options.\n * * `filteringOperator` - The operator for which you need to fetch the options.\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options for a `filteringProperty` that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n */\n onLoadItems?: NonCancelableEventHandler<PropertyFilterProps.LoadItemsDetail>;\n /**\n * If you have more than 500 `filteringOptions`, enable this flag to apply a performance optimization that makes\n * the filtering experience smoother. We don't recommend enabling the feature if you have less than 500 options,\n * because the improvements to performance are offset by a visible scrolling lag. When you set this flag to true,\n * it removes options that are not currently in view from the DOM.\n */\n virtualScroll?: boolean;\n /**\n * A slot located before the filtering input. Use it if for a Select component if your dataset supports property\n * filter queries only after an initial filter is applied.\n */\n customControl?: React.ReactNode;\n /**\n * Set `asyncProperties` if you need to load `filteringProperties` asynchronousely. This would cause extra `onLoadMore`\n * events to fire calling for more properties.\n */\n asyncProperties?: boolean;\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n tokenLimit?: number;\n /**\n * Displayed when there are no options to display.\n * This is only shown when `statusType` is set to `finished` or not set at all.\n */\n filteringEmpty?: React.ReactNode;\n /**\n * Specifies the text to display when in the loading state.\n **/\n filteringLoadingText?: string;\n /**\n * Specifies the text to display at the bottom of the dropdown menu after pagination has reached the end.\n **/\n filteringFinishedText?: string;\n /**\n * Specifies the text to display when a data fetching error occurs. Make sure that you provide `recoveryText`.\n **/\n filteringErrorText?: string;\n /**\n * Specifies the text for the recovery button. The text is displayed next to the error text.\n * Use the `onLoadItems` event to perform a recovery action (for example, retrying the request).\n **/\n filteringRecoveryText?: string;\n /**\n * Specifies the current status of loading more options.\n * * `pending` - Indicates that no request in progress, but more options may be loaded.\n * * `loading` - Indicates that data fetching is in progress.\n * * `finished` - Indicates that pagination has finished and no more requests are expected.\n * * `error` - Indicates that an error occurred during fetch. You should use `recoveryText` to enable the user to recover.\n **/\n filteringStatusType?: DropdownStatusProps.StatusType;\n}\n\nexport namespace PropertyFilterProps {\n export type Token = PropertyFilterToken;\n export type JoinOperation = PropertyFilterOperation;\n export type ComparisonOperator = PropertyFilterOperator;\n export type FilteringProperty = PropertyFilterProperty;\n export type FilteringOption = PropertyFilterOption;\n export interface Query {\n tokens: ReadonlyArray<PropertyFilterProps.Token>;\n operation: PropertyFilterProps.JoinOperation;\n }\n\n export interface LoadItemsDetail {\n filteringProperty?: FilteringProperty;\n filteringOperator?: ComparisonOperator;\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n }\n\n export interface I18nStrings {\n /**\n * Label that will be passed down to the Autosuggest `ariaLabel` property.\n * See the [Autosuggest API](/system/components/autosuggest/?tabId=api) page for more details.\n */\n filteringAriaLabel: string;\n dismissAriaLabel: string;\n\n filteringPlaceholder?: string;\n groupValuesText: string;\n groupPropertiesText: string;\n operatorsText: string;\n\n operationAndText: string;\n operationOrText: string;\n\n operatorLessText: string;\n operatorLessOrEqualText: string;\n operatorGreaterText: string;\n operatorGreaterOrEqualText: string;\n operatorContainsText: string;\n operatorDoesNotContainText: string;\n operatorEqualsText: string;\n operatorDoesNotEqualText: string;\n\n editTokenHeader: string;\n propertyText: string;\n operatorText: string;\n valueText: string;\n cancelActionText: string;\n applyActionText: string;\n allPropertiesLabel: string;\n\n tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText: string;\n removeTokenButtonAriaLabel: (token: PropertyFilterProps.Token) => string;\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\n }\n\n export interface GroupText {\n properties: string;\n values: string;\n group: string;\n }\n\n export interface FilteringChangeDetail {\n filteringText: string;\n filteringProperty?: FilteringProperty;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport {\n PropertyFilterOperator,\n PropertyFilterOperation,\n PropertyFilterToken,\n PropertyFilterProperty,\n PropertyFilterOption,\n} from '@cloudscape-design/collection-hooks';\n\nexport interface PropertyFilterProps extends BaseComponentProps, ExpandToViewport {\n /**\n * If set to `true`, the filtering input will be disabled.\n * Use it, for example, if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering query.\n */\n disabled?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings: PropertyFilterProps.I18nStrings;\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `query.tokens` isn't empty.\n */\n countText?: string;\n /**\n * An object representing the current query displayed in the property filter. Has two properties: `tokens` and `operation`.\n * `tokens` is an array of objects that will be displayed to the user beneath the filtering input.\n * Each token has the following properties:\n *\n * * value [string]: The string value of the token to be used as a filter.\n * * propertyKey [string]: The key of the corresponding property in filteringProperties.\n * * operator ['<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!=']: The operator which indicates how to filter the dataset using this token.\n *\n * `operation` has two valid values [and, or] and controls the join operation to be applied between tokens when filtering the items.\n */\n query: PropertyFilterProps.Query;\n /**\n * If hideOperations it set, the indicator of the operation (that is, `and` or `or`) and the selection of operations\n * (applied to the property and value token) are hidden from the user. Only use when you have a custom\n * filtering logic which combines tokens in different way than the default one. When used, ensure that\n * operations are communicated to the user in another way.\n */\n hideOperations?: boolean;\n /**\n * Fired when the `query` gets changed. Filter the dataset in response to this event using the values in the `detail` object.\n */\n onChange: NonCancelableEventHandler<PropertyFilterProps.Query>;\n /**\n * An array of properties by which the data set can be filtered. Each element has the following properties:\n *\n * * groupValuesLabel [string]: Localized string to display for the 'Values' group label for a specific property.\n * * key [string]: The identifier of this property.\n * * propertyLabel [string]: A human-readable string for the property.\n * * operators [Array]: A list of all operators supported by this property. If you omit the equals operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * group [string]: Optional identifier of a custom group that this filtering option is assigned to. Use to create additional groups below the default one. Make sure to also define labels for the group in the customGroupsText property. Notice that only one level of options nesting is supported.\n * * defaultOperator [ComparisonOperator]: Optional parameter that changes the default operator used with this filtering property. Use it only if your API does not support \"equals\" filtering terms with this property.\n */\n filteringProperties: ReadonlyArray<PropertyFilterProps.FilteringProperty>;\n /**\n * An array of possible values of the individual `filteringProperties`. Each element has the following properties:\n *\n * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.\n * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.\n */\n filteringOptions?: ReadonlyArray<PropertyFilterProps.FilteringOption>;\n /**\n * An array of objects that contain localized, human-readable strings for the labels of custom groups within the filtering dropdown. Use group property to associate the strings with your custom group of options. Define the following values for each group:\n *\n * * properties [string]: The group label in the filtering dropdown that contains the list of properties from this group. For example: Tags.\n * * values [string]: The group label in the filtering dropdown that contains the list of values from this group. For example: Tags values.\n * * group [string]: The identifier of a custom group.\n */\n customGroupsText?: PropertyFilterProps.GroupText[];\n /**\n * Set `disableFreeTextFiltering` only if you can’t filter the dataset using a filter that is applied to every column,\n * instead of a specific property. This would stop the user from creating such tokens.\n */\n disableFreeTextFiltering?: boolean;\n /**\n * Use this event to asynchronously load filteringOptions, component currently needs. The detail object contains following properties:\n *\n * * `filteringProperty` - The property for which you need to fetch the options.\n * * `filteringOperator` - The operator for which you need to fetch the options.\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options for a `filteringProperty` that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n */\n onLoadItems?: NonCancelableEventHandler<PropertyFilterProps.LoadItemsDetail>;\n /**\n * If you have more than 500 `filteringOptions`, enable this flag to apply a performance optimization that makes\n * the filtering experience smoother. We don't recommend enabling the feature if you have less than 500 options,\n * because the improvements to performance are offset by a visible scrolling lag. When you set this flag to true,\n * it removes options that are not currently in view from the DOM.\n */\n virtualScroll?: boolean;\n /**\n * A slot located before the filtering input. Use it if for a Select component if your dataset supports property\n * filter queries only after an initial filter is applied.\n */\n customControl?: React.ReactNode;\n /**\n * Set `asyncProperties` if you need to load `filteringProperties` asynchronousely. This would cause extra `onLoadMore`\n * events to fire calling for more properties.\n */\n asyncProperties?: boolean;\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n tokenLimit?: number;\n /**\n * Displayed when there are no options to display.\n * This is only shown when `statusType` is set to `finished` or not set at all.\n */\n filteringEmpty?: React.ReactNode;\n /**\n * Specifies the text to display when in the loading state.\n **/\n filteringLoadingText?: string;\n /**\n * Specifies the text to display at the bottom of the dropdown menu after pagination has reached the end.\n **/\n filteringFinishedText?: string;\n /**\n * Specifies the text to display when a data fetching error occurs. Make sure that you provide `recoveryText`.\n **/\n filteringErrorText?: string;\n /**\n * Specifies the text for the recovery button. The text is displayed next to the error text.\n * Use the `onLoadItems` event to perform a recovery action (for example, retrying the request).\n **/\n filteringRecoveryText?: string;\n /**\n * Specifies the current status of loading more options.\n * * `pending` - Indicates that no request in progress, but more options may be loaded.\n * * `loading` - Indicates that data fetching is in progress.\n * * `finished` - Indicates that pagination has finished and no more requests are expected.\n * * `error` - Indicates that an error occurred during fetch. You should use `recoveryText` to enable the user to recover.\n **/\n filteringStatusType?: DropdownStatusProps.StatusType;\n}\n\nexport namespace PropertyFilterProps {\n export type Token = PropertyFilterToken;\n export type JoinOperation = PropertyFilterOperation;\n export type ComparisonOperator = PropertyFilterOperator;\n export type FilteringOption = PropertyFilterOption;\n export interface FilteringProperty extends PropertyFilterProperty {\n groupValuesLabel: string;\n propertyLabel: string;\n group?: string;\n }\n\n export interface Query {\n tokens: ReadonlyArray<PropertyFilterProps.Token>;\n operation: PropertyFilterProps.JoinOperation;\n }\n\n export interface LoadItemsDetail {\n filteringProperty?: FilteringProperty;\n filteringOperator?: ComparisonOperator;\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n }\n\n export interface I18nStrings {\n /**\n * Label that will be passed down to the Autosuggest `ariaLabel` property.\n * See the [Autosuggest API](/system/components/autosuggest/?tabId=api) page for more details.\n */\n filteringAriaLabel: string;\n dismissAriaLabel: string;\n\n filteringPlaceholder?: string;\n groupValuesText: string;\n groupPropertiesText: string;\n operatorsText: string;\n\n operationAndText: string;\n operationOrText: string;\n\n operatorLessText: string;\n operatorLessOrEqualText: string;\n operatorGreaterText: string;\n operatorGreaterOrEqualText: string;\n operatorContainsText: string;\n operatorDoesNotContainText: string;\n operatorEqualsText: string;\n operatorDoesNotEqualText: string;\n\n editTokenHeader: string;\n propertyText: string;\n operatorText: string;\n valueText: string;\n cancelActionText: string;\n applyActionText: string;\n allPropertiesLabel: string;\n\n tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText: string;\n removeTokenButtonAriaLabel: (token: PropertyFilterProps.Token) => string;\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\n }\n\n export interface GroupText {\n properties: string;\n values: string;\n group: string;\n }\n\n export interface FilteringChangeDetail {\n filteringText: string;\n filteringProperty?: FilteringProperty;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-filter-autosuggest.d.ts","sourceRoot":"","sources":["../../../src/property-filter/property-filter-autosuggest.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA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