@salt-ds/data-grid 1.0.4-alpha.0 → 1.0.4-alpha.1
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-cjs/packages/grid/src/BaseCell.css.js +1 -1
- package/dist-cjs/packages/grid/src/BaseCell.js +35 -3
- package/dist-cjs/packages/grid/src/BaseCell.js.map +1 -1
- package/dist-cjs/packages/grid/src/ColumnSortContext.js +20 -0
- package/dist-cjs/packages/grid/src/ColumnSortContext.js.map +1 -0
- package/dist-cjs/packages/grid/src/Grid.js +208 -126
- package/dist-cjs/packages/grid/src/Grid.js.map +1 -1
- package/dist-cjs/packages/grid/src/GridColumn.js +1 -1
- package/dist-cjs/packages/grid/src/GridColumn.js.map +1 -1
- package/dist-cjs/packages/grid/src/HeaderCell.css.js +1 -1
- package/dist-cjs/packages/grid/src/HeaderCell.js +66 -2
- package/dist-cjs/packages/grid/src/HeaderCell.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowSelectionCheckboxColumn.js +14 -7
- package/dist-cjs/packages/grid/src/RowSelectionCheckboxColumn.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowSelectionRadioColumn.js +11 -7
- package/dist-cjs/packages/grid/src/RowSelectionRadioColumn.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowValidationStatus.js +13 -0
- package/dist-cjs/packages/grid/src/RowValidationStatus.js.map +1 -0
- package/dist-cjs/packages/grid/src/index.js +1 -0
- package/dist-cjs/packages/grid/src/index.js.map +1 -1
- package/dist-cjs/packages/grid/src/internal/Cell.css.js +1 -1
- package/dist-cjs/packages/grid/src/internal/CellStatusIcons.js +46 -0
- package/dist-cjs/packages/grid/src/internal/CellStatusIcons.js.map +1 -0
- package/dist-cjs/packages/grid/src/internal/LeftPart.js +4 -2
- package/dist-cjs/packages/grid/src/internal/LeftPart.js.map +1 -1
- package/dist-cjs/packages/grid/src/internal/MiddlePart.js +4 -2
- package/dist-cjs/packages/grid/src/internal/MiddlePart.js.map +1 -1
- package/dist-cjs/packages/grid/src/internal/RightPart.js +4 -2
- package/dist-cjs/packages/grid/src/internal/RightPart.js.map +1 -1
- package/dist-cjs/packages/grid/src/internal/TableBody.js +11 -4
- package/dist-cjs/packages/grid/src/internal/TableBody.js.map +1 -1
- package/dist-cjs/packages/grid/src/internal/TableRow.css.js +1 -1
- package/dist-cjs/packages/grid/src/internal/TableRow.js +33 -12
- package/dist-cjs/packages/grid/src/internal/TableRow.js.map +1 -1
- package/dist-es/packages/grid/src/BaseCell.css.js +1 -1
- package/dist-es/packages/grid/src/BaseCell.js +35 -3
- package/dist-es/packages/grid/src/BaseCell.js.map +1 -1
- package/dist-es/packages/grid/src/ColumnSortContext.js +15 -0
- package/dist-es/packages/grid/src/ColumnSortContext.js.map +1 -0
- package/dist-es/packages/grid/src/Grid.js +208 -127
- package/dist-es/packages/grid/src/Grid.js.map +1 -1
- package/dist-es/packages/grid/src/GridColumn.js +1 -1
- package/dist-es/packages/grid/src/GridColumn.js.map +1 -1
- package/dist-es/packages/grid/src/HeaderCell.css.js +1 -1
- package/dist-es/packages/grid/src/HeaderCell.js +66 -2
- package/dist-es/packages/grid/src/HeaderCell.js.map +1 -1
- package/dist-es/packages/grid/src/RowSelectionCheckboxColumn.js +14 -7
- package/dist-es/packages/grid/src/RowSelectionCheckboxColumn.js.map +1 -1
- package/dist-es/packages/grid/src/RowSelectionRadioColumn.js +11 -7
- package/dist-es/packages/grid/src/RowSelectionRadioColumn.js.map +1 -1
- package/dist-es/packages/grid/src/RowValidationStatus.js +9 -0
- package/dist-es/packages/grid/src/RowValidationStatus.js.map +1 -0
- package/dist-es/packages/grid/src/index.js +1 -1
- package/dist-es/packages/grid/src/internal/Cell.css.js +1 -1
- package/dist-es/packages/grid/src/internal/CellStatusIcons.js +40 -0
- package/dist-es/packages/grid/src/internal/CellStatusIcons.js.map +1 -0
- package/dist-es/packages/grid/src/internal/LeftPart.js +4 -2
- package/dist-es/packages/grid/src/internal/LeftPart.js.map +1 -1
- package/dist-es/packages/grid/src/internal/MiddlePart.js +4 -2
- package/dist-es/packages/grid/src/internal/MiddlePart.js.map +1 -1
- package/dist-es/packages/grid/src/internal/RightPart.js +4 -2
- package/dist-es/packages/grid/src/internal/RightPart.js.map +1 -1
- package/dist-es/packages/grid/src/internal/TableBody.js +11 -4
- package/dist-es/packages/grid/src/internal/TableBody.js.map +1 -1
- package/dist-es/packages/grid/src/internal/TableRow.css.js +1 -1
- package/dist-es/packages/grid/src/internal/TableRow.js +33 -12
- package/dist-es/packages/grid/src/internal/TableRow.js.map +1 -1
- package/dist-es/packages/grid/src/internal/gridHooks.js +1 -1
- package/dist-types/ColumnSortContext.d.ts +12 -0
- package/dist-types/Grid.d.ts +7 -1
- package/dist-types/GridColumn.d.ts +54 -2
- package/dist-types/RowValidationStatus.d.ts +7 -0
- package/dist-types/internal/CellStatusIcons.d.ts +4 -0
- package/dist-types/internal/LeftPart.d.ts +2 -0
- package/dist-types/internal/MiddlePart.d.ts +2 -0
- package/dist-types/internal/RightPart.d.ts +2 -0
- package/dist-types/internal/TableBody.d.ts +2 -0
- package/dist-types/internal/TableRow.d.ts +2 -1
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnSortContext.js","sources":["../src/ColumnSortContext.ts"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport { SortOrder } from \"./Grid\";\nimport { GridColumnProps } from \"./GridColumn\";\n\nexport interface ColumnSortContext {\n sortByColumnId?: GridColumnProps[\"id\"];\n setSortByColumnId: (c: React.SetStateAction<GridColumnProps[\"id\"]>) => void;\n sortOrder: SortOrder;\n setSortOrder: (o: SortOrder) => void;\n onClickSortColumn: (colHeaderId: GridColumnProps[\"id\"]) => void;\n}\n\nexport const ColumnSortContext = createContext<ColumnSortContext | undefined>(\n undefined\n);\n\nexport const useColumnSortContext = () => {\n const c = useContext(ColumnSortContext);\n if (!c) {\n throw new Error(`useColumnSortContext invoked outside of a Grid`);\n }\n return c;\n};\n"],"names":[],"mappings":";;AAYO,MAAM,iBAAoB,GAAA,aAAA;AAAA,EAC/B,KAAA,CAAA;AACF,EAAA;AAEO,MAAM,uBAAuB,MAAM;AACxC,EAAM,MAAA,CAAA,GAAI,WAAW,iBAAiB,CAAA,CAAA;AACtC,EAAA,IAAI,CAAC,CAAG,EAAA;AACN,IAAM,MAAA,IAAI,MAAM,CAAgD,8CAAA,CAAA,CAAA,CAAA;AAAA,GAClE;AACA,EAAO,OAAA,CAAA,CAAA;AACT;;;;"}
|
|
@@ -30,12 +30,20 @@ import { ColumnDragContext } from './ColumnDragContext.js';
|
|
|
30
30
|
import { ColumnGhost } from './internal/ColumnGhost.js';
|
|
31
31
|
import { ColumnDropTarget } from './internal/ColumnDropTarget.js';
|
|
32
32
|
import { ColumnDataContext } from './ColumnDataContext.js';
|
|
33
|
+
import { ColumnSortContext } from './ColumnSortContext.js';
|
|
33
34
|
|
|
34
35
|
const withBaseName = makePrefixer("saltGrid");
|
|
36
|
+
var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
|
|
37
|
+
SortOrder2["ASC"] = "asc";
|
|
38
|
+
SortOrder2["DESC"] = "desc";
|
|
39
|
+
SortOrder2["NONE"] = "none";
|
|
40
|
+
return SortOrder2;
|
|
41
|
+
})(SortOrder || {});
|
|
35
42
|
function defaultRowKeyGetter(row, index) {
|
|
36
43
|
return `${index}`;
|
|
37
44
|
}
|
|
38
45
|
const Grid = function Grid2(props) {
|
|
46
|
+
var _a, _b, _c;
|
|
39
47
|
const {
|
|
40
48
|
rowData,
|
|
41
49
|
zebra,
|
|
@@ -55,7 +63,8 @@ const Grid = function Grid2(props) {
|
|
|
55
63
|
onColumnMoved,
|
|
56
64
|
cellSelectionMode = "none",
|
|
57
65
|
onVisibleRowRangeChange,
|
|
58
|
-
headerIsFocusable
|
|
66
|
+
headerIsFocusable,
|
|
67
|
+
getRowValidationStatus
|
|
59
68
|
} = props;
|
|
60
69
|
const rootRef = useRef(null);
|
|
61
70
|
const scrollableRef = useRef(null);
|
|
@@ -83,6 +92,8 @@ const Grid = function Grid2(props) {
|
|
|
83
92
|
const [focusedPart, setFocusedPart] = useState(
|
|
84
93
|
headerIsFocusable ? "header" : "body"
|
|
85
94
|
);
|
|
95
|
+
const [sortByColumnId, setSortByColumnId] = useState("");
|
|
96
|
+
const [sortOrder, setSortOrder] = useState("none" /* NONE */);
|
|
86
97
|
const [editMode, setEditMode] = useState(false);
|
|
87
98
|
const [initialText, setInitialText] = useState(void 0);
|
|
88
99
|
const resizeClient = useCallback(
|
|
@@ -127,8 +138,8 @@ const Grid = function Grid2(props) {
|
|
|
127
138
|
);
|
|
128
139
|
const midGrpByColId = useMemo(() => {
|
|
129
140
|
const m = /* @__PURE__ */ new Map();
|
|
130
|
-
for (
|
|
131
|
-
for (
|
|
141
|
+
for (const g of midGroups) {
|
|
142
|
+
for (const c of g.childrenIds) {
|
|
132
143
|
m.set(c, g);
|
|
133
144
|
}
|
|
134
145
|
}
|
|
@@ -242,6 +253,70 @@ const Grid = function Grid2(props) {
|
|
|
242
253
|
}),
|
|
243
254
|
[getColById]
|
|
244
255
|
);
|
|
256
|
+
const isSortMode = sortByColumnId && sortOrder !== "none" /* NONE */;
|
|
257
|
+
const onSortOrderChange = (_a = getColById(sortByColumnId)) == null ? void 0 : _a.info.props.onSortOrderChange;
|
|
258
|
+
const valueGetter = ((_b = getColById(sortByColumnId)) == null ? void 0 : _b.info.props.getValue) || ((r) => {
|
|
259
|
+
return r[sortByColumnId];
|
|
260
|
+
});
|
|
261
|
+
const customSortingFn = (_c = getColById(sortByColumnId)) == null ? void 0 : _c.info.props.customSort;
|
|
262
|
+
const sortedRowData = useMemo(() => {
|
|
263
|
+
if (!isSortMode || onSortOrderChange)
|
|
264
|
+
return rowData;
|
|
265
|
+
if (customSortingFn) {
|
|
266
|
+
return customSortingFn({ rowData, sortOrder });
|
|
267
|
+
}
|
|
268
|
+
const sortedData = [...rowData].sort(
|
|
269
|
+
(a, b) => valueGetter(a) < valueGetter(b) ? -1 : 1
|
|
270
|
+
);
|
|
271
|
+
if (sortOrder === "desc" /* DESC */) {
|
|
272
|
+
return sortedData.reverse();
|
|
273
|
+
}
|
|
274
|
+
return sortedData;
|
|
275
|
+
}, [
|
|
276
|
+
onSortOrderChange,
|
|
277
|
+
valueGetter,
|
|
278
|
+
customSortingFn,
|
|
279
|
+
isSortMode,
|
|
280
|
+
rowData,
|
|
281
|
+
sortByColumnId,
|
|
282
|
+
sortOrder
|
|
283
|
+
]);
|
|
284
|
+
const onClickSortColumn = useCallback(
|
|
285
|
+
(colHeaderId) => {
|
|
286
|
+
if (sortByColumnId === colHeaderId) {
|
|
287
|
+
switch (sortOrder) {
|
|
288
|
+
case "asc" /* ASC */:
|
|
289
|
+
setSortOrder("desc" /* DESC */);
|
|
290
|
+
break;
|
|
291
|
+
case "desc" /* DESC */:
|
|
292
|
+
setSortOrder("none" /* NONE */);
|
|
293
|
+
break;
|
|
294
|
+
default:
|
|
295
|
+
setSortOrder("asc" /* ASC */);
|
|
296
|
+
}
|
|
297
|
+
} else {
|
|
298
|
+
setSortByColumnId(colHeaderId);
|
|
299
|
+
setSortOrder("asc" /* ASC */);
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
[sortByColumnId, sortOrder]
|
|
303
|
+
);
|
|
304
|
+
const columnSortContext = useMemo(
|
|
305
|
+
() => ({
|
|
306
|
+
sortByColumnId,
|
|
307
|
+
setSortByColumnId,
|
|
308
|
+
sortOrder,
|
|
309
|
+
setSortOrder,
|
|
310
|
+
onClickSortColumn
|
|
311
|
+
}),
|
|
312
|
+
[
|
|
313
|
+
sortByColumnId,
|
|
314
|
+
setSortByColumnId,
|
|
315
|
+
sortOrder,
|
|
316
|
+
setSortOrder,
|
|
317
|
+
onClickSortColumn
|
|
318
|
+
]
|
|
319
|
+
);
|
|
245
320
|
const scroll = useCallback(
|
|
246
321
|
(left, top, source) => {
|
|
247
322
|
setScrollSource(source || "user");
|
|
@@ -265,9 +340,9 @@ const Grid = function Grid2(props) {
|
|
|
265
340
|
);
|
|
266
341
|
const focusCellElement = (part, rowIdx, colIdx) => {
|
|
267
342
|
setTimeout(() => {
|
|
268
|
-
var
|
|
343
|
+
var _a2;
|
|
269
344
|
const selector = part === "body" ? `td[data-row-index="${rowIdx}"][data-column-index="${colIdx}"]` : `th[data-column-index="${colIdx}"]`;
|
|
270
|
-
const nodeToFocus = (
|
|
345
|
+
const nodeToFocus = (_a2 = rootRef.current) == null ? void 0 : _a2.querySelector(selector);
|
|
271
346
|
if (nodeToFocus) {
|
|
272
347
|
nodeToFocus.focus({ preventScroll: true });
|
|
273
348
|
} else {
|
|
@@ -305,7 +380,7 @@ const Grid = function Grid2(props) {
|
|
|
305
380
|
`onChange is not specified for editable column "${c.info.props.id}".`
|
|
306
381
|
);
|
|
307
382
|
} else {
|
|
308
|
-
handler(
|
|
383
|
+
handler(sortedRowData[cursorRowIdx], cursorRowIdx, value);
|
|
309
384
|
}
|
|
310
385
|
setEditMode(false);
|
|
311
386
|
focusCellElement(focusedPart, cursorRowIdx, cursorColIdx);
|
|
@@ -329,7 +404,7 @@ const Grid = function Grid2(props) {
|
|
|
329
404
|
onMouseDown: onRowSelectionMouseDown
|
|
330
405
|
} = useRowSelection(
|
|
331
406
|
rowKeyGetter,
|
|
332
|
-
|
|
407
|
+
sortedRowData,
|
|
333
408
|
defaultSelectedRowIdxs,
|
|
334
409
|
selectedRowIdxs,
|
|
335
410
|
rowSelectionMode,
|
|
@@ -347,10 +422,10 @@ const Grid = function Grid2(props) {
|
|
|
347
422
|
setFocusedPart(part);
|
|
348
423
|
colIdx = clamp(colIdx, 0, cols.length - 1);
|
|
349
424
|
if (part === "body") {
|
|
350
|
-
if (
|
|
425
|
+
if (sortedRowData.length < 1 || cols.length < 1) {
|
|
351
426
|
return;
|
|
352
427
|
}
|
|
353
|
-
rowIdx = clamp(rowIdx, 0,
|
|
428
|
+
rowIdx = clamp(rowIdx, 0, sortedRowData.length - 1);
|
|
354
429
|
} else if (part === "header") {
|
|
355
430
|
rowIdx = 0;
|
|
356
431
|
}
|
|
@@ -365,7 +440,7 @@ const Grid = function Grid2(props) {
|
|
|
365
440
|
[
|
|
366
441
|
setCursorRowIdx,
|
|
367
442
|
setCursorColIdx,
|
|
368
|
-
|
|
443
|
+
sortedRowData,
|
|
369
444
|
rowKeyGetter,
|
|
370
445
|
cols,
|
|
371
446
|
rootRef.current,
|
|
@@ -376,7 +451,7 @@ const Grid = function Grid2(props) {
|
|
|
376
451
|
headerIsFocusable
|
|
377
452
|
]
|
|
378
453
|
);
|
|
379
|
-
const rows = useRowModels(rowKeyGetter,
|
|
454
|
+
const rows = useRowModels(rowKeyGetter, sortedRowData, visRowRng);
|
|
380
455
|
const isLeftRaised = scrollLeft > 0;
|
|
381
456
|
const isRightRaised = scrollLeft + clientMidWidth < midWidth;
|
|
382
457
|
const isHeaderRaised = scrollTop > 0;
|
|
@@ -543,7 +618,7 @@ const Grid = function Grid2(props) {
|
|
|
543
618
|
if (cursorColIdx != void 0) {
|
|
544
619
|
rangeSelection.selectRange({
|
|
545
620
|
start: { rowIdx: 0, colIdx: cursorColIdx },
|
|
546
|
-
end: { rowIdx:
|
|
621
|
+
end: { rowIdx: sortedRowData.length, colIdx: cursorColIdx }
|
|
547
622
|
});
|
|
548
623
|
}
|
|
549
624
|
} else {
|
|
@@ -564,7 +639,7 @@ const Grid = function Grid2(props) {
|
|
|
564
639
|
if (event.ctrlKey || event.metaKey) {
|
|
565
640
|
rangeSelection.selectRange({
|
|
566
641
|
start: { rowIdx: 0, colIdx: 0 },
|
|
567
|
-
end: { rowIdx:
|
|
642
|
+
end: { rowIdx: sortedRowData.length, colIdx: cols.length }
|
|
568
643
|
});
|
|
569
644
|
selectAll();
|
|
570
645
|
return true;
|
|
@@ -585,7 +660,7 @@ const Grid = function Grid2(props) {
|
|
|
585
660
|
selectAll,
|
|
586
661
|
cursorColIdx,
|
|
587
662
|
cursorRowIdx,
|
|
588
|
-
|
|
663
|
+
sortedRowData.length,
|
|
589
664
|
cols.length,
|
|
590
665
|
focusedPart
|
|
591
666
|
]
|
|
@@ -600,7 +675,7 @@ const Grid = function Grid2(props) {
|
|
|
600
675
|
const [minCol, maxCol] = [start.colIdx, end.colIdx].sort(c);
|
|
601
676
|
const text = [];
|
|
602
677
|
for (let r = minRow; r <= maxRow; ++r) {
|
|
603
|
-
const row =
|
|
678
|
+
const row = sortedRowData[r];
|
|
604
679
|
const rowText = [];
|
|
605
680
|
for (let c2 = minCol; c2 <= maxCol; ++c2) {
|
|
606
681
|
const col = cols[c2];
|
|
@@ -676,7 +751,7 @@ const Grid = function Grid2(props) {
|
|
|
676
751
|
if (!event.ctrlKey) {
|
|
677
752
|
moveCursor(focusedPart, cursorRowIdx, cols.length - 1);
|
|
678
753
|
} else {
|
|
679
|
-
moveCursor(focusedPart,
|
|
754
|
+
moveCursor(focusedPart, sortedRowData.length - 1, cols.length - 1);
|
|
680
755
|
}
|
|
681
756
|
break;
|
|
682
757
|
case "Tab":
|
|
@@ -685,7 +760,7 @@ const Grid = function Grid2(props) {
|
|
|
685
760
|
if (cursorColIdx < cols.length - 1) {
|
|
686
761
|
moveCursor(focusedPart, cursorRowIdx, cursorColIdx + 1);
|
|
687
762
|
} else {
|
|
688
|
-
if (cursorRowIdx <
|
|
763
|
+
if (cursorRowIdx < sortedRowData.length - 1) {
|
|
689
764
|
moveCursor(focusedPart, cursorRowIdx + 1, 0);
|
|
690
765
|
}
|
|
691
766
|
}
|
|
@@ -725,7 +800,7 @@ const Grid = function Grid2(props) {
|
|
|
725
800
|
cursorRowIdx,
|
|
726
801
|
cursorRowIdx,
|
|
727
802
|
cols.length,
|
|
728
|
-
|
|
803
|
+
sortedRowData.length,
|
|
729
804
|
headerIsFocusable,
|
|
730
805
|
pageSize
|
|
731
806
|
]
|
|
@@ -810,115 +885,121 @@ const Grid = function Grid2(props) {
|
|
|
810
885
|
value: sizingContext,
|
|
811
886
|
children: /* @__PURE__ */ jsx(EditorContext.Provider, {
|
|
812
887
|
value: editorContext,
|
|
813
|
-
children: /* @__PURE__ */
|
|
888
|
+
children: /* @__PURE__ */ jsx(ColumnDataContext.Provider, {
|
|
814
889
|
value: columnDataContext,
|
|
815
|
-
children:
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
890
|
+
children: /* @__PURE__ */ jsxs(ColumnSortContext.Provider, {
|
|
891
|
+
value: columnSortContext,
|
|
892
|
+
children: [
|
|
893
|
+
props.children,
|
|
894
|
+
/* @__PURE__ */ jsxs("div", {
|
|
895
|
+
className: clsx(
|
|
896
|
+
withBaseName(),
|
|
897
|
+
{
|
|
898
|
+
[withBaseName("zebra")]: zebra,
|
|
899
|
+
[withBaseName("columnSeparators")]: columnSeparators,
|
|
900
|
+
[withBaseName("pinnedSeparators")]: pinnedSeparators,
|
|
901
|
+
[withBaseName("primaryBackground")]: variant === "primary",
|
|
902
|
+
[withBaseName("secondaryBackground")]: variant === "secondary"
|
|
903
|
+
},
|
|
904
|
+
className
|
|
905
|
+
),
|
|
906
|
+
style: rootStyle,
|
|
907
|
+
ref: rootRef,
|
|
908
|
+
onKeyDown,
|
|
909
|
+
onKeyUp,
|
|
910
|
+
onMouseDown,
|
|
911
|
+
onFocus,
|
|
912
|
+
onBlur,
|
|
913
|
+
"data-name": "grid-root",
|
|
914
|
+
role: "grid",
|
|
915
|
+
"aria-colcount": cols.length,
|
|
916
|
+
"aria-rowcount": rowCount + headRowCount,
|
|
917
|
+
"aria-multiselectable": rowSelectionMode === "multi",
|
|
918
|
+
children: [
|
|
919
|
+
/* @__PURE__ */ jsx(CellMeasure, {
|
|
920
|
+
setRowHeight
|
|
921
|
+
}),
|
|
922
|
+
/* @__PURE__ */ jsx(Scrollable, {
|
|
923
|
+
resizeClient,
|
|
924
|
+
scrollLeft,
|
|
925
|
+
scrollTop,
|
|
926
|
+
scrollSource,
|
|
927
|
+
scroll,
|
|
928
|
+
scrollerRef: scrollableRef,
|
|
929
|
+
topRef,
|
|
930
|
+
rightRef,
|
|
931
|
+
bottomRef,
|
|
932
|
+
leftRef,
|
|
933
|
+
middleRef
|
|
934
|
+
}),
|
|
935
|
+
!hideHeader && leftCols.length > 0 && /* @__PURE__ */ jsx(TopLeftPart, {
|
|
936
|
+
onWheel,
|
|
937
|
+
columns: leftCols,
|
|
938
|
+
columnGroups: leftGroups,
|
|
939
|
+
rightShadow: isLeftRaised,
|
|
940
|
+
bottomShadow: isHeaderRaised
|
|
941
|
+
}),
|
|
942
|
+
!hideHeader && /* @__PURE__ */ jsx(TopPart, {
|
|
943
|
+
columns: headVisibleColumns,
|
|
944
|
+
columnGroups: visColGrps,
|
|
945
|
+
topRef,
|
|
946
|
+
onWheel,
|
|
947
|
+
midGap,
|
|
948
|
+
bottomShadow: isHeaderRaised
|
|
949
|
+
}),
|
|
950
|
+
!hideHeader && rightCols.length > 0 && /* @__PURE__ */ jsx(TopRightPart, {
|
|
951
|
+
onWheel,
|
|
952
|
+
columns: rightCols,
|
|
953
|
+
columnGroups: rightGroups,
|
|
954
|
+
leftShadow: isRightRaised,
|
|
955
|
+
bottomShadow: isHeaderRaised
|
|
956
|
+
}),
|
|
957
|
+
leftCols.length > 0 && /* @__PURE__ */ jsx(LeftPart, {
|
|
958
|
+
leftRef,
|
|
959
|
+
onWheel,
|
|
960
|
+
columns: leftCols,
|
|
961
|
+
rows,
|
|
962
|
+
rightShadow: isLeftRaised,
|
|
963
|
+
hoverOverRowKey: hoverRowKey,
|
|
964
|
+
setHoverOverRowKey: setHoverRowKey,
|
|
965
|
+
zebra,
|
|
966
|
+
getRowValidationStatus
|
|
967
|
+
}),
|
|
968
|
+
/* @__PURE__ */ jsx(MiddlePart, {
|
|
969
|
+
middleRef,
|
|
970
|
+
onWheel,
|
|
971
|
+
columns: bodyVisibleColumns,
|
|
972
|
+
rows,
|
|
973
|
+
hoverOverRowKey: hoverRowKey,
|
|
974
|
+
setHoverOverRowKey: setHoverRowKey,
|
|
975
|
+
midGap,
|
|
976
|
+
zebra,
|
|
977
|
+
getRowValidationStatus
|
|
978
|
+
}),
|
|
979
|
+
rightCols.length > 0 && /* @__PURE__ */ jsx(RightPart, {
|
|
980
|
+
rightRef,
|
|
981
|
+
onWheel,
|
|
982
|
+
columns: rightCols,
|
|
983
|
+
rows,
|
|
984
|
+
leftShadow: isRightRaised,
|
|
985
|
+
hoverOverRowKey: hoverRowKey,
|
|
986
|
+
setHoverOverRowKey: setHoverRowKey,
|
|
987
|
+
zebra,
|
|
988
|
+
getRowValidationStatus
|
|
989
|
+
}),
|
|
990
|
+
/* @__PURE__ */ jsx(ColumnDropTarget, {
|
|
991
|
+
x: activeTarget == null ? void 0 : activeTarget.x
|
|
992
|
+
}),
|
|
993
|
+
/* @__PURE__ */ jsx(ColumnGhost, {
|
|
994
|
+
columns: cols,
|
|
995
|
+
rows,
|
|
996
|
+
dragState,
|
|
997
|
+
zebra
|
|
998
|
+
})
|
|
999
|
+
]
|
|
1000
|
+
})
|
|
1001
|
+
]
|
|
1002
|
+
})
|
|
922
1003
|
})
|
|
923
1004
|
})
|
|
924
1005
|
})
|
|
@@ -929,5 +1010,5 @@ const Grid = function Grid2(props) {
|
|
|
929
1010
|
});
|
|
930
1011
|
};
|
|
931
1012
|
|
|
932
|
-
export { Grid };
|
|
1013
|
+
export { Grid, SortOrder };
|
|
933
1014
|
//# sourceMappingURL=Grid.js.map
|