@dmsi/wedgekit-react 0.0.213 → 0.0.215
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-BHFIS4ZV.js → chunk-2WRRRPEB.js} +1 -1
- package/dist/{chunk-HKSYYK4K.js → chunk-33W2KSCB.js} +1 -1
- package/dist/{chunk-LQW4LMNB.js → chunk-CZ55LUFC.js} +14 -14
- package/dist/components/DataGridCell.cjs +10 -10
- package/dist/components/DataGridCell.js +6 -6
- package/dist/components/DateInput.js +7 -7
- package/dist/components/DateRangeInput.js +7 -7
- package/dist/components/FilterGroup.js +7 -7
- package/dist/components/Input.js +2 -2
- package/dist/components/MenuOption.js +2 -2
- package/dist/components/MobileDataGrid.js +3 -3
- package/dist/components/Modal.js +1 -1
- package/dist/components/NestedMenu.js +2 -2
- package/dist/components/Notification.js +3 -3
- package/dist/components/PDFViewer.js +3 -3
- package/dist/components/Password.js +2 -2
- package/dist/components/Search.js +3 -3
- package/dist/components/Select.js +3 -3
- package/dist/components/Stepper.js +2 -2
- package/dist/components/Time.js +4 -4
- package/dist/components/Toast.js +3 -3
- package/dist/components/Upload.js +3 -3
- package/dist/components/index.cjs +51 -28
- package/dist/components/index.css +3 -0
- package/dist/components/index.js +60 -37
- package/dist/index.css +3 -0
- package/package.json +1 -1
- package/src/components/DataGrid/PinnedColumns.tsx +1 -1
- package/src/components/DataGrid/TableBody/TableBodyRow.tsx +16 -6
- package/src/components/DataGrid/index.tsx +42 -12
- package/src/components/DataGrid/types.ts +2 -0
- package/src/components/DataGridCell.tsx +10 -13
- package/dist/{chunk-GW7OVMMC.js → chunk-7W4I2NK3.js} +3 -3
- package/dist/{chunk-TPZ6752P.js → chunk-ERW3AMED.js} +3 -3
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "./chunk-NIHZMIOL.js";
|
|
7
7
|
import {
|
|
8
8
|
MenuOption
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ERW3AMED.js";
|
|
10
|
+
import {
|
|
11
|
+
Search
|
|
12
|
+
} from "./chunk-2WRRRPEB.js";
|
|
10
13
|
import {
|
|
11
14
|
CSS
|
|
12
15
|
} from "./chunk-WVUIIBRR.js";
|
|
13
|
-
import {
|
|
14
|
-
Search
|
|
15
|
-
} from "./chunk-BHFIS4ZV.js";
|
|
16
16
|
import {
|
|
17
17
|
Icon
|
|
18
18
|
} from "./chunk-UAPWR2KE.js";
|
|
@@ -194,6 +194,8 @@ function DataCellHeader(_a) {
|
|
|
194
194
|
);
|
|
195
195
|
const ref = useRef(null);
|
|
196
196
|
const predeterminedPinned = useRef(false);
|
|
197
|
+
const { column, getContext } = header;
|
|
198
|
+
const { id: columnId, setFilterValue } = column;
|
|
197
199
|
const {
|
|
198
200
|
menuRootRef,
|
|
199
201
|
isMenuActive,
|
|
@@ -202,22 +204,20 @@ function DataCellHeader(_a) {
|
|
|
202
204
|
mobileHide
|
|
203
205
|
} = useSubMenuSystem(node ? node : ref);
|
|
204
206
|
useEffect(() => {
|
|
205
|
-
var _a3;
|
|
206
|
-
const columnPinning = (_a3 =
|
|
207
|
-
const left = (columnPinning == null ? void 0 : columnPinning.left) ?
|
|
208
|
-
const right = (columnPinning == null ? void 0 : columnPinning.right) ?
|
|
209
|
-
predeterminedPinned.current = [...left, ...right].includes(
|
|
210
|
-
|
|
211
|
-
);
|
|
212
|
-
}, []);
|
|
207
|
+
var _a3, _b2, _c;
|
|
208
|
+
const columnPinning = (_a3 = getContext().table.options.initialState) == null ? void 0 : _a3.columnPinning;
|
|
209
|
+
const left = (_b2 = columnPinning == null ? void 0 : columnPinning.left) != null ? _b2 : [];
|
|
210
|
+
const right = (_c = columnPinning == null ? void 0 : columnPinning.right) != null ? _c : [];
|
|
211
|
+
predeterminedPinned.current = [...left, ...right].includes(columnId);
|
|
212
|
+
}, [columnId, getContext]);
|
|
213
213
|
useEffect(() => {
|
|
214
214
|
const handler = setTimeout(() => {
|
|
215
|
-
|
|
215
|
+
setFilterValue(filter);
|
|
216
216
|
}, 500);
|
|
217
217
|
return () => {
|
|
218
218
|
clearTimeout(handler);
|
|
219
219
|
};
|
|
220
|
-
}, [filter]);
|
|
220
|
+
}, [filter, setFilterValue]);
|
|
221
221
|
const style = __spreadValues({
|
|
222
222
|
position: "relative",
|
|
223
223
|
whiteSpace: "nowrap",
|
|
@@ -1904,6 +1904,8 @@ function DataCellHeader(_a) {
|
|
|
1904
1904
|
);
|
|
1905
1905
|
const ref = (0, import_react11.useRef)(null);
|
|
1906
1906
|
const predeterminedPinned = (0, import_react11.useRef)(false);
|
|
1907
|
+
const { column, getContext } = header;
|
|
1908
|
+
const { id: columnId, setFilterValue } = column;
|
|
1907
1909
|
const {
|
|
1908
1910
|
menuRootRef,
|
|
1909
1911
|
isMenuActive,
|
|
@@ -1912,22 +1914,20 @@ function DataCellHeader(_a) {
|
|
|
1912
1914
|
mobileHide
|
|
1913
1915
|
} = useSubMenuSystem(node ? node : ref);
|
|
1914
1916
|
(0, import_react11.useEffect)(() => {
|
|
1915
|
-
var _a3;
|
|
1916
|
-
const columnPinning = (_a3 =
|
|
1917
|
-
const left = (columnPinning == null ? void 0 : columnPinning.left) ?
|
|
1918
|
-
const right = (columnPinning == null ? void 0 : columnPinning.right) ?
|
|
1919
|
-
predeterminedPinned.current = [...left, ...right].includes(
|
|
1920
|
-
|
|
1921
|
-
);
|
|
1922
|
-
}, []);
|
|
1917
|
+
var _a3, _b2, _c;
|
|
1918
|
+
const columnPinning = (_a3 = getContext().table.options.initialState) == null ? void 0 : _a3.columnPinning;
|
|
1919
|
+
const left = (_b2 = columnPinning == null ? void 0 : columnPinning.left) != null ? _b2 : [];
|
|
1920
|
+
const right = (_c = columnPinning == null ? void 0 : columnPinning.right) != null ? _c : [];
|
|
1921
|
+
predeterminedPinned.current = [...left, ...right].includes(columnId);
|
|
1922
|
+
}, [columnId, getContext]);
|
|
1923
1923
|
(0, import_react11.useEffect)(() => {
|
|
1924
1924
|
const handler = setTimeout(() => {
|
|
1925
|
-
|
|
1925
|
+
setFilterValue(filter);
|
|
1926
1926
|
}, 500);
|
|
1927
1927
|
return () => {
|
|
1928
1928
|
clearTimeout(handler);
|
|
1929
1929
|
};
|
|
1930
|
-
}, [filter]);
|
|
1930
|
+
}, [filter, setFilterValue]);
|
|
1931
1931
|
const style = __spreadValues({
|
|
1932
1932
|
position: "relative",
|
|
1933
1933
|
whiteSpace: "nowrap",
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
DataGridCell,
|
|
5
5
|
DragAlongCell,
|
|
6
6
|
DraggableCellHeader
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-CZ55LUFC.js";
|
|
8
8
|
import "../chunk-JITZWSPR.js";
|
|
9
9
|
import "../chunk-NIHZMIOL.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-WVUIIBRR.js";
|
|
12
|
-
import "../chunk-BHFIS4ZV.js";
|
|
13
|
-
import "../chunk-GW7OVMMC.js";
|
|
14
|
-
import "../chunk-CJVTFYI4.js";
|
|
10
|
+
import "../chunk-ERW3AMED.js";
|
|
15
11
|
import "../chunk-E6Y7ZHQX.js";
|
|
16
12
|
import "../chunk-VXWSAIB5.js";
|
|
17
13
|
import "../chunk-T3F37S6Z.js";
|
|
14
|
+
import "../chunk-2WRRRPEB.js";
|
|
15
|
+
import "../chunk-7W4I2NK3.js";
|
|
18
16
|
import "../chunk-5UH6QUFB.js";
|
|
17
|
+
import "../chunk-CJVTFYI4.js";
|
|
18
|
+
import "../chunk-WVUIIBRR.js";
|
|
19
19
|
import "../chunk-CJELWEO2.js";
|
|
20
20
|
import "../chunk-UAPWR2KE.js";
|
|
21
21
|
import "../chunk-RDLEIAQU.js";
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InputBase
|
|
3
|
-
} from "../chunk-GW7OVMMC.js";
|
|
4
|
-
import "../chunk-CJVTFYI4.js";
|
|
5
|
-
import {
|
|
6
|
-
CalendarRange
|
|
7
|
-
} from "../chunk-SE5DM2IJ.js";
|
|
8
1
|
import {
|
|
9
2
|
findDocumentRoot
|
|
10
3
|
} from "../chunk-VXWSAIB5.js";
|
|
@@ -15,7 +8,14 @@ import {
|
|
|
15
8
|
isValidDate,
|
|
16
9
|
parseInputDate
|
|
17
10
|
} from "../chunk-T3F37S6Z.js";
|
|
11
|
+
import {
|
|
12
|
+
InputBase
|
|
13
|
+
} from "../chunk-7W4I2NK3.js";
|
|
18
14
|
import "../chunk-5UH6QUFB.js";
|
|
15
|
+
import "../chunk-CJVTFYI4.js";
|
|
16
|
+
import {
|
|
17
|
+
CalendarRange
|
|
18
|
+
} from "../chunk-SE5DM2IJ.js";
|
|
19
19
|
import {
|
|
20
20
|
Icon
|
|
21
21
|
} from "../chunk-UAPWR2KE.js";
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InputBase
|
|
3
|
-
} from "../chunk-GW7OVMMC.js";
|
|
4
|
-
import "../chunk-CJVTFYI4.js";
|
|
5
|
-
import {
|
|
6
|
-
CalendarRange
|
|
7
|
-
} from "../chunk-SE5DM2IJ.js";
|
|
8
1
|
import {
|
|
9
2
|
findDocumentRoot
|
|
10
3
|
} from "../chunk-VXWSAIB5.js";
|
|
@@ -16,7 +9,14 @@ import {
|
|
|
16
9
|
isValidDateRangeOrder,
|
|
17
10
|
parseInputDate
|
|
18
11
|
} from "../chunk-T3F37S6Z.js";
|
|
12
|
+
import {
|
|
13
|
+
InputBase
|
|
14
|
+
} from "../chunk-7W4I2NK3.js";
|
|
19
15
|
import "../chunk-5UH6QUFB.js";
|
|
16
|
+
import "../chunk-CJVTFYI4.js";
|
|
17
|
+
import {
|
|
18
|
+
CalendarRange
|
|
19
|
+
} from "../chunk-SE5DM2IJ.js";
|
|
20
20
|
import {
|
|
21
21
|
Icon
|
|
22
22
|
} from "../chunk-UAPWR2KE.js";
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
import {
|
|
3
3
|
OptionPill
|
|
4
4
|
} from "../chunk-ED7FXZRX.js";
|
|
5
|
+
import {
|
|
6
|
+
Checkbox
|
|
7
|
+
} from "../chunk-E3UOI2D2.js";
|
|
5
8
|
import {
|
|
6
9
|
Search
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-2WRRRPEB.js";
|
|
11
|
+
import "../chunk-7W4I2NK3.js";
|
|
12
|
+
import "../chunk-5UH6QUFB.js";
|
|
9
13
|
import {
|
|
10
14
|
Label
|
|
11
15
|
} from "../chunk-CJVTFYI4.js";
|
|
12
|
-
import {
|
|
13
|
-
Checkbox
|
|
14
|
-
} from "../chunk-E3UOI2D2.js";
|
|
15
|
-
import "../chunk-SK742QNF.js";
|
|
16
|
-
import "../chunk-5UH6QUFB.js";
|
|
17
16
|
import "../chunk-CJELWEO2.js";
|
|
18
17
|
import {
|
|
19
18
|
Link
|
|
20
19
|
} from "../chunk-XQILVD56.js";
|
|
20
|
+
import "../chunk-SK742QNF.js";
|
|
21
21
|
import {
|
|
22
22
|
Icon
|
|
23
23
|
} from "../chunk-UAPWR2KE.js";
|
package/dist/components/Input.js
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
InputBase,
|
|
7
7
|
Percentage,
|
|
8
8
|
UOM
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-CJVTFYI4.js";
|
|
9
|
+
} from "../chunk-7W4I2NK3.js";
|
|
11
10
|
import "../chunk-5UH6QUFB.js";
|
|
11
|
+
import "../chunk-CJVTFYI4.js";
|
|
12
12
|
import "../chunk-UAPWR2KE.js";
|
|
13
13
|
import "../chunk-RDLEIAQU.js";
|
|
14
14
|
import "../chunk-BBZEL7EG.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
MenuOption
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-CJVTFYI4.js";
|
|
4
|
+
} from "../chunk-ERW3AMED.js";
|
|
6
5
|
import "../chunk-E6Y7ZHQX.js";
|
|
7
6
|
import "../chunk-VXWSAIB5.js";
|
|
8
7
|
import "../chunk-T3F37S6Z.js";
|
|
9
8
|
import "../chunk-5UH6QUFB.js";
|
|
9
|
+
import "../chunk-CJVTFYI4.js";
|
|
10
10
|
import "../chunk-CJELWEO2.js";
|
|
11
11
|
import "../chunk-UAPWR2KE.js";
|
|
12
12
|
import "../chunk-RDLEIAQU.js";
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
Heading3
|
|
6
6
|
} from "../chunk-REOLWEZG.js";
|
|
7
|
-
import {
|
|
8
|
-
Button
|
|
9
|
-
} from "../chunk-SK742QNF.js";
|
|
10
7
|
import {
|
|
11
8
|
Stack
|
|
12
9
|
} from "../chunk-BOWQUDUU.js";
|
|
13
10
|
import {
|
|
14
11
|
Paragraph
|
|
15
12
|
} from "../chunk-CJELWEO2.js";
|
|
13
|
+
import {
|
|
14
|
+
Button
|
|
15
|
+
} from "../chunk-SK742QNF.js";
|
|
16
16
|
import {
|
|
17
17
|
Icon
|
|
18
18
|
} from "../chunk-UAPWR2KE.js";
|
package/dist/components/Modal.js
CHANGED
|
@@ -8,11 +8,11 @@ import "../chunk-SYEJVSE4.js";
|
|
|
8
8
|
import "../chunk-A5ROZWIH.js";
|
|
9
9
|
import "../chunk-ZFOANBWG.js";
|
|
10
10
|
import "../chunk-REOLWEZG.js";
|
|
11
|
-
import "../chunk-SK742QNF.js";
|
|
12
11
|
import "../chunk-E6Y7ZHQX.js";
|
|
13
12
|
import "../chunk-VXWSAIB5.js";
|
|
14
13
|
import "../chunk-T3F37S6Z.js";
|
|
15
14
|
import "../chunk-5UH6QUFB.js";
|
|
15
|
+
import "../chunk-SK742QNF.js";
|
|
16
16
|
import "../chunk-UAPWR2KE.js";
|
|
17
17
|
import "../chunk-RDLEIAQU.js";
|
|
18
18
|
import "../chunk-BBZEL7EG.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
MenuOption
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-CJVTFYI4.js";
|
|
4
|
+
} from "../chunk-ERW3AMED.js";
|
|
6
5
|
import {
|
|
7
6
|
useKeydown
|
|
8
7
|
} from "../chunk-E6Y7ZHQX.js";
|
|
9
8
|
import "../chunk-VXWSAIB5.js";
|
|
10
9
|
import "../chunk-T3F37S6Z.js";
|
|
11
10
|
import "../chunk-5UH6QUFB.js";
|
|
11
|
+
import "../chunk-CJVTFYI4.js";
|
|
12
12
|
import "../chunk-CJELWEO2.js";
|
|
13
13
|
import {
|
|
14
14
|
Icon
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Heading3
|
|
4
4
|
} from "../chunk-REOLWEZG.js";
|
|
5
|
-
import {
|
|
6
|
-
Button
|
|
7
|
-
} from "../chunk-SK742QNF.js";
|
|
8
5
|
import {
|
|
9
6
|
Stack
|
|
10
7
|
} from "../chunk-BOWQUDUU.js";
|
|
11
8
|
import {
|
|
12
9
|
Paragraph
|
|
13
10
|
} from "../chunk-CJELWEO2.js";
|
|
11
|
+
import {
|
|
12
|
+
Button
|
|
13
|
+
} from "../chunk-SK742QNF.js";
|
|
14
14
|
import {
|
|
15
15
|
Icon
|
|
16
16
|
} from "../chunk-UAPWR2KE.js";
|
|
@@ -13,9 +13,6 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
Heading3
|
|
15
15
|
} from "../chunk-REOLWEZG.js";
|
|
16
|
-
import {
|
|
17
|
-
Button
|
|
18
|
-
} from "../chunk-SK742QNF.js";
|
|
19
16
|
import "../chunk-E6Y7ZHQX.js";
|
|
20
17
|
import "../chunk-VXWSAIB5.js";
|
|
21
18
|
import "../chunk-T3F37S6Z.js";
|
|
@@ -26,6 +23,9 @@ import {
|
|
|
26
23
|
import {
|
|
27
24
|
Paragraph
|
|
28
25
|
} from "../chunk-CJELWEO2.js";
|
|
26
|
+
import {
|
|
27
|
+
Button
|
|
28
|
+
} from "../chunk-SK742QNF.js";
|
|
29
29
|
import {
|
|
30
30
|
Icon
|
|
31
31
|
} from "../chunk-UAPWR2KE.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Search
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-CJVTFYI4.js";
|
|
4
|
+
} from "../chunk-2WRRRPEB.js";
|
|
5
|
+
import "../chunk-7W4I2NK3.js";
|
|
7
6
|
import "../chunk-5UH6QUFB.js";
|
|
7
|
+
import "../chunk-CJVTFYI4.js";
|
|
8
8
|
import "../chunk-UAPWR2KE.js";
|
|
9
9
|
import "../chunk-RDLEIAQU.js";
|
|
10
10
|
import "../chunk-BBZEL7EG.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Select
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-CJVTFYI4.js";
|
|
4
|
+
} from "../chunk-33W2KSCB.js";
|
|
5
|
+
import "../chunk-7W4I2NK3.js";
|
|
7
6
|
import "../chunk-5UH6QUFB.js";
|
|
7
|
+
import "../chunk-CJVTFYI4.js";
|
|
8
8
|
import "../chunk-UAPWR2KE.js";
|
|
9
9
|
import "../chunk-RDLEIAQU.js";
|
|
10
10
|
import "../chunk-BBZEL7EG.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
InputBase
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-7W4I2NK3.js";
|
|
5
|
+
import "../chunk-5UH6QUFB.js";
|
|
5
6
|
import "../chunk-CJVTFYI4.js";
|
|
6
7
|
import {
|
|
7
8
|
Button
|
|
8
9
|
} from "../chunk-SK742QNF.js";
|
|
9
|
-
import "../chunk-5UH6QUFB.js";
|
|
10
10
|
import {
|
|
11
11
|
Icon
|
|
12
12
|
} from "../chunk-UAPWR2KE.js";
|
package/dist/components/Time.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InputBase
|
|
3
|
-
} from "../chunk-GW7OVMMC.js";
|
|
4
|
-
import "../chunk-CJVTFYI4.js";
|
|
5
1
|
import {
|
|
6
2
|
findDocumentRoot
|
|
7
3
|
} from "../chunk-VXWSAIB5.js";
|
|
8
4
|
import "../chunk-T3F37S6Z.js";
|
|
5
|
+
import {
|
|
6
|
+
InputBase
|
|
7
|
+
} from "../chunk-7W4I2NK3.js";
|
|
9
8
|
import "../chunk-5UH6QUFB.js";
|
|
9
|
+
import "../chunk-CJVTFYI4.js";
|
|
10
10
|
import {
|
|
11
11
|
Stack
|
|
12
12
|
} from "../chunk-BOWQUDUU.js";
|
package/dist/components/Toast.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Heading3
|
|
4
4
|
} from "../chunk-REOLWEZG.js";
|
|
5
|
-
import {
|
|
6
|
-
Button
|
|
7
|
-
} from "../chunk-SK742QNF.js";
|
|
8
5
|
import {
|
|
9
6
|
Paragraph
|
|
10
7
|
} from "../chunk-CJELWEO2.js";
|
|
8
|
+
import {
|
|
9
|
+
Button
|
|
10
|
+
} from "../chunk-SK742QNF.js";
|
|
11
11
|
import {
|
|
12
12
|
Icon
|
|
13
13
|
} from "../chunk-UAPWR2KE.js";
|
|
@@ -1991,6 +1991,8 @@ function DataCellHeader(_a) {
|
|
|
1991
1991
|
);
|
|
1992
1992
|
const ref = (0, import_react11.useRef)(null);
|
|
1993
1993
|
const predeterminedPinned = (0, import_react11.useRef)(false);
|
|
1994
|
+
const { column, getContext } = header;
|
|
1995
|
+
const { id: columnId, setFilterValue } = column;
|
|
1994
1996
|
const {
|
|
1995
1997
|
menuRootRef,
|
|
1996
1998
|
isMenuActive,
|
|
@@ -1999,22 +2001,20 @@ function DataCellHeader(_a) {
|
|
|
1999
2001
|
mobileHide
|
|
2000
2002
|
} = useSubMenuSystem(node ? node : ref);
|
|
2001
2003
|
(0, import_react11.useEffect)(() => {
|
|
2002
|
-
var _a3;
|
|
2003
|
-
const columnPinning = (_a3 =
|
|
2004
|
-
const left = (columnPinning == null ? void 0 : columnPinning.left) ?
|
|
2005
|
-
const right = (columnPinning == null ? void 0 : columnPinning.right) ?
|
|
2006
|
-
predeterminedPinned.current = [...left, ...right].includes(
|
|
2007
|
-
|
|
2008
|
-
);
|
|
2009
|
-
}, []);
|
|
2004
|
+
var _a3, _b2, _c;
|
|
2005
|
+
const columnPinning = (_a3 = getContext().table.options.initialState) == null ? void 0 : _a3.columnPinning;
|
|
2006
|
+
const left = (_b2 = columnPinning == null ? void 0 : columnPinning.left) != null ? _b2 : [];
|
|
2007
|
+
const right = (_c = columnPinning == null ? void 0 : columnPinning.right) != null ? _c : [];
|
|
2008
|
+
predeterminedPinned.current = [...left, ...right].includes(columnId);
|
|
2009
|
+
}, [columnId, getContext]);
|
|
2010
2010
|
(0, import_react11.useEffect)(() => {
|
|
2011
2011
|
const handler = setTimeout(() => {
|
|
2012
|
-
|
|
2012
|
+
setFilterValue(filter);
|
|
2013
2013
|
}, 500);
|
|
2014
2014
|
return () => {
|
|
2015
2015
|
clearTimeout(handler);
|
|
2016
2016
|
};
|
|
2017
|
-
}, [filter]);
|
|
2017
|
+
}, [filter, setFilterValue]);
|
|
2018
2018
|
const style = __spreadValues({
|
|
2019
2019
|
position: "relative",
|
|
2020
2020
|
whiteSpace: "nowrap",
|
|
@@ -2338,6 +2338,7 @@ function TableBodyRow({
|
|
|
2338
2338
|
"tr",
|
|
2339
2339
|
{
|
|
2340
2340
|
className: (0, import_clsx10.default)(
|
|
2341
|
+
"min-h-10",
|
|
2341
2342
|
"transition-colors hover:bg-background-action-secondary-hover",
|
|
2342
2343
|
row.getIsSelected() && "!bg-background-action-secondary-hover",
|
|
2343
2344
|
isError && "!bg-background-action-critical-secondary-hover",
|
|
@@ -2357,21 +2358,28 @@ function TableBodyRow({
|
|
|
2357
2358
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { style: { display: "flex", width: virtualPaddingLeft } })
|
|
2358
2359
|
) : null,
|
|
2359
2360
|
columns.map((column) => {
|
|
2360
|
-
var _a2;
|
|
2361
|
+
var _a2, _b, _c, _d;
|
|
2361
2362
|
const cell = locked ? column : visibleCells[column.index];
|
|
2362
2363
|
if (!cell) {
|
|
2363
2364
|
return;
|
|
2364
2365
|
}
|
|
2366
|
+
const cellAlignment = (_a2 = cell.column.columnDef.meta) == null ? void 0 : _a2.align;
|
|
2365
2367
|
const cellValue = cell.getValue();
|
|
2366
|
-
return ((
|
|
2368
|
+
return ((_b = cell.column.columnDef.meta) == null ? void 0 : _b.useCustomRenderer) ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react12.default.Fragment, { children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2367
2369
|
CellElement,
|
|
2368
2370
|
{
|
|
2369
2371
|
id: id ? `${id}-row-${row.id}-cell-${cell.id}` : void 0,
|
|
2370
2372
|
testid: testid ? `${testid}-row-${row.id}-cell-${cell.id}` : void 0,
|
|
2371
2373
|
cell,
|
|
2372
|
-
className: (0, import_clsx10.default)(
|
|
2373
|
-
|
|
2374
|
-
|
|
2374
|
+
className: (0, import_clsx10.default)(
|
|
2375
|
+
cellAlignment ? {
|
|
2376
|
+
"justify-start": cellAlignment === "left",
|
|
2377
|
+
"justify-end": cellAlignment === "right"
|
|
2378
|
+
} : {
|
|
2379
|
+
"justify-end": typeof cellValue === "number"
|
|
2380
|
+
}
|
|
2381
|
+
),
|
|
2382
|
+
width: (_d = (_c = cell.column.columnDef.meta) == null ? void 0 : _c.headerWidth) != null ? _d : `${cell.column.getSize()}px`,
|
|
2375
2383
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2376
2384
|
Tooltip,
|
|
2377
2385
|
{
|
|
@@ -2810,7 +2818,7 @@ function PinnedColumns(_a) {
|
|
|
2810
2818
|
testid: pinnedTestId
|
|
2811
2819
|
}, props), {
|
|
2812
2820
|
table,
|
|
2813
|
-
locked:
|
|
2821
|
+
locked: !enableColumnSelector,
|
|
2814
2822
|
pinDirection
|
|
2815
2823
|
})
|
|
2816
2824
|
)
|
|
@@ -2828,6 +2836,7 @@ var PAGE_SIZE_OPTIONS = [5, 10, 15, 20, 25, 30, 35];
|
|
|
2828
2836
|
var NO_RESULTS_HEIGHT = "h-[185px]";
|
|
2829
2837
|
function DataGrid({
|
|
2830
2838
|
id,
|
|
2839
|
+
rowIdAccessor,
|
|
2831
2840
|
testid,
|
|
2832
2841
|
data,
|
|
2833
2842
|
columns,
|
|
@@ -2888,11 +2897,21 @@ function DataGrid({
|
|
|
2888
2897
|
const value = typeof updaterOrValue === "function" ? updaterOrValue(externalColumnFilters != null ? externalColumnFilters : []) : updaterOrValue;
|
|
2889
2898
|
(onColumnFiltersChange != null ? onColumnFiltersChange : setLocalColumnFilters)(value);
|
|
2890
2899
|
} : setLocalColumnFilters;
|
|
2891
|
-
const rowSelection =
|
|
2892
|
-
const setRowSelection =
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2900
|
+
const rowSelection = externalRowSelection != null ? externalRowSelection : localRowSelection;
|
|
2901
|
+
const setRowSelection = (0, import_react16.useCallback)(
|
|
2902
|
+
(updaterOrValue) => {
|
|
2903
|
+
if (pagination) {
|
|
2904
|
+
const value = typeof updaterOrValue === "function" ? updaterOrValue(externalRowSelection != null ? externalRowSelection : {}) : updaterOrValue;
|
|
2905
|
+
(onRowSelectionChange != null ? onRowSelectionChange : setLocalRowSelection)(value);
|
|
2906
|
+
} else if (externalRowSelection && onRowSelectionChange) {
|
|
2907
|
+
const value = typeof updaterOrValue === "function" ? updaterOrValue(externalRowSelection != null ? externalRowSelection : {}) : updaterOrValue;
|
|
2908
|
+
onRowSelectionChange(value);
|
|
2909
|
+
} else {
|
|
2910
|
+
setLocalRowSelection(updaterOrValue);
|
|
2911
|
+
}
|
|
2912
|
+
},
|
|
2913
|
+
[externalRowSelection, onRowSelectionChange, pagination]
|
|
2914
|
+
);
|
|
2896
2915
|
const dndId = (0, import_react16.useId)();
|
|
2897
2916
|
const containerRef = import_react16.default.useRef(null);
|
|
2898
2917
|
const toggleColumnVisibility = (0, import_react16.useCallback)(
|
|
@@ -2926,7 +2945,7 @@ function DataGrid({
|
|
|
2926
2945
|
getSortedRowModel: (0, import_react_table3.getSortedRowModel)(),
|
|
2927
2946
|
getFilteredRowModel: (0, import_react_table3.getFilteredRowModel)(),
|
|
2928
2947
|
columnResizeMode: "onChange",
|
|
2929
|
-
getRowId: (row, index) => {
|
|
2948
|
+
getRowId: rowIdAccessor ? (row) => String(row[rowIdAccessor]) : (row, index) => {
|
|
2930
2949
|
var _a2;
|
|
2931
2950
|
return String((_a2 = row.id) != null ? _a2 : index + 1);
|
|
2932
2951
|
},
|
|
@@ -3095,38 +3114,42 @@ function DataGrid({
|
|
|
3095
3114
|
)
|
|
3096
3115
|
) : null,
|
|
3097
3116
|
virtualColumns.map((virtualColumn) => {
|
|
3098
|
-
var _a2, _b2, _c2;
|
|
3117
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
3099
3118
|
const header = headerGroup.headers[virtualColumn.index];
|
|
3100
3119
|
if (!header) {
|
|
3101
3120
|
return;
|
|
3102
3121
|
}
|
|
3103
3122
|
if (typeof header.column.columnDef.header === "string") {
|
|
3104
3123
|
const cellValue = (_a2 = table.getRowModel().rows[0]) == null ? void 0 : _a2.getValue(header.column.id);
|
|
3124
|
+
const cellAlignment = ((_c2 = (_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.align) != null ? _c2 : cellValue === "number") ? "right" : "left";
|
|
3105
3125
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3106
3126
|
DraggableCellHeader,
|
|
3107
3127
|
{
|
|
3108
3128
|
id: id ? `${id}-header-${header.id}` : void 0,
|
|
3109
3129
|
testid: testid ? `${testid}-header-${header.id}` : void 0,
|
|
3110
3130
|
header,
|
|
3111
|
-
locked: (
|
|
3131
|
+
locked: (_d2 = header.column.columnDef.meta) == null ? void 0 : _d2.locked,
|
|
3112
3132
|
center: centerHeader,
|
|
3113
3133
|
className: (0, import_clsx13.default)(
|
|
3114
3134
|
header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
|
|
3115
3135
|
"group",
|
|
3116
|
-
{
|
|
3136
|
+
cellAlignment ? {
|
|
3137
|
+
"justify-start": cellAlignment === "left",
|
|
3138
|
+
"justify-end": cellAlignment === "right"
|
|
3139
|
+
} : {
|
|
3117
3140
|
"justify-end": typeof cellValue === "number"
|
|
3118
3141
|
}
|
|
3119
3142
|
),
|
|
3120
3143
|
useMenuDefaultMinWidth,
|
|
3121
3144
|
children: [
|
|
3122
|
-
|
|
3145
|
+
cellAlignment === "left" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Subheader, { tall: true, children: header.column.columnDef.header }),
|
|
3123
3146
|
getSortIcon(header.column.getIsSorted()),
|
|
3124
3147
|
!header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
|
|
3125
3148
|
header.column.getNextSortingOrder(),
|
|
3126
3149
|
true
|
|
3127
3150
|
),
|
|
3128
3151
|
header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
|
|
3129
|
-
|
|
3152
|
+
cellAlignment === "right" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Subheader, { tall: true, children: header.column.columnDef.header }),
|
|
3130
3153
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3131
3154
|
"div",
|
|
3132
3155
|
{
|
|
@@ -3150,7 +3173,7 @@ function DataGrid({
|
|
|
3150
3173
|
header.id
|
|
3151
3174
|
);
|
|
3152
3175
|
}
|
|
3153
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react16.default.Fragment, { children: ((
|
|
3176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react16.default.Fragment, { children: ((_e2 = header.column.columnDef.meta) == null ? void 0 : _e2.checkbox) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3154
3177
|
DataGridCell,
|
|
3155
3178
|
{
|
|
3156
3179
|
id: id ? `${id}-header-${header.id}` : void 0,
|
package/dist/components/index.js
CHANGED
|
@@ -3,43 +3,40 @@ import {
|
|
|
3
3
|
} from "../chunk-3WNXMCZV.js";
|
|
4
4
|
import {
|
|
5
5
|
Select
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-33W2KSCB.js";
|
|
7
|
+
import {
|
|
8
|
+
Checkbox
|
|
9
|
+
} from "../chunk-E3UOI2D2.js";
|
|
7
10
|
import {
|
|
8
11
|
DataCellHeader,
|
|
9
12
|
DataGridCell,
|
|
10
13
|
DragAlongCell,
|
|
11
14
|
DraggableCellHeader
|
|
12
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-CZ55LUFC.js";
|
|
13
16
|
import {
|
|
14
17
|
Menu
|
|
15
18
|
} from "../chunk-JITZWSPR.js";
|
|
16
19
|
import "../chunk-NIHZMIOL.js";
|
|
17
20
|
import {
|
|
18
21
|
MenuOption
|
|
19
|
-
} from "../chunk-
|
|
20
|
-
import "../chunk-WVUIIBRR.js";
|
|
21
|
-
import {
|
|
22
|
-
Search
|
|
23
|
-
} from "../chunk-BHFIS4ZV.js";
|
|
24
|
-
import {
|
|
25
|
-
Input
|
|
26
|
-
} from "../chunk-GW7OVMMC.js";
|
|
27
|
-
import {
|
|
28
|
-
Label
|
|
29
|
-
} from "../chunk-CJVTFYI4.js";
|
|
30
|
-
import {
|
|
31
|
-
Checkbox
|
|
32
|
-
} from "../chunk-E3UOI2D2.js";
|
|
33
|
-
import {
|
|
34
|
-
Button
|
|
35
|
-
} from "../chunk-SK742QNF.js";
|
|
22
|
+
} from "../chunk-ERW3AMED.js";
|
|
36
23
|
import {
|
|
37
24
|
useInfiniteScroll,
|
|
38
25
|
useTableLayout
|
|
39
26
|
} from "../chunk-E6Y7ZHQX.js";
|
|
40
27
|
import "../chunk-VXWSAIB5.js";
|
|
41
28
|
import "../chunk-T3F37S6Z.js";
|
|
29
|
+
import {
|
|
30
|
+
Search
|
|
31
|
+
} from "../chunk-2WRRRPEB.js";
|
|
32
|
+
import {
|
|
33
|
+
Input
|
|
34
|
+
} from "../chunk-7W4I2NK3.js";
|
|
42
35
|
import "../chunk-5UH6QUFB.js";
|
|
36
|
+
import {
|
|
37
|
+
Label
|
|
38
|
+
} from "../chunk-CJVTFYI4.js";
|
|
39
|
+
import "../chunk-WVUIIBRR.js";
|
|
43
40
|
import {
|
|
44
41
|
Subheader
|
|
45
42
|
} from "../chunk-KGVKHWUK.js";
|
|
@@ -53,6 +50,9 @@ import {
|
|
|
53
50
|
import {
|
|
54
51
|
Paragraph
|
|
55
52
|
} from "../chunk-CJELWEO2.js";
|
|
53
|
+
import {
|
|
54
|
+
Button
|
|
55
|
+
} from "../chunk-SK742QNF.js";
|
|
56
56
|
import {
|
|
57
57
|
Icon
|
|
58
58
|
} from "../chunk-UAPWR2KE.js";
|
|
@@ -153,6 +153,7 @@ function TableBodyRow({
|
|
|
153
153
|
"tr",
|
|
154
154
|
{
|
|
155
155
|
className: clsx2(
|
|
156
|
+
"min-h-10",
|
|
156
157
|
"transition-colors hover:bg-background-action-secondary-hover",
|
|
157
158
|
row.getIsSelected() && "!bg-background-action-secondary-hover",
|
|
158
159
|
isError && "!bg-background-action-critical-secondary-hover",
|
|
@@ -172,21 +173,28 @@ function TableBodyRow({
|
|
|
172
173
|
/* @__PURE__ */ jsx2("td", { style: { display: "flex", width: virtualPaddingLeft } })
|
|
173
174
|
) : null,
|
|
174
175
|
columns.map((column) => {
|
|
175
|
-
var _a2;
|
|
176
|
+
var _a2, _b, _c, _d;
|
|
176
177
|
const cell = locked ? column : visibleCells[column.index];
|
|
177
178
|
if (!cell) {
|
|
178
179
|
return;
|
|
179
180
|
}
|
|
181
|
+
const cellAlignment = (_a2 = cell.column.columnDef.meta) == null ? void 0 : _a2.align;
|
|
180
182
|
const cellValue = cell.getValue();
|
|
181
|
-
return ((
|
|
183
|
+
return ((_b = cell.column.columnDef.meta) == null ? void 0 : _b.useCustomRenderer) ? /* @__PURE__ */ jsx2(React.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id) : /* @__PURE__ */ jsx2(
|
|
182
184
|
CellElement,
|
|
183
185
|
{
|
|
184
186
|
id: id ? `${id}-row-${row.id}-cell-${cell.id}` : void 0,
|
|
185
187
|
testid: testid ? `${testid}-row-${row.id}-cell-${cell.id}` : void 0,
|
|
186
188
|
cell,
|
|
187
|
-
className: clsx2(
|
|
188
|
-
|
|
189
|
-
|
|
189
|
+
className: clsx2(
|
|
190
|
+
cellAlignment ? {
|
|
191
|
+
"justify-start": cellAlignment === "left",
|
|
192
|
+
"justify-end": cellAlignment === "right"
|
|
193
|
+
} : {
|
|
194
|
+
"justify-end": typeof cellValue === "number"
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
width: (_d = (_c = cell.column.columnDef.meta) == null ? void 0 : _c.headerWidth) != null ? _d : `${cell.column.getSize()}px`,
|
|
190
198
|
children: /* @__PURE__ */ jsx2(
|
|
191
199
|
Tooltip,
|
|
192
200
|
{
|
|
@@ -625,7 +633,7 @@ function PinnedColumns(_a) {
|
|
|
625
633
|
testid: pinnedTestId
|
|
626
634
|
}, props), {
|
|
627
635
|
table,
|
|
628
|
-
locked:
|
|
636
|
+
locked: !enableColumnSelector,
|
|
629
637
|
pinDirection
|
|
630
638
|
})
|
|
631
639
|
)
|
|
@@ -643,6 +651,7 @@ var PAGE_SIZE_OPTIONS = [5, 10, 15, 20, 25, 30, 35];
|
|
|
643
651
|
var NO_RESULTS_HEIGHT = "h-[185px]";
|
|
644
652
|
function DataGrid({
|
|
645
653
|
id,
|
|
654
|
+
rowIdAccessor,
|
|
646
655
|
testid,
|
|
647
656
|
data,
|
|
648
657
|
columns,
|
|
@@ -703,11 +712,21 @@ function DataGrid({
|
|
|
703
712
|
const value = typeof updaterOrValue === "function" ? updaterOrValue(externalColumnFilters != null ? externalColumnFilters : []) : updaterOrValue;
|
|
704
713
|
(onColumnFiltersChange != null ? onColumnFiltersChange : setLocalColumnFilters)(value);
|
|
705
714
|
} : setLocalColumnFilters;
|
|
706
|
-
const rowSelection =
|
|
707
|
-
const setRowSelection =
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
715
|
+
const rowSelection = externalRowSelection != null ? externalRowSelection : localRowSelection;
|
|
716
|
+
const setRowSelection = useCallback(
|
|
717
|
+
(updaterOrValue) => {
|
|
718
|
+
if (pagination) {
|
|
719
|
+
const value = typeof updaterOrValue === "function" ? updaterOrValue(externalRowSelection != null ? externalRowSelection : {}) : updaterOrValue;
|
|
720
|
+
(onRowSelectionChange != null ? onRowSelectionChange : setLocalRowSelection)(value);
|
|
721
|
+
} else if (externalRowSelection && onRowSelectionChange) {
|
|
722
|
+
const value = typeof updaterOrValue === "function" ? updaterOrValue(externalRowSelection != null ? externalRowSelection : {}) : updaterOrValue;
|
|
723
|
+
onRowSelectionChange(value);
|
|
724
|
+
} else {
|
|
725
|
+
setLocalRowSelection(updaterOrValue);
|
|
726
|
+
}
|
|
727
|
+
},
|
|
728
|
+
[externalRowSelection, onRowSelectionChange, pagination]
|
|
729
|
+
);
|
|
711
730
|
const dndId = useId();
|
|
712
731
|
const containerRef = React3.useRef(null);
|
|
713
732
|
const toggleColumnVisibility = useCallback(
|
|
@@ -741,7 +760,7 @@ function DataGrid({
|
|
|
741
760
|
getSortedRowModel: getSortedRowModel(),
|
|
742
761
|
getFilteredRowModel: getFilteredRowModel(),
|
|
743
762
|
columnResizeMode: "onChange",
|
|
744
|
-
getRowId: (row, index) => {
|
|
763
|
+
getRowId: rowIdAccessor ? (row) => String(row[rowIdAccessor]) : (row, index) => {
|
|
745
764
|
var _a2;
|
|
746
765
|
return String((_a2 = row.id) != null ? _a2 : index + 1);
|
|
747
766
|
},
|
|
@@ -910,38 +929,42 @@ function DataGrid({
|
|
|
910
929
|
)
|
|
911
930
|
) : null,
|
|
912
931
|
virtualColumns.map((virtualColumn) => {
|
|
913
|
-
var _a2, _b2, _c2;
|
|
932
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
914
933
|
const header = headerGroup.headers[virtualColumn.index];
|
|
915
934
|
if (!header) {
|
|
916
935
|
return;
|
|
917
936
|
}
|
|
918
937
|
if (typeof header.column.columnDef.header === "string") {
|
|
919
938
|
const cellValue = (_a2 = table.getRowModel().rows[0]) == null ? void 0 : _a2.getValue(header.column.id);
|
|
939
|
+
const cellAlignment = ((_c2 = (_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.align) != null ? _c2 : cellValue === "number") ? "right" : "left";
|
|
920
940
|
return /* @__PURE__ */ jsxs5(
|
|
921
941
|
DraggableCellHeader,
|
|
922
942
|
{
|
|
923
943
|
id: id ? `${id}-header-${header.id}` : void 0,
|
|
924
944
|
testid: testid ? `${testid}-header-${header.id}` : void 0,
|
|
925
945
|
header,
|
|
926
|
-
locked: (
|
|
946
|
+
locked: (_d2 = header.column.columnDef.meta) == null ? void 0 : _d2.locked,
|
|
927
947
|
center: centerHeader,
|
|
928
948
|
className: clsx5(
|
|
929
949
|
header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
|
|
930
950
|
"group",
|
|
931
|
-
{
|
|
951
|
+
cellAlignment ? {
|
|
952
|
+
"justify-start": cellAlignment === "left",
|
|
953
|
+
"justify-end": cellAlignment === "right"
|
|
954
|
+
} : {
|
|
932
955
|
"justify-end": typeof cellValue === "number"
|
|
933
956
|
}
|
|
934
957
|
),
|
|
935
958
|
useMenuDefaultMinWidth,
|
|
936
959
|
children: [
|
|
937
|
-
|
|
960
|
+
cellAlignment === "left" && /* @__PURE__ */ jsx8(Subheader, { tall: true, children: header.column.columnDef.header }),
|
|
938
961
|
getSortIcon(header.column.getIsSorted()),
|
|
939
962
|
!header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
|
|
940
963
|
header.column.getNextSortingOrder(),
|
|
941
964
|
true
|
|
942
965
|
),
|
|
943
966
|
header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ jsx8(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
|
|
944
|
-
|
|
967
|
+
cellAlignment === "right" && /* @__PURE__ */ jsx8(Subheader, { tall: true, children: header.column.columnDef.header }),
|
|
945
968
|
/* @__PURE__ */ jsx8(
|
|
946
969
|
"div",
|
|
947
970
|
{
|
|
@@ -965,7 +988,7 @@ function DataGrid({
|
|
|
965
988
|
header.id
|
|
966
989
|
);
|
|
967
990
|
}
|
|
968
|
-
return /* @__PURE__ */ jsx8(React3.Fragment, { children: ((
|
|
991
|
+
return /* @__PURE__ */ jsx8(React3.Fragment, { children: ((_e2 = header.column.columnDef.meta) == null ? void 0 : _e2.checkbox) ? /* @__PURE__ */ jsx8(
|
|
969
992
|
DataGridCell,
|
|
970
993
|
{
|
|
971
994
|
id: id ? `${id}-header-${header.id}` : void 0,
|
package/dist/index.css
CHANGED
package/package.json
CHANGED
|
@@ -59,6 +59,7 @@ export function TableBodyRow<T>({
|
|
|
59
59
|
<tr
|
|
60
60
|
key={row.id}
|
|
61
61
|
className={clsx(
|
|
62
|
+
"min-h-10",
|
|
62
63
|
"transition-colors hover:bg-background-action-secondary-hover",
|
|
63
64
|
row.getIsSelected() && "!bg-background-action-secondary-hover",
|
|
64
65
|
isError && "!bg-background-action-critical-secondary-hover",
|
|
@@ -81,7 +82,6 @@ export function TableBodyRow<T>({
|
|
|
81
82
|
// fake empty column to the left for virtualization scroll padding
|
|
82
83
|
<td style={{ display: "flex", width: virtualPaddingLeft }} />
|
|
83
84
|
) : null}
|
|
84
|
-
|
|
85
85
|
{columns.map((column) => {
|
|
86
86
|
const cell = locked
|
|
87
87
|
? (column as Cell<T, unknown>)
|
|
@@ -90,6 +90,7 @@ export function TableBodyRow<T>({
|
|
|
90
90
|
if (!cell) {
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
+
const cellAlignment = cell.column.columnDef.meta?.align;
|
|
93
94
|
const cellValue = cell.getValue();
|
|
94
95
|
|
|
95
96
|
return cell.column.columnDef.meta?.useCustomRenderer ? (
|
|
@@ -104,9 +105,20 @@ export function TableBodyRow<T>({
|
|
|
104
105
|
testid ? `${testid}-row-${row.id}-cell-${cell.id}` : undefined
|
|
105
106
|
}
|
|
106
107
|
cell={cell}
|
|
107
|
-
className={clsx(
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
className={clsx(
|
|
109
|
+
cellAlignment
|
|
110
|
+
? {
|
|
111
|
+
"justify-start": cellAlignment === "left",
|
|
112
|
+
"justify-end": cellAlignment === "right",
|
|
113
|
+
}
|
|
114
|
+
: {
|
|
115
|
+
"justify-end": typeof cellValue === "number",
|
|
116
|
+
},
|
|
117
|
+
)}
|
|
118
|
+
width={
|
|
119
|
+
(cell.column.columnDef.meta?.headerWidth as string | undefined) ??
|
|
120
|
+
`${cell.column.getSize()}px`
|
|
121
|
+
}
|
|
110
122
|
>
|
|
111
123
|
<Tooltip
|
|
112
124
|
id={id ? `${id}-tooltip-${cell.id}` : undefined}
|
|
@@ -122,12 +134,10 @@ export function TableBodyRow<T>({
|
|
|
122
134
|
</CellElement>
|
|
123
135
|
);
|
|
124
136
|
})}
|
|
125
|
-
|
|
126
137
|
{!locked && virtualPaddingRight ? (
|
|
127
138
|
// fake empty column to the right for virtualization scroll padding
|
|
128
139
|
<td style={{ display: "flex", width: virtualPaddingRight }} />
|
|
129
140
|
) : null}
|
|
130
|
-
|
|
131
141
|
{enableColumnSelector && !locked && (
|
|
132
142
|
<td className="p-2" style={{ width: "48.8px" }}></td>
|
|
133
143
|
)}
|
|
@@ -57,6 +57,7 @@ const NO_RESULTS_HEIGHT = "h-[185px]";
|
|
|
57
57
|
|
|
58
58
|
export function DataGrid<T extends Record<string, unknown>>({
|
|
59
59
|
id,
|
|
60
|
+
rowIdAccessor,
|
|
60
61
|
testid,
|
|
61
62
|
data,
|
|
62
63
|
columns,
|
|
@@ -147,13 +148,13 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
147
148
|
}
|
|
148
149
|
: setLocalColumnFilters;
|
|
149
150
|
|
|
150
|
-
const rowSelection =
|
|
151
|
-
|
|
152
|
-
: localRowSelection;
|
|
151
|
+
const rowSelection = externalRowSelection ?? localRowSelection;
|
|
152
|
+
|
|
153
153
|
const setRowSelection: React.Dispatch<
|
|
154
154
|
React.SetStateAction<Record<string, boolean>>
|
|
155
|
-
> =
|
|
156
|
-
|
|
155
|
+
> = useCallback(
|
|
156
|
+
(updaterOrValue) => {
|
|
157
|
+
if (pagination) {
|
|
157
158
|
const value =
|
|
158
159
|
typeof updaterOrValue === "function"
|
|
159
160
|
? (
|
|
@@ -163,8 +164,23 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
163
164
|
)(externalRowSelection ?? {})
|
|
164
165
|
: updaterOrValue;
|
|
165
166
|
(onRowSelectionChange ?? setLocalRowSelection)(value);
|
|
167
|
+
} else if (externalRowSelection && onRowSelectionChange) {
|
|
168
|
+
const value =
|
|
169
|
+
typeof updaterOrValue === "function"
|
|
170
|
+
? (
|
|
171
|
+
updaterOrValue as (
|
|
172
|
+
prev: Record<string, boolean>,
|
|
173
|
+
) => Record<string, boolean>
|
|
174
|
+
)(externalRowSelection ?? {})
|
|
175
|
+
: updaterOrValue;
|
|
176
|
+
|
|
177
|
+
onRowSelectionChange(value);
|
|
178
|
+
} else {
|
|
179
|
+
setLocalRowSelection(updaterOrValue);
|
|
166
180
|
}
|
|
167
|
-
|
|
181
|
+
},
|
|
182
|
+
[externalRowSelection, onRowSelectionChange, pagination],
|
|
183
|
+
);
|
|
168
184
|
|
|
169
185
|
const dndId = useId();
|
|
170
186
|
const containerRef = React.useRef<HTMLDivElement>(null);
|
|
@@ -203,7 +219,9 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
203
219
|
getSortedRowModel: getSortedRowModel(),
|
|
204
220
|
getFilteredRowModel: getFilteredRowModel(),
|
|
205
221
|
columnResizeMode: "onChange",
|
|
206
|
-
getRowId:
|
|
222
|
+
getRowId: rowIdAccessor
|
|
223
|
+
? (row) => String(row[rowIdAccessor])
|
|
224
|
+
: (row, index) => String(row.id ?? index + 1),
|
|
207
225
|
state: {
|
|
208
226
|
columnOrder,
|
|
209
227
|
sorting: sortingState,
|
|
@@ -405,6 +423,12 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
405
423
|
.getRowModel()
|
|
406
424
|
.rows[0]?.getValue(header.column.id);
|
|
407
425
|
|
|
426
|
+
const cellAlignment: "left" | "right" | "center" =
|
|
427
|
+
(header.column.columnDef.meta?.align ??
|
|
428
|
+
cellValue === "number")
|
|
429
|
+
? "right"
|
|
430
|
+
: "left";
|
|
431
|
+
|
|
408
432
|
return (
|
|
409
433
|
<DraggableCellHeader
|
|
410
434
|
key={header.id}
|
|
@@ -423,13 +447,19 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
423
447
|
? "cursor-pointer"
|
|
424
448
|
: "cursor-grab",
|
|
425
449
|
"group",
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
450
|
+
cellAlignment
|
|
451
|
+
? {
|
|
452
|
+
"justify-start": cellAlignment === "left",
|
|
453
|
+
"justify-end": cellAlignment === "right",
|
|
454
|
+
}
|
|
455
|
+
: {
|
|
456
|
+
"justify-end":
|
|
457
|
+
typeof cellValue === "number",
|
|
458
|
+
},
|
|
429
459
|
)}
|
|
430
460
|
useMenuDefaultMinWidth={useMenuDefaultMinWidth}
|
|
431
461
|
>
|
|
432
|
-
{
|
|
462
|
+
{cellAlignment === "left" && (
|
|
433
463
|
<Subheader tall>
|
|
434
464
|
{header.column.columnDef.header}
|
|
435
465
|
</Subheader>
|
|
@@ -450,7 +480,7 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
450
480
|
{header.column.getSortIndex() + 1}
|
|
451
481
|
</Subheader>
|
|
452
482
|
)}
|
|
453
|
-
{
|
|
483
|
+
{cellAlignment === "right" && (
|
|
454
484
|
<Subheader tall>
|
|
455
485
|
{header.column.columnDef.header}
|
|
456
486
|
</Subheader>
|
|
@@ -27,6 +27,7 @@ export interface DataGridPagination {
|
|
|
27
27
|
|
|
28
28
|
export interface DataGridProps<T extends Record<string, unknown>> {
|
|
29
29
|
id?: string;
|
|
30
|
+
rowIdAccessor?: keyof T;
|
|
30
31
|
testid?: string;
|
|
31
32
|
data: T[];
|
|
32
33
|
columns: ColumnDef<T>[];
|
|
@@ -83,5 +84,6 @@ declare module "@tanstack/react-table" {
|
|
|
83
84
|
header: Header<TData, TValue>;
|
|
84
85
|
table: Table<TData>;
|
|
85
86
|
}) => ReactNode;
|
|
87
|
+
align?: "left" | "right";
|
|
86
88
|
}
|
|
87
89
|
}
|
|
@@ -226,6 +226,9 @@ export function DataCellHeader<T>({
|
|
|
226
226
|
const ref = useRef<HTMLElement>(null);
|
|
227
227
|
const predeterminedPinned = useRef(false);
|
|
228
228
|
|
|
229
|
+
const { column, getContext } = header;
|
|
230
|
+
const { id: columnId, setFilterValue } = column;
|
|
231
|
+
|
|
229
232
|
const {
|
|
230
233
|
menuRootRef,
|
|
231
234
|
isMenuActive,
|
|
@@ -236,28 +239,22 @@ export function DataCellHeader<T>({
|
|
|
236
239
|
|
|
237
240
|
useEffect(() => {
|
|
238
241
|
const columnPinning =
|
|
239
|
-
|
|
240
|
-
const left = columnPinning?.left
|
|
241
|
-
const right = columnPinning?.right
|
|
242
|
+
getContext().table.options.initialState?.columnPinning;
|
|
243
|
+
const left = columnPinning?.left ?? [];
|
|
244
|
+
const right = columnPinning?.right ?? [];
|
|
242
245
|
|
|
243
|
-
predeterminedPinned.current = [...left, ...right].includes(
|
|
244
|
-
|
|
245
|
-
);
|
|
246
|
-
// header is stable for the lifetime of the header cell
|
|
247
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
248
|
-
}, []);
|
|
246
|
+
predeterminedPinned.current = [...left, ...right].includes(columnId);
|
|
247
|
+
}, [columnId, getContext]);
|
|
249
248
|
|
|
250
249
|
useEffect(() => {
|
|
251
250
|
const handler = setTimeout(() => {
|
|
252
|
-
|
|
251
|
+
setFilterValue(filter);
|
|
253
252
|
}, 500);
|
|
254
253
|
|
|
255
254
|
return () => {
|
|
256
255
|
clearTimeout(handler);
|
|
257
256
|
};
|
|
258
|
-
|
|
259
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
260
|
-
}, [filter]);
|
|
257
|
+
}, [filter, setFilterValue]);
|
|
261
258
|
|
|
262
259
|
const style: CSSProperties = {
|
|
263
260
|
position: "relative",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Label
|
|
3
|
-
} from "./chunk-CJVTFYI4.js";
|
|
4
1
|
import {
|
|
5
2
|
formatCurrencyDisplay,
|
|
6
3
|
formatDecimalValue,
|
|
7
4
|
getDecimalPlaceholder
|
|
8
5
|
} from "./chunk-5UH6QUFB.js";
|
|
6
|
+
import {
|
|
7
|
+
Label
|
|
8
|
+
} from "./chunk-CJVTFYI4.js";
|
|
9
9
|
import {
|
|
10
10
|
Icon
|
|
11
11
|
} from "./chunk-UAPWR2KE.js";
|