@42-central/ui-react 0.26.0 → 0.28.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/{chunk-YZJUPYPO.js → chunk-2W7H43WL.js} +3 -3
- package/dist/{chunk-YZJUPYPO.js.map → chunk-2W7H43WL.js.map} +1 -1
- package/dist/{chunk-OVT2KZHY.js → chunk-3KARNPW4.js} +3 -3
- package/dist/{chunk-OVT2KZHY.js.map → chunk-3KARNPW4.js.map} +1 -1
- package/dist/chunk-6B2GNPJP.js +43 -0
- package/dist/chunk-6B2GNPJP.js.map +1 -0
- package/dist/{chunk-E52Z2FKU.js → chunk-7BY5I2RB.js} +3 -3
- package/dist/{chunk-E52Z2FKU.js.map → chunk-7BY5I2RB.js.map} +1 -1
- package/dist/{chunk-JFB6O7IY.js → chunk-7KFUFAVP.js} +4 -4
- package/dist/{chunk-JFB6O7IY.js.map → chunk-7KFUFAVP.js.map} +1 -1
- package/dist/{chunk-X3YIHN2U.js → chunk-ASKQ6N5V.js} +3 -3
- package/dist/{chunk-X3YIHN2U.js.map → chunk-ASKQ6N5V.js.map} +1 -1
- package/dist/{chunk-6IRMKF5T.js → chunk-B4GNSSHU.js} +4 -4
- package/dist/{chunk-6IRMKF5T.js.map → chunk-B4GNSSHU.js.map} +1 -1
- package/dist/{chunk-BMEJBY6H.js → chunk-B5YHYI7E.js} +22 -27
- package/dist/chunk-B5YHYI7E.js.map +1 -0
- package/dist/{chunk-PT22KEVD.js → chunk-BGDVUC3B.js} +5 -5
- package/dist/{chunk-PT22KEVD.js.map → chunk-BGDVUC3B.js.map} +1 -1
- package/dist/{chunk-7247WBTV.js → chunk-DJ72KP32.js} +3 -3
- package/dist/{chunk-7247WBTV.js.map → chunk-DJ72KP32.js.map} +1 -1
- package/dist/{chunk-7OGZT7U2.js → chunk-G3AD3NJG.js} +3 -3
- package/dist/{chunk-7OGZT7U2.js.map → chunk-G3AD3NJG.js.map} +1 -1
- package/dist/{chunk-276RL7FX.js → chunk-GJFCIG34.js} +8 -8
- package/dist/{chunk-276RL7FX.js.map → chunk-GJFCIG34.js.map} +1 -1
- package/dist/{chunk-JDPVD2YE.js → chunk-HCHGERDB.js} +3 -3
- package/dist/{chunk-JDPVD2YE.js.map → chunk-HCHGERDB.js.map} +1 -1
- package/dist/{chunk-H7WOMZXO.js → chunk-HWBFRDX7.js} +16 -8
- package/dist/chunk-HWBFRDX7.js.map +1 -0
- package/dist/{chunk-LYGOFMXJ.js → chunk-I4IJOLNA.js} +4 -4
- package/dist/{chunk-LYGOFMXJ.js.map → chunk-I4IJOLNA.js.map} +1 -1
- package/dist/{chunk-7B44J3CF.js → chunk-I53TMAV2.js} +6 -6
- package/dist/{chunk-7B44J3CF.js.map → chunk-I53TMAV2.js.map} +1 -1
- package/dist/{chunk-DSZF2TW6.js → chunk-IA6DCC3N.js} +6 -6
- package/dist/{chunk-DSZF2TW6.js.map → chunk-IA6DCC3N.js.map} +1 -1
- package/dist/{chunk-QEAF57ZQ.js → chunk-ISX3AM32.js} +3 -3
- package/dist/{chunk-QEAF57ZQ.js.map → chunk-ISX3AM32.js.map} +1 -1
- package/dist/{chunk-N42EFOML.js → chunk-K3FZHYJL.js} +6 -6
- package/dist/chunk-K3FZHYJL.js.map +1 -0
- package/dist/{chunk-ZVECQBGG.js → chunk-KNGSO7A3.js} +41 -13
- package/dist/chunk-KNGSO7A3.js.map +1 -0
- package/dist/{chunk-NLSJ6T7V.js → chunk-KYVXPSNW.js} +4 -4
- package/dist/{chunk-NLSJ6T7V.js.map → chunk-KYVXPSNW.js.map} +1 -1
- package/dist/{chunk-J2NW7JID.js → chunk-L5GH7LLD.js} +3 -3
- package/dist/{chunk-J2NW7JID.js.map → chunk-L5GH7LLD.js.map} +1 -1
- package/dist/{chunk-THGJLR5S.js → chunk-NNPSBC7O.js} +5 -5
- package/dist/{chunk-THGJLR5S.js.map → chunk-NNPSBC7O.js.map} +1 -1
- package/dist/{chunk-YMVUQ2L7.js → chunk-P7SH3XWY.js} +6 -6
- package/dist/chunk-P7SH3XWY.js.map +1 -0
- package/dist/{chunk-2CL3FKEY.js → chunk-QEMXXQQO.js} +3 -3
- package/dist/{chunk-2CL3FKEY.js.map → chunk-QEMXXQQO.js.map} +1 -1
- package/dist/{chunk-2NTCQIRP.js → chunk-QRNQQIQM.js} +5 -5
- package/dist/{chunk-2NTCQIRP.js.map → chunk-QRNQQIQM.js.map} +1 -1
- package/dist/{chunk-LKFHUDEW.js → chunk-QVOBLRCM.js} +3 -3
- package/dist/{chunk-LKFHUDEW.js.map → chunk-QVOBLRCM.js.map} +1 -1
- package/dist/{chunk-E3XLWMEB.js → chunk-RKCUXOU2.js} +4 -4
- package/dist/{chunk-E3XLWMEB.js.map → chunk-RKCUXOU2.js.map} +1 -1
- package/dist/{chunk-DMI4KS32.js → chunk-SBZJGFZ6.js} +3 -3
- package/dist/{chunk-DMI4KS32.js.map → chunk-SBZJGFZ6.js.map} +1 -1
- package/dist/{chunk-7P32XCEU.js → chunk-SLUOF7XW.js} +2 -2
- package/dist/chunk-SLUOF7XW.js.map +1 -0
- package/dist/{chunk-SCXXJDKQ.js → chunk-SP6LCCTZ.js} +21 -28
- package/dist/chunk-SP6LCCTZ.js.map +1 -0
- package/dist/{chunk-Y2G47ARQ.js → chunk-TGGNSSOJ.js} +3 -3
- package/dist/{chunk-Y2G47ARQ.js.map → chunk-TGGNSSOJ.js.map} +1 -1
- package/dist/{chunk-2TZU4LSX.js → chunk-ULF5LOBS.js} +3 -3
- package/dist/{chunk-2TZU4LSX.js.map → chunk-ULF5LOBS.js.map} +1 -1
- package/dist/{chunk-D2QIPQ74.js → chunk-W3XX7BYT.js} +2 -2
- package/dist/chunk-W3XX7BYT.js.map +1 -0
- package/dist/{chunk-F374BNL4.js → chunk-YVTM2KRR.js} +12 -8
- package/dist/chunk-YVTM2KRR.js.map +1 -0
- package/dist/colors.css +328 -0
- package/dist/components/action-icon/action-icon.d.ts +6 -5
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +3 -2
- package/dist/components/alert/index.js +2 -2
- package/dist/components/app-shell/index.js +7 -6
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/index.js +4 -4
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/index.js +2 -1
- package/dist/components/button/button.d.ts +11 -9
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +3 -2
- package/dist/components/button-multi-select/index.js +4 -3
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/index.js +4 -3
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/index.js +4 -3
- package/dist/components/calendar-heatmap/index.js +2 -2
- package/dist/components/camera/index.js +11 -10
- package/dist/components/clipboard/index.js +3 -2
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code-block/chrome.js +5 -5
- package/dist/components/code-block/index.js +6 -6
- package/dist/components/combobox/index.js +4 -4
- package/dist/components/combobox-list/index.js +6 -6
- package/dist/components/data-table/data-table-features.d.ts +8 -0
- package/dist/components/data-table/data-table-features.d.ts.map +1 -1
- package/dist/components/data-table/data-table-group.d.ts +128 -0
- package/dist/components/data-table/data-table-group.d.ts.map +1 -0
- package/dist/components/data-table/data-table-grouping.d.ts +72 -0
- package/dist/components/data-table/data-table-grouping.d.ts.map +1 -0
- package/dist/components/data-table/data-table-icons.d.ts +4 -2
- package/dist/components/data-table/data-table-icons.d.ts.map +1 -1
- package/dist/components/data-table/data-table-meta.d.ts +9 -0
- package/dist/components/data-table/data-table-meta.d.ts.map +1 -1
- package/dist/components/data-table/data-table-pagination.d.ts +4 -1
- package/dist/components/data-table/data-table-pagination.d.ts.map +1 -1
- package/dist/components/data-table/data-table-schema.d.ts +4 -0
- package/dist/components/data-table/data-table-schema.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts +16 -3
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table-toolbar.d.ts +33 -2
- package/dist/components/data-table/data-table-toolbar.d.ts.map +1 -1
- package/dist/components/data-table/data-table-translations.d.ts +35 -0
- package/dist/components/data-table/data-table-translations.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +55 -3
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.d.ts +3 -1
- package/dist/components/data-table/index.d.ts.map +1 -1
- package/dist/components/data-table/index.js +883 -234
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/index.js +12 -11
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/download-button/index.js +4 -3
- package/dist/components/drawer/index.js +7 -6
- package/dist/components/file-item/index.js +4 -3
- package/dist/components/file-preview/index.js +4 -3
- package/dist/components/file-preview/index.js.map +1 -1
- package/dist/components/file-trigger/index.js +4 -3
- package/dist/components/file-upload/index.js +4 -3
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/hover-card/index.js +3 -3
- package/dist/components/image-cropper/index.js +4 -3
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/lightbox/index.js +9 -8
- package/dist/components/lightbox/index.js.map +1 -1
- package/dist/components/menu/index.js +4 -4
- package/dist/components/modal/index.js +7 -6
- package/dist/components/multi-combobox-list/index.js +6 -6
- package/dist/components/multi-select/index.js +4 -4
- package/dist/components/nav-link/index.js +3 -3
- package/dist/components/nav-link/tanstack.js +3 -3
- package/dist/components/notification/create-notifier.d.ts.map +1 -1
- package/dist/components/notification/index.js +18 -6
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/notification/types.d.ts +5 -0
- package/dist/components/notification/types.d.ts.map +1 -1
- package/dist/components/number-input/index.js +4 -4
- package/dist/components/overlays/index.js +9 -8
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/photo-capture/index.js +13 -12
- package/dist/components/photo-capture/index.js.map +1 -1
- package/dist/components/popover/index.js +3 -3
- package/dist/components/schedule/index.js +7 -6
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/select/index.js +5 -5
- package/dist/components/spinner/index.js +1 -1
- package/dist/components/spinner/spinner.d.ts +1 -1
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/spotlight/index.js +11 -10
- package/dist/components/spotlight/index.js.map +1 -1
- package/dist/components/tags-input/index.js +3 -3
- package/dist/components/theme-icon/index.js +1 -1
- package/dist/components/theme-icon/theme-icon.d.ts.map +1 -1
- package/dist/components/time-input/index.js +5 -5
- package/dist/components/tooltip/index.js +2 -2
- package/dist/components/tree-multi-select/index.js +4 -4
- package/dist/components/tree-select/index.js +4 -4
- package/dist/index.js +2 -2
- package/dist/lib/button-colors.d.ts +25 -0
- package/dist/lib/button-colors.d.ts.map +1 -0
- package/dist/lib/overlay-container.d.ts.map +1 -1
- package/dist/lib/overlay-layer.d.ts +10 -3
- package/dist/lib/overlay-layer.d.ts.map +1 -1
- package/dist/theme.css +14 -6
- package/package.json +1 -1
- package/src/colors.css +328 -0
- package/src/components/action-icon/action-icon.test.tsx +22 -0
- package/src/components/action-icon/action-icon.tsx +24 -28
- package/src/components/badge/badge.test.tsx +53 -10
- package/src/components/badge/badge.tsx +64 -11
- package/src/components/button/button.test.tsx +41 -5
- package/src/components/button/button.tsx +28 -33
- package/src/components/data-table/data-table-features.ts +11 -0
- package/src/components/data-table/data-table-group.test.tsx +1007 -0
- package/src/components/data-table/data-table-group.tsx +474 -0
- package/src/components/data-table/data-table-grouping.ts +160 -0
- package/src/components/data-table/data-table-icons.tsx +8 -1
- package/src/components/data-table/data-table-meta.ts +9 -0
- package/src/components/data-table/data-table-pagination.tsx +5 -1
- package/src/components/data-table/data-table-stack.tsx +165 -43
- package/src/components/data-table/data-table-toolbar.tsx +110 -2
- package/src/components/data-table/data-table-translations.ts +44 -0
- package/src/components/data-table/data-table.tsx +420 -150
- package/src/components/data-table/index.ts +4 -0
- package/src/components/drawer/drawer.tsx +1 -1
- package/src/components/modal/modal.tsx +1 -1
- package/src/components/notification/create-notifier.tsx +18 -2
- package/src/components/notification/notify-in-modal.test.tsx +128 -0
- package/src/components/notification/types.ts +5 -0
- package/src/components/spinner/spinner.tsx +3 -3
- package/src/components/theme-icon/theme-icon.test.tsx +7 -0
- package/src/components/theme-icon/theme-icon.tsx +10 -6
- package/src/lib/button-colors.ts +55 -0
- package/src/lib/overlay-container.tsx +2 -1
- package/src/lib/overlay-layer.test.tsx +63 -1
- package/src/lib/overlay-layer.tsx +29 -6
- package/src/theme.css +14 -6
- package/src/theme.test.ts +14 -10
- package/dist/chunk-7P32XCEU.js.map +0 -1
- package/dist/chunk-BMEJBY6H.js.map +0 -1
- package/dist/chunk-D2QIPQ74.js.map +0 -1
- package/dist/chunk-F374BNL4.js.map +0 -1
- package/dist/chunk-H7WOMZXO.js.map +0 -1
- package/dist/chunk-N42EFOML.js.map +0 -1
- package/dist/chunk-SCXXJDKQ.js.map +0 -1
- package/dist/chunk-YMVUQ2L7.js.map +0 -1
- package/dist/chunk-ZVECQBGG.js.map +0 -1
|
@@ -1,66 +1,68 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ThemeIcon } from '../../chunk-
|
|
2
|
+
import { ThemeIcon } from '../../chunk-YVTM2KRR.js';
|
|
3
3
|
import '../../chunk-J2WSKRJW.js';
|
|
4
4
|
import { Table } from '../../chunk-PEHFWGTT.js';
|
|
5
5
|
import { Text } from '../../chunk-XKDL4QS6.js';
|
|
6
6
|
import '../../chunk-R5GMMWAY.js';
|
|
7
7
|
import '../../chunk-BJZLQTAZ.js';
|
|
8
|
-
import { Root, Trigger, Content, CheckboxItem } from '../../chunk-
|
|
9
|
-
import { MultiComboboxList } from '../../chunk-
|
|
8
|
+
import { Root, Trigger, Content, RadioGroup, ItemGroupLabel, RadioItem, Divider, CheckboxItem } from '../../chunk-BGDVUC3B.js';
|
|
9
|
+
import { MultiComboboxList } from '../../chunk-7KFUFAVP.js';
|
|
10
10
|
import { Pill } from '../../chunk-6M6YZ3PQ.js';
|
|
11
11
|
import { Flex } from '../../chunk-UXPINIDN.js';
|
|
12
12
|
import '../../chunk-XFEPUGUZ.js';
|
|
13
13
|
import '../../chunk-FMMKEYHB.js';
|
|
14
|
-
import { ComboboxList } from '../../chunk-
|
|
15
|
-
import '../../chunk-
|
|
16
|
-
import { serializeDateValue, DatePicker } from '../../chunk-
|
|
17
|
-
import { resolveHourCycle } from '../../chunk-
|
|
14
|
+
import { ComboboxList } from '../../chunk-NNPSBC7O.js';
|
|
15
|
+
import '../../chunk-ISX3AM32.js';
|
|
16
|
+
import { serializeDateValue, DatePicker } from '../../chunk-GJFCIG34.js';
|
|
17
|
+
import { resolveHourCycle } from '../../chunk-ULF5LOBS.js';
|
|
18
18
|
import '../../chunk-NF2PBGD3.js';
|
|
19
|
-
import { NUMBER_INPUT_DEFAULT_TRANSLATIONS, NumberInput } from '../../chunk-
|
|
19
|
+
import { NUMBER_INPUT_DEFAULT_TRANSLATIONS, NumberInput } from '../../chunk-SBZJGFZ6.js';
|
|
20
20
|
import { Checkbox } from '../../chunk-7E7JNWOC.js';
|
|
21
21
|
import '../../chunk-NLOBBJAA.js';
|
|
22
|
-
import { resolveCalendarTranslations } from '../../chunk-
|
|
22
|
+
import { resolveCalendarTranslations } from '../../chunk-7BY5I2RB.js';
|
|
23
23
|
import '../../chunk-ZB5VMGKB.js';
|
|
24
24
|
import '../../chunk-ZP6EBROY.js';
|
|
25
|
-
import { Select } from '../../chunk-
|
|
25
|
+
import { Select } from '../../chunk-IA6DCC3N.js';
|
|
26
26
|
import { Skeleton } from '../../chunk-TWNIAF7K.js';
|
|
27
27
|
import { Card } from '../../chunk-KKLCHLCZ.js';
|
|
28
|
-
import { Drawer } from '../../chunk-
|
|
29
|
-
import '../../chunk-
|
|
30
|
-
import '../../chunk-7TDHT3QD.js';
|
|
31
|
-
import { COMBOBOX_DEFAULT_TRANSLATIONS } from '../../chunk-
|
|
28
|
+
import { Drawer } from '../../chunk-P7SH3XWY.js';
|
|
29
|
+
import '../../chunk-KYVXPSNW.js';
|
|
30
|
+
import { normalizeSelectData } from '../../chunk-7TDHT3QD.js';
|
|
31
|
+
import { COMBOBOX_DEFAULT_TRANSLATIONS } from '../../chunk-QRNQQIQM.js';
|
|
32
32
|
import '../../chunk-5FDOOG4J.js';
|
|
33
33
|
import { Input } from '../../chunk-I4B3N3UX.js';
|
|
34
34
|
import '../../chunk-X6DESK37.js';
|
|
35
35
|
import '../../chunk-DHM4IG2O.js';
|
|
36
|
+
import { Badge } from '../../chunk-KNGSO7A3.js';
|
|
36
37
|
import '../../chunk-SKPM2FRX.js';
|
|
37
38
|
import '../../chunk-ORTCK34Y.js';
|
|
38
|
-
import { Button } from '../../chunk-
|
|
39
|
+
import { Button } from '../../chunk-SP6LCCTZ.js';
|
|
39
40
|
import { useDebouncedCallback } from '../../chunk-ZYX564HO.js';
|
|
40
41
|
import '../../chunk-HBWV5EPU.js';
|
|
41
42
|
import { useLocale, useTimeZone } from '../../chunk-IUK7OJXZ.js';
|
|
42
|
-
import { Popover } from '../../chunk-
|
|
43
|
-
import '../../chunk-
|
|
44
|
-
import { Tooltip } from '../../chunk-
|
|
43
|
+
import { Popover } from '../../chunk-RKCUXOU2.js';
|
|
44
|
+
import '../../chunk-HWBFRDX7.js';
|
|
45
|
+
import { Tooltip } from '../../chunk-2W7H43WL.js';
|
|
45
46
|
import '../../chunk-V6PY7C6S.js';
|
|
46
|
-
import '../../chunk-
|
|
47
|
-
import { ActionIcon } from '../../chunk-
|
|
48
|
-
import '../../chunk-
|
|
47
|
+
import '../../chunk-SLUOF7XW.js';
|
|
48
|
+
import { ActionIcon } from '../../chunk-B5YHYI7E.js';
|
|
49
|
+
import '../../chunk-6B2GNPJP.js';
|
|
50
|
+
import { devWarnOnce } from '../../chunk-LIZWCWED.js';
|
|
49
51
|
import { useUncontrolled } from '../../chunk-PMUCGFY5.js';
|
|
50
52
|
import '../../chunk-BUIHQJGE.js';
|
|
51
53
|
import '../../chunk-6YNLRQ25.js';
|
|
52
54
|
import { iconStroke, mergeIcons } from '../../chunk-XXOR34T4.js';
|
|
53
|
-
import '../../chunk-
|
|
55
|
+
import '../../chunk-W3XX7BYT.js';
|
|
54
56
|
import '../../chunk-R5LYFTHA.js';
|
|
55
57
|
import { props } from '../../chunk-WYCMIIRR.js';
|
|
56
58
|
import { focusStyles } from '../../chunk-C6NVU4F7.js';
|
|
57
59
|
import { TEXT_COLOR_CLASSES } from '../../chunk-GIPQUKCN.js';
|
|
58
60
|
import { cn } from '../../chunk-4ASNIDV7.js';
|
|
59
61
|
import { useLocaleContext } from '@ark-ui/react/locale';
|
|
60
|
-
import { tableFeatures, filterFn_weakEquals, filterFn_inDateRange, filterFn_arrIncludes, filterFn_equals, filterFn_inNumberRange, filterFn_includesString, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_alphanumeric, columnResizingFeature, columnSizingFeature, columnVisibilityFeature, rowSelectionFeature, rowPaginationFeature, rowSortingFeature, globalFilteringFeature, columnFilteringFeature, createPaginatedRowModel, createSortedRowModel, createFilteredRowModel, useTable, flexRender, createColumnHelper as createColumnHelper$1 } from '@tanstack/react-table';
|
|
61
|
-
import { useRef, useMemo, useId, useState, useEffect } from 'react';
|
|
62
|
+
import { tableFeatures, filterFn_weakEquals, filterFn_inDateRange, filterFn_arrIncludes, filterFn_equals, filterFn_inNumberRange, filterFn_includesString, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_alphanumeric, rowExpandingFeature, columnGroupingFeature, columnResizingFeature, columnSizingFeature, columnVisibilityFeature, rowSelectionFeature, rowPaginationFeature, rowSortingFeature, globalFilteringFeature, columnFilteringFeature, createPaginatedRowModel, createExpandedRowModel, createSortedRowModel, createGroupedRowModel, createFilteredRowModel, useTable, flexRender, createColumnHelper as createColumnHelper$1 } from '@tanstack/react-table';
|
|
63
|
+
import { useRef, useMemo, useId, useState, Fragment as Fragment$1, useEffect } from 'react';
|
|
62
64
|
import { match, P } from 'ts-pattern';
|
|
63
|
-
import { ChevronRight, ChevronLeft, Search, ArrowUpToLineIcon, ArrowDownToLineIcon, RotateCwIcon, EraserIcon, ServerCrashIcon, SearchAlertIcon, Columns3CogIcon, ListFilterIcon, ChevronsUpDownIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
|
|
65
|
+
import { ChevronRight, ChevronLeft, Search, GroupIcon, ArrowUpToLineIcon, ArrowDownToLineIcon, RotateCwIcon, EraserIcon, ServerCrashIcon, SearchAlertIcon, Columns3CogIcon, ListFilterIcon, ChevronsUpDownIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
|
|
64
66
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
65
67
|
import { parseDateTime, parseDate } from '@internationalized/date';
|
|
66
68
|
import { cva } from 'class-variance-authority';
|
|
@@ -74,10 +76,17 @@ var dataTableFeatures = tableFeatures({
|
|
|
74
76
|
columnVisibilityFeature,
|
|
75
77
|
columnSizingFeature,
|
|
76
78
|
columnResizingFeature,
|
|
79
|
+
// Row grouping (`grouping`) and its fold state (`expanded`). No
|
|
80
|
+
// `rowAggregationFeature`: a group row draws a header, never cells, so there
|
|
81
|
+
// is nothing to aggregate.
|
|
82
|
+
columnGroupingFeature,
|
|
83
|
+
rowExpandingFeature,
|
|
77
84
|
// v8's `get*RowModel` options moved into these slots. The core row model is
|
|
78
85
|
// automatic in v9 and must not be passed.
|
|
79
86
|
filteredRowModel: createFilteredRowModel(),
|
|
87
|
+
groupedRowModel: createGroupedRowModel(),
|
|
80
88
|
sortedRowModel: createSortedRowModel(),
|
|
89
|
+
expandedRowModel: createExpandedRowModel(),
|
|
81
90
|
paginatedRowModel: createPaginatedRowModel(),
|
|
82
91
|
/* These two registries are load-bearing, and their failure mode is silent.
|
|
83
92
|
*
|
|
@@ -121,7 +130,9 @@ var DEFAULT_ICONS = {
|
|
|
121
130
|
clear: /* @__PURE__ */ jsx(EraserIcon, { className: iconStroke }),
|
|
122
131
|
retry: /* @__PURE__ */ jsx(RotateCwIcon, { className: iconStroke }),
|
|
123
132
|
min: /* @__PURE__ */ jsx(ArrowDownToLineIcon, { className: iconStroke }),
|
|
124
|
-
max: /* @__PURE__ */ jsx(ArrowUpToLineIcon, { className: iconStroke })
|
|
133
|
+
max: /* @__PURE__ */ jsx(ArrowUpToLineIcon, { className: iconStroke }),
|
|
134
|
+
group: /* @__PURE__ */ jsx(GroupIcon, { className: iconStroke }),
|
|
135
|
+
fold: /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", className: iconStroke })
|
|
125
136
|
};
|
|
126
137
|
var resolveDataTableIcons = (icons) => icons ? mergeIcons(DEFAULT_ICONS, icons) : DEFAULT_ICONS;
|
|
127
138
|
var sortIcon = (sorted) => sorted || "unsorted";
|
|
@@ -148,6 +159,17 @@ var DATA_TABLE_DEFAULT_TRANSLATIONS = {
|
|
|
148
159
|
fromTime: "From time",
|
|
149
160
|
toTime: "To time",
|
|
150
161
|
clearDates: "Clear",
|
|
162
|
+
group: "Group rows",
|
|
163
|
+
groupBy: "Group by",
|
|
164
|
+
groupThenBy: "Then by",
|
|
165
|
+
groupNone: "None",
|
|
166
|
+
hideEmptyGroups: "Hide empty groups",
|
|
167
|
+
groupToggle: (label) => label,
|
|
168
|
+
groupCount: (count, formatted) => count === 1 ? `${formatted} row` : `${formatted} rows`,
|
|
169
|
+
groupNoValue: "No value",
|
|
170
|
+
selectGroup: (label) => `Select group ${label}`,
|
|
171
|
+
showMore: (_count, formatted) => `Show ${formatted} more`,
|
|
172
|
+
groupSummary: ({ rows, groups, formatted }) => `${formatted.rows} ${rows === 1 ? "row" : "rows"} in ${formatted.groups} ${groups === 1 ? "group" : "groups"}`,
|
|
151
173
|
clearTriggerLabel: COMBOBOX_DEFAULT_TRANSLATIONS.clearTriggerLabel,
|
|
152
174
|
incrementLabel: NUMBER_INPUT_DEFAULT_TRANSLATIONS.incrementLabel,
|
|
153
175
|
decrementLabel: NUMBER_INPUT_DEFAULT_TRANSLATIONS.decrementLabel
|
|
@@ -595,6 +617,345 @@ var DataTableFilterControl = ({
|
|
|
595
617
|
}
|
|
596
618
|
)).exhaustive();
|
|
597
619
|
};
|
|
620
|
+
|
|
621
|
+
// src/components/data-table/data-table-grouping.ts
|
|
622
|
+
var MAX_GROUPING_DEPTH = 2;
|
|
623
|
+
var NO_OPTIONS = [];
|
|
624
|
+
var optionsCache = /* @__PURE__ */ new WeakMap();
|
|
625
|
+
var groupOptions = (column) => {
|
|
626
|
+
const filter = column?.columnDef.meta?.filter;
|
|
627
|
+
if (filter?.type !== "select" || !Array.isArray(filter.options)) return NO_OPTIONS;
|
|
628
|
+
const cached = optionsCache.get(filter.options);
|
|
629
|
+
if (cached) return cached;
|
|
630
|
+
const items = normalizeSelectData(filter.options).items;
|
|
631
|
+
optionsCache.set(filter.options, items);
|
|
632
|
+
return items;
|
|
633
|
+
};
|
|
634
|
+
var isGroupExpanded = (expanded, id) => expanded === true || expanded[id] !== false;
|
|
635
|
+
var toggleGroupExpanded = (expanded, id) => {
|
|
636
|
+
const { [id]: current, ...rest } = expanded === true ? {} : expanded;
|
|
637
|
+
return current === false ? rest : { ...rest, [id]: false };
|
|
638
|
+
};
|
|
639
|
+
var groupLeafRows = (node) => node.groups.length > 0 ? node.groups.flatMap(groupLeafRows) : node.rows;
|
|
640
|
+
var ascending = (a, b) => a.localeCompare(b, void 0, { numeric: true });
|
|
641
|
+
function buildGroupTree({
|
|
642
|
+
table,
|
|
643
|
+
rows,
|
|
644
|
+
grouping,
|
|
645
|
+
hideEmptyGroups,
|
|
646
|
+
manualGroups
|
|
647
|
+
}) {
|
|
648
|
+
const level = (levelRows, depth, parentId) => {
|
|
649
|
+
const columnId = grouping[depth];
|
|
650
|
+
if (columnId == null) return [];
|
|
651
|
+
const column = table.getColumn(columnId);
|
|
652
|
+
const manual = depth === 0 ? manualGroups : void 0;
|
|
653
|
+
const order = manual?.map((group) => group.value) ?? groupOptions(column).map((option) => option.value);
|
|
654
|
+
const declared = depth === 0 ? order : [];
|
|
655
|
+
const rank = new Map(order.map((value, index) => [value, index]));
|
|
656
|
+
const counts = new Map(manual?.map((group) => [group.value, group.count]));
|
|
657
|
+
const compare = column?.columnDef.meta?.groupOrder ?? ((a, b) => (rank.get(a) ?? Number.POSITIVE_INFINITY) - (rank.get(b) ?? Number.POSITIVE_INFINITY) || ascending(a, b));
|
|
658
|
+
const present = levelRows.filter((row) => row.getIsGrouped()).map((row) => {
|
|
659
|
+
const nested = depth + 1 < grouping.length;
|
|
660
|
+
const groups = nested ? level(row.subRows, depth + 1, row.id) : [];
|
|
661
|
+
const leaves = nested ? [] : row.subRows;
|
|
662
|
+
const loaded = nested ? groups.reduce((sum, group) => sum + group.loaded, 0) : leaves.length;
|
|
663
|
+
return {
|
|
664
|
+
id: row.id,
|
|
665
|
+
columnId,
|
|
666
|
+
value: String(row.groupingValue),
|
|
667
|
+
depth,
|
|
668
|
+
count: loaded,
|
|
669
|
+
loaded,
|
|
670
|
+
row,
|
|
671
|
+
groups,
|
|
672
|
+
rows: leaves
|
|
673
|
+
};
|
|
674
|
+
});
|
|
675
|
+
const known = new Set(present.map((node) => node.value));
|
|
676
|
+
const empty = declared.filter((value) => !known.has(value)).map(
|
|
677
|
+
(value) => ({
|
|
678
|
+
id: parentId ? `${parentId}>${columnId}:${value}` : `${columnId}:${value}`,
|
|
679
|
+
columnId,
|
|
680
|
+
value,
|
|
681
|
+
depth,
|
|
682
|
+
count: 0,
|
|
683
|
+
loaded: 0,
|
|
684
|
+
groups: [],
|
|
685
|
+
rows: []
|
|
686
|
+
})
|
|
687
|
+
);
|
|
688
|
+
return [...present, ...empty].map((node) => ({ ...node, count: counts.get(node.value) ?? node.count })).filter((node) => !hideEmptyGroups || node.count > 0).sort((a, b) => compare(a.value, b.value));
|
|
689
|
+
};
|
|
690
|
+
return level(rows, 0);
|
|
691
|
+
}
|
|
692
|
+
var NO_VALUE = /* @__PURE__ */ new Set(["", "null", "undefined"]);
|
|
693
|
+
function useDataTableGrouping({
|
|
694
|
+
table,
|
|
695
|
+
grouping,
|
|
696
|
+
expanded,
|
|
697
|
+
onExpandedChange,
|
|
698
|
+
hideEmptyGroups,
|
|
699
|
+
paginate,
|
|
700
|
+
groupPageSize,
|
|
701
|
+
manualGrouping,
|
|
702
|
+
manualGroups,
|
|
703
|
+
onGroupShowMore,
|
|
704
|
+
renderGroupHeader,
|
|
705
|
+
translations,
|
|
706
|
+
resetKey
|
|
707
|
+
}) {
|
|
708
|
+
const [limitState, setLimitState] = useState({
|
|
709
|
+
key: resetKey,
|
|
710
|
+
limits: {}
|
|
711
|
+
});
|
|
712
|
+
const [opened, setOpened] = useState(() => /* @__PURE__ */ new Set());
|
|
713
|
+
if (grouping.length === 0) return null;
|
|
714
|
+
const limits = limitState.key === resetKey ? limitState.limits : {};
|
|
715
|
+
const groups = buildGroupTree({
|
|
716
|
+
table,
|
|
717
|
+
rows: table.getSortedRowModel().rows,
|
|
718
|
+
grouping,
|
|
719
|
+
hideEmptyGroups,
|
|
720
|
+
manualGroups: manualGrouping ? manualGroups : void 0
|
|
721
|
+
});
|
|
722
|
+
const limitOf = (node) => paginate && !manualGrouping ? limits[node.id] ?? groupPageSize : Number.POSITIVE_INFINITY;
|
|
723
|
+
const isExpanded = (node) => isGroupExpanded(expanded, node.id);
|
|
724
|
+
const toggle = (node) => {
|
|
725
|
+
if (!isExpanded(node)) setOpened((previous) => new Set(previous).add(node.id));
|
|
726
|
+
onExpandedChange((old) => toggleGroupExpanded(old, node.id));
|
|
727
|
+
};
|
|
728
|
+
const label = (node) => groupOptions(table.getColumn(node.columnId)).find((option) => option.value === node.value)?.label ?? (NO_VALUE.has(node.value) ? translations.groupNoValue : node.value);
|
|
729
|
+
const renderValue = (node) => {
|
|
730
|
+
const column = table.getColumn(node.columnId);
|
|
731
|
+
if (!column) return label(node);
|
|
732
|
+
const leaves = groupLeafRows(node);
|
|
733
|
+
if (renderGroupHeader) {
|
|
734
|
+
return renderGroupHeader({
|
|
735
|
+
column,
|
|
736
|
+
value: node.value,
|
|
737
|
+
label: label(node),
|
|
738
|
+
rows: leaves,
|
|
739
|
+
count: node.count,
|
|
740
|
+
expanded: isExpanded(node),
|
|
741
|
+
toggle: () => toggle(node)
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
const cell = column.columnDef.getGroupingValue == null && !NO_VALUE.has(node.value) ? leaves[0]?.getAllCells().find((candidate) => candidate.column.id === node.columnId) : void 0;
|
|
745
|
+
if (cell) return flexRender(column.columnDef.cell, cell.getContext());
|
|
746
|
+
const option = groupOptions(column).find((candidate) => candidate.value === node.value);
|
|
747
|
+
return option?.color ? /* @__PURE__ */ jsx(Badge, { size: "sm", color: option.color, children: option.label }) : label(node);
|
|
748
|
+
};
|
|
749
|
+
return {
|
|
750
|
+
groups,
|
|
751
|
+
rowCount: groups.reduce((sum, node) => sum + node.count, 0),
|
|
752
|
+
label,
|
|
753
|
+
renderValue,
|
|
754
|
+
isExpanded,
|
|
755
|
+
toggle,
|
|
756
|
+
visibleRows: (node) => node.rows.slice(0, limitOf(node)),
|
|
757
|
+
nextCount: (node) => {
|
|
758
|
+
if (node.groups.length > 0) return 0;
|
|
759
|
+
const rest = manualGrouping ? node.count - node.loaded : node.rows.length - limitOf(node);
|
|
760
|
+
return Math.max(0, Math.min(groupPageSize, rest));
|
|
761
|
+
},
|
|
762
|
+
showMore: (node) => {
|
|
763
|
+
if (manualGrouping) {
|
|
764
|
+
onGroupShowMore?.({ columnId: node.columnId, value: node.value, loaded: node.loaded });
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
setLimitState({
|
|
768
|
+
key: resetKey,
|
|
769
|
+
limits: { ...limits, [node.id]: limitOf(node) + groupPageSize }
|
|
770
|
+
});
|
|
771
|
+
},
|
|
772
|
+
opened
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
function DataTableGroupToggle({
|
|
776
|
+
node,
|
|
777
|
+
grouping,
|
|
778
|
+
controls,
|
|
779
|
+
translations,
|
|
780
|
+
icons,
|
|
781
|
+
className
|
|
782
|
+
}) {
|
|
783
|
+
const format = new Intl.NumberFormat(useLocale()).format;
|
|
784
|
+
const expanded = grouping.isExpanded(node);
|
|
785
|
+
const foldable = node.count > 0;
|
|
786
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
787
|
+
/* @__PURE__ */ jsxs(
|
|
788
|
+
"button",
|
|
789
|
+
{
|
|
790
|
+
type: "button",
|
|
791
|
+
"aria-expanded": foldable ? expanded : void 0,
|
|
792
|
+
"aria-controls": foldable && expanded ? controls : void 0,
|
|
793
|
+
"aria-label": translations.groupToggle(grouping.label(node)),
|
|
794
|
+
disabled: !foldable,
|
|
795
|
+
onClick: () => grouping.toggle(node),
|
|
796
|
+
className: cn(
|
|
797
|
+
"inline-flex min-w-0 items-center gap-1.5 rounded-xxs font-medium select-none",
|
|
798
|
+
"enabled:cursor-pointer",
|
|
799
|
+
focusStyles({ offset: false }),
|
|
800
|
+
// The chevron is sized and coloured from here, so one passed through
|
|
801
|
+
// `icons` lands the same. It turns down while the group is open; when
|
|
802
|
+
// closed it follows the reading direction.
|
|
803
|
+
"[&>svg]:size-3.5 [&>svg]:shrink-0 [&>svg]:text-brand-900/40 dark:[&>svg]:text-white/35",
|
|
804
|
+
"enabled:hover:[&>svg]:text-brand-950 dark:enabled:hover:[&>svg]:text-white",
|
|
805
|
+
"motion-safe:[&>svg]:transition-transform motion-safe:[&>svg]:duration-(--duration-fast)",
|
|
806
|
+
foldable && expanded ? "[&>svg]:rotate-90" : "rtl:[&>svg]:rotate-180",
|
|
807
|
+
!foldable && "[&>svg]:opacity-40",
|
|
808
|
+
className
|
|
809
|
+
),
|
|
810
|
+
children: [
|
|
811
|
+
icons.fold,
|
|
812
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "pointer-events-none inline-flex min-w-0 items-center", children: grouping.renderValue(node) })
|
|
813
|
+
]
|
|
814
|
+
}
|
|
815
|
+
),
|
|
816
|
+
/* @__PURE__ */ jsxs(Text, { span: true, size: "xs", c: "muted", className: "tabular-nums", children: [
|
|
817
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: format(node.count) }),
|
|
818
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: translations.groupCount(node.count, format(node.count)) })
|
|
819
|
+
] })
|
|
820
|
+
] });
|
|
821
|
+
}
|
|
822
|
+
function DataTableGroupShowMore({
|
|
823
|
+
node,
|
|
824
|
+
grouping,
|
|
825
|
+
translations
|
|
826
|
+
}) {
|
|
827
|
+
const format = new Intl.NumberFormat(useLocale()).format;
|
|
828
|
+
const next = grouping.nextCount(node);
|
|
829
|
+
return /* @__PURE__ */ jsx(Button, { variant: "subtle", color: "neutral", size: "xs", onClick: () => grouping.showMore(node), children: translations.showMore(next, format(next)) });
|
|
830
|
+
}
|
|
831
|
+
var groupHeaderCell = cn(
|
|
832
|
+
"bg-black/3 dark:bg-white/4",
|
|
833
|
+
"border-brand-900/20 dark:border-white/8",
|
|
834
|
+
// A hairline under the header unless it closes its `<tbody>` (a folded or empty
|
|
835
|
+
// last group): the next group's header, or the footer, draws that one.
|
|
836
|
+
"[tr:not(:last-child)>&]:border-b"
|
|
837
|
+
);
|
|
838
|
+
function DataTableGroupedBody({
|
|
839
|
+
grouping,
|
|
840
|
+
table,
|
|
841
|
+
colSpan,
|
|
842
|
+
renderRow,
|
|
843
|
+
selectable,
|
|
844
|
+
size,
|
|
845
|
+
translations,
|
|
846
|
+
icons,
|
|
847
|
+
className
|
|
848
|
+
}) {
|
|
849
|
+
const baseId = useId();
|
|
850
|
+
const header = (node, controls) => {
|
|
851
|
+
const selectableRows = groupLeafRows(node).filter((row) => row.getCanSelect());
|
|
852
|
+
const selectableIds = new Set(selectableRows.map((row) => row.id));
|
|
853
|
+
const selected = selectableRows.filter((row) => row.getIsSelected()).length;
|
|
854
|
+
const allLoadedSelected = selected === selectableRows.length;
|
|
855
|
+
const partlyLoaded = node.loaded < node.count;
|
|
856
|
+
return /* @__PURE__ */ jsx(
|
|
857
|
+
Table.Row,
|
|
858
|
+
{
|
|
859
|
+
testId: `group-${node.id}`,
|
|
860
|
+
"data-placeholder": true,
|
|
861
|
+
"data-group": true,
|
|
862
|
+
"data-depth": node.depth,
|
|
863
|
+
...props({ "data-expanded": grouping.isExpanded(node) }),
|
|
864
|
+
children: /* @__PURE__ */ jsx(
|
|
865
|
+
Table.HeaderCell,
|
|
866
|
+
{
|
|
867
|
+
scope: node.depth === 0 ? "rowgroup" : "row",
|
|
868
|
+
colSpan,
|
|
869
|
+
className: cn(
|
|
870
|
+
groupHeaderCell,
|
|
871
|
+
node.depth === 0 && "[tbody:not(:first-of-type)_&]:border-t"
|
|
872
|
+
),
|
|
873
|
+
children: /* @__PURE__ */ jsxs("div", { className: "sticky start-3 flex w-max max-w-full items-center gap-2", children: [
|
|
874
|
+
selectable && selectableRows.length > 0 && /* @__PURE__ */ jsx(
|
|
875
|
+
Checkbox,
|
|
876
|
+
{
|
|
877
|
+
size,
|
|
878
|
+
checked: selected === 0 ? false : allLoadedSelected && !partlyLoaded ? true : "indeterminate",
|
|
879
|
+
onCheckedChange: () => (
|
|
880
|
+
// Written to the leaf rows directly: the group row itself is never
|
|
881
|
+
// selectable, so `rowSelection` only ever holds real row ids. Decided
|
|
882
|
+
// from the rows, not from the checkbox: a partly loaded group reads
|
|
883
|
+
// indeterminate with every loaded row selected, and must still clear.
|
|
884
|
+
table.setRowSelection((old) => ({
|
|
885
|
+
...Object.fromEntries(
|
|
886
|
+
Object.entries(old).filter(([id]) => !selectableIds.has(id))
|
|
887
|
+
),
|
|
888
|
+
...allLoadedSelected ? {} : Object.fromEntries(selectableRows.map((row) => [row.id, true]))
|
|
889
|
+
}))
|
|
890
|
+
),
|
|
891
|
+
label: translations.selectGroup(grouping.label(node)),
|
|
892
|
+
classNames: { label: "sr-only" }
|
|
893
|
+
}
|
|
894
|
+
),
|
|
895
|
+
/* @__PURE__ */ jsx(
|
|
896
|
+
DataTableGroupToggle,
|
|
897
|
+
{
|
|
898
|
+
node,
|
|
899
|
+
grouping,
|
|
900
|
+
controls,
|
|
901
|
+
translations,
|
|
902
|
+
icons,
|
|
903
|
+
className: node.depth > 0 ? "ms-6" : void 0
|
|
904
|
+
}
|
|
905
|
+
)
|
|
906
|
+
] })
|
|
907
|
+
}
|
|
908
|
+
)
|
|
909
|
+
},
|
|
910
|
+
node.id
|
|
911
|
+
);
|
|
912
|
+
};
|
|
913
|
+
const leaves = (node) => [
|
|
914
|
+
...grouping.visibleRows(node).map(
|
|
915
|
+
(row) => renderRow(row, {
|
|
916
|
+
className: grouping.opened.has(node.id) ? "motion-safe:animate-fade-in" : void 0,
|
|
917
|
+
// Rows under a sub-group step in with it, so they read as its children.
|
|
918
|
+
indent: node.depth > 0
|
|
919
|
+
})
|
|
920
|
+
),
|
|
921
|
+
grouping.nextCount(node) > 0 && /* @__PURE__ */ jsx(Table.Row, { testId: `group-${node.id}-more`, "data-placeholder": true, children: /* @__PURE__ */ jsx(Table.Cell, { colSpan, children: /* @__PURE__ */ jsx("div", { className: cn("sticky start-3 w-max", node.depth > 0 && "ps-6"), children: /* @__PURE__ */ jsx(DataTableGroupShowMore, { node, grouping, translations }) }) }) }, `${node.id}-more`)
|
|
922
|
+
];
|
|
923
|
+
return grouping.groups.map((node, index) => {
|
|
924
|
+
const bodyId = `${baseId}-group-${index}`;
|
|
925
|
+
return /* @__PURE__ */ jsxs(Table.Body, { id: bodyId, className, children: [
|
|
926
|
+
header(node, bodyId),
|
|
927
|
+
grouping.isExpanded(node) && (node.groups.length > 0 ? node.groups.flatMap((sub) => [
|
|
928
|
+
header(sub),
|
|
929
|
+
...grouping.isExpanded(sub) ? leaves(sub) : []
|
|
930
|
+
]) : leaves(node))
|
|
931
|
+
] }, node.id);
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
function DataTableGroupSummary({
|
|
935
|
+
grouping,
|
|
936
|
+
translations,
|
|
937
|
+
className
|
|
938
|
+
}) {
|
|
939
|
+
const format = new Intl.NumberFormat(useLocale()).format;
|
|
940
|
+
const rows = grouping.rowCount;
|
|
941
|
+
const groups = grouping.groups.length;
|
|
942
|
+
return /* @__PURE__ */ jsx(
|
|
943
|
+
"div",
|
|
944
|
+
{
|
|
945
|
+
className: cn(
|
|
946
|
+
// The pagination band's own fill, hairline and padding.
|
|
947
|
+
"bg-brand-50/90 dark:bg-transparent",
|
|
948
|
+
"flex shrink-0 items-center border-t border-brand-900/20 px-4 py-3 dark:border-white/8",
|
|
949
|
+
className
|
|
950
|
+
),
|
|
951
|
+
children: /* @__PURE__ */ jsx(Text, { span: true, size: "sm", c: "muted", role: "status", children: translations.groupSummary({
|
|
952
|
+
rows,
|
|
953
|
+
groups,
|
|
954
|
+
formatted: { rows: format(rows), groups: format(groups) }
|
|
955
|
+
}) })
|
|
956
|
+
}
|
|
957
|
+
);
|
|
958
|
+
}
|
|
598
959
|
var RESIZE_STEP = 5;
|
|
599
960
|
var columnLabel = (column) => {
|
|
600
961
|
if (column.columnDef.meta?.label) return column.columnDef.meta.label;
|
|
@@ -810,6 +1171,7 @@ var DEFAULT_TRANSLATIONS = {
|
|
|
810
1171
|
function DataTablePagination({
|
|
811
1172
|
table,
|
|
812
1173
|
pageSizeOptions = [10, 20, 50],
|
|
1174
|
+
rowsOnPage: rowsOnPageProp,
|
|
813
1175
|
hasNextPage,
|
|
814
1176
|
className,
|
|
815
1177
|
translations: translationsProp,
|
|
@@ -819,7 +1181,7 @@ function DataTablePagination({
|
|
|
819
1181
|
const { pageIndex, pageSize } = table.atoms.pagination.get();
|
|
820
1182
|
const pageCount = table.getPageCount();
|
|
821
1183
|
const totalKnown = pageCount >= 0;
|
|
822
|
-
const rowsOnPage = table.getRowModel().rows.length;
|
|
1184
|
+
const rowsOnPage = rowsOnPageProp ?? table.getRowModel().rows.length;
|
|
823
1185
|
const canPrevious = table.getCanPreviousPage();
|
|
824
1186
|
const canNext = totalKnown ? table.getCanNextPage() : hasNextPage ?? rowsOnPage >= pageSize;
|
|
825
1187
|
const translations = { ...DEFAULT_TRANSLATIONS, ...translationsProp };
|
|
@@ -938,8 +1300,122 @@ function RenderPlaceholder({
|
|
|
938
1300
|
}
|
|
939
1301
|
);
|
|
940
1302
|
}
|
|
1303
|
+
function DataTableGlobalFilter({
|
|
1304
|
+
value,
|
|
1305
|
+
onChange,
|
|
1306
|
+
placeholder = "Search\u2026",
|
|
1307
|
+
debounce = 300,
|
|
1308
|
+
icon = DEFAULT_ICONS.search
|
|
1309
|
+
}) {
|
|
1310
|
+
const [local, setLocal] = useDebouncedCommit(value, debounce, onChange);
|
|
1311
|
+
return /* @__PURE__ */ jsx(
|
|
1312
|
+
Input,
|
|
1313
|
+
{
|
|
1314
|
+
size: "sm",
|
|
1315
|
+
placeholder,
|
|
1316
|
+
startSlot: icon,
|
|
1317
|
+
value: local,
|
|
1318
|
+
onChange: (e) => setLocal(e.target.value),
|
|
1319
|
+
className: "max-w-64"
|
|
1320
|
+
}
|
|
1321
|
+
);
|
|
1322
|
+
}
|
|
1323
|
+
function DataTableColumnVisibilityMenu({
|
|
1324
|
+
table,
|
|
1325
|
+
label,
|
|
1326
|
+
icon = DEFAULT_ICONS.columns,
|
|
1327
|
+
className
|
|
1328
|
+
}) {
|
|
1329
|
+
const columns = table.getAllLeafColumns().filter((column) => !column.columnDef.meta?.hideFromMenu);
|
|
1330
|
+
return /* @__PURE__ */ jsxs(Root, { closeOnSelect: false, position: "bottom-end", children: [
|
|
1331
|
+
/* @__PURE__ */ jsx(Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1332
|
+
ActionIcon,
|
|
1333
|
+
{
|
|
1334
|
+
variant: "subtle",
|
|
1335
|
+
color: "neutral",
|
|
1336
|
+
size: "sm",
|
|
1337
|
+
"aria-label": label,
|
|
1338
|
+
className,
|
|
1339
|
+
children: icon
|
|
1340
|
+
}
|
|
1341
|
+
) }),
|
|
1342
|
+
/* @__PURE__ */ jsx(Content, { children: columns.map((column) => /* @__PURE__ */ jsx(
|
|
1343
|
+
CheckboxItem,
|
|
1344
|
+
{
|
|
1345
|
+
value: column.id,
|
|
1346
|
+
checked: column.getIsVisible(),
|
|
1347
|
+
disabled: !column.getCanHide(),
|
|
1348
|
+
onCheckedChange: () => column.toggleVisibility(),
|
|
1349
|
+
children: columnLabel(column)
|
|
1350
|
+
},
|
|
1351
|
+
column.id
|
|
1352
|
+
)) })
|
|
1353
|
+
] });
|
|
1354
|
+
}
|
|
1355
|
+
var NO_GROUP = "__none__";
|
|
1356
|
+
var pickGrouping = (grouping, level, value) => value === NO_GROUP ? grouping.slice(0, level) : [
|
|
1357
|
+
...grouping.slice(0, level),
|
|
1358
|
+
value,
|
|
1359
|
+
...grouping.slice(level + 1).filter((id) => id !== value)
|
|
1360
|
+
];
|
|
1361
|
+
var groupingChoices = (table, grouping, level) => [
|
|
1362
|
+
{ value: NO_GROUP, label: void 0 },
|
|
1363
|
+
...table.getAllLeafColumns().filter((column) => column.getCanGroup() && !grouping.slice(0, level).includes(column.id)).map((column) => ({ value: column.id, label: columnLabel(column) }))
|
|
1364
|
+
];
|
|
1365
|
+
var groupingLevels = (grouping, maxDepth) => Array.from({ length: Math.min(grouping.length + 1, maxDepth) }, (_, level) => level);
|
|
1366
|
+
function DataTableGroupMenu({
|
|
1367
|
+
table,
|
|
1368
|
+
grouping,
|
|
1369
|
+
onGroupingChange,
|
|
1370
|
+
maxDepth,
|
|
1371
|
+
hideEmptyGroups,
|
|
1372
|
+
onHideEmptyGroupsChange,
|
|
1373
|
+
translations,
|
|
1374
|
+
icon = DEFAULT_ICONS.group,
|
|
1375
|
+
className
|
|
1376
|
+
}) {
|
|
1377
|
+
return /* @__PURE__ */ jsxs(Root, { closeOnSelect: false, position: "bottom-end", children: [
|
|
1378
|
+
/* @__PURE__ */ jsx(Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1379
|
+
ActionIcon,
|
|
1380
|
+
{
|
|
1381
|
+
variant: "subtle",
|
|
1382
|
+
color: "neutral",
|
|
1383
|
+
size: "sm",
|
|
1384
|
+
"aria-label": translations.group,
|
|
1385
|
+
className,
|
|
1386
|
+
children: icon
|
|
1387
|
+
}
|
|
1388
|
+
) }),
|
|
1389
|
+
/* @__PURE__ */ jsxs(Content, { children: [
|
|
1390
|
+
groupingLevels(grouping, maxDepth).map((level) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1391
|
+
/* @__PURE__ */ jsxs(
|
|
1392
|
+
RadioGroup,
|
|
1393
|
+
{
|
|
1394
|
+
value: `${level}:${grouping[level] ?? NO_GROUP}`,
|
|
1395
|
+
onChange: (value) => onGroupingChange(pickGrouping(grouping, level, value.slice(`${level}:`.length))),
|
|
1396
|
+
children: [
|
|
1397
|
+
/* @__PURE__ */ jsx(ItemGroupLabel, { children: level === 0 ? translations.groupBy : translations.groupThenBy }),
|
|
1398
|
+
groupingChoices(table, grouping, level).map((choice) => /* @__PURE__ */ jsx(RadioItem, { value: `${level}:${choice.value}`, children: choice.label ?? translations.groupNone }, choice.value))
|
|
1399
|
+
]
|
|
1400
|
+
}
|
|
1401
|
+
),
|
|
1402
|
+
/* @__PURE__ */ jsx(Divider, {})
|
|
1403
|
+
] }, level)),
|
|
1404
|
+
/* @__PURE__ */ jsx(
|
|
1405
|
+
CheckboxItem,
|
|
1406
|
+
{
|
|
1407
|
+
value: "hide-empty-groups",
|
|
1408
|
+
checked: hideEmptyGroups,
|
|
1409
|
+
onCheckedChange: (checked) => onHideEmptyGroupsChange(checked === true),
|
|
1410
|
+
children: translations.hideEmptyGroups
|
|
1411
|
+
}
|
|
1412
|
+
)
|
|
1413
|
+
] })
|
|
1414
|
+
] });
|
|
1415
|
+
}
|
|
941
1416
|
function DataTableStackedRows({
|
|
942
1417
|
rows,
|
|
1418
|
+
grouping,
|
|
943
1419
|
view,
|
|
944
1420
|
error,
|
|
945
1421
|
refetching,
|
|
@@ -953,6 +1429,7 @@ function DataTableStackedRows({
|
|
|
953
1429
|
translations,
|
|
954
1430
|
icons
|
|
955
1431
|
}) {
|
|
1432
|
+
const stackId = useId();
|
|
956
1433
|
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-1 min-h-0 flex-col gap-2 overflow-y-auto p-3", className), children: match(view).with("error", () => /* @__PURE__ */ jsxs(
|
|
957
1434
|
"div",
|
|
958
1435
|
{
|
|
@@ -1008,6 +1485,76 @@ function DataTableStackedRows({
|
|
|
1008
1485
|
const headersByColumnId = new Map(
|
|
1009
1486
|
table.getFlatHeaders().map((header) => [header.column.id, header])
|
|
1010
1487
|
);
|
|
1488
|
+
const renderCard = (row, cardClassName) => /* @__PURE__ */ jsx(
|
|
1489
|
+
Card,
|
|
1490
|
+
{
|
|
1491
|
+
padding: "sm",
|
|
1492
|
+
className: cn(
|
|
1493
|
+
"transition-colors",
|
|
1494
|
+
cardClassName,
|
|
1495
|
+
// Same black/white wash convention as Table's row hover/
|
|
1496
|
+
// DataTable's row selection, instead of a fixed per-theme gray.
|
|
1497
|
+
"hover:bg-black/5 dark:hover:bg-white/8",
|
|
1498
|
+
"data-[selected=true]:bg-black/8 dark:data-[selected=true]:bg-white/16",
|
|
1499
|
+
onRowClick && "cursor-pointer"
|
|
1500
|
+
),
|
|
1501
|
+
...props({ "data-selected": row.getIsSelected() }),
|
|
1502
|
+
onClick: onRowClick ? (event) => {
|
|
1503
|
+
if (!isRowClickIgnored2(event.target, event.currentTarget)) {
|
|
1504
|
+
onRowClick(row.original);
|
|
1505
|
+
}
|
|
1506
|
+
} : void 0,
|
|
1507
|
+
children: /* @__PURE__ */ jsx(Flex, { direction: "col", gap: "xs", children: row.getVisibleCells().map((cell) => {
|
|
1508
|
+
const header = headersByColumnId.get(cell.column.id);
|
|
1509
|
+
return /* @__PURE__ */ jsxs(Flex, { justify: "between", gap: "sm", children: [
|
|
1510
|
+
/* @__PURE__ */ jsx(Text, { size: "xs", c: "muted", children: header ? renderColumnHeader(header, "stack") : columnLabel(cell.column) }),
|
|
1511
|
+
/* @__PURE__ */ jsx("div", { children: flexRender(cell.column.columnDef.cell, cell.getContext()) })
|
|
1512
|
+
] }, cell.id);
|
|
1513
|
+
}) })
|
|
1514
|
+
},
|
|
1515
|
+
row.id
|
|
1516
|
+
);
|
|
1517
|
+
const section = (node, path) => {
|
|
1518
|
+
if (!grouping) return null;
|
|
1519
|
+
const headingId = `${stackId}-group-${path}`;
|
|
1520
|
+
return /* @__PURE__ */ jsxs(
|
|
1521
|
+
"section",
|
|
1522
|
+
{
|
|
1523
|
+
"aria-labelledby": headingId,
|
|
1524
|
+
"data-group": true,
|
|
1525
|
+
"data-depth": node.depth,
|
|
1526
|
+
className: cn("flex flex-col gap-2", node.depth > 0 && "ps-3"),
|
|
1527
|
+
children: [
|
|
1528
|
+
/* @__PURE__ */ jsx("div", { id: headingId, className: "flex items-center gap-2 pt-1 text-sm", children: /* @__PURE__ */ jsx(
|
|
1529
|
+
DataTableGroupToggle,
|
|
1530
|
+
{
|
|
1531
|
+
node,
|
|
1532
|
+
grouping,
|
|
1533
|
+
translations,
|
|
1534
|
+
icons
|
|
1535
|
+
}
|
|
1536
|
+
) }),
|
|
1537
|
+
grouping.isExpanded(node) && (node.groups.length > 0 ? node.groups.map((sub, index) => section(sub, `${path}-${index}`)) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1538
|
+
grouping.visibleRows(node).map(
|
|
1539
|
+
(row) => renderCard(
|
|
1540
|
+
row,
|
|
1541
|
+
grouping.opened.has(node.id) ? "motion-safe:animate-fade-in" : void 0
|
|
1542
|
+
)
|
|
1543
|
+
),
|
|
1544
|
+
grouping.nextCount(node) > 0 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
1545
|
+
DataTableGroupShowMore,
|
|
1546
|
+
{
|
|
1547
|
+
node,
|
|
1548
|
+
grouping,
|
|
1549
|
+
translations
|
|
1550
|
+
}
|
|
1551
|
+
) })
|
|
1552
|
+
] }))
|
|
1553
|
+
]
|
|
1554
|
+
},
|
|
1555
|
+
node.id
|
|
1556
|
+
);
|
|
1557
|
+
};
|
|
1011
1558
|
return /* @__PURE__ */ jsx(
|
|
1012
1559
|
"div",
|
|
1013
1560
|
{
|
|
@@ -1015,34 +1562,7 @@ function DataTableStackedRows({
|
|
|
1015
1562
|
"flex flex-col gap-2",
|
|
1016
1563
|
refetching && "pointer-events-none opacity-60 transition-opacity"
|
|
1017
1564
|
),
|
|
1018
|
-
children:
|
|
1019
|
-
Card,
|
|
1020
|
-
{
|
|
1021
|
-
padding: "sm",
|
|
1022
|
-
className: cn(
|
|
1023
|
-
"transition-colors",
|
|
1024
|
-
// Same black/white wash convention as Table's row hover/
|
|
1025
|
-
// DataTable's row selection, instead of a fixed per-theme gray.
|
|
1026
|
-
"hover:bg-black/5 dark:hover:bg-white/8",
|
|
1027
|
-
"data-[selected=true]:bg-black/8 dark:data-[selected=true]:bg-white/16",
|
|
1028
|
-
onRowClick && "cursor-pointer"
|
|
1029
|
-
),
|
|
1030
|
-
...props({ "data-selected": row.getIsSelected() }),
|
|
1031
|
-
onClick: onRowClick ? (event) => {
|
|
1032
|
-
if (!isRowClickIgnored2(event.target, event.currentTarget)) {
|
|
1033
|
-
onRowClick(row.original);
|
|
1034
|
-
}
|
|
1035
|
-
} : void 0,
|
|
1036
|
-
children: /* @__PURE__ */ jsx(Flex, { direction: "col", gap: "xs", children: row.getVisibleCells().map((cell) => {
|
|
1037
|
-
const header = headersByColumnId.get(cell.column.id);
|
|
1038
|
-
return /* @__PURE__ */ jsxs(Flex, { justify: "between", gap: "sm", children: [
|
|
1039
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "muted", children: header ? renderColumnHeader(header, "stack") : columnLabel(cell.column) }),
|
|
1040
|
-
/* @__PURE__ */ jsx("div", { children: flexRender(cell.column.columnDef.cell, cell.getContext()) })
|
|
1041
|
-
] }, cell.id);
|
|
1042
|
-
}) })
|
|
1043
|
-
},
|
|
1044
|
-
row.id
|
|
1045
|
-
))
|
|
1565
|
+
children: grouping ? grouping.groups.map((node, index) => section(node, String(index))) : rows.map((row) => renderCard(row))
|
|
1046
1566
|
}
|
|
1047
1567
|
);
|
|
1048
1568
|
}).exhaustive() });
|
|
@@ -1050,6 +1570,7 @@ function DataTableStackedRows({
|
|
|
1050
1570
|
function DataTableStackOptions({
|
|
1051
1571
|
table,
|
|
1052
1572
|
enableColumnVisibility,
|
|
1573
|
+
grouping,
|
|
1053
1574
|
translations,
|
|
1054
1575
|
icons,
|
|
1055
1576
|
className
|
|
@@ -1058,7 +1579,7 @@ function DataTableStackOptions({
|
|
|
1058
1579
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
1059
1580
|
const sortableColumns = visibleColumns.filter((column) => column.getCanSort());
|
|
1060
1581
|
const filterableColumns = visibleColumns.filter((column) => column.columnDef.meta?.filter != null);
|
|
1061
|
-
if (sortableColumns.length === 0 && filterableColumns.length === 0 && !enableColumnVisibility) {
|
|
1582
|
+
if (sortableColumns.length === 0 && filterableColumns.length === 0 && !enableColumnVisibility && !grouping) {
|
|
1062
1583
|
return null;
|
|
1063
1584
|
}
|
|
1064
1585
|
const activeFilterCount = filterableColumns.filter(
|
|
@@ -1093,6 +1614,34 @@ function DataTableStackOptions({
|
|
|
1093
1614
|
open,
|
|
1094
1615
|
onOpenChange: setOpen,
|
|
1095
1616
|
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
1617
|
+
grouping && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1618
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
1619
|
+
groupingLevels(grouping.value, grouping.maxDepth).map((level) => /* @__PURE__ */ jsx(
|
|
1620
|
+
Select,
|
|
1621
|
+
{
|
|
1622
|
+
size: "sm",
|
|
1623
|
+
label: level === 0 ? translations.groupBy : translations.groupThenBy,
|
|
1624
|
+
data: groupingChoices(table, grouping.value, level).map((choice) => ({
|
|
1625
|
+
value: choice.value,
|
|
1626
|
+
label: choice.label ?? translations.groupNone
|
|
1627
|
+
})),
|
|
1628
|
+
value: grouping.value[level] ?? groupingChoices(table, grouping.value, level)[0]?.value,
|
|
1629
|
+
onChange: (value) => value && grouping.onChange(pickGrouping(grouping.value, level, value))
|
|
1630
|
+
},
|
|
1631
|
+
level
|
|
1632
|
+
)),
|
|
1633
|
+
/* @__PURE__ */ jsx(
|
|
1634
|
+
Checkbox,
|
|
1635
|
+
{
|
|
1636
|
+
size: "sm",
|
|
1637
|
+
checked: grouping.hideEmptyGroups,
|
|
1638
|
+
onCheckedChange: (checked) => grouping.onHideEmptyGroupsChange(checked === true),
|
|
1639
|
+
label: translations.hideEmptyGroups
|
|
1640
|
+
}
|
|
1641
|
+
)
|
|
1642
|
+
] }),
|
|
1643
|
+
(enableColumnVisibility || sortableColumns.length > 0 || filterableColumns.length > 0) && /* @__PURE__ */ jsx("hr", { className: "mt-6 mb-2 border-0 border-t border-brand-900/20 dark:border-white/8" })
|
|
1644
|
+
] }),
|
|
1096
1645
|
enableColumnVisibility && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
1097
1646
|
/* @__PURE__ */ jsxs(Text, { size: "xs", c: "muted", className: "uppercase tracking-wide", children: [
|
|
1098
1647
|
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "// " }),
|
|
@@ -1192,58 +1741,6 @@ function DataTableStackOptions({
|
|
|
1192
1741
|
)
|
|
1193
1742
|
] });
|
|
1194
1743
|
}
|
|
1195
|
-
function DataTableGlobalFilter({
|
|
1196
|
-
value,
|
|
1197
|
-
onChange,
|
|
1198
|
-
placeholder = "Search\u2026",
|
|
1199
|
-
debounce = 300,
|
|
1200
|
-
icon = DEFAULT_ICONS.search
|
|
1201
|
-
}) {
|
|
1202
|
-
const [local, setLocal] = useDebouncedCommit(value, debounce, onChange);
|
|
1203
|
-
return /* @__PURE__ */ jsx(
|
|
1204
|
-
Input,
|
|
1205
|
-
{
|
|
1206
|
-
size: "sm",
|
|
1207
|
-
placeholder,
|
|
1208
|
-
startSlot: icon,
|
|
1209
|
-
value: local,
|
|
1210
|
-
onChange: (e) => setLocal(e.target.value),
|
|
1211
|
-
className: "max-w-64"
|
|
1212
|
-
}
|
|
1213
|
-
);
|
|
1214
|
-
}
|
|
1215
|
-
function DataTableColumnVisibilityMenu({
|
|
1216
|
-
table,
|
|
1217
|
-
label,
|
|
1218
|
-
icon = DEFAULT_ICONS.columns,
|
|
1219
|
-
className
|
|
1220
|
-
}) {
|
|
1221
|
-
const columns = table.getAllLeafColumns().filter((column) => !column.columnDef.meta?.hideFromMenu);
|
|
1222
|
-
return /* @__PURE__ */ jsxs(Root, { closeOnSelect: false, position: "bottom-end", children: [
|
|
1223
|
-
/* @__PURE__ */ jsx(Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1224
|
-
ActionIcon,
|
|
1225
|
-
{
|
|
1226
|
-
variant: "subtle",
|
|
1227
|
-
color: "neutral",
|
|
1228
|
-
size: "sm",
|
|
1229
|
-
"aria-label": label,
|
|
1230
|
-
className,
|
|
1231
|
-
children: icon
|
|
1232
|
-
}
|
|
1233
|
-
) }),
|
|
1234
|
-
/* @__PURE__ */ jsx(Content, { children: columns.map((column) => /* @__PURE__ */ jsx(
|
|
1235
|
-
CheckboxItem,
|
|
1236
|
-
{
|
|
1237
|
-
value: column.id,
|
|
1238
|
-
checked: column.getIsVisible(),
|
|
1239
|
-
disabled: !column.getCanHide(),
|
|
1240
|
-
onCheckedChange: () => column.toggleVisibility(),
|
|
1241
|
-
children: columnLabel(column)
|
|
1242
|
-
},
|
|
1243
|
-
column.id
|
|
1244
|
-
)) })
|
|
1245
|
-
] });
|
|
1246
|
-
}
|
|
1247
1744
|
var INTERACTIVE_SELECTOR = [
|
|
1248
1745
|
"a[href]",
|
|
1249
1746
|
"button",
|
|
@@ -1322,16 +1819,22 @@ function createSelectColumn(size, labels) {
|
|
|
1322
1819
|
meta: {
|
|
1323
1820
|
hideFromMenu: true
|
|
1324
1821
|
},
|
|
1325
|
-
header: ({ table, mode }) =>
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1822
|
+
header: ({ table, mode }) => {
|
|
1823
|
+
if (mode !== "table") return null;
|
|
1824
|
+
const grouped = table.atoms.grouping.get().length > 0;
|
|
1825
|
+
const all = grouped ? table.getIsAllRowsSelected() : table.getIsAllPageRowsSelected();
|
|
1826
|
+
const some = grouped ? table.getIsSomeRowsSelected() : table.getIsSomePageRowsSelected();
|
|
1827
|
+
return /* @__PURE__ */ jsx(
|
|
1828
|
+
Checkbox,
|
|
1829
|
+
{
|
|
1830
|
+
size,
|
|
1831
|
+
checked: all ? true : some ? "indeterminate" : false,
|
|
1832
|
+
onCheckedChange: (checked) => grouped ? table.toggleAllRowsSelected(checked === true) : table.toggleAllPageRowsSelected(checked === true),
|
|
1833
|
+
label: labels.current.selectAllRows,
|
|
1834
|
+
classNames: { label: "sr-only" }
|
|
1835
|
+
}
|
|
1836
|
+
);
|
|
1837
|
+
},
|
|
1335
1838
|
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "flex flex-row justify-center items-center", children: /* @__PURE__ */ jsx(
|
|
1336
1839
|
Checkbox,
|
|
1337
1840
|
{
|
|
@@ -1366,10 +1869,19 @@ function DataTableComponent({
|
|
|
1366
1869
|
onColumnVisibilityChange,
|
|
1367
1870
|
columnSizing: columnSizingProp,
|
|
1368
1871
|
onColumnSizingChange,
|
|
1872
|
+
grouping: groupingProp,
|
|
1873
|
+
onGroupingChange,
|
|
1874
|
+
expanded: expandedProp,
|
|
1875
|
+
onExpandedChange,
|
|
1876
|
+
hideEmptyGroups: hideEmptyGroupsProp,
|
|
1877
|
+
onHideEmptyGroupsChange,
|
|
1369
1878
|
initialState,
|
|
1370
1879
|
manualSorting,
|
|
1371
1880
|
manualFiltering,
|
|
1372
1881
|
manualPagination,
|
|
1882
|
+
manualGrouping = false,
|
|
1883
|
+
groups: manualGroups,
|
|
1884
|
+
onGroupShowMore,
|
|
1373
1885
|
enableMultiSort,
|
|
1374
1886
|
rowCount,
|
|
1375
1887
|
pageCount,
|
|
@@ -1390,6 +1902,10 @@ function DataTableComponent({
|
|
|
1390
1902
|
globalFilterPlaceholder,
|
|
1391
1903
|
globalFilterDebounce,
|
|
1392
1904
|
enableColumnVisibility: _enableColumnVisibility,
|
|
1905
|
+
enableGrouping,
|
|
1906
|
+
hideGroupedColumns = true,
|
|
1907
|
+
groupPageSize = 25,
|
|
1908
|
+
renderGroupHeader,
|
|
1393
1909
|
enableColumnResizing,
|
|
1394
1910
|
enablePagination = true,
|
|
1395
1911
|
sizing = "fixed",
|
|
@@ -1447,13 +1963,35 @@ function DataTableComponent({
|
|
|
1447
1963
|
onChange: onColumnSizingChange,
|
|
1448
1964
|
defaultValue: initialState?.columnSizing ?? {}
|
|
1449
1965
|
});
|
|
1966
|
+
const [grouping, handleGroupingChange] = useUncontrolled({
|
|
1967
|
+
value: groupingProp,
|
|
1968
|
+
onChange: (value) => {
|
|
1969
|
+
resetPagignation();
|
|
1970
|
+
onGroupingChange?.(value);
|
|
1971
|
+
},
|
|
1972
|
+
defaultValue: initialState?.grouping ?? []
|
|
1973
|
+
});
|
|
1974
|
+
const [expanded, handleExpandedChange] = useUncontrolled({
|
|
1975
|
+
value: expandedProp,
|
|
1976
|
+
onChange: onExpandedChange,
|
|
1977
|
+
defaultValue: initialState?.expanded ?? true
|
|
1978
|
+
});
|
|
1979
|
+
const [hideEmptyGroups, handleHideEmptyGroupsChange] = useUncontrolled({
|
|
1980
|
+
value: hideEmptyGroupsProp,
|
|
1981
|
+
onChange: onHideEmptyGroupsChange,
|
|
1982
|
+
defaultValue: initialState?.hideEmptyGroups ?? true
|
|
1983
|
+
});
|
|
1450
1984
|
const resolvedTranslations = resolveDataTableTranslations(translations);
|
|
1451
1985
|
const selectLabels = { ...resolvedTranslations, rowLabel: getRowLabel };
|
|
1452
1986
|
const selectLabelsRef = useRef(selectLabels);
|
|
1453
1987
|
const icons = resolveDataTableIcons(iconsProp);
|
|
1454
1988
|
selectLabelsRef.current = selectLabels;
|
|
1455
1989
|
const tableColumns = useMemo(() => {
|
|
1456
|
-
const withFilterFns = columns.map((
|
|
1990
|
+
const withFilterFns = columns.map((column) => {
|
|
1991
|
+
const col = {
|
|
1992
|
+
...column,
|
|
1993
|
+
enableGrouping: column.enableGrouping ?? column.meta?.groupable === true
|
|
1994
|
+
};
|
|
1457
1995
|
const filter = col.meta?.filter;
|
|
1458
1996
|
if (!filter || col.filterFn != null) return col;
|
|
1459
1997
|
return { ...col, filterFn: resolveFilterFn(filter) };
|
|
@@ -1462,6 +2000,35 @@ function DataTableComponent({
|
|
|
1462
2000
|
const selectColumn = createSelectColumn(size ?? "md", selectLabelsRef);
|
|
1463
2001
|
return [selectColumn, ...withFilterFns];
|
|
1464
2002
|
}, [columns, enableRowSelection, size]);
|
|
2003
|
+
const maxGroupingDepth = manualGrouping ? 1 : MAX_GROUPING_DEPTH;
|
|
2004
|
+
const { activeGrouping, groupingVisibility } = useMemo(() => {
|
|
2005
|
+
const idOf = (col) => "accessorKey" in col && col.id == null ? String(col.accessorKey).replaceAll(".", "_") : col.id;
|
|
2006
|
+
const groupable = new Set(
|
|
2007
|
+
tableColumns.filter(
|
|
2008
|
+
(col) => col.enableGrouping && ("accessorKey" in col || "accessorFn" in col || col.getGroupingValue != null)
|
|
2009
|
+
).map(idOf)
|
|
2010
|
+
);
|
|
2011
|
+
const pinnedVisible = new Set(
|
|
2012
|
+
tableColumns.filter((col) => col.enableHiding === false).map(idOf)
|
|
2013
|
+
);
|
|
2014
|
+
const active = grouping.filter((id) => groupable.has(id)).slice(0, maxGroupingDepth);
|
|
2015
|
+
return {
|
|
2016
|
+
activeGrouping: active,
|
|
2017
|
+
// A grouped column is hidden by default: every row of a group would repeat
|
|
2018
|
+
// what its header already says. Only a default, laid under `columnVisibility`
|
|
2019
|
+
// below, so an explicit entry (the column menu's toggle, or the app's own
|
|
2020
|
+
// state) shows it again. A column that can't be hidden is left alone, since
|
|
2021
|
+
// nothing could bring it back.
|
|
2022
|
+
groupingVisibility: Object.fromEntries(
|
|
2023
|
+
active.filter((id) => hideGroupedColumns && !pinnedVisible.has(id)).map((id) => [id, false])
|
|
2024
|
+
)
|
|
2025
|
+
};
|
|
2026
|
+
}, [tableColumns, grouping, maxGroupingDepth, hideGroupedColumns]);
|
|
2027
|
+
if (activeGrouping.length < grouping.length) {
|
|
2028
|
+
devWarnOnce(
|
|
2029
|
+
`[DataTable] \`grouping\` is ${JSON.stringify(grouping)}, but only ${JSON.stringify(activeGrouping)} applies: a column must opt in with \`meta.groupable\` and the table groups ${maxGroupingDepth === 1 ? "one level deep under `manualGrouping`" : `at most ${maxGroupingDepth} levels deep`}.`
|
|
2030
|
+
);
|
|
2031
|
+
}
|
|
1465
2032
|
const { dir } = useLocaleContext();
|
|
1466
2033
|
const table = useTable({
|
|
1467
2034
|
// v9 makes features opt-in; `dataTableFeatures` is the kit's registry and
|
|
@@ -1479,8 +2046,12 @@ function DataTableComponent({
|
|
|
1479
2046
|
globalFilter,
|
|
1480
2047
|
pagination,
|
|
1481
2048
|
rowSelection,
|
|
1482
|
-
columnVisibility,
|
|
1483
|
-
|
|
2049
|
+
// `onColumnVisibilityChange` still resolves against `columnVisibility` alone,
|
|
2050
|
+
// so the grouping default never leaks into the app's state.
|
|
2051
|
+
columnVisibility: { ...groupingVisibility, ...columnVisibility },
|
|
2052
|
+
columnSizing,
|
|
2053
|
+
grouping: activeGrouping,
|
|
2054
|
+
expanded
|
|
1484
2055
|
},
|
|
1485
2056
|
onSortingChange: handleSortingChange,
|
|
1486
2057
|
onColumnFiltersChange: handleColumnFiltersChange,
|
|
@@ -1489,11 +2060,22 @@ function DataTableComponent({
|
|
|
1489
2060
|
onRowSelectionChange: handleRowSelectionChange,
|
|
1490
2061
|
onColumnVisibilityChange: handleColumnVisibilityChange,
|
|
1491
2062
|
onColumnSizingChange: handleColumnSizingChange,
|
|
2063
|
+
onGroupingChange: handleGroupingChange,
|
|
2064
|
+
onExpandedChange: handleExpandedChange,
|
|
2065
|
+
// The grouped column stays where the app put it, after the select column.
|
|
2066
|
+
groupedColumnMode: false,
|
|
2067
|
+
// A refetch or a filter change must not reopen what the user folded.
|
|
2068
|
+
autoResetExpanded: false,
|
|
2069
|
+
// Groups are open unless folded, see `isGroupExpanded`; any other row keeps
|
|
2070
|
+
// react-table's reading of `expanded`.
|
|
2071
|
+
getIsRowExpanded: (row) => row.getIsGrouped() ? isGroupExpanded(expanded, row.id) : expanded === true || expanded[row.id] === true,
|
|
1492
2072
|
manualSorting,
|
|
1493
2073
|
manualFiltering,
|
|
1494
2074
|
manualPagination,
|
|
1495
2075
|
enableMultiSort,
|
|
1496
|
-
|
|
2076
|
+
// A group row is never selectable itself: its checkbox selects its rows, and
|
|
2077
|
+
// `rowSelection` only ever holds real row ids.
|
|
2078
|
+
enableRowSelection: (row) => !row.getIsGrouped() && (typeof enableRowSelection === "function" ? enableRowSelection(row) : enableRowSelection ?? true),
|
|
1497
2079
|
// No fixed width for a drag to adjust in "auto" mode — see the `sizing` prop doc.
|
|
1498
2080
|
enableColumnResizing: Boolean(enableColumnResizing) && sizing === "fixed",
|
|
1499
2081
|
columnResizeMode: "onChange",
|
|
@@ -1501,22 +2083,91 @@ function DataTableComponent({
|
|
|
1501
2083
|
rowCount,
|
|
1502
2084
|
pageCount
|
|
1503
2085
|
});
|
|
1504
|
-
const
|
|
2086
|
+
const groupsOnePage = Boolean(manualPagination) && !manualGrouping;
|
|
2087
|
+
if (groupsOnePage && activeGrouping.length > 0) {
|
|
2088
|
+
devWarnOnce(
|
|
2089
|
+
"[DataTable] `grouping` with `manualPagination` only groups the rows of the current page, so a group's count is its count on this page. Pass `manualGrouping` with `groups` and `onGroupShowMore` to let the server own the groups."
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
const groupingView = useDataTableGrouping({
|
|
2093
|
+
table,
|
|
2094
|
+
grouping: activeGrouping,
|
|
2095
|
+
expanded,
|
|
2096
|
+
onExpandedChange: handleExpandedChange,
|
|
2097
|
+
hideEmptyGroups,
|
|
2098
|
+
paginate: enablePagination && !groupsOnePage,
|
|
2099
|
+
groupPageSize,
|
|
2100
|
+
manualGrouping,
|
|
2101
|
+
manualGroups,
|
|
2102
|
+
onGroupShowMore,
|
|
2103
|
+
renderGroupHeader,
|
|
2104
|
+
translations: resolvedTranslations,
|
|
2105
|
+
resetKey: JSON.stringify([activeGrouping, sorting, columnFilters, globalFilter])
|
|
2106
|
+
});
|
|
2107
|
+
const rows = groupingView ? [] : table.getRowModel().rows;
|
|
2108
|
+
const loadedCount = groupingView ? groupingView.groups.reduce((sum, group) => sum + group.loaded, 0) : rows.length;
|
|
2109
|
+
const itemCount = groupingView ? groupingView.groups.length : rows.length;
|
|
1505
2110
|
const visibleColumnCount = table.getVisibleLeafColumns().length;
|
|
1506
|
-
const showSkeleton = loading &&
|
|
1507
|
-
const isRefetching = loading &&
|
|
2111
|
+
const showSkeleton = loading && loadedCount === 0;
|
|
2112
|
+
const isRefetching = loading && loadedCount > 0;
|
|
1508
2113
|
const skeletonRowCount = Math.min(Math.max(pagination.pageSize, 1), 100);
|
|
1509
2114
|
const handleRowClick = (row) => (event) => {
|
|
1510
2115
|
if (!onRowClick || isRowClickIgnored(event.target, event.currentTarget)) return;
|
|
1511
2116
|
onRowClick(row);
|
|
1512
2117
|
};
|
|
1513
2118
|
const enableColumnVisibility = _enableColumnVisibility && table.getAllLeafColumns().some((column) => !column.columnDef.meta?.hideFromMenu);
|
|
1514
|
-
const
|
|
2119
|
+
const showGroupMenu = enableGrouping && table.getAllLeafColumns().some((column) => column.getCanGroup());
|
|
2120
|
+
const showToolbar = title != null || toolbarActions != null || enableGlobalFilter || enableColumnVisibility || showGroupMenu;
|
|
1515
2121
|
const titleId = useId();
|
|
1516
2122
|
const isStacked = responsive === "stack";
|
|
1517
2123
|
const isFixedSizing = sizing === "fixed";
|
|
1518
2124
|
const isFillLast = isFixedSizing && fillLastColumn;
|
|
1519
|
-
const view = match({ error, showSkeleton, items:
|
|
2125
|
+
const view = match({ error, showSkeleton, items: itemCount }).with({ error: P.nonNullable }, () => "error").with({ showSkeleton: true }, () => "loading").with({ items: P.number.lte(0) }, () => "empty").otherwise(() => "items");
|
|
2126
|
+
const bodyClassName = cn(
|
|
2127
|
+
classNames?.body,
|
|
2128
|
+
isRefetching && "pointer-events-none opacity-60 transition-opacity"
|
|
2129
|
+
);
|
|
2130
|
+
const leafIndent = `${SELECT_CELL_PADDING_PX[size ?? "md"] + (enableRowSelection ? 28 : 44)}px`;
|
|
2131
|
+
const renderRow = (row, { className: rowClassName, indent = false } = {}) => {
|
|
2132
|
+
const rowTestId = getRowTestId ? getRowTestId(row.original, row.id) : defaultRowTestId(row.id);
|
|
2133
|
+
const indentedColumnId = indent ? row.getVisibleCells().find((cell) => cell.column.id !== "__select__")?.column.id : void 0;
|
|
2134
|
+
return /* @__PURE__ */ jsx(
|
|
2135
|
+
Table.Row,
|
|
2136
|
+
{
|
|
2137
|
+
testId: rowTestId,
|
|
2138
|
+
onClick: onRowClick ? handleRowClick(row.original) : void 0,
|
|
2139
|
+
className: cn(onRowClick && "cursor-pointer", rowClassName, classNames?.row),
|
|
2140
|
+
...props({ "data-selected": row.getIsSelected() }),
|
|
2141
|
+
children: row.getVisibleCells().map((cell, index, cells) => {
|
|
2142
|
+
const fillsRemaining = isFillLast && index === cells.length - 1;
|
|
2143
|
+
const indented = cell.column.id === indentedColumnId;
|
|
2144
|
+
return /* @__PURE__ */ jsx(
|
|
2145
|
+
Table.Cell,
|
|
2146
|
+
{
|
|
2147
|
+
testId: `${rowTestId}-cell-${cell.column.id}`,
|
|
2148
|
+
style: {
|
|
2149
|
+
width: isFixedSizing && !fillsRemaining ? cell.column.getSize() : void 0,
|
|
2150
|
+
"--data-table-leaf-indent": indented ? leafIndent : void 0
|
|
2151
|
+
},
|
|
2152
|
+
className: cn(
|
|
2153
|
+
tableCell({
|
|
2154
|
+
align: cell.column.columnDef.meta?.align
|
|
2155
|
+
}),
|
|
2156
|
+
isFixedSizing && cell.column.id !== "__select__" && "truncate",
|
|
2157
|
+
// Through a custom property, with `!`: the cell padding comes from a
|
|
2158
|
+
// descendant rule on the table root, which a plain utility loses to.
|
|
2159
|
+
indented && "ps-(--data-table-leaf-indent)!",
|
|
2160
|
+
classNames?.cell
|
|
2161
|
+
),
|
|
2162
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
2163
|
+
},
|
|
2164
|
+
cell.id
|
|
2165
|
+
);
|
|
2166
|
+
})
|
|
2167
|
+
},
|
|
2168
|
+
row.id
|
|
2169
|
+
);
|
|
2170
|
+
};
|
|
1520
2171
|
return /* @__PURE__ */ jsxs(
|
|
1521
2172
|
Table,
|
|
1522
2173
|
{
|
|
@@ -1552,6 +2203,20 @@ function DataTableComponent({
|
|
|
1552
2203
|
}
|
|
1553
2204
|
),
|
|
1554
2205
|
toolbarActions,
|
|
2206
|
+
showGroupMenu && /* @__PURE__ */ jsx(
|
|
2207
|
+
DataTableGroupMenu,
|
|
2208
|
+
{
|
|
2209
|
+
table,
|
|
2210
|
+
grouping: activeGrouping,
|
|
2211
|
+
onGroupingChange: handleGroupingChange,
|
|
2212
|
+
maxDepth: maxGroupingDepth,
|
|
2213
|
+
hideEmptyGroups,
|
|
2214
|
+
onHideEmptyGroupsChange: handleHideEmptyGroupsChange,
|
|
2215
|
+
translations: resolvedTranslations,
|
|
2216
|
+
icon: icons.group,
|
|
2217
|
+
className: isStacked ? "hidden @lg:flex" : void 0
|
|
2218
|
+
}
|
|
2219
|
+
),
|
|
1555
2220
|
enableColumnVisibility && /* @__PURE__ */ jsx(
|
|
1556
2221
|
DataTableColumnVisibilityMenu,
|
|
1557
2222
|
{
|
|
@@ -1619,130 +2284,98 @@ function DataTableComponent({
|
|
|
1619
2284
|
header.id
|
|
1620
2285
|
);
|
|
1621
2286
|
}) }, headerGroup.id)) }),
|
|
1622
|
-
/* @__PURE__ */ jsx(
|
|
1623
|
-
|
|
2287
|
+
view === "items" && groupingView ? /* @__PURE__ */ jsx(
|
|
2288
|
+
DataTableGroupedBody,
|
|
1624
2289
|
{
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
RenderPlaceholder,
|
|
1643
|
-
{
|
|
1644
|
-
node: error,
|
|
1645
|
-
defaultActions: onRetry && /* @__PURE__ */ jsx(
|
|
1646
|
-
Button,
|
|
1647
|
-
{
|
|
1648
|
-
variant: "light",
|
|
1649
|
-
color: "neutral",
|
|
1650
|
-
size: "sm",
|
|
1651
|
-
startSlot: icons.retry,
|
|
1652
|
-
onClick: onRetry,
|
|
1653
|
-
children: resolvedTranslations.retry
|
|
1654
|
-
}
|
|
1655
|
-
)
|
|
1656
|
-
}
|
|
1657
|
-
)
|
|
1658
|
-
]
|
|
1659
|
-
}
|
|
1660
|
-
)
|
|
1661
|
-
}
|
|
1662
|
-
) })).with("empty", () => /* @__PURE__ */ jsx(Table.Row, { "data-placeholder": true, children: /* @__PURE__ */ jsx(
|
|
1663
|
-
Table.Cell,
|
|
2290
|
+
grouping: groupingView,
|
|
2291
|
+
table,
|
|
2292
|
+
colSpan: visibleColumnCount,
|
|
2293
|
+
renderRow,
|
|
2294
|
+
selectable: Boolean(enableRowSelection),
|
|
2295
|
+
size: size ?? "md",
|
|
2296
|
+
translations: resolvedTranslations,
|
|
2297
|
+
icons,
|
|
2298
|
+
className: bodyClassName
|
|
2299
|
+
}
|
|
2300
|
+
) : /* @__PURE__ */ jsx(Table.Body, { className: bodyClassName, children: match(view).with("error", () => /* @__PURE__ */ jsx(Table.Row, { "data-placeholder": true, children: /* @__PURE__ */ jsx(
|
|
2301
|
+
Table.Cell,
|
|
2302
|
+
{
|
|
2303
|
+
colSpan: visibleColumnCount,
|
|
2304
|
+
className: cn("py-6 text-center", classNames?.error),
|
|
2305
|
+
children: /* @__PURE__ */ jsxs(
|
|
2306
|
+
"div",
|
|
1664
2307
|
{
|
|
1665
|
-
|
|
1666
|
-
className:
|
|
1667
|
-
children:
|
|
1668
|
-
icons.
|
|
2308
|
+
role: "alert",
|
|
2309
|
+
className: "flex flex-col gap-3 items-center justify-center min-h-48.5",
|
|
2310
|
+
children: [
|
|
2311
|
+
icons.error != null && /* @__PURE__ */ jsx(ThemeIcon, { children: icons.error }),
|
|
1669
2312
|
/* @__PURE__ */ jsx(
|
|
1670
2313
|
RenderPlaceholder,
|
|
1671
2314
|
{
|
|
1672
|
-
node:
|
|
1673
|
-
defaultActions: /* @__PURE__ */ jsx(
|
|
2315
|
+
node: error,
|
|
2316
|
+
defaultActions: onRetry && /* @__PURE__ */ jsx(
|
|
1674
2317
|
Button,
|
|
1675
2318
|
{
|
|
1676
2319
|
variant: "light",
|
|
1677
2320
|
color: "neutral",
|
|
1678
2321
|
size: "sm",
|
|
1679
|
-
startSlot: icons.
|
|
1680
|
-
onClick:
|
|
1681
|
-
children: resolvedTranslations.
|
|
2322
|
+
startSlot: icons.retry,
|
|
2323
|
+
onClick: onRetry,
|
|
2324
|
+
children: resolvedTranslations.retry
|
|
1682
2325
|
}
|
|
1683
2326
|
)
|
|
1684
2327
|
}
|
|
1685
2328
|
)
|
|
1686
|
-
]
|
|
2329
|
+
]
|
|
1687
2330
|
}
|
|
1688
|
-
)
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
2331
|
+
)
|
|
2332
|
+
}
|
|
2333
|
+
) })).with("empty", () => /* @__PURE__ */ jsx(Table.Row, { "data-placeholder": true, children: /* @__PURE__ */ jsx(
|
|
2334
|
+
Table.Cell,
|
|
2335
|
+
{
|
|
2336
|
+
colSpan: visibleColumnCount,
|
|
2337
|
+
className: cn("py-6 text-center", classNames?.empty),
|
|
2338
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 items-center justify-center min-h-48.5", children: [
|
|
2339
|
+
icons.empty != null && /* @__PURE__ */ jsx(ThemeIcon, { children: icons.empty }),
|
|
2340
|
+
/* @__PURE__ */ jsx(
|
|
2341
|
+
RenderPlaceholder,
|
|
1692
2342
|
{
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
children: table.getVisibleLeafColumns().map((column) => /* @__PURE__ */ jsx(
|
|
1697
|
-
Table.Cell,
|
|
2343
|
+
node: empty,
|
|
2344
|
+
defaultActions: /* @__PURE__ */ jsx(
|
|
2345
|
+
Button,
|
|
1698
2346
|
{
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
2347
|
+
variant: "light",
|
|
2348
|
+
color: "neutral",
|
|
2349
|
+
size: "sm",
|
|
2350
|
+
startSlot: icons.clear,
|
|
2351
|
+
onClick: () => table.resetColumnFilters(),
|
|
2352
|
+
children: resolvedTranslations.clearFilters
|
|
2353
|
+
}
|
|
2354
|
+
)
|
|
2355
|
+
}
|
|
2356
|
+
)
|
|
2357
|
+
] })
|
|
2358
|
+
}
|
|
2359
|
+
) })).with(
|
|
2360
|
+
"loading",
|
|
2361
|
+
() => Array.from({ length: skeletonRowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx(
|
|
2362
|
+
Table.Row,
|
|
2363
|
+
{
|
|
2364
|
+
testId: `skeleton-row-${rowIndex}`,
|
|
2365
|
+
"aria-hidden": "true",
|
|
2366
|
+
"data-placeholder": true,
|
|
2367
|
+
children: table.getVisibleLeafColumns().map((column) => /* @__PURE__ */ jsx(
|
|
2368
|
+
Table.Cell,
|
|
2369
|
+
{
|
|
2370
|
+
testId: `skeleton-row-${rowIndex}-cell-${column.id}`,
|
|
2371
|
+
children: column.columnDef.meta?.skeleton ?? /* @__PURE__ */ jsx(Skeleton, { shape: "rectangular", size, className: "w-full" })
|
|
1704
2372
|
},
|
|
1705
|
-
|
|
2373
|
+
column.id
|
|
1706
2374
|
))
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
return /* @__PURE__ */ jsx(
|
|
1712
|
-
Table.Row,
|
|
1713
|
-
{
|
|
1714
|
-
testId: rowTestId,
|
|
1715
|
-
onClick: onRowClick ? handleRowClick(row.original) : void 0,
|
|
1716
|
-
className: cn(onRowClick && "cursor-pointer", classNames?.row),
|
|
1717
|
-
...props({ "data-selected": row.getIsSelected() }),
|
|
1718
|
-
children: row.getVisibleCells().map((cell, index, cells) => {
|
|
1719
|
-
const fillsRemaining = isFillLast && index === cells.length - 1;
|
|
1720
|
-
return /* @__PURE__ */ jsx(
|
|
1721
|
-
Table.Cell,
|
|
1722
|
-
{
|
|
1723
|
-
testId: `${rowTestId}-cell-${cell.column.id}`,
|
|
1724
|
-
style: {
|
|
1725
|
-
width: isFixedSizing && !fillsRemaining ? cell.column.getSize() : void 0
|
|
1726
|
-
},
|
|
1727
|
-
className: cn(
|
|
1728
|
-
tableCell({
|
|
1729
|
-
align: cell.column.columnDef.meta?.align
|
|
1730
|
-
}),
|
|
1731
|
-
isFixedSizing && cell.column.id !== "__select__" && "truncate",
|
|
1732
|
-
classNames?.cell
|
|
1733
|
-
),
|
|
1734
|
-
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
1735
|
-
},
|
|
1736
|
-
cell.id
|
|
1737
|
-
);
|
|
1738
|
-
})
|
|
1739
|
-
},
|
|
1740
|
-
row.id
|
|
1741
|
-
);
|
|
1742
|
-
})
|
|
1743
|
-
).exhaustive()
|
|
1744
|
-
}
|
|
1745
|
-
)
|
|
2375
|
+
},
|
|
2376
|
+
`skeleton-${rowIndex}`
|
|
2377
|
+
))
|
|
2378
|
+
).with("items", () => rows.map((row) => renderRow(row))).exhaustive() })
|
|
1746
2379
|
]
|
|
1747
2380
|
}
|
|
1748
2381
|
),
|
|
@@ -1752,6 +2385,13 @@ function DataTableComponent({
|
|
|
1752
2385
|
{
|
|
1753
2386
|
table,
|
|
1754
2387
|
enableColumnVisibility,
|
|
2388
|
+
grouping: showGroupMenu ? {
|
|
2389
|
+
value: activeGrouping,
|
|
2390
|
+
onChange: handleGroupingChange,
|
|
2391
|
+
maxDepth: maxGroupingDepth,
|
|
2392
|
+
hideEmptyGroups,
|
|
2393
|
+
onHideEmptyGroupsChange: handleHideEmptyGroupsChange
|
|
2394
|
+
} : void 0,
|
|
1755
2395
|
translations: resolvedTranslations,
|
|
1756
2396
|
icons,
|
|
1757
2397
|
className: "@lg:hidden"
|
|
@@ -1761,6 +2401,7 @@ function DataTableComponent({
|
|
|
1761
2401
|
DataTableStackedRows,
|
|
1762
2402
|
{
|
|
1763
2403
|
rows,
|
|
2404
|
+
grouping: groupingView,
|
|
1764
2405
|
view,
|
|
1765
2406
|
error,
|
|
1766
2407
|
refetching: isRefetching,
|
|
@@ -1776,10 +2417,18 @@ function DataTableComponent({
|
|
|
1776
2417
|
}
|
|
1777
2418
|
)
|
|
1778
2419
|
] }),
|
|
1779
|
-
enablePagination && /* @__PURE__ */ jsx(
|
|
2420
|
+
enablePagination && (groupingView && !groupsOnePage ? /* @__PURE__ */ jsx(
|
|
2421
|
+
DataTableGroupSummary,
|
|
2422
|
+
{
|
|
2423
|
+
grouping: groupingView,
|
|
2424
|
+
translations: resolvedTranslations,
|
|
2425
|
+
className: classNames?.pagination
|
|
2426
|
+
}
|
|
2427
|
+
) : /* @__PURE__ */ jsx(
|
|
1780
2428
|
DataTablePagination,
|
|
1781
2429
|
{
|
|
1782
2430
|
table,
|
|
2431
|
+
rowsOnPage: groupingView ? loadedCount : void 0,
|
|
1783
2432
|
pageSizeOptions,
|
|
1784
2433
|
hasNextPage,
|
|
1785
2434
|
translations,
|
|
@@ -1787,7 +2436,7 @@ function DataTableComponent({
|
|
|
1787
2436
|
icons,
|
|
1788
2437
|
className: classNames?.pagination
|
|
1789
2438
|
}
|
|
1790
|
-
)
|
|
2439
|
+
))
|
|
1791
2440
|
]
|
|
1792
2441
|
}
|
|
1793
2442
|
);
|