eidos-ui 2.0.0 → 2.1.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/Avatar.types-BY-C09Ke.d.cts +23 -0
- package/dist/Avatar.types-BY-C09Ke.d.ts +23 -0
- package/dist/{Header.types-BZi80bWz.d.cts → Header.types-B3QtuiL-.d.cts} +7 -3
- package/dist/{Header.types-DJt-q01P.d.ts → Header.types-C6w0FBY8.d.ts} +7 -3
- package/dist/{Table.types-Cl5gR8r9.d.cts → Table.types-CPj-udMc.d.cts} +95 -0
- package/dist/{Table.types-jhPb7JNU.d.ts → Table.types-CZZ7QWAI.d.ts} +95 -0
- package/dist/Toolbar.types-DSk8z2iy.d.cts +38 -0
- package/dist/Toolbar.types-RN0klQzu.d.ts +38 -0
- package/dist/alert/index.cjs +4 -4
- package/dist/alert/index.d.cts +2 -1
- package/dist/alert/index.d.ts +2 -1
- package/dist/alert/index.js +3 -3
- package/dist/avatar/index.d.cts +3 -21
- package/dist/avatar/index.d.ts +3 -21
- package/dist/button/index.cjs +3 -3
- package/dist/button/index.js +2 -2
- package/dist/chip/index.cjs +3 -3
- package/dist/chip/index.js +2 -2
- package/dist/{chunk-KIXFSXIN.cjs → chunk-3E7TKBQI.cjs} +5 -3
- package/dist/chunk-3E7TKBQI.cjs.map +1 -0
- package/dist/{chunk-ZBKJ3EMK.cjs → chunk-442U3W6R.cjs} +3 -3
- package/dist/{chunk-ZBKJ3EMK.cjs.map → chunk-442U3W6R.cjs.map} +1 -1
- package/dist/{chunk-YQLCPKGV.js → chunk-5HUZYY54.js} +6 -4
- package/dist/chunk-5HUZYY54.js.map +1 -0
- package/dist/{chunk-G5IGADJI.cjs → chunk-5VM2256W.cjs} +7 -11
- package/dist/chunk-5VM2256W.cjs.map +1 -0
- package/dist/{chunk-Z4ZY7L7W.js → chunk-5ZL6PYU3.js} +3 -3
- package/dist/{chunk-A3NE2C7C.js → chunk-67RFMV6K.js} +2 -2
- package/dist/{chunk-2U7UJOOB.cjs → chunk-6HUHH6Y4.cjs} +17 -15
- package/dist/chunk-6HUHH6Y4.cjs.map +1 -0
- package/dist/{chunk-5WROPW7Z.js → chunk-A7WQINIG.js} +3 -3
- package/dist/{chunk-DKZTDYH5.cjs → chunk-AAA6TR5I.cjs} +3 -3
- package/dist/{chunk-DKZTDYH5.cjs.map → chunk-AAA6TR5I.cjs.map} +1 -1
- package/dist/{chunk-A7Z2QAFZ.cjs → chunk-APK5OQRV.cjs} +5 -5
- package/dist/{chunk-A7Z2QAFZ.cjs.map → chunk-APK5OQRV.cjs.map} +1 -1
- package/dist/{chunk-ISABZ2VX.cjs → chunk-AXBYJ2OY.cjs} +9 -9
- package/dist/{chunk-ISABZ2VX.cjs.map → chunk-AXBYJ2OY.cjs.map} +1 -1
- package/dist/{chunk-6RGJAQCU.cjs → chunk-B5G5XVFJ.cjs} +5 -5
- package/dist/{chunk-6RGJAQCU.cjs.map → chunk-B5G5XVFJ.cjs.map} +1 -1
- package/dist/{chunk-MW2S7PZ7.cjs → chunk-D5IY2HUV.cjs} +5 -5
- package/dist/{chunk-MW2S7PZ7.cjs.map → chunk-D5IY2HUV.cjs.map} +1 -1
- package/dist/{chunk-FMPXSF3H.cjs → chunk-DAXZRNNO.cjs} +4 -4
- package/dist/{chunk-FMPXSF3H.cjs.map → chunk-DAXZRNNO.cjs.map} +1 -1
- package/dist/{chunk-AJZTVCST.js → chunk-EXITZVB2.js} +24 -9
- package/dist/chunk-EXITZVB2.js.map +1 -0
- package/dist/{chunk-AYMD4D4M.cjs → chunk-EZME5CLK.cjs} +3 -3
- package/dist/{chunk-AYMD4D4M.cjs.map → chunk-EZME5CLK.cjs.map} +1 -1
- package/dist/{chunk-IV4LM3MB.js → chunk-F26VIKNF.js} +9 -11
- package/dist/chunk-F26VIKNF.js.map +1 -0
- package/dist/{chunk-WPTMMOA6.cjs → chunk-G77YR73R.cjs} +10 -13
- package/dist/chunk-G77YR73R.cjs.map +1 -0
- package/dist/chunk-GEHL4LKK.cjs +32 -0
- package/dist/chunk-GEHL4LKK.cjs.map +1 -0
- package/dist/chunk-GGSII6Y2.cjs +921 -0
- package/dist/chunk-GGSII6Y2.cjs.map +1 -0
- package/dist/{chunk-3VRMTWUS.js → chunk-GHQ6SQPI.js} +7 -10
- package/dist/chunk-GHQ6SQPI.js.map +1 -0
- package/dist/{chunk-56B6RLOE.js → chunk-GI6VJYOS.js} +4 -4
- package/dist/{chunk-56B6RLOE.js.map → chunk-GI6VJYOS.js.map} +1 -1
- package/dist/{chunk-UGMONQGH.cjs → chunk-GR2PMCVN.cjs} +10 -12
- package/dist/chunk-GR2PMCVN.cjs.map +1 -0
- package/dist/{chunk-7AHZTHXR.cjs → chunk-GT22EGJP.cjs} +5 -5
- package/dist/{chunk-7AHZTHXR.cjs.map → chunk-GT22EGJP.cjs.map} +1 -1
- package/dist/{chunk-ALGX5X4N.js → chunk-IFVT5UCY.js} +3 -3
- package/dist/{chunk-5CLC3FJO.js → chunk-KBG77JHC.js} +13 -2
- package/dist/chunk-KBG77JHC.js.map +1 -0
- package/dist/{chunk-HLNKIAE5.cjs → chunk-KJZUYC4X.cjs} +5 -5
- package/dist/{chunk-HLNKIAE5.cjs.map → chunk-KJZUYC4X.cjs.map} +1 -1
- package/dist/{chunk-4BQM5F76.cjs → chunk-LFWPQYWX.cjs} +3 -3
- package/dist/{chunk-4BQM5F76.cjs.map → chunk-LFWPQYWX.cjs.map} +1 -1
- package/dist/{chunk-XVSODE4K.cjs → chunk-LIFUHQH5.cjs} +35 -20
- package/dist/chunk-LIFUHQH5.cjs.map +1 -0
- package/dist/{chunk-PJC7NZUV.cjs → chunk-LUL6RZ4M.cjs} +3 -3
- package/dist/{chunk-PJC7NZUV.cjs.map → chunk-LUL6RZ4M.cjs.map} +1 -1
- package/dist/{chunk-4UJ7LG4W.cjs → chunk-N2IGZIEX.cjs} +3 -3
- package/dist/{chunk-4UJ7LG4W.cjs.map → chunk-N2IGZIEX.cjs.map} +1 -1
- package/dist/{chunk-3LHQUOGP.js → chunk-NGVOXM7P.js} +3 -3
- package/dist/{chunk-WTXASLBB.js → chunk-O5WEKLNF.js} +2 -2
- package/dist/{chunk-BOB5JJ7F.js → chunk-P7IQY5YH.js} +2 -2
- package/dist/{chunk-VZYLJSV5.js → chunk-R4PU2TBM.js} +2 -2
- package/dist/{chunk-P2GCAVUZ.js → chunk-RAZRQ57B.js} +2 -2
- package/dist/{chunk-K7IFNKMN.js → chunk-REVK7IGN.js} +2 -2
- package/dist/{chunk-6U2H26A4.cjs → chunk-RHOT7AEI.cjs} +3 -3
- package/dist/{chunk-6U2H26A4.cjs.map → chunk-RHOT7AEI.cjs.map} +1 -1
- package/dist/{chunk-MH2CD2QT.js → chunk-RKA2OJRT.js} +207 -102
- package/dist/chunk-RKA2OJRT.js.map +1 -0
- package/dist/{chunk-JC4WLVBG.js → chunk-RWOX2NJN.js} +2 -2
- package/dist/{chunk-4LM33LDV.js → chunk-S3CT536K.js} +2 -2
- package/dist/{chunk-4M3LZLOH.js → chunk-SHYSLWQG.js} +2 -2
- package/dist/{chunk-EQEV7GPT.cjs → chunk-SKEWTQJ7.cjs} +5 -5
- package/dist/{chunk-EQEV7GPT.cjs.map → chunk-SKEWTQJ7.cjs.map} +1 -1
- package/dist/{chunk-2ZENLZEQ.cjs → chunk-SKTDGCWJ.cjs} +232 -127
- package/dist/chunk-SKTDGCWJ.cjs.map +1 -0
- package/dist/{chunk-2BXCIWL7.js → chunk-SN6EWQDJ.js} +3 -3
- package/dist/{chunk-DW2YDWGN.js → chunk-TEJIPPZR.js} +2 -2
- package/dist/{chunk-OGKD5PLS.cjs → chunk-TRLBYA5G.cjs} +4 -4
- package/dist/{chunk-OGKD5PLS.cjs.map → chunk-TRLBYA5G.cjs.map} +1 -1
- package/dist/{chunk-WE5FTQGD.js → chunk-VHMOKXUT.js} +3 -7
- package/dist/chunk-VHMOKXUT.js.map +1 -0
- package/dist/{chunk-S77GR5YQ.cjs → chunk-VHQTDITV.cjs} +3 -3
- package/dist/{chunk-S77GR5YQ.cjs.map → chunk-VHQTDITV.cjs.map} +1 -1
- package/dist/{chunk-3HMKE2GJ.js → chunk-VSTQEHVZ.js} +6 -4
- package/dist/chunk-VSTQEHVZ.js.map +1 -0
- package/dist/{chunk-HNUTV3HR.cjs → chunk-WUBQJVB7.cjs} +3 -3
- package/dist/{chunk-HNUTV3HR.cjs.map → chunk-WUBQJVB7.cjs.map} +1 -1
- package/dist/{chunk-S7TWEVC3.js → chunk-Y53HCLGW.js} +2 -2
- package/dist/{chunk-WIE7HDIM.js → chunk-YJXZR7RL.js} +2 -2
- package/dist/{chunk-IJYYHBZC.cjs → chunk-Z4SLV6WG.cjs} +3 -3
- package/dist/{chunk-IJYYHBZC.cjs.map → chunk-Z4SLV6WG.cjs.map} +1 -1
- package/dist/chunk-ZEZK664O.js +921 -0
- package/dist/chunk-ZEZK664O.js.map +1 -0
- package/dist/{chunk-JMD3P4CY.js → chunk-ZHFPV43D.js} +2 -2
- package/dist/combobox/index.cjs +4 -4
- package/dist/combobox/index.js +3 -3
- package/dist/context-menu/index.cjs +4 -4
- package/dist/context-menu/index.js +3 -3
- package/dist/data-grid/index.cjs +13 -13
- package/dist/data-grid/index.d.cts +49 -3
- package/dist/data-grid/index.d.ts +49 -3
- package/dist/data-grid/index.js +12 -12
- package/dist/date-picker/index.cjs +6 -6
- package/dist/date-picker/index.js +5 -5
- package/dist/drawer/index.cjs +4 -4
- package/dist/drawer/index.d.cts +2 -1
- package/dist/drawer/index.d.ts +2 -1
- package/dist/drawer/index.js +3 -3
- package/dist/empty-state/index.d.cts +2 -2
- package/dist/empty-state/index.d.ts +2 -2
- package/dist/header/index.cjs +4 -4
- package/dist/header/index.d.cts +2 -2
- package/dist/header/index.d.ts +2 -2
- package/dist/header/index.js +3 -3
- package/dist/index.cjs +29 -29
- package/dist/index.css +318 -73
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +28 -28
- package/dist/inline-edit/index.cjs +4 -4
- package/dist/inline-edit/index.js +3 -3
- package/dist/input/index.cjs +3 -3
- package/dist/input/index.js +2 -2
- package/dist/menu/index.cjs +3 -3
- package/dist/menu/index.js +2 -2
- package/dist/modal/index.cjs +4 -4
- package/dist/modal/index.d.cts +2 -1
- package/dist/modal/index.d.ts +2 -1
- package/dist/modal/index.js +3 -3
- package/dist/navigation/index.cjs +4 -4
- package/dist/navigation/index.js +3 -3
- package/dist/page-layout/index.cjs +8 -8
- package/dist/page-layout/index.d.cts +3 -2
- package/dist/page-layout/index.d.ts +3 -2
- package/dist/page-layout/index.js +7 -7
- package/dist/pagination/index.cjs +6 -6
- package/dist/pagination/index.js +5 -5
- package/dist/popover/index.cjs +2 -2
- package/dist/popover/index.d.cts +2 -2
- package/dist/popover/index.d.ts +2 -2
- package/dist/popover/index.js +1 -1
- package/dist/segmented-control/index.cjs +3 -3
- package/dist/segmented-control/index.js +2 -2
- package/dist/select/index.cjs +4 -4
- package/dist/select/index.js +3 -3
- package/dist/snackbar/index.cjs +4 -4
- package/dist/snackbar/index.js +3 -3
- package/dist/split-button/index.cjs +4 -4
- package/dist/split-button/index.js +3 -3
- package/dist/table/index.cjs +11 -11
- package/dist/table/index.d.cts +3 -3
- package/dist/table/index.d.ts +3 -3
- package/dist/table/index.js +10 -10
- package/dist/tabs/index.cjs +3 -3
- package/dist/tabs/index.js +2 -2
- package/dist/tag-input/index.cjs +4 -4
- package/dist/tag-input/index.js +3 -3
- package/dist/textarea/index.cjs +3 -3
- package/dist/textarea/index.js +2 -2
- package/dist/toolbar/index.cjs +5 -5
- package/dist/toolbar/index.d.cts +3 -2
- package/dist/toolbar/index.d.ts +3 -2
- package/dist/toolbar/index.js +4 -4
- package/package.json +6 -5
- package/dist/Toolbar.types-BGD57Uhm.d.ts +0 -22
- package/dist/Toolbar.types-tQkLmPIu.d.cts +0 -22
- package/dist/chunk-2U7UJOOB.cjs.map +0 -1
- package/dist/chunk-2ZENLZEQ.cjs.map +0 -1
- package/dist/chunk-3HMKE2GJ.js.map +0 -1
- package/dist/chunk-3VRMTWUS.js.map +0 -1
- package/dist/chunk-5CLC3FJO.js.map +0 -1
- package/dist/chunk-AJZTVCST.js.map +0 -1
- package/dist/chunk-G5IGADJI.cjs.map +0 -1
- package/dist/chunk-GOR642KK.cjs +0 -21
- package/dist/chunk-GOR642KK.cjs.map +0 -1
- package/dist/chunk-IV4LM3MB.js.map +0 -1
- package/dist/chunk-KIXFSXIN.cjs.map +0 -1
- package/dist/chunk-MH2CD2QT.js.map +0 -1
- package/dist/chunk-QONDJ5VM.cjs +0 -744
- package/dist/chunk-QONDJ5VM.cjs.map +0 -1
- package/dist/chunk-UGMONQGH.cjs.map +0 -1
- package/dist/chunk-VSFKM7FE.js +0 -744
- package/dist/chunk-VSFKM7FE.js.map +0 -1
- package/dist/chunk-WE5FTQGD.js.map +0 -1
- package/dist/chunk-WPTMMOA6.cjs.map +0 -1
- package/dist/chunk-XVSODE4K.cjs.map +0 -1
- package/dist/chunk-YQLCPKGV.js.map +0 -1
- /package/dist/{chunk-Z4ZY7L7W.js.map → chunk-5ZL6PYU3.js.map} +0 -0
- /package/dist/{chunk-A3NE2C7C.js.map → chunk-67RFMV6K.js.map} +0 -0
- /package/dist/{chunk-5WROPW7Z.js.map → chunk-A7WQINIG.js.map} +0 -0
- /package/dist/{chunk-ALGX5X4N.js.map → chunk-IFVT5UCY.js.map} +0 -0
- /package/dist/{chunk-3LHQUOGP.js.map → chunk-NGVOXM7P.js.map} +0 -0
- /package/dist/{chunk-WTXASLBB.js.map → chunk-O5WEKLNF.js.map} +0 -0
- /package/dist/{chunk-BOB5JJ7F.js.map → chunk-P7IQY5YH.js.map} +0 -0
- /package/dist/{chunk-VZYLJSV5.js.map → chunk-R4PU2TBM.js.map} +0 -0
- /package/dist/{chunk-P2GCAVUZ.js.map → chunk-RAZRQ57B.js.map} +0 -0
- /package/dist/{chunk-K7IFNKMN.js.map → chunk-REVK7IGN.js.map} +0 -0
- /package/dist/{chunk-JC4WLVBG.js.map → chunk-RWOX2NJN.js.map} +0 -0
- /package/dist/{chunk-4LM33LDV.js.map → chunk-S3CT536K.js.map} +0 -0
- /package/dist/{chunk-4M3LZLOH.js.map → chunk-SHYSLWQG.js.map} +0 -0
- /package/dist/{chunk-2BXCIWL7.js.map → chunk-SN6EWQDJ.js.map} +0 -0
- /package/dist/{chunk-DW2YDWGN.js.map → chunk-TEJIPPZR.js.map} +0 -0
- /package/dist/{chunk-S7TWEVC3.js.map → chunk-Y53HCLGW.js.map} +0 -0
- /package/dist/{chunk-WIE7HDIM.js.map → chunk-YJXZR7RL.js.map} +0 -0
- /package/dist/{chunk-JMD3P4CY.js.map → chunk-ZHFPV43D.js.map} +0 -0
|
@@ -11,22 +11,22 @@ import {
|
|
|
11
11
|
useSensors,
|
|
12
12
|
useSortable,
|
|
13
13
|
verticalListSortingStrategy
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-EXITZVB2.js";
|
|
15
15
|
import {
|
|
16
16
|
Spinner
|
|
17
17
|
} from "./chunk-6ZAT5CGB.js";
|
|
18
18
|
import {
|
|
19
19
|
SplitButton
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-NGVOXM7P.js";
|
|
21
21
|
import {
|
|
22
22
|
Pagination
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-GI6VJYOS.js";
|
|
24
24
|
import {
|
|
25
25
|
SegmentedControl
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-P7IQY5YH.js";
|
|
27
27
|
import {
|
|
28
28
|
Select
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-A7WQINIG.js";
|
|
30
30
|
import {
|
|
31
31
|
EmptyState
|
|
32
32
|
} from "./chunk-3TUCQAYL.js";
|
|
@@ -35,22 +35,23 @@ import {
|
|
|
35
35
|
} from "./chunk-H6CWTMAH.js";
|
|
36
36
|
import {
|
|
37
37
|
Combobox
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-TEJIPPZR.js";
|
|
39
39
|
import {
|
|
40
40
|
Input
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-VHMOKXUT.js";
|
|
42
42
|
import {
|
|
43
43
|
Menu
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-ZHFPV43D.js";
|
|
45
45
|
import {
|
|
46
46
|
Dropdown
|
|
47
47
|
} from "./chunk-4BKTBV2I.js";
|
|
48
48
|
import {
|
|
49
49
|
Button
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-YJXZR7RL.js";
|
|
51
51
|
import {
|
|
52
|
+
devWarn,
|
|
52
53
|
renderIcon
|
|
53
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-KBG77JHC.js";
|
|
54
55
|
|
|
55
56
|
// src/components/DataGrid/DataGrid.component.tsx
|
|
56
57
|
import React, { useState, useEffect, useRef, useCallback, useMemo, useLayoutEffect } from "react";
|
|
@@ -61,7 +62,6 @@ import {
|
|
|
61
62
|
ArrowDown,
|
|
62
63
|
ChevronsUpDown,
|
|
63
64
|
ChevronRight,
|
|
64
|
-
X,
|
|
65
65
|
Plus,
|
|
66
66
|
AlignJustify,
|
|
67
67
|
Check,
|
|
@@ -70,7 +70,13 @@ import {
|
|
|
70
70
|
MoreVertical
|
|
71
71
|
} from "lucide-react";
|
|
72
72
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
73
|
-
var
|
|
73
|
+
var MIN_DATA_COLUMN_WIDTH_PX = 100;
|
|
74
|
+
var ACTIONS_COLUMN_WIDTH_PX = 48;
|
|
75
|
+
var CHECKBOX_COLUMN_WIDTH_PX = 40;
|
|
76
|
+
var ROW_NUMBER_COLUMN_WIDTH_PX = 40;
|
|
77
|
+
var DRAG_HANDLE_COLUMN_WIDTH_PX = 32;
|
|
78
|
+
var EXPAND_COLUMN_WIDTH_PX = 32;
|
|
79
|
+
var COMPACT_TOOLBAR_WIDTH_PX = 560;
|
|
74
80
|
var cellOf = (row, key) => row[key];
|
|
75
81
|
var QUICK_FILTER_RESET_VALUE = "";
|
|
76
82
|
var hasFilterValue = (value) => {
|
|
@@ -203,6 +209,8 @@ function DataGridInner({
|
|
|
203
209
|
selectedRows: controlledSelectedRows,
|
|
204
210
|
defaultSelectedRows,
|
|
205
211
|
onSelectionChange,
|
|
212
|
+
selectAllScope = "all",
|
|
213
|
+
onSelectAllMatching,
|
|
206
214
|
bulkActions,
|
|
207
215
|
// ── Row expansion ────────────────────────────────────────────────────────────
|
|
208
216
|
expandable = false,
|
|
@@ -275,22 +283,26 @@ function DataGridInner({
|
|
|
275
283
|
);
|
|
276
284
|
const [containerWidth, setContainerWidth] = useState(null);
|
|
277
285
|
const resizeObserverRef = useRef(null);
|
|
278
|
-
const setContainerRef = useCallback(
|
|
279
|
-
(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
286
|
+
const setContainerRef = useCallback((el) => {
|
|
287
|
+
resizeObserverRef.current?.disconnect();
|
|
288
|
+
resizeObserverRef.current = null;
|
|
289
|
+
if (!el) return;
|
|
290
|
+
const observer = new ResizeObserver((entries) => {
|
|
291
|
+
const width = entries[0]?.contentRect.width;
|
|
292
|
+
if (width != null) setContainerWidth(width);
|
|
293
|
+
});
|
|
294
|
+
observer.observe(el);
|
|
295
|
+
resizeObserverRef.current = observer;
|
|
296
|
+
}, []);
|
|
297
|
+
const minTableWidth = useMemo(
|
|
298
|
+
() => columns.reduce(
|
|
299
|
+
(total, column) => total + (column.type === "actions" ? ACTIONS_COLUMN_WIDTH_PX : MIN_DATA_COLUMN_WIDTH_PX),
|
|
300
|
+
(showRowNumbers ? ROW_NUMBER_COLUMN_WIDTH_PX : 0) + (draggableRows ? DRAG_HANDLE_COLUMN_WIDTH_PX : 0) + (selectable ? CHECKBOX_COLUMN_WIDTH_PX : 0) + (expandable ? EXPAND_COLUMN_WIDTH_PX : 0)
|
|
301
|
+
),
|
|
302
|
+
[columns, showRowNumbers, draggableRows, selectable, expandable]
|
|
291
303
|
);
|
|
292
|
-
const
|
|
293
|
-
const
|
|
304
|
+
const isCardView = hasCardView && containerWidth !== null && (containerWidth < cardViewBreakpoint || containerWidth < minTableWidth);
|
|
305
|
+
const isCompactToolbar = containerWidth !== null && containerWidth < COMPACT_TOOLBAR_WIDTH_PX;
|
|
294
306
|
const cardHeaderColumn = useMemo(() => columns.find((c) => c.cardHeader), [columns]);
|
|
295
307
|
const cardSubheaderColumn = useMemo(() => columns.find((c) => c.cardSubheader), [columns]);
|
|
296
308
|
const actionsColumn = useMemo(() => columns.find((c) => c.type === "actions"), [columns]);
|
|
@@ -298,6 +310,7 @@ function DataGridInner({
|
|
|
298
310
|
() => columns.filter((c) => c !== actionsColumn),
|
|
299
311
|
[columns, actionsColumn]
|
|
300
312
|
);
|
|
313
|
+
const hasCardToolbar = selectable || showRowNumbers || expandable || !!cardHeaderColumn || !!cardSubheaderColumn || !!actionsColumn;
|
|
301
314
|
const cardFieldColumns = useMemo(
|
|
302
315
|
() => dataColumns.filter((c) => c !== cardHeaderColumn && c !== cardSubheaderColumn),
|
|
303
316
|
[dataColumns, cardHeaderColumn, cardSubheaderColumn]
|
|
@@ -328,16 +341,36 @@ function DataGridInner({
|
|
|
328
341
|
() => new Set(isControlledSelection ? controlledSelectedRows ?? [] : [...internalSelectedKeys]),
|
|
329
342
|
[isControlledSelection, controlledSelectedRows, internalSelectedKeys]
|
|
330
343
|
);
|
|
331
|
-
const allKeys = useMemo(
|
|
332
|
-
() => localData.map((row, idx) => String(cellOf(row, rowKeyField) ?? idx)),
|
|
333
|
-
[localData, rowKeyField]
|
|
334
|
-
);
|
|
335
|
-
const allSelected = allKeys.length > 0 && allKeys.every((k) => selectedSet.has(k));
|
|
336
|
-
const someSelected = !allSelected && allKeys.some((k) => selectedSet.has(k));
|
|
337
344
|
const hasSelection = selectedSet.size > 0;
|
|
345
|
+
const selectedRowCacheRef = useRef(/* @__PURE__ */ new Map());
|
|
346
|
+
const rowsForKeys = useCallback(
|
|
347
|
+
(keys) => {
|
|
348
|
+
const current = /* @__PURE__ */ new Map();
|
|
349
|
+
localDataRef.current.forEach(
|
|
350
|
+
(row, idx) => current.set(String(cellOf(row, rowKeyField) ?? idx), row)
|
|
351
|
+
);
|
|
352
|
+
const cache = selectedRowCacheRef.current;
|
|
353
|
+
return keys.map((key) => current.get(key) ?? cache.get(key)).filter((row) => row !== void 0);
|
|
354
|
+
},
|
|
355
|
+
[rowKeyField]
|
|
356
|
+
);
|
|
357
|
+
useEffect(() => {
|
|
358
|
+
const cache = selectedRowCacheRef.current;
|
|
359
|
+
const current = /* @__PURE__ */ new Map();
|
|
360
|
+
localData.forEach((row, idx) => current.set(String(cellOf(row, rowKeyField) ?? idx), row));
|
|
361
|
+
const next = /* @__PURE__ */ new Map();
|
|
362
|
+
selectedSet.forEach((key) => {
|
|
363
|
+
const row = current.get(key) ?? cache.get(key);
|
|
364
|
+
if (row) next.set(key, row);
|
|
365
|
+
});
|
|
366
|
+
selectedRowCacheRef.current = next;
|
|
367
|
+
}, [localData, selectedSet, rowKeyField]);
|
|
338
368
|
const selectedItems = useMemo(
|
|
339
|
-
() =>
|
|
340
|
-
|
|
369
|
+
() => rowsForKeys([...selectedSet]),
|
|
370
|
+
// `localData` isn't read directly here - `rowsForKeys` reads it through a
|
|
371
|
+
// ref - but it must still retrigger this when the loaded rows change.
|
|
372
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
373
|
+
[rowsForKeys, selectedSet, localData]
|
|
341
374
|
);
|
|
342
375
|
const expandedSet = useMemo(
|
|
343
376
|
() => new Set(isControlledExpansion ? controlledExpandedRows ?? [] : [...internalExpandedKeys]),
|
|
@@ -414,6 +447,22 @@ function DataGridInner({
|
|
|
414
447
|
}, [sortedData, showPagination, currentPage, currentPageSize, onPageChange]);
|
|
415
448
|
const totalItemCount = totalRowsProp ?? sortedData.length;
|
|
416
449
|
const totalPages = Math.max(1, Math.ceil(totalItemCount / currentPageSize));
|
|
450
|
+
const selectAllKeys = useMemo(
|
|
451
|
+
() => (selectAllScope === "page" ? displayData : localData).map(
|
|
452
|
+
(row, idx) => String(cellOf(row, rowKeyField) ?? idx)
|
|
453
|
+
),
|
|
454
|
+
[selectAllScope, displayData, localData, rowKeyField]
|
|
455
|
+
);
|
|
456
|
+
const allSelected = selectAllKeys.length > 0 && selectAllKeys.every((key) => selectedSet.has(key));
|
|
457
|
+
const someSelected = !allSelected && selectAllKeys.some((key) => selectedSet.has(key));
|
|
458
|
+
useEffect(() => {
|
|
459
|
+
if (!selectable || selectAllScope !== "all") return;
|
|
460
|
+
if (totalItemCount <= localData.length) return;
|
|
461
|
+
devWarn(
|
|
462
|
+
`datagrid-select-all-scope:${localData.length}/${totalItemCount}`,
|
|
463
|
+
`DataGrid: selectAllScope="all" can only select the ${localData.length} row(s) currently loaded, but there are ${totalItemCount} in total. The keys of rows the grid has never received cannot be known here - use selectAllScope="page" to make the scope explicit, or resolve the full key set yourself and pass it as \`selectedRows\`.`
|
|
464
|
+
);
|
|
465
|
+
}, [selectable, selectAllScope, totalItemCount, localData.length]);
|
|
417
466
|
const activeFiltersKey = useMemo(() => JSON.stringify(activeFilters), [activeFilters]);
|
|
418
467
|
useEffect(() => {
|
|
419
468
|
setCurrentPage(1);
|
|
@@ -654,12 +703,9 @@ function DataGridInner({
|
|
|
654
703
|
const commitSelection = useCallback(
|
|
655
704
|
(keys) => {
|
|
656
705
|
if (!isControlledSelection) setInternalSelectedKeys(new Set(keys));
|
|
657
|
-
|
|
658
|
-
(row, idx) => keys.includes(String(cellOf(row, rowKeyField) ?? idx))
|
|
659
|
-
);
|
|
660
|
-
onSelectionChange?.(keys, rows);
|
|
706
|
+
onSelectionChange?.(keys, rowsForKeys(keys));
|
|
661
707
|
},
|
|
662
|
-
[isControlledSelection,
|
|
708
|
+
[isControlledSelection, onSelectionChange, rowsForKeys]
|
|
663
709
|
);
|
|
664
710
|
const toggleRow = useCallback(
|
|
665
711
|
(key) => {
|
|
@@ -668,9 +714,30 @@ function DataGridInner({
|
|
|
668
714
|
},
|
|
669
715
|
[selectedSet, commitSelection]
|
|
670
716
|
);
|
|
717
|
+
const [isSelectingAllMatching, setIsSelectingAllMatching] = useState(false);
|
|
718
|
+
const holdsEveryRow = totalItemCount <= localData.length;
|
|
719
|
+
const hasSelectedAllMatching = !holdsEveryRow && selectedSet.size >= totalItemCount;
|
|
720
|
+
const canSelectAllMatching = !!onSelectAllMatching && selectable && !holdsEveryRow && allSelected && !hasSelectedAllMatching;
|
|
721
|
+
const selectAllMatching = useCallback(async () => {
|
|
722
|
+
if (!onSelectAllMatching) return;
|
|
723
|
+
setIsSelectingAllMatching(true);
|
|
724
|
+
try {
|
|
725
|
+
commitSelection(await onSelectAllMatching());
|
|
726
|
+
} catch (error) {
|
|
727
|
+
devWarn(
|
|
728
|
+
"datagrid-select-all-matching-failed",
|
|
729
|
+
`DataGrid: onSelectAllMatching() rejected, so the selection was left untouched. ${String(error)}`
|
|
730
|
+
);
|
|
731
|
+
} finally {
|
|
732
|
+
setIsSelectingAllMatching(false);
|
|
733
|
+
}
|
|
734
|
+
}, [onSelectAllMatching, commitSelection]);
|
|
671
735
|
const toggleAll = useCallback(() => {
|
|
672
|
-
|
|
673
|
-
|
|
736
|
+
const inScope = new Set(selectAllKeys);
|
|
737
|
+
commitSelection(
|
|
738
|
+
allSelected ? [...selectedSet].filter((key) => !inScope.has(key)) : [.../* @__PURE__ */ new Set([...selectedSet, ...selectAllKeys])]
|
|
739
|
+
);
|
|
740
|
+
}, [allSelected, selectAllKeys, selectedSet, commitSelection]);
|
|
674
741
|
const clearSelection = useCallback(() => commitSelection([]), [commitSelection]);
|
|
675
742
|
const commitExpanded = useCallback(
|
|
676
743
|
(keys) => {
|
|
@@ -974,6 +1041,7 @@ function DataGridInner({
|
|
|
974
1041
|
size: "sm",
|
|
975
1042
|
color: quickFilter.color,
|
|
976
1043
|
disabled,
|
|
1044
|
+
fullWidth: isCompactToolbar,
|
|
977
1045
|
options: [
|
|
978
1046
|
{ value: QUICK_FILTER_RESET_VALUE, label: quickFilter.allLabel ?? "All" },
|
|
979
1047
|
...quickFilter.options
|
|
@@ -1073,12 +1141,43 @@ function DataGridInner({
|
|
|
1073
1141
|
children: [
|
|
1074
1142
|
showToolbar && /* @__PURE__ */ jsxs("div", { className: "eidos-datagrid-toolbar", children: [
|
|
1075
1143
|
/* @__PURE__ */ jsxs("div", { className: "eidos-datagrid-toolbar-left", children: [
|
|
1076
|
-
|
|
1144
|
+
selectable && isCardView && /* @__PURE__ */ jsx(
|
|
1145
|
+
Checkbox,
|
|
1146
|
+
{
|
|
1147
|
+
size: "sm",
|
|
1148
|
+
checked: allSelected,
|
|
1149
|
+
indeterminate: someSelected,
|
|
1150
|
+
onChange: toggleAll,
|
|
1151
|
+
label: "Select all",
|
|
1152
|
+
"aria-label": "Select all rows"
|
|
1153
|
+
}
|
|
1154
|
+
),
|
|
1155
|
+
showQuickFilters && /* @__PURE__ */ jsx(
|
|
1156
|
+
"div",
|
|
1157
|
+
{
|
|
1158
|
+
className: [
|
|
1159
|
+
"eidos-datagrid-quick-filters",
|
|
1160
|
+
isCompactToolbar && "eidos-datagrid-quick-filters--compact"
|
|
1161
|
+
].filter(Boolean).join(" "),
|
|
1162
|
+
children: quickFilters.map(renderQuickFilter)
|
|
1163
|
+
}
|
|
1164
|
+
),
|
|
1077
1165
|
selectable && hasSelection && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1078
1166
|
/* @__PURE__ */ jsxs("span", { className: "eidos-datagrid-selection-count", children: [
|
|
1079
1167
|
selectedSet.size,
|
|
1080
1168
|
" selected"
|
|
1081
1169
|
] }),
|
|
1170
|
+
canSelectAllMatching && /* @__PURE__ */ jsx(
|
|
1171
|
+
Button,
|
|
1172
|
+
{
|
|
1173
|
+
variant: "text",
|
|
1174
|
+
size: "sm",
|
|
1175
|
+
loading: isSelectingAllMatching,
|
|
1176
|
+
onClick: () => void selectAllMatching(),
|
|
1177
|
+
children: `Select all ${totalItemCount}`
|
|
1178
|
+
}
|
|
1179
|
+
),
|
|
1180
|
+
hasSelectedAllMatching && /* @__PURE__ */ jsx(Button, { variant: "text", size: "sm", color: "secondary", onClick: clearSelection, children: "Clear selection" }),
|
|
1082
1181
|
bulkActions && bulkActions.length > 0 && /* @__PURE__ */ jsx("div", { className: "eidos-datagrid-bulk-actions", children: bulkActions.map((action) => {
|
|
1083
1182
|
const isDisabled = typeof action.disabled === "function" ? action.disabled(selectedItems) : action.disabled ?? false;
|
|
1084
1183
|
if (action.type === "split-button") {
|
|
@@ -1128,17 +1227,7 @@ function DataGridInner({
|
|
|
1128
1227
|
},
|
|
1129
1228
|
action.id
|
|
1130
1229
|
) : null;
|
|
1131
|
-
}) })
|
|
1132
|
-
/* @__PURE__ */ jsx(
|
|
1133
|
-
"button",
|
|
1134
|
-
{
|
|
1135
|
-
type: "button",
|
|
1136
|
-
className: "eidos-datagrid-clear-selection",
|
|
1137
|
-
onClick: clearSelection,
|
|
1138
|
-
"aria-label": "Clear selection",
|
|
1139
|
-
children: /* @__PURE__ */ jsx(X, { size: 14 })
|
|
1140
|
-
}
|
|
1141
|
-
)
|
|
1230
|
+
}) })
|
|
1142
1231
|
] })
|
|
1143
1232
|
] }),
|
|
1144
1233
|
/* @__PURE__ */ jsxs("div", { className: "eidos-datagrid-toolbar-right", children: [
|
|
@@ -1148,7 +1237,7 @@ function DataGridInner({
|
|
|
1148
1237
|
placement: "bottom",
|
|
1149
1238
|
align: "end",
|
|
1150
1239
|
autoWidth: false,
|
|
1151
|
-
trigger: /* @__PURE__ */ jsx(Button, { variant: "text", size: "sm", preIcon: AlignJustify, children: "Density" }),
|
|
1240
|
+
trigger: isCompactToolbar ? /* @__PURE__ */ jsx(Button, { variant: "text", size: "sm", icon: AlignJustify, tooltip: "Density" }) : /* @__PURE__ */ jsx(Button, { variant: "text", size: "sm", preIcon: AlignJustify, children: "Density" }),
|
|
1152
1241
|
content: /* @__PURE__ */ jsx("div", { className: "eidos-table-menu-panel", children: [
|
|
1153
1242
|
{ value: "compact", label: "Compact" },
|
|
1154
1243
|
{ value: "comfortable", label: "Comfortable" },
|
|
@@ -1178,7 +1267,16 @@ function DataGridInner({
|
|
|
1178
1267
|
onFiltersChange: handleFiltersChange
|
|
1179
1268
|
}
|
|
1180
1269
|
),
|
|
1181
|
-
onRowAdd && /* @__PURE__ */ jsx(
|
|
1270
|
+
onRowAdd && (isCompactToolbar ? /* @__PURE__ */ jsx(
|
|
1271
|
+
Button,
|
|
1272
|
+
{
|
|
1273
|
+
variant: "outlined",
|
|
1274
|
+
size: "sm",
|
|
1275
|
+
icon: Plus,
|
|
1276
|
+
tooltip: "Add row",
|
|
1277
|
+
onClick: handleRowAdd
|
|
1278
|
+
}
|
|
1279
|
+
) : /* @__PURE__ */ jsx(Button, { variant: "outlined", size: "sm", preIcon: Plus, onClick: handleRowAdd, children: "Add row" }))
|
|
1182
1280
|
] })
|
|
1183
1281
|
] }),
|
|
1184
1282
|
isCardView ? (
|
|
@@ -1202,51 +1300,58 @@ function DataGridInner({
|
|
|
1202
1300
|
isRowSelected && "eidos-datagrid-card--selected"
|
|
1203
1301
|
].filter(Boolean).join(" "),
|
|
1204
1302
|
children: [
|
|
1205
|
-
/* @__PURE__ */ jsxs(
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
"eidos-datagrid-card-heading
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1303
|
+
hasCardToolbar && /* @__PURE__ */ jsxs(
|
|
1304
|
+
"div",
|
|
1305
|
+
{
|
|
1306
|
+
className: "eidos-datagrid-card-toolbar",
|
|
1307
|
+
onClick: (e) => e.stopPropagation(),
|
|
1308
|
+
children: [
|
|
1309
|
+
/* @__PURE__ */ jsxs("div", { className: "eidos-datagrid-card-toolbar-left", children: [
|
|
1310
|
+
expandable && canExpandRow && /* @__PURE__ */ jsx(
|
|
1311
|
+
"button",
|
|
1312
|
+
{
|
|
1313
|
+
type: "button",
|
|
1314
|
+
className: [
|
|
1315
|
+
"eidos-datagrid-expand-toggle",
|
|
1316
|
+
isRowExpanded && "eidos-datagrid-expand-toggle--open"
|
|
1317
|
+
].filter(Boolean).join(" "),
|
|
1318
|
+
onClick: () => toggleExpanded(rowKeyValue),
|
|
1319
|
+
"aria-expanded": isRowExpanded,
|
|
1320
|
+
"aria-label": isRowExpanded ? "Collapse row" : "Expand row",
|
|
1321
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
|
|
1322
|
+
}
|
|
1323
|
+
),
|
|
1324
|
+
selectable && /* @__PURE__ */ jsx(
|
|
1325
|
+
Checkbox,
|
|
1326
|
+
{
|
|
1327
|
+
checked: isRowSelected,
|
|
1328
|
+
onChange: () => toggleRow(rowKeyValue),
|
|
1329
|
+
size: "sm"
|
|
1330
|
+
}
|
|
1331
|
+
),
|
|
1332
|
+
showRowNumbers && /* @__PURE__ */ jsxs("span", { className: "eidos-datagrid-card-row-number", children: [
|
|
1333
|
+
"#",
|
|
1334
|
+
localIndex + 1
|
|
1335
|
+
] })
|
|
1336
|
+
] }),
|
|
1337
|
+
/* @__PURE__ */ jsxs("div", { className: "eidos-datagrid-card-heading", children: [
|
|
1338
|
+
cardHeaderColumn && renderCardValue(
|
|
1339
|
+
cardHeaderColumn,
|
|
1340
|
+
row,
|
|
1341
|
+
localIndex,
|
|
1342
|
+
"eidos-datagrid-card-heading-title"
|
|
1343
|
+
),
|
|
1344
|
+
cardSubheaderColumn && renderCardValue(
|
|
1345
|
+
cardSubheaderColumn,
|
|
1346
|
+
row,
|
|
1347
|
+
localIndex,
|
|
1348
|
+
"eidos-datagrid-card-heading-subtitle"
|
|
1349
|
+
)
|
|
1350
|
+
] }),
|
|
1351
|
+
/* @__PURE__ */ jsx("div", { className: "eidos-datagrid-card-toolbar-right", children: renderActionsMenu(row, localIndex) })
|
|
1352
|
+
]
|
|
1353
|
+
}
|
|
1354
|
+
),
|
|
1250
1355
|
/* @__PURE__ */ jsx("div", { className: "eidos-datagrid-card-fields", children: cardFieldColumns.map((col) => renderCardField(col, row, localIndex)) }),
|
|
1251
1356
|
expandable && renderExpandedContent && /* @__PURE__ */ jsx(
|
|
1252
1357
|
ExpandedCardPanel,
|
|
@@ -1613,4 +1718,4 @@ var DataGrid = Object.assign(DataGridInner, { displayName: "DataGrid" });
|
|
|
1613
1718
|
export {
|
|
1614
1719
|
DataGrid
|
|
1615
1720
|
};
|
|
1616
|
-
//# sourceMappingURL=chunk-
|
|
1721
|
+
//# sourceMappingURL=chunk-RKA2OJRT.js.map
|