@gridkitjs/react 0.18.0 → 0.20.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/index.d.ts +53 -7
- package/dist/index.js +822 -482
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -6,17 +6,21 @@ import {
|
|
|
6
6
|
useId as useId2,
|
|
7
7
|
useImperativeHandle as useImperativeHandle3,
|
|
8
8
|
useMemo as useMemo5,
|
|
9
|
-
useRef as
|
|
10
|
-
useState as
|
|
9
|
+
useRef as useRef24,
|
|
10
|
+
useState as useState19
|
|
11
11
|
} from "react";
|
|
12
12
|
import {
|
|
13
13
|
headerFocus as headerFocus3,
|
|
14
|
-
moveColumnBefore,
|
|
15
14
|
resolveColumnHeaderText as resolveColumnHeaderText2,
|
|
15
|
+
resolveColumnPin as resolveColumnPin2,
|
|
16
16
|
resolveMessages,
|
|
17
17
|
resolveRows
|
|
18
18
|
} from "@gridkitjs/core";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
moveColumnInPinGroup,
|
|
21
|
+
pinnedWidths as pinnedWidths2,
|
|
22
|
+
totalColumnWidth
|
|
23
|
+
} from "@gridkitjs/core/renderer";
|
|
20
24
|
|
|
21
25
|
// src/DataGrid/components/GridColgroup.tsx
|
|
22
26
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -34,10 +38,12 @@ import {
|
|
|
34
38
|
} from "@gridkitjs/core";
|
|
35
39
|
import {
|
|
36
40
|
buildKeyShortcuts,
|
|
41
|
+
inlineStep,
|
|
37
42
|
intentOf,
|
|
38
43
|
KEYBOARD_STEP,
|
|
39
44
|
resolveColumnFilterMenu
|
|
40
45
|
} from "@gridkitjs/core/renderer";
|
|
46
|
+
import { writingDirection } from "@gridkitjs/dom";
|
|
41
47
|
|
|
42
48
|
// src/DataGrid/ariaAttr.ts
|
|
43
49
|
function ariaAttr(condition, key, value) {
|
|
@@ -109,6 +115,27 @@ function isOwnEvent(event) {
|
|
|
109
115
|
return event.target instanceof Node && event.currentTarget.contains(event.target);
|
|
110
116
|
}
|
|
111
117
|
|
|
118
|
+
// src/DataGrid/pinnedCell.ts
|
|
119
|
+
function pinnedCellClassNames({
|
|
120
|
+
pinned,
|
|
121
|
+
pinEdge
|
|
122
|
+
}) {
|
|
123
|
+
if (pinned === "none") return "";
|
|
124
|
+
return classNames(
|
|
125
|
+
pinned === "start" ? "is-pinned-start" : "is-pinned-end",
|
|
126
|
+
pinEdge && "is-pinned-edge"
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
function pinnedCellStyle({
|
|
130
|
+
pinned,
|
|
131
|
+
pinOffset
|
|
132
|
+
}) {
|
|
133
|
+
if (pinned === "none") return void 0;
|
|
134
|
+
return {
|
|
135
|
+
"--gridkit-pin-offset": `${String(pinOffset)}px`
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
112
139
|
// src/DataGrid/useGridSelection.ts
|
|
113
140
|
import { useMemo } from "react";
|
|
114
141
|
function keyboardSelectIntent(event) {
|
|
@@ -180,8 +207,10 @@ function GridHeader({
|
|
|
180
207
|
const { column } = entry;
|
|
181
208
|
const resizing = resize.activeColumnId === entry.id;
|
|
182
209
|
const dragging = drag.draggedColumnId === entry.id;
|
|
183
|
-
const
|
|
184
|
-
const
|
|
210
|
+
const dragBlocked = draggedEntry !== null && entry.pinned !== draggedEntry.pinned;
|
|
211
|
+
const next = columns[index + 1];
|
|
212
|
+
const dropBefore = beforeId === entry.id && !dragBlocked;
|
|
213
|
+
const dropAfter = !dragBlocked && (next === void 0 ? beforeId === null : beforeId === next.id && next.pinned !== entry.pinned);
|
|
185
214
|
const selected = selection.selectedColumnIds.has(entry.id);
|
|
186
215
|
const sortable = column.sortable ?? sortableColumns;
|
|
187
216
|
const sortDirection = sortDirectionFor(columnSort, entry.id);
|
|
@@ -228,16 +257,18 @@ function GridHeader({
|
|
|
228
257
|
},
|
|
229
258
|
onKeyDown: (event) => {
|
|
230
259
|
if (!isOwnEvent(event)) return;
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
260
|
+
const step = inlineStep(
|
|
261
|
+
event.key,
|
|
262
|
+
writingDirection(event.currentTarget)
|
|
263
|
+
);
|
|
264
|
+
if (step !== null && event.ctrlKey && entry.reorderable) {
|
|
234
265
|
event.preventDefault();
|
|
235
|
-
drag.moveByKeyboard(entry,
|
|
266
|
+
drag.moveByKeyboard(entry, step);
|
|
236
267
|
return;
|
|
237
268
|
}
|
|
238
|
-
if (
|
|
269
|
+
if (step !== null && event.altKey && entry.resizable) {
|
|
239
270
|
event.preventDefault();
|
|
240
|
-
resize.nudge(entry,
|
|
271
|
+
resize.nudge(entry, step * KEYBOARD_STEP);
|
|
241
272
|
return;
|
|
242
273
|
}
|
|
243
274
|
if (event.key === "Enter" && event.altKey && entry.resizable) {
|
|
@@ -284,9 +315,12 @@ function GridHeader({
|
|
|
284
315
|
dragging ? "is-dragging" : "",
|
|
285
316
|
dropBefore ? "is-drop-before" : "",
|
|
286
317
|
dropAfter ? "is-drop-after" : "",
|
|
318
|
+
dragBlocked ? "is-drag-blocked" : "",
|
|
287
319
|
column.wrap?.header ? "is-wrapped" : "",
|
|
320
|
+
pinnedCellClassNames(entry),
|
|
288
321
|
column.headerClassName ?? ""
|
|
289
322
|
),
|
|
323
|
+
style: pinnedCellStyle(entry),
|
|
290
324
|
...ariaAttr(shortcuts !== "", "aria-keyshortcuts", shortcuts),
|
|
291
325
|
...ariaAttr(
|
|
292
326
|
filtered,
|
|
@@ -435,8 +469,7 @@ import {
|
|
|
435
469
|
useState as useState2
|
|
436
470
|
} from "react";
|
|
437
471
|
import {
|
|
438
|
-
bodyFocus
|
|
439
|
-
groupRowId
|
|
472
|
+
bodyFocus
|
|
440
473
|
} from "@gridkitjs/core";
|
|
441
474
|
import { intentOf as intentOf2 } from "@gridkitjs/core/renderer";
|
|
442
475
|
import {
|
|
@@ -455,7 +488,8 @@ import {
|
|
|
455
488
|
import {
|
|
456
489
|
createGridFocus,
|
|
457
490
|
findBodyRow,
|
|
458
|
-
measurePageSize
|
|
491
|
+
measurePageSize,
|
|
492
|
+
writingDirection as writingDirection2
|
|
459
493
|
} from "@gridkitjs/dom";
|
|
460
494
|
function tabIndexFor(columnIndex, focusedColumnIndex) {
|
|
461
495
|
return columnIndex === focusedColumnIndex ? 0 : -1;
|
|
@@ -519,7 +553,8 @@ function useGridNavigation({
|
|
|
519
553
|
if (gridFocus.handleKey(
|
|
520
554
|
event.key,
|
|
521
555
|
event,
|
|
522
|
-
measurePageSize(bodyTableRef.current)
|
|
556
|
+
measurePageSize(bodyTableRef.current, gridRef.current),
|
|
557
|
+
writingDirection2(event.currentTarget)
|
|
523
558
|
)) {
|
|
524
559
|
event.preventDefault();
|
|
525
560
|
}
|
|
@@ -558,6 +593,27 @@ function createRowPropsResolver() {
|
|
|
558
593
|
};
|
|
559
594
|
}
|
|
560
595
|
|
|
596
|
+
// src/DataGrid/components/GridEmptyRow.tsx
|
|
597
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
598
|
+
function GridEmptyRow({
|
|
599
|
+
columnCount,
|
|
600
|
+
viewportWidth,
|
|
601
|
+
children
|
|
602
|
+
}) {
|
|
603
|
+
const contentStyle = viewportWidth === null ? void 0 : {
|
|
604
|
+
"--gridkit-empty-width": `${String(viewportWidth)}px`
|
|
605
|
+
};
|
|
606
|
+
return /* @__PURE__ */ jsx4("tr", { role: "row", className: "gridkit-grid-empty-row", children: /* @__PURE__ */ jsx4(
|
|
607
|
+
"td",
|
|
608
|
+
{
|
|
609
|
+
role: "gridcell",
|
|
610
|
+
colSpan: columnCount,
|
|
611
|
+
className: "gridkit-grid-empty-cell",
|
|
612
|
+
children: /* @__PURE__ */ jsx4("div", { className: "gridkit-grid-empty-content", style: contentStyle, children })
|
|
613
|
+
}
|
|
614
|
+
) });
|
|
615
|
+
}
|
|
616
|
+
|
|
561
617
|
// src/DataGrid/components/GridGroupRow.tsx
|
|
562
618
|
import { memo } from "react";
|
|
563
619
|
import {
|
|
@@ -580,7 +636,7 @@ function renderAggregate(value, spec, column, rows, locale) {
|
|
|
580
636
|
}
|
|
581
637
|
|
|
582
638
|
// src/DataGrid/components/GridGroupRow.tsx
|
|
583
|
-
import { jsx as
|
|
639
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
584
640
|
function GridGroupRowComponent({
|
|
585
641
|
columnCount,
|
|
586
642
|
groupId,
|
|
@@ -602,7 +658,7 @@ function GridGroupRowComponent({
|
|
|
602
658
|
cellMessages,
|
|
603
659
|
ref
|
|
604
660
|
}) {
|
|
605
|
-
return /* @__PURE__ */
|
|
661
|
+
return /* @__PURE__ */ jsx5(
|
|
606
662
|
"tr",
|
|
607
663
|
{
|
|
608
664
|
ref,
|
|
@@ -618,7 +674,7 @@ function GridGroupRowComponent({
|
|
|
618
674
|
"gridkit-grid-group-row",
|
|
619
675
|
`is-group-level-${String(level)}`
|
|
620
676
|
),
|
|
621
|
-
children: /* @__PURE__ */
|
|
677
|
+
children: /* @__PURE__ */ jsx5(
|
|
622
678
|
"td",
|
|
623
679
|
{
|
|
624
680
|
role: "gridcell",
|
|
@@ -632,7 +688,7 @@ function GridGroupRowComponent({
|
|
|
632
688
|
className: "gridkit-grid-group-cell-content",
|
|
633
689
|
style: { paddingInlineStart: `${String(level * 1.25 + 0.5)}rem` },
|
|
634
690
|
children: [
|
|
635
|
-
/* @__PURE__ */
|
|
691
|
+
/* @__PURE__ */ jsx5(
|
|
636
692
|
"span",
|
|
637
693
|
{
|
|
638
694
|
className: classNames(
|
|
@@ -653,7 +709,7 @@ function GridGroupRowComponent({
|
|
|
653
709
|
count,
|
|
654
710
|
")"
|
|
655
711
|
] }),
|
|
656
|
-
aggregates.length > 0 && /* @__PURE__ */
|
|
712
|
+
aggregates.length > 0 && /* @__PURE__ */ jsx5("span", { className: "gridkit-group-aggregates", children: aggregates.map((spec) => {
|
|
657
713
|
const key = spec.id ?? spec.columnId;
|
|
658
714
|
const aggregateValue = results.get(key);
|
|
659
715
|
const column = definitions.get(spec.columnId);
|
|
@@ -686,7 +742,21 @@ var GridGroupRow_default = GridGroupRow;
|
|
|
686
742
|
|
|
687
743
|
// src/DataGrid/components/GridGroupSummaryRow.tsx
|
|
688
744
|
import { memo as memo2 } from "react";
|
|
689
|
-
|
|
745
|
+
|
|
746
|
+
// src/DataGrid/textAlign.ts
|
|
747
|
+
function textAlignFor(alignment) {
|
|
748
|
+
switch (alignment) {
|
|
749
|
+
case "left":
|
|
750
|
+
return "start";
|
|
751
|
+
case "right":
|
|
752
|
+
return "end";
|
|
753
|
+
case "center":
|
|
754
|
+
return "center";
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// src/DataGrid/components/GridGroupSummaryRow.tsx
|
|
759
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
690
760
|
function GridGroupSummaryRowComponent({
|
|
691
761
|
groupId,
|
|
692
762
|
level,
|
|
@@ -698,7 +768,7 @@ function GridGroupSummaryRowComponent({
|
|
|
698
768
|
locale,
|
|
699
769
|
ref
|
|
700
770
|
}) {
|
|
701
|
-
return /* @__PURE__ */
|
|
771
|
+
return /* @__PURE__ */ jsx6(
|
|
702
772
|
"tr",
|
|
703
773
|
{
|
|
704
774
|
ref,
|
|
@@ -719,10 +789,16 @@ function GridGroupSummaryRowComponent({
|
|
|
719
789
|
{
|
|
720
790
|
role: "gridcell",
|
|
721
791
|
"data-gridkit-column": entry.id,
|
|
722
|
-
className:
|
|
723
|
-
|
|
792
|
+
className: classNames(
|
|
793
|
+
"gridkit-grid-group-summary-cell",
|
|
794
|
+
pinnedCellClassNames(entry)
|
|
795
|
+
),
|
|
796
|
+
style: {
|
|
797
|
+
textAlign: textAlignFor(specs[0]?.alignment ?? entry.alignment),
|
|
798
|
+
...pinnedCellStyle(entry)
|
|
799
|
+
},
|
|
724
800
|
children: [
|
|
725
|
-
entry.id === columns[0]?.id && /* @__PURE__ */
|
|
801
|
+
entry.id === columns[0]?.id && /* @__PURE__ */ jsx6(
|
|
726
802
|
"span",
|
|
727
803
|
{
|
|
728
804
|
className: "gridkit-grid-group-summary-indent",
|
|
@@ -760,13 +836,16 @@ import {
|
|
|
760
836
|
formatCellValue
|
|
761
837
|
} from "@gridkitjs/core";
|
|
762
838
|
import { memo as memo3 } from "react";
|
|
763
|
-
import { jsx as
|
|
839
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
764
840
|
function GridRowComponent({
|
|
765
841
|
columns,
|
|
766
842
|
rowId,
|
|
767
843
|
row,
|
|
768
844
|
rowIndex,
|
|
769
845
|
datasetIndex,
|
|
846
|
+
groupLevel,
|
|
847
|
+
groupPosition,
|
|
848
|
+
groupSetSize,
|
|
770
849
|
activeColumnId,
|
|
771
850
|
selectedColumnIds,
|
|
772
851
|
selected,
|
|
@@ -785,7 +864,7 @@ function GridRowComponent({
|
|
|
785
864
|
cellsSelectable ? "Space Enter" : "",
|
|
786
865
|
contextMenu ? "Shift+F10" : ""
|
|
787
866
|
].filter(Boolean).join(" ");
|
|
788
|
-
return /* @__PURE__ */
|
|
867
|
+
return /* @__PURE__ */ jsx7(
|
|
789
868
|
"tr",
|
|
790
869
|
{
|
|
791
870
|
...rowAttributes,
|
|
@@ -794,16 +873,20 @@ function GridRowComponent({
|
|
|
794
873
|
"aria-rowindex": datasetIndex + 2,
|
|
795
874
|
"data-gridkit-row-index": rowIndex,
|
|
796
875
|
"data-gridkit-row-id": rowId,
|
|
876
|
+
"aria-level": groupLevel === void 0 ? void 0 : groupLevel + 1,
|
|
877
|
+
"aria-posinset": groupPosition,
|
|
878
|
+
"aria-setsize": groupSetSize,
|
|
797
879
|
...ariaAttr(rowsSelectable, "aria-selected", selected),
|
|
798
880
|
className: classNames(
|
|
799
881
|
"gridkit-grid-row",
|
|
800
882
|
selected ? "is-selected" : "",
|
|
801
883
|
rowClassName
|
|
802
884
|
),
|
|
803
|
-
children: columns.map((
|
|
885
|
+
children: columns.map((entry, columnIndex) => {
|
|
886
|
+
const { id, column, alignment } = entry;
|
|
804
887
|
const value = accessDotted(row, column.field);
|
|
805
888
|
const cellSelected = id === selectedColumnId;
|
|
806
|
-
return /* @__PURE__ */
|
|
889
|
+
return /* @__PURE__ */ jsx7(
|
|
807
890
|
"td",
|
|
808
891
|
{
|
|
809
892
|
role: "gridcell",
|
|
@@ -817,9 +900,13 @@ function GridRowComponent({
|
|
|
817
900
|
id === activeColumnId ? "is-resizing" : "",
|
|
818
901
|
cellSelected || selectedColumnIds.has(id) ? "is-selected" : "",
|
|
819
902
|
column.wrap?.cells ? "is-wrapped" : "",
|
|
903
|
+
pinnedCellClassNames(entry),
|
|
820
904
|
column.cellClassName ?? ""
|
|
821
905
|
),
|
|
822
|
-
style: {
|
|
906
|
+
style: {
|
|
907
|
+
textAlign: textAlignFor(alignment),
|
|
908
|
+
...pinnedCellStyle(entry)
|
|
909
|
+
},
|
|
823
910
|
children: column.cellTemplate ? column.cellTemplate({
|
|
824
911
|
value,
|
|
825
912
|
row,
|
|
@@ -839,28 +926,7 @@ var GridRow = memo3(GridRowComponent);
|
|
|
839
926
|
var GridRow_default = GridRow;
|
|
840
927
|
|
|
841
928
|
// src/DataGrid/components/GridBody.tsx
|
|
842
|
-
import { Fragment, jsx as
|
|
843
|
-
function groupAriaMeta(rows) {
|
|
844
|
-
const totals = /* @__PURE__ */ new Map();
|
|
845
|
-
for (const entry of rows) {
|
|
846
|
-
if (entry.kind !== "group") continue;
|
|
847
|
-
const parentKey = groupRowId(entry.path.slice(0, -1));
|
|
848
|
-
totals.set(parentKey, (totals.get(parentKey) ?? 0) + 1);
|
|
849
|
-
}
|
|
850
|
-
const seen = /* @__PURE__ */ new Map();
|
|
851
|
-
const meta = /* @__PURE__ */ new Map();
|
|
852
|
-
for (const entry of rows) {
|
|
853
|
-
if (entry.kind !== "group") continue;
|
|
854
|
-
const parentKey = groupRowId(entry.path.slice(0, -1));
|
|
855
|
-
const posinset = (seen.get(parentKey) ?? 0) + 1;
|
|
856
|
-
seen.set(parentKey, posinset);
|
|
857
|
-
meta.set(entry.groupId, {
|
|
858
|
-
posinset,
|
|
859
|
-
setsize: totals.get(parentKey) ?? posinset
|
|
860
|
-
});
|
|
861
|
-
}
|
|
862
|
-
return meta;
|
|
863
|
-
}
|
|
929
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
864
930
|
function GridBody({
|
|
865
931
|
columns,
|
|
866
932
|
definitions,
|
|
@@ -874,6 +940,9 @@ function GridBody({
|
|
|
874
940
|
virtualRange,
|
|
875
941
|
infiniteScroll,
|
|
876
942
|
sentinelRef,
|
|
943
|
+
empty,
|
|
944
|
+
emptyTemplate,
|
|
945
|
+
viewportWidth,
|
|
877
946
|
locale,
|
|
878
947
|
getRowProps,
|
|
879
948
|
onRowClick,
|
|
@@ -883,7 +952,6 @@ function GridBody({
|
|
|
883
952
|
groupMenu
|
|
884
953
|
}) {
|
|
885
954
|
const { selectedCell, rowMode, cellMode, toggleOnClick } = selection;
|
|
886
|
-
const ariaMeta = useMemo2(() => groupAriaMeta(rows), [rows]);
|
|
887
955
|
const visibleRows = virtualRange === null ? rows : rows.slice(virtualRange.startIndex, virtualRange.endIndex + 1);
|
|
888
956
|
const { booleanTrue, booleanFalse, blankGroupValue } = messages;
|
|
889
957
|
const cellMessages = useMemo2(
|
|
@@ -941,7 +1009,7 @@ function GridBody({
|
|
|
941
1009
|
return /* @__PURE__ */ jsxs5(
|
|
942
1010
|
"tbody",
|
|
943
1011
|
{
|
|
944
|
-
role: "
|
|
1012
|
+
role: "presentation",
|
|
945
1013
|
className: "gridkit-grid-body",
|
|
946
1014
|
onFocus: (event) => {
|
|
947
1015
|
const group = groupRowFrom(event.target);
|
|
@@ -1006,7 +1074,7 @@ function GridBody({
|
|
|
1006
1074
|
// to give the browser's scrollbar the correct total height and thumb
|
|
1007
1075
|
// position, the same way `GridFooter`'s `<tfoot>` isn't a "row" to
|
|
1008
1076
|
// any of this grid's own row-counting logic.
|
|
1009
|
-
/* @__PURE__ */
|
|
1077
|
+
/* @__PURE__ */ jsx8("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx8(
|
|
1010
1078
|
"td",
|
|
1011
1079
|
{
|
|
1012
1080
|
style: {
|
|
@@ -1020,7 +1088,7 @@ function GridBody({
|
|
|
1020
1088
|
switch (entry.kind) {
|
|
1021
1089
|
case "data": {
|
|
1022
1090
|
const rowProps = rowPropsOf(entry.rowId);
|
|
1023
|
-
return /* @__PURE__ */
|
|
1091
|
+
return /* @__PURE__ */ jsx8(
|
|
1024
1092
|
GridRow_default,
|
|
1025
1093
|
{
|
|
1026
1094
|
ref: virtualRange?.measureRow(entry.rowIndex),
|
|
@@ -1029,6 +1097,9 @@ function GridBody({
|
|
|
1029
1097
|
row: entry.row,
|
|
1030
1098
|
rowIndex: entry.rowIndex,
|
|
1031
1099
|
datasetIndex: entry.datasetIndex,
|
|
1100
|
+
groupLevel: entry.groupPosition?.level,
|
|
1101
|
+
groupPosition: entry.groupPosition?.position,
|
|
1102
|
+
groupSetSize: entry.groupPosition?.setSize,
|
|
1032
1103
|
activeColumnId,
|
|
1033
1104
|
selectedColumnIds: selection.selectedColumnIds,
|
|
1034
1105
|
selected: selection.selectedRowIds.has(entry.rowId),
|
|
@@ -1049,7 +1120,7 @@ function GridBody({
|
|
|
1049
1120
|
);
|
|
1050
1121
|
}
|
|
1051
1122
|
case "group-summary":
|
|
1052
|
-
return /* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ jsx8(
|
|
1053
1124
|
GridGroupSummaryRow_default,
|
|
1054
1125
|
{
|
|
1055
1126
|
ref: virtualRange?.measureRow(entry.rowIndex),
|
|
@@ -1065,7 +1136,7 @@ function GridBody({
|
|
|
1065
1136
|
`${entry.groupId}-summary`
|
|
1066
1137
|
);
|
|
1067
1138
|
case "group":
|
|
1068
|
-
return /* @__PURE__ */
|
|
1139
|
+
return /* @__PURE__ */ jsx8(
|
|
1069
1140
|
GridGroupRow_default,
|
|
1070
1141
|
{
|
|
1071
1142
|
ref: virtualRange?.measureRow(entry.rowIndex),
|
|
@@ -1078,8 +1149,8 @@ function GridBody({
|
|
|
1078
1149
|
count: entry.count,
|
|
1079
1150
|
rowIndex: entry.rowIndex,
|
|
1080
1151
|
datasetIndex: entry.datasetIndex,
|
|
1081
|
-
posinset:
|
|
1082
|
-
setsize:
|
|
1152
|
+
posinset: entry.position,
|
|
1153
|
+
setsize: entry.setSize,
|
|
1083
1154
|
aggregates: groupAggregateDisplay === "inline" ? aggregates : [],
|
|
1084
1155
|
results: entry.aggregates,
|
|
1085
1156
|
definitions,
|
|
@@ -1094,7 +1165,15 @@ function GridBody({
|
|
|
1094
1165
|
return entry;
|
|
1095
1166
|
}
|
|
1096
1167
|
}),
|
|
1097
|
-
|
|
1168
|
+
empty !== null && /* @__PURE__ */ jsx8(
|
|
1169
|
+
GridEmptyRow,
|
|
1170
|
+
{
|
|
1171
|
+
columnCount: columns.length,
|
|
1172
|
+
viewportWidth,
|
|
1173
|
+
children: emptyTemplate ? emptyTemplate(empty) : empty.filtered ? messages.noMatchingRows : messages.noRows
|
|
1174
|
+
}
|
|
1175
|
+
),
|
|
1176
|
+
virtualRange !== null && virtualRange.offsetAfter > 0 && /* @__PURE__ */ jsx8("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx8(
|
|
1098
1177
|
"td",
|
|
1099
1178
|
{
|
|
1100
1179
|
style: {
|
|
@@ -1105,7 +1184,7 @@ function GridBody({
|
|
|
1105
1184
|
}
|
|
1106
1185
|
) }),
|
|
1107
1186
|
infiniteScroll?.hasMore && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1108
|
-
infiniteScroll.isLoadingMore === true && /* @__PURE__ */
|
|
1187
|
+
infiniteScroll.isLoadingMore === true && /* @__PURE__ */ jsx8("tr", { "aria-hidden": "true", className: "gridkit-grid-loading-row", children: /* @__PURE__ */ jsx8(
|
|
1109
1188
|
"td",
|
|
1110
1189
|
{
|
|
1111
1190
|
colSpan: columns.length,
|
|
@@ -1113,13 +1192,13 @@ function GridBody({
|
|
|
1113
1192
|
children: infiniteScroll.loadingTemplate ? infiniteScroll.loadingTemplate() : messages.loadingMore
|
|
1114
1193
|
}
|
|
1115
1194
|
) }),
|
|
1116
|
-
/* @__PURE__ */
|
|
1195
|
+
/* @__PURE__ */ jsx8(
|
|
1117
1196
|
"tr",
|
|
1118
1197
|
{
|
|
1119
1198
|
"aria-hidden": "true",
|
|
1120
1199
|
ref: sentinelRef,
|
|
1121
1200
|
className: "gridkit-grid-sentinel-row",
|
|
1122
|
-
children: /* @__PURE__ */
|
|
1201
|
+
children: /* @__PURE__ */ jsx8(
|
|
1123
1202
|
"td",
|
|
1124
1203
|
{
|
|
1125
1204
|
colSpan: columns.length,
|
|
@@ -1135,7 +1214,7 @@ function GridBody({
|
|
|
1135
1214
|
}
|
|
1136
1215
|
|
|
1137
1216
|
// src/DataGrid/components/GridFooter.tsx
|
|
1138
|
-
import { jsx as
|
|
1217
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1139
1218
|
function GridFooter({
|
|
1140
1219
|
columns,
|
|
1141
1220
|
aggregates,
|
|
@@ -1144,7 +1223,7 @@ function GridFooter({
|
|
|
1144
1223
|
locale,
|
|
1145
1224
|
ariaRowIndex
|
|
1146
1225
|
}) {
|
|
1147
|
-
return /* @__PURE__ */
|
|
1226
|
+
return /* @__PURE__ */ jsx9("tfoot", { role: "rowgroup", children: /* @__PURE__ */ jsx9(
|
|
1148
1227
|
"tr",
|
|
1149
1228
|
{
|
|
1150
1229
|
className: "gridkit-grid-footer",
|
|
@@ -1154,13 +1233,19 @@ function GridFooter({
|
|
|
1154
1233
|
const specs = aggregates.filter(
|
|
1155
1234
|
(candidate) => candidate.columnId === entry.id
|
|
1156
1235
|
);
|
|
1157
|
-
return /* @__PURE__ */
|
|
1236
|
+
return /* @__PURE__ */ jsx9(
|
|
1158
1237
|
"td",
|
|
1159
1238
|
{
|
|
1160
1239
|
role: "gridcell",
|
|
1161
1240
|
"data-gridkit-column": entry.id,
|
|
1162
|
-
className:
|
|
1163
|
-
|
|
1241
|
+
className: classNames(
|
|
1242
|
+
"gridkit-grid-footer-cell",
|
|
1243
|
+
pinnedCellClassNames(entry)
|
|
1244
|
+
),
|
|
1245
|
+
style: {
|
|
1246
|
+
textAlign: textAlignFor(specs[0]?.alignment ?? entry.alignment),
|
|
1247
|
+
...pinnedCellStyle(entry)
|
|
1248
|
+
},
|
|
1164
1249
|
children: specs.map(
|
|
1165
1250
|
(spec) => renderAggregate(
|
|
1166
1251
|
results.get(spec.id ?? spec.columnId),
|
|
@@ -1180,9 +1265,40 @@ function GridFooter({
|
|
|
1180
1265
|
) });
|
|
1181
1266
|
}
|
|
1182
1267
|
|
|
1268
|
+
// src/DataGrid/components/GridLoadingOverlay.tsx
|
|
1269
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1270
|
+
function GridLoadingOverlay({
|
|
1271
|
+
empty,
|
|
1272
|
+
viewportWidth,
|
|
1273
|
+
children
|
|
1274
|
+
}) {
|
|
1275
|
+
const contentStyle = viewportWidth === null ? void 0 : {
|
|
1276
|
+
"--gridkit-loading-width": `${String(viewportWidth)}px`
|
|
1277
|
+
};
|
|
1278
|
+
return /* @__PURE__ */ jsx10(
|
|
1279
|
+
"div",
|
|
1280
|
+
{
|
|
1281
|
+
role: "row",
|
|
1282
|
+
className: classNames(
|
|
1283
|
+
"gridkit-grid-loading-overlay",
|
|
1284
|
+
empty && "is-empty"
|
|
1285
|
+
),
|
|
1286
|
+
children: /* @__PURE__ */ jsx10(
|
|
1287
|
+
"div",
|
|
1288
|
+
{
|
|
1289
|
+
role: "gridcell",
|
|
1290
|
+
className: "gridkit-grid-loading-overlay-content",
|
|
1291
|
+
style: contentStyle,
|
|
1292
|
+
children
|
|
1293
|
+
}
|
|
1294
|
+
)
|
|
1295
|
+
}
|
|
1296
|
+
);
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1183
1299
|
// src/DataGrid/components/GridPager.tsx
|
|
1184
1300
|
import { paginationWindow } from "@gridkitjs/core/renderer";
|
|
1185
|
-
import { jsx as
|
|
1301
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1186
1302
|
function PagerNavButton({
|
|
1187
1303
|
className,
|
|
1188
1304
|
label,
|
|
@@ -1190,7 +1306,7 @@ function PagerNavButton({
|
|
|
1190
1306
|
onClick,
|
|
1191
1307
|
children
|
|
1192
1308
|
}) {
|
|
1193
|
-
return /* @__PURE__ */
|
|
1309
|
+
return /* @__PURE__ */ jsx11(
|
|
1194
1310
|
"button",
|
|
1195
1311
|
{
|
|
1196
1312
|
type: "button",
|
|
@@ -1206,13 +1322,15 @@ function PagerNavButton({
|
|
|
1206
1322
|
);
|
|
1207
1323
|
}
|
|
1208
1324
|
function GridPager({ pager, config, messages }) {
|
|
1209
|
-
const { pagination
|
|
1325
|
+
const { pagination } = pager;
|
|
1326
|
+
const pageCount = Math.max(1, pager.pageCount);
|
|
1327
|
+
const currentPage = Math.max(1, pager.currentPage);
|
|
1210
1328
|
const variant = config?.variant ?? "compact";
|
|
1211
1329
|
const sizeOptions = config?.sizeOptions;
|
|
1212
1330
|
const atFirst = pagination.pageIndex <= 0;
|
|
1213
1331
|
const atLast = pagination.pageIndex >= pageCount - 1;
|
|
1214
1332
|
const barStyle = {
|
|
1215
|
-
"--gridkit-pager-digits": String(String(
|
|
1333
|
+
"--gridkit-pager-digits": String(String(pageCount).length)
|
|
1216
1334
|
};
|
|
1217
1335
|
return /* @__PURE__ */ jsxs6(
|
|
1218
1336
|
"div",
|
|
@@ -1222,7 +1340,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1222
1340
|
"aria-label": messages.pagerLabel,
|
|
1223
1341
|
children: [
|
|
1224
1342
|
/* @__PURE__ */ jsxs6("div", { className: "gridkit-grid-pager-bar", style: barStyle, children: [
|
|
1225
|
-
/* @__PURE__ */
|
|
1343
|
+
/* @__PURE__ */ jsx11(
|
|
1226
1344
|
PagerNavButton,
|
|
1227
1345
|
{
|
|
1228
1346
|
className: "gridkit-grid-pager-first",
|
|
@@ -1231,10 +1349,10 @@ function GridPager({ pager, config, messages }) {
|
|
|
1231
1349
|
onClick: () => {
|
|
1232
1350
|
pager.goToPage(0);
|
|
1233
1351
|
},
|
|
1234
|
-
children: /* @__PURE__ */
|
|
1352
|
+
children: /* @__PURE__ */ jsx11(ChevronsLeftIcon, {})
|
|
1235
1353
|
}
|
|
1236
1354
|
),
|
|
1237
|
-
/* @__PURE__ */
|
|
1355
|
+
/* @__PURE__ */ jsx11(
|
|
1238
1356
|
PagerNavButton,
|
|
1239
1357
|
{
|
|
1240
1358
|
className: "gridkit-grid-pager-previous",
|
|
@@ -1243,14 +1361,14 @@ function GridPager({ pager, config, messages }) {
|
|
|
1243
1361
|
onClick: () => {
|
|
1244
1362
|
pager.previousPage();
|
|
1245
1363
|
},
|
|
1246
|
-
children: /* @__PURE__ */
|
|
1364
|
+
children: /* @__PURE__ */ jsx11(ChevronLeftIcon, {})
|
|
1247
1365
|
}
|
|
1248
1366
|
),
|
|
1249
1367
|
variant === "numbered" ? paginationWindow(currentPage, pageCount, {
|
|
1250
1368
|
boundaryCount: config?.boundaryCount,
|
|
1251
1369
|
siblingCount: config?.siblingCount
|
|
1252
1370
|
}).map(
|
|
1253
|
-
(entry, index) => entry === "ellipsis" ? /* @__PURE__ */
|
|
1371
|
+
(entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx11(
|
|
1254
1372
|
"span",
|
|
1255
1373
|
{
|
|
1256
1374
|
className: "gridkit-grid-pager-ellipsis",
|
|
@@ -1258,7 +1376,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1258
1376
|
children: "\u2026"
|
|
1259
1377
|
},
|
|
1260
1378
|
`ellipsis-${String(index)}`
|
|
1261
|
-
) : /* @__PURE__ */
|
|
1379
|
+
) : /* @__PURE__ */ jsx11(
|
|
1262
1380
|
"button",
|
|
1263
1381
|
{
|
|
1264
1382
|
type: "button",
|
|
@@ -1273,11 +1391,8 @@ function GridPager({ pager, config, messages }) {
|
|
|
1273
1391
|
entry
|
|
1274
1392
|
)
|
|
1275
1393
|
) : /* @__PURE__ */ jsxs6("span", { className: "gridkit-grid-pager-status-slot", children: [
|
|
1276
|
-
/* @__PURE__ */
|
|
1277
|
-
|
|
1278
|
-
pageCount
|
|
1279
|
-
) }),
|
|
1280
|
-
/* @__PURE__ */ jsx9(
|
|
1394
|
+
/* @__PURE__ */ jsx11("span", { className: "gridkit-grid-pager-status", children: messages.pageStatus(currentPage, pageCount) }),
|
|
1395
|
+
/* @__PURE__ */ jsx11(
|
|
1281
1396
|
"span",
|
|
1282
1397
|
{
|
|
1283
1398
|
className: "gridkit-grid-pager-status-sizer",
|
|
@@ -1286,7 +1401,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1286
1401
|
}
|
|
1287
1402
|
)
|
|
1288
1403
|
] }),
|
|
1289
|
-
/* @__PURE__ */
|
|
1404
|
+
/* @__PURE__ */ jsx11(
|
|
1290
1405
|
PagerNavButton,
|
|
1291
1406
|
{
|
|
1292
1407
|
className: "gridkit-grid-pager-next",
|
|
@@ -1295,10 +1410,10 @@ function GridPager({ pager, config, messages }) {
|
|
|
1295
1410
|
onClick: () => {
|
|
1296
1411
|
pager.nextPage();
|
|
1297
1412
|
},
|
|
1298
|
-
children: /* @__PURE__ */
|
|
1413
|
+
children: /* @__PURE__ */ jsx11(ChevronRightIcon, {})
|
|
1299
1414
|
}
|
|
1300
1415
|
),
|
|
1301
|
-
/* @__PURE__ */
|
|
1416
|
+
/* @__PURE__ */ jsx11(
|
|
1302
1417
|
PagerNavButton,
|
|
1303
1418
|
{
|
|
1304
1419
|
className: "gridkit-grid-pager-last",
|
|
@@ -1307,22 +1422,22 @@ function GridPager({ pager, config, messages }) {
|
|
|
1307
1422
|
onClick: () => {
|
|
1308
1423
|
pager.goToPage(pageCount - 1);
|
|
1309
1424
|
},
|
|
1310
|
-
children: /* @__PURE__ */
|
|
1425
|
+
children: /* @__PURE__ */ jsx11(ChevronsRightIcon, {})
|
|
1311
1426
|
}
|
|
1312
1427
|
)
|
|
1313
1428
|
] }),
|
|
1314
1429
|
sizeOptions !== void 0 && sizeOptions.length > 0 && /* @__PURE__ */ jsxs6("label", { className: "gridkit-grid-pager-page-size", children: [
|
|
1315
|
-
/* @__PURE__ */
|
|
1430
|
+
/* @__PURE__ */ jsx11(
|
|
1316
1431
|
"select",
|
|
1317
1432
|
{
|
|
1318
1433
|
value: pagination.pageSize,
|
|
1319
1434
|
onChange: (event) => {
|
|
1320
1435
|
pager.setPageSize(Number(event.target.value));
|
|
1321
1436
|
},
|
|
1322
|
-
children: sizeOptions.map((size) => /* @__PURE__ */
|
|
1437
|
+
children: sizeOptions.map((size) => /* @__PURE__ */ jsx11("option", { value: size, children: size }, size))
|
|
1323
1438
|
}
|
|
1324
1439
|
),
|
|
1325
|
-
/* @__PURE__ */
|
|
1440
|
+
/* @__PURE__ */ jsx11("span", { className: "gridkit-grid-pager-page-size-label", children: messages.pageSizeLabel })
|
|
1326
1441
|
] })
|
|
1327
1442
|
]
|
|
1328
1443
|
}
|
|
@@ -1334,7 +1449,11 @@ import { createPortal as createPortal2 } from "react-dom";
|
|
|
1334
1449
|
import {
|
|
1335
1450
|
resolveColumnLabel as resolveColumnLabel2
|
|
1336
1451
|
} from "@gridkitjs/core";
|
|
1337
|
-
import {
|
|
1452
|
+
import {
|
|
1453
|
+
inlineStep as inlineStep2,
|
|
1454
|
+
resolveKeyboardDropTarget
|
|
1455
|
+
} from "@gridkitjs/core/renderer";
|
|
1456
|
+
import { writingDirection as writingDirection3 } from "@gridkitjs/dom";
|
|
1338
1457
|
|
|
1339
1458
|
// src/DataGrid/useGroupByDrag.ts
|
|
1340
1459
|
import {
|
|
@@ -1450,7 +1569,7 @@ function useGroupByDrag({
|
|
|
1450
1569
|
}
|
|
1451
1570
|
|
|
1452
1571
|
// src/DataGrid/components/GroupByBar.tsx
|
|
1453
|
-
import { jsx as
|
|
1572
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1454
1573
|
function GroupByBar({
|
|
1455
1574
|
columns,
|
|
1456
1575
|
definitions,
|
|
@@ -1499,7 +1618,7 @@ function GroupByBar({
|
|
|
1499
1618
|
role: "group",
|
|
1500
1619
|
"aria-label": messages.groupByBarLabel,
|
|
1501
1620
|
children: [
|
|
1502
|
-
showPlaceholder && /* @__PURE__ */
|
|
1621
|
+
showPlaceholder && /* @__PURE__ */ jsx12("span", { className: "gridkit-group-by-bar-placeholder", children: messages.groupByBarPlaceholder }),
|
|
1503
1622
|
groupBy.map((entry, index) => {
|
|
1504
1623
|
const dropBefore = activeDropTarget?.beforeColumnId === entry.columnId;
|
|
1505
1624
|
const dropAfter = activeDropTarget?.beforeColumnId === null && index === groupBy.length - 1;
|
|
@@ -1525,18 +1644,18 @@ function GroupByBar({
|
|
|
1525
1644
|
chipDrag.startDrag(entry.columnId, event);
|
|
1526
1645
|
},
|
|
1527
1646
|
onKeyDown: (event) => {
|
|
1528
|
-
const
|
|
1529
|
-
|
|
1647
|
+
const step = inlineStep2(
|
|
1648
|
+
event.key,
|
|
1649
|
+
writingDirection3(event.currentTarget)
|
|
1650
|
+
);
|
|
1651
|
+
if (step !== null && event.ctrlKey) {
|
|
1530
1652
|
event.preventDefault();
|
|
1531
|
-
moveByKeyboard(
|
|
1532
|
-
entry.columnId,
|
|
1533
|
-
event.key === "ArrowLeft" ? -1 : 1
|
|
1534
|
-
);
|
|
1653
|
+
moveByKeyboard(entry.columnId, step);
|
|
1535
1654
|
}
|
|
1536
1655
|
},
|
|
1537
1656
|
children: [
|
|
1538
|
-
/* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1657
|
+
/* @__PURE__ */ jsx12("span", { className: "gridkit-group-by-chip-label", children: labelFor(entry.columnId) }),
|
|
1658
|
+
/* @__PURE__ */ jsx12(
|
|
1540
1659
|
"button",
|
|
1541
1660
|
{
|
|
1542
1661
|
type: "button",
|
|
@@ -1557,7 +1676,7 @@ function GroupByBar({
|
|
|
1557
1676
|
);
|
|
1558
1677
|
}),
|
|
1559
1678
|
chipDrag.draggedColumnId !== null && chipDrag.ghostTransform !== null && createPortal2(
|
|
1560
|
-
/* @__PURE__ */
|
|
1679
|
+
/* @__PURE__ */ jsx12(
|
|
1561
1680
|
"span",
|
|
1562
1681
|
{
|
|
1563
1682
|
className: "gridkit-group-by-chip gridkit-drag-ghost",
|
|
@@ -1576,7 +1695,8 @@ function GroupByBar({
|
|
|
1576
1695
|
// src/DataGrid/announcedCallbacks.ts
|
|
1577
1696
|
import {
|
|
1578
1697
|
isColumnVisible,
|
|
1579
|
-
isGroupExpanded
|
|
1698
|
+
isGroupExpanded,
|
|
1699
|
+
resolveColumnPin
|
|
1580
1700
|
} from "@gridkitjs/core";
|
|
1581
1701
|
function announcedCallbacks({
|
|
1582
1702
|
callbacks,
|
|
@@ -1630,6 +1750,26 @@ function announcedCallbacks({
|
|
|
1630
1750
|
shown ? messages.columnShown(columnName(columnId)) : messages.columnHidden(columnName(columnId))
|
|
1631
1751
|
);
|
|
1632
1752
|
},
|
|
1753
|
+
/**
|
|
1754
|
+
* Naming the one column pinned or unpinned and the edge it went to. A
|
|
1755
|
+
* change touching several columns, as `setColumnPinning` or restoring a
|
|
1756
|
+
* layout can, may pin some and unpin others, and says nothing.
|
|
1757
|
+
*/
|
|
1758
|
+
onColumnPinningChange: (event) => {
|
|
1759
|
+
callbacks.onColumnPinningChange?.(event);
|
|
1760
|
+
const [columnId, ...others] = event.columnIds;
|
|
1761
|
+
if (columnId === void 0 || others.length > 0) {
|
|
1762
|
+
return;
|
|
1763
|
+
}
|
|
1764
|
+
const column = columnOf(columnId);
|
|
1765
|
+
if (column === void 0) {
|
|
1766
|
+
return;
|
|
1767
|
+
}
|
|
1768
|
+
const pin = resolveColumnPin(column, event.pinning);
|
|
1769
|
+
announce(
|
|
1770
|
+
pin === "none" ? messages.columnUnpinned(columnName(columnId)) : messages.columnPinned(columnName(columnId), pin)
|
|
1771
|
+
);
|
|
1772
|
+
},
|
|
1633
1773
|
/** A toggle, a stack, or a clear back to "none" each get their own. */
|
|
1634
1774
|
onColumnSortChange: (event) => {
|
|
1635
1775
|
callbacks.onColumnSortChange?.(event);
|
|
@@ -1687,7 +1827,10 @@ function announcedCallbacks({
|
|
|
1687
1827
|
onPaginationChange: (event) => {
|
|
1688
1828
|
callbacks.onPaginationChange?.(event);
|
|
1689
1829
|
announce(
|
|
1690
|
-
messages.pageStatus(
|
|
1830
|
+
messages.pageStatus(
|
|
1831
|
+
event.pagination.pageIndex + 1,
|
|
1832
|
+
Math.max(1, event.pageCount)
|
|
1833
|
+
)
|
|
1691
1834
|
);
|
|
1692
1835
|
},
|
|
1693
1836
|
/**
|
|
@@ -1977,20 +2120,27 @@ import {
|
|
|
1977
2120
|
import { useLayoutEffect as useLayoutEffect3, useRef as useRef5 } from "react";
|
|
1978
2121
|
import { createPortal as createPortal3 } from "react-dom";
|
|
1979
2122
|
import {
|
|
1980
|
-
attachOverlay
|
|
2123
|
+
attachOverlay,
|
|
2124
|
+
writingDirection as writingDirection4
|
|
1981
2125
|
} from "@gridkitjs/dom";
|
|
1982
|
-
import { jsx as
|
|
2126
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1983
2127
|
var ANCHOR_GAP = 4;
|
|
1984
2128
|
function attachedFocus(focus) {
|
|
1985
2129
|
return typeof focus === "object" && !(focus instanceof HTMLElement) ? focus.current ?? "first" : focus;
|
|
1986
2130
|
}
|
|
1987
|
-
function
|
|
2131
|
+
function themeClassNameOf(element) {
|
|
1988
2132
|
const scope = element?.closest(".gridkit-light, .gridkit-dark");
|
|
1989
2133
|
if (scope === null || scope === void 0) {
|
|
1990
2134
|
return "";
|
|
1991
2135
|
}
|
|
1992
2136
|
return scope.classList.contains("gridkit-dark") ? "gridkit-dark" : "gridkit-light";
|
|
1993
2137
|
}
|
|
2138
|
+
function overlayScope(element) {
|
|
2139
|
+
return {
|
|
2140
|
+
themeClassName: themeClassNameOf(element),
|
|
2141
|
+
direction: writingDirection4(element ?? document.documentElement)
|
|
2142
|
+
};
|
|
2143
|
+
}
|
|
1994
2144
|
function Overlay({
|
|
1995
2145
|
anchor,
|
|
1996
2146
|
placement,
|
|
@@ -2001,7 +2151,7 @@ function Overlay({
|
|
|
2001
2151
|
returnFocusFallback,
|
|
2002
2152
|
ignoreScrollAfterInput,
|
|
2003
2153
|
trapFocus,
|
|
2004
|
-
|
|
2154
|
+
scope,
|
|
2005
2155
|
onDismiss,
|
|
2006
2156
|
children
|
|
2007
2157
|
}) {
|
|
@@ -2041,11 +2191,12 @@ function Overlay({
|
|
|
2041
2191
|
trapFocus
|
|
2042
2192
|
]);
|
|
2043
2193
|
return createPortal3(
|
|
2044
|
-
/* @__PURE__ */
|
|
2194
|
+
/* @__PURE__ */ jsx13(
|
|
2045
2195
|
"div",
|
|
2046
2196
|
{
|
|
2047
2197
|
ref: panelRef,
|
|
2048
|
-
className: classNames("gridkit-overlay", themeClassName),
|
|
2198
|
+
className: classNames("gridkit-overlay", scope.themeClassName),
|
|
2199
|
+
dir: scope.direction,
|
|
2049
2200
|
children
|
|
2050
2201
|
}
|
|
2051
2202
|
),
|
|
@@ -2054,42 +2205,42 @@ function Overlay({
|
|
|
2054
2205
|
}
|
|
2055
2206
|
|
|
2056
2207
|
// src/DataGrid/menu/menuIcons.tsx
|
|
2057
|
-
import { jsx as
|
|
2208
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2058
2209
|
var BUILT_IN_ICONS = {
|
|
2059
2210
|
sortAscending: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2060
|
-
/* @__PURE__ */
|
|
2061
|
-
/* @__PURE__ */
|
|
2062
|
-
/* @__PURE__ */
|
|
2063
|
-
/* @__PURE__ */
|
|
2064
|
-
/* @__PURE__ */
|
|
2211
|
+
/* @__PURE__ */ jsx14("path", { d: "m3 8 4-4 4 4" }),
|
|
2212
|
+
/* @__PURE__ */ jsx14("path", { d: "M7 4v16" }),
|
|
2213
|
+
/* @__PURE__ */ jsx14("path", { d: "M11 12h4" }),
|
|
2214
|
+
/* @__PURE__ */ jsx14("path", { d: "M11 16h7" }),
|
|
2215
|
+
/* @__PURE__ */ jsx14("path", { d: "M11 20h10" })
|
|
2065
2216
|
] }),
|
|
2066
2217
|
sortDescending: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2067
|
-
/* @__PURE__ */
|
|
2068
|
-
/* @__PURE__ */
|
|
2069
|
-
/* @__PURE__ */
|
|
2070
|
-
/* @__PURE__ */
|
|
2071
|
-
/* @__PURE__ */
|
|
2218
|
+
/* @__PURE__ */ jsx14("path", { d: "m3 16 4 4 4-4" }),
|
|
2219
|
+
/* @__PURE__ */ jsx14("path", { d: "M7 20V4" }),
|
|
2220
|
+
/* @__PURE__ */ jsx14("path", { d: "M11 4h10" }),
|
|
2221
|
+
/* @__PURE__ */ jsx14("path", { d: "M11 8h7" }),
|
|
2222
|
+
/* @__PURE__ */ jsx14("path", { d: "M11 12h4" })
|
|
2072
2223
|
] }),
|
|
2073
|
-
group: () => /* @__PURE__ */
|
|
2224
|
+
group: () => /* @__PURE__ */ jsx14(GroupIcon, {}),
|
|
2074
2225
|
hide: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2075
|
-
/* @__PURE__ */
|
|
2076
|
-
/* @__PURE__ */
|
|
2077
|
-
/* @__PURE__ */
|
|
2078
|
-
/* @__PURE__ */
|
|
2226
|
+
/* @__PURE__ */ jsx14("path", { d: "M9.88 9.88a3 3 0 1 0 4.24 4.24" }),
|
|
2227
|
+
/* @__PURE__ */ jsx14("path", { d: "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" }),
|
|
2228
|
+
/* @__PURE__ */ jsx14("path", { d: "M6.61 6.61A13.53 13.53 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" }),
|
|
2229
|
+
/* @__PURE__ */ jsx14("path", { d: "m2 2 20 20" })
|
|
2079
2230
|
] }),
|
|
2080
2231
|
autoFit: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2081
|
-
/* @__PURE__ */
|
|
2082
|
-
/* @__PURE__ */
|
|
2083
|
-
/* @__PURE__ */
|
|
2232
|
+
/* @__PURE__ */ jsx14("path", { d: "m18 8 4 4-4 4" }),
|
|
2233
|
+
/* @__PURE__ */ jsx14("path", { d: "M2 12h20" }),
|
|
2234
|
+
/* @__PURE__ */ jsx14("path", { d: "m6 8-4 4 4 4" })
|
|
2084
2235
|
] }),
|
|
2085
2236
|
copy: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2086
|
-
/* @__PURE__ */
|
|
2087
|
-
/* @__PURE__ */
|
|
2237
|
+
/* @__PURE__ */ jsx14("rect", { x: "8", y: "8", width: "14", height: "14", rx: "2" }),
|
|
2238
|
+
/* @__PURE__ */ jsx14("path", { d: "M4 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2" })
|
|
2088
2239
|
] }),
|
|
2089
2240
|
print: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2090
|
-
/* @__PURE__ */
|
|
2091
|
-
/* @__PURE__ */
|
|
2092
|
-
/* @__PURE__ */
|
|
2241
|
+
/* @__PURE__ */ jsx14("path", { d: "M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" }),
|
|
2242
|
+
/* @__PURE__ */ jsx14("path", { d: "M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6" }),
|
|
2243
|
+
/* @__PURE__ */ jsx14("rect", { x: "6", y: "14", width: "12", height: "8", rx: "1" })
|
|
2093
2244
|
] })
|
|
2094
2245
|
};
|
|
2095
2246
|
var ICONS = new Map(Object.entries(BUILT_IN_ICONS));
|
|
@@ -2098,20 +2249,20 @@ function MenuIcon({ name }) {
|
|
|
2098
2249
|
return draw === void 0 ? null : draw();
|
|
2099
2250
|
}
|
|
2100
2251
|
function CheckIcon() {
|
|
2101
|
-
return /* @__PURE__ */
|
|
2252
|
+
return /* @__PURE__ */ jsx14(Icon, { children: /* @__PURE__ */ jsx14("path", { d: "M20 6 9 17l-5-5" }) });
|
|
2102
2253
|
}
|
|
2103
2254
|
function ChevronDownIcon() {
|
|
2104
|
-
return /* @__PURE__ */
|
|
2255
|
+
return /* @__PURE__ */ jsx14(Icon, { children: /* @__PURE__ */ jsx14("path", { d: "m6 9 6 6 6-6" }) });
|
|
2105
2256
|
}
|
|
2106
2257
|
function ChevronLeftIcon2() {
|
|
2107
|
-
return /* @__PURE__ */
|
|
2258
|
+
return /* @__PURE__ */ jsx14(Icon, { children: /* @__PURE__ */ jsx14("path", { d: "m15 18-6-6 6-6" }) });
|
|
2108
2259
|
}
|
|
2109
2260
|
function ChevronRightIcon2() {
|
|
2110
|
-
return /* @__PURE__ */
|
|
2261
|
+
return /* @__PURE__ */ jsx14(Icon, { children: /* @__PURE__ */ jsx14("path", { d: "m9 18 6-6-6-6" }) });
|
|
2111
2262
|
}
|
|
2112
2263
|
|
|
2113
2264
|
// src/DataGrid/menu/GridMenu.tsx
|
|
2114
|
-
import { Fragment as Fragment2, jsx as
|
|
2265
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2115
2266
|
var CLOSED = { kind: "closed" };
|
|
2116
2267
|
var ENTRY_GONE = { kind: "entryGone" };
|
|
2117
2268
|
function itemElement(menu, id) {
|
|
@@ -2142,10 +2293,10 @@ function MenuItem({
|
|
|
2142
2293
|
...ariaAttr(!isItem2, "aria-haspopup", "menu"),
|
|
2143
2294
|
...ariaAttr(!isItem2, "aria-expanded", expanded),
|
|
2144
2295
|
children: [
|
|
2145
|
-
/* @__PURE__ */
|
|
2146
|
-
/* @__PURE__ */
|
|
2147
|
-
shortcut !== void 0 && /* @__PURE__ */
|
|
2148
|
-
!isItem2 && /* @__PURE__ */
|
|
2296
|
+
/* @__PURE__ */ jsx15("span", { className: "gridkit-menu-item-icon", "aria-hidden": "true", children: checked === true ? /* @__PURE__ */ jsx15(CheckIcon, {}) : /* @__PURE__ */ jsx15(MenuIcon, { name: entry.icon }) }),
|
|
2297
|
+
/* @__PURE__ */ jsx15("span", { className: "gridkit-menu-item-label", children: entry.label }),
|
|
2298
|
+
shortcut !== void 0 && /* @__PURE__ */ jsx15("span", { className: "gridkit-menu-item-shortcut", "aria-hidden": "true", children: shortcut }),
|
|
2299
|
+
!isItem2 && /* @__PURE__ */ jsx15("span", { className: "gridkit-menu-submenu-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx15(ChevronRightIcon2, {}) })
|
|
2149
2300
|
]
|
|
2150
2301
|
}
|
|
2151
2302
|
);
|
|
@@ -2153,7 +2304,7 @@ function MenuItem({
|
|
|
2153
2304
|
function GridMenu({
|
|
2154
2305
|
entries,
|
|
2155
2306
|
label,
|
|
2156
|
-
|
|
2307
|
+
scope,
|
|
2157
2308
|
onRun,
|
|
2158
2309
|
onClose,
|
|
2159
2310
|
onCloseSubmenu,
|
|
@@ -2240,7 +2391,7 @@ function GridMenu({
|
|
|
2240
2391
|
setSubmenu(ENTRY_GONE);
|
|
2241
2392
|
}
|
|
2242
2393
|
return /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2243
|
-
/* @__PURE__ */
|
|
2394
|
+
/* @__PURE__ */ jsx15(
|
|
2244
2395
|
"div",
|
|
2245
2396
|
{
|
|
2246
2397
|
ref: menuRef,
|
|
@@ -2248,14 +2399,14 @@ function GridMenu({
|
|
|
2248
2399
|
"aria-label": label,
|
|
2249
2400
|
className: "gridkit-menu",
|
|
2250
2401
|
children: entries.map(
|
|
2251
|
-
(entry) => entry.type === "separator" ? /* @__PURE__ */
|
|
2402
|
+
(entry) => entry.type === "separator" ? /* @__PURE__ */ jsx15(
|
|
2252
2403
|
"div",
|
|
2253
2404
|
{
|
|
2254
2405
|
role: "separator",
|
|
2255
2406
|
className: "gridkit-menu-separator"
|
|
2256
2407
|
},
|
|
2257
2408
|
entry.key
|
|
2258
|
-
) : /* @__PURE__ */
|
|
2409
|
+
) : /* @__PURE__ */ jsx15(
|
|
2259
2410
|
MenuItem,
|
|
2260
2411
|
{
|
|
2261
2412
|
entry,
|
|
@@ -2266,21 +2417,21 @@ function GridMenu({
|
|
|
2266
2417
|
)
|
|
2267
2418
|
}
|
|
2268
2419
|
),
|
|
2269
|
-
submenu.kind === "open" && openEntry !== void 0 && /* @__PURE__ */
|
|
2420
|
+
submenu.kind === "open" && openEntry !== void 0 && /* @__PURE__ */ jsx15(
|
|
2270
2421
|
Overlay,
|
|
2271
2422
|
{
|
|
2272
2423
|
anchor: submenu.anchor,
|
|
2273
2424
|
placement: "right-start",
|
|
2274
2425
|
offset: submenu.offset,
|
|
2275
2426
|
initialFocus: submenu.focus,
|
|
2276
|
-
|
|
2427
|
+
scope,
|
|
2277
2428
|
onDismiss: closeSubmenu,
|
|
2278
|
-
children: /* @__PURE__ */
|
|
2429
|
+
children: /* @__PURE__ */ jsx15(
|
|
2279
2430
|
GridMenu,
|
|
2280
2431
|
{
|
|
2281
2432
|
entries: openEntry.items,
|
|
2282
2433
|
label: openEntry.label,
|
|
2283
|
-
|
|
2434
|
+
scope,
|
|
2284
2435
|
onRun,
|
|
2285
2436
|
onClose,
|
|
2286
2437
|
onCloseSubmenu: closeSubmenu,
|
|
@@ -2294,7 +2445,7 @@ function GridMenu({
|
|
|
2294
2445
|
}
|
|
2295
2446
|
|
|
2296
2447
|
// src/DataGrid/contextMenu/GridContextMenu.tsx
|
|
2297
|
-
import { jsx as
|
|
2448
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2298
2449
|
function GridContextMenu({
|
|
2299
2450
|
contextMenu
|
|
2300
2451
|
}) {
|
|
@@ -2302,21 +2453,21 @@ function GridContextMenu({
|
|
|
2302
2453
|
if (menu === null) {
|
|
2303
2454
|
return null;
|
|
2304
2455
|
}
|
|
2305
|
-
return /* @__PURE__ */
|
|
2456
|
+
return /* @__PURE__ */ jsx16(
|
|
2306
2457
|
Overlay,
|
|
2307
2458
|
{
|
|
2308
2459
|
anchor: menu.anchor,
|
|
2309
2460
|
gap: menu.anchor instanceof Element ? ANCHOR_GAP : 0,
|
|
2310
2461
|
returnFocusTo: menu.cell ?? void 0,
|
|
2311
2462
|
returnFocusFallback,
|
|
2312
|
-
|
|
2463
|
+
scope: menu.scope,
|
|
2313
2464
|
onDismiss: close,
|
|
2314
|
-
children: /* @__PURE__ */
|
|
2465
|
+
children: /* @__PURE__ */ jsx16(
|
|
2315
2466
|
GridMenu,
|
|
2316
2467
|
{
|
|
2317
2468
|
entries: menu.entries,
|
|
2318
2469
|
label: menu.label,
|
|
2319
|
-
|
|
2470
|
+
scope: menu.scope,
|
|
2320
2471
|
onRun: run,
|
|
2321
2472
|
onClose: close
|
|
2322
2473
|
}
|
|
@@ -2338,7 +2489,7 @@ import {
|
|
|
2338
2489
|
isSameCell,
|
|
2339
2490
|
resolveMenu
|
|
2340
2491
|
} from "@gridkitjs/core";
|
|
2341
|
-
import { hasContextMenu } from "@gridkitjs/core/renderer";
|
|
2492
|
+
import { hasContextMenu, pinnedWidths } from "@gridkitjs/core/renderer";
|
|
2342
2493
|
import {
|
|
2343
2494
|
attachContextMenuTrigger
|
|
2344
2495
|
} from "@gridkitjs/dom";
|
|
@@ -2352,7 +2503,8 @@ import {
|
|
|
2352
2503
|
bodyCellFrom as bodyCellFrom2,
|
|
2353
2504
|
bodyRowFrom as bodyRowFrom2,
|
|
2354
2505
|
findBodyRow as findBodyRow2,
|
|
2355
|
-
groupRowFrom as groupRowFrom2
|
|
2506
|
+
groupRowFrom as groupRowFrom2,
|
|
2507
|
+
writingDirection as writingDirection5
|
|
2356
2508
|
} from "@gridkitjs/dom";
|
|
2357
2509
|
function headerCell(parts, columnIndex) {
|
|
2358
2510
|
const element = parts.headerTable?.tHead?.rows[0]?.cells[columnIndex];
|
|
@@ -2362,24 +2514,46 @@ function bodyCell(parts, rowIndex, columnIndex) {
|
|
|
2362
2514
|
const element = findBodyRow2(parts.bodyTable, rowIndex)?.cells[columnIndex];
|
|
2363
2515
|
return element === void 0 ? null : { element, focus: bodyFocus2(rowIndex, columnIndex) };
|
|
2364
2516
|
}
|
|
2517
|
+
function underPinnedColumns(element, parts) {
|
|
2518
|
+
return parts.pinnedWidths.start + parts.pinnedWidths.end > 0 && element instanceof HTMLTableCellElement && !element.matches(".is-pinned-start, .is-pinned-end");
|
|
2519
|
+
}
|
|
2365
2520
|
function viewOf(element, parts) {
|
|
2366
|
-
const
|
|
2367
|
-
if (
|
|
2521
|
+
const { scroller } = parts;
|
|
2522
|
+
if (scroller === null) {
|
|
2368
2523
|
return null;
|
|
2369
2524
|
}
|
|
2370
|
-
const
|
|
2371
|
-
|
|
2372
|
-
|
|
2525
|
+
const view = scroller.getBoundingClientRect();
|
|
2526
|
+
let { top, bottom, left, right } = view;
|
|
2527
|
+
if (parts.body?.contains(element) === true) {
|
|
2528
|
+
top = Math.max(
|
|
2529
|
+
top,
|
|
2530
|
+
parts.headerTable?.getBoundingClientRect().bottom ?? top
|
|
2531
|
+
);
|
|
2532
|
+
bottom = Math.min(
|
|
2533
|
+
bottom,
|
|
2534
|
+
parts.footerTable?.getBoundingClientRect().top ?? bottom
|
|
2535
|
+
);
|
|
2536
|
+
}
|
|
2537
|
+
if (underPinnedColumns(element, parts)) {
|
|
2538
|
+
const { start, end } = parts.pinnedWidths;
|
|
2539
|
+
const rtl = writingDirection5(element) === "rtl";
|
|
2540
|
+
const portLeft = view.left + scroller.clientLeft;
|
|
2541
|
+
left = portLeft + (rtl ? end : start);
|
|
2542
|
+
right = portLeft + scroller.clientWidth - (rtl ? start : end);
|
|
2543
|
+
}
|
|
2373
2544
|
return new DOMRect(
|
|
2374
2545
|
left,
|
|
2375
2546
|
top,
|
|
2376
|
-
Math.max(0,
|
|
2377
|
-
Math.max(0,
|
|
2547
|
+
Math.max(0, right - left),
|
|
2548
|
+
Math.max(0, bottom - top)
|
|
2378
2549
|
);
|
|
2379
2550
|
}
|
|
2380
2551
|
function clamp(value, min, max) {
|
|
2381
2552
|
return Math.min(Math.max(value, min), max);
|
|
2382
2553
|
}
|
|
2554
|
+
function inlineStartOf(element, box) {
|
|
2555
|
+
return writingDirection5(element) === "rtl" ? box.right : box.left;
|
|
2556
|
+
}
|
|
2383
2557
|
function onCell(target, cell, parts) {
|
|
2384
2558
|
if (cell === null) {
|
|
2385
2559
|
return null;
|
|
@@ -2393,14 +2567,22 @@ function onCell(target, cell, parts) {
|
|
|
2393
2567
|
target,
|
|
2394
2568
|
cell,
|
|
2395
2569
|
anchor: {
|
|
2396
|
-
x: clamp(
|
|
2570
|
+
x: clamp(inlineStartOf(cell.element, box), view.left, view.right),
|
|
2397
2571
|
y: clamp(box.bottom, view.top, view.bottom)
|
|
2398
2572
|
}
|
|
2399
2573
|
};
|
|
2400
2574
|
}
|
|
2401
|
-
function onBody(body) {
|
|
2402
|
-
const
|
|
2403
|
-
|
|
2575
|
+
function onBody(body, parts) {
|
|
2576
|
+
const box = body.getBoundingClientRect();
|
|
2577
|
+
const view = viewOf(body, parts) ?? box;
|
|
2578
|
+
return {
|
|
2579
|
+
target: { area: "body" },
|
|
2580
|
+
cell: null,
|
|
2581
|
+
anchor: {
|
|
2582
|
+
x: inlineStartOf(body, view),
|
|
2583
|
+
y: clamp(box.top, view.top, view.bottom)
|
|
2584
|
+
}
|
|
2585
|
+
};
|
|
2404
2586
|
}
|
|
2405
2587
|
function headerPlaceAt(element, parts) {
|
|
2406
2588
|
const cell = element.closest("th[data-gridkit-column]");
|
|
@@ -2439,7 +2621,7 @@ function bodyPlaceAt(element, parts) {
|
|
|
2439
2621
|
parts
|
|
2440
2622
|
) : null;
|
|
2441
2623
|
}
|
|
2442
|
-
return bodyRowFrom2(element) === null ? onBody(body) : null;
|
|
2624
|
+
return bodyRowFrom2(element) === null ? onBody(body, parts) : null;
|
|
2443
2625
|
}
|
|
2444
2626
|
function placeAt(element, parts) {
|
|
2445
2627
|
return headerPlaceAt(element, parts) ?? bodyPlaceAt(element, parts);
|
|
@@ -2470,16 +2652,18 @@ function placeOf(target, parts) {
|
|
|
2470
2652
|
return onCell(target, bodyCell(parts, rowIndex, 0), parts);
|
|
2471
2653
|
}
|
|
2472
2654
|
case "body":
|
|
2473
|
-
return parts.body === null ? null : onBody(parts.body);
|
|
2655
|
+
return parts.body === null ? null : onBody(parts.body, parts);
|
|
2474
2656
|
}
|
|
2475
2657
|
}
|
|
2476
2658
|
|
|
2477
2659
|
// src/DataGrid/contextMenu/useContextMenu.ts
|
|
2478
2660
|
function useContextMenu({
|
|
2479
2661
|
rootRef,
|
|
2662
|
+
scrollRef,
|
|
2480
2663
|
headerTableRef,
|
|
2481
2664
|
bodyTableRef,
|
|
2482
|
-
|
|
2665
|
+
bodyRef,
|
|
2666
|
+
footerTableRef,
|
|
2483
2667
|
contextMenu,
|
|
2484
2668
|
overlay,
|
|
2485
2669
|
controller,
|
|
@@ -2495,11 +2679,13 @@ function useContextMenu({
|
|
|
2495
2679
|
function parts() {
|
|
2496
2680
|
const { columns, pageRows } = controller.getView();
|
|
2497
2681
|
return {
|
|
2498
|
-
|
|
2682
|
+
scroller: scrollRef.current,
|
|
2499
2683
|
headerTable: headerTableRef.current,
|
|
2500
2684
|
bodyTable: bodyTableRef.current,
|
|
2501
|
-
body:
|
|
2685
|
+
body: bodyRef.current,
|
|
2686
|
+
footerTable: footerTableRef.current,
|
|
2502
2687
|
columns,
|
|
2688
|
+
pinnedWidths: pinnedWidths(columns),
|
|
2503
2689
|
pageRows
|
|
2504
2690
|
};
|
|
2505
2691
|
}
|
|
@@ -2571,7 +2757,7 @@ function useContextMenu({
|
|
|
2571
2757
|
label: labelOf(target),
|
|
2572
2758
|
anchor: point ?? anchor,
|
|
2573
2759
|
cell: cell?.element ?? null,
|
|
2574
|
-
|
|
2760
|
+
scope: overlayScope(rootRef.current)
|
|
2575
2761
|
}
|
|
2576
2762
|
});
|
|
2577
2763
|
return true;
|
|
@@ -2658,12 +2844,12 @@ function useGridOverlay({
|
|
|
2658
2844
|
}
|
|
2659
2845
|
|
|
2660
2846
|
// src/DataGrid/panels/GridPanels.tsx
|
|
2661
|
-
import { useRef as
|
|
2847
|
+
import { useRef as useRef16 } from "react";
|
|
2662
2848
|
|
|
2663
2849
|
// src/DataGrid/columnChooser/ColumnChooser.tsx
|
|
2664
2850
|
import { useLayoutEffect as useLayoutEffect7, useRef as useRef9, useState as useState6 } from "react";
|
|
2665
2851
|
import { resolveColumnChooser } from "@gridkitjs/core/renderer";
|
|
2666
|
-
import { Fragment as Fragment3, jsx as
|
|
2852
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2667
2853
|
function ColumnChooser({
|
|
2668
2854
|
controller,
|
|
2669
2855
|
messages
|
|
@@ -2694,7 +2880,7 @@ function ColumnChooser({
|
|
|
2694
2880
|
"aria-label": messages.columnChooserLabel,
|
|
2695
2881
|
className: "gridkit-column-chooser",
|
|
2696
2882
|
children: [
|
|
2697
|
-
/* @__PURE__ */
|
|
2883
|
+
/* @__PURE__ */ jsx17(
|
|
2698
2884
|
"input",
|
|
2699
2885
|
{
|
|
2700
2886
|
type: "search",
|
|
@@ -2707,9 +2893,9 @@ function ColumnChooser({
|
|
|
2707
2893
|
}
|
|
2708
2894
|
}
|
|
2709
2895
|
),
|
|
2710
|
-
entries.length === 0 ? /* @__PURE__ */
|
|
2896
|
+
entries.length === 0 ? /* @__PURE__ */ jsx17("p", { role: "status", className: "gridkit-column-chooser-empty", children: messages.noMatchingColumns }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2711
2897
|
/* @__PURE__ */ jsxs10("label", { className: "gridkit-column-chooser-option gridkit-column-chooser-all", children: [
|
|
2712
|
-
/* @__PURE__ */
|
|
2898
|
+
/* @__PURE__ */ jsx17(
|
|
2713
2899
|
"input",
|
|
2714
2900
|
{
|
|
2715
2901
|
ref: showAllRef,
|
|
@@ -2725,8 +2911,8 @@ function ColumnChooser({
|
|
|
2725
2911
|
),
|
|
2726
2912
|
messages.showAllColumns
|
|
2727
2913
|
] }),
|
|
2728
|
-
/* @__PURE__ */
|
|
2729
|
-
/* @__PURE__ */
|
|
2914
|
+
/* @__PURE__ */ jsx17("ul", { className: "gridkit-column-chooser-list", children: entries.map((entry) => /* @__PURE__ */ jsx17("li", { children: /* @__PURE__ */ jsxs10("label", { className: "gridkit-column-chooser-option", children: [
|
|
2915
|
+
/* @__PURE__ */ jsx17(
|
|
2730
2916
|
"input",
|
|
2731
2917
|
{
|
|
2732
2918
|
type: "checkbox",
|
|
@@ -2823,7 +3009,7 @@ function useMenuButton({
|
|
|
2823
3009
|
setState({
|
|
2824
3010
|
kind: "open",
|
|
2825
3011
|
anchor: button,
|
|
2826
|
-
|
|
3012
|
+
scope: overlayScope(button),
|
|
2827
3013
|
gap: gap(button),
|
|
2828
3014
|
focusItem: onLast ? itemCount - 1 : 0
|
|
2829
3015
|
});
|
|
@@ -2856,7 +3042,7 @@ function useMenuButton({
|
|
|
2856
3042
|
}
|
|
2857
3043
|
|
|
2858
3044
|
// src/DataGrid/filterMenu/OperatorMenuButton.tsx
|
|
2859
|
-
import { Fragment as Fragment4, jsx as
|
|
3045
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2860
3046
|
function gapBeside(button) {
|
|
2861
3047
|
const dialog = button.closest('[role="dialog"]') ?? button;
|
|
2862
3048
|
return dialog.getBoundingClientRect().right - button.getBoundingClientRect().right + ANCHOR_GAP;
|
|
@@ -2894,34 +3080,34 @@ function OperatorMenuButton({
|
|
|
2894
3080
|
className: "gridkit-filter-menu-submenu",
|
|
2895
3081
|
...buttonProps,
|
|
2896
3082
|
children: [
|
|
2897
|
-
/* @__PURE__ */
|
|
3083
|
+
/* @__PURE__ */ jsx18("span", { className: "gridkit-filter-menu-submenu-icon", "aria-hidden": "true", children: active !== void 0 && /* @__PURE__ */ jsx18(CheckIcon, {}) }),
|
|
2898
3084
|
label,
|
|
2899
|
-
/* @__PURE__ */
|
|
3085
|
+
/* @__PURE__ */ jsx18(
|
|
2900
3086
|
"span",
|
|
2901
3087
|
{
|
|
2902
3088
|
className: "gridkit-filter-menu-submenu-indicator",
|
|
2903
3089
|
"aria-hidden": "true",
|
|
2904
|
-
children: /* @__PURE__ */
|
|
3090
|
+
children: /* @__PURE__ */ jsx18(ChevronRightIcon2, {})
|
|
2905
3091
|
}
|
|
2906
3092
|
)
|
|
2907
3093
|
]
|
|
2908
3094
|
}
|
|
2909
3095
|
),
|
|
2910
|
-
state.kind === "open" && /* @__PURE__ */
|
|
3096
|
+
state.kind === "open" && /* @__PURE__ */ jsx18(
|
|
2911
3097
|
Overlay,
|
|
2912
3098
|
{
|
|
2913
3099
|
anchor: state.anchor,
|
|
2914
3100
|
placement: "right-start",
|
|
2915
3101
|
gap: state.gap,
|
|
2916
3102
|
returnFocusTo: state.anchor,
|
|
2917
|
-
|
|
3103
|
+
scope: state.scope,
|
|
2918
3104
|
onDismiss: close,
|
|
2919
|
-
children: /* @__PURE__ */
|
|
3105
|
+
children: /* @__PURE__ */ jsx18(
|
|
2920
3106
|
GridMenu,
|
|
2921
3107
|
{
|
|
2922
3108
|
entries,
|
|
2923
3109
|
label,
|
|
2924
|
-
|
|
3110
|
+
scope: state.scope,
|
|
2925
3111
|
behaviourRef,
|
|
2926
3112
|
onRun: (item) => {
|
|
2927
3113
|
item.run();
|
|
@@ -2955,7 +3141,7 @@ import {
|
|
|
2955
3141
|
filterOperandArity,
|
|
2956
3142
|
parseFilterOperand
|
|
2957
3143
|
} from "@gridkitjs/core/renderer";
|
|
2958
|
-
import { jsx as
|
|
3144
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2959
3145
|
function inputType(family, type) {
|
|
2960
3146
|
switch (family) {
|
|
2961
3147
|
case "text":
|
|
@@ -2989,12 +3175,12 @@ function OperandField({
|
|
|
2989
3175
|
};
|
|
2990
3176
|
if (family === "boolean") {
|
|
2991
3177
|
return /* @__PURE__ */ jsxs12("select", { ...field, children: [
|
|
2992
|
-
/* @__PURE__ */
|
|
2993
|
-
/* @__PURE__ */
|
|
2994
|
-
/* @__PURE__ */
|
|
3178
|
+
/* @__PURE__ */ jsx19("option", { value: "" }),
|
|
3179
|
+
/* @__PURE__ */ jsx19("option", { value: "true", children: messages.booleanTrue }),
|
|
3180
|
+
/* @__PURE__ */ jsx19("option", { value: "false", children: messages.booleanFalse })
|
|
2995
3181
|
] });
|
|
2996
3182
|
}
|
|
2997
|
-
return /* @__PURE__ */
|
|
3183
|
+
return /* @__PURE__ */ jsx19("input", { ...field, type: inputType(family, type) });
|
|
2998
3184
|
}
|
|
2999
3185
|
function ConditionRow({
|
|
3000
3186
|
row,
|
|
@@ -3021,7 +3207,7 @@ function ConditionRow({
|
|
|
3021
3207
|
"aria-label": messages.filterConditionLabel(position),
|
|
3022
3208
|
className: "gridkit-filter-menu-condition",
|
|
3023
3209
|
children: [
|
|
3024
|
-
/* @__PURE__ */
|
|
3210
|
+
/* @__PURE__ */ jsx19(
|
|
3025
3211
|
"select",
|
|
3026
3212
|
{
|
|
3027
3213
|
ref: arity === 0 ? focusRef : void 0,
|
|
@@ -3034,10 +3220,10 @@ function ConditionRow({
|
|
|
3034
3220
|
onChange({ ...row, operator });
|
|
3035
3221
|
}
|
|
3036
3222
|
},
|
|
3037
|
-
children: operators.map((operator) => /* @__PURE__ */
|
|
3223
|
+
children: operators.map((operator) => /* @__PURE__ */ jsx19("option", { value: operator, children: messages.filterOperatorLabel(operator, menu.family) }, operator))
|
|
3038
3224
|
}
|
|
3039
3225
|
),
|
|
3040
|
-
arity > 0 && /* @__PURE__ */
|
|
3226
|
+
arity > 0 && /* @__PURE__ */ jsx19(
|
|
3041
3227
|
OperandField,
|
|
3042
3228
|
{
|
|
3043
3229
|
...operand,
|
|
@@ -3050,7 +3236,7 @@ function ConditionRow({
|
|
|
3050
3236
|
}
|
|
3051
3237
|
}
|
|
3052
3238
|
),
|
|
3053
|
-
arity === 2 && /* @__PURE__ */
|
|
3239
|
+
arity === 2 && /* @__PURE__ */ jsx19(
|
|
3054
3240
|
OperandField,
|
|
3055
3241
|
{
|
|
3056
3242
|
...operand,
|
|
@@ -3148,7 +3334,7 @@ function simpleEditorReducer(state, action) {
|
|
|
3148
3334
|
}
|
|
3149
3335
|
|
|
3150
3336
|
// src/DataGrid/filterMenu/SimpleFilterEditor.tsx
|
|
3151
|
-
import { jsx as
|
|
3337
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3152
3338
|
var COMBINATORS = ["and", "or"];
|
|
3153
3339
|
function holdsUnreadable(row) {
|
|
3154
3340
|
return Array.from(row?.querySelectorAll("input") ?? []).some(
|
|
@@ -3161,14 +3347,14 @@ function CombinatorChoice({
|
|
|
3161
3347
|
messages,
|
|
3162
3348
|
onChange
|
|
3163
3349
|
}) {
|
|
3164
|
-
return /* @__PURE__ */
|
|
3350
|
+
return /* @__PURE__ */ jsx20(
|
|
3165
3351
|
"div",
|
|
3166
3352
|
{
|
|
3167
3353
|
role: "radiogroup",
|
|
3168
3354
|
"aria-label": messages.filterCombinatorLabel,
|
|
3169
3355
|
className: "gridkit-filter-menu-combinator",
|
|
3170
3356
|
children: COMBINATORS.map((choice) => /* @__PURE__ */ jsxs13("label", { className: "gridkit-filter-menu-combinator-option", children: [
|
|
3171
|
-
/* @__PURE__ */
|
|
3357
|
+
/* @__PURE__ */ jsx20(
|
|
3172
3358
|
"input",
|
|
3173
3359
|
{
|
|
3174
3360
|
type: "radio",
|
|
@@ -3247,11 +3433,11 @@ function SimpleFilterEditor({
|
|
|
3247
3433
|
}
|
|
3248
3434
|
}, [invalid]);
|
|
3249
3435
|
return /* @__PURE__ */ jsxs13("div", { className: "gridkit-filter-menu-conditions", children: [
|
|
3250
|
-
opened.custom && /* @__PURE__ */
|
|
3436
|
+
opened.custom && /* @__PURE__ */ jsx20("p", { className: "gridkit-filter-menu-custom", children: messages.customFilter }),
|
|
3251
3437
|
draft.rows.map((row, index) => (
|
|
3252
3438
|
// A row is its place: the first condition, or the second.
|
|
3253
3439
|
/* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3254
|
-
index > 0 && /* @__PURE__ */
|
|
3440
|
+
index > 0 && /* @__PURE__ */ jsx20(
|
|
3255
3441
|
CombinatorChoice,
|
|
3256
3442
|
{
|
|
3257
3443
|
name: combinatorName,
|
|
@@ -3262,7 +3448,7 @@ function SimpleFilterEditor({
|
|
|
3262
3448
|
}
|
|
3263
3449
|
}
|
|
3264
3450
|
),
|
|
3265
|
-
/* @__PURE__ */
|
|
3451
|
+
/* @__PURE__ */ jsx20(
|
|
3266
3452
|
ConditionRow,
|
|
3267
3453
|
{
|
|
3268
3454
|
ref: (element) => {
|
|
@@ -3282,7 +3468,7 @@ function SimpleFilterEditor({
|
|
|
3282
3468
|
)
|
|
3283
3469
|
] }, index)
|
|
3284
3470
|
)),
|
|
3285
|
-
invalid.length > 0 && /* @__PURE__ */
|
|
3471
|
+
invalid.length > 0 && /* @__PURE__ */ jsx20("p", { id: invalidMessageId, className: "gridkit-filter-menu-invalid", children: messages.filterValueInvalid(menu.family) })
|
|
3286
3472
|
] });
|
|
3287
3473
|
}
|
|
3288
3474
|
|
|
@@ -3292,7 +3478,7 @@ import {
|
|
|
3292
3478
|
attachChecklist,
|
|
3293
3479
|
createRowVirtualizer
|
|
3294
3480
|
} from "@gridkitjs/dom";
|
|
3295
|
-
import { Fragment as Fragment6, jsx as
|
|
3481
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3296
3482
|
var ESTIMATED_ITEM_HEIGHT = 28;
|
|
3297
3483
|
var OVERSCAN = 4;
|
|
3298
3484
|
var NO_RANGE = {
|
|
@@ -3358,7 +3544,7 @@ function ValueChecklist({
|
|
|
3358
3544
|
"aria-label": label,
|
|
3359
3545
|
className: "gridkit-filter-menu-checklist",
|
|
3360
3546
|
children: [
|
|
3361
|
-
/* @__PURE__ */
|
|
3547
|
+
/* @__PURE__ */ jsx21("div", { role: "presentation", style: { height: range.offsetBefore } }),
|
|
3362
3548
|
shown.map((item, offset) => {
|
|
3363
3549
|
const index = range.startIndex + offset;
|
|
3364
3550
|
return /* @__PURE__ */ jsxs14(
|
|
@@ -3373,32 +3559,32 @@ function ValueChecklist({
|
|
|
3373
3559
|
"aria-posinset": index + 1,
|
|
3374
3560
|
className: "gridkit-filter-menu-option",
|
|
3375
3561
|
children: [
|
|
3376
|
-
/* @__PURE__ */
|
|
3562
|
+
/* @__PURE__ */ jsx21(
|
|
3377
3563
|
"span",
|
|
3378
3564
|
{
|
|
3379
3565
|
className: "gridkit-filter-menu-option-check",
|
|
3380
3566
|
"aria-hidden": "true",
|
|
3381
|
-
children: /* @__PURE__ */
|
|
3567
|
+
children: /* @__PURE__ */ jsx21(CheckIcon, {})
|
|
3382
3568
|
}
|
|
3383
3569
|
),
|
|
3384
|
-
/* @__PURE__ */
|
|
3570
|
+
/* @__PURE__ */ jsx21("span", { className: "gridkit-filter-menu-option-label", children: item.label }),
|
|
3385
3571
|
showCounts && /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
3386
3572
|
" ",
|
|
3387
|
-
/* @__PURE__ */
|
|
3573
|
+
/* @__PURE__ */ jsx21("span", { className: "gridkit-filter-menu-option-count", children: String(item.count) })
|
|
3388
3574
|
] })
|
|
3389
3575
|
]
|
|
3390
3576
|
},
|
|
3391
3577
|
item.key
|
|
3392
3578
|
);
|
|
3393
3579
|
}),
|
|
3394
|
-
/* @__PURE__ */
|
|
3580
|
+
/* @__PURE__ */ jsx21("div", { role: "presentation", style: { height: range.offsetAfter } })
|
|
3395
3581
|
]
|
|
3396
3582
|
}
|
|
3397
3583
|
);
|
|
3398
3584
|
}
|
|
3399
3585
|
|
|
3400
3586
|
// src/DataGrid/filterMenu/ExcelFilterEditor.tsx
|
|
3401
|
-
import { Fragment as Fragment7, jsx as
|
|
3587
|
+
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3402
3588
|
var OPENED_ON_VALUES = {
|
|
3403
3589
|
kind: "values",
|
|
3404
3590
|
focusOnMount: false
|
|
@@ -3475,12 +3661,12 @@ function ExcelFilterEditor({
|
|
|
3475
3661
|
setMode({ kind: "values", focusOnMount: true });
|
|
3476
3662
|
},
|
|
3477
3663
|
children: [
|
|
3478
|
-
/* @__PURE__ */
|
|
3664
|
+
/* @__PURE__ */ jsx22("span", { className: "gridkit-filter-menu-back-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx22(ChevronLeftIcon2, {}) }),
|
|
3479
3665
|
messages.filterBackToValues
|
|
3480
3666
|
]
|
|
3481
3667
|
}
|
|
3482
3668
|
),
|
|
3483
|
-
/* @__PURE__ */
|
|
3669
|
+
/* @__PURE__ */ jsx22(
|
|
3484
3670
|
SimpleFilterEditor,
|
|
3485
3671
|
{
|
|
3486
3672
|
ref: conditions,
|
|
@@ -3499,7 +3685,7 @@ function ExcelFilterEditor({
|
|
|
3499
3685
|
}
|
|
3500
3686
|
const { shape } = opened;
|
|
3501
3687
|
return /* @__PURE__ */ jsxs15("div", { className: "gridkit-filter-menu-values", children: [
|
|
3502
|
-
menu.operators.length > 0 && /* @__PURE__ */
|
|
3688
|
+
menu.operators.length > 0 && /* @__PURE__ */ jsx22(
|
|
3503
3689
|
OperatorMenuButton,
|
|
3504
3690
|
{
|
|
3505
3691
|
ref: operatorButton,
|
|
@@ -3511,8 +3697,8 @@ function ExcelFilterEditor({
|
|
|
3511
3697
|
}
|
|
3512
3698
|
}
|
|
3513
3699
|
),
|
|
3514
|
-
(shape.kind === "conditions" || shape.kind === "custom") && /* @__PURE__ */
|
|
3515
|
-
/* @__PURE__ */
|
|
3700
|
+
(shape.kind === "conditions" || shape.kind === "custom") && /* @__PURE__ */ jsx22("p", { className: "gridkit-filter-menu-custom", children: shape.kind === "conditions" ? messages.filterByCondition : messages.customFilter }),
|
|
3701
|
+
/* @__PURE__ */ jsx22(
|
|
3516
3702
|
"input",
|
|
3517
3703
|
{
|
|
3518
3704
|
ref: initialFocusRef,
|
|
@@ -3527,7 +3713,7 @@ function ExcelFilterEditor({
|
|
|
3527
3713
|
}
|
|
3528
3714
|
),
|
|
3529
3715
|
/* @__PURE__ */ jsxs15("label", { className: "gridkit-filter-menu-select-all", children: [
|
|
3530
|
-
/* @__PURE__ */
|
|
3716
|
+
/* @__PURE__ */ jsx22(
|
|
3531
3717
|
"input",
|
|
3532
3718
|
{
|
|
3533
3719
|
ref: selectAllRef,
|
|
@@ -3541,7 +3727,7 @@ function ExcelFilterEditor({
|
|
|
3541
3727
|
),
|
|
3542
3728
|
messages.filterSelectAll
|
|
3543
3729
|
] }),
|
|
3544
|
-
checklist.needsSearch ? /* @__PURE__ */
|
|
3730
|
+
checklist.needsSearch ? /* @__PURE__ */ jsx22("p", { className: "gridkit-filter-menu-search-first", children: messages.filterSearchFirst(checklist.total) }) : /* @__PURE__ */ jsx22(
|
|
3545
3731
|
ValueChecklist,
|
|
3546
3732
|
{
|
|
3547
3733
|
items: checklist.items,
|
|
@@ -3552,12 +3738,12 @@ function ExcelFilterEditor({
|
|
|
3552
3738
|
}
|
|
3553
3739
|
}
|
|
3554
3740
|
),
|
|
3555
|
-
checklist.hiddenCount > 0 && /* @__PURE__ */
|
|
3741
|
+
checklist.hiddenCount > 0 && /* @__PURE__ */ jsx22("p", { role: "status", className: "gridkit-filter-menu-more", children: messages.filterMoreValues(checklist.hiddenCount) })
|
|
3556
3742
|
] });
|
|
3557
3743
|
}
|
|
3558
3744
|
|
|
3559
3745
|
// src/DataGrid/filterMenu/FilterMenu.tsx
|
|
3560
|
-
import { jsx as
|
|
3746
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3561
3747
|
var SORT_COMMANDS = [
|
|
3562
3748
|
"sort.ascending",
|
|
3563
3749
|
"sort.descending",
|
|
@@ -3614,7 +3800,7 @@ function FilterMenu({
|
|
|
3614
3800
|
close();
|
|
3615
3801
|
}
|
|
3616
3802
|
}
|
|
3617
|
-
return /* @__PURE__ */
|
|
3803
|
+
return /* @__PURE__ */ jsx23(
|
|
3618
3804
|
"div",
|
|
3619
3805
|
{
|
|
3620
3806
|
role: "dialog",
|
|
@@ -3635,7 +3821,7 @@ function FilterMenu({
|
|
|
3635
3821
|
}
|
|
3636
3822
|
},
|
|
3637
3823
|
children: [
|
|
3638
|
-
sortItems.length > 0 && /* @__PURE__ */
|
|
3824
|
+
sortItems.length > 0 && /* @__PURE__ */ jsx23("div", { className: "gridkit-filter-menu-sort", children: sortItems.map((item) => /* @__PURE__ */ jsxs16(
|
|
3639
3825
|
"button",
|
|
3640
3826
|
{
|
|
3641
3827
|
type: "button",
|
|
@@ -3650,12 +3836,12 @@ function FilterMenu({
|
|
|
3650
3836
|
run(item);
|
|
3651
3837
|
},
|
|
3652
3838
|
children: [
|
|
3653
|
-
/* @__PURE__ */
|
|
3839
|
+
/* @__PURE__ */ jsx23(
|
|
3654
3840
|
"span",
|
|
3655
3841
|
{
|
|
3656
3842
|
className: "gridkit-filter-menu-sort-icon",
|
|
3657
3843
|
"aria-hidden": "true",
|
|
3658
|
-
children: /* @__PURE__ */
|
|
3844
|
+
children: /* @__PURE__ */ jsx23(MenuIcon, { name: item.icon })
|
|
3659
3845
|
}
|
|
3660
3846
|
),
|
|
3661
3847
|
item.label
|
|
@@ -3663,9 +3849,9 @@ function FilterMenu({
|
|
|
3663
3849
|
},
|
|
3664
3850
|
item.id
|
|
3665
3851
|
)) }),
|
|
3666
|
-
menu.ui === "excel" ? /* @__PURE__ */
|
|
3852
|
+
menu.ui === "excel" ? /* @__PURE__ */ jsx23(ExcelFilterEditor, { ...editorProps, columnValues }) : /* @__PURE__ */ jsx23(SimpleFilterEditor, { ...editorProps }),
|
|
3667
3853
|
/* @__PURE__ */ jsxs16("div", { className: "gridkit-filter-menu-actions", children: [
|
|
3668
|
-
clearItem !== void 0 && /* @__PURE__ */
|
|
3854
|
+
clearItem !== void 0 && /* @__PURE__ */ jsx23(
|
|
3669
3855
|
"button",
|
|
3670
3856
|
{
|
|
3671
3857
|
type: "button",
|
|
@@ -3677,7 +3863,7 @@ function FilterMenu({
|
|
|
3677
3863
|
children: clearItem.label
|
|
3678
3864
|
}
|
|
3679
3865
|
),
|
|
3680
|
-
/* @__PURE__ */
|
|
3866
|
+
/* @__PURE__ */ jsx23(
|
|
3681
3867
|
"button",
|
|
3682
3868
|
{
|
|
3683
3869
|
type: "button",
|
|
@@ -3686,7 +3872,7 @@ function FilterMenu({
|
|
|
3686
3872
|
children: messages.cancelFilter
|
|
3687
3873
|
}
|
|
3688
3874
|
),
|
|
3689
|
-
/* @__PURE__ */
|
|
3875
|
+
/* @__PURE__ */ jsx23("button", { type: "submit", className: "gridkit-filter-menu-apply", children: messages.applyFilter })
|
|
3690
3876
|
] })
|
|
3691
3877
|
]
|
|
3692
3878
|
}
|
|
@@ -3696,25 +3882,47 @@ function FilterMenu({
|
|
|
3696
3882
|
}
|
|
3697
3883
|
|
|
3698
3884
|
// src/DataGrid/useAnnounceWhenDrawn.ts
|
|
3699
|
-
import { useEffect as useEffect5, useState as useState10 } from "react";
|
|
3700
|
-
function useAnnounceWhenDrawn(announce) {
|
|
3885
|
+
import { useEffect as useEffect5, useRef as useRef15, useState as useState10 } from "react";
|
|
3886
|
+
function useAnnounceWhenDrawn(announce, controller) {
|
|
3701
3887
|
const [requested, setRequested] = useState10(null);
|
|
3888
|
+
const settled = useRef15(null);
|
|
3889
|
+
const { dataMode, dataSource, loading = false } = controller.getOptions();
|
|
3702
3890
|
useEffect5(() => {
|
|
3703
|
-
if (requested
|
|
3704
|
-
|
|
3891
|
+
if (requested === null || settled.current === requested) {
|
|
3892
|
+
return;
|
|
3705
3893
|
}
|
|
3706
|
-
|
|
3707
|
-
|
|
3894
|
+
const { announcement, rowsAsked } = requested;
|
|
3895
|
+
const awaitingRows = dataMode === "server" && (loading || dataSource === rowsAsked);
|
|
3896
|
+
const drawn = announcement.drawn();
|
|
3897
|
+
if (drawn && awaitingRows) {
|
|
3898
|
+
return;
|
|
3899
|
+
}
|
|
3900
|
+
settled.current = requested;
|
|
3901
|
+
if (drawn) {
|
|
3902
|
+
announce(announcement.text());
|
|
3903
|
+
}
|
|
3904
|
+
}, [requested, dataMode, dataSource, loading, announce]);
|
|
3905
|
+
return (announcement) => {
|
|
3906
|
+
setRequested({
|
|
3907
|
+
announcement,
|
|
3908
|
+
rowsAsked: controller.getOptions().dataSource
|
|
3909
|
+
});
|
|
3910
|
+
};
|
|
3911
|
+
}
|
|
3912
|
+
function resultCount(controller) {
|
|
3913
|
+
const { dataMode, rowCount } = controller.getOptions();
|
|
3914
|
+
const held = controller.getView().rows.length;
|
|
3915
|
+
return dataMode === "server" ? rowCount ?? held : held;
|
|
3708
3916
|
}
|
|
3709
3917
|
|
|
3710
3918
|
// src/DataGrid/filterMenu/useApplyFilter.ts
|
|
3711
3919
|
function useApplyFilter(controller, messages, announce) {
|
|
3712
|
-
const announceWhenDrawn = useAnnounceWhenDrawn(announce);
|
|
3920
|
+
const announceWhenDrawn = useAnnounceWhenDrawn(announce, controller);
|
|
3713
3921
|
return (filter) => {
|
|
3714
3922
|
announceWhenDrawn({
|
|
3715
3923
|
drawn: () => controller.getState().filter === filter,
|
|
3716
|
-
text: () => messages.filterResults(
|
|
3717
|
-
controller
|
|
3924
|
+
text: () => controller.getOptions().dataMode === "server" ? messages.searchResults(resultCount(controller)) : messages.filterResults(
|
|
3925
|
+
resultCount(controller),
|
|
3718
3926
|
controller.getOptions().dataSource?.length ?? 0
|
|
3719
3927
|
)
|
|
3720
3928
|
});
|
|
@@ -3743,7 +3951,7 @@ function useFilterValueCache(controller, messages) {
|
|
|
3743
3951
|
}
|
|
3744
3952
|
|
|
3745
3953
|
// src/DataGrid/panels/GridPanels.tsx
|
|
3746
|
-
import { jsx as
|
|
3954
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
3747
3955
|
var panelKinds = {
|
|
3748
3956
|
columnChooser: { component: ColumnChooser, trapFocus: false },
|
|
3749
3957
|
filter: { component: FilterMenu, trapFocus: true }
|
|
@@ -3754,7 +3962,7 @@ function GridPanels({
|
|
|
3754
3962
|
commands,
|
|
3755
3963
|
messages
|
|
3756
3964
|
}) {
|
|
3757
|
-
const initialFocus =
|
|
3965
|
+
const initialFocus = useRef16(null);
|
|
3758
3966
|
const applyFilter = useApplyFilter(
|
|
3759
3967
|
controller,
|
|
3760
3968
|
messages,
|
|
@@ -3766,7 +3974,7 @@ function GridPanels({
|
|
|
3766
3974
|
return null;
|
|
3767
3975
|
}
|
|
3768
3976
|
const { component: Panel, trapFocus } = panelKinds[panel.kind];
|
|
3769
|
-
return /* @__PURE__ */
|
|
3977
|
+
return /* @__PURE__ */ jsx24(
|
|
3770
3978
|
Overlay,
|
|
3771
3979
|
{
|
|
3772
3980
|
anchor: panel.anchor,
|
|
@@ -3777,9 +3985,9 @@ function GridPanels({
|
|
|
3777
3985
|
returnFocusFallback,
|
|
3778
3986
|
ignoreScrollAfterInput: true,
|
|
3779
3987
|
trapFocus,
|
|
3780
|
-
|
|
3988
|
+
scope: panel.scope,
|
|
3781
3989
|
onDismiss: close,
|
|
3782
|
-
children: /* @__PURE__ */
|
|
3990
|
+
children: /* @__PURE__ */ jsx24(
|
|
3783
3991
|
Panel,
|
|
3784
3992
|
{
|
|
3785
3993
|
target: panel.target,
|
|
@@ -3823,7 +4031,10 @@ function panelApi(panels, controller) {
|
|
|
3823
4031
|
}
|
|
3824
4032
|
|
|
3825
4033
|
// src/DataGrid/panels/useGridPanels.ts
|
|
3826
|
-
import { useRef as
|
|
4034
|
+
import { useRef as useRef17 } from "react";
|
|
4035
|
+
import {
|
|
4036
|
+
writingDirection as writingDirection6
|
|
4037
|
+
} from "@gridkitjs/dom";
|
|
3827
4038
|
function toolbarItem(root, itemId) {
|
|
3828
4039
|
const items = root.querySelectorAll(
|
|
3829
4040
|
":scope > .gridkit-toolbar > [data-gridkit-toolbar-item]"
|
|
@@ -3849,7 +4060,7 @@ function useGridPanels({
|
|
|
3849
4060
|
headerTableRef,
|
|
3850
4061
|
overlay
|
|
3851
4062
|
}) {
|
|
3852
|
-
const openings =
|
|
4063
|
+
const openings = useRef17(0);
|
|
3853
4064
|
function placeFor(root, target) {
|
|
3854
4065
|
const element = target.area === "toolbar" ? toolbarItem(root, target.itemId) : target.area === "header" ? headerCell2(headerTableRef.current, target.columnId) : null;
|
|
3855
4066
|
if (element !== null) {
|
|
@@ -3860,9 +4071,9 @@ function useGridPanels({
|
|
|
3860
4071
|
returnFocusTo: element
|
|
3861
4072
|
};
|
|
3862
4073
|
}
|
|
3863
|
-
const { right, top } = root.getBoundingClientRect();
|
|
4074
|
+
const { left, right, top } = root.getBoundingClientRect();
|
|
3864
4075
|
return {
|
|
3865
|
-
anchor: { x: right, y: top },
|
|
4076
|
+
anchor: { x: writingDirection6(root) === "rtl" ? left : right, y: top },
|
|
3866
4077
|
placement: "bottom-end",
|
|
3867
4078
|
returnFocusTo: void 0
|
|
3868
4079
|
};
|
|
@@ -3883,7 +4094,7 @@ function useGridPanels({
|
|
|
3883
4094
|
kind,
|
|
3884
4095
|
target,
|
|
3885
4096
|
...placeFor(root, target),
|
|
3886
|
-
|
|
4097
|
+
scope: overlayScope(root)
|
|
3887
4098
|
}
|
|
3888
4099
|
});
|
|
3889
4100
|
},
|
|
@@ -3895,7 +4106,7 @@ function useGridPanels({
|
|
|
3895
4106
|
}
|
|
3896
4107
|
|
|
3897
4108
|
// src/DataGrid/toolbar/GridToolbar.tsx
|
|
3898
|
-
import { useLayoutEffect as useLayoutEffect13, useRef as
|
|
4109
|
+
import { useLayoutEffect as useLayoutEffect13, useRef as useRef20 } from "react";
|
|
3899
4110
|
import {
|
|
3900
4111
|
resolveToolbar,
|
|
3901
4112
|
toolbarEntries
|
|
@@ -3904,7 +4115,7 @@ import { splitToolbarItems } from "@gridkitjs/core/renderer";
|
|
|
3904
4115
|
import { attachToolbar } from "@gridkitjs/dom";
|
|
3905
4116
|
|
|
3906
4117
|
// src/DataGrid/toolbar/ToolbarMenuButton.tsx
|
|
3907
|
-
import { Fragment as Fragment8, jsx as
|
|
4118
|
+
import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3908
4119
|
function ToolbarMenuButton({
|
|
3909
4120
|
itemKey,
|
|
3910
4121
|
attributes,
|
|
@@ -3931,13 +4142,13 @@ function ToolbarMenuButton({
|
|
|
3931
4142
|
...ariaAttr(more, "data-gridkit-toolbar-more", ""),
|
|
3932
4143
|
...buttonProps,
|
|
3933
4144
|
children: [
|
|
3934
|
-
icon !== void 0 && /* @__PURE__ */
|
|
4145
|
+
icon !== void 0 && /* @__PURE__ */ jsx25("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx25(MenuIcon, { name: icon }) }),
|
|
3935
4146
|
label,
|
|
3936
|
-
/* @__PURE__ */
|
|
4147
|
+
/* @__PURE__ */ jsx25("span", { className: "gridkit-toolbar-button-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx25(ChevronDownIcon, {}) })
|
|
3937
4148
|
]
|
|
3938
4149
|
}
|
|
3939
4150
|
),
|
|
3940
|
-
state.kind === "open" && /* @__PURE__ */
|
|
4151
|
+
state.kind === "open" && /* @__PURE__ */ jsx25(
|
|
3941
4152
|
Overlay,
|
|
3942
4153
|
{
|
|
3943
4154
|
anchor: state.anchor,
|
|
@@ -3945,14 +4156,14 @@ function ToolbarMenuButton({
|
|
|
3945
4156
|
gap: state.gap,
|
|
3946
4157
|
returnFocusTo: state.anchor,
|
|
3947
4158
|
returnFocusFallback,
|
|
3948
|
-
|
|
4159
|
+
scope: state.scope,
|
|
3949
4160
|
onDismiss: close,
|
|
3950
|
-
children: /* @__PURE__ */
|
|
4161
|
+
children: /* @__PURE__ */ jsx25(
|
|
3951
4162
|
GridMenu,
|
|
3952
4163
|
{
|
|
3953
4164
|
entries,
|
|
3954
4165
|
label,
|
|
3955
|
-
|
|
4166
|
+
scope: state.scope,
|
|
3956
4167
|
behaviourRef,
|
|
3957
4168
|
onRun: (item) => {
|
|
3958
4169
|
item.run();
|
|
@@ -3967,9 +4178,9 @@ function ToolbarMenuButton({
|
|
|
3967
4178
|
}
|
|
3968
4179
|
|
|
3969
4180
|
// src/DataGrid/toolbar/ToolbarSearch.tsx
|
|
3970
|
-
import { useEffect as useEffect6, useRef as
|
|
4181
|
+
import { useEffect as useEffect6, useRef as useRef18, useState as useState12 } from "react";
|
|
3971
4182
|
import { searchTextOf, setSearchText } from "@gridkitjs/core/renderer";
|
|
3972
|
-
import { jsx as
|
|
4183
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3973
4184
|
var SEARCH_DELAY_MS = 250;
|
|
3974
4185
|
function ToolbarSearch({
|
|
3975
4186
|
itemKey,
|
|
@@ -3980,8 +4191,8 @@ function ToolbarSearch({
|
|
|
3980
4191
|
}) {
|
|
3981
4192
|
const applied = searchTextOf(controller.getState().filter);
|
|
3982
4193
|
const [draft, setDraft] = useState12(null);
|
|
3983
|
-
const timer =
|
|
3984
|
-
const announceWhenDrawn = useAnnounceWhenDrawn(announce);
|
|
4194
|
+
const timer = useRef18(void 0);
|
|
4195
|
+
const announceWhenDrawn = useAnnounceWhenDrawn(announce, controller);
|
|
3985
4196
|
const text = draft !== null && draft.over === applied ? draft.text : applied;
|
|
3986
4197
|
function apply(next, over) {
|
|
3987
4198
|
clearTimeout(timer.current);
|
|
@@ -3994,7 +4205,7 @@ function ToolbarSearch({
|
|
|
3994
4205
|
if (searched !== filter) {
|
|
3995
4206
|
announceWhenDrawn({
|
|
3996
4207
|
drawn: () => searchTextOf(controller.getState().filter) === next,
|
|
3997
|
-
text: () => messages.searchResults(controller
|
|
4208
|
+
text: () => messages.searchResults(resultCount(controller))
|
|
3998
4209
|
});
|
|
3999
4210
|
controller.setFilter(searched);
|
|
4000
4211
|
}
|
|
@@ -4005,7 +4216,7 @@ function ToolbarSearch({
|
|
|
4005
4216
|
},
|
|
4006
4217
|
[]
|
|
4007
4218
|
);
|
|
4008
|
-
return /* @__PURE__ */
|
|
4219
|
+
return /* @__PURE__ */ jsx26(
|
|
4009
4220
|
"input",
|
|
4010
4221
|
{
|
|
4011
4222
|
...attributes,
|
|
@@ -4036,12 +4247,12 @@ function ToolbarSearch({
|
|
|
4036
4247
|
}
|
|
4037
4248
|
|
|
4038
4249
|
// src/DataGrid/toolbar/useToolbarOverflow.ts
|
|
4039
|
-
import { useLayoutEffect as useLayoutEffect12, useRef as
|
|
4250
|
+
import { useLayoutEffect as useLayoutEffect12, useRef as useRef19, useState as useState13 } from "react";
|
|
4040
4251
|
import { observeToolbarOverflow } from "@gridkitjs/dom";
|
|
4041
4252
|
function useToolbarOverflow(toolbarRef, items) {
|
|
4042
4253
|
const [fit, setFit] = useState13(items.length);
|
|
4043
|
-
const overflow =
|
|
4044
|
-
const measuredLayout =
|
|
4254
|
+
const overflow = useRef19(null);
|
|
4255
|
+
const measuredLayout = useRef19("");
|
|
4045
4256
|
const layout = JSON.stringify(
|
|
4046
4257
|
items.map((item) => [
|
|
4047
4258
|
item.type,
|
|
@@ -4074,7 +4285,7 @@ function useToolbarOverflow(toolbarRef, items) {
|
|
|
4074
4285
|
}
|
|
4075
4286
|
|
|
4076
4287
|
// src/DataGrid/toolbar/GridToolbar.tsx
|
|
4077
|
-
import { jsx as
|
|
4288
|
+
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4078
4289
|
function reporting(run, report) {
|
|
4079
4290
|
return () => {
|
|
4080
4291
|
const ran = run();
|
|
@@ -4127,7 +4338,7 @@ function GridToolbar(props) {
|
|
|
4127
4338
|
return null;
|
|
4128
4339
|
}
|
|
4129
4340
|
const options = typeof props.toolbar === "object" ? props.toolbar : void 0;
|
|
4130
|
-
return /* @__PURE__ */
|
|
4341
|
+
return /* @__PURE__ */ jsx27(
|
|
4131
4342
|
Toolbar,
|
|
4132
4343
|
{
|
|
4133
4344
|
...props,
|
|
@@ -4148,7 +4359,7 @@ function Toolbar({
|
|
|
4148
4359
|
messages,
|
|
4149
4360
|
announce
|
|
4150
4361
|
}) {
|
|
4151
|
-
const toolbarRef =
|
|
4362
|
+
const toolbarRef = useRef20(null);
|
|
4152
4363
|
const items = resolveToolbar(entries, {
|
|
4153
4364
|
commands: commands.commands,
|
|
4154
4365
|
contextFor: commands.contextFor,
|
|
@@ -4193,14 +4404,14 @@ function Toolbar({
|
|
|
4193
4404
|
item.run();
|
|
4194
4405
|
},
|
|
4195
4406
|
children: [
|
|
4196
|
-
item.icon !== void 0 && /* @__PURE__ */
|
|
4407
|
+
item.icon !== void 0 && /* @__PURE__ */ jsx27("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx27(MenuIcon, { name: item.icon }) }),
|
|
4197
4408
|
item.label
|
|
4198
4409
|
]
|
|
4199
4410
|
},
|
|
4200
4411
|
item.key
|
|
4201
4412
|
);
|
|
4202
4413
|
case "menu":
|
|
4203
|
-
return /* @__PURE__ */
|
|
4414
|
+
return /* @__PURE__ */ jsx27(
|
|
4204
4415
|
ToolbarMenuButton,
|
|
4205
4416
|
{
|
|
4206
4417
|
itemKey: item.key,
|
|
@@ -4213,7 +4424,7 @@ function Toolbar({
|
|
|
4213
4424
|
item.key
|
|
4214
4425
|
);
|
|
4215
4426
|
case "search":
|
|
4216
|
-
return /* @__PURE__ */
|
|
4427
|
+
return /* @__PURE__ */ jsx27(
|
|
4217
4428
|
ToolbarSearch,
|
|
4218
4429
|
{
|
|
4219
4430
|
itemKey: item.key,
|
|
@@ -4225,7 +4436,7 @@ function Toolbar({
|
|
|
4225
4436
|
item.key
|
|
4226
4437
|
);
|
|
4227
4438
|
case "separator":
|
|
4228
|
-
return /* @__PURE__ */
|
|
4439
|
+
return /* @__PURE__ */ jsx27(
|
|
4229
4440
|
"div",
|
|
4230
4441
|
{
|
|
4231
4442
|
role: "separator",
|
|
@@ -4236,7 +4447,7 @@ function Toolbar({
|
|
|
4236
4447
|
item.key
|
|
4237
4448
|
);
|
|
4238
4449
|
case "spacer":
|
|
4239
|
-
return /* @__PURE__ */
|
|
4450
|
+
return /* @__PURE__ */ jsx27(
|
|
4240
4451
|
"div",
|
|
4241
4452
|
{
|
|
4242
4453
|
className: "gridkit-toolbar-spacer",
|
|
@@ -4245,7 +4456,7 @@ function Toolbar({
|
|
|
4245
4456
|
item.key
|
|
4246
4457
|
);
|
|
4247
4458
|
case "custom":
|
|
4248
|
-
return /* @__PURE__ */
|
|
4459
|
+
return /* @__PURE__ */ jsx27(
|
|
4249
4460
|
"div",
|
|
4250
4461
|
{
|
|
4251
4462
|
...item.attributes,
|
|
@@ -4267,7 +4478,7 @@ function Toolbar({
|
|
|
4267
4478
|
className: "gridkit-toolbar",
|
|
4268
4479
|
children: [
|
|
4269
4480
|
shown.map(draw),
|
|
4270
|
-
overflow.length > 0 && /* @__PURE__ */
|
|
4481
|
+
overflow.length > 0 && /* @__PURE__ */ jsx27(
|
|
4271
4482
|
ToolbarMenuButton,
|
|
4272
4483
|
{
|
|
4273
4484
|
itemKey: "more",
|
|
@@ -4289,13 +4500,15 @@ function useColumnDrag({
|
|
|
4289
4500
|
order,
|
|
4290
4501
|
groupBy,
|
|
4291
4502
|
groupByDraggableIds,
|
|
4503
|
+
pinOf,
|
|
4292
4504
|
onDrop
|
|
4293
4505
|
}) {
|
|
4294
4506
|
const drag = useDragReorder({
|
|
4295
4507
|
resolveTarget: (clientX, clientY, movedId) => resolveColumnDropTarget(clientX, clientY, movedId, {
|
|
4296
4508
|
order,
|
|
4297
4509
|
groupBy,
|
|
4298
|
-
groupByDraggableIds
|
|
4510
|
+
groupByDraggableIds,
|
|
4511
|
+
pinOf
|
|
4299
4512
|
}),
|
|
4300
4513
|
onDrop
|
|
4301
4514
|
});
|
|
@@ -4413,12 +4626,31 @@ function useColumnResize({
|
|
|
4413
4626
|
return { activeColumnId, startResize, sizeToContent, nudge };
|
|
4414
4627
|
}
|
|
4415
4628
|
|
|
4416
|
-
// src/DataGrid/
|
|
4629
|
+
// src/DataGrid/useElementHeight.ts
|
|
4417
4630
|
import { useLayoutEffect as useLayoutEffect14, useState as useState15 } from "react";
|
|
4631
|
+
import { observeElementHeight } from "@gridkitjs/dom";
|
|
4632
|
+
function useElementHeight(ref, enabled) {
|
|
4633
|
+
const [height, setHeight] = useState15(null);
|
|
4634
|
+
useLayoutEffect14(() => {
|
|
4635
|
+
const element = ref.current;
|
|
4636
|
+
if (element === null || !enabled) {
|
|
4637
|
+
return void 0;
|
|
4638
|
+
}
|
|
4639
|
+
const disconnect = observeElementHeight(element, setHeight);
|
|
4640
|
+
return () => {
|
|
4641
|
+
disconnect();
|
|
4642
|
+
setHeight(null);
|
|
4643
|
+
};
|
|
4644
|
+
}, [ref, enabled]);
|
|
4645
|
+
return enabled ? height : null;
|
|
4646
|
+
}
|
|
4647
|
+
|
|
4648
|
+
// src/DataGrid/useElementWidth.ts
|
|
4649
|
+
import { useLayoutEffect as useLayoutEffect15, useState as useState16 } from "react";
|
|
4418
4650
|
import { observeElementWidth } from "@gridkitjs/dom";
|
|
4419
4651
|
function useElementWidth(ref, enabled) {
|
|
4420
|
-
const [width, setWidth] =
|
|
4421
|
-
|
|
4652
|
+
const [width, setWidth] = useState16(null);
|
|
4653
|
+
useLayoutEffect15(() => {
|
|
4422
4654
|
const element = ref.current;
|
|
4423
4655
|
if (element === null || !enabled) {
|
|
4424
4656
|
return void 0;
|
|
@@ -4429,12 +4661,12 @@ function useElementWidth(ref, enabled) {
|
|
|
4429
4661
|
}
|
|
4430
4662
|
|
|
4431
4663
|
// src/DataGrid/useGridController.ts
|
|
4432
|
-
import { useState as
|
|
4664
|
+
import { useState as useState17, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
4433
4665
|
import {
|
|
4434
4666
|
createGridController
|
|
4435
4667
|
} from "@gridkitjs/core";
|
|
4436
4668
|
function useGridController(options) {
|
|
4437
|
-
const [controller] =
|
|
4669
|
+
const [controller] = useState17(
|
|
4438
4670
|
() => createGridController(options)
|
|
4439
4671
|
);
|
|
4440
4672
|
controller.setOptions(options);
|
|
@@ -4447,14 +4679,14 @@ function useGridController(options) {
|
|
|
4447
4679
|
}
|
|
4448
4680
|
|
|
4449
4681
|
// src/DataGrid/useInfiniteScroll.ts
|
|
4450
|
-
import { useEffect as useEffect7, useRef as
|
|
4682
|
+
import { useEffect as useEffect7, useRef as useRef21 } from "react";
|
|
4451
4683
|
import { attachInfiniteScroll } from "@gridkitjs/dom";
|
|
4452
4684
|
function useInfiniteScroll({
|
|
4453
4685
|
rootRef,
|
|
4454
4686
|
sentinelRef,
|
|
4455
4687
|
config
|
|
4456
4688
|
}) {
|
|
4457
|
-
const scroll =
|
|
4689
|
+
const scroll = useRef21(null);
|
|
4458
4690
|
useEffect7(() => {
|
|
4459
4691
|
const root = rootRef.current;
|
|
4460
4692
|
if (root === null) {
|
|
@@ -4482,11 +4714,11 @@ function useInfiniteScroll({
|
|
|
4482
4714
|
}
|
|
4483
4715
|
|
|
4484
4716
|
// src/DataGrid/useLiveAnnouncer.ts
|
|
4485
|
-
import { useCallback as useCallback3, useLayoutEffect as
|
|
4717
|
+
import { useCallback as useCallback3, useLayoutEffect as useLayoutEffect16, useRef as useRef22 } from "react";
|
|
4486
4718
|
import { createLiveAnnouncer } from "@gridkitjs/dom";
|
|
4487
4719
|
function useLiveAnnouncer(containerRef) {
|
|
4488
|
-
const announcer =
|
|
4489
|
-
|
|
4720
|
+
const announcer = useRef22(null);
|
|
4721
|
+
useLayoutEffect16(() => {
|
|
4490
4722
|
const container = containerRef.current;
|
|
4491
4723
|
if (container === null) {
|
|
4492
4724
|
return void 0;
|
|
@@ -4504,7 +4736,7 @@ function useLiveAnnouncer(containerRef) {
|
|
|
4504
4736
|
}
|
|
4505
4737
|
|
|
4506
4738
|
// src/DataGrid/useRowVirtualizer.ts
|
|
4507
|
-
import { useLayoutEffect as
|
|
4739
|
+
import { useLayoutEffect as useLayoutEffect17, useRef as useRef23, useState as useState18 } from "react";
|
|
4508
4740
|
import {
|
|
4509
4741
|
bodyRowFrom as bodyRowFrom3,
|
|
4510
4742
|
createRowVirtualizer as createRowVirtualizer2
|
|
@@ -4539,25 +4771,25 @@ function ignoreRow() {
|
|
|
4539
4771
|
function useRowVirtualizer({
|
|
4540
4772
|
enabled,
|
|
4541
4773
|
rows,
|
|
4542
|
-
|
|
4774
|
+
scrollRef,
|
|
4543
4775
|
bodyTableRef,
|
|
4544
4776
|
estimatedRowHeight,
|
|
4545
4777
|
overscan
|
|
4546
4778
|
}) {
|
|
4547
|
-
const [virtualizer, setVirtualizer] =
|
|
4548
|
-
const instance =
|
|
4549
|
-
const rowCount =
|
|
4550
|
-
const [rowWindow, setRowWindow] =
|
|
4779
|
+
const [virtualizer, setVirtualizer] = useState18(null);
|
|
4780
|
+
const instance = useRef23(null);
|
|
4781
|
+
const rowCount = useRef23(rows.length);
|
|
4782
|
+
const [rowWindow, setRowWindow] = useState18(enabled ? NO_ROWS3 : ALL_ROWS);
|
|
4551
4783
|
if (!enabled && rowWindow.kind !== "allRows") {
|
|
4552
4784
|
setRowWindow(ALL_ROWS);
|
|
4553
4785
|
}
|
|
4554
|
-
|
|
4786
|
+
useLayoutEffect17(() => {
|
|
4555
4787
|
rowCount.current = rows.length;
|
|
4556
4788
|
instance.current?.setRowCount(rows.length);
|
|
4557
4789
|
instance.current?.resetHeights();
|
|
4558
4790
|
}, [rows]);
|
|
4559
|
-
|
|
4560
|
-
const element =
|
|
4791
|
+
useLayoutEffect17(() => {
|
|
4792
|
+
const element = scrollRef.current;
|
|
4561
4793
|
if (!enabled || element === null) {
|
|
4562
4794
|
return void 0;
|
|
4563
4795
|
}
|
|
@@ -4575,7 +4807,7 @@ function useRowVirtualizer({
|
|
|
4575
4807
|
return () => {
|
|
4576
4808
|
created.destroy();
|
|
4577
4809
|
};
|
|
4578
|
-
}, [enabled,
|
|
4810
|
+
}, [enabled, scrollRef, bodyTableRef, estimatedRowHeight, overscan]);
|
|
4579
4811
|
const range = rangeOf(rowWindow, rows.length);
|
|
4580
4812
|
return {
|
|
4581
4813
|
startIndex: range.startIndex,
|
|
@@ -4590,7 +4822,7 @@ function useRowVirtualizer({
|
|
|
4590
4822
|
}
|
|
4591
4823
|
|
|
4592
4824
|
// src/DataGrid/DataGrid.tsx
|
|
4593
|
-
import { jsx as
|
|
4825
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4594
4826
|
var NO_AGGREGATES = [];
|
|
4595
4827
|
function paginationReader(controller) {
|
|
4596
4828
|
let last;
|
|
@@ -4615,6 +4847,25 @@ function selectedRowsReader(controller) {
|
|
|
4615
4847
|
return last.selected;
|
|
4616
4848
|
};
|
|
4617
4849
|
}
|
|
4850
|
+
function tablesStyle(height, headerHeight, footerHeight, pinned) {
|
|
4851
|
+
const heights = height === void 0 ? {} : {
|
|
4852
|
+
"--gridkit-body-height": typeof height === "number" ? `${String(height)}px` : height,
|
|
4853
|
+
...headerHeight === null ? {} : { "--gridkit-header-height": `${String(headerHeight)}px` },
|
|
4854
|
+
...footerHeight === null ? {} : { "--gridkit-footer-height": `${String(footerHeight)}px` }
|
|
4855
|
+
};
|
|
4856
|
+
const widths = pinned.start === 0 && pinned.end === 0 ? {} : {
|
|
4857
|
+
"--gridkit-pinned-start-width": `${String(pinned.start)}px`,
|
|
4858
|
+
"--gridkit-pinned-end-width": `${String(pinned.end)}px`
|
|
4859
|
+
};
|
|
4860
|
+
const style = { ...heights, ...widths };
|
|
4861
|
+
return Object.keys(style).length === 0 ? void 0 : style;
|
|
4862
|
+
}
|
|
4863
|
+
function emptyContext(view, filter, loading, infiniteScroll) {
|
|
4864
|
+
if (view.pageRows.length > 0 || view.columns.length === 0 || loading || infiniteScroll?.hasMore === true) {
|
|
4865
|
+
return null;
|
|
4866
|
+
}
|
|
4867
|
+
return { filtered: filter.length > 0 };
|
|
4868
|
+
}
|
|
4618
4869
|
function DataGrid(props) {
|
|
4619
4870
|
const {
|
|
4620
4871
|
borders,
|
|
@@ -4626,6 +4877,7 @@ function DataGrid(props) {
|
|
|
4626
4877
|
groupableColumns = false,
|
|
4627
4878
|
groupToggleIconColumns = true,
|
|
4628
4879
|
groupByBarVisibility = "auto",
|
|
4880
|
+
loading = false,
|
|
4629
4881
|
paginated = false,
|
|
4630
4882
|
pager,
|
|
4631
4883
|
infiniteScroll,
|
|
@@ -4647,14 +4899,15 @@ function DataGrid(props) {
|
|
|
4647
4899
|
const hoverRows = hoverable?.rows ?? true;
|
|
4648
4900
|
const hoverColumns = hoverable?.columns ?? true;
|
|
4649
4901
|
const hoverCells = hoverable?.cells ?? true;
|
|
4650
|
-
const viewportRef =
|
|
4651
|
-
const gridRef =
|
|
4652
|
-
const headerTableRef =
|
|
4653
|
-
const bodyTableRef =
|
|
4654
|
-
const
|
|
4655
|
-
const
|
|
4656
|
-
const
|
|
4657
|
-
const
|
|
4902
|
+
const viewportRef = useRef24(null);
|
|
4903
|
+
const gridRef = useRef24(null);
|
|
4904
|
+
const headerTableRef = useRef24(null);
|
|
4905
|
+
const bodyTableRef = useRef24(null);
|
|
4906
|
+
const bodyRef = useRef24(null);
|
|
4907
|
+
const footerTableRef = useRef24(null);
|
|
4908
|
+
const sentinelRef = useRef24(null);
|
|
4909
|
+
const viewportWidth = useElementWidth(gridRef, resizeMode === "fit");
|
|
4910
|
+
const subscribersRef = useRef24(/* @__PURE__ */ new Set());
|
|
4658
4911
|
const gridId = useId2();
|
|
4659
4912
|
const announce = useLiveAnnouncer(viewportRef);
|
|
4660
4913
|
const messages = useMemo5(
|
|
@@ -4672,12 +4925,12 @@ function DataGrid(props) {
|
|
|
4672
4925
|
columnOf
|
|
4673
4926
|
})
|
|
4674
4927
|
});
|
|
4675
|
-
const [readPagination] =
|
|
4676
|
-
const [readSelectedRows] =
|
|
4928
|
+
const [readPagination] = useState19(() => paginationReader(controller));
|
|
4929
|
+
const [readSelectedRows] = useState19(() => selectedRowsReader(controller));
|
|
4677
4930
|
const virtualizer = useRowVirtualizer({
|
|
4678
4931
|
enabled: virtualized,
|
|
4679
4932
|
rows: view.pageRows,
|
|
4680
|
-
|
|
4933
|
+
scrollRef: gridRef,
|
|
4681
4934
|
bodyTableRef,
|
|
4682
4935
|
estimatedRowHeight,
|
|
4683
4936
|
overscan
|
|
@@ -4697,11 +4950,30 @@ function DataGrid(props) {
|
|
|
4697
4950
|
);
|
|
4698
4951
|
}
|
|
4699
4952
|
}, [paginated, hasInfiniteScroll]);
|
|
4953
|
+
const serverPagesUncounted = props.dataMode === "server" && paginated && props.rowCount === void 0;
|
|
4954
|
+
useEffect8(() => {
|
|
4955
|
+
if (serverPagesUncounted) {
|
|
4956
|
+
console.error(
|
|
4957
|
+
'DataGrid: a `paginated` grid under `dataMode: "server"` needs `rowCount` \u2014 without it the pager counts only the rows given, one page. Pass `0` until the first response.'
|
|
4958
|
+
);
|
|
4959
|
+
}
|
|
4960
|
+
}, [serverPagesUncounted]);
|
|
4700
4961
|
useInfiniteScroll({
|
|
4701
|
-
rootRef:
|
|
4962
|
+
rootRef: gridRef,
|
|
4702
4963
|
sentinelRef,
|
|
4703
4964
|
config: infiniteScroll
|
|
4704
4965
|
});
|
|
4966
|
+
const empty = emptyContext(view, state.filter, loading, infiniteScroll);
|
|
4967
|
+
const messageWidth = useElementWidth(
|
|
4968
|
+
gridRef,
|
|
4969
|
+
(empty !== null || loading) && resizeMode !== "fit"
|
|
4970
|
+
);
|
|
4971
|
+
const bodyViewportWidth = viewportWidth ?? messageWidth;
|
|
4972
|
+
useEffect8(() => {
|
|
4973
|
+
if (loading) {
|
|
4974
|
+
announce(messages.loading);
|
|
4975
|
+
}
|
|
4976
|
+
}, [loading, announce, messages.loading]);
|
|
4705
4977
|
function columnOf(columnId) {
|
|
4706
4978
|
return view.dataColumns.find((candidate) => candidate.id === columnId)?.column;
|
|
4707
4979
|
}
|
|
@@ -4779,20 +5051,36 @@ function DataGrid(props) {
|
|
|
4779
5051
|
),
|
|
4780
5052
|
[view.columns]
|
|
4781
5053
|
);
|
|
5054
|
+
function pinOf(columnId) {
|
|
5055
|
+
const column = definitions.get(columnId);
|
|
5056
|
+
return column === void 0 ? "none" : resolveColumnPin2(column, state.columnPinning);
|
|
5057
|
+
}
|
|
4782
5058
|
function handleDrop(target, movedId) {
|
|
4783
5059
|
if (target.kind === "group-by") {
|
|
4784
5060
|
controller.moveGroupBy(movedId, target.beforeColumnId);
|
|
4785
5061
|
return;
|
|
4786
5062
|
}
|
|
4787
|
-
const next =
|
|
5063
|
+
const next = moveColumnInPinGroup(
|
|
5064
|
+
orderedIds,
|
|
5065
|
+
pinOf,
|
|
5066
|
+
movedId,
|
|
5067
|
+
target.beforeId
|
|
5068
|
+
);
|
|
4788
5069
|
if (next === orderedIds) {
|
|
4789
5070
|
return;
|
|
4790
5071
|
}
|
|
4791
5072
|
controller.moveColumn(movedId, target.beforeId);
|
|
4792
|
-
const
|
|
4793
|
-
const
|
|
5073
|
+
const pin = pinOf(movedId);
|
|
5074
|
+
const group = next.filter(
|
|
5075
|
+
(id) => pinOf(id) === pin && displayedIds.includes(id)
|
|
5076
|
+
);
|
|
5077
|
+
const position = displayedIds.findIndex((id) => pinOf(id) === pin) + group.indexOf(movedId);
|
|
4794
5078
|
announce(
|
|
4795
|
-
messages.columnMoved(
|
|
5079
|
+
messages.columnMoved(
|
|
5080
|
+
columnName(movedId),
|
|
5081
|
+
position + 1,
|
|
5082
|
+
displayedIds.length
|
|
5083
|
+
)
|
|
4796
5084
|
);
|
|
4797
5085
|
nav.focusCell(headerFocus3(position));
|
|
4798
5086
|
}
|
|
@@ -4800,6 +5088,7 @@ function DataGrid(props) {
|
|
|
4800
5088
|
order: displayedIds,
|
|
4801
5089
|
groupBy: state.groupBy,
|
|
4802
5090
|
groupByDraggableIds,
|
|
5091
|
+
pinOf,
|
|
4803
5092
|
onDrop: handleDrop
|
|
4804
5093
|
});
|
|
4805
5094
|
const draggedColumnAlreadyGrouped = drag.draggedColumnId !== null && state.groupBy.some((entry) => entry.columnId === drag.draggedColumnId);
|
|
@@ -4820,9 +5109,11 @@ function DataGrid(props) {
|
|
|
4820
5109
|
const multiselectable = selection.rowMode === "multiple" || selection.columnMode === "multiple";
|
|
4821
5110
|
const contextMenu = useContextMenu({
|
|
4822
5111
|
rootRef: viewportRef,
|
|
5112
|
+
scrollRef: gridRef,
|
|
4823
5113
|
headerTableRef,
|
|
4824
5114
|
bodyTableRef,
|
|
4825
|
-
|
|
5115
|
+
bodyRef,
|
|
5116
|
+
footerTableRef,
|
|
4826
5117
|
contextMenu: props.contextMenu,
|
|
4827
5118
|
overlay,
|
|
4828
5119
|
controller,
|
|
@@ -4855,6 +5146,7 @@ function DataGrid(props) {
|
|
|
4855
5146
|
getColumnSizing: () => controller.getState().columnSizing,
|
|
4856
5147
|
getColumnOrder: () => controller.getState().columnOrder,
|
|
4857
5148
|
getColumnVisibility: () => controller.getState().columnVisibility,
|
|
5149
|
+
getColumnPinning: () => controller.getState().columnPinning,
|
|
4858
5150
|
getColumnSort: () => controller.getState().columnSort,
|
|
4859
5151
|
getFilter: () => controller.getState().filter,
|
|
4860
5152
|
getGroupBy: () => controller.getState().groupBy,
|
|
@@ -4881,6 +5173,7 @@ function DataGrid(props) {
|
|
|
4881
5173
|
setPageSize: controller.setPageSize,
|
|
4882
5174
|
showColumns: controller.showColumns,
|
|
4883
5175
|
hideColumns: controller.hideColumns,
|
|
5176
|
+
pinColumn: controller.pinColumn,
|
|
4884
5177
|
setFilter: controller.setFilter,
|
|
4885
5178
|
setColumnSort: controller.setColumnSort,
|
|
4886
5179
|
setGroupBy: controller.setGroupBy,
|
|
@@ -4889,6 +5182,7 @@ function DataGrid(props) {
|
|
|
4889
5182
|
setColumnSizing: controller.setColumnSizing,
|
|
4890
5183
|
setColumnOrder: controller.setColumnOrder,
|
|
4891
5184
|
setColumnVisibility: controller.setColumnVisibility,
|
|
5185
|
+
setColumnPinning: controller.setColumnPinning,
|
|
4892
5186
|
setRowSelection: controller.setRowSelection,
|
|
4893
5187
|
setColumnSelection: controller.setColumnSelection,
|
|
4894
5188
|
setCellSelection: controller.setCellSelection,
|
|
@@ -4947,181 +5241,215 @@ function DataGrid(props) {
|
|
|
4947
5241
|
selection.cellMode === false ? "" : "gridkit-selectable-cells"
|
|
4948
5242
|
);
|
|
4949
5243
|
const hasFooter = aggregates.length > 0;
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
headerDragBlocked: draggedColumnAlreadyGrouped,
|
|
4973
|
-
headerDropTarget: headerGroupByDropTarget,
|
|
4974
|
-
messages
|
|
4975
|
-
}
|
|
4976
|
-
),
|
|
4977
|
-
/* @__PURE__ */ jsxs19(
|
|
4978
|
-
"div",
|
|
4979
|
-
{
|
|
4980
|
-
ref: gridRef,
|
|
4981
|
-
id: gridId,
|
|
4982
|
-
className: "gridkit-data-grid-tables",
|
|
4983
|
-
role: state.groupBy.length > 0 ? "treegrid" : "grid",
|
|
4984
|
-
"aria-rowcount": view.displayRows.length + (hasFooter ? 2 : 1),
|
|
4985
|
-
"aria-colcount": view.columns.length,
|
|
4986
|
-
...ariaAttr(multiselectable, "aria-multiselectable", true),
|
|
4987
|
-
...ariaAttr(labelledBy !== void 0, "aria-labelledby", labelledBy),
|
|
4988
|
-
...ariaAttr(
|
|
4989
|
-
labelledBy === void 0 && label !== void 0,
|
|
4990
|
-
"aria-label",
|
|
4991
|
-
label
|
|
4992
|
-
),
|
|
4993
|
-
onKeyDown: (event) => {
|
|
4994
|
-
if (!isOwnEvent(event)) return;
|
|
4995
|
-
handleCopyKey(event);
|
|
4996
|
-
if (event.key === "Escape") {
|
|
4997
|
-
if (drag.draggedColumnId !== null || resize.activeColumnId !== null)
|
|
4998
|
-
return;
|
|
4999
|
-
selection.clear();
|
|
5000
|
-
return;
|
|
5244
|
+
const headerHeight = useElementHeight(headerTableRef, height !== void 0);
|
|
5245
|
+
const footerHeight = useElementHeight(
|
|
5246
|
+
footerTableRef,
|
|
5247
|
+
height !== void 0 && hasFooter
|
|
5248
|
+
);
|
|
5249
|
+
return /* @__PURE__ */ jsxs19(
|
|
5250
|
+
"div",
|
|
5251
|
+
{
|
|
5252
|
+
className: "gridkit-data-grid-viewport",
|
|
5253
|
+
ref: viewportRef,
|
|
5254
|
+
tabIndex: -1,
|
|
5255
|
+
children: [
|
|
5256
|
+
/* @__PURE__ */ jsx28(
|
|
5257
|
+
GridToolbar,
|
|
5258
|
+
{
|
|
5259
|
+
toolbar: props.toolbar,
|
|
5260
|
+
renderItem: props.renderToolbarItem,
|
|
5261
|
+
gridId,
|
|
5262
|
+
controller,
|
|
5263
|
+
commands,
|
|
5264
|
+
messages,
|
|
5265
|
+
announce
|
|
5001
5266
|
}
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5267
|
+
),
|
|
5268
|
+
showGroupByBar && /* @__PURE__ */ jsx28(
|
|
5269
|
+
GroupByBar,
|
|
5270
|
+
{
|
|
5271
|
+
columns: view.columns,
|
|
5272
|
+
definitions,
|
|
5273
|
+
groupBy: state.groupBy,
|
|
5274
|
+
controller,
|
|
5275
|
+
columnName,
|
|
5276
|
+
headerDragEligible: dragEligibleForGroupBy,
|
|
5277
|
+
headerDragBlocked: draggedColumnAlreadyGrouped,
|
|
5278
|
+
headerDropTarget: headerGroupByDropTarget,
|
|
5279
|
+
messages
|
|
5006
5280
|
}
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5281
|
+
),
|
|
5282
|
+
/* @__PURE__ */ jsxs19(
|
|
5283
|
+
"div",
|
|
5284
|
+
{
|
|
5285
|
+
ref: gridRef,
|
|
5286
|
+
id: gridId,
|
|
5287
|
+
className: "gridkit-data-grid-tables",
|
|
5288
|
+
role: state.groupBy.length > 0 ? "treegrid" : "grid",
|
|
5289
|
+
"aria-rowcount": view.rowCount + (hasFooter ? 2 : 1),
|
|
5290
|
+
"aria-colcount": view.columns.length,
|
|
5291
|
+
tabIndex: -1,
|
|
5292
|
+
style: tablesStyle(
|
|
5293
|
+
height,
|
|
5294
|
+
headerHeight,
|
|
5295
|
+
footerHeight,
|
|
5296
|
+
pinnedWidths2(view.columns)
|
|
5297
|
+
),
|
|
5298
|
+
...ariaAttr(multiselectable, "aria-multiselectable", true),
|
|
5299
|
+
...ariaAttr(loading, "aria-busy", true),
|
|
5300
|
+
...ariaAttr(labelledBy !== void 0, "aria-labelledby", labelledBy),
|
|
5301
|
+
...ariaAttr(
|
|
5302
|
+
labelledBy === void 0 && label !== void 0,
|
|
5303
|
+
"aria-label",
|
|
5304
|
+
label
|
|
5305
|
+
),
|
|
5306
|
+
onKeyDown: (event) => {
|
|
5307
|
+
if (!isOwnEvent(event)) return;
|
|
5308
|
+
handleCopyKey(event);
|
|
5309
|
+
if (event.key === "Escape") {
|
|
5310
|
+
if (drag.draggedColumnId !== null || resize.activeColumnId !== null)
|
|
5311
|
+
return;
|
|
5312
|
+
selection.clear();
|
|
5313
|
+
return;
|
|
5314
|
+
}
|
|
5315
|
+
if ((event.ctrlKey || event.metaKey) && (event.key === "a" || event.key === "A")) {
|
|
5316
|
+
if (selection.rowMode !== "multiple") return;
|
|
5317
|
+
event.preventDefault();
|
|
5318
|
+
selection.selectAllRows();
|
|
5319
|
+
}
|
|
5320
|
+
},
|
|
5321
|
+
children: [
|
|
5322
|
+
/* @__PURE__ */ jsxs19(
|
|
5048
5323
|
"table",
|
|
5049
5324
|
{
|
|
5050
|
-
ref:
|
|
5325
|
+
ref: headerTableRef,
|
|
5051
5326
|
role: "presentation",
|
|
5052
5327
|
style: { width: totalColumnWidth(view.columns) },
|
|
5053
|
-
className: gridTableClassName,
|
|
5328
|
+
className: classNames(gridTableClassName, "gridkit-data-grid-header"),
|
|
5054
5329
|
children: [
|
|
5055
|
-
/* @__PURE__ */
|
|
5056
|
-
/* @__PURE__ */
|
|
5057
|
-
|
|
5330
|
+
/* @__PURE__ */ jsx28(GridColgroup, { columns: view.columns }),
|
|
5331
|
+
/* @__PURE__ */ jsx28(
|
|
5332
|
+
GridHeader,
|
|
5058
5333
|
{
|
|
5059
5334
|
columns: view.columns,
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
activeColumnId: resize.activeColumnId,
|
|
5063
|
-
nav,
|
|
5064
|
-
selection,
|
|
5335
|
+
resize,
|
|
5336
|
+
drag,
|
|
5065
5337
|
controller,
|
|
5338
|
+
state,
|
|
5339
|
+
sortableColumns,
|
|
5340
|
+
groupableColumns,
|
|
5341
|
+
groupToggleIconColumns,
|
|
5342
|
+
headerMenu: contextMenu.opens("header"),
|
|
5343
|
+
panels,
|
|
5344
|
+
messages,
|
|
5345
|
+
nav,
|
|
5346
|
+
selection
|
|
5347
|
+
}
|
|
5348
|
+
)
|
|
5349
|
+
]
|
|
5350
|
+
}
|
|
5351
|
+
),
|
|
5352
|
+
/* @__PURE__ */ jsxs19(
|
|
5353
|
+
"div",
|
|
5354
|
+
{
|
|
5355
|
+
className: "gridkit-data-grid-body",
|
|
5356
|
+
ref: bodyRef,
|
|
5357
|
+
role: "rowgroup",
|
|
5358
|
+
tabIndex: -1,
|
|
5359
|
+
children: [
|
|
5360
|
+
/* @__PURE__ */ jsxs19(
|
|
5361
|
+
"table",
|
|
5362
|
+
{
|
|
5363
|
+
ref: bodyTableRef,
|
|
5364
|
+
role: "presentation",
|
|
5365
|
+
style: { width: totalColumnWidth(view.columns) },
|
|
5366
|
+
className: gridTableClassName,
|
|
5367
|
+
children: [
|
|
5368
|
+
/* @__PURE__ */ jsx28(GridColgroup, { columns: view.columns }),
|
|
5369
|
+
/* @__PURE__ */ jsx28(
|
|
5370
|
+
GridBody,
|
|
5371
|
+
{
|
|
5372
|
+
columns: view.columns,
|
|
5373
|
+
definitions,
|
|
5374
|
+
rows: view.pageRows,
|
|
5375
|
+
activeColumnId: resize.activeColumnId,
|
|
5376
|
+
nav,
|
|
5377
|
+
selection,
|
|
5378
|
+
controller,
|
|
5379
|
+
aggregates,
|
|
5380
|
+
groupAggregateDisplay,
|
|
5381
|
+
virtualRange: virtualized ? virtualizer : null,
|
|
5382
|
+
infiniteScroll,
|
|
5383
|
+
sentinelRef,
|
|
5384
|
+
empty,
|
|
5385
|
+
emptyTemplate: props.emptyTemplate,
|
|
5386
|
+
viewportWidth: bodyViewportWidth,
|
|
5387
|
+
locale,
|
|
5388
|
+
getRowProps,
|
|
5389
|
+
onRowClick,
|
|
5390
|
+
onRowDoubleClick,
|
|
5391
|
+
messages,
|
|
5392
|
+
cellMenu: contextMenu.opens("cell"),
|
|
5393
|
+
groupMenu: contextMenu.opens("group")
|
|
5394
|
+
}
|
|
5395
|
+
)
|
|
5396
|
+
]
|
|
5397
|
+
}
|
|
5398
|
+
),
|
|
5399
|
+
loading && /* @__PURE__ */ jsx28(
|
|
5400
|
+
GridLoadingOverlay,
|
|
5401
|
+
{
|
|
5402
|
+
empty: view.pageRows.length === 0,
|
|
5403
|
+
viewportWidth: bodyViewportWidth,
|
|
5404
|
+
children: props.loadingTemplate ? props.loadingTemplate() : messages.loading
|
|
5405
|
+
}
|
|
5406
|
+
)
|
|
5407
|
+
]
|
|
5408
|
+
}
|
|
5409
|
+
),
|
|
5410
|
+
hasFooter && /* @__PURE__ */ jsxs19(
|
|
5411
|
+
"table",
|
|
5412
|
+
{
|
|
5413
|
+
ref: footerTableRef,
|
|
5414
|
+
role: "presentation",
|
|
5415
|
+
style: { width: totalColumnWidth(view.columns) },
|
|
5416
|
+
className: classNames(
|
|
5417
|
+
gridTableClassName,
|
|
5418
|
+
"gridkit-data-grid-footer"
|
|
5419
|
+
),
|
|
5420
|
+
children: [
|
|
5421
|
+
/* @__PURE__ */ jsx28(GridColgroup, { columns: view.columns }),
|
|
5422
|
+
/* @__PURE__ */ jsx28(
|
|
5423
|
+
GridFooter,
|
|
5424
|
+
{
|
|
5425
|
+
columns: view.columns,
|
|
5066
5426
|
aggregates,
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
infiniteScroll,
|
|
5070
|
-
sentinelRef,
|
|
5427
|
+
results: view.grandTotal,
|
|
5428
|
+
rows: view.rows.map((entry) => entry.row),
|
|
5071
5429
|
locale,
|
|
5072
|
-
|
|
5073
|
-
onRowClick,
|
|
5074
|
-
onRowDoubleClick,
|
|
5075
|
-
messages,
|
|
5076
|
-
cellMenu: contextMenu.opens("cell"),
|
|
5077
|
-
groupMenu: contextMenu.opens("group")
|
|
5430
|
+
ariaRowIndex: view.rowCount + 2
|
|
5078
5431
|
}
|
|
5079
5432
|
)
|
|
5080
5433
|
]
|
|
5081
5434
|
}
|
|
5082
5435
|
)
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
aggregates,
|
|
5101
|
-
results: view.grandTotal,
|
|
5102
|
-
rows: view.rows.map((entry) => entry.row),
|
|
5103
|
-
locale,
|
|
5104
|
-
ariaRowIndex: view.displayRows.length + 2
|
|
5105
|
-
}
|
|
5106
|
-
)
|
|
5107
|
-
]
|
|
5108
|
-
}
|
|
5109
|
-
)
|
|
5110
|
-
]
|
|
5111
|
-
}
|
|
5112
|
-
),
|
|
5113
|
-
/* @__PURE__ */ jsx26(GridContextMenu, { contextMenu }),
|
|
5114
|
-
/* @__PURE__ */ jsx26(
|
|
5115
|
-
GridPanels,
|
|
5116
|
-
{
|
|
5117
|
-
panels,
|
|
5118
|
-
controller,
|
|
5119
|
-
commands,
|
|
5120
|
-
messages
|
|
5121
|
-
}
|
|
5122
|
-
),
|
|
5123
|
-
paginated && (pager?.template ? pager.template(pagerContext) : /* @__PURE__ */ jsx26(GridPager, { pager: pagerContext, config: pager, messages }))
|
|
5124
|
-
] });
|
|
5436
|
+
]
|
|
5437
|
+
}
|
|
5438
|
+
),
|
|
5439
|
+
/* @__PURE__ */ jsx28(GridContextMenu, { contextMenu }),
|
|
5440
|
+
/* @__PURE__ */ jsx28(
|
|
5441
|
+
GridPanels,
|
|
5442
|
+
{
|
|
5443
|
+
panels,
|
|
5444
|
+
controller,
|
|
5445
|
+
commands,
|
|
5446
|
+
messages
|
|
5447
|
+
}
|
|
5448
|
+
),
|
|
5449
|
+
paginated && (pager?.template ? pager.template(pagerContext) : /* @__PURE__ */ jsx28(GridPager, { pager: pagerContext, config: pager, messages }))
|
|
5450
|
+
]
|
|
5451
|
+
}
|
|
5452
|
+
);
|
|
5125
5453
|
}
|
|
5126
5454
|
|
|
5127
5455
|
// src/index.ts
|
|
@@ -5134,7 +5462,7 @@ import { useCallback as useCallback5 } from "react";
|
|
|
5134
5462
|
import {
|
|
5135
5463
|
useCallback as useCallback4,
|
|
5136
5464
|
useEffect as useEffect9,
|
|
5137
|
-
useRef as
|
|
5465
|
+
useRef as useRef25,
|
|
5138
5466
|
useSyncExternalStore as useSyncExternalStore3
|
|
5139
5467
|
} from "react";
|
|
5140
5468
|
function subscribeTo(api, listener) {
|
|
@@ -5151,7 +5479,7 @@ function unsubscribe(subscription) {
|
|
|
5151
5479
|
}
|
|
5152
5480
|
}
|
|
5153
5481
|
function useGridSnapshot(gridRef, getSnapshot, fallback) {
|
|
5154
|
-
const subscription =
|
|
5482
|
+
const subscription = useRef25(null);
|
|
5155
5483
|
const subscribe = useCallback4(
|
|
5156
5484
|
(listener) => {
|
|
5157
5485
|
subscription.current = subscribeTo(gridRef.current, listener);
|
|
@@ -5335,13 +5663,24 @@ function useColumnVisibilityState(gridRef) {
|
|
|
5335
5663
|
);
|
|
5336
5664
|
}
|
|
5337
5665
|
|
|
5666
|
+
// src/DataGrid/hooks/useColumnPinningState.ts
|
|
5667
|
+
import { useCallback as useCallback13 } from "react";
|
|
5668
|
+
var FALLBACK_PINNING = {};
|
|
5669
|
+
function useColumnPinningState(gridRef) {
|
|
5670
|
+
return useGridSnapshot(
|
|
5671
|
+
gridRef,
|
|
5672
|
+
useCallback13((api) => api.getColumnPinning(), []),
|
|
5673
|
+
FALLBACK_PINNING
|
|
5674
|
+
);
|
|
5675
|
+
}
|
|
5676
|
+
|
|
5338
5677
|
// src/DataGrid/hooks/useFilterState.ts
|
|
5339
|
-
import { useCallback as
|
|
5678
|
+
import { useCallback as useCallback14, useState as useState20 } from "react";
|
|
5340
5679
|
function useFilterState(gridRef) {
|
|
5341
|
-
const [fallback] =
|
|
5680
|
+
const [fallback] = useState20(() => []);
|
|
5342
5681
|
const filter = useGridSnapshot(
|
|
5343
5682
|
gridRef,
|
|
5344
|
-
|
|
5683
|
+
useCallback14((api) => api.getFilter(), []),
|
|
5345
5684
|
fallback
|
|
5346
5685
|
);
|
|
5347
5686
|
return {
|
|
@@ -5360,6 +5699,7 @@ export {
|
|
|
5360
5699
|
serializeGridState,
|
|
5361
5700
|
useAggregateState,
|
|
5362
5701
|
useColumnOrderState,
|
|
5702
|
+
useColumnPinningState,
|
|
5363
5703
|
useColumnSizingState,
|
|
5364
5704
|
useColumnSortState,
|
|
5365
5705
|
useColumnVisibilityState,
|