@gridkitjs/react 0.17.1 → 0.18.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 +16 -18
- package/dist/index.js +312 -260
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -10,14 +10,13 @@ import {
|
|
|
10
10
|
useState as useState18
|
|
11
11
|
} from "react";
|
|
12
12
|
import {
|
|
13
|
-
bodyFocus as bodyFocus3,
|
|
14
13
|
headerFocus as headerFocus3,
|
|
15
14
|
moveColumnBefore,
|
|
16
15
|
resolveColumnHeaderText as resolveColumnHeaderText2,
|
|
17
16
|
resolveMessages,
|
|
18
|
-
resolveRows
|
|
19
|
-
totalColumnWidth
|
|
17
|
+
resolveRows
|
|
20
18
|
} from "@gridkitjs/core";
|
|
19
|
+
import { totalColumnWidth } from "@gridkitjs/core/renderer";
|
|
21
20
|
|
|
22
21
|
// src/DataGrid/components/GridColgroup.tsx
|
|
23
22
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -28,15 +27,17 @@ function GridColgroup({ columns }) {
|
|
|
28
27
|
// src/DataGrid/components/GridHeader.tsx
|
|
29
28
|
import { createPortal } from "react-dom";
|
|
30
29
|
import {
|
|
31
|
-
buildKeyShortcuts,
|
|
32
30
|
headerFocus,
|
|
33
|
-
intentOf,
|
|
34
31
|
isColumnFiltered,
|
|
35
|
-
KEYBOARD_STEP,
|
|
36
|
-
resolveColumnFilterMenu,
|
|
37
32
|
sortDirectionFor,
|
|
38
33
|
sortPriorityFor
|
|
39
34
|
} from "@gridkitjs/core";
|
|
35
|
+
import {
|
|
36
|
+
buildKeyShortcuts,
|
|
37
|
+
intentOf,
|
|
38
|
+
KEYBOARD_STEP,
|
|
39
|
+
resolveColumnFilterMenu
|
|
40
|
+
} from "@gridkitjs/core/renderer";
|
|
40
41
|
|
|
41
42
|
// src/DataGrid/ariaAttr.ts
|
|
42
43
|
function ariaAttr(condition, key, value) {
|
|
@@ -175,7 +176,7 @@ function GridHeader({
|
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
178
|
return /* @__PURE__ */ jsxs2("thead", { role: "rowgroup", children: [
|
|
178
|
-
/* @__PURE__ */ jsx3("tr", { className: "grid-header", role: "row", "aria-rowindex": 1, children: columns.map((entry, index) => {
|
|
179
|
+
/* @__PURE__ */ jsx3("tr", { className: "gridkit-grid-header", role: "row", "aria-rowindex": 1, children: columns.map((entry, index) => {
|
|
179
180
|
const { column } = entry;
|
|
180
181
|
const resizing = resize.activeColumnId === entry.id;
|
|
181
182
|
const dragging = drag.draggedColumnId === entry.id;
|
|
@@ -220,7 +221,7 @@ function GridHeader({
|
|
|
220
221
|
if (drag.justDragged(entry.id)) {
|
|
221
222
|
return;
|
|
222
223
|
}
|
|
223
|
-
if (event.target instanceof Element && (event.target.closest(".header-resize-handle") !== null || event.target.closest(".header-sort-toggle") !== null || event.target.closest(".header-group-toggle") !== null || event.target.closest(".header-filter-toggle") !== null)) {
|
|
224
|
+
if (event.target instanceof Element && (event.target.closest(".gridkit-header-resize-handle") !== null || event.target.closest(".gridkit-header-sort-toggle") !== null || event.target.closest(".gridkit-header-group-toggle") !== null || event.target.closest(".gridkit-header-filter-toggle") !== null)) {
|
|
224
225
|
return;
|
|
225
226
|
}
|
|
226
227
|
selection.selectColumn(entry.id, intentOf(event));
|
|
@@ -272,7 +273,7 @@ function GridHeader({
|
|
|
272
273
|
nav.onKeyDown(event);
|
|
273
274
|
},
|
|
274
275
|
className: classNames(
|
|
275
|
-
"header-cell",
|
|
276
|
+
"gridkit-header-cell",
|
|
276
277
|
// The grab affordance a header showing either drag
|
|
277
278
|
// destination shares — a column dragged only for grouping
|
|
278
279
|
// (`groupByDraggable` without `reorderable`) grabs the same
|
|
@@ -316,7 +317,7 @@ function GridHeader({
|
|
|
316
317
|
"span",
|
|
317
318
|
{
|
|
318
319
|
className: classNames(
|
|
319
|
-
"header-group-toggle",
|
|
320
|
+
"gridkit-header-group-toggle",
|
|
320
321
|
isGrouped ? "is-grouped" : ""
|
|
321
322
|
),
|
|
322
323
|
"aria-hidden": "true",
|
|
@@ -342,7 +343,7 @@ function GridHeader({
|
|
|
342
343
|
"span",
|
|
343
344
|
{
|
|
344
345
|
className: classNames(
|
|
345
|
-
"header-sort-toggle",
|
|
346
|
+
"gridkit-header-sort-toggle",
|
|
346
347
|
sortDirection !== null ? `is-sorted-${sortDirection}` : ""
|
|
347
348
|
),
|
|
348
349
|
"aria-hidden": "true",
|
|
@@ -357,7 +358,7 @@ function GridHeader({
|
|
|
357
358
|
},
|
|
358
359
|
children: [
|
|
359
360
|
sortDirection === null ? /* @__PURE__ */ jsx3(ChevronsUpDownIcon, {}) : /* @__PURE__ */ jsx3(ChevronUpIcon, {}),
|
|
360
|
-
sortPriority !== null && sortPriority > 1 && /* @__PURE__ */ jsx3("span", { className: "header-sort-priority", children: sortPriority })
|
|
361
|
+
sortPriority !== null && sortPriority > 1 && /* @__PURE__ */ jsx3("span", { className: "gridkit-header-sort-priority", children: sortPriority })
|
|
361
362
|
]
|
|
362
363
|
}
|
|
363
364
|
),
|
|
@@ -371,7 +372,7 @@ function GridHeader({
|
|
|
371
372
|
"span",
|
|
372
373
|
{
|
|
373
374
|
className: classNames(
|
|
374
|
-
"header-filter-toggle",
|
|
375
|
+
"gridkit-header-filter-toggle",
|
|
375
376
|
filtered ? "is-filtered" : ""
|
|
376
377
|
),
|
|
377
378
|
"aria-hidden": "true",
|
|
@@ -394,7 +395,7 @@ function GridHeader({
|
|
|
394
395
|
/* @__PURE__ */ jsx3(
|
|
395
396
|
"span",
|
|
396
397
|
{
|
|
397
|
-
className: "header-resize-handle",
|
|
398
|
+
className: "gridkit-header-resize-handle",
|
|
398
399
|
"aria-hidden": "true",
|
|
399
400
|
tabIndex: -1,
|
|
400
401
|
onPointerDown: (event) => {
|
|
@@ -414,7 +415,7 @@ function GridHeader({
|
|
|
414
415
|
/* @__PURE__ */ jsx3(
|
|
415
416
|
"div",
|
|
416
417
|
{
|
|
417
|
-
className: "gridkit-data-grid header-cell drag-ghost",
|
|
418
|
+
className: "gridkit-data-grid gridkit-header-cell gridkit-drag-ghost",
|
|
418
419
|
style: {
|
|
419
420
|
width: draggedEntry.width,
|
|
420
421
|
transform: drag.ghostTransform
|
|
@@ -435,9 +436,9 @@ import {
|
|
|
435
436
|
} from "react";
|
|
436
437
|
import {
|
|
437
438
|
bodyFocus,
|
|
438
|
-
groupRowId
|
|
439
|
-
intentOf as intentOf2
|
|
439
|
+
groupRowId
|
|
440
440
|
} from "@gridkitjs/core";
|
|
441
|
+
import { intentOf as intentOf2 } from "@gridkitjs/core/renderer";
|
|
441
442
|
import {
|
|
442
443
|
bodyCellFrom,
|
|
443
444
|
bodyRowFrom,
|
|
@@ -614,7 +615,7 @@ function GridGroupRowComponent({
|
|
|
614
615
|
"data-gridkit-group": groupId,
|
|
615
616
|
"data-gridkit-row-index": rowIndex,
|
|
616
617
|
className: classNames(
|
|
617
|
-
"grid-group-row",
|
|
618
|
+
"gridkit-grid-group-row",
|
|
618
619
|
`is-group-level-${String(level)}`
|
|
619
620
|
),
|
|
620
621
|
children: /* @__PURE__ */ jsx4(
|
|
@@ -624,35 +625,35 @@ function GridGroupRowComponent({
|
|
|
624
625
|
colSpan: columnCount,
|
|
625
626
|
tabIndex: focused ? 0 : -1,
|
|
626
627
|
"aria-keyshortcuts": contextMenu ? "Space Enter Shift+F10" : "Space Enter",
|
|
627
|
-
className: "grid-group-cell",
|
|
628
|
+
className: "gridkit-grid-group-cell",
|
|
628
629
|
children: /* @__PURE__ */ jsxs3(
|
|
629
630
|
"div",
|
|
630
631
|
{
|
|
631
|
-
className: "grid-group-cell-content",
|
|
632
|
+
className: "gridkit-grid-group-cell-content",
|
|
632
633
|
style: { paddingInlineStart: `${String(level * 1.25 + 0.5)}rem` },
|
|
633
634
|
children: [
|
|
634
635
|
/* @__PURE__ */ jsx4(
|
|
635
636
|
"span",
|
|
636
637
|
{
|
|
637
638
|
className: classNames(
|
|
638
|
-
"group-toggle",
|
|
639
|
+
"gridkit-group-toggle",
|
|
639
640
|
expanded ? "is-expanded" : "is-collapsed"
|
|
640
641
|
),
|
|
641
642
|
"aria-hidden": "true"
|
|
642
643
|
}
|
|
643
644
|
),
|
|
644
|
-
/* @__PURE__ */ jsxs3("span", { className: "group-label", children: [
|
|
645
|
+
/* @__PURE__ */ jsxs3("span", { className: "gridkit-group-label", children: [
|
|
645
646
|
resolveColumnLabel(groupColumn),
|
|
646
647
|
":",
|
|
647
648
|
" ",
|
|
648
649
|
formatGroupValue(value, groupColumn, locale, cellMessages)
|
|
649
650
|
] }),
|
|
650
|
-
/* @__PURE__ */ jsxs3("span", { className: "group-count", children: [
|
|
651
|
+
/* @__PURE__ */ jsxs3("span", { className: "gridkit-group-count", children: [
|
|
651
652
|
"(",
|
|
652
653
|
count,
|
|
653
654
|
")"
|
|
654
655
|
] }),
|
|
655
|
-
aggregates.length > 0 && /* @__PURE__ */ jsx4("span", { className: "group-aggregates", children: aggregates.map((spec) => {
|
|
656
|
+
aggregates.length > 0 && /* @__PURE__ */ jsx4("span", { className: "gridkit-group-aggregates", children: aggregates.map((spec) => {
|
|
656
657
|
const key = spec.id ?? spec.columnId;
|
|
657
658
|
const aggregateValue = results.get(key);
|
|
658
659
|
const column = definitions.get(spec.columnId);
|
|
@@ -664,7 +665,7 @@ function GridGroupRowComponent({
|
|
|
664
665
|
locale
|
|
665
666
|
);
|
|
666
667
|
const aggregateLabel = spec.id ?? (column === void 0 ? spec.columnId : resolveColumnLabel(column));
|
|
667
|
-
return /* @__PURE__ */ jsxs3("span", { className: "group-aggregate", children: [
|
|
668
|
+
return /* @__PURE__ */ jsxs3("span", { className: "gridkit-group-aggregate", children: [
|
|
668
669
|
aggregateLabel,
|
|
669
670
|
": ",
|
|
670
671
|
rendered
|
|
@@ -706,7 +707,7 @@ function GridGroupSummaryRowComponent({
|
|
|
706
707
|
"data-gridkit-group-summary": groupId,
|
|
707
708
|
"data-gridkit-row-index": rowIndex,
|
|
708
709
|
className: classNames(
|
|
709
|
-
"grid-group-summary-row",
|
|
710
|
+
"gridkit-grid-group-summary-row",
|
|
710
711
|
`is-group-level-${String(level)}`
|
|
711
712
|
),
|
|
712
713
|
children: columns.map((entry) => {
|
|
@@ -718,13 +719,13 @@ function GridGroupSummaryRowComponent({
|
|
|
718
719
|
{
|
|
719
720
|
role: "gridcell",
|
|
720
721
|
"data-gridkit-column": entry.id,
|
|
721
|
-
className: "grid-group-summary-cell",
|
|
722
|
+
className: "gridkit-grid-group-summary-cell",
|
|
722
723
|
style: { textAlign: specs[0]?.alignment ?? entry.alignment },
|
|
723
724
|
children: [
|
|
724
725
|
entry.id === columns[0]?.id && /* @__PURE__ */ jsx5(
|
|
725
726
|
"span",
|
|
726
727
|
{
|
|
727
|
-
className: "grid-group-summary-indent",
|
|
728
|
+
className: "gridkit-grid-group-summary-indent",
|
|
728
729
|
style: { width: `${String(level * 1.25 + 0.5)}rem` },
|
|
729
730
|
"aria-hidden": "true"
|
|
730
731
|
}
|
|
@@ -795,7 +796,7 @@ function GridRowComponent({
|
|
|
795
796
|
"data-gridkit-row-id": rowId,
|
|
796
797
|
...ariaAttr(rowsSelectable, "aria-selected", selected),
|
|
797
798
|
className: classNames(
|
|
798
|
-
"grid-row",
|
|
799
|
+
"gridkit-grid-row",
|
|
799
800
|
selected ? "is-selected" : "",
|
|
800
801
|
rowClassName
|
|
801
802
|
),
|
|
@@ -812,7 +813,7 @@ function GridRowComponent({
|
|
|
812
813
|
...ariaAttr(cellsSelectable, "aria-selected", cellSelected),
|
|
813
814
|
...ariaAttr(shortcuts !== "", "aria-keyshortcuts", shortcuts),
|
|
814
815
|
className: classNames(
|
|
815
|
-
"grid-cell",
|
|
816
|
+
"gridkit-grid-cell",
|
|
816
817
|
id === activeColumnId ? "is-resizing" : "",
|
|
817
818
|
cellSelected || selectedColumnIds.has(id) ? "is-selected" : "",
|
|
818
819
|
column.wrap?.cells ? "is-wrapped" : "",
|
|
@@ -842,14 +843,14 @@ import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
|
842
843
|
function groupAriaMeta(rows) {
|
|
843
844
|
const totals = /* @__PURE__ */ new Map();
|
|
844
845
|
for (const entry of rows) {
|
|
845
|
-
if (
|
|
846
|
+
if (entry.kind !== "group") continue;
|
|
846
847
|
const parentKey = groupRowId(entry.path.slice(0, -1));
|
|
847
848
|
totals.set(parentKey, (totals.get(parentKey) ?? 0) + 1);
|
|
848
849
|
}
|
|
849
850
|
const seen = /* @__PURE__ */ new Map();
|
|
850
851
|
const meta = /* @__PURE__ */ new Map();
|
|
851
852
|
for (const entry of rows) {
|
|
852
|
-
if (
|
|
853
|
+
if (entry.kind !== "group") continue;
|
|
853
854
|
const parentKey = groupRowId(entry.path.slice(0, -1));
|
|
854
855
|
const posinset = (seen.get(parentKey) ?? 0) + 1;
|
|
855
856
|
seen.set(parentKey, posinset);
|
|
@@ -892,14 +893,14 @@ function GridBody({
|
|
|
892
893
|
const [resolveRowProps] = useState2(() => createRowPropsResolver());
|
|
893
894
|
const rowPropsOf = resolveRowProps(
|
|
894
895
|
visibleRows.filter(
|
|
895
|
-
(entry) =>
|
|
896
|
+
(entry) => entry.kind === "data"
|
|
896
897
|
),
|
|
897
898
|
getRowProps
|
|
898
899
|
);
|
|
899
900
|
function targetOf(target) {
|
|
900
901
|
const position = bodyCellFrom(target);
|
|
901
902
|
const entry = position === null ? void 0 : rows[position.rowIndex];
|
|
902
|
-
if (position === null || entry
|
|
903
|
+
if (position === null || entry?.kind !== "data") {
|
|
903
904
|
return null;
|
|
904
905
|
}
|
|
905
906
|
return { position, rowId: entry.rowId };
|
|
@@ -915,7 +916,7 @@ function GridBody({
|
|
|
915
916
|
function rowPointerEventOf(event) {
|
|
916
917
|
const target = bodyRowFrom(event.target);
|
|
917
918
|
const entry = target === null ? void 0 : rows[target.rowIndex];
|
|
918
|
-
if (target === null || entry
|
|
919
|
+
if (target === null || entry?.kind !== "data") {
|
|
919
920
|
return null;
|
|
920
921
|
}
|
|
921
922
|
return {
|
|
@@ -941,7 +942,7 @@ function GridBody({
|
|
|
941
942
|
"tbody",
|
|
942
943
|
{
|
|
943
944
|
role: "rowgroup",
|
|
944
|
-
className: "grid-body",
|
|
945
|
+
className: "gridkit-grid-body",
|
|
945
946
|
onFocus: (event) => {
|
|
946
947
|
const group = groupRowFrom(event.target);
|
|
947
948
|
if (group !== null) {
|
|
@@ -1016,75 +1017,82 @@ function GridBody({
|
|
|
1016
1017
|
}
|
|
1017
1018
|
) }),
|
|
1018
1019
|
visibleRows.map((entry) => {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1020
|
+
switch (entry.kind) {
|
|
1021
|
+
case "data": {
|
|
1022
|
+
const rowProps = rowPropsOf(entry.rowId);
|
|
1023
|
+
return /* @__PURE__ */ jsx7(
|
|
1024
|
+
GridRow_default,
|
|
1025
|
+
{
|
|
1026
|
+
ref: virtualRange?.measureRow(entry.rowIndex),
|
|
1027
|
+
columns,
|
|
1028
|
+
rowId: entry.rowId,
|
|
1029
|
+
row: entry.row,
|
|
1030
|
+
rowIndex: entry.rowIndex,
|
|
1031
|
+
datasetIndex: entry.datasetIndex,
|
|
1032
|
+
activeColumnId,
|
|
1033
|
+
selectedColumnIds: selection.selectedColumnIds,
|
|
1034
|
+
selected: selection.selectedRowIds.has(entry.rowId),
|
|
1035
|
+
selectedColumnId: selectedCell.kind === "cell" && selectedCell.rowId === entry.rowId ? selectedCell.columnId : null,
|
|
1036
|
+
focusedColumnIndex: focusedColumnInRow(
|
|
1037
|
+
nav.focus,
|
|
1038
|
+
entry.rowIndex
|
|
1039
|
+
),
|
|
1040
|
+
rowsSelectable: rowMode !== false,
|
|
1041
|
+
cellsSelectable: cellMode !== false,
|
|
1042
|
+
contextMenu: cellMenu,
|
|
1043
|
+
locale,
|
|
1044
|
+
cellMessages,
|
|
1045
|
+
rowClassName: rowProps.className,
|
|
1046
|
+
rowAttributes: rowProps.attributes
|
|
1047
|
+
},
|
|
1048
|
+
entry.rowId
|
|
1049
|
+
);
|
|
1050
|
+
}
|
|
1051
|
+
case "group-summary":
|
|
1052
|
+
return /* @__PURE__ */ jsx7(
|
|
1053
|
+
GridGroupSummaryRow_default,
|
|
1054
|
+
{
|
|
1055
|
+
ref: virtualRange?.measureRow(entry.rowIndex),
|
|
1056
|
+
groupId: entry.groupId,
|
|
1057
|
+
level: entry.level,
|
|
1058
|
+
rowIndex: entry.rowIndex,
|
|
1059
|
+
datasetIndex: entry.datasetIndex,
|
|
1060
|
+
results: entry.aggregates,
|
|
1061
|
+
aggregates,
|
|
1062
|
+
columns,
|
|
1063
|
+
locale
|
|
1064
|
+
},
|
|
1065
|
+
`${entry.groupId}-summary`
|
|
1066
|
+
);
|
|
1067
|
+
case "group":
|
|
1068
|
+
return /* @__PURE__ */ jsx7(
|
|
1069
|
+
GridGroupRow_default,
|
|
1070
|
+
{
|
|
1071
|
+
ref: virtualRange?.measureRow(entry.rowIndex),
|
|
1072
|
+
columnCount: columns.length,
|
|
1073
|
+
groupId: entry.groupId,
|
|
1074
|
+
level: entry.level,
|
|
1075
|
+
groupColumn: definitions.get(entry.columnId) ?? { field: entry.columnId },
|
|
1076
|
+
value: entry.value,
|
|
1077
|
+
expanded: entry.expanded,
|
|
1078
|
+
count: entry.count,
|
|
1079
|
+
rowIndex: entry.rowIndex,
|
|
1080
|
+
datasetIndex: entry.datasetIndex,
|
|
1081
|
+
posinset: ariaMeta.get(entry.groupId)?.posinset ?? 1,
|
|
1082
|
+
setsize: ariaMeta.get(entry.groupId)?.setsize ?? 1,
|
|
1083
|
+
aggregates: groupAggregateDisplay === "inline" ? aggregates : [],
|
|
1084
|
+
results: entry.aggregates,
|
|
1085
|
+
definitions,
|
|
1086
|
+
locale,
|
|
1087
|
+
cellMessages,
|
|
1088
|
+
focused: focusedColumnInRow(nav.focus, entry.rowIndex) !== null,
|
|
1089
|
+
contextMenu: groupMenu
|
|
1090
|
+
},
|
|
1091
|
+
entry.groupId
|
|
1092
|
+
);
|
|
1093
|
+
default:
|
|
1094
|
+
return entry;
|
|
1062
1095
|
}
|
|
1063
|
-
return /* @__PURE__ */ jsx7(
|
|
1064
|
-
GridGroupRow_default,
|
|
1065
|
-
{
|
|
1066
|
-
ref: virtualRange?.measureRow(entry.rowIndex),
|
|
1067
|
-
columnCount: columns.length,
|
|
1068
|
-
groupId: entry.groupId,
|
|
1069
|
-
level: entry.level,
|
|
1070
|
-
groupColumn: definitions.get(entry.columnId) ?? { field: entry.columnId },
|
|
1071
|
-
value: entry.value,
|
|
1072
|
-
expanded: entry.expanded,
|
|
1073
|
-
count: entry.count,
|
|
1074
|
-
rowIndex: entry.rowIndex,
|
|
1075
|
-
datasetIndex: entry.datasetIndex,
|
|
1076
|
-
posinset: ariaMeta.get(entry.groupId)?.posinset ?? 1,
|
|
1077
|
-
setsize: ariaMeta.get(entry.groupId)?.setsize ?? 1,
|
|
1078
|
-
aggregates: groupAggregateDisplay === "inline" ? aggregates : [],
|
|
1079
|
-
results: entry.aggregates,
|
|
1080
|
-
definitions,
|
|
1081
|
-
locale,
|
|
1082
|
-
cellMessages,
|
|
1083
|
-
focused: focusedColumnInRow(nav.focus, entry.rowIndex) !== null,
|
|
1084
|
-
contextMenu: groupMenu
|
|
1085
|
-
},
|
|
1086
|
-
entry.groupId
|
|
1087
|
-
);
|
|
1088
1096
|
}),
|
|
1089
1097
|
virtualRange !== null && virtualRange.offsetAfter > 0 && /* @__PURE__ */ jsx7("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx7(
|
|
1090
1098
|
"td",
|
|
@@ -1097,13 +1105,20 @@ function GridBody({
|
|
|
1097
1105
|
}
|
|
1098
1106
|
) }),
|
|
1099
1107
|
infiniteScroll?.hasMore && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1100
|
-
infiniteScroll.isLoadingMore === true && /* @__PURE__ */ jsx7("tr", { "aria-hidden": "true", className: "grid-loading-row", children: /* @__PURE__ */ jsx7(
|
|
1108
|
+
infiniteScroll.isLoadingMore === true && /* @__PURE__ */ jsx7("tr", { "aria-hidden": "true", className: "gridkit-grid-loading-row", children: /* @__PURE__ */ jsx7(
|
|
1109
|
+
"td",
|
|
1110
|
+
{
|
|
1111
|
+
colSpan: columns.length,
|
|
1112
|
+
className: "gridkit-grid-loading-cell",
|
|
1113
|
+
children: infiniteScroll.loadingTemplate ? infiniteScroll.loadingTemplate() : messages.loadingMore
|
|
1114
|
+
}
|
|
1115
|
+
) }),
|
|
1101
1116
|
/* @__PURE__ */ jsx7(
|
|
1102
1117
|
"tr",
|
|
1103
1118
|
{
|
|
1104
1119
|
"aria-hidden": "true",
|
|
1105
1120
|
ref: sentinelRef,
|
|
1106
|
-
className: "grid-sentinel-row",
|
|
1121
|
+
className: "gridkit-grid-sentinel-row",
|
|
1107
1122
|
children: /* @__PURE__ */ jsx7(
|
|
1108
1123
|
"td",
|
|
1109
1124
|
{
|
|
@@ -1129,36 +1144,44 @@ function GridFooter({
|
|
|
1129
1144
|
locale,
|
|
1130
1145
|
ariaRowIndex
|
|
1131
1146
|
}) {
|
|
1132
|
-
return /* @__PURE__ */ jsx8("tfoot", { role: "rowgroup", children: /* @__PURE__ */ jsx8(
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
"
|
|
1138
|
-
{
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1147
|
+
return /* @__PURE__ */ jsx8("tfoot", { role: "rowgroup", children: /* @__PURE__ */ jsx8(
|
|
1148
|
+
"tr",
|
|
1149
|
+
{
|
|
1150
|
+
className: "gridkit-grid-footer",
|
|
1151
|
+
role: "row",
|
|
1152
|
+
"aria-rowindex": ariaRowIndex,
|
|
1153
|
+
children: columns.map((entry) => {
|
|
1154
|
+
const specs = aggregates.filter(
|
|
1155
|
+
(candidate) => candidate.columnId === entry.id
|
|
1156
|
+
);
|
|
1157
|
+
return /* @__PURE__ */ jsx8(
|
|
1158
|
+
"td",
|
|
1159
|
+
{
|
|
1160
|
+
role: "gridcell",
|
|
1161
|
+
"data-gridkit-column": entry.id,
|
|
1162
|
+
className: "gridkit-grid-footer-cell",
|
|
1163
|
+
style: { textAlign: specs[0]?.alignment ?? entry.alignment },
|
|
1164
|
+
children: specs.map(
|
|
1165
|
+
(spec) => renderAggregate(
|
|
1166
|
+
results.get(spec.id ?? spec.columnId),
|
|
1167
|
+
spec,
|
|
1168
|
+
entry.column,
|
|
1169
|
+
rows,
|
|
1170
|
+
locale
|
|
1171
|
+
)
|
|
1172
|
+
).flatMap(
|
|
1173
|
+
(rendered, index) => index === 0 ? [rendered] : [", ", rendered]
|
|
1174
|
+
)
|
|
1175
|
+
},
|
|
1176
|
+
entry.id
|
|
1177
|
+
);
|
|
1178
|
+
})
|
|
1179
|
+
}
|
|
1180
|
+
) });
|
|
1158
1181
|
}
|
|
1159
1182
|
|
|
1160
1183
|
// src/DataGrid/components/GridPager.tsx
|
|
1161
|
-
import { paginationWindow } from "@gridkitjs/core";
|
|
1184
|
+
import { paginationWindow } from "@gridkitjs/core/renderer";
|
|
1162
1185
|
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1163
1186
|
function PagerNavButton({
|
|
1164
1187
|
className,
|
|
@@ -1171,7 +1194,7 @@ function PagerNavButton({
|
|
|
1171
1194
|
"button",
|
|
1172
1195
|
{
|
|
1173
1196
|
type: "button",
|
|
1174
|
-
className: `grid-pager-button grid-pager-nav ${className}`,
|
|
1197
|
+
className: `gridkit-grid-pager-button gridkit-grid-pager-nav ${className}`,
|
|
1175
1198
|
"aria-label": label,
|
|
1176
1199
|
title: label,
|
|
1177
1200
|
...ariaAttr(disabled, "aria-disabled", true),
|
|
@@ -1198,11 +1221,11 @@ function GridPager({ pager, config, messages }) {
|
|
|
1198
1221
|
role: "group",
|
|
1199
1222
|
"aria-label": messages.pagerLabel,
|
|
1200
1223
|
children: [
|
|
1201
|
-
/* @__PURE__ */ jsxs6("div", { className: "grid-pager-bar", style: barStyle, children: [
|
|
1224
|
+
/* @__PURE__ */ jsxs6("div", { className: "gridkit-grid-pager-bar", style: barStyle, children: [
|
|
1202
1225
|
/* @__PURE__ */ jsx9(
|
|
1203
1226
|
PagerNavButton,
|
|
1204
1227
|
{
|
|
1205
|
-
className: "grid-pager-first",
|
|
1228
|
+
className: "gridkit-grid-pager-first",
|
|
1206
1229
|
label: messages.firstPage,
|
|
1207
1230
|
disabled: atFirst,
|
|
1208
1231
|
onClick: () => {
|
|
@@ -1214,7 +1237,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1214
1237
|
/* @__PURE__ */ jsx9(
|
|
1215
1238
|
PagerNavButton,
|
|
1216
1239
|
{
|
|
1217
|
-
className: "grid-pager-previous",
|
|
1240
|
+
className: "gridkit-grid-pager-previous",
|
|
1218
1241
|
label: messages.previousPage,
|
|
1219
1242
|
disabled: atFirst,
|
|
1220
1243
|
onClick: () => {
|
|
@@ -1230,7 +1253,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1230
1253
|
(entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx9(
|
|
1231
1254
|
"span",
|
|
1232
1255
|
{
|
|
1233
|
-
className: "grid-pager-ellipsis",
|
|
1256
|
+
className: "gridkit-grid-pager-ellipsis",
|
|
1234
1257
|
"aria-hidden": "true",
|
|
1235
1258
|
children: "\u2026"
|
|
1236
1259
|
},
|
|
@@ -1239,7 +1262,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1239
1262
|
"button",
|
|
1240
1263
|
{
|
|
1241
1264
|
type: "button",
|
|
1242
|
-
className: "grid-pager-button grid-pager-page",
|
|
1265
|
+
className: "gridkit-grid-pager-button gridkit-grid-pager-page",
|
|
1243
1266
|
"aria-label": messages.pageButtonLabel(entry),
|
|
1244
1267
|
"aria-current": entry === currentPage ? "page" : void 0,
|
|
1245
1268
|
onClick: () => {
|
|
@@ -1249,17 +1272,24 @@ function GridPager({ pager, config, messages }) {
|
|
|
1249
1272
|
},
|
|
1250
1273
|
entry
|
|
1251
1274
|
)
|
|
1252
|
-
) : /* @__PURE__ */ jsxs6("span", { className: "grid-pager-status-slot", children: [
|
|
1253
|
-
/* @__PURE__ */ jsx9("span", { className: "grid-pager-status", children: messages.pageStatus(
|
|
1275
|
+
) : /* @__PURE__ */ jsxs6("span", { className: "gridkit-grid-pager-status-slot", children: [
|
|
1276
|
+
/* @__PURE__ */ jsx9("span", { className: "gridkit-grid-pager-status", children: messages.pageStatus(
|
|
1254
1277
|
pageCount === 0 ? 0 : currentPage,
|
|
1255
1278
|
pageCount
|
|
1256
1279
|
) }),
|
|
1257
|
-
/* @__PURE__ */ jsx9(
|
|
1280
|
+
/* @__PURE__ */ jsx9(
|
|
1281
|
+
"span",
|
|
1282
|
+
{
|
|
1283
|
+
className: "gridkit-grid-pager-status-sizer",
|
|
1284
|
+
"aria-hidden": "true",
|
|
1285
|
+
children: messages.pageStatus(pageCount, pageCount)
|
|
1286
|
+
}
|
|
1287
|
+
)
|
|
1258
1288
|
] }),
|
|
1259
1289
|
/* @__PURE__ */ jsx9(
|
|
1260
1290
|
PagerNavButton,
|
|
1261
1291
|
{
|
|
1262
|
-
className: "grid-pager-next",
|
|
1292
|
+
className: "gridkit-grid-pager-next",
|
|
1263
1293
|
label: messages.nextPage,
|
|
1264
1294
|
disabled: atLast,
|
|
1265
1295
|
onClick: () => {
|
|
@@ -1271,7 +1301,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1271
1301
|
/* @__PURE__ */ jsx9(
|
|
1272
1302
|
PagerNavButton,
|
|
1273
1303
|
{
|
|
1274
|
-
className: "grid-pager-last",
|
|
1304
|
+
className: "gridkit-grid-pager-last",
|
|
1275
1305
|
label: messages.lastPage,
|
|
1276
1306
|
disabled: atLast,
|
|
1277
1307
|
onClick: () => {
|
|
@@ -1281,7 +1311,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1281
1311
|
}
|
|
1282
1312
|
)
|
|
1283
1313
|
] }),
|
|
1284
|
-
sizeOptions !== void 0 && sizeOptions.length > 0 && /* @__PURE__ */ jsxs6("label", { className: "grid-pager-page-size", children: [
|
|
1314
|
+
sizeOptions !== void 0 && sizeOptions.length > 0 && /* @__PURE__ */ jsxs6("label", { className: "gridkit-grid-pager-page-size", children: [
|
|
1285
1315
|
/* @__PURE__ */ jsx9(
|
|
1286
1316
|
"select",
|
|
1287
1317
|
{
|
|
@@ -1292,7 +1322,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1292
1322
|
children: sizeOptions.map((size) => /* @__PURE__ */ jsx9("option", { value: size, children: size }, size))
|
|
1293
1323
|
}
|
|
1294
1324
|
),
|
|
1295
|
-
/* @__PURE__ */ jsx9("span", { className: "grid-pager-page-size-label", children: messages.pageSizeLabel })
|
|
1325
|
+
/* @__PURE__ */ jsx9("span", { className: "gridkit-grid-pager-page-size-label", children: messages.pageSizeLabel })
|
|
1296
1326
|
] })
|
|
1297
1327
|
]
|
|
1298
1328
|
}
|
|
@@ -1302,9 +1332,9 @@ function GridPager({ pager, config, messages }) {
|
|
|
1302
1332
|
// src/DataGrid/components/GroupByBar.tsx
|
|
1303
1333
|
import { createPortal as createPortal2 } from "react-dom";
|
|
1304
1334
|
import {
|
|
1305
|
-
resolveColumnLabel as resolveColumnLabel2
|
|
1306
|
-
resolveKeyboardDropTarget
|
|
1335
|
+
resolveColumnLabel as resolveColumnLabel2
|
|
1307
1336
|
} from "@gridkitjs/core";
|
|
1337
|
+
import { resolveKeyboardDropTarget } from "@gridkitjs/core/renderer";
|
|
1308
1338
|
|
|
1309
1339
|
// src/DataGrid/useGroupByDrag.ts
|
|
1310
1340
|
import {
|
|
@@ -1469,7 +1499,7 @@ function GroupByBar({
|
|
|
1469
1499
|
role: "group",
|
|
1470
1500
|
"aria-label": messages.groupByBarLabel,
|
|
1471
1501
|
children: [
|
|
1472
|
-
showPlaceholder && /* @__PURE__ */ jsx10("span", { className: "group-by-bar-placeholder", children: messages.groupByBarPlaceholder }),
|
|
1502
|
+
showPlaceholder && /* @__PURE__ */ jsx10("span", { className: "gridkit-group-by-bar-placeholder", children: messages.groupByBarPlaceholder }),
|
|
1473
1503
|
groupBy.map((entry, index) => {
|
|
1474
1504
|
const dropBefore = activeDropTarget?.beforeColumnId === entry.columnId;
|
|
1475
1505
|
const dropAfter = activeDropTarget?.beforeColumnId === null && index === groupBy.length - 1;
|
|
@@ -1478,7 +1508,7 @@ function GroupByBar({
|
|
|
1478
1508
|
"span",
|
|
1479
1509
|
{
|
|
1480
1510
|
className: classNames(
|
|
1481
|
-
"group-by-chip",
|
|
1511
|
+
"gridkit-group-by-chip",
|
|
1482
1512
|
dragging ? "is-dragging" : "",
|
|
1483
1513
|
dropBefore ? "is-drop-before" : "",
|
|
1484
1514
|
dropAfter ? "is-drop-after" : ""
|
|
@@ -1505,12 +1535,12 @@ function GroupByBar({
|
|
|
1505
1535
|
}
|
|
1506
1536
|
},
|
|
1507
1537
|
children: [
|
|
1508
|
-
/* @__PURE__ */ jsx10("span", { className: "group-by-chip-label", children: labelFor(entry.columnId) }),
|
|
1538
|
+
/* @__PURE__ */ jsx10("span", { className: "gridkit-group-by-chip-label", children: labelFor(entry.columnId) }),
|
|
1509
1539
|
/* @__PURE__ */ jsx10(
|
|
1510
1540
|
"button",
|
|
1511
1541
|
{
|
|
1512
1542
|
type: "button",
|
|
1513
|
-
className: "group-by-chip-remove",
|
|
1543
|
+
className: "gridkit-group-by-chip-remove",
|
|
1514
1544
|
"aria-label": messages.removeGroupBy(columnName(entry.columnId)),
|
|
1515
1545
|
onPointerDown: (event) => {
|
|
1516
1546
|
event.stopPropagation();
|
|
@@ -1530,7 +1560,7 @@ function GroupByBar({
|
|
|
1530
1560
|
/* @__PURE__ */ jsx10(
|
|
1531
1561
|
"span",
|
|
1532
1562
|
{
|
|
1533
|
-
className: "group-by-chip drag-ghost",
|
|
1563
|
+
className: "gridkit-group-by-chip gridkit-drag-ghost",
|
|
1534
1564
|
style: { transform: chipDrag.ghostTransform },
|
|
1535
1565
|
"aria-hidden": "true",
|
|
1536
1566
|
children: labelFor(chipDrag.draggedColumnId)
|
|
@@ -1561,8 +1591,8 @@ function announcedCallbacks({
|
|
|
1561
1591
|
* continuous `"move"` phase as well, and a live region given every frame
|
|
1562
1592
|
* of a drag says nothing an assistive technology can keep up with.
|
|
1563
1593
|
*/
|
|
1564
|
-
|
|
1565
|
-
callbacks.
|
|
1594
|
+
onColumnSizingChange: (event) => {
|
|
1595
|
+
callbacks.onColumnSizingChange?.(event);
|
|
1566
1596
|
if (event.phase === "end") {
|
|
1567
1597
|
announce(
|
|
1568
1598
|
messages.columnResized(
|
|
@@ -1716,7 +1746,7 @@ function useGridCopy({
|
|
|
1716
1746
|
const { pageRows, columns } = controller.getView();
|
|
1717
1747
|
const entry = pageRows[focus.rowIndex];
|
|
1718
1748
|
const column = columns[focus.columnIndex];
|
|
1719
|
-
return entry
|
|
1749
|
+
return entry?.kind !== "data" || column === void 0 ? null : { area: "cell", rowId: entry.rowId, columnId: column.id };
|
|
1720
1750
|
}
|
|
1721
1751
|
return (event) => {
|
|
1722
1752
|
if (!isCopyKey(event) || isNativeCopy(event.target)) {
|
|
@@ -2105,17 +2135,17 @@ function MenuItem({
|
|
|
2105
2135
|
{
|
|
2106
2136
|
role: checked === void 0 ? "menuitem" : "menuitemcheckbox",
|
|
2107
2137
|
"data-gridkit-menu-item": entry.id,
|
|
2108
|
-
className: "menu-item",
|
|
2138
|
+
className: "gridkit-menu-item",
|
|
2109
2139
|
...ariaAttr(isItem2 && entry.disabled, "aria-disabled", true),
|
|
2110
2140
|
...ariaAttr(checked !== void 0, "aria-checked", checked),
|
|
2111
2141
|
...ariaAttr(shortcut !== void 0, "aria-keyshortcuts", shortcut),
|
|
2112
2142
|
...ariaAttr(!isItem2, "aria-haspopup", "menu"),
|
|
2113
2143
|
...ariaAttr(!isItem2, "aria-expanded", expanded),
|
|
2114
2144
|
children: [
|
|
2115
|
-
/* @__PURE__ */ jsx13("span", { className: "menu-item-icon", "aria-hidden": "true", children: checked === true ? /* @__PURE__ */ jsx13(CheckIcon, {}) : /* @__PURE__ */ jsx13(MenuIcon, { name: entry.icon }) }),
|
|
2116
|
-
/* @__PURE__ */ jsx13("span", { className: "menu-item-label", children: entry.label }),
|
|
2117
|
-
shortcut !== void 0 && /* @__PURE__ */ jsx13("span", { className: "menu-item-shortcut", "aria-hidden": "true", children: shortcut }),
|
|
2118
|
-
!isItem2 && /* @__PURE__ */ jsx13("span", { className: "menu-submenu-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(ChevronRightIcon2, {}) })
|
|
2145
|
+
/* @__PURE__ */ jsx13("span", { className: "gridkit-menu-item-icon", "aria-hidden": "true", children: checked === true ? /* @__PURE__ */ jsx13(CheckIcon, {}) : /* @__PURE__ */ jsx13(MenuIcon, { name: entry.icon }) }),
|
|
2146
|
+
/* @__PURE__ */ jsx13("span", { className: "gridkit-menu-item-label", children: entry.label }),
|
|
2147
|
+
shortcut !== void 0 && /* @__PURE__ */ jsx13("span", { className: "gridkit-menu-item-shortcut", "aria-hidden": "true", children: shortcut }),
|
|
2148
|
+
!isItem2 && /* @__PURE__ */ jsx13("span", { className: "gridkit-menu-submenu-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(ChevronRightIcon2, {}) })
|
|
2119
2149
|
]
|
|
2120
2150
|
}
|
|
2121
2151
|
);
|
|
@@ -2218,7 +2248,14 @@ function GridMenu({
|
|
|
2218
2248
|
"aria-label": label,
|
|
2219
2249
|
className: "gridkit-menu",
|
|
2220
2250
|
children: entries.map(
|
|
2221
|
-
(entry) => entry.type === "separator" ? /* @__PURE__ */ jsx13(
|
|
2251
|
+
(entry) => entry.type === "separator" ? /* @__PURE__ */ jsx13(
|
|
2252
|
+
"div",
|
|
2253
|
+
{
|
|
2254
|
+
role: "separator",
|
|
2255
|
+
className: "gridkit-menu-separator"
|
|
2256
|
+
},
|
|
2257
|
+
entry.key
|
|
2258
|
+
) : /* @__PURE__ */ jsx13(
|
|
2222
2259
|
MenuItem,
|
|
2223
2260
|
{
|
|
2224
2261
|
entry,
|
|
@@ -2298,10 +2335,10 @@ import {
|
|
|
2298
2335
|
} from "react";
|
|
2299
2336
|
import {
|
|
2300
2337
|
contextMenuEntries,
|
|
2301
|
-
hasContextMenu,
|
|
2302
2338
|
isSameCell,
|
|
2303
2339
|
resolveMenu
|
|
2304
2340
|
} from "@gridkitjs/core";
|
|
2341
|
+
import { hasContextMenu } from "@gridkitjs/core/renderer";
|
|
2305
2342
|
import {
|
|
2306
2343
|
attachContextMenuTrigger
|
|
2307
2344
|
} from "@gridkitjs/dom";
|
|
@@ -2386,7 +2423,7 @@ function bodyPlaceAt(element, parts) {
|
|
|
2386
2423
|
if (group !== null) {
|
|
2387
2424
|
const entry = pageRows[group.rowIndex];
|
|
2388
2425
|
const cell = bodyCell(parts, group.rowIndex, 0);
|
|
2389
|
-
return entry !== void 0 &&
|
|
2426
|
+
return entry !== void 0 && entry.kind === "group" && cell?.element.contains(element) === true ? onCell(
|
|
2390
2427
|
{ area: "group", groupId: entry.groupId, columnId: entry.columnId },
|
|
2391
2428
|
cell,
|
|
2392
2429
|
parts
|
|
@@ -2396,7 +2433,7 @@ function bodyPlaceAt(element, parts) {
|
|
|
2396
2433
|
if (position !== null) {
|
|
2397
2434
|
const entry = pageRows[position.rowIndex];
|
|
2398
2435
|
const cell = bodyCell(parts, position.rowIndex, position.columnIndex);
|
|
2399
|
-
return entry !== void 0 &&
|
|
2436
|
+
return entry !== void 0 && entry.kind === "data" && cell?.element.contains(element) === true ? onCell(
|
|
2400
2437
|
{ area: "cell", rowId: entry.rowId, columnId: position.columnId },
|
|
2401
2438
|
cell,
|
|
2402
2439
|
parts
|
|
@@ -2418,7 +2455,7 @@ function placeOf(target, parts) {
|
|
|
2418
2455
|
);
|
|
2419
2456
|
case "cell": {
|
|
2420
2457
|
const rowIndex = parts.pageRows.findIndex(
|
|
2421
|
-
(entry) =>
|
|
2458
|
+
(entry) => entry.kind === "data" && entry.rowId === target.rowId
|
|
2422
2459
|
);
|
|
2423
2460
|
return onCell(
|
|
2424
2461
|
target,
|
|
@@ -2428,7 +2465,7 @@ function placeOf(target, parts) {
|
|
|
2428
2465
|
}
|
|
2429
2466
|
case "group": {
|
|
2430
2467
|
const rowIndex = parts.pageRows.findIndex(
|
|
2431
|
-
(entry) =>
|
|
2468
|
+
(entry) => entry.kind === "group" && entry.groupId === target.groupId
|
|
2432
2469
|
);
|
|
2433
2470
|
return onCell(target, bodyCell(parts, rowIndex, 0), parts);
|
|
2434
2471
|
}
|
|
@@ -2490,7 +2527,11 @@ function useContextMenu({
|
|
|
2490
2527
|
if (target.area !== "cell") {
|
|
2491
2528
|
return false;
|
|
2492
2529
|
}
|
|
2493
|
-
const cell = {
|
|
2530
|
+
const cell = {
|
|
2531
|
+
kind: "cell",
|
|
2532
|
+
rowId: target.rowId,
|
|
2533
|
+
columnId: target.columnId
|
|
2534
|
+
};
|
|
2494
2535
|
const selectRow = selection.rowMode !== false && !state.rowSelection.includes(target.rowId);
|
|
2495
2536
|
const selectCell = selection.cellMode !== false && !isSameCell(state.cellSelection, cell);
|
|
2496
2537
|
if (selectRow) {
|
|
@@ -2621,7 +2662,7 @@ import { useRef as useRef15 } from "react";
|
|
|
2621
2662
|
|
|
2622
2663
|
// src/DataGrid/columnChooser/ColumnChooser.tsx
|
|
2623
2664
|
import { useLayoutEffect as useLayoutEffect7, useRef as useRef9, useState as useState6 } from "react";
|
|
2624
|
-
import { resolveColumnChooser } from "@gridkitjs/core";
|
|
2665
|
+
import { resolveColumnChooser } from "@gridkitjs/core/renderer";
|
|
2625
2666
|
import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2626
2667
|
function ColumnChooser({
|
|
2627
2668
|
controller,
|
|
@@ -2657,7 +2698,7 @@ function ColumnChooser({
|
|
|
2657
2698
|
"input",
|
|
2658
2699
|
{
|
|
2659
2700
|
type: "search",
|
|
2660
|
-
className: "column-chooser-search",
|
|
2701
|
+
className: "gridkit-column-chooser-search",
|
|
2661
2702
|
"aria-label": messages.columnChooserSearchLabel,
|
|
2662
2703
|
placeholder: messages.searchPlaceholder,
|
|
2663
2704
|
value: search,
|
|
@@ -2666,8 +2707,8 @@ function ColumnChooser({
|
|
|
2666
2707
|
}
|
|
2667
2708
|
}
|
|
2668
2709
|
),
|
|
2669
|
-
entries.length === 0 ? /* @__PURE__ */ jsx15("p", { role: "status", className: "column-chooser-empty", children: messages.noMatchingColumns }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2670
|
-
/* @__PURE__ */ jsxs10("label", { className: "column-chooser-option column-chooser-all", children: [
|
|
2710
|
+
entries.length === 0 ? /* @__PURE__ */ jsx15("p", { role: "status", className: "gridkit-column-chooser-empty", children: messages.noMatchingColumns }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2711
|
+
/* @__PURE__ */ jsxs10("label", { className: "gridkit-column-chooser-option gridkit-column-chooser-all", children: [
|
|
2671
2712
|
/* @__PURE__ */ jsx15(
|
|
2672
2713
|
"input",
|
|
2673
2714
|
{
|
|
@@ -2684,7 +2725,7 @@ function ColumnChooser({
|
|
|
2684
2725
|
),
|
|
2685
2726
|
messages.showAllColumns
|
|
2686
2727
|
] }),
|
|
2687
|
-
/* @__PURE__ */ jsx15("ul", { className: "column-chooser-list", children: entries.map((entry) => /* @__PURE__ */ jsx15("li", { children: /* @__PURE__ */ jsxs10("label", { className: "column-chooser-option", children: [
|
|
2728
|
+
/* @__PURE__ */ jsx15("ul", { className: "gridkit-column-chooser-list", children: entries.map((entry) => /* @__PURE__ */ jsx15("li", { children: /* @__PURE__ */ jsxs10("label", { className: "gridkit-column-chooser-option", children: [
|
|
2688
2729
|
/* @__PURE__ */ jsx15(
|
|
2689
2730
|
"input",
|
|
2690
2731
|
{
|
|
@@ -2707,10 +2748,10 @@ function ColumnChooser({
|
|
|
2707
2748
|
// src/DataGrid/filterMenu/FilterMenu.tsx
|
|
2708
2749
|
import { useEffect as useEffect4, useRef as useRef14 } from "react";
|
|
2709
2750
|
import {
|
|
2710
|
-
resolveColumnFilterMenu as resolveColumnFilterMenu2,
|
|
2711
2751
|
resolveColumnHeaderText,
|
|
2712
2752
|
resolveMenu as resolveMenu2
|
|
2713
2753
|
} from "@gridkitjs/core";
|
|
2754
|
+
import { resolveColumnFilterMenu as resolveColumnFilterMenu2 } from "@gridkitjs/core/renderer";
|
|
2714
2755
|
|
|
2715
2756
|
// src/DataGrid/filterMenu/ExcelFilterEditor.tsx
|
|
2716
2757
|
import {
|
|
@@ -2726,7 +2767,7 @@ import {
|
|
|
2726
2767
|
filterChecklist,
|
|
2727
2768
|
filterDraftChanged as filterDraftChanged3,
|
|
2728
2769
|
selectAllState
|
|
2729
|
-
} from "@gridkitjs/core";
|
|
2770
|
+
} from "@gridkitjs/core/renderer";
|
|
2730
2771
|
|
|
2731
2772
|
// src/DataGrid/filterMenu/excelEditorState.ts
|
|
2732
2773
|
import {
|
|
@@ -2735,7 +2776,7 @@ import {
|
|
|
2735
2776
|
filterEditorReducer,
|
|
2736
2777
|
initialFilterEditorDraft,
|
|
2737
2778
|
toValuesDraft
|
|
2738
|
-
} from "@gridkitjs/core";
|
|
2779
|
+
} from "@gridkitjs/core/renderer";
|
|
2739
2780
|
function openValues(filter, columnId, values) {
|
|
2740
2781
|
const shape = describeColumnFilter(filter, columnId);
|
|
2741
2782
|
return {
|
|
@@ -2850,12 +2891,19 @@ function OperatorMenuButton({
|
|
|
2850
2891
|
{
|
|
2851
2892
|
ref,
|
|
2852
2893
|
type: "button",
|
|
2853
|
-
className: "filter-menu-submenu",
|
|
2894
|
+
className: "gridkit-filter-menu-submenu",
|
|
2854
2895
|
...buttonProps,
|
|
2855
2896
|
children: [
|
|
2856
|
-
/* @__PURE__ */ jsx16("span", { className: "filter-menu-submenu-icon", "aria-hidden": "true", children: active !== void 0 && /* @__PURE__ */ jsx16(CheckIcon, {}) }),
|
|
2897
|
+
/* @__PURE__ */ jsx16("span", { className: "gridkit-filter-menu-submenu-icon", "aria-hidden": "true", children: active !== void 0 && /* @__PURE__ */ jsx16(CheckIcon, {}) }),
|
|
2857
2898
|
label,
|
|
2858
|
-
/* @__PURE__ */ jsx16(
|
|
2899
|
+
/* @__PURE__ */ jsx16(
|
|
2900
|
+
"span",
|
|
2901
|
+
{
|
|
2902
|
+
className: "gridkit-filter-menu-submenu-indicator",
|
|
2903
|
+
"aria-hidden": "true",
|
|
2904
|
+
children: /* @__PURE__ */ jsx16(ChevronRightIcon2, {})
|
|
2905
|
+
}
|
|
2906
|
+
)
|
|
2859
2907
|
]
|
|
2860
2908
|
}
|
|
2861
2909
|
),
|
|
@@ -2900,13 +2948,13 @@ import {
|
|
|
2900
2948
|
draftToFilter,
|
|
2901
2949
|
filterDraftChanged as filterDraftChanged2,
|
|
2902
2950
|
filterEditorReducer as filterEditorReducer2
|
|
2903
|
-
} from "@gridkitjs/core";
|
|
2951
|
+
} from "@gridkitjs/core/renderer";
|
|
2904
2952
|
|
|
2905
2953
|
// src/DataGrid/filterMenu/ConditionRow.tsx
|
|
2906
2954
|
import {
|
|
2907
2955
|
filterOperandArity,
|
|
2908
2956
|
parseFilterOperand
|
|
2909
|
-
} from "@gridkitjs/core";
|
|
2957
|
+
} from "@gridkitjs/core/renderer";
|
|
2910
2958
|
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2911
2959
|
function inputType(family, type) {
|
|
2912
2960
|
switch (family) {
|
|
@@ -2930,7 +2978,7 @@ function OperandField({
|
|
|
2930
2978
|
}) {
|
|
2931
2979
|
const field = {
|
|
2932
2980
|
ref: fieldRef,
|
|
2933
|
-
className: "filter-menu-value",
|
|
2981
|
+
className: "gridkit-filter-menu-value",
|
|
2934
2982
|
"aria-label": label,
|
|
2935
2983
|
"aria-invalid": invalidMessageId === void 0 ? void 0 : true,
|
|
2936
2984
|
"aria-describedby": invalidMessageId,
|
|
@@ -2971,13 +3019,13 @@ function ConditionRow({
|
|
|
2971
3019
|
ref,
|
|
2972
3020
|
role: "group",
|
|
2973
3021
|
"aria-label": messages.filterConditionLabel(position),
|
|
2974
|
-
className: "filter-menu-condition",
|
|
3022
|
+
className: "gridkit-filter-menu-condition",
|
|
2975
3023
|
children: [
|
|
2976
3024
|
/* @__PURE__ */ jsx17(
|
|
2977
3025
|
"select",
|
|
2978
3026
|
{
|
|
2979
3027
|
ref: arity === 0 ? focusRef : void 0,
|
|
2980
|
-
className: "filter-menu-operator",
|
|
3028
|
+
className: "gridkit-filter-menu-operator",
|
|
2981
3029
|
"aria-label": messages.filterOperatorFieldLabel,
|
|
2982
3030
|
value: row.operator,
|
|
2983
3031
|
onChange: (event) => {
|
|
@@ -3026,7 +3074,7 @@ import {
|
|
|
3026
3074
|
conditionsFromRows,
|
|
3027
3075
|
describeColumnFilter as describeColumnFilter2,
|
|
3028
3076
|
initialFilterEditorDraft as initialFilterEditorDraft2
|
|
3029
|
-
} from "@gridkitjs/core";
|
|
3077
|
+
} from "@gridkitjs/core/renderer";
|
|
3030
3078
|
var NO_ROWS = [];
|
|
3031
3079
|
var NO_VALUES = {
|
|
3032
3080
|
options: [],
|
|
@@ -3118,8 +3166,8 @@ function CombinatorChoice({
|
|
|
3118
3166
|
{
|
|
3119
3167
|
role: "radiogroup",
|
|
3120
3168
|
"aria-label": messages.filterCombinatorLabel,
|
|
3121
|
-
className: "filter-menu-combinator",
|
|
3122
|
-
children: COMBINATORS.map((choice) => /* @__PURE__ */ jsxs13("label", { className: "filter-menu-combinator-option", children: [
|
|
3169
|
+
className: "gridkit-filter-menu-combinator",
|
|
3170
|
+
children: COMBINATORS.map((choice) => /* @__PURE__ */ jsxs13("label", { className: "gridkit-filter-menu-combinator-option", children: [
|
|
3123
3171
|
/* @__PURE__ */ jsx18(
|
|
3124
3172
|
"input",
|
|
3125
3173
|
{
|
|
@@ -3198,8 +3246,8 @@ function SimpleFilterEditor({
|
|
|
3198
3246
|
rowElements.current[first]?.querySelector('[aria-invalid="true"]')?.focus();
|
|
3199
3247
|
}
|
|
3200
3248
|
}, [invalid]);
|
|
3201
|
-
return /* @__PURE__ */ jsxs13("div", { className: "filter-menu-conditions", children: [
|
|
3202
|
-
opened.custom && /* @__PURE__ */ jsx18("p", { className: "filter-menu-custom", children: messages.customFilter }),
|
|
3249
|
+
return /* @__PURE__ */ jsxs13("div", { className: "gridkit-filter-menu-conditions", children: [
|
|
3250
|
+
opened.custom && /* @__PURE__ */ jsx18("p", { className: "gridkit-filter-menu-custom", children: messages.customFilter }),
|
|
3203
3251
|
draft.rows.map((row, index) => (
|
|
3204
3252
|
// A row is its place: the first condition, or the second.
|
|
3205
3253
|
/* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
@@ -3234,7 +3282,7 @@ function SimpleFilterEditor({
|
|
|
3234
3282
|
)
|
|
3235
3283
|
] }, index)
|
|
3236
3284
|
)),
|
|
3237
|
-
invalid.length > 0 && /* @__PURE__ */ jsx18("p", { id: invalidMessageId, className: "filter-menu-invalid", children: messages.filterValueInvalid(menu.family) })
|
|
3285
|
+
invalid.length > 0 && /* @__PURE__ */ jsx18("p", { id: invalidMessageId, className: "gridkit-filter-menu-invalid", children: messages.filterValueInvalid(menu.family) })
|
|
3238
3286
|
] });
|
|
3239
3287
|
}
|
|
3240
3288
|
|
|
@@ -3308,7 +3356,7 @@ function ValueChecklist({
|
|
|
3308
3356
|
role: "listbox",
|
|
3309
3357
|
"aria-multiselectable": "true",
|
|
3310
3358
|
"aria-label": label,
|
|
3311
|
-
className: "filter-menu-checklist",
|
|
3359
|
+
className: "gridkit-filter-menu-checklist",
|
|
3312
3360
|
children: [
|
|
3313
3361
|
/* @__PURE__ */ jsx19("div", { role: "presentation", style: { height: range.offsetBefore } }),
|
|
3314
3362
|
shown.map((item, offset) => {
|
|
@@ -3323,13 +3371,20 @@ function ValueChecklist({
|
|
|
3323
3371
|
"aria-checked": item.checked,
|
|
3324
3372
|
"aria-setsize": items.length,
|
|
3325
3373
|
"aria-posinset": index + 1,
|
|
3326
|
-
className: "filter-menu-option",
|
|
3374
|
+
className: "gridkit-filter-menu-option",
|
|
3327
3375
|
children: [
|
|
3328
|
-
/* @__PURE__ */ jsx19(
|
|
3329
|
-
|
|
3376
|
+
/* @__PURE__ */ jsx19(
|
|
3377
|
+
"span",
|
|
3378
|
+
{
|
|
3379
|
+
className: "gridkit-filter-menu-option-check",
|
|
3380
|
+
"aria-hidden": "true",
|
|
3381
|
+
children: /* @__PURE__ */ jsx19(CheckIcon, {})
|
|
3382
|
+
}
|
|
3383
|
+
),
|
|
3384
|
+
/* @__PURE__ */ jsx19("span", { className: "gridkit-filter-menu-option-label", children: item.label }),
|
|
3330
3385
|
showCounts && /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
3331
3386
|
" ",
|
|
3332
|
-
/* @__PURE__ */ jsx19("span", { className: "filter-menu-option-count", children: String(item.count) })
|
|
3387
|
+
/* @__PURE__ */ jsx19("span", { className: "gridkit-filter-menu-option-count", children: String(item.count) })
|
|
3333
3388
|
] })
|
|
3334
3389
|
]
|
|
3335
3390
|
},
|
|
@@ -3415,12 +3470,12 @@ function ExcelFilterEditor({
|
|
|
3415
3470
|
"button",
|
|
3416
3471
|
{
|
|
3417
3472
|
type: "button",
|
|
3418
|
-
className: "filter-menu-back",
|
|
3473
|
+
className: "gridkit-filter-menu-back",
|
|
3419
3474
|
onClick: () => {
|
|
3420
3475
|
setMode({ kind: "values", focusOnMount: true });
|
|
3421
3476
|
},
|
|
3422
3477
|
children: [
|
|
3423
|
-
/* @__PURE__ */ jsx20("span", { className: "filter-menu-back-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(ChevronLeftIcon2, {}) }),
|
|
3478
|
+
/* @__PURE__ */ jsx20("span", { className: "gridkit-filter-menu-back-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(ChevronLeftIcon2, {}) }),
|
|
3424
3479
|
messages.filterBackToValues
|
|
3425
3480
|
]
|
|
3426
3481
|
}
|
|
@@ -3443,7 +3498,7 @@ function ExcelFilterEditor({
|
|
|
3443
3498
|
] });
|
|
3444
3499
|
}
|
|
3445
3500
|
const { shape } = opened;
|
|
3446
|
-
return /* @__PURE__ */ jsxs15("div", { className: "filter-menu-values", children: [
|
|
3501
|
+
return /* @__PURE__ */ jsxs15("div", { className: "gridkit-filter-menu-values", children: [
|
|
3447
3502
|
menu.operators.length > 0 && /* @__PURE__ */ jsx20(
|
|
3448
3503
|
OperatorMenuButton,
|
|
3449
3504
|
{
|
|
@@ -3456,13 +3511,13 @@ function ExcelFilterEditor({
|
|
|
3456
3511
|
}
|
|
3457
3512
|
}
|
|
3458
3513
|
),
|
|
3459
|
-
(shape.kind === "conditions" || shape.kind === "custom") && /* @__PURE__ */ jsx20("p", { className: "filter-menu-custom", children: shape.kind === "conditions" ? messages.filterByCondition : messages.customFilter }),
|
|
3514
|
+
(shape.kind === "conditions" || shape.kind === "custom") && /* @__PURE__ */ jsx20("p", { className: "gridkit-filter-menu-custom", children: shape.kind === "conditions" ? messages.filterByCondition : messages.customFilter }),
|
|
3460
3515
|
/* @__PURE__ */ jsx20(
|
|
3461
3516
|
"input",
|
|
3462
3517
|
{
|
|
3463
3518
|
ref: initialFocusRef,
|
|
3464
3519
|
type: "search",
|
|
3465
|
-
className: "filter-menu-search",
|
|
3520
|
+
className: "gridkit-filter-menu-search",
|
|
3466
3521
|
"aria-label": messages.filterSearchLabel,
|
|
3467
3522
|
placeholder: messages.searchPlaceholder,
|
|
3468
3523
|
value: draft.search,
|
|
@@ -3471,7 +3526,7 @@ function ExcelFilterEditor({
|
|
|
3471
3526
|
}
|
|
3472
3527
|
}
|
|
3473
3528
|
),
|
|
3474
|
-
/* @__PURE__ */ jsxs15("label", { className: "filter-menu-select-all", children: [
|
|
3529
|
+
/* @__PURE__ */ jsxs15("label", { className: "gridkit-filter-menu-select-all", children: [
|
|
3475
3530
|
/* @__PURE__ */ jsx20(
|
|
3476
3531
|
"input",
|
|
3477
3532
|
{
|
|
@@ -3486,7 +3541,7 @@ function ExcelFilterEditor({
|
|
|
3486
3541
|
),
|
|
3487
3542
|
messages.filterSelectAll
|
|
3488
3543
|
] }),
|
|
3489
|
-
checklist.needsSearch ? /* @__PURE__ */ jsx20("p", { className: "filter-menu-search-first", children: messages.filterSearchFirst(checklist.total) }) : /* @__PURE__ */ jsx20(
|
|
3544
|
+
checklist.needsSearch ? /* @__PURE__ */ jsx20("p", { className: "gridkit-filter-menu-search-first", children: messages.filterSearchFirst(checklist.total) }) : /* @__PURE__ */ jsx20(
|
|
3490
3545
|
ValueChecklist,
|
|
3491
3546
|
{
|
|
3492
3547
|
items: checklist.items,
|
|
@@ -3497,7 +3552,7 @@ function ExcelFilterEditor({
|
|
|
3497
3552
|
}
|
|
3498
3553
|
}
|
|
3499
3554
|
),
|
|
3500
|
-
checklist.hiddenCount > 0 && /* @__PURE__ */ jsx20("p", { role: "status", className: "filter-menu-more", children: messages.filterMoreValues(checklist.hiddenCount) })
|
|
3555
|
+
checklist.hiddenCount > 0 && /* @__PURE__ */ jsx20("p", { role: "status", className: "gridkit-filter-menu-more", children: messages.filterMoreValues(checklist.hiddenCount) })
|
|
3501
3556
|
] });
|
|
3502
3557
|
}
|
|
3503
3558
|
|
|
@@ -3570,7 +3625,7 @@ function FilterMenu({
|
|
|
3570
3625
|
children: /* @__PURE__ */ jsxs16(
|
|
3571
3626
|
"form",
|
|
3572
3627
|
{
|
|
3573
|
-
className: "filter-menu-form",
|
|
3628
|
+
className: "gridkit-filter-menu-form",
|
|
3574
3629
|
noValidate: true,
|
|
3575
3630
|
onSubmit: apply,
|
|
3576
3631
|
onKeyDown: (event) => {
|
|
@@ -3580,11 +3635,11 @@ function FilterMenu({
|
|
|
3580
3635
|
}
|
|
3581
3636
|
},
|
|
3582
3637
|
children: [
|
|
3583
|
-
sortItems.length > 0 && /* @__PURE__ */ jsx21("div", { className: "filter-menu-sort", children: sortItems.map((item) => /* @__PURE__ */ jsxs16(
|
|
3638
|
+
sortItems.length > 0 && /* @__PURE__ */ jsx21("div", { className: "gridkit-filter-menu-sort", children: sortItems.map((item) => /* @__PURE__ */ jsxs16(
|
|
3584
3639
|
"button",
|
|
3585
3640
|
{
|
|
3586
3641
|
type: "button",
|
|
3587
|
-
className: "filter-menu-sort-item",
|
|
3642
|
+
className: "gridkit-filter-menu-sort-item",
|
|
3588
3643
|
disabled: item.disabled,
|
|
3589
3644
|
...ariaAttr(
|
|
3590
3645
|
item.checked !== void 0,
|
|
@@ -3595,19 +3650,26 @@ function FilterMenu({
|
|
|
3595
3650
|
run(item);
|
|
3596
3651
|
},
|
|
3597
3652
|
children: [
|
|
3598
|
-
/* @__PURE__ */ jsx21(
|
|
3653
|
+
/* @__PURE__ */ jsx21(
|
|
3654
|
+
"span",
|
|
3655
|
+
{
|
|
3656
|
+
className: "gridkit-filter-menu-sort-icon",
|
|
3657
|
+
"aria-hidden": "true",
|
|
3658
|
+
children: /* @__PURE__ */ jsx21(MenuIcon, { name: item.icon })
|
|
3659
|
+
}
|
|
3660
|
+
),
|
|
3599
3661
|
item.label
|
|
3600
3662
|
]
|
|
3601
3663
|
},
|
|
3602
3664
|
item.id
|
|
3603
3665
|
)) }),
|
|
3604
3666
|
menu.ui === "excel" ? /* @__PURE__ */ jsx21(ExcelFilterEditor, { ...editorProps, columnValues }) : /* @__PURE__ */ jsx21(SimpleFilterEditor, { ...editorProps }),
|
|
3605
|
-
/* @__PURE__ */ jsxs16("div", { className: "filter-menu-actions", children: [
|
|
3667
|
+
/* @__PURE__ */ jsxs16("div", { className: "gridkit-filter-menu-actions", children: [
|
|
3606
3668
|
clearItem !== void 0 && /* @__PURE__ */ jsx21(
|
|
3607
3669
|
"button",
|
|
3608
3670
|
{
|
|
3609
3671
|
type: "button",
|
|
3610
|
-
className: "filter-menu-clear",
|
|
3672
|
+
className: "gridkit-filter-menu-clear",
|
|
3611
3673
|
disabled: clearItem.disabled,
|
|
3612
3674
|
onClick: () => {
|
|
3613
3675
|
run(clearItem);
|
|
@@ -3615,8 +3677,16 @@ function FilterMenu({
|
|
|
3615
3677
|
children: clearItem.label
|
|
3616
3678
|
}
|
|
3617
3679
|
),
|
|
3618
|
-
/* @__PURE__ */ jsx21(
|
|
3619
|
-
|
|
3680
|
+
/* @__PURE__ */ jsx21(
|
|
3681
|
+
"button",
|
|
3682
|
+
{
|
|
3683
|
+
type: "button",
|
|
3684
|
+
className: "gridkit-filter-menu-cancel",
|
|
3685
|
+
onClick: close,
|
|
3686
|
+
children: messages.cancelFilter
|
|
3687
|
+
}
|
|
3688
|
+
),
|
|
3689
|
+
/* @__PURE__ */ jsx21("button", { type: "submit", className: "gridkit-filter-menu-apply", children: messages.applyFilter })
|
|
3620
3690
|
] })
|
|
3621
3691
|
]
|
|
3622
3692
|
}
|
|
@@ -3656,7 +3726,7 @@ function useApplyFilter(controller, messages, announce) {
|
|
|
3656
3726
|
import { useState as useState11 } from "react";
|
|
3657
3727
|
import {
|
|
3658
3728
|
createColumnValueOptionsCache
|
|
3659
|
-
} from "@gridkitjs/core";
|
|
3729
|
+
} from "@gridkitjs/core/renderer";
|
|
3660
3730
|
var NO_ROWS2 = [];
|
|
3661
3731
|
function useFilterValueCache(controller, messages) {
|
|
3662
3732
|
const [cache] = useState11(createColumnValueOptionsCache);
|
|
@@ -3730,7 +3800,7 @@ function GridPanels({
|
|
|
3730
3800
|
}
|
|
3731
3801
|
|
|
3732
3802
|
// src/DataGrid/panels/panelApi.ts
|
|
3733
|
-
import { resolveColumnFilterMenu as resolveColumnFilterMenu3 } from "@gridkitjs/core";
|
|
3803
|
+
import { resolveColumnFilterMenu as resolveColumnFilterMenu3 } from "@gridkitjs/core/renderer";
|
|
3734
3804
|
function panelApi(panels, controller) {
|
|
3735
3805
|
return {
|
|
3736
3806
|
openColumnChooser: () => {
|
|
@@ -3828,9 +3898,9 @@ function useGridPanels({
|
|
|
3828
3898
|
import { useLayoutEffect as useLayoutEffect13, useRef as useRef19 } from "react";
|
|
3829
3899
|
import {
|
|
3830
3900
|
resolveToolbar,
|
|
3831
|
-
splitToolbarItems,
|
|
3832
3901
|
toolbarEntries
|
|
3833
3902
|
} from "@gridkitjs/core";
|
|
3903
|
+
import { splitToolbarItems } from "@gridkitjs/core/renderer";
|
|
3834
3904
|
import { attachToolbar } from "@gridkitjs/dom";
|
|
3835
3905
|
|
|
3836
3906
|
// src/DataGrid/toolbar/ToolbarMenuButton.tsx
|
|
@@ -3853,14 +3923,17 @@ function ToolbarMenuButton({
|
|
|
3853
3923
|
{
|
|
3854
3924
|
...attributes,
|
|
3855
3925
|
type: "button",
|
|
3856
|
-
className: classNames(
|
|
3926
|
+
className: classNames(
|
|
3927
|
+
"gridkit-toolbar-button",
|
|
3928
|
+
more && "gridkit-toolbar-more"
|
|
3929
|
+
),
|
|
3857
3930
|
"data-gridkit-toolbar-item": itemKey,
|
|
3858
3931
|
...ariaAttr(more, "data-gridkit-toolbar-more", ""),
|
|
3859
3932
|
...buttonProps,
|
|
3860
3933
|
children: [
|
|
3861
|
-
icon !== void 0 && /* @__PURE__ */ jsx23("span", { className: "toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx23(MenuIcon, { name: icon }) }),
|
|
3934
|
+
icon !== void 0 && /* @__PURE__ */ jsx23("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx23(MenuIcon, { name: icon }) }),
|
|
3862
3935
|
label,
|
|
3863
|
-
/* @__PURE__ */ jsx23("span", { className: "toolbar-button-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx23(ChevronDownIcon, {}) })
|
|
3936
|
+
/* @__PURE__ */ jsx23("span", { className: "gridkit-toolbar-button-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx23(ChevronDownIcon, {}) })
|
|
3864
3937
|
]
|
|
3865
3938
|
}
|
|
3866
3939
|
),
|
|
@@ -3895,10 +3968,7 @@ function ToolbarMenuButton({
|
|
|
3895
3968
|
|
|
3896
3969
|
// src/DataGrid/toolbar/ToolbarSearch.tsx
|
|
3897
3970
|
import { useEffect as useEffect6, useRef as useRef17, useState as useState12 } from "react";
|
|
3898
|
-
import {
|
|
3899
|
-
searchTextOf,
|
|
3900
|
-
setSearchText
|
|
3901
|
-
} from "@gridkitjs/core";
|
|
3971
|
+
import { searchTextOf, setSearchText } from "@gridkitjs/core/renderer";
|
|
3902
3972
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
3903
3973
|
var SEARCH_DELAY_MS = 250;
|
|
3904
3974
|
function ToolbarSearch({
|
|
@@ -3940,7 +4010,7 @@ function ToolbarSearch({
|
|
|
3940
4010
|
{
|
|
3941
4011
|
...attributes,
|
|
3942
4012
|
type: "search",
|
|
3943
|
-
className: "toolbar-search",
|
|
4013
|
+
className: "gridkit-toolbar-search",
|
|
3944
4014
|
"data-gridkit-toolbar-item": itemKey,
|
|
3945
4015
|
"aria-label": messages.searchLabel,
|
|
3946
4016
|
placeholder: messages.searchPlaceholder,
|
|
@@ -4106,7 +4176,7 @@ function Toolbar({
|
|
|
4106
4176
|
{
|
|
4107
4177
|
...item.attributes,
|
|
4108
4178
|
type: "button",
|
|
4109
|
-
className: "toolbar-button",
|
|
4179
|
+
className: "gridkit-toolbar-button",
|
|
4110
4180
|
"data-gridkit-toolbar-item": item.key,
|
|
4111
4181
|
...ariaAttr(item.disabled, "aria-disabled", true),
|
|
4112
4182
|
...ariaAttr(
|
|
@@ -4123,7 +4193,7 @@ function Toolbar({
|
|
|
4123
4193
|
item.run();
|
|
4124
4194
|
},
|
|
4125
4195
|
children: [
|
|
4126
|
-
item.icon !== void 0 && /* @__PURE__ */ jsx25("span", { className: "toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx25(MenuIcon, { name: item.icon }) }),
|
|
4196
|
+
item.icon !== void 0 && /* @__PURE__ */ jsx25("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx25(MenuIcon, { name: item.icon }) }),
|
|
4127
4197
|
item.label
|
|
4128
4198
|
]
|
|
4129
4199
|
},
|
|
@@ -4160,7 +4230,7 @@ function Toolbar({
|
|
|
4160
4230
|
{
|
|
4161
4231
|
role: "separator",
|
|
4162
4232
|
"aria-orientation": "vertical",
|
|
4163
|
-
className: "toolbar-separator",
|
|
4233
|
+
className: "gridkit-toolbar-separator",
|
|
4164
4234
|
"data-gridkit-toolbar-item": item.key
|
|
4165
4235
|
},
|
|
4166
4236
|
item.key
|
|
@@ -4169,7 +4239,7 @@ function Toolbar({
|
|
|
4169
4239
|
return /* @__PURE__ */ jsx25(
|
|
4170
4240
|
"div",
|
|
4171
4241
|
{
|
|
4172
|
-
className: "toolbar-spacer",
|
|
4242
|
+
className: "gridkit-toolbar-spacer",
|
|
4173
4243
|
"data-gridkit-toolbar-item": item.key
|
|
4174
4244
|
},
|
|
4175
4245
|
item.key
|
|
@@ -4179,7 +4249,7 @@ function Toolbar({
|
|
|
4179
4249
|
"div",
|
|
4180
4250
|
{
|
|
4181
4251
|
...item.attributes,
|
|
4182
|
-
className: "toolbar-custom",
|
|
4252
|
+
className: "gridkit-toolbar-custom",
|
|
4183
4253
|
"data-gridkit-toolbar-item": item.key,
|
|
4184
4254
|
children: renderItem?.(item.id)
|
|
4185
4255
|
},
|
|
@@ -4213,9 +4283,7 @@ function Toolbar({
|
|
|
4213
4283
|
}
|
|
4214
4284
|
|
|
4215
4285
|
// src/DataGrid/useColumnDrag.ts
|
|
4216
|
-
import {
|
|
4217
|
-
resolveKeyboardDropTarget as resolveKeyboardDropTarget2
|
|
4218
|
-
} from "@gridkitjs/core";
|
|
4286
|
+
import { resolveKeyboardDropTarget as resolveKeyboardDropTarget2 } from "@gridkitjs/core/renderer";
|
|
4219
4287
|
import { resolveColumnDropTarget } from "@gridkitjs/dom";
|
|
4220
4288
|
function useColumnDrag({
|
|
4221
4289
|
order,
|
|
@@ -4260,7 +4328,7 @@ import {
|
|
|
4260
4328
|
clampColumnWidth,
|
|
4261
4329
|
resolveColumnConstraints,
|
|
4262
4330
|
sizeColumnToContent
|
|
4263
|
-
} from "@gridkitjs/core";
|
|
4331
|
+
} from "@gridkitjs/core/renderer";
|
|
4264
4332
|
import { measureColumnContent, startColumnResizeGesture } from "@gridkitjs/dom";
|
|
4265
4333
|
function useColumnResize({
|
|
4266
4334
|
tableRef,
|
|
@@ -4547,19 +4615,6 @@ function selectedRowsReader(controller) {
|
|
|
4547
4615
|
return last.selected;
|
|
4548
4616
|
};
|
|
4549
4617
|
}
|
|
4550
|
-
function focusAt(rowIndex, columnIndex) {
|
|
4551
|
-
return rowIndex < 0 ? headerFocus3(columnIndex) : bodyFocus3(rowIndex, columnIndex);
|
|
4552
|
-
}
|
|
4553
|
-
function focusedCellReader() {
|
|
4554
|
-
let last;
|
|
4555
|
-
return (focus) => {
|
|
4556
|
-
if (last?.focus !== focus) {
|
|
4557
|
-
const rowIndex = focus.area === "header" ? -1 : focus.rowIndex;
|
|
4558
|
-
last = { focus, cell: { rowIndex, columnIndex: focus.columnIndex } };
|
|
4559
|
-
}
|
|
4560
|
-
return last.cell;
|
|
4561
|
-
};
|
|
4562
|
-
}
|
|
4563
4618
|
function DataGrid(props) {
|
|
4564
4619
|
const {
|
|
4565
4620
|
borders,
|
|
@@ -4619,7 +4674,6 @@ function DataGrid(props) {
|
|
|
4619
4674
|
});
|
|
4620
4675
|
const [readPagination] = useState18(() => paginationReader(controller));
|
|
4621
4676
|
const [readSelectedRows] = useState18(() => selectedRowsReader(controller));
|
|
4622
|
-
const [readFocusedCell] = useState18(focusedCellReader);
|
|
4623
4677
|
const virtualizer = useRowVirtualizer({
|
|
4624
4678
|
enabled: virtualized,
|
|
4625
4679
|
rows: view.pageRows,
|
|
@@ -4685,7 +4739,7 @@ function DataGrid(props) {
|
|
|
4685
4739
|
// vertical movement steps over it rather than landing there.
|
|
4686
4740
|
isSkippableRow: (rowIndex) => {
|
|
4687
4741
|
const entry = view.pageRows[rowIndex];
|
|
4688
|
-
return entry
|
|
4742
|
+
return entry?.kind === "group-summary";
|
|
4689
4743
|
}
|
|
4690
4744
|
});
|
|
4691
4745
|
const overlay = useGridOverlay({
|
|
@@ -4812,12 +4866,10 @@ function DataGrid(props) {
|
|
|
4812
4866
|
getSelectedRows: readSelectedRows,
|
|
4813
4867
|
getColumnSelection: () => controller.getState().columnSelection,
|
|
4814
4868
|
getCellSelection: () => controller.getState().cellSelection,
|
|
4815
|
-
getFocusedCell: () =>
|
|
4869
|
+
getFocusedCell: () => nav.focus,
|
|
4816
4870
|
getState: controller.getState,
|
|
4817
4871
|
restoreState: controller.restoreState,
|
|
4818
|
-
focusCell:
|
|
4819
|
-
nav.focusCell(focusAt(rowIndex, columnIndex));
|
|
4820
|
-
},
|
|
4872
|
+
focusCell: nav.focusCell,
|
|
4821
4873
|
clearSelection: controller.clearSelection,
|
|
4822
4874
|
selectAllRows: controller.selectAllRows,
|
|
4823
4875
|
selectRows: controller.selectRows,
|
|
@@ -4856,7 +4908,7 @@ function DataGrid(props) {
|
|
|
4856
4908
|
runCommand: (commandId, target = { area: "grid" }) => commands.run(commandId, target, "api"),
|
|
4857
4909
|
scrollToRow: (rowId, options) => {
|
|
4858
4910
|
const index = controller.getView().pageRows.findIndex(
|
|
4859
|
-
(entry) =>
|
|
4911
|
+
(entry) => entry.kind === "data" && entry.rowId === rowId
|
|
4860
4912
|
);
|
|
4861
4913
|
if (index === -1) return;
|
|
4862
4914
|
if (virtualized) {
|
|
@@ -4883,16 +4935,16 @@ function DataGrid(props) {
|
|
|
4883
4935
|
}));
|
|
4884
4936
|
const gridTableClassName = classNames(
|
|
4885
4937
|
"gridkit-data-grid",
|
|
4886
|
-
borders ? `borders-${borders}` : "",
|
|
4938
|
+
borders ? `gridkit-borders-${borders}` : "",
|
|
4887
4939
|
// Hover is on by default and selection off, so one set of classes
|
|
4888
4940
|
// turns styling off and the other turns it on. The polarity differs
|
|
4889
4941
|
// because the defaults do.
|
|
4890
|
-
hoverRows ? "" : "no-hover-rows",
|
|
4891
|
-
hoverColumns ? "" : "no-hover-columns",
|
|
4892
|
-
hoverCells ? "" : "no-hover-cells",
|
|
4893
|
-
selection.rowMode === false ? "" : "selectable-rows",
|
|
4894
|
-
selection.columnMode === false ? "" : "selectable-columns",
|
|
4895
|
-
selection.cellMode === false ? "" : "selectable-cells"
|
|
4942
|
+
hoverRows ? "" : "gridkit-no-hover-rows",
|
|
4943
|
+
hoverColumns ? "" : "gridkit-no-hover-columns",
|
|
4944
|
+
hoverCells ? "" : "gridkit-no-hover-cells",
|
|
4945
|
+
selection.rowMode === false ? "" : "gridkit-selectable-rows",
|
|
4946
|
+
selection.columnMode === false ? "" : "gridkit-selectable-columns",
|
|
4947
|
+
selection.cellMode === false ? "" : "gridkit-selectable-cells"
|
|
4896
4948
|
);
|
|
4897
4949
|
const hasFooter = aggregates.length > 0;
|
|
4898
4950
|
return /* @__PURE__ */ jsxs19("div", { className: "gridkit-data-grid-viewport", ref: viewportRef, children: [
|
|
@@ -5209,7 +5261,7 @@ function useColumnSortState(gridRef) {
|
|
|
5209
5261
|
// src/DataGrid/hooks/useSelectionState.ts
|
|
5210
5262
|
import { useCallback as useCallback8 } from "react";
|
|
5211
5263
|
var FALLBACK_SELECTION = [];
|
|
5212
|
-
var FALLBACK_CELL_SELECTION =
|
|
5264
|
+
var FALLBACK_CELL_SELECTION = { kind: "none" };
|
|
5213
5265
|
function useSelectionState(gridRef) {
|
|
5214
5266
|
const rowSelection = useGridSnapshot(
|
|
5215
5267
|
gridRef,
|