@salt-ds/data-grid 1.0.3 → 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 +211 -128
- 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/NumericColumn.js +12 -0
- package/dist-cjs/packages/grid/src/NumericColumn.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowSelectionCheckboxCellValue.js +2 -2
- package/dist-cjs/packages/grid/src/RowSelectionCheckboxCellValue.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/RowSelectionCheckboxHeaderCellValue.js +2 -2
- package/dist-cjs/packages/grid/src/RowSelectionCheckboxHeaderCellValue.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowSelectionRadioCellValue.js +2 -2
- package/dist-cjs/packages/grid/src/RowSelectionRadioCellValue.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/RowSelectionRadioHeaderCell.js +2 -2
- package/dist-cjs/packages/grid/src/RowSelectionRadioHeaderCell.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/TextCellEditor.js +12 -0
- package/dist-cjs/packages/grid/src/TextCellEditor.js.map +1 -1
- 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 +211 -129
- 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/NumericColumn.js +12 -0
- package/dist-es/packages/grid/src/NumericColumn.js.map +1 -1
- package/dist-es/packages/grid/src/RowSelectionCheckboxCellValue.js +2 -2
- package/dist-es/packages/grid/src/RowSelectionCheckboxCellValue.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/RowSelectionCheckboxHeaderCellValue.js +2 -2
- package/dist-es/packages/grid/src/RowSelectionCheckboxHeaderCellValue.js.map +1 -1
- package/dist-es/packages/grid/src/RowSelectionRadioCellValue.js +1 -1
- package/dist-es/packages/grid/src/RowSelectionRadioCellValue.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/RowSelectionRadioHeaderCell.js +1 -1
- package/dist-es/packages/grid/src/RowSelectionRadioHeaderCell.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/TextCellEditor.js +12 -0
- package/dist-es/packages/grid/src/TextCellEditor.js.map +1 -1
- 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 +6 -4
|
@@ -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,
|
|
@@ -338,7 +413,6 @@ const Grid = function Grid2(props) {
|
|
|
338
413
|
const rangeSelection = useRangeSelection(cellSelectionMode);
|
|
339
414
|
const moveCursor = useCallback(
|
|
340
415
|
(part, rowIdx, colIdx) => {
|
|
341
|
-
cancelEditMode();
|
|
342
416
|
if (!headerIsFocusable && part === "header") {
|
|
343
417
|
console.warn(
|
|
344
418
|
`Cannot move focus to the header. "headerIsFocusable" prop is false.`
|
|
@@ -348,10 +422,10 @@ const Grid = function Grid2(props) {
|
|
|
348
422
|
setFocusedPart(part);
|
|
349
423
|
colIdx = clamp(colIdx, 0, cols.length - 1);
|
|
350
424
|
if (part === "body") {
|
|
351
|
-
if (
|
|
425
|
+
if (sortedRowData.length < 1 || cols.length < 1) {
|
|
352
426
|
return;
|
|
353
427
|
}
|
|
354
|
-
rowIdx = clamp(rowIdx, 0,
|
|
428
|
+
rowIdx = clamp(rowIdx, 0, sortedRowData.length - 1);
|
|
355
429
|
} else if (part === "header") {
|
|
356
430
|
rowIdx = 0;
|
|
357
431
|
}
|
|
@@ -366,7 +440,7 @@ const Grid = function Grid2(props) {
|
|
|
366
440
|
[
|
|
367
441
|
setCursorRowIdx,
|
|
368
442
|
setCursorColIdx,
|
|
369
|
-
|
|
443
|
+
sortedRowData,
|
|
370
444
|
rowKeyGetter,
|
|
371
445
|
cols,
|
|
372
446
|
rootRef.current,
|
|
@@ -377,7 +451,7 @@ const Grid = function Grid2(props) {
|
|
|
377
451
|
headerIsFocusable
|
|
378
452
|
]
|
|
379
453
|
);
|
|
380
|
-
const rows = useRowModels(rowKeyGetter,
|
|
454
|
+
const rows = useRowModels(rowKeyGetter, sortedRowData, visRowRng);
|
|
381
455
|
const isLeftRaised = scrollLeft > 0;
|
|
382
456
|
const isRightRaised = scrollLeft + clientMidWidth < midWidth;
|
|
383
457
|
const isHeaderRaised = scrollTop > 0;
|
|
@@ -544,7 +618,7 @@ const Grid = function Grid2(props) {
|
|
|
544
618
|
if (cursorColIdx != void 0) {
|
|
545
619
|
rangeSelection.selectRange({
|
|
546
620
|
start: { rowIdx: 0, colIdx: cursorColIdx },
|
|
547
|
-
end: { rowIdx:
|
|
621
|
+
end: { rowIdx: sortedRowData.length, colIdx: cursorColIdx }
|
|
548
622
|
});
|
|
549
623
|
}
|
|
550
624
|
} else {
|
|
@@ -565,11 +639,13 @@ const Grid = function Grid2(props) {
|
|
|
565
639
|
if (event.ctrlKey || event.metaKey) {
|
|
566
640
|
rangeSelection.selectRange({
|
|
567
641
|
start: { rowIdx: 0, colIdx: 0 },
|
|
568
|
-
end: { rowIdx:
|
|
642
|
+
end: { rowIdx: sortedRowData.length, colIdx: cols.length }
|
|
569
643
|
});
|
|
570
644
|
selectAll();
|
|
645
|
+
return true;
|
|
646
|
+
} else {
|
|
647
|
+
return false;
|
|
571
648
|
}
|
|
572
|
-
break;
|
|
573
649
|
default:
|
|
574
650
|
return false;
|
|
575
651
|
}
|
|
@@ -584,7 +660,7 @@ const Grid = function Grid2(props) {
|
|
|
584
660
|
selectAll,
|
|
585
661
|
cursorColIdx,
|
|
586
662
|
cursorRowIdx,
|
|
587
|
-
|
|
663
|
+
sortedRowData.length,
|
|
588
664
|
cols.length,
|
|
589
665
|
focusedPart
|
|
590
666
|
]
|
|
@@ -599,7 +675,7 @@ const Grid = function Grid2(props) {
|
|
|
599
675
|
const [minCol, maxCol] = [start.colIdx, end.colIdx].sort(c);
|
|
600
676
|
const text = [];
|
|
601
677
|
for (let r = minRow; r <= maxRow; ++r) {
|
|
602
|
-
const row =
|
|
678
|
+
const row = sortedRowData[r];
|
|
603
679
|
const rowText = [];
|
|
604
680
|
for (let c2 = minCol; c2 <= maxCol; ++c2) {
|
|
605
681
|
const col = cols[c2];
|
|
@@ -675,7 +751,7 @@ const Grid = function Grid2(props) {
|
|
|
675
751
|
if (!event.ctrlKey) {
|
|
676
752
|
moveCursor(focusedPart, cursorRowIdx, cols.length - 1);
|
|
677
753
|
} else {
|
|
678
|
-
moveCursor(focusedPart,
|
|
754
|
+
moveCursor(focusedPart, sortedRowData.length - 1, cols.length - 1);
|
|
679
755
|
}
|
|
680
756
|
break;
|
|
681
757
|
case "Tab":
|
|
@@ -684,7 +760,7 @@ const Grid = function Grid2(props) {
|
|
|
684
760
|
if (cursorColIdx < cols.length - 1) {
|
|
685
761
|
moveCursor(focusedPart, cursorRowIdx, cursorColIdx + 1);
|
|
686
762
|
} else {
|
|
687
|
-
if (cursorRowIdx <
|
|
763
|
+
if (cursorRowIdx < sortedRowData.length - 1) {
|
|
688
764
|
moveCursor(focusedPart, cursorRowIdx + 1, 0);
|
|
689
765
|
}
|
|
690
766
|
}
|
|
@@ -724,7 +800,7 @@ const Grid = function Grid2(props) {
|
|
|
724
800
|
cursorRowIdx,
|
|
725
801
|
cursorRowIdx,
|
|
726
802
|
cols.length,
|
|
727
|
-
|
|
803
|
+
sortedRowData.length,
|
|
728
804
|
headerIsFocusable,
|
|
729
805
|
pageSize
|
|
730
806
|
]
|
|
@@ -809,115 +885,121 @@ const Grid = function Grid2(props) {
|
|
|
809
885
|
value: sizingContext,
|
|
810
886
|
children: /* @__PURE__ */ jsx(EditorContext.Provider, {
|
|
811
887
|
value: editorContext,
|
|
812
|
-
children: /* @__PURE__ */
|
|
888
|
+
children: /* @__PURE__ */ jsx(ColumnDataContext.Provider, {
|
|
813
889
|
value: columnDataContext,
|
|
814
|
-
children:
|
|
815
|
-
|
|
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
|
-
|
|
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
|
+
})
|
|
921
1003
|
})
|
|
922
1004
|
})
|
|
923
1005
|
})
|
|
@@ -928,5 +1010,5 @@ const Grid = function Grid2(props) {
|
|
|
928
1010
|
});
|
|
929
1011
|
};
|
|
930
1012
|
|
|
931
|
-
export { Grid };
|
|
1013
|
+
export { Grid, SortOrder };
|
|
932
1014
|
//# sourceMappingURL=Grid.js.map
|