@planningcenter/tapestry 4.15.0-rc.1 → 4.15.1-qa-1684.0
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/dist/components/DataTable/ActiveFilterInstance.d.ts +6 -0
- package/dist/components/DataTable/ActiveFilterInstance.d.ts.map +1 -1
- package/dist/components/DataTable/ActiveFilterInstance.js +13 -0
- package/dist/components/DataTable/ActiveFilterInstance.js.map +1 -1
- package/dist/components/DataTable/CollectionEditorsLazy.d.ts +1 -1
- package/dist/components/DataTable/CollectionEditorsLazy.d.ts.map +1 -1
- package/dist/components/DataTable/CollectionEditorsLazy.js +2 -2
- package/dist/components/DataTable/CollectionEditorsLazy.js.map +1 -1
- package/dist/components/DataTable/CollectionEditorsShared.d.ts +4 -8
- package/dist/components/DataTable/CollectionEditorsShared.d.ts.map +1 -1
- package/dist/components/DataTable/CollectionEditorsShared.js +2 -2
- package/dist/components/DataTable/CollectionEditorsShared.js.map +1 -1
- package/dist/components/DataTable/CollectionEditorsStatic.d.ts +4 -5
- package/dist/components/DataTable/CollectionEditorsStatic.d.ts.map +1 -1
- package/dist/components/DataTable/CollectionEditorsStatic.js +9 -9
- package/dist/components/DataTable/CollectionEditorsStatic.js.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +27 -5
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.js +13 -2
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/DataTableRow.d.ts +2 -0
- package/dist/components/DataTable/DataTableRow.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableRow.js.map +1 -1
- package/dist/components/DataTable/RowActions.d.ts +7 -3
- package/dist/components/DataTable/RowActions.d.ts.map +1 -1
- package/dist/components/DataTable/RowActions.js +7 -2
- package/dist/components/DataTable/RowActions.js.map +1 -1
- package/dist/components/DataTable/collectionFilter.js +1 -1
- package/dist/components/DataTable/collectionFilter.js.map +1 -1
- package/dist/components/DataTable/dateFilter.js +5 -5
- package/dist/components/DataTable/dateFilter.js.map +1 -1
- package/dist/components/DataTable/dayFilter.js +4 -3
- package/dist/components/DataTable/dayFilter.js.map +1 -1
- package/dist/components/DataTable/index.d.ts +1 -1
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DataTable/numberFilter.js +3 -2
- package/dist/components/DataTable/numberFilter.js.map +1 -1
- package/dist/components/DataTable/scopedFilter.js +5 -1
- package/dist/components/DataTable/scopedFilter.js.map +1 -1
- package/dist/components/DataTable/textFilter.js +1 -1
- package/dist/components/DataTable/textFilter.js.map +1 -1
- package/dist/components/button/ActionsDropdownIconButton.js +2 -2
- package/dist/components/button/ActionsDropdownIconButton.js.map +1 -1
- package/dist/components/button/BaseButton.js +4 -4
- package/dist/components/button/BaseButton.js.map +1 -1
- package/dist/components/button/Button.js +2 -2
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/DropdownButton.js +3 -3
- package/dist/components/button/DropdownButton.js.map +1 -1
- package/dist/components/button/DropdownIconButton.js +2 -2
- package/dist/components/button/DropdownIconButton.js.map +1 -1
- package/dist/components/button/IconButton.js +4 -4
- package/dist/components/button/IconButton.js.map +1 -1
- package/dist/components/button/LoadingButton.js +2 -2
- package/dist/components/button/LoadingButton.js.map +1 -1
- package/dist/components/button/PageHeaderActionsDropdownButton.js +3 -3
- package/dist/components/button/PageHeaderActionsDropdownButton.js.map +1 -1
- package/dist/components/combo-box/ComboBox.js +31 -31
- package/dist/components/combo-box/ComboBox.js.map +1 -1
- package/dist/components/date-picker/DatePicker.js +42 -42
- package/dist/components/date-picker/DatePicker.js.map +1 -1
- package/dist/components/dropdown/Dropdown.js +13 -13
- package/dist/components/dropdown/Dropdown.js.map +1 -1
- package/dist/components/field/Field.js +5 -5
- package/dist/components/field/Field.js.map +1 -1
- package/dist/components/internal/LoadingSpinner.js +2 -2
- package/dist/components/internal/LoadingSpinner.js.map +1 -1
- package/dist/components/internal/tooltip/Tooltip.js +8 -8
- package/dist/components/internal/tooltip/Tooltip.js.map +1 -1
- package/dist/components/link/BaseLink.d.ts.map +1 -1
- package/dist/components/link/BaseLink.js +7 -3
- package/dist/components/link/BaseLink.js.map +1 -1
- package/dist/components/link/IconLink.js +4 -4
- package/dist/components/link/IconLink.js.map +1 -1
- package/dist/components/link/Link.js +2 -2
- package/dist/components/link/Link.js.map +1 -1
- package/dist/components/number-stepper/NumberStepper.js +11 -11
- package/dist/components/number-stepper/NumberStepper.js.map +1 -1
- package/dist/components/page-header/PageHeader.js +10 -10
- package/dist/components/page-header/PageHeader.js.map +1 -1
- package/dist/components/search-input/SearchInput.js +6 -6
- package/dist/components/search-input/SearchInput.js.map +1 -1
- package/dist/components/select/Select.js +6 -6
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/select/SelectNative.js +6 -6
- package/dist/components/select/SelectNative.js.map +1 -1
- package/dist/components/select/SelectOptions.js +9 -9
- package/dist/components/select/SelectOptions.js.map +1 -1
- package/dist/components/select/SelectPopover.js +14 -14
- package/dist/components/select/SelectPopover.js.map +1 -1
- package/dist/components/sidenav/Sidenav.js +6 -6
- package/dist/components/sidenav/Sidenav.js.map +1 -1
- package/dist/components/sidenav/SidenavItem.js +2 -2
- package/dist/components/sidenav/SidenavItem.js.map +1 -1
- package/dist/components/sidenav/SidenavSection.js +7 -7
- package/dist/components/sidenav/SidenavSection.js.map +1 -1
- package/dist/components/sidenav/private/SidenavResponsiveHeader.js +6 -6
- package/dist/components/sidenav/private/SidenavResponsiveHeader.js.map +1 -1
- package/dist/components/sidenav/private/withSlotChildrenAsActions.js +7 -7
- package/dist/components/sidenav/private/withSlotChildrenAsActions.js.map +1 -1
- package/dist/components/tag/Tag.d.ts +59 -0
- package/dist/components/tag/Tag.d.ts.map +1 -0
- package/dist/components/tag/Tag.js +31 -0
- package/dist/components/tag/Tag.js.map +1 -0
- package/dist/components/tag/TagContent.d.ts +19 -0
- package/dist/components/tag/TagContent.d.ts.map +1 -0
- package/dist/components/tag/TagContent.js +26 -0
- package/dist/components/tag/TagContent.js.map +1 -0
- package/dist/components/tag/index.d.ts +4 -0
- package/dist/components/tag/index.d.ts.map +1 -0
- package/dist/components/tag/useTagMenu.d.ts +31 -0
- package/dist/components/tag/useTagMenu.d.ts.map +1 -0
- package/dist/components/tag/useTagMenu.js +56 -0
- package/dist/components/tag/useTagMenu.js.map +1 -0
- package/dist/components/time-field/TimeField.js +8 -8
- package/dist/components/time-field/TimeField.js.map +1 -1
- package/dist/packages/tapestry-render/dist/buildComponent-DzY2PDMT.js +4 -4
- package/dist/packages/tapestry-render/dist/buildComponent-DzY2PDMT.js.map +1 -1
- package/dist/reactRender.css +566 -327
- package/dist/reactRender.css.map +1 -1
- package/dist/reactRenderLegacy.css +566 -327
- package/dist/reactRenderLegacy.css.map +1 -1
- package/dist/tapestryMount.css +566 -327
- package/dist/tapestryMount.css.map +1 -1
- package/dist/tapestryMountLegacy.css +566 -327
- package/dist/tapestryMountLegacy.css.map +1 -1
- package/dist/unstable.css +245 -6
- package/dist/unstable.css.map +1 -1
- package/dist/unstable.d.ts +2 -0
- package/dist/unstable.d.ts.map +1 -1
- package/dist/unstable.js +1 -0
- package/dist/unstable.js.map +1 -1
- package/dist/utilities/Icon.js +2 -2
- package/dist/utilities/Icon.js.map +1 -1
- package/dist/utilities/buttonLinkShared.js +2 -2
- package/dist/utilities/buttonLinkShared.js.map +1 -1
- package/dist/utilities/locale.js +34 -5
- package/dist/utilities/locale.js.map +1 -1
- package/docs/components/DataTable.md +23 -5
- package/docs/components/tag.md +41 -0
- package/docs/llms.txt +3 -0
- package/package.json +5 -5
|
@@ -5,6 +5,12 @@ export declare abstract class ActiveFilterInstance<T = unknown> {
|
|
|
5
5
|
readonly operator: Operator;
|
|
6
6
|
readonly value: T;
|
|
7
7
|
constructor(filter: FilterNodeItem, operator: Operator, value: T);
|
|
8
|
+
/** Replaces the filter label in editor names. Scoped filters set it to name the scope. */
|
|
9
|
+
editorFilterLabel?: string;
|
|
10
|
+
/** Names the editor's controls by filter and operator. */
|
|
11
|
+
get editorLabel(): string;
|
|
12
|
+
/** Names the start and end controls of a range editor. */
|
|
13
|
+
get rangeEditorLabels(): [string, string];
|
|
8
14
|
get isCompleteWithoutInput(): boolean;
|
|
9
15
|
toSegments(locale: string): FilterChipSegment[];
|
|
10
16
|
abstract formatValue(locale: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActiveFilterInstance.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/ActiveFilterInstance.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACT,MAAM,eAAe,CAAA;AAGtB,8BAAsB,oBAAoB,CAAC,CAAC,GAAG,OAAO;IAElD,QAAQ,CAAC,MAAM,EAAE,cAAc;IAC/B,QAAQ,CAAC,QAAQ,EAAE,QAAQ;IAC3B,QAAQ,CAAC,KAAK,EAAE,CAAC;gBAFR,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,CAAC;IAGnB,IAAI,sBAAsB,IAAI,OAAO,CAEpC;IAED,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE;IAO/C,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAE5C,kFAAkF;IAClF,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE;IAOpD,QAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,KAAK,CAAC,SAAS;CAC/D"}
|
|
1
|
+
{"version":3,"file":"ActiveFilterInstance.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/ActiveFilterInstance.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACT,MAAM,eAAe,CAAA;AAGtB,8BAAsB,oBAAoB,CAAC,CAAC,GAAG,OAAO;IAElD,QAAQ,CAAC,MAAM,EAAE,cAAc;IAC/B,QAAQ,CAAC,QAAQ,EAAE,QAAQ;IAC3B,QAAQ,CAAC,KAAK,EAAE,CAAC;gBAFR,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,CAAC;IAGnB,0FAA0F;IAC1F,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B,0DAA0D;IAC1D,IAAI,WAAW,IAAI,MAAM,CAIxB;IAED,0DAA0D;IAC1D,IAAI,iBAAiB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAGxC;IAED,IAAI,sBAAsB,IAAI,OAAO,CAEpC;IAED,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE;IAO/C,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAE5C,kFAAkF;IAClF,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE;IAOpD,QAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,KAAK,CAAC,SAAS;CAC/D"}
|
|
@@ -9,6 +9,19 @@ class ActiveFilterInstance {
|
|
|
9
9
|
this.operator = operator;
|
|
10
10
|
this.value = value;
|
|
11
11
|
}
|
|
12
|
+
/** Replaces the filter label in editor names. Scoped filters set it to name the scope. */
|
|
13
|
+
editorFilterLabel;
|
|
14
|
+
/** Names the editor's controls by filter and operator. */
|
|
15
|
+
get editorLabel() {
|
|
16
|
+
return [this.editorFilterLabel ?? this.filter.label, this.operator.label]
|
|
17
|
+
.filter(Boolean)
|
|
18
|
+
.join(" ");
|
|
19
|
+
}
|
|
20
|
+
/** Names the start and end controls of a range editor. */
|
|
21
|
+
get rangeEditorLabels() {
|
|
22
|
+
const label = this.editorFilterLabel ?? this.filter.label;
|
|
23
|
+
return [`${label} range start`, `${label} range end`];
|
|
24
|
+
}
|
|
12
25
|
get isCompleteWithoutInput() {
|
|
13
26
|
return false;
|
|
14
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActiveFilterInstance.js","sources":["../../../src/components/DataTable/ActiveFilterInstance.tsx"],"sourcesContent":["import type React from \"react\"\n\nimport type {\n FilterChange,\n FilterChipSegment,\n FilterNodeItem,\n Operator,\n} from \"./FilterTypes\"\nimport { isEmptyValue } from \"./utils\"\n\nexport abstract class ActiveFilterInstance<T = unknown> {\n constructor(\n readonly filter: FilterNodeItem,\n readonly operator: Operator,\n readonly value: T\n ) {}\n\n get isCompleteWithoutInput(): boolean {\n return false\n }\n\n toSegments(locale: string): FilterChipSegment[] {\n const { label } = this.operator\n return label\n ? [this.filter.label, label, ...this.toValueSegments(locale)]\n : [this.filter.label, ...this.toValueSegments(locale)]\n }\n\n abstract formatValue(locale: string): string\n\n /** How many items the value lists, shown when a multi-item value is truncated. */\n get valueCount(): number {\n return 1\n }\n\n toValueSegments(locale: string): FilterChipSegment[] {\n const value = this.formatValue(locale)\n if (isEmptyValue(value)) return []\n const count = this.valueCount > 1 ? this.valueCount : undefined\n return [{ count, kind: \"value\", label: value }]\n }\n\n abstract renderEditor(onChange: FilterChange): React.ReactNode\n}\n"],"names":[],"mappings":";;MAUsB,oBAAoB,CAAA;AAE7B,IAAA,MAAA;AACA,IAAA,QAAA;AACA,IAAA,KAAA;AAHX,IAAA,WAAA,CACW,MAAsB,EACtB,QAAkB,EAClB,KAAQ,EAAA;QAFR,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAAA,CAAA,KAAK,GAAL,KAAK;IACb;
|
|
1
|
+
{"version":3,"file":"ActiveFilterInstance.js","sources":["../../../src/components/DataTable/ActiveFilterInstance.tsx"],"sourcesContent":["import type React from \"react\"\n\nimport type {\n FilterChange,\n FilterChipSegment,\n FilterNodeItem,\n Operator,\n} from \"./FilterTypes\"\nimport { isEmptyValue } from \"./utils\"\n\nexport abstract class ActiveFilterInstance<T = unknown> {\n constructor(\n readonly filter: FilterNodeItem,\n readonly operator: Operator,\n readonly value: T\n ) {}\n\n /** Replaces the filter label in editor names. Scoped filters set it to name the scope. */\n editorFilterLabel?: string\n\n /** Names the editor's controls by filter and operator. */\n get editorLabel(): string {\n return [this.editorFilterLabel ?? this.filter.label, this.operator.label]\n .filter(Boolean)\n .join(\" \")\n }\n\n /** Names the start and end controls of a range editor. */\n get rangeEditorLabels(): [string, string] {\n const label = this.editorFilterLabel ?? this.filter.label\n return [`${label} range start`, `${label} range end`]\n }\n\n get isCompleteWithoutInput(): boolean {\n return false\n }\n\n toSegments(locale: string): FilterChipSegment[] {\n const { label } = this.operator\n return label\n ? [this.filter.label, label, ...this.toValueSegments(locale)]\n : [this.filter.label, ...this.toValueSegments(locale)]\n }\n\n abstract formatValue(locale: string): string\n\n /** How many items the value lists, shown when a multi-item value is truncated. */\n get valueCount(): number {\n return 1\n }\n\n toValueSegments(locale: string): FilterChipSegment[] {\n const value = this.formatValue(locale)\n if (isEmptyValue(value)) return []\n const count = this.valueCount > 1 ? this.valueCount : undefined\n return [{ count, kind: \"value\", label: value }]\n }\n\n abstract renderEditor(onChange: FilterChange): React.ReactNode\n}\n"],"names":[],"mappings":";;MAUsB,oBAAoB,CAAA;AAE7B,IAAA,MAAA;AACA,IAAA,QAAA;AACA,IAAA,KAAA;AAHX,IAAA,WAAA,CACW,MAAsB,EACtB,QAAkB,EAClB,KAAQ,EAAA;QAFR,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAAA,CAAA,KAAK,GAAL,KAAK;IACb;;AAGH,IAAA,iBAAiB;;AAGjB,IAAA,IAAI,WAAW,GAAA;AACb,QAAA,OAAO,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1
1
|
import React from "react";
|
|
2
2
|
import type { CollectionFilterEditorProps } from "./CollectionEditorsShared";
|
|
3
|
-
export declare function CollectionFilterEditorLazy({ config,
|
|
3
|
+
export declare function CollectionFilterEditorLazy({ config, editorLabel, onChange, value, filter, label, scope, }: CollectionFilterEditorProps): React.JSX.Element;
|
|
4
4
|
export declare function Loading(): React.JSX.Element;
|
|
5
5
|
export declare function LoadError(): React.JSX.Element;
|
|
6
6
|
//# sourceMappingURL=CollectionEditorsLazy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionEditorsLazy.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAgD,MAAM,OAAO,CAAA;AAGpE,OAAO,KAAK,EACV,2BAA2B,EAG5B,MAAM,2BAA2B,CAAA;AAuBlC,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,EACN,
|
|
1
|
+
{"version":3,"file":"CollectionEditorsLazy.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAgD,MAAM,OAAO,CAAA;AAGpE,OAAO,KAAK,EACV,2BAA2B,EAG5B,MAAM,2BAA2B,CAAA;AAuBlC,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,EACN,WAAW,EACX,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,GACN,EAAE,2BAA2B,qBA4C7B;AA6FD,wBAAgB,OAAO,sBAQtB;AAED,wBAAgB,SAAS,sBAMxB"}
|
|
@@ -12,7 +12,7 @@ import { useLazyOptions } from './useLazyOptions.js';
|
|
|
12
12
|
import { isEmptyValue } from './utils.js';
|
|
13
13
|
|
|
14
14
|
const DEBOUNCE_MS = 300;
|
|
15
|
-
function CollectionFilterEditorLazy({ config,
|
|
15
|
+
function CollectionFilterEditorLazy({ config, editorLabel, onChange, value, filter, label, scope, }) {
|
|
16
16
|
const { display, multiple } = config;
|
|
17
17
|
const loadOptions = config.options;
|
|
18
18
|
const options = useCallback((query) => loadOptions(query, scope), [loadOptions, scope]);
|
|
@@ -28,7 +28,7 @@ function CollectionFilterEditorLazy({ config, onChange, operator, value, filter,
|
|
|
28
28
|
return onChange({ label: newLabel, value: newValue }, { complete: !isEmptyValue(newValue) });
|
|
29
29
|
}, [resolvedOptions, onChange, value, label]);
|
|
30
30
|
const Editor = getLazyEditor(display);
|
|
31
|
-
return (React__default.createElement(Editor, { error: error, loading: loading, query: query, setQuery: setQuery, value: value, onCommit: onCommit, options: resolvedOptions, multiple: multiple,
|
|
31
|
+
return (React__default.createElement(Editor, { error: error, loading: loading, query: query, setQuery: setQuery, value: value, onCommit: onCommit, options: resolvedOptions, multiple: multiple, editorLabel: editorLabel, filterName: filter.name }));
|
|
32
32
|
}
|
|
33
33
|
function getLazyEditor(display) {
|
|
34
34
|
if (display === "combobox")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionEditorsLazy.js","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"sourcesContent":["import { ComboBoxItem } from \"@components/combo-box\"\nimport {\n LoadingAnnouncement,\n LoadingSpinner,\n SuppressLoadingAnnouncementContext,\n} from \"@components/internal\"\nimport { useDebouncedValue } from \"@utilities/useDebouncedValue\"\nimport React, { Key, useCallback, useEffect, useState } from \"react\"\n\nimport styles from \"./CollectionEditorsLazy.module.css\"\nimport type {\n CollectionFilterEditorProps,\n CollectionFilterValue,\n CollectionOptionsLazy,\n} from \"./CollectionEditorsShared\"\nimport { CollectionEditorCombobox } from \"./CollectionEditorsShared\"\nimport {\n CollectionEditorCheckboxes,\n CollectionEditorRadios,\n CollectionEditorSelect,\n CollectionEditorStaticProps,\n} from \"./CollectionEditorsStatic\"\nimport type { CollectionDisplay, CollectionOption } from \"./collectionFilter\"\nimport type { ActiveFilterLabel } from \"./FilterTypes\"\nimport { useFocusFirstControlAfterLoad } from \"./FocusFirstControl\"\nimport { useLazyOptions } from \"./useLazyOptions\"\nimport { isEmptyValue } from \"./utils\"\n\ntype CollectionEditorLazyProps = CollectionEditorStaticProps & {\n error: unknown\n loading: boolean\n query: string | undefined\n setQuery: (query: string | undefined) => void\n}\n\nconst DEBOUNCE_MS = 300\n\nexport function CollectionFilterEditorLazy({\n config,\n onChange,\n operator,\n value,\n filter,\n label,\n scope,\n}: CollectionFilterEditorProps) {\n const { display, multiple } = config\n const loadOptions = config.options as CollectionOptionsLazy\n const options = useCallback(\n (query?: string) => loadOptions(query, scope),\n [loadOptions, scope]\n )\n const [query, setQuery] = useState<string | undefined>()\n const debouncedQuery = useDebouncedValue(query, DEBOUNCE_MS)\n const {\n error,\n loading,\n options: resolvedOptions,\n } = useLazyOptions(options, debouncedQuery)\n useFocusFirstControlAfterLoad(loading)\n const onCommit = useCallback(\n (newValue: CollectionFilterValue) => {\n const newLabel = findLabelFromOptions(resolvedOptions, newValue, {\n label,\n value,\n })\n return onChange(\n { label: newLabel, value: newValue },\n { complete: !isEmptyValue(newValue) }\n )\n },\n [resolvedOptions, onChange, value, label]\n )\n const Editor = getLazyEditor(display)\n\n return (\n <Editor\n error={error}\n loading={loading}\n query={query}\n setQuery={setQuery}\n value={value}\n onCommit={onCommit}\n options={resolvedOptions}\n multiple={multiple}\n operator={operator}\n filterLabel={filter.label}\n filterName={filter.name}\n />\n )\n}\n\nfunction getLazyEditor(display: CollectionDisplay) {\n if (display === \"combobox\") return CollectionEditorComboboxLazy\n if (display === \"checkboxes\") return CollectionEditorCheckboxesLazy\n if (display === \"radios\") return CollectionEditorRadiosLazy\n return CollectionEditorSelectLazy\n}\n\nfunction CollectionEditorCheckboxesLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorCheckboxes {...props} />\n}\n\nfunction CollectionEditorRadiosLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorRadios {...props} />\n}\n\nfunction CollectionEditorSelectLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorSelect {...props} />\n}\n\nfunction CollectionEditorComboboxLazy({\n error,\n onCommit,\n options,\n query,\n loading,\n setQuery,\n ...props\n}: CollectionEditorLazyProps) {\n const [loadingState, setLoadingState] = useState<\n \"loading\" | \"filtering\" | \"idle\"\n >(loading ? \"loading\" : \"idle\")\n useEffect(() => {\n if (!loading) {\n setLoadingState(\"idle\")\n }\n }, [loading])\n\n return (\n <SuppressLoadingAnnouncementContext.Provider\n value={loadingState === \"loading\"}\n >\n <CollectionEditorCombobox\n {...props}\n loadingState={error ? \"error\" : loadingState}\n inputValue={query}\n onInputChange={(q: string) => {\n setLoadingState(\"filtering\")\n setQuery(q)\n }}\n onChange={(value: Key | Key[] | null) => {\n if (value === null) return\n\n const resolvedValue = Array.isArray(value)\n ? value.map(String)\n : String(value)\n onCommit(resolvedValue)\n }}\n items={options}\n renderEmptyState={error ? <LoadError /> : \"No results\"}\n >\n {(o) => {\n const option = o as CollectionOption\n return (\n <ComboBoxItem key={option.value} id={option.value}>\n {option.label}\n </ComboBoxItem>\n )\n }}\n </CollectionEditorCombobox>\n </SuppressLoadingAnnouncementContext.Provider>\n )\n}\n\nexport function Loading() {\n return (\n <div className={styles[\"loading\"]}>\n <span>Loading...</span>\n <LoadingSpinner />\n <LoadingAnnouncement message=\"Loading\" />\n </div>\n )\n}\n\nexport function LoadError() {\n return (\n <div className={styles[\"load-error\"]} role=\"alert\">\n Error: Failed to load options\n </div>\n )\n}\n\nfunction findLabelFromOptions(\n options: CollectionOption[],\n value: CollectionFilterValue,\n previous: { label?: ActiveFilterLabel; value: CollectionFilterValue }\n) {\n const previousLabelByValue = buildPreviousLabelByValue(previous)\n const labelFor = (v: string) =>\n options.find((option) => option.value === v)?.label ??\n previousLabelByValue.get(v)\n\n return Array.isArray(value)\n ? value.map(labelFor).filter((label) => label !== undefined)\n : labelFor(value)\n}\n\nfunction buildPreviousLabelByValue(previous: {\n label?: ActiveFilterLabel\n value: CollectionFilterValue\n}): Map<string, string | undefined> {\n const previousValues = normalizeValueToArray(previous.value)\n const previousLabels = normalizeValueToArray(previous.label)\n return new Map(previousValues.map((v, index) => [v, previousLabels[index]]))\n}\n\nfunction normalizeValueToArray(value: string | string[] | undefined): string[] {\n if (value === undefined) return []\n return Array.isArray(value) ? value : [value]\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AAmCA,MAAM,WAAW,GAAG,GAAG;SAEP,0BAA0B,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,GACuB,EAAA;AAC5B,IAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM;AACpC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,OAAgC;IAC3D,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,KAAc,KAAK,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAC7C,CAAC,WAAW,EAAE,KAAK,CAAC,CACrB;IACD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAsB;IACxD,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC;AAC5D,IAAA,MAAM,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EAAE,eAAe,GACzB,GAAG,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC;IAC3C,6BAA6B,CAAC,OAAO,CAAC;AACtC,IAAA,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,QAA+B,KAAI;AAClC,QAAA,MAAM,QAAQ,GAAG,oBAAoB,CAAC,eAAe,EAAE,QAAQ,EAAE;YAC/D,KAAK;YACL,KAAK;AACN,SAAA,CAAC;QACF,OAAO,QAAQ,CACb,EAAE,KAAK,EAAE,QA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;AAEA,SAAS,oBAAoB,CAC3B,OAA2B,EAC3B,KAA4B,EAC5B,QAAqE,EAAA;AAErE,IAAA,MAAM,oBAAoB,GAAG,yBAAyB,CAAC,QAAQ,CAAC;IAChE,MAAM,QAAQ,GAAG,CAAC,CAAS,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,EAAE,KAAK;AACnD,QAAA,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7B,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK;AACxB,UAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,SAAS;AAC3D,UAAE,QAAQ,CAAC,KAAK,CAAC;AACrB;AAEA,SAAS,yBAAyB,CAAC,QAGlC,EAAA;IACC,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC5D,MAAM,cAAc,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC5D,OAAO,IAAI,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9E;AAEA,SAAS,qBAAqB,CAAC,KAAoC,EAAA;IACjE,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,EAAE;AAClC,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;AAC/C;;;;"}
|
|
1
|
+
{"version":3,"file":"CollectionEditorsLazy.js","sources":["../../../src/components/DataTable/CollectionEditorsLazy.tsx"],"sourcesContent":["import { ComboBoxItem } from \"@components/combo-box\"\nimport {\n LoadingAnnouncement,\n LoadingSpinner,\n SuppressLoadingAnnouncementContext,\n} from \"@components/internal\"\nimport { useDebouncedValue } from \"@utilities/useDebouncedValue\"\nimport React, { Key, useCallback, useEffect, useState } from \"react\"\n\nimport styles from \"./CollectionEditorsLazy.module.css\"\nimport type {\n CollectionFilterEditorProps,\n CollectionFilterValue,\n CollectionOptionsLazy,\n} from \"./CollectionEditorsShared\"\nimport { CollectionEditorCombobox } from \"./CollectionEditorsShared\"\nimport {\n CollectionEditorCheckboxes,\n CollectionEditorRadios,\n CollectionEditorSelect,\n CollectionEditorStaticProps,\n} from \"./CollectionEditorsStatic\"\nimport type { CollectionDisplay, CollectionOption } from \"./collectionFilter\"\nimport type { ActiveFilterLabel } from \"./FilterTypes\"\nimport { useFocusFirstControlAfterLoad } from \"./FocusFirstControl\"\nimport { useLazyOptions } from \"./useLazyOptions\"\nimport { isEmptyValue } from \"./utils\"\n\ntype CollectionEditorLazyProps = CollectionEditorStaticProps & {\n error: unknown\n loading: boolean\n query: string | undefined\n setQuery: (query: string | undefined) => void\n}\n\nconst DEBOUNCE_MS = 300\n\nexport function CollectionFilterEditorLazy({\n config,\n editorLabel,\n onChange,\n value,\n filter,\n label,\n scope,\n}: CollectionFilterEditorProps) {\n const { display, multiple } = config\n const loadOptions = config.options as CollectionOptionsLazy\n const options = useCallback(\n (query?: string) => loadOptions(query, scope),\n [loadOptions, scope]\n )\n const [query, setQuery] = useState<string | undefined>()\n const debouncedQuery = useDebouncedValue(query, DEBOUNCE_MS)\n const {\n error,\n loading,\n options: resolvedOptions,\n } = useLazyOptions(options, debouncedQuery)\n useFocusFirstControlAfterLoad(loading)\n const onCommit = useCallback(\n (newValue: CollectionFilterValue) => {\n const newLabel = findLabelFromOptions(resolvedOptions, newValue, {\n label,\n value,\n })\n return onChange(\n { label: newLabel, value: newValue },\n { complete: !isEmptyValue(newValue) }\n )\n },\n [resolvedOptions, onChange, value, label]\n )\n const Editor = getLazyEditor(display)\n\n return (\n <Editor\n error={error}\n loading={loading}\n query={query}\n setQuery={setQuery}\n value={value}\n onCommit={onCommit}\n options={resolvedOptions}\n multiple={multiple}\n editorLabel={editorLabel}\n filterName={filter.name}\n />\n )\n}\n\nfunction getLazyEditor(display: CollectionDisplay) {\n if (display === \"combobox\") return CollectionEditorComboboxLazy\n if (display === \"checkboxes\") return CollectionEditorCheckboxesLazy\n if (display === \"radios\") return CollectionEditorRadiosLazy\n return CollectionEditorSelectLazy\n}\n\nfunction CollectionEditorCheckboxesLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorCheckboxes {...props} />\n}\n\nfunction CollectionEditorRadiosLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorRadios {...props} />\n}\n\nfunction CollectionEditorSelectLazy({\n error,\n loading,\n ...props\n}: CollectionEditorLazyProps) {\n if (loading) return <Loading />\n if (error) return <LoadError />\n return <CollectionEditorSelect {...props} />\n}\n\nfunction CollectionEditorComboboxLazy({\n error,\n onCommit,\n options,\n query,\n loading,\n setQuery,\n ...props\n}: CollectionEditorLazyProps) {\n const [loadingState, setLoadingState] = useState<\n \"loading\" | \"filtering\" | \"idle\"\n >(loading ? \"loading\" : \"idle\")\n useEffect(() => {\n if (!loading) {\n setLoadingState(\"idle\")\n }\n }, [loading])\n\n return (\n <SuppressLoadingAnnouncementContext.Provider\n value={loadingState === \"loading\"}\n >\n <CollectionEditorCombobox\n {...props}\n loadingState={error ? \"error\" : loadingState}\n inputValue={query}\n onInputChange={(q: string) => {\n setLoadingState(\"filtering\")\n setQuery(q)\n }}\n onChange={(value: Key | Key[] | null) => {\n if (value === null) return\n\n const resolvedValue = Array.isArray(value)\n ? value.map(String)\n : String(value)\n onCommit(resolvedValue)\n }}\n items={options}\n renderEmptyState={error ? <LoadError /> : \"No results\"}\n >\n {(o) => {\n const option = o as CollectionOption\n return (\n <ComboBoxItem key={option.value} id={option.value}>\n {option.label}\n </ComboBoxItem>\n )\n }}\n </CollectionEditorCombobox>\n </SuppressLoadingAnnouncementContext.Provider>\n )\n}\n\nexport function Loading() {\n return (\n <div className={styles[\"loading\"]}>\n <span>Loading...</span>\n <LoadingSpinner />\n <LoadingAnnouncement message=\"Loading\" />\n </div>\n )\n}\n\nexport function LoadError() {\n return (\n <div className={styles[\"load-error\"]} role=\"alert\">\n Error: Failed to load options\n </div>\n )\n}\n\nfunction findLabelFromOptions(\n options: CollectionOption[],\n value: CollectionFilterValue,\n previous: { label?: ActiveFilterLabel; value: CollectionFilterValue }\n) {\n const previousLabelByValue = buildPreviousLabelByValue(previous)\n const labelFor = (v: string) =>\n options.find((option) => option.value === v)?.label ??\n previousLabelByValue.get(v)\n\n return Array.isArray(value)\n ? value.map(labelFor).filter((label) => label !== undefined)\n : labelFor(value)\n}\n\nfunction buildPreviousLabelByValue(previous: {\n label?: ActiveFilterLabel\n value: CollectionFilterValue\n}): Map<string, string | undefined> {\n const previousValues = normalizeValueToArray(previous.value)\n const previousLabels = normalizeValueToArray(previous.label)\n return new Map(previousValues.map((v, index) => [v, previousLabels[index]]))\n}\n\nfunction normalizeValueToArray(value: string | string[] | undefined): string[] {\n if (value === undefined) return []\n return Array.isArray(value) ? value : [value]\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AAmCA,MAAM,WAAW,GAAG,GAAG;SAEP,0BAA0B,CAAC,EACzC,MAAM,EACN,WAAW,EACX,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,GACuB,EAAA;AAC5B,IAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM;AACpC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,OAAgC;IAC3D,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,KAAc,KAAK,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAC7C,CAAC,WAAW,EAAE,KAAK,CAAC,CACrB;IACD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAsB;IACxD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C,EAAA;IACjE,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,EAAE;AAClC,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;AAC/C;;;;"}
|
|
@@ -8,10 +8,8 @@ export type CollectionFilterValue = string | string[];
|
|
|
8
8
|
export type CollectionOptionsLazy = (q: string | undefined, scope?: string) => Promise<CollectionOption[]> | CollectionOption[];
|
|
9
9
|
export type CollectionOptions = CollectionOption[] | CollectionOptionsLazy;
|
|
10
10
|
export type CollectionEditorProps = {
|
|
11
|
+
editorLabel: string;
|
|
11
12
|
multiple: boolean;
|
|
12
|
-
operator: {
|
|
13
|
-
label: string;
|
|
14
|
-
};
|
|
15
13
|
value: CollectionFilterValue;
|
|
16
14
|
};
|
|
17
15
|
export type CollectionFilterEditorProps = {
|
|
@@ -20,18 +18,16 @@ export type CollectionFilterEditorProps = {
|
|
|
20
18
|
multiple: boolean;
|
|
21
19
|
options: CollectionOptions;
|
|
22
20
|
};
|
|
21
|
+
/** The control's accessible name. Not the same as `label`, which is the selected value's text. */
|
|
22
|
+
editorLabel: string;
|
|
23
23
|
filter: {
|
|
24
|
-
label: string;
|
|
25
24
|
name: string;
|
|
26
25
|
};
|
|
27
26
|
label: ActiveFilterLabel;
|
|
28
27
|
onChange: FilterChange;
|
|
29
|
-
operator: {
|
|
30
|
-
label: string;
|
|
31
|
-
};
|
|
32
28
|
scope?: string;
|
|
33
29
|
value: CollectionFilterValue;
|
|
34
30
|
};
|
|
35
31
|
export declare function orderByOptions(options: CollectionOption[], selected: Set<string>): string[];
|
|
36
|
-
export declare function CollectionEditorCombobox({ value, multiple,
|
|
32
|
+
export declare function CollectionEditorCombobox({ editorLabel, value, multiple, ...props }: CollectionEditorProps & Partial<ComboBoxElementProps> & Pick<ComboBoxElementProps, "children">): React.JSX.Element;
|
|
37
33
|
//# sourceMappingURL=CollectionEditorsShared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionEditorsShared.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsShared.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEpE,2EAA2E;AAC3E,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;AAErD,MAAM,MAAM,qBAAqB,GAAG,CAClC,CAAC,EAAE,MAAM,GAAG,SAAS,EACrB,KAAK,CAAC,EAAE,MAAM,KACX,OAAO,CAAC,gBAAgB,EAAE,CAAC,GAAG,gBAAgB,EAAE,CAAA;AACrD,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,EAAE,GAAG,qBAAqB,CAAA;AAE1E,MAAM,MAAM,qBAAqB,GAAG;IAClC,
|
|
1
|
+
{"version":3,"file":"CollectionEditorsShared.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsShared.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEpE,2EAA2E;AAC3E,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;AAErD,MAAM,MAAM,qBAAqB,GAAG,CAClC,CAAC,EAAE,MAAM,GAAG,SAAS,EACrB,KAAK,CAAC,EAAE,MAAM,KACX,OAAO,CAAC,gBAAgB,EAAE,CAAC,GAAG,gBAAgB,EAAE,CAAA;AACrD,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,EAAE,GAAG,qBAAqB,CAAA;AAE1E,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,qBAAqB,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE;QACN,OAAO,EAAE,iBAAiB,CAAA;QAC1B,QAAQ,EAAE,OAAO,CAAA;QACjB,OAAO,EAAE,iBAAiB,CAAA;KAC3B,CAAA;IACD,kGAAkG;IAClG,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,KAAK,EAAE,iBAAiB,CAAA;IACxB,QAAQ,EAAE,YAAY,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,qBAAqB,CAAA;CAC7B,CAAA;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,gBAAgB,EAAE,EAC3B,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,YAGtB;AAED,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EACX,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,qBAAqB,GACtB,OAAO,CAAC,oBAAoB,CAAC,GAC7B,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,qBAUvC"}
|
|
@@ -4,8 +4,8 @@ import React__default from 'react';
|
|
|
4
4
|
function orderByOptions(options, selected) {
|
|
5
5
|
return options.filter((o) => selected.has(o.value)).map((o) => o.value);
|
|
6
6
|
}
|
|
7
|
-
function CollectionEditorCombobox({ value, multiple,
|
|
8
|
-
return (React__default.createElement(ComboBox, { hideLabel: true, label:
|
|
7
|
+
function CollectionEditorCombobox({ editorLabel, value, multiple, ...props }) {
|
|
8
|
+
return (React__default.createElement(ComboBox, { hideLabel: true, label: editorLabel, selectionMode: multiple ? "multiple" : "single", value: value, ...props }));
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export { CollectionEditorCombobox, orderByOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionEditorsShared.js","sources":["../../../src/components/DataTable/CollectionEditorsShared.tsx"],"sourcesContent":["import { ComboBox, type ComboBoxElementProps } from \"@components/combo-box\"\nimport React from \"react\"\n\nimport type { CollectionDisplay } from \"./collectionFilter\"\nimport { CollectionOption } from \"./collectionFilter\"\nimport type { ActiveFilterLabel, FilterChange } from \"./FilterTypes\"\n\n/** A single option's `value`, or the selected `value`s when `multiple`. */\nexport type CollectionFilterValue = string | string[]\n\nexport type CollectionOptionsLazy = (\n q: string | undefined,\n scope?: string\n) => Promise<CollectionOption[]> | CollectionOption[]\nexport type CollectionOptions = CollectionOption[] | CollectionOptionsLazy\n\nexport type CollectionEditorProps = {\n
|
|
1
|
+
{"version":3,"file":"CollectionEditorsShared.js","sources":["../../../src/components/DataTable/CollectionEditorsShared.tsx"],"sourcesContent":["import { ComboBox, type ComboBoxElementProps } from \"@components/combo-box\"\nimport React from \"react\"\n\nimport type { CollectionDisplay } from \"./collectionFilter\"\nimport { CollectionOption } from \"./collectionFilter\"\nimport type { ActiveFilterLabel, FilterChange } from \"./FilterTypes\"\n\n/** A single option's `value`, or the selected `value`s when `multiple`. */\nexport type CollectionFilterValue = string | string[]\n\nexport type CollectionOptionsLazy = (\n q: string | undefined,\n scope?: string\n) => Promise<CollectionOption[]> | CollectionOption[]\nexport type CollectionOptions = CollectionOption[] | CollectionOptionsLazy\n\nexport type CollectionEditorProps = {\n editorLabel: string\n multiple: boolean\n value: CollectionFilterValue\n}\n\nexport type CollectionFilterEditorProps = {\n config: {\n display: CollectionDisplay\n multiple: boolean\n options: CollectionOptions\n }\n /** The control's accessible name. Not the same as `label`, which is the selected value's text. */\n editorLabel: string\n filter: {\n name: string\n }\n label: ActiveFilterLabel\n onChange: FilterChange\n scope?: string\n value: CollectionFilterValue\n}\n\nexport function orderByOptions(\n options: CollectionOption[],\n selected: Set<string>\n) {\n return options.filter((o) => selected.has(o.value)).map((o) => o.value)\n}\n\nexport function CollectionEditorCombobox({\n editorLabel,\n value,\n multiple,\n ...props\n}: CollectionEditorProps &\n Partial<ComboBoxElementProps> &\n Pick<ComboBoxElementProps, \"children\">) {\n return (\n <ComboBox\n hideLabel\n label={editorLabel}\n selectionMode={multiple ? \"multiple\" : \"single\"}\n value={value}\n {...props}\n />\n )\n}\n"],"names":["React"],"mappings":";;;AAuCM,SAAU,cAAc,CAC5B,OAA2B,EAC3B,QAAqB,EAAA;AAErB,IAAA,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;AACzE;AAEM,SAAU,wBAAwB,CAAC,EACvC,WAAW,EACX,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EAG8B,EAAA;AACtC,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EACP,SAAS,EAAA,IAAA,EACT,KAAK,EAAE,WAAW,EAClB,aAAa,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,EAC/C,KAAK,EAAE,KAAK,EAAA,GACR,KAAK,EAAA,CACT;AAEN;;;;"}
|
|
@@ -2,13 +2,12 @@ import React from "react";
|
|
|
2
2
|
import { CollectionEditorProps, CollectionFilterEditorProps, CollectionFilterValue } from "./CollectionEditorsShared";
|
|
3
3
|
import type { CollectionOption } from "./collectionFilter";
|
|
4
4
|
export type CollectionEditorStaticProps = CollectionEditorProps & {
|
|
5
|
-
filterLabel: string;
|
|
6
5
|
filterName: string;
|
|
7
6
|
onCommit: (value: CollectionFilterValue) => void;
|
|
8
7
|
options: CollectionOption[];
|
|
9
8
|
};
|
|
10
|
-
export declare function CollectionFilterEditorStatic({ config,
|
|
11
|
-
export declare function CollectionEditorCheckboxes({
|
|
12
|
-
export declare function CollectionEditorRadios({
|
|
13
|
-
export declare function CollectionEditorSelect({
|
|
9
|
+
export declare function CollectionFilterEditorStatic({ config, editorLabel, onChange, value, filter, }: CollectionFilterEditorProps): React.JSX.Element;
|
|
10
|
+
export declare function CollectionEditorCheckboxes({ editorLabel, onCommit, options, value, }: CollectionEditorStaticProps): React.JSX.Element;
|
|
11
|
+
export declare function CollectionEditorRadios({ editorLabel, filterName, onCommit, options, value, }: CollectionEditorStaticProps): React.JSX.Element;
|
|
12
|
+
export declare function CollectionEditorSelect({ editorLabel, value, options, onCommit, }: CollectionEditorStaticProps): React.JSX.Element;
|
|
14
13
|
//# sourceMappingURL=CollectionEditorsStatic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionEditorsStatic.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsStatic.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAc,MAAM,OAAO,CAAA;AAElC,OAAO,EAEL,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EAEtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAqB,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG7E,MAAM,MAAM,2BAA2B,GAAG,qBAAqB,GAAG;IAChE,
|
|
1
|
+
{"version":3,"file":"CollectionEditorsStatic.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/CollectionEditorsStatic.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAc,MAAM,OAAO,CAAA;AAElC,OAAO,EAEL,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EAEtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAqB,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG7E,MAAM,MAAM,2BAA2B,GAAG,qBAAqB,GAAG;IAChE,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAA;IAChD,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAC5B,CAAA;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,WAAW,EACX,QAAQ,EACR,KAAK,EACL,MAAM,GACP,EAAE,2BAA2B,qBAmB7B;AASD,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE,2BAA2B,qBAqB7B;AAED,wBAAgB,sBAAsB,CAAC,EACrC,WAAW,EACX,UAAU,EACV,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE,2BAA2B,qBAe7B;AAED,wBAAgB,sBAAsB,CAAC,EACrC,WAAW,EACX,KAAK,EACL,OAAO,EACP,QAAQ,GACT,EAAE,2BAA2B,qBAY7B"}
|
|
@@ -8,12 +8,12 @@ import React__default from 'react';
|
|
|
8
8
|
import { CollectionEditorCombobox, orderByOptions } from './CollectionEditorsShared.js';
|
|
9
9
|
import { isEmptyValue } from './utils.js';
|
|
10
10
|
|
|
11
|
-
function CollectionFilterEditorStatic({ config,
|
|
11
|
+
function CollectionFilterEditorStatic({ config, editorLabel, onChange, value, filter, }) {
|
|
12
12
|
const { display, multiple } = config;
|
|
13
13
|
const options = config.options;
|
|
14
14
|
const onCommit = (value) => onChange({ label: undefined, value }, { complete: !isEmptyValue(value) });
|
|
15
15
|
const Editor = getStaticEditor(display);
|
|
16
|
-
return (React__default.createElement(Editor, { value: value, onCommit: onCommit, options: options, multiple: multiple,
|
|
16
|
+
return (React__default.createElement(Editor, { value: value, onCommit: onCommit, options: options, multiple: multiple, editorLabel: editorLabel, filterName: filter.name }));
|
|
17
17
|
}
|
|
18
18
|
function getStaticEditor(display) {
|
|
19
19
|
if (display === "combobox")
|
|
@@ -24,7 +24,7 @@ function getStaticEditor(display) {
|
|
|
24
24
|
return CollectionEditorRadios;
|
|
25
25
|
return CollectionEditorSelect;
|
|
26
26
|
}
|
|
27
|
-
function CollectionEditorCheckboxes({
|
|
27
|
+
function CollectionEditorCheckboxes({ editorLabel, onCommit, options, value, }) {
|
|
28
28
|
const selected = Array.isArray(value) ? value : [value];
|
|
29
29
|
const toggle = (optionValue, checked) => {
|
|
30
30
|
const next = new Set(selected);
|
|
@@ -34,17 +34,17 @@ function CollectionEditorCheckboxes({ filterLabel, onCommit, options, value, })
|
|
|
34
34
|
next.delete(optionValue);
|
|
35
35
|
onCommit(orderByOptions(options, next));
|
|
36
36
|
};
|
|
37
|
-
return (React__default.createElement(CheckboxGroup, { hideLabel: true, label:
|
|
37
|
+
return (React__default.createElement(CheckboxGroup, { hideLabel: true, label: editorLabel }, options.map((option) => (React__default.createElement(Checkbox, { key: option.value, checked: selected.includes(option.value), label: option.label, onChange: (e) => toggle(option.value, e.target.checked) })))));
|
|
38
38
|
}
|
|
39
|
-
function CollectionEditorRadios({
|
|
39
|
+
function CollectionEditorRadios({ editorLabel, filterName, onCommit, options, value, }) {
|
|
40
40
|
const selected = Array.isArray(value) ? value[0] : value;
|
|
41
|
-
return (React__default.createElement(RadioGroup, { hideLabel: true, label:
|
|
41
|
+
return (React__default.createElement(RadioGroup, { hideLabel: true, label: editorLabel }, options.map((option) => (React__default.createElement(Radio, { key: option.value, checked: selected === option.value, label: option.label, name: filterName, onChange: () => onCommit(option.value) })))));
|
|
42
42
|
}
|
|
43
|
-
function CollectionEditorSelect({
|
|
43
|
+
function CollectionEditorSelect({ editorLabel, value, options, onCommit, }) {
|
|
44
44
|
const selected = Array.isArray(value) ? value[0] : value;
|
|
45
|
-
return (React__default.createElement(Select, { hideLabel: true, label:
|
|
45
|
+
return (React__default.createElement(Select, { hideLabel: true, label: editorLabel, options: options, value: selected, onChange: (e) => onCommit(e.target.value) }));
|
|
46
46
|
}
|
|
47
|
-
function CollectionEditorComboboxStatic({ onCommit, options,
|
|
47
|
+
function CollectionEditorComboboxStatic({ onCommit, options, filterName, ...props }) {
|
|
48
48
|
return (React__default.createElement(CollectionEditorCombobox, { ...props, onChange: (value) => {
|
|
49
49
|
if (value === null)
|
|
50
50
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionEditorsStatic.js","sources":["../../../src/components/DataTable/CollectionEditorsStatic.tsx"],"sourcesContent":["import { Checkbox } from \"@components/checkbox\"\nimport { CheckboxGroup } from \"@components/checkbox-group\"\nimport { ComboBoxItem } from \"@components/combo-box\"\nimport { Radio } from \"@components/radio\"\nimport { RadioGroup } from \"@components/radio-group\"\nimport { Select } from \"@components/select\"\nimport React, { Key } from \"react\"\n\nimport {\n CollectionEditorCombobox,\n CollectionEditorProps,\n CollectionFilterEditorProps,\n CollectionFilterValue,\n orderByOptions,\n} from \"./CollectionEditorsShared\"\nimport type { CollectionDisplay, CollectionOption } from \"./collectionFilter\"\nimport { isEmptyValue } from \"./utils\"\n\nexport type CollectionEditorStaticProps = CollectionEditorProps & {\n
|
|
1
|
+
{"version":3,"file":"CollectionEditorsStatic.js","sources":["../../../src/components/DataTable/CollectionEditorsStatic.tsx"],"sourcesContent":["import { Checkbox } from \"@components/checkbox\"\nimport { CheckboxGroup } from \"@components/checkbox-group\"\nimport { ComboBoxItem } from \"@components/combo-box\"\nimport { Radio } from \"@components/radio\"\nimport { RadioGroup } from \"@components/radio-group\"\nimport { Select } from \"@components/select\"\nimport React, { Key } from \"react\"\n\nimport {\n CollectionEditorCombobox,\n CollectionEditorProps,\n CollectionFilterEditorProps,\n CollectionFilterValue,\n orderByOptions,\n} from \"./CollectionEditorsShared\"\nimport type { CollectionDisplay, CollectionOption } from \"./collectionFilter\"\nimport { isEmptyValue } from \"./utils\"\n\nexport type CollectionEditorStaticProps = CollectionEditorProps & {\n filterName: string\n onCommit: (value: CollectionFilterValue) => void\n options: CollectionOption[]\n}\n\nexport function CollectionFilterEditorStatic({\n config,\n editorLabel,\n onChange,\n value,\n filter,\n}: CollectionFilterEditorProps) {\n const { display, multiple } = config\n const options = config.options as CollectionOption[]\n\n const onCommit = (value: CollectionFilterValue) =>\n onChange({ label: undefined, value }, { complete: !isEmptyValue(value) })\n\n const Editor = getStaticEditor(display)\n\n return (\n <Editor\n value={value}\n onCommit={onCommit}\n options={options}\n multiple={multiple}\n editorLabel={editorLabel}\n filterName={filter.name}\n />\n )\n}\n\nfunction getStaticEditor(display: CollectionDisplay) {\n if (display === \"combobox\") return CollectionEditorComboboxStatic\n if (display === \"checkboxes\") return CollectionEditorCheckboxes\n if (display === \"radios\") return CollectionEditorRadios\n return CollectionEditorSelect\n}\n\nexport function CollectionEditorCheckboxes({\n editorLabel,\n onCommit,\n options,\n value,\n}: CollectionEditorStaticProps) {\n const selected = Array.isArray(value) ? value : [value]\n const toggle = (optionValue: string, checked: boolean) => {\n const next = new Set(selected)\n if (checked) next.add(optionValue)\n else next.delete(optionValue)\n onCommit(orderByOptions(options, next))\n }\n\n return (\n <CheckboxGroup hideLabel label={editorLabel}>\n {options.map((option) => (\n <Checkbox\n key={option.value}\n checked={selected.includes(option.value)}\n label={option.label}\n onChange={(e) => toggle(option.value, e.target.checked)}\n />\n ))}\n </CheckboxGroup>\n )\n}\n\nexport function CollectionEditorRadios({\n editorLabel,\n filterName,\n onCommit,\n options,\n value,\n}: CollectionEditorStaticProps) {\n const selected = Array.isArray(value) ? value[0] : value\n return (\n <RadioGroup hideLabel label={editorLabel}>\n {options.map((option) => (\n <Radio\n key={option.value}\n checked={selected === option.value}\n label={option.label}\n name={filterName}\n onChange={() => onCommit(option.value)}\n />\n ))}\n </RadioGroup>\n )\n}\n\nexport function CollectionEditorSelect({\n editorLabel,\n value,\n options,\n onCommit,\n}: CollectionEditorStaticProps) {\n const selected = Array.isArray(value) ? value[0] : value\n\n return (\n <Select\n hideLabel\n label={editorLabel}\n options={options}\n value={selected}\n onChange={(e) => onCommit(e.target.value)}\n />\n )\n}\n\nfunction CollectionEditorComboboxStatic({\n onCommit,\n options,\n filterName,\n ...props\n}: CollectionEditorStaticProps) {\n return (\n <CollectionEditorCombobox\n {...props}\n onChange={(value: Key | Key[] | null) => {\n if (value === null) return\n\n const resolvedValue = Array.isArray(value)\n ? orderByOptions(options, new Set(value.map(String)))\n : String(value)\n\n onCommit(resolvedValue)\n }}\n >\n {options.map((option) => (\n <ComboBoxItem key={option.value} id={option.value}>\n {option.label}\n </ComboBoxItem>\n ))}\n </CollectionEditorCombobox>\n )\n}\n"],"names":["React"],"mappings":";;;;;;;;;;AAwBM,SAAU,4BAA4B,CAAC,EAC3C,MAAM,EACN,WAAW,EACX,QAAQ,EACR,KAAK,EACL,MAAM,GACsB,EAAA;AAC5B,IAAA,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM;AACpC,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,OAA6B;IAEpD,MAAM,QAAQ,GAAG,CAAC,KAA4B,KAC5C,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;AAE3E,IAAA,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC;AAEvC,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,CAAC,IAAI,EAAA,CACvB;AAEN;AAEA,SAAS,eAAe,CAAC,OAA0B,EAAA;IACjD,IAAI,OAAO,KAAK,UAAU;AAAE,QAAA,OAAO,8BAA8B;IACjE,IAAI,OAAO,KAAK,YAAY;AAAE,QAAA,OAAO,0BAA0B;IAC/D,IAAI,OAAO,KAAK,QAAQ;AAA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AAE,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACpD,kBAAE,MAAM,CAAC,KAAK,CAAC;YAEjB,QAAQ,CAAC,aAAa,CAAC;AACzB,QAAA,CAAC,EAAA,EAEA,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MAClBA,cAAA,CAAA,aAAA,CAAC,YAAY,EAAA,EAAC,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,EAAA,EAC9C,MAAM,CAAC,KAAK,CACA,CAChB,CAAC,CACuB;AAE/B;;;;"}
|
|
@@ -4,13 +4,14 @@ import type { CombineAriaPropsWithCustomProps } from "../../utilities/reactAriaP
|
|
|
4
4
|
import React, { type ReactNode } from "react";
|
|
5
5
|
import { type TableProps as AriaTableProps } from "react-aria-components/Table";
|
|
6
6
|
import type { DataTableColumn } from "./DataTableColumn";
|
|
7
|
+
import { type DataTableRowAppearance } from "./DataTableRow";
|
|
7
8
|
import type { ActiveFilter, FilterNode } from "./FilterTypes";
|
|
8
9
|
import { type ResultNoun } from "./ResultsCount";
|
|
9
10
|
import { type RowAction } from "./RowActions";
|
|
10
11
|
import { type TableAction } from "./TableActions";
|
|
11
12
|
import { type DataTableSelection } from "./useDataTableSelection";
|
|
12
13
|
import { type SavedView, type StaticView, type View } from "./views";
|
|
13
|
-
export type { DataTableSelection, ResultNoun, RowAction, TableAction };
|
|
14
|
+
export type { DataTableRowAppearance, DataTableSelection, ResultNoun, RowAction, TableAction, };
|
|
14
15
|
/**
|
|
15
16
|
* A PCO API order string: the column name for ascending (`"lastName"`), or
|
|
16
17
|
* the name prefixed with a hyphen for descending (`"-lastName"`).
|
|
@@ -50,6 +51,23 @@ interface DataTableBaseProps {
|
|
|
50
51
|
* `q` is reserved for the search, so no filter can use it as its name.
|
|
51
52
|
*/
|
|
52
53
|
filters?: FilterNode[];
|
|
54
|
+
/**
|
|
55
|
+
* Returns one of a fixed set of looks for the row, or `undefined` for the
|
|
56
|
+
* default. Called on every render, so the appearance can depend on state
|
|
57
|
+
* outside the row, such as a date picked elsewhere on the page. A row has
|
|
58
|
+
* one appearance at a time; return the one that matters most.
|
|
59
|
+
* - `"reveal"`: something outside the table points to the row. A highlight
|
|
60
|
+
* plays when the row's appearance changes to `"reveal"`, then fades.
|
|
61
|
+
* - `"flagged"`: the row needs attention. A persistent tint.
|
|
62
|
+
* - `"new"`: the row was recently added. A persistent tint.
|
|
63
|
+
* - `"muted"`: the row is less relevant. Subdued text.
|
|
64
|
+
*
|
|
65
|
+
* Reveal sits above selection and hover, which sit above flagged and new.
|
|
66
|
+
* Color can't be the only signal, so flagged and new rows also need a
|
|
67
|
+
* visible indicator in a cell, such as an icon or badge. A reveal doesn't
|
|
68
|
+
* move focus; announce reveals that matter, such as "3 events on November 9".
|
|
69
|
+
*/
|
|
70
|
+
getRowAppearance?: (row: unknown) => DataTableRowAppearance | undefined;
|
|
53
71
|
/** Returns a stable identity for each row. Defaults to `row.id`. */
|
|
54
72
|
getRowId?: (row: unknown) => number | string;
|
|
55
73
|
/**
|
|
@@ -248,8 +266,9 @@ interface DataTableBaseProps {
|
|
|
248
266
|
resultNoun?: ResultNoun;
|
|
249
267
|
/**
|
|
250
268
|
* Displays a sticky column to the right that holds row-scoped actions.
|
|
251
|
-
* Renders as a dropdown with 2+ actions or a single button with one.
|
|
252
|
-
*
|
|
269
|
+
* Renders as a dropdown with 2+ actions or a single button with one. Every
|
|
270
|
+
* row renders the same control, even when `hidden` leaves a row with one
|
|
271
|
+
* action. Each action's `onAction` or `getHref` receives the row.
|
|
253
272
|
*/
|
|
254
273
|
rowActions?: RowAction[];
|
|
255
274
|
/** Ref to the scroll container the sticky header should track. Takes priority over `scrollContainerSelector`. Only used when `stickyHeader` is true. */
|
|
@@ -274,8 +293,11 @@ interface DataTableBaseProps {
|
|
|
274
293
|
/**
|
|
275
294
|
* Read-only views from the app, listed before the saved views. Ids must not
|
|
276
295
|
* overlap with `initialSavedViews`. Unless one has the id `"initial"`, an
|
|
277
|
-
* "All" view is added first.
|
|
278
|
-
*
|
|
296
|
+
* "All" view is added first. A table that opens filtered should pass those
|
|
297
|
+
* filters as a view with the id `"initial"`, which replaces "All" and is the
|
|
298
|
+
* default. Once the table's filters, sort, or visible columns differ from a
|
|
299
|
+
* static view, it isn't shown as selected; picking it again reapplies it.
|
|
300
|
+
* Omit both `staticViews` and `initialSavedViews` to hide the views bar.
|
|
279
301
|
*/
|
|
280
302
|
staticViews?: StaticView[];
|
|
281
303
|
/** Enables a sticky header that tracks an outer scroll container. Progressive enhancement: Relies on `animation-timeline: scroll()`, which isn't supported in all browsers (e.g. Firefox) — the header scrolls with the table body instead of sticking in those cases. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,eAAe,CAAA;AAMtB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAGhF,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AACd,OAAO,EASL,KAAK,UAAU,IAAI,cAAc,EAClC,MAAM,6BAA6B,CAAA;AAGpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,eAAe,CAAA;AAMtB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAGhF,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AACd,OAAO,EASL,KAAK,UAAU,IAAI,cAAc,EAClC,MAAM,6BAA6B,CAAA;AAGpC,OAAO,KAAK,EAAE,eAAe,EAAE,MA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|
34
34
|
import { ViewSettingsToggle } from './ViewSettingsToggle.js';
|
|
35
35
|
|
|
36
36
|
const DEFAULT_ERROR_STATE = "Something went wrong.";
|
|
37
|
+
const ROW_APPEARANCES = new Set(["flagged", "muted", "new", "reveal"]);
|
|
37
38
|
/**
|
|
38
39
|
* A table for displaying tabular data. Built on React Aria's `Table`.
|
|
39
40
|
*
|
|
@@ -53,7 +54,7 @@ const DEFAULT_ERROR_STATE = "Something went wrong.";
|
|
|
53
54
|
*/
|
|
54
55
|
const DataTable = ({ activeFilters = [], filters = [], ...props }) => (React__default.createElement(FiltersProvider, { activeFilters: activeFilters, filters: filters },
|
|
55
56
|
React__default.createElement(DataTableInner, { ...props, activeFilters: activeFilters, filters: filters })));
|
|
56
|
-
const DataTableInner = ({ activeFilters = [], className, canSelectAllPages, columns, currentPage = 1, data, disabledKeys, emptyState, errorState, filters = [], getRowId, getRowLink, hasNextPage = false, hasPreviousPage = false, id, initialDefaultViewId = "initial", initialSavedViews, loadingState = "idle", paginationType = "paged", resultCount, resultNoun, scrollContainerRef, scrollContainerSelector = ".content-wrap", rowActions, searchable, selectable, selectedKeys: controlledSelectedKeys, staticViews: staticViewsProp, stickyHeader, sortBy, tableActions, totalDisabledCount, totalPages, visibleColumnNames, onActiveFiltersChange = () => { }, onDefaultViewIdChange: onDefaultViewIdChangeProp, onNextPageClick, onPageChange, onPreviousPageClick, onRowClick, onSavedViewCreate: onSavedViewCreateProp, onSavedViewDelete: onSavedViewDeleteProp, onSavedViewReorder, onSavedViewUpdate: onSavedViewUpdateProp, onSelectedChange, onSortChange, onVisibleColumnNamesChange, ...restProps }) => {
|
|
57
|
+
const DataTableInner = ({ activeFilters = [], className, canSelectAllPages, columns, currentPage = 1, data, disabledKeys, emptyState, errorState, filters = [], getRowAppearance, getRowId, getRowLink, hasNextPage = false, hasPreviousPage = false, id, initialDefaultViewId = "initial", initialSavedViews, loadingState = "idle", paginationType = "paged", resultCount, resultNoun, scrollContainerRef, scrollContainerSelector = ".content-wrap", rowActions, searchable, selectable, selectedKeys: controlledSelectedKeys, staticViews: staticViewsProp, stickyHeader, sortBy, tableActions, totalDisabledCount, totalPages, visibleColumnNames, onActiveFiltersChange = () => { }, onDefaultViewIdChange: onDefaultViewIdChangeProp, onNextPageClick, onPageChange, onPreviousPageClick, onRowClick, onSavedViewCreate: onSavedViewCreateProp, onSavedViewDelete: onSavedViewDeleteProp, onSavedViewReorder, onSavedViewUpdate: onSavedViewUpdateProp, onSelectedChange, onSortChange, onVisibleColumnNamesChange, ...restProps }) => {
|
|
57
58
|
const hasRowPressAction = Boolean(onRowClick || getRowLink);
|
|
58
59
|
const rowsAreInteractive = hasRowPressAction || Boolean(selectable);
|
|
59
60
|
const combinedClassName = classNames("tds-data-table-grid", className);
|
|
@@ -217,6 +218,14 @@ const DataTableInner = ({ activeFilters = [], className, canSelectAllPages, colu
|
|
|
217
218
|
activeView.id !== applyingView?.id &&
|
|
218
219
|
isViewEditable(activeView, savedViews ?? []) &&
|
|
219
220
|
isModified(activeView);
|
|
221
|
+
// A changed system view has no Update or Discard, so the bar stops showing it
|
|
222
|
+
// as selected. Picking it again, such as after Clear filters, reapplies it.
|
|
223
|
+
const selectedView = activeView &&
|
|
224
|
+
(activeView.id === applyingView?.id ||
|
|
225
|
+
isViewEditable(activeView, savedViews ?? []) ||
|
|
226
|
+
!isModified(activeView))
|
|
227
|
+
? activeView
|
|
228
|
+
: undefined;
|
|
220
229
|
// Associate the visible results count with the table so screen readers
|
|
221
230
|
// announce it as a description of the table. `Table` doesn't support a real
|
|
222
231
|
// `<caption>` (its children go through a collection builder), so we link the
|
|
@@ -265,7 +274,7 @@ const DataTableInner = ({ activeFilters = [], className, canSelectAllPages, colu
|
|
|
265
274
|
return (React__default.createElement("div", { ref: rootRef, className: classNames("tds-data-table", {
|
|
266
275
|
"tds-data-table--sticky-header": hasScrollContainer,
|
|
267
276
|
}) },
|
|
268
|
-
(Array.isArray(staticViews) || Array.isArray(savedViews)) && (React__default.createElement(ViewsBar, { activeView:
|
|
277
|
+
(Array.isArray(staticViews) || Array.isArray(savedViews)) && (React__default.createElement(ViewsBar, { activeView: selectedView, currentState: currentState, defaultViewId: defaultViewId, isReordering: isSavedViewReordering, saveStatus: saveStatus, savedViews: savedViews ?? [], select: select, selectWhenSaved: selectWhenSaved, staticViews: staticViewsWithInitial, onApply: applyView, onCreate: onSavedViewCreate, onDelete: onSavedViewDelete, onReorder: onSavedViewMove, onSetDefault: onDefaultViewIdChange, onUpdate: onSavedViewUpdate })),
|
|
269
278
|
React__default.createElement("div", { className: "tds-data-table-frame" },
|
|
270
279
|
React__default.createElement(DataTableSelectionContext.Provider, { value: selectionModel },
|
|
271
280
|
showHeader && (React__default.createElement("div", { className: "tds-data-table-frame-header" },
|
|
@@ -307,12 +316,14 @@ const DataTableInner = ({ activeFilters = [], className, canSelectAllPages, colu
|
|
|
307
316
|
React__default.createElement("span", { className: "tds-data-table-column-label--hidden" }, "Actions")))),
|
|
308
317
|
React__default.createElement(TableBody, { className: "tds-data-table-body", renderEmptyState: renderEmptyState }, data.map((row, rowIndex) => {
|
|
309
318
|
const rowKey = getRowKey(row, rowIndex, getRowId);
|
|
319
|
+
const appearance = getRowAppearance?.(row);
|
|
310
320
|
return (React__default.createElement(Row, { key: rowKey, id: rowKey, href: getRowLink?.(row), onAction: onRowClick ? () => onRowClick(row) : undefined, className: classNames("tds-data-table-row", {
|
|
311
321
|
// A press fires the link/action only until something
|
|
312
322
|
// is selected; after that it toggles selection.
|
|
313
323
|
"tds-data-table-row--has-action": hasRowPressAction && !rowPressSelects,
|
|
314
324
|
"tds-data-table-row--interactive": rowsAreInteractive,
|
|
315
325
|
"tds-data-table-row--press-selects": rowPressSelects,
|
|
326
|
+
[`tds-data-table-row--${appearance}`]: appearance && ROW_APPEARANCES.has(appearance),
|
|
316
327
|
}) },
|
|
317
328
|
selectable && (React__default.createElement(Cell, { className: "tds-data-table-cell tds-data-table-cell--selectable" },
|
|
318
329
|
React__default.createElement(Checkbox, { slot: "selection", className: "tds-data-table-selectable-checkbox" }))),
|