@gridkitjs/react 0.0.0-dev-20261118204728 → 0.0.0-dev-20261119130019
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 +19 -3
- package/dist/index.js +285 -194
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -11,12 +11,16 @@ import {
|
|
|
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";
|
|
@@ -203,8 +207,10 @@ function GridHeader({
|
|
|
203
207
|
const { column } = entry;
|
|
204
208
|
const resizing = resize.activeColumnId === entry.id;
|
|
205
209
|
const dragging = drag.draggedColumnId === entry.id;
|
|
206
|
-
const
|
|
207
|
-
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);
|
|
208
214
|
const selected = selection.selectedColumnIds.has(entry.id);
|
|
209
215
|
const sortable = column.sortable ?? sortableColumns;
|
|
210
216
|
const sortDirection = sortDirectionFor(columnSort, entry.id);
|
|
@@ -309,6 +315,7 @@ function GridHeader({
|
|
|
309
315
|
dragging ? "is-dragging" : "",
|
|
310
316
|
dropBefore ? "is-drop-before" : "",
|
|
311
317
|
dropAfter ? "is-drop-after" : "",
|
|
318
|
+
dragBlocked ? "is-drag-blocked" : "",
|
|
312
319
|
column.wrap?.header ? "is-wrapped" : "",
|
|
313
320
|
pinnedCellClassNames(entry),
|
|
314
321
|
column.headerClassName ?? ""
|
|
@@ -586,6 +593,27 @@ function createRowPropsResolver() {
|
|
|
586
593
|
};
|
|
587
594
|
}
|
|
588
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
|
+
|
|
589
617
|
// src/DataGrid/components/GridGroupRow.tsx
|
|
590
618
|
import { memo } from "react";
|
|
591
619
|
import {
|
|
@@ -608,7 +636,7 @@ function renderAggregate(value, spec, column, rows, locale) {
|
|
|
608
636
|
}
|
|
609
637
|
|
|
610
638
|
// src/DataGrid/components/GridGroupRow.tsx
|
|
611
|
-
import { jsx as
|
|
639
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
612
640
|
function GridGroupRowComponent({
|
|
613
641
|
columnCount,
|
|
614
642
|
groupId,
|
|
@@ -630,7 +658,7 @@ function GridGroupRowComponent({
|
|
|
630
658
|
cellMessages,
|
|
631
659
|
ref
|
|
632
660
|
}) {
|
|
633
|
-
return /* @__PURE__ */
|
|
661
|
+
return /* @__PURE__ */ jsx5(
|
|
634
662
|
"tr",
|
|
635
663
|
{
|
|
636
664
|
ref,
|
|
@@ -646,7 +674,7 @@ function GridGroupRowComponent({
|
|
|
646
674
|
"gridkit-grid-group-row",
|
|
647
675
|
`is-group-level-${String(level)}`
|
|
648
676
|
),
|
|
649
|
-
children: /* @__PURE__ */
|
|
677
|
+
children: /* @__PURE__ */ jsx5(
|
|
650
678
|
"td",
|
|
651
679
|
{
|
|
652
680
|
role: "gridcell",
|
|
@@ -660,7 +688,7 @@ function GridGroupRowComponent({
|
|
|
660
688
|
className: "gridkit-grid-group-cell-content",
|
|
661
689
|
style: { paddingInlineStart: `${String(level * 1.25 + 0.5)}rem` },
|
|
662
690
|
children: [
|
|
663
|
-
/* @__PURE__ */
|
|
691
|
+
/* @__PURE__ */ jsx5(
|
|
664
692
|
"span",
|
|
665
693
|
{
|
|
666
694
|
className: classNames(
|
|
@@ -681,7 +709,7 @@ function GridGroupRowComponent({
|
|
|
681
709
|
count,
|
|
682
710
|
")"
|
|
683
711
|
] }),
|
|
684
|
-
aggregates.length > 0 && /* @__PURE__ */
|
|
712
|
+
aggregates.length > 0 && /* @__PURE__ */ jsx5("span", { className: "gridkit-group-aggregates", children: aggregates.map((spec) => {
|
|
685
713
|
const key = spec.id ?? spec.columnId;
|
|
686
714
|
const aggregateValue = results.get(key);
|
|
687
715
|
const column = definitions.get(spec.columnId);
|
|
@@ -728,7 +756,7 @@ function textAlignFor(alignment) {
|
|
|
728
756
|
}
|
|
729
757
|
|
|
730
758
|
// src/DataGrid/components/GridGroupSummaryRow.tsx
|
|
731
|
-
import { jsx as
|
|
759
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
732
760
|
function GridGroupSummaryRowComponent({
|
|
733
761
|
groupId,
|
|
734
762
|
level,
|
|
@@ -740,7 +768,7 @@ function GridGroupSummaryRowComponent({
|
|
|
740
768
|
locale,
|
|
741
769
|
ref
|
|
742
770
|
}) {
|
|
743
|
-
return /* @__PURE__ */
|
|
771
|
+
return /* @__PURE__ */ jsx6(
|
|
744
772
|
"tr",
|
|
745
773
|
{
|
|
746
774
|
ref,
|
|
@@ -770,7 +798,7 @@ function GridGroupSummaryRowComponent({
|
|
|
770
798
|
...pinnedCellStyle(entry)
|
|
771
799
|
},
|
|
772
800
|
children: [
|
|
773
|
-
entry.id === columns[0]?.id && /* @__PURE__ */
|
|
801
|
+
entry.id === columns[0]?.id && /* @__PURE__ */ jsx6(
|
|
774
802
|
"span",
|
|
775
803
|
{
|
|
776
804
|
className: "gridkit-grid-group-summary-indent",
|
|
@@ -808,7 +836,7 @@ import {
|
|
|
808
836
|
formatCellValue
|
|
809
837
|
} from "@gridkitjs/core";
|
|
810
838
|
import { memo as memo3 } from "react";
|
|
811
|
-
import { jsx as
|
|
839
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
812
840
|
function GridRowComponent({
|
|
813
841
|
columns,
|
|
814
842
|
rowId,
|
|
@@ -836,7 +864,7 @@ function GridRowComponent({
|
|
|
836
864
|
cellsSelectable ? "Space Enter" : "",
|
|
837
865
|
contextMenu ? "Shift+F10" : ""
|
|
838
866
|
].filter(Boolean).join(" ");
|
|
839
|
-
return /* @__PURE__ */
|
|
867
|
+
return /* @__PURE__ */ jsx7(
|
|
840
868
|
"tr",
|
|
841
869
|
{
|
|
842
870
|
...rowAttributes,
|
|
@@ -858,7 +886,7 @@ function GridRowComponent({
|
|
|
858
886
|
const { id, column, alignment } = entry;
|
|
859
887
|
const value = accessDotted(row, column.field);
|
|
860
888
|
const cellSelected = id === selectedColumnId;
|
|
861
|
-
return /* @__PURE__ */
|
|
889
|
+
return /* @__PURE__ */ jsx7(
|
|
862
890
|
"td",
|
|
863
891
|
{
|
|
864
892
|
role: "gridcell",
|
|
@@ -898,7 +926,7 @@ var GridRow = memo3(GridRowComponent);
|
|
|
898
926
|
var GridRow_default = GridRow;
|
|
899
927
|
|
|
900
928
|
// src/DataGrid/components/GridBody.tsx
|
|
901
|
-
import { Fragment, jsx as
|
|
929
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
902
930
|
function GridBody({
|
|
903
931
|
columns,
|
|
904
932
|
definitions,
|
|
@@ -912,6 +940,9 @@ function GridBody({
|
|
|
912
940
|
virtualRange,
|
|
913
941
|
infiniteScroll,
|
|
914
942
|
sentinelRef,
|
|
943
|
+
empty,
|
|
944
|
+
emptyTemplate,
|
|
945
|
+
viewportWidth,
|
|
915
946
|
locale,
|
|
916
947
|
getRowProps,
|
|
917
948
|
onRowClick,
|
|
@@ -1043,7 +1074,7 @@ function GridBody({
|
|
|
1043
1074
|
// to give the browser's scrollbar the correct total height and thumb
|
|
1044
1075
|
// position, the same way `GridFooter`'s `<tfoot>` isn't a "row" to
|
|
1045
1076
|
// any of this grid's own row-counting logic.
|
|
1046
|
-
/* @__PURE__ */
|
|
1077
|
+
/* @__PURE__ */ jsx8("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx8(
|
|
1047
1078
|
"td",
|
|
1048
1079
|
{
|
|
1049
1080
|
style: {
|
|
@@ -1057,7 +1088,7 @@ function GridBody({
|
|
|
1057
1088
|
switch (entry.kind) {
|
|
1058
1089
|
case "data": {
|
|
1059
1090
|
const rowProps = rowPropsOf(entry.rowId);
|
|
1060
|
-
return /* @__PURE__ */
|
|
1091
|
+
return /* @__PURE__ */ jsx8(
|
|
1061
1092
|
GridRow_default,
|
|
1062
1093
|
{
|
|
1063
1094
|
ref: virtualRange?.measureRow(entry.rowIndex),
|
|
@@ -1089,7 +1120,7 @@ function GridBody({
|
|
|
1089
1120
|
);
|
|
1090
1121
|
}
|
|
1091
1122
|
case "group-summary":
|
|
1092
|
-
return /* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ jsx8(
|
|
1093
1124
|
GridGroupSummaryRow_default,
|
|
1094
1125
|
{
|
|
1095
1126
|
ref: virtualRange?.measureRow(entry.rowIndex),
|
|
@@ -1105,7 +1136,7 @@ function GridBody({
|
|
|
1105
1136
|
`${entry.groupId}-summary`
|
|
1106
1137
|
);
|
|
1107
1138
|
case "group":
|
|
1108
|
-
return /* @__PURE__ */
|
|
1139
|
+
return /* @__PURE__ */ jsx8(
|
|
1109
1140
|
GridGroupRow_default,
|
|
1110
1141
|
{
|
|
1111
1142
|
ref: virtualRange?.measureRow(entry.rowIndex),
|
|
@@ -1134,7 +1165,15 @@ function GridBody({
|
|
|
1134
1165
|
return entry;
|
|
1135
1166
|
}
|
|
1136
1167
|
}),
|
|
1137
|
-
|
|
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(
|
|
1138
1177
|
"td",
|
|
1139
1178
|
{
|
|
1140
1179
|
style: {
|
|
@@ -1145,7 +1184,7 @@ function GridBody({
|
|
|
1145
1184
|
}
|
|
1146
1185
|
) }),
|
|
1147
1186
|
infiniteScroll?.hasMore && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1148
|
-
infiniteScroll.isLoadingMore === true && /* @__PURE__ */
|
|
1187
|
+
infiniteScroll.isLoadingMore === true && /* @__PURE__ */ jsx8("tr", { "aria-hidden": "true", className: "gridkit-grid-loading-row", children: /* @__PURE__ */ jsx8(
|
|
1149
1188
|
"td",
|
|
1150
1189
|
{
|
|
1151
1190
|
colSpan: columns.length,
|
|
@@ -1153,13 +1192,13 @@ function GridBody({
|
|
|
1153
1192
|
children: infiniteScroll.loadingTemplate ? infiniteScroll.loadingTemplate() : messages.loadingMore
|
|
1154
1193
|
}
|
|
1155
1194
|
) }),
|
|
1156
|
-
/* @__PURE__ */
|
|
1195
|
+
/* @__PURE__ */ jsx8(
|
|
1157
1196
|
"tr",
|
|
1158
1197
|
{
|
|
1159
1198
|
"aria-hidden": "true",
|
|
1160
1199
|
ref: sentinelRef,
|
|
1161
1200
|
className: "gridkit-grid-sentinel-row",
|
|
1162
|
-
children: /* @__PURE__ */
|
|
1201
|
+
children: /* @__PURE__ */ jsx8(
|
|
1163
1202
|
"td",
|
|
1164
1203
|
{
|
|
1165
1204
|
colSpan: columns.length,
|
|
@@ -1175,7 +1214,7 @@ function GridBody({
|
|
|
1175
1214
|
}
|
|
1176
1215
|
|
|
1177
1216
|
// src/DataGrid/components/GridFooter.tsx
|
|
1178
|
-
import { jsx as
|
|
1217
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1179
1218
|
function GridFooter({
|
|
1180
1219
|
columns,
|
|
1181
1220
|
aggregates,
|
|
@@ -1184,7 +1223,7 @@ function GridFooter({
|
|
|
1184
1223
|
locale,
|
|
1185
1224
|
ariaRowIndex
|
|
1186
1225
|
}) {
|
|
1187
|
-
return /* @__PURE__ */
|
|
1226
|
+
return /* @__PURE__ */ jsx9("tfoot", { role: "rowgroup", children: /* @__PURE__ */ jsx9(
|
|
1188
1227
|
"tr",
|
|
1189
1228
|
{
|
|
1190
1229
|
className: "gridkit-grid-footer",
|
|
@@ -1194,7 +1233,7 @@ function GridFooter({
|
|
|
1194
1233
|
const specs = aggregates.filter(
|
|
1195
1234
|
(candidate) => candidate.columnId === entry.id
|
|
1196
1235
|
);
|
|
1197
|
-
return /* @__PURE__ */
|
|
1236
|
+
return /* @__PURE__ */ jsx9(
|
|
1198
1237
|
"td",
|
|
1199
1238
|
{
|
|
1200
1239
|
role: "gridcell",
|
|
@@ -1228,7 +1267,7 @@ function GridFooter({
|
|
|
1228
1267
|
|
|
1229
1268
|
// src/DataGrid/components/GridPager.tsx
|
|
1230
1269
|
import { paginationWindow } from "@gridkitjs/core/renderer";
|
|
1231
|
-
import { jsx as
|
|
1270
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1232
1271
|
function PagerNavButton({
|
|
1233
1272
|
className,
|
|
1234
1273
|
label,
|
|
@@ -1236,7 +1275,7 @@ function PagerNavButton({
|
|
|
1236
1275
|
onClick,
|
|
1237
1276
|
children
|
|
1238
1277
|
}) {
|
|
1239
|
-
return /* @__PURE__ */
|
|
1278
|
+
return /* @__PURE__ */ jsx10(
|
|
1240
1279
|
"button",
|
|
1241
1280
|
{
|
|
1242
1281
|
type: "button",
|
|
@@ -1252,13 +1291,15 @@ function PagerNavButton({
|
|
|
1252
1291
|
);
|
|
1253
1292
|
}
|
|
1254
1293
|
function GridPager({ pager, config, messages }) {
|
|
1255
|
-
const { pagination
|
|
1294
|
+
const { pagination } = pager;
|
|
1295
|
+
const pageCount = Math.max(1, pager.pageCount);
|
|
1296
|
+
const currentPage = Math.max(1, pager.currentPage);
|
|
1256
1297
|
const variant = config?.variant ?? "compact";
|
|
1257
1298
|
const sizeOptions = config?.sizeOptions;
|
|
1258
1299
|
const atFirst = pagination.pageIndex <= 0;
|
|
1259
1300
|
const atLast = pagination.pageIndex >= pageCount - 1;
|
|
1260
1301
|
const barStyle = {
|
|
1261
|
-
"--gridkit-pager-digits": String(String(
|
|
1302
|
+
"--gridkit-pager-digits": String(String(pageCount).length)
|
|
1262
1303
|
};
|
|
1263
1304
|
return /* @__PURE__ */ jsxs6(
|
|
1264
1305
|
"div",
|
|
@@ -1268,7 +1309,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1268
1309
|
"aria-label": messages.pagerLabel,
|
|
1269
1310
|
children: [
|
|
1270
1311
|
/* @__PURE__ */ jsxs6("div", { className: "gridkit-grid-pager-bar", style: barStyle, children: [
|
|
1271
|
-
/* @__PURE__ */
|
|
1312
|
+
/* @__PURE__ */ jsx10(
|
|
1272
1313
|
PagerNavButton,
|
|
1273
1314
|
{
|
|
1274
1315
|
className: "gridkit-grid-pager-first",
|
|
@@ -1277,10 +1318,10 @@ function GridPager({ pager, config, messages }) {
|
|
|
1277
1318
|
onClick: () => {
|
|
1278
1319
|
pager.goToPage(0);
|
|
1279
1320
|
},
|
|
1280
|
-
children: /* @__PURE__ */
|
|
1321
|
+
children: /* @__PURE__ */ jsx10(ChevronsLeftIcon, {})
|
|
1281
1322
|
}
|
|
1282
1323
|
),
|
|
1283
|
-
/* @__PURE__ */
|
|
1324
|
+
/* @__PURE__ */ jsx10(
|
|
1284
1325
|
PagerNavButton,
|
|
1285
1326
|
{
|
|
1286
1327
|
className: "gridkit-grid-pager-previous",
|
|
@@ -1289,14 +1330,14 @@ function GridPager({ pager, config, messages }) {
|
|
|
1289
1330
|
onClick: () => {
|
|
1290
1331
|
pager.previousPage();
|
|
1291
1332
|
},
|
|
1292
|
-
children: /* @__PURE__ */
|
|
1333
|
+
children: /* @__PURE__ */ jsx10(ChevronLeftIcon, {})
|
|
1293
1334
|
}
|
|
1294
1335
|
),
|
|
1295
1336
|
variant === "numbered" ? paginationWindow(currentPage, pageCount, {
|
|
1296
1337
|
boundaryCount: config?.boundaryCount,
|
|
1297
1338
|
siblingCount: config?.siblingCount
|
|
1298
1339
|
}).map(
|
|
1299
|
-
(entry, index) => entry === "ellipsis" ? /* @__PURE__ */
|
|
1340
|
+
(entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx10(
|
|
1300
1341
|
"span",
|
|
1301
1342
|
{
|
|
1302
1343
|
className: "gridkit-grid-pager-ellipsis",
|
|
@@ -1304,7 +1345,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1304
1345
|
children: "\u2026"
|
|
1305
1346
|
},
|
|
1306
1347
|
`ellipsis-${String(index)}`
|
|
1307
|
-
) : /* @__PURE__ */
|
|
1348
|
+
) : /* @__PURE__ */ jsx10(
|
|
1308
1349
|
"button",
|
|
1309
1350
|
{
|
|
1310
1351
|
type: "button",
|
|
@@ -1319,11 +1360,8 @@ function GridPager({ pager, config, messages }) {
|
|
|
1319
1360
|
entry
|
|
1320
1361
|
)
|
|
1321
1362
|
) : /* @__PURE__ */ jsxs6("span", { className: "gridkit-grid-pager-status-slot", children: [
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
|
|
1324
|
-
pageCount
|
|
1325
|
-
) }),
|
|
1326
|
-
/* @__PURE__ */ jsx9(
|
|
1363
|
+
/* @__PURE__ */ jsx10("span", { className: "gridkit-grid-pager-status", children: messages.pageStatus(currentPage, pageCount) }),
|
|
1364
|
+
/* @__PURE__ */ jsx10(
|
|
1327
1365
|
"span",
|
|
1328
1366
|
{
|
|
1329
1367
|
className: "gridkit-grid-pager-status-sizer",
|
|
@@ -1332,7 +1370,7 @@ function GridPager({ pager, config, messages }) {
|
|
|
1332
1370
|
}
|
|
1333
1371
|
)
|
|
1334
1372
|
] }),
|
|
1335
|
-
/* @__PURE__ */
|
|
1373
|
+
/* @__PURE__ */ jsx10(
|
|
1336
1374
|
PagerNavButton,
|
|
1337
1375
|
{
|
|
1338
1376
|
className: "gridkit-grid-pager-next",
|
|
@@ -1341,10 +1379,10 @@ function GridPager({ pager, config, messages }) {
|
|
|
1341
1379
|
onClick: () => {
|
|
1342
1380
|
pager.nextPage();
|
|
1343
1381
|
},
|
|
1344
|
-
children: /* @__PURE__ */
|
|
1382
|
+
children: /* @__PURE__ */ jsx10(ChevronRightIcon, {})
|
|
1345
1383
|
}
|
|
1346
1384
|
),
|
|
1347
|
-
/* @__PURE__ */
|
|
1385
|
+
/* @__PURE__ */ jsx10(
|
|
1348
1386
|
PagerNavButton,
|
|
1349
1387
|
{
|
|
1350
1388
|
className: "gridkit-grid-pager-last",
|
|
@@ -1353,22 +1391,22 @@ function GridPager({ pager, config, messages }) {
|
|
|
1353
1391
|
onClick: () => {
|
|
1354
1392
|
pager.goToPage(pageCount - 1);
|
|
1355
1393
|
},
|
|
1356
|
-
children: /* @__PURE__ */
|
|
1394
|
+
children: /* @__PURE__ */ jsx10(ChevronsRightIcon, {})
|
|
1357
1395
|
}
|
|
1358
1396
|
)
|
|
1359
1397
|
] }),
|
|
1360
1398
|
sizeOptions !== void 0 && sizeOptions.length > 0 && /* @__PURE__ */ jsxs6("label", { className: "gridkit-grid-pager-page-size", children: [
|
|
1361
|
-
/* @__PURE__ */
|
|
1399
|
+
/* @__PURE__ */ jsx10(
|
|
1362
1400
|
"select",
|
|
1363
1401
|
{
|
|
1364
1402
|
value: pagination.pageSize,
|
|
1365
1403
|
onChange: (event) => {
|
|
1366
1404
|
pager.setPageSize(Number(event.target.value));
|
|
1367
1405
|
},
|
|
1368
|
-
children: sizeOptions.map((size) => /* @__PURE__ */
|
|
1406
|
+
children: sizeOptions.map((size) => /* @__PURE__ */ jsx10("option", { value: size, children: size }, size))
|
|
1369
1407
|
}
|
|
1370
1408
|
),
|
|
1371
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ jsx10("span", { className: "gridkit-grid-pager-page-size-label", children: messages.pageSizeLabel })
|
|
1372
1410
|
] })
|
|
1373
1411
|
]
|
|
1374
1412
|
}
|
|
@@ -1500,7 +1538,7 @@ function useGroupByDrag({
|
|
|
1500
1538
|
}
|
|
1501
1539
|
|
|
1502
1540
|
// src/DataGrid/components/GroupByBar.tsx
|
|
1503
|
-
import { jsx as
|
|
1541
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1504
1542
|
function GroupByBar({
|
|
1505
1543
|
columns,
|
|
1506
1544
|
definitions,
|
|
@@ -1549,7 +1587,7 @@ function GroupByBar({
|
|
|
1549
1587
|
role: "group",
|
|
1550
1588
|
"aria-label": messages.groupByBarLabel,
|
|
1551
1589
|
children: [
|
|
1552
|
-
showPlaceholder && /* @__PURE__ */
|
|
1590
|
+
showPlaceholder && /* @__PURE__ */ jsx11("span", { className: "gridkit-group-by-bar-placeholder", children: messages.groupByBarPlaceholder }),
|
|
1553
1591
|
groupBy.map((entry, index) => {
|
|
1554
1592
|
const dropBefore = activeDropTarget?.beforeColumnId === entry.columnId;
|
|
1555
1593
|
const dropAfter = activeDropTarget?.beforeColumnId === null && index === groupBy.length - 1;
|
|
@@ -1585,8 +1623,8 @@ function GroupByBar({
|
|
|
1585
1623
|
}
|
|
1586
1624
|
},
|
|
1587
1625
|
children: [
|
|
1588
|
-
/* @__PURE__ */
|
|
1589
|
-
/* @__PURE__ */
|
|
1626
|
+
/* @__PURE__ */ jsx11("span", { className: "gridkit-group-by-chip-label", children: labelFor(entry.columnId) }),
|
|
1627
|
+
/* @__PURE__ */ jsx11(
|
|
1590
1628
|
"button",
|
|
1591
1629
|
{
|
|
1592
1630
|
type: "button",
|
|
@@ -1607,7 +1645,7 @@ function GroupByBar({
|
|
|
1607
1645
|
);
|
|
1608
1646
|
}),
|
|
1609
1647
|
chipDrag.draggedColumnId !== null && chipDrag.ghostTransform !== null && createPortal2(
|
|
1610
|
-
/* @__PURE__ */
|
|
1648
|
+
/* @__PURE__ */ jsx11(
|
|
1611
1649
|
"span",
|
|
1612
1650
|
{
|
|
1613
1651
|
className: "gridkit-group-by-chip gridkit-drag-ghost",
|
|
@@ -1758,7 +1796,10 @@ function announcedCallbacks({
|
|
|
1758
1796
|
onPaginationChange: (event) => {
|
|
1759
1797
|
callbacks.onPaginationChange?.(event);
|
|
1760
1798
|
announce(
|
|
1761
|
-
messages.pageStatus(
|
|
1799
|
+
messages.pageStatus(
|
|
1800
|
+
event.pagination.pageIndex + 1,
|
|
1801
|
+
Math.max(1, event.pageCount)
|
|
1802
|
+
)
|
|
1762
1803
|
);
|
|
1763
1804
|
},
|
|
1764
1805
|
/**
|
|
@@ -2051,7 +2092,7 @@ import {
|
|
|
2051
2092
|
attachOverlay,
|
|
2052
2093
|
writingDirection as writingDirection4
|
|
2053
2094
|
} from "@gridkitjs/dom";
|
|
2054
|
-
import { jsx as
|
|
2095
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2055
2096
|
var ANCHOR_GAP = 4;
|
|
2056
2097
|
function attachedFocus(focus) {
|
|
2057
2098
|
return typeof focus === "object" && !(focus instanceof HTMLElement) ? focus.current ?? "first" : focus;
|
|
@@ -2119,7 +2160,7 @@ function Overlay({
|
|
|
2119
2160
|
trapFocus
|
|
2120
2161
|
]);
|
|
2121
2162
|
return createPortal3(
|
|
2122
|
-
/* @__PURE__ */
|
|
2163
|
+
/* @__PURE__ */ jsx12(
|
|
2123
2164
|
"div",
|
|
2124
2165
|
{
|
|
2125
2166
|
ref: panelRef,
|
|
@@ -2133,42 +2174,42 @@ function Overlay({
|
|
|
2133
2174
|
}
|
|
2134
2175
|
|
|
2135
2176
|
// src/DataGrid/menu/menuIcons.tsx
|
|
2136
|
-
import { jsx as
|
|
2177
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2137
2178
|
var BUILT_IN_ICONS = {
|
|
2138
2179
|
sortAscending: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2139
|
-
/* @__PURE__ */
|
|
2140
|
-
/* @__PURE__ */
|
|
2141
|
-
/* @__PURE__ */
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2180
|
+
/* @__PURE__ */ jsx13("path", { d: "m3 8 4-4 4 4" }),
|
|
2181
|
+
/* @__PURE__ */ jsx13("path", { d: "M7 4v16" }),
|
|
2182
|
+
/* @__PURE__ */ jsx13("path", { d: "M11 12h4" }),
|
|
2183
|
+
/* @__PURE__ */ jsx13("path", { d: "M11 16h7" }),
|
|
2184
|
+
/* @__PURE__ */ jsx13("path", { d: "M11 20h10" })
|
|
2144
2185
|
] }),
|
|
2145
2186
|
sortDescending: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2146
|
-
/* @__PURE__ */
|
|
2147
|
-
/* @__PURE__ */
|
|
2148
|
-
/* @__PURE__ */
|
|
2149
|
-
/* @__PURE__ */
|
|
2150
|
-
/* @__PURE__ */
|
|
2187
|
+
/* @__PURE__ */ jsx13("path", { d: "m3 16 4 4 4-4" }),
|
|
2188
|
+
/* @__PURE__ */ jsx13("path", { d: "M7 20V4" }),
|
|
2189
|
+
/* @__PURE__ */ jsx13("path", { d: "M11 4h10" }),
|
|
2190
|
+
/* @__PURE__ */ jsx13("path", { d: "M11 8h7" }),
|
|
2191
|
+
/* @__PURE__ */ jsx13("path", { d: "M11 12h4" })
|
|
2151
2192
|
] }),
|
|
2152
|
-
group: () => /* @__PURE__ */
|
|
2193
|
+
group: () => /* @__PURE__ */ jsx13(GroupIcon, {}),
|
|
2153
2194
|
hide: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2154
|
-
/* @__PURE__ */
|
|
2155
|
-
/* @__PURE__ */
|
|
2156
|
-
/* @__PURE__ */
|
|
2157
|
-
/* @__PURE__ */
|
|
2195
|
+
/* @__PURE__ */ jsx13("path", { d: "M9.88 9.88a3 3 0 1 0 4.24 4.24" }),
|
|
2196
|
+
/* @__PURE__ */ jsx13("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" }),
|
|
2197
|
+
/* @__PURE__ */ jsx13("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" }),
|
|
2198
|
+
/* @__PURE__ */ jsx13("path", { d: "m2 2 20 20" })
|
|
2158
2199
|
] }),
|
|
2159
2200
|
autoFit: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2160
|
-
/* @__PURE__ */
|
|
2161
|
-
/* @__PURE__ */
|
|
2162
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsx13("path", { d: "m18 8 4 4-4 4" }),
|
|
2202
|
+
/* @__PURE__ */ jsx13("path", { d: "M2 12h20" }),
|
|
2203
|
+
/* @__PURE__ */ jsx13("path", { d: "m6 8-4 4 4 4" })
|
|
2163
2204
|
] }),
|
|
2164
2205
|
copy: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2165
|
-
/* @__PURE__ */
|
|
2166
|
-
/* @__PURE__ */
|
|
2206
|
+
/* @__PURE__ */ jsx13("rect", { x: "8", y: "8", width: "14", height: "14", rx: "2" }),
|
|
2207
|
+
/* @__PURE__ */ jsx13("path", { d: "M4 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2" })
|
|
2167
2208
|
] }),
|
|
2168
2209
|
print: () => /* @__PURE__ */ jsxs8(Icon, { children: [
|
|
2169
|
-
/* @__PURE__ */
|
|
2170
|
-
/* @__PURE__ */
|
|
2171
|
-
/* @__PURE__ */
|
|
2210
|
+
/* @__PURE__ */ jsx13("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" }),
|
|
2211
|
+
/* @__PURE__ */ jsx13("path", { d: "M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6" }),
|
|
2212
|
+
/* @__PURE__ */ jsx13("rect", { x: "6", y: "14", width: "12", height: "8", rx: "1" })
|
|
2172
2213
|
] })
|
|
2173
2214
|
};
|
|
2174
2215
|
var ICONS = new Map(Object.entries(BUILT_IN_ICONS));
|
|
@@ -2177,20 +2218,20 @@ function MenuIcon({ name }) {
|
|
|
2177
2218
|
return draw === void 0 ? null : draw();
|
|
2178
2219
|
}
|
|
2179
2220
|
function CheckIcon() {
|
|
2180
|
-
return /* @__PURE__ */
|
|
2221
|
+
return /* @__PURE__ */ jsx13(Icon, { children: /* @__PURE__ */ jsx13("path", { d: "M20 6 9 17l-5-5" }) });
|
|
2181
2222
|
}
|
|
2182
2223
|
function ChevronDownIcon() {
|
|
2183
|
-
return /* @__PURE__ */
|
|
2224
|
+
return /* @__PURE__ */ jsx13(Icon, { children: /* @__PURE__ */ jsx13("path", { d: "m6 9 6 6 6-6" }) });
|
|
2184
2225
|
}
|
|
2185
2226
|
function ChevronLeftIcon2() {
|
|
2186
|
-
return /* @__PURE__ */
|
|
2227
|
+
return /* @__PURE__ */ jsx13(Icon, { children: /* @__PURE__ */ jsx13("path", { d: "m15 18-6-6 6-6" }) });
|
|
2187
2228
|
}
|
|
2188
2229
|
function ChevronRightIcon2() {
|
|
2189
|
-
return /* @__PURE__ */
|
|
2230
|
+
return /* @__PURE__ */ jsx13(Icon, { children: /* @__PURE__ */ jsx13("path", { d: "m9 18 6-6-6-6" }) });
|
|
2190
2231
|
}
|
|
2191
2232
|
|
|
2192
2233
|
// src/DataGrid/menu/GridMenu.tsx
|
|
2193
|
-
import { Fragment as Fragment2, jsx as
|
|
2234
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2194
2235
|
var CLOSED = { kind: "closed" };
|
|
2195
2236
|
var ENTRY_GONE = { kind: "entryGone" };
|
|
2196
2237
|
function itemElement(menu, id) {
|
|
@@ -2221,10 +2262,10 @@ function MenuItem({
|
|
|
2221
2262
|
...ariaAttr(!isItem2, "aria-haspopup", "menu"),
|
|
2222
2263
|
...ariaAttr(!isItem2, "aria-expanded", expanded),
|
|
2223
2264
|
children: [
|
|
2224
|
-
/* @__PURE__ */
|
|
2225
|
-
/* @__PURE__ */
|
|
2226
|
-
shortcut !== void 0 && /* @__PURE__ */
|
|
2227
|
-
!isItem2 && /* @__PURE__ */
|
|
2265
|
+
/* @__PURE__ */ jsx14("span", { className: "gridkit-menu-item-icon", "aria-hidden": "true", children: checked === true ? /* @__PURE__ */ jsx14(CheckIcon, {}) : /* @__PURE__ */ jsx14(MenuIcon, { name: entry.icon }) }),
|
|
2266
|
+
/* @__PURE__ */ jsx14("span", { className: "gridkit-menu-item-label", children: entry.label }),
|
|
2267
|
+
shortcut !== void 0 && /* @__PURE__ */ jsx14("span", { className: "gridkit-menu-item-shortcut", "aria-hidden": "true", children: shortcut }),
|
|
2268
|
+
!isItem2 && /* @__PURE__ */ jsx14("span", { className: "gridkit-menu-submenu-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx14(ChevronRightIcon2, {}) })
|
|
2228
2269
|
]
|
|
2229
2270
|
}
|
|
2230
2271
|
);
|
|
@@ -2319,7 +2360,7 @@ function GridMenu({
|
|
|
2319
2360
|
setSubmenu(ENTRY_GONE);
|
|
2320
2361
|
}
|
|
2321
2362
|
return /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2322
|
-
/* @__PURE__ */
|
|
2363
|
+
/* @__PURE__ */ jsx14(
|
|
2323
2364
|
"div",
|
|
2324
2365
|
{
|
|
2325
2366
|
ref: menuRef,
|
|
@@ -2327,14 +2368,14 @@ function GridMenu({
|
|
|
2327
2368
|
"aria-label": label,
|
|
2328
2369
|
className: "gridkit-menu",
|
|
2329
2370
|
children: entries.map(
|
|
2330
|
-
(entry) => entry.type === "separator" ? /* @__PURE__ */
|
|
2371
|
+
(entry) => entry.type === "separator" ? /* @__PURE__ */ jsx14(
|
|
2331
2372
|
"div",
|
|
2332
2373
|
{
|
|
2333
2374
|
role: "separator",
|
|
2334
2375
|
className: "gridkit-menu-separator"
|
|
2335
2376
|
},
|
|
2336
2377
|
entry.key
|
|
2337
|
-
) : /* @__PURE__ */
|
|
2378
|
+
) : /* @__PURE__ */ jsx14(
|
|
2338
2379
|
MenuItem,
|
|
2339
2380
|
{
|
|
2340
2381
|
entry,
|
|
@@ -2345,7 +2386,7 @@ function GridMenu({
|
|
|
2345
2386
|
)
|
|
2346
2387
|
}
|
|
2347
2388
|
),
|
|
2348
|
-
submenu.kind === "open" && openEntry !== void 0 && /* @__PURE__ */
|
|
2389
|
+
submenu.kind === "open" && openEntry !== void 0 && /* @__PURE__ */ jsx14(
|
|
2349
2390
|
Overlay,
|
|
2350
2391
|
{
|
|
2351
2392
|
anchor: submenu.anchor,
|
|
@@ -2354,7 +2395,7 @@ function GridMenu({
|
|
|
2354
2395
|
initialFocus: submenu.focus,
|
|
2355
2396
|
scope,
|
|
2356
2397
|
onDismiss: closeSubmenu,
|
|
2357
|
-
children: /* @__PURE__ */
|
|
2398
|
+
children: /* @__PURE__ */ jsx14(
|
|
2358
2399
|
GridMenu,
|
|
2359
2400
|
{
|
|
2360
2401
|
entries: openEntry.items,
|
|
@@ -2373,7 +2414,7 @@ function GridMenu({
|
|
|
2373
2414
|
}
|
|
2374
2415
|
|
|
2375
2416
|
// src/DataGrid/contextMenu/GridContextMenu.tsx
|
|
2376
|
-
import { jsx as
|
|
2417
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2377
2418
|
function GridContextMenu({
|
|
2378
2419
|
contextMenu
|
|
2379
2420
|
}) {
|
|
@@ -2381,7 +2422,7 @@ function GridContextMenu({
|
|
|
2381
2422
|
if (menu === null) {
|
|
2382
2423
|
return null;
|
|
2383
2424
|
}
|
|
2384
|
-
return /* @__PURE__ */
|
|
2425
|
+
return /* @__PURE__ */ jsx15(
|
|
2385
2426
|
Overlay,
|
|
2386
2427
|
{
|
|
2387
2428
|
anchor: menu.anchor,
|
|
@@ -2390,7 +2431,7 @@ function GridContextMenu({
|
|
|
2390
2431
|
returnFocusFallback,
|
|
2391
2432
|
scope: menu.scope,
|
|
2392
2433
|
onDismiss: close,
|
|
2393
|
-
children: /* @__PURE__ */
|
|
2434
|
+
children: /* @__PURE__ */ jsx15(
|
|
2394
2435
|
GridMenu,
|
|
2395
2436
|
{
|
|
2396
2437
|
entries: menu.entries,
|
|
@@ -2417,7 +2458,7 @@ import {
|
|
|
2417
2458
|
isSameCell,
|
|
2418
2459
|
resolveMenu
|
|
2419
2460
|
} from "@gridkitjs/core";
|
|
2420
|
-
import { hasContextMenu } from "@gridkitjs/core/renderer";
|
|
2461
|
+
import { hasContextMenu, pinnedWidths } from "@gridkitjs/core/renderer";
|
|
2421
2462
|
import {
|
|
2422
2463
|
attachContextMenuTrigger
|
|
2423
2464
|
} from "@gridkitjs/dom";
|
|
@@ -2442,12 +2483,16 @@ function bodyCell(parts, rowIndex, columnIndex) {
|
|
|
2442
2483
|
const element = findBodyRow2(parts.bodyTable, rowIndex)?.cells[columnIndex];
|
|
2443
2484
|
return element === void 0 ? null : { element, focus: bodyFocus2(rowIndex, columnIndex) };
|
|
2444
2485
|
}
|
|
2486
|
+
function underPinnedColumns(element, parts) {
|
|
2487
|
+
return parts.pinnedWidths.start + parts.pinnedWidths.end > 0 && element instanceof HTMLTableCellElement && !element.matches(".is-pinned-start, .is-pinned-end");
|
|
2488
|
+
}
|
|
2445
2489
|
function viewOf(element, parts) {
|
|
2446
|
-
const
|
|
2447
|
-
if (
|
|
2490
|
+
const { scroller } = parts;
|
|
2491
|
+
if (scroller === null) {
|
|
2448
2492
|
return null;
|
|
2449
2493
|
}
|
|
2450
|
-
|
|
2494
|
+
const view = scroller.getBoundingClientRect();
|
|
2495
|
+
let { top, bottom, left, right } = view;
|
|
2451
2496
|
if (parts.body?.contains(element) === true) {
|
|
2452
2497
|
top = Math.max(
|
|
2453
2498
|
top,
|
|
@@ -2458,7 +2503,19 @@ function viewOf(element, parts) {
|
|
|
2458
2503
|
parts.footerTable?.getBoundingClientRect().top ?? bottom
|
|
2459
2504
|
);
|
|
2460
2505
|
}
|
|
2461
|
-
|
|
2506
|
+
if (underPinnedColumns(element, parts)) {
|
|
2507
|
+
const { start, end } = parts.pinnedWidths;
|
|
2508
|
+
const rtl = writingDirection5(element) === "rtl";
|
|
2509
|
+
const portLeft = view.left + scroller.clientLeft;
|
|
2510
|
+
left = portLeft + (rtl ? end : start);
|
|
2511
|
+
right = portLeft + scroller.clientWidth - (rtl ? start : end);
|
|
2512
|
+
}
|
|
2513
|
+
return new DOMRect(
|
|
2514
|
+
left,
|
|
2515
|
+
top,
|
|
2516
|
+
Math.max(0, right - left),
|
|
2517
|
+
Math.max(0, bottom - top)
|
|
2518
|
+
);
|
|
2462
2519
|
}
|
|
2463
2520
|
function clamp(value, min, max) {
|
|
2464
2521
|
return Math.min(Math.max(value, min), max);
|
|
@@ -2597,6 +2654,7 @@ function useContextMenu({
|
|
|
2597
2654
|
body: bodyRef.current,
|
|
2598
2655
|
footerTable: footerTableRef.current,
|
|
2599
2656
|
columns,
|
|
2657
|
+
pinnedWidths: pinnedWidths(columns),
|
|
2600
2658
|
pageRows
|
|
2601
2659
|
};
|
|
2602
2660
|
}
|
|
@@ -2760,7 +2818,7 @@ import { useRef as useRef15 } from "react";
|
|
|
2760
2818
|
// src/DataGrid/columnChooser/ColumnChooser.tsx
|
|
2761
2819
|
import { useLayoutEffect as useLayoutEffect7, useRef as useRef9, useState as useState6 } from "react";
|
|
2762
2820
|
import { resolveColumnChooser } from "@gridkitjs/core/renderer";
|
|
2763
|
-
import { Fragment as Fragment3, jsx as
|
|
2821
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2764
2822
|
function ColumnChooser({
|
|
2765
2823
|
controller,
|
|
2766
2824
|
messages
|
|
@@ -2791,7 +2849,7 @@ function ColumnChooser({
|
|
|
2791
2849
|
"aria-label": messages.columnChooserLabel,
|
|
2792
2850
|
className: "gridkit-column-chooser",
|
|
2793
2851
|
children: [
|
|
2794
|
-
/* @__PURE__ */
|
|
2852
|
+
/* @__PURE__ */ jsx16(
|
|
2795
2853
|
"input",
|
|
2796
2854
|
{
|
|
2797
2855
|
type: "search",
|
|
@@ -2804,9 +2862,9 @@ function ColumnChooser({
|
|
|
2804
2862
|
}
|
|
2805
2863
|
}
|
|
2806
2864
|
),
|
|
2807
|
-
entries.length === 0 ? /* @__PURE__ */
|
|
2865
|
+
entries.length === 0 ? /* @__PURE__ */ jsx16("p", { role: "status", className: "gridkit-column-chooser-empty", children: messages.noMatchingColumns }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2808
2866
|
/* @__PURE__ */ jsxs10("label", { className: "gridkit-column-chooser-option gridkit-column-chooser-all", children: [
|
|
2809
|
-
/* @__PURE__ */
|
|
2867
|
+
/* @__PURE__ */ jsx16(
|
|
2810
2868
|
"input",
|
|
2811
2869
|
{
|
|
2812
2870
|
ref: showAllRef,
|
|
@@ -2822,8 +2880,8 @@ function ColumnChooser({
|
|
|
2822
2880
|
),
|
|
2823
2881
|
messages.showAllColumns
|
|
2824
2882
|
] }),
|
|
2825
|
-
/* @__PURE__ */
|
|
2826
|
-
/* @__PURE__ */
|
|
2883
|
+
/* @__PURE__ */ jsx16("ul", { className: "gridkit-column-chooser-list", children: entries.map((entry) => /* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */ jsxs10("label", { className: "gridkit-column-chooser-option", children: [
|
|
2884
|
+
/* @__PURE__ */ jsx16(
|
|
2827
2885
|
"input",
|
|
2828
2886
|
{
|
|
2829
2887
|
type: "checkbox",
|
|
@@ -2953,7 +3011,7 @@ function useMenuButton({
|
|
|
2953
3011
|
}
|
|
2954
3012
|
|
|
2955
3013
|
// src/DataGrid/filterMenu/OperatorMenuButton.tsx
|
|
2956
|
-
import { Fragment as Fragment4, jsx as
|
|
3014
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2957
3015
|
function gapBeside(button) {
|
|
2958
3016
|
const dialog = button.closest('[role="dialog"]') ?? button;
|
|
2959
3017
|
return dialog.getBoundingClientRect().right - button.getBoundingClientRect().right + ANCHOR_GAP;
|
|
@@ -2991,20 +3049,20 @@ function OperatorMenuButton({
|
|
|
2991
3049
|
className: "gridkit-filter-menu-submenu",
|
|
2992
3050
|
...buttonProps,
|
|
2993
3051
|
children: [
|
|
2994
|
-
/* @__PURE__ */
|
|
3052
|
+
/* @__PURE__ */ jsx17("span", { className: "gridkit-filter-menu-submenu-icon", "aria-hidden": "true", children: active !== void 0 && /* @__PURE__ */ jsx17(CheckIcon, {}) }),
|
|
2995
3053
|
label,
|
|
2996
|
-
/* @__PURE__ */
|
|
3054
|
+
/* @__PURE__ */ jsx17(
|
|
2997
3055
|
"span",
|
|
2998
3056
|
{
|
|
2999
3057
|
className: "gridkit-filter-menu-submenu-indicator",
|
|
3000
3058
|
"aria-hidden": "true",
|
|
3001
|
-
children: /* @__PURE__ */
|
|
3059
|
+
children: /* @__PURE__ */ jsx17(ChevronRightIcon2, {})
|
|
3002
3060
|
}
|
|
3003
3061
|
)
|
|
3004
3062
|
]
|
|
3005
3063
|
}
|
|
3006
3064
|
),
|
|
3007
|
-
state.kind === "open" && /* @__PURE__ */
|
|
3065
|
+
state.kind === "open" && /* @__PURE__ */ jsx17(
|
|
3008
3066
|
Overlay,
|
|
3009
3067
|
{
|
|
3010
3068
|
anchor: state.anchor,
|
|
@@ -3013,7 +3071,7 @@ function OperatorMenuButton({
|
|
|
3013
3071
|
returnFocusTo: state.anchor,
|
|
3014
3072
|
scope: state.scope,
|
|
3015
3073
|
onDismiss: close,
|
|
3016
|
-
children: /* @__PURE__ */
|
|
3074
|
+
children: /* @__PURE__ */ jsx17(
|
|
3017
3075
|
GridMenu,
|
|
3018
3076
|
{
|
|
3019
3077
|
entries,
|
|
@@ -3052,7 +3110,7 @@ import {
|
|
|
3052
3110
|
filterOperandArity,
|
|
3053
3111
|
parseFilterOperand
|
|
3054
3112
|
} from "@gridkitjs/core/renderer";
|
|
3055
|
-
import { jsx as
|
|
3113
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3056
3114
|
function inputType(family, type) {
|
|
3057
3115
|
switch (family) {
|
|
3058
3116
|
case "text":
|
|
@@ -3086,12 +3144,12 @@ function OperandField({
|
|
|
3086
3144
|
};
|
|
3087
3145
|
if (family === "boolean") {
|
|
3088
3146
|
return /* @__PURE__ */ jsxs12("select", { ...field, children: [
|
|
3089
|
-
/* @__PURE__ */
|
|
3090
|
-
/* @__PURE__ */
|
|
3091
|
-
/* @__PURE__ */
|
|
3147
|
+
/* @__PURE__ */ jsx18("option", { value: "" }),
|
|
3148
|
+
/* @__PURE__ */ jsx18("option", { value: "true", children: messages.booleanTrue }),
|
|
3149
|
+
/* @__PURE__ */ jsx18("option", { value: "false", children: messages.booleanFalse })
|
|
3092
3150
|
] });
|
|
3093
3151
|
}
|
|
3094
|
-
return /* @__PURE__ */
|
|
3152
|
+
return /* @__PURE__ */ jsx18("input", { ...field, type: inputType(family, type) });
|
|
3095
3153
|
}
|
|
3096
3154
|
function ConditionRow({
|
|
3097
3155
|
row,
|
|
@@ -3118,7 +3176,7 @@ function ConditionRow({
|
|
|
3118
3176
|
"aria-label": messages.filterConditionLabel(position),
|
|
3119
3177
|
className: "gridkit-filter-menu-condition",
|
|
3120
3178
|
children: [
|
|
3121
|
-
/* @__PURE__ */
|
|
3179
|
+
/* @__PURE__ */ jsx18(
|
|
3122
3180
|
"select",
|
|
3123
3181
|
{
|
|
3124
3182
|
ref: arity === 0 ? focusRef : void 0,
|
|
@@ -3131,10 +3189,10 @@ function ConditionRow({
|
|
|
3131
3189
|
onChange({ ...row, operator });
|
|
3132
3190
|
}
|
|
3133
3191
|
},
|
|
3134
|
-
children: operators.map((operator) => /* @__PURE__ */
|
|
3192
|
+
children: operators.map((operator) => /* @__PURE__ */ jsx18("option", { value: operator, children: messages.filterOperatorLabel(operator, menu.family) }, operator))
|
|
3135
3193
|
}
|
|
3136
3194
|
),
|
|
3137
|
-
arity > 0 && /* @__PURE__ */
|
|
3195
|
+
arity > 0 && /* @__PURE__ */ jsx18(
|
|
3138
3196
|
OperandField,
|
|
3139
3197
|
{
|
|
3140
3198
|
...operand,
|
|
@@ -3147,7 +3205,7 @@ function ConditionRow({
|
|
|
3147
3205
|
}
|
|
3148
3206
|
}
|
|
3149
3207
|
),
|
|
3150
|
-
arity === 2 && /* @__PURE__ */
|
|
3208
|
+
arity === 2 && /* @__PURE__ */ jsx18(
|
|
3151
3209
|
OperandField,
|
|
3152
3210
|
{
|
|
3153
3211
|
...operand,
|
|
@@ -3245,7 +3303,7 @@ function simpleEditorReducer(state, action) {
|
|
|
3245
3303
|
}
|
|
3246
3304
|
|
|
3247
3305
|
// src/DataGrid/filterMenu/SimpleFilterEditor.tsx
|
|
3248
|
-
import { jsx as
|
|
3306
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3249
3307
|
var COMBINATORS = ["and", "or"];
|
|
3250
3308
|
function holdsUnreadable(row) {
|
|
3251
3309
|
return Array.from(row?.querySelectorAll("input") ?? []).some(
|
|
@@ -3258,14 +3316,14 @@ function CombinatorChoice({
|
|
|
3258
3316
|
messages,
|
|
3259
3317
|
onChange
|
|
3260
3318
|
}) {
|
|
3261
|
-
return /* @__PURE__ */
|
|
3319
|
+
return /* @__PURE__ */ jsx19(
|
|
3262
3320
|
"div",
|
|
3263
3321
|
{
|
|
3264
3322
|
role: "radiogroup",
|
|
3265
3323
|
"aria-label": messages.filterCombinatorLabel,
|
|
3266
3324
|
className: "gridkit-filter-menu-combinator",
|
|
3267
3325
|
children: COMBINATORS.map((choice) => /* @__PURE__ */ jsxs13("label", { className: "gridkit-filter-menu-combinator-option", children: [
|
|
3268
|
-
/* @__PURE__ */
|
|
3326
|
+
/* @__PURE__ */ jsx19(
|
|
3269
3327
|
"input",
|
|
3270
3328
|
{
|
|
3271
3329
|
type: "radio",
|
|
@@ -3344,11 +3402,11 @@ function SimpleFilterEditor({
|
|
|
3344
3402
|
}
|
|
3345
3403
|
}, [invalid]);
|
|
3346
3404
|
return /* @__PURE__ */ jsxs13("div", { className: "gridkit-filter-menu-conditions", children: [
|
|
3347
|
-
opened.custom && /* @__PURE__ */
|
|
3405
|
+
opened.custom && /* @__PURE__ */ jsx19("p", { className: "gridkit-filter-menu-custom", children: messages.customFilter }),
|
|
3348
3406
|
draft.rows.map((row, index) => (
|
|
3349
3407
|
// A row is its place: the first condition, or the second.
|
|
3350
3408
|
/* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3351
|
-
index > 0 && /* @__PURE__ */
|
|
3409
|
+
index > 0 && /* @__PURE__ */ jsx19(
|
|
3352
3410
|
CombinatorChoice,
|
|
3353
3411
|
{
|
|
3354
3412
|
name: combinatorName,
|
|
@@ -3359,7 +3417,7 @@ function SimpleFilterEditor({
|
|
|
3359
3417
|
}
|
|
3360
3418
|
}
|
|
3361
3419
|
),
|
|
3362
|
-
/* @__PURE__ */
|
|
3420
|
+
/* @__PURE__ */ jsx19(
|
|
3363
3421
|
ConditionRow,
|
|
3364
3422
|
{
|
|
3365
3423
|
ref: (element) => {
|
|
@@ -3379,7 +3437,7 @@ function SimpleFilterEditor({
|
|
|
3379
3437
|
)
|
|
3380
3438
|
] }, index)
|
|
3381
3439
|
)),
|
|
3382
|
-
invalid.length > 0 && /* @__PURE__ */
|
|
3440
|
+
invalid.length > 0 && /* @__PURE__ */ jsx19("p", { id: invalidMessageId, className: "gridkit-filter-menu-invalid", children: messages.filterValueInvalid(menu.family) })
|
|
3383
3441
|
] });
|
|
3384
3442
|
}
|
|
3385
3443
|
|
|
@@ -3389,7 +3447,7 @@ import {
|
|
|
3389
3447
|
attachChecklist,
|
|
3390
3448
|
createRowVirtualizer
|
|
3391
3449
|
} from "@gridkitjs/dom";
|
|
3392
|
-
import { Fragment as Fragment6, jsx as
|
|
3450
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3393
3451
|
var ESTIMATED_ITEM_HEIGHT = 28;
|
|
3394
3452
|
var OVERSCAN = 4;
|
|
3395
3453
|
var NO_RANGE = {
|
|
@@ -3455,7 +3513,7 @@ function ValueChecklist({
|
|
|
3455
3513
|
"aria-label": label,
|
|
3456
3514
|
className: "gridkit-filter-menu-checklist",
|
|
3457
3515
|
children: [
|
|
3458
|
-
/* @__PURE__ */
|
|
3516
|
+
/* @__PURE__ */ jsx20("div", { role: "presentation", style: { height: range.offsetBefore } }),
|
|
3459
3517
|
shown.map((item, offset) => {
|
|
3460
3518
|
const index = range.startIndex + offset;
|
|
3461
3519
|
return /* @__PURE__ */ jsxs14(
|
|
@@ -3470,32 +3528,32 @@ function ValueChecklist({
|
|
|
3470
3528
|
"aria-posinset": index + 1,
|
|
3471
3529
|
className: "gridkit-filter-menu-option",
|
|
3472
3530
|
children: [
|
|
3473
|
-
/* @__PURE__ */
|
|
3531
|
+
/* @__PURE__ */ jsx20(
|
|
3474
3532
|
"span",
|
|
3475
3533
|
{
|
|
3476
3534
|
className: "gridkit-filter-menu-option-check",
|
|
3477
3535
|
"aria-hidden": "true",
|
|
3478
|
-
children: /* @__PURE__ */
|
|
3536
|
+
children: /* @__PURE__ */ jsx20(CheckIcon, {})
|
|
3479
3537
|
}
|
|
3480
3538
|
),
|
|
3481
|
-
/* @__PURE__ */
|
|
3539
|
+
/* @__PURE__ */ jsx20("span", { className: "gridkit-filter-menu-option-label", children: item.label }),
|
|
3482
3540
|
showCounts && /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
3483
3541
|
" ",
|
|
3484
|
-
/* @__PURE__ */
|
|
3542
|
+
/* @__PURE__ */ jsx20("span", { className: "gridkit-filter-menu-option-count", children: String(item.count) })
|
|
3485
3543
|
] })
|
|
3486
3544
|
]
|
|
3487
3545
|
},
|
|
3488
3546
|
item.key
|
|
3489
3547
|
);
|
|
3490
3548
|
}),
|
|
3491
|
-
/* @__PURE__ */
|
|
3549
|
+
/* @__PURE__ */ jsx20("div", { role: "presentation", style: { height: range.offsetAfter } })
|
|
3492
3550
|
]
|
|
3493
3551
|
}
|
|
3494
3552
|
);
|
|
3495
3553
|
}
|
|
3496
3554
|
|
|
3497
3555
|
// src/DataGrid/filterMenu/ExcelFilterEditor.tsx
|
|
3498
|
-
import { Fragment as Fragment7, jsx as
|
|
3556
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3499
3557
|
var OPENED_ON_VALUES = {
|
|
3500
3558
|
kind: "values",
|
|
3501
3559
|
focusOnMount: false
|
|
@@ -3572,12 +3630,12 @@ function ExcelFilterEditor({
|
|
|
3572
3630
|
setMode({ kind: "values", focusOnMount: true });
|
|
3573
3631
|
},
|
|
3574
3632
|
children: [
|
|
3575
|
-
/* @__PURE__ */
|
|
3633
|
+
/* @__PURE__ */ jsx21("span", { className: "gridkit-filter-menu-back-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx21(ChevronLeftIcon2, {}) }),
|
|
3576
3634
|
messages.filterBackToValues
|
|
3577
3635
|
]
|
|
3578
3636
|
}
|
|
3579
3637
|
),
|
|
3580
|
-
/* @__PURE__ */
|
|
3638
|
+
/* @__PURE__ */ jsx21(
|
|
3581
3639
|
SimpleFilterEditor,
|
|
3582
3640
|
{
|
|
3583
3641
|
ref: conditions,
|
|
@@ -3596,7 +3654,7 @@ function ExcelFilterEditor({
|
|
|
3596
3654
|
}
|
|
3597
3655
|
const { shape } = opened;
|
|
3598
3656
|
return /* @__PURE__ */ jsxs15("div", { className: "gridkit-filter-menu-values", children: [
|
|
3599
|
-
menu.operators.length > 0 && /* @__PURE__ */
|
|
3657
|
+
menu.operators.length > 0 && /* @__PURE__ */ jsx21(
|
|
3600
3658
|
OperatorMenuButton,
|
|
3601
3659
|
{
|
|
3602
3660
|
ref: operatorButton,
|
|
@@ -3608,8 +3666,8 @@ function ExcelFilterEditor({
|
|
|
3608
3666
|
}
|
|
3609
3667
|
}
|
|
3610
3668
|
),
|
|
3611
|
-
(shape.kind === "conditions" || shape.kind === "custom") && /* @__PURE__ */
|
|
3612
|
-
/* @__PURE__ */
|
|
3669
|
+
(shape.kind === "conditions" || shape.kind === "custom") && /* @__PURE__ */ jsx21("p", { className: "gridkit-filter-menu-custom", children: shape.kind === "conditions" ? messages.filterByCondition : messages.customFilter }),
|
|
3670
|
+
/* @__PURE__ */ jsx21(
|
|
3613
3671
|
"input",
|
|
3614
3672
|
{
|
|
3615
3673
|
ref: initialFocusRef,
|
|
@@ -3624,7 +3682,7 @@ function ExcelFilterEditor({
|
|
|
3624
3682
|
}
|
|
3625
3683
|
),
|
|
3626
3684
|
/* @__PURE__ */ jsxs15("label", { className: "gridkit-filter-menu-select-all", children: [
|
|
3627
|
-
/* @__PURE__ */
|
|
3685
|
+
/* @__PURE__ */ jsx21(
|
|
3628
3686
|
"input",
|
|
3629
3687
|
{
|
|
3630
3688
|
ref: selectAllRef,
|
|
@@ -3638,7 +3696,7 @@ function ExcelFilterEditor({
|
|
|
3638
3696
|
),
|
|
3639
3697
|
messages.filterSelectAll
|
|
3640
3698
|
] }),
|
|
3641
|
-
checklist.needsSearch ? /* @__PURE__ */
|
|
3699
|
+
checklist.needsSearch ? /* @__PURE__ */ jsx21("p", { className: "gridkit-filter-menu-search-first", children: messages.filterSearchFirst(checklist.total) }) : /* @__PURE__ */ jsx21(
|
|
3642
3700
|
ValueChecklist,
|
|
3643
3701
|
{
|
|
3644
3702
|
items: checklist.items,
|
|
@@ -3649,12 +3707,12 @@ function ExcelFilterEditor({
|
|
|
3649
3707
|
}
|
|
3650
3708
|
}
|
|
3651
3709
|
),
|
|
3652
|
-
checklist.hiddenCount > 0 && /* @__PURE__ */
|
|
3710
|
+
checklist.hiddenCount > 0 && /* @__PURE__ */ jsx21("p", { role: "status", className: "gridkit-filter-menu-more", children: messages.filterMoreValues(checklist.hiddenCount) })
|
|
3653
3711
|
] });
|
|
3654
3712
|
}
|
|
3655
3713
|
|
|
3656
3714
|
// src/DataGrid/filterMenu/FilterMenu.tsx
|
|
3657
|
-
import { jsx as
|
|
3715
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3658
3716
|
var SORT_COMMANDS = [
|
|
3659
3717
|
"sort.ascending",
|
|
3660
3718
|
"sort.descending",
|
|
@@ -3711,7 +3769,7 @@ function FilterMenu({
|
|
|
3711
3769
|
close();
|
|
3712
3770
|
}
|
|
3713
3771
|
}
|
|
3714
|
-
return /* @__PURE__ */
|
|
3772
|
+
return /* @__PURE__ */ jsx22(
|
|
3715
3773
|
"div",
|
|
3716
3774
|
{
|
|
3717
3775
|
role: "dialog",
|
|
@@ -3732,7 +3790,7 @@ function FilterMenu({
|
|
|
3732
3790
|
}
|
|
3733
3791
|
},
|
|
3734
3792
|
children: [
|
|
3735
|
-
sortItems.length > 0 && /* @__PURE__ */
|
|
3793
|
+
sortItems.length > 0 && /* @__PURE__ */ jsx22("div", { className: "gridkit-filter-menu-sort", children: sortItems.map((item) => /* @__PURE__ */ jsxs16(
|
|
3736
3794
|
"button",
|
|
3737
3795
|
{
|
|
3738
3796
|
type: "button",
|
|
@@ -3747,12 +3805,12 @@ function FilterMenu({
|
|
|
3747
3805
|
run(item);
|
|
3748
3806
|
},
|
|
3749
3807
|
children: [
|
|
3750
|
-
/* @__PURE__ */
|
|
3808
|
+
/* @__PURE__ */ jsx22(
|
|
3751
3809
|
"span",
|
|
3752
3810
|
{
|
|
3753
3811
|
className: "gridkit-filter-menu-sort-icon",
|
|
3754
3812
|
"aria-hidden": "true",
|
|
3755
|
-
children: /* @__PURE__ */
|
|
3813
|
+
children: /* @__PURE__ */ jsx22(MenuIcon, { name: item.icon })
|
|
3756
3814
|
}
|
|
3757
3815
|
),
|
|
3758
3816
|
item.label
|
|
@@ -3760,9 +3818,9 @@ function FilterMenu({
|
|
|
3760
3818
|
},
|
|
3761
3819
|
item.id
|
|
3762
3820
|
)) }),
|
|
3763
|
-
menu.ui === "excel" ? /* @__PURE__ */
|
|
3821
|
+
menu.ui === "excel" ? /* @__PURE__ */ jsx22(ExcelFilterEditor, { ...editorProps, columnValues }) : /* @__PURE__ */ jsx22(SimpleFilterEditor, { ...editorProps }),
|
|
3764
3822
|
/* @__PURE__ */ jsxs16("div", { className: "gridkit-filter-menu-actions", children: [
|
|
3765
|
-
clearItem !== void 0 && /* @__PURE__ */
|
|
3823
|
+
clearItem !== void 0 && /* @__PURE__ */ jsx22(
|
|
3766
3824
|
"button",
|
|
3767
3825
|
{
|
|
3768
3826
|
type: "button",
|
|
@@ -3774,7 +3832,7 @@ function FilterMenu({
|
|
|
3774
3832
|
children: clearItem.label
|
|
3775
3833
|
}
|
|
3776
3834
|
),
|
|
3777
|
-
/* @__PURE__ */
|
|
3835
|
+
/* @__PURE__ */ jsx22(
|
|
3778
3836
|
"button",
|
|
3779
3837
|
{
|
|
3780
3838
|
type: "button",
|
|
@@ -3783,7 +3841,7 @@ function FilterMenu({
|
|
|
3783
3841
|
children: messages.cancelFilter
|
|
3784
3842
|
}
|
|
3785
3843
|
),
|
|
3786
|
-
/* @__PURE__ */
|
|
3844
|
+
/* @__PURE__ */ jsx22("button", { type: "submit", className: "gridkit-filter-menu-apply", children: messages.applyFilter })
|
|
3787
3845
|
] })
|
|
3788
3846
|
]
|
|
3789
3847
|
}
|
|
@@ -3840,7 +3898,7 @@ function useFilterValueCache(controller, messages) {
|
|
|
3840
3898
|
}
|
|
3841
3899
|
|
|
3842
3900
|
// src/DataGrid/panels/GridPanels.tsx
|
|
3843
|
-
import { jsx as
|
|
3901
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3844
3902
|
var panelKinds = {
|
|
3845
3903
|
columnChooser: { component: ColumnChooser, trapFocus: false },
|
|
3846
3904
|
filter: { component: FilterMenu, trapFocus: true }
|
|
@@ -3863,7 +3921,7 @@ function GridPanels({
|
|
|
3863
3921
|
return null;
|
|
3864
3922
|
}
|
|
3865
3923
|
const { component: Panel, trapFocus } = panelKinds[panel.kind];
|
|
3866
|
-
return /* @__PURE__ */
|
|
3924
|
+
return /* @__PURE__ */ jsx23(
|
|
3867
3925
|
Overlay,
|
|
3868
3926
|
{
|
|
3869
3927
|
anchor: panel.anchor,
|
|
@@ -3876,7 +3934,7 @@ function GridPanels({
|
|
|
3876
3934
|
trapFocus,
|
|
3877
3935
|
scope: panel.scope,
|
|
3878
3936
|
onDismiss: close,
|
|
3879
|
-
children: /* @__PURE__ */
|
|
3937
|
+
children: /* @__PURE__ */ jsx23(
|
|
3880
3938
|
Panel,
|
|
3881
3939
|
{
|
|
3882
3940
|
target: panel.target,
|
|
@@ -4004,7 +4062,7 @@ import { splitToolbarItems } from "@gridkitjs/core/renderer";
|
|
|
4004
4062
|
import { attachToolbar } from "@gridkitjs/dom";
|
|
4005
4063
|
|
|
4006
4064
|
// src/DataGrid/toolbar/ToolbarMenuButton.tsx
|
|
4007
|
-
import { Fragment as Fragment8, jsx as
|
|
4065
|
+
import { Fragment as Fragment8, jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4008
4066
|
function ToolbarMenuButton({
|
|
4009
4067
|
itemKey,
|
|
4010
4068
|
attributes,
|
|
@@ -4031,13 +4089,13 @@ function ToolbarMenuButton({
|
|
|
4031
4089
|
...ariaAttr(more, "data-gridkit-toolbar-more", ""),
|
|
4032
4090
|
...buttonProps,
|
|
4033
4091
|
children: [
|
|
4034
|
-
icon !== void 0 && /* @__PURE__ */
|
|
4092
|
+
icon !== void 0 && /* @__PURE__ */ jsx24("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx24(MenuIcon, { name: icon }) }),
|
|
4035
4093
|
label,
|
|
4036
|
-
/* @__PURE__ */
|
|
4094
|
+
/* @__PURE__ */ jsx24("span", { className: "gridkit-toolbar-button-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx24(ChevronDownIcon, {}) })
|
|
4037
4095
|
]
|
|
4038
4096
|
}
|
|
4039
4097
|
),
|
|
4040
|
-
state.kind === "open" && /* @__PURE__ */
|
|
4098
|
+
state.kind === "open" && /* @__PURE__ */ jsx24(
|
|
4041
4099
|
Overlay,
|
|
4042
4100
|
{
|
|
4043
4101
|
anchor: state.anchor,
|
|
@@ -4047,7 +4105,7 @@ function ToolbarMenuButton({
|
|
|
4047
4105
|
returnFocusFallback,
|
|
4048
4106
|
scope: state.scope,
|
|
4049
4107
|
onDismiss: close,
|
|
4050
|
-
children: /* @__PURE__ */
|
|
4108
|
+
children: /* @__PURE__ */ jsx24(
|
|
4051
4109
|
GridMenu,
|
|
4052
4110
|
{
|
|
4053
4111
|
entries,
|
|
@@ -4069,7 +4127,7 @@ function ToolbarMenuButton({
|
|
|
4069
4127
|
// src/DataGrid/toolbar/ToolbarSearch.tsx
|
|
4070
4128
|
import { useEffect as useEffect6, useRef as useRef17, useState as useState12 } from "react";
|
|
4071
4129
|
import { searchTextOf, setSearchText } from "@gridkitjs/core/renderer";
|
|
4072
|
-
import { jsx as
|
|
4130
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4073
4131
|
var SEARCH_DELAY_MS = 250;
|
|
4074
4132
|
function ToolbarSearch({
|
|
4075
4133
|
itemKey,
|
|
@@ -4105,7 +4163,7 @@ function ToolbarSearch({
|
|
|
4105
4163
|
},
|
|
4106
4164
|
[]
|
|
4107
4165
|
);
|
|
4108
|
-
return /* @__PURE__ */
|
|
4166
|
+
return /* @__PURE__ */ jsx25(
|
|
4109
4167
|
"input",
|
|
4110
4168
|
{
|
|
4111
4169
|
...attributes,
|
|
@@ -4174,7 +4232,7 @@ function useToolbarOverflow(toolbarRef, items) {
|
|
|
4174
4232
|
}
|
|
4175
4233
|
|
|
4176
4234
|
// src/DataGrid/toolbar/GridToolbar.tsx
|
|
4177
|
-
import { jsx as
|
|
4235
|
+
import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4178
4236
|
function reporting(run, report) {
|
|
4179
4237
|
return () => {
|
|
4180
4238
|
const ran = run();
|
|
@@ -4227,7 +4285,7 @@ function GridToolbar(props) {
|
|
|
4227
4285
|
return null;
|
|
4228
4286
|
}
|
|
4229
4287
|
const options = typeof props.toolbar === "object" ? props.toolbar : void 0;
|
|
4230
|
-
return /* @__PURE__ */
|
|
4288
|
+
return /* @__PURE__ */ jsx26(
|
|
4231
4289
|
Toolbar,
|
|
4232
4290
|
{
|
|
4233
4291
|
...props,
|
|
@@ -4293,14 +4351,14 @@ function Toolbar({
|
|
|
4293
4351
|
item.run();
|
|
4294
4352
|
},
|
|
4295
4353
|
children: [
|
|
4296
|
-
item.icon !== void 0 && /* @__PURE__ */
|
|
4354
|
+
item.icon !== void 0 && /* @__PURE__ */ jsx26("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx26(MenuIcon, { name: item.icon }) }),
|
|
4297
4355
|
item.label
|
|
4298
4356
|
]
|
|
4299
4357
|
},
|
|
4300
4358
|
item.key
|
|
4301
4359
|
);
|
|
4302
4360
|
case "menu":
|
|
4303
|
-
return /* @__PURE__ */
|
|
4361
|
+
return /* @__PURE__ */ jsx26(
|
|
4304
4362
|
ToolbarMenuButton,
|
|
4305
4363
|
{
|
|
4306
4364
|
itemKey: item.key,
|
|
@@ -4313,7 +4371,7 @@ function Toolbar({
|
|
|
4313
4371
|
item.key
|
|
4314
4372
|
);
|
|
4315
4373
|
case "search":
|
|
4316
|
-
return /* @__PURE__ */
|
|
4374
|
+
return /* @__PURE__ */ jsx26(
|
|
4317
4375
|
ToolbarSearch,
|
|
4318
4376
|
{
|
|
4319
4377
|
itemKey: item.key,
|
|
@@ -4325,7 +4383,7 @@ function Toolbar({
|
|
|
4325
4383
|
item.key
|
|
4326
4384
|
);
|
|
4327
4385
|
case "separator":
|
|
4328
|
-
return /* @__PURE__ */
|
|
4386
|
+
return /* @__PURE__ */ jsx26(
|
|
4329
4387
|
"div",
|
|
4330
4388
|
{
|
|
4331
4389
|
role: "separator",
|
|
@@ -4336,7 +4394,7 @@ function Toolbar({
|
|
|
4336
4394
|
item.key
|
|
4337
4395
|
);
|
|
4338
4396
|
case "spacer":
|
|
4339
|
-
return /* @__PURE__ */
|
|
4397
|
+
return /* @__PURE__ */ jsx26(
|
|
4340
4398
|
"div",
|
|
4341
4399
|
{
|
|
4342
4400
|
className: "gridkit-toolbar-spacer",
|
|
@@ -4345,7 +4403,7 @@ function Toolbar({
|
|
|
4345
4403
|
item.key
|
|
4346
4404
|
);
|
|
4347
4405
|
case "custom":
|
|
4348
|
-
return /* @__PURE__ */
|
|
4406
|
+
return /* @__PURE__ */ jsx26(
|
|
4349
4407
|
"div",
|
|
4350
4408
|
{
|
|
4351
4409
|
...item.attributes,
|
|
@@ -4367,7 +4425,7 @@ function Toolbar({
|
|
|
4367
4425
|
className: "gridkit-toolbar",
|
|
4368
4426
|
children: [
|
|
4369
4427
|
shown.map(draw),
|
|
4370
|
-
overflow.length > 0 && /* @__PURE__ */
|
|
4428
|
+
overflow.length > 0 && /* @__PURE__ */ jsx26(
|
|
4371
4429
|
ToolbarMenuButton,
|
|
4372
4430
|
{
|
|
4373
4431
|
itemKey: "more",
|
|
@@ -4389,13 +4447,15 @@ function useColumnDrag({
|
|
|
4389
4447
|
order,
|
|
4390
4448
|
groupBy,
|
|
4391
4449
|
groupByDraggableIds,
|
|
4450
|
+
pinOf,
|
|
4392
4451
|
onDrop
|
|
4393
4452
|
}) {
|
|
4394
4453
|
const drag = useDragReorder({
|
|
4395
4454
|
resolveTarget: (clientX, clientY, movedId) => resolveColumnDropTarget(clientX, clientY, movedId, {
|
|
4396
4455
|
order,
|
|
4397
4456
|
groupBy,
|
|
4398
|
-
groupByDraggableIds
|
|
4457
|
+
groupByDraggableIds,
|
|
4458
|
+
pinOf
|
|
4399
4459
|
}),
|
|
4400
4460
|
onDrop
|
|
4401
4461
|
});
|
|
@@ -4709,7 +4769,7 @@ function useRowVirtualizer({
|
|
|
4709
4769
|
}
|
|
4710
4770
|
|
|
4711
4771
|
// src/DataGrid/DataGrid.tsx
|
|
4712
|
-
import { jsx as
|
|
4772
|
+
import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4713
4773
|
var NO_AGGREGATES = [];
|
|
4714
4774
|
function paginationReader(controller) {
|
|
4715
4775
|
let last;
|
|
@@ -4747,6 +4807,12 @@ function tablesStyle(height, headerHeight, footerHeight, pinned) {
|
|
|
4747
4807
|
const style = { ...heights, ...widths };
|
|
4748
4808
|
return Object.keys(style).length === 0 ? void 0 : style;
|
|
4749
4809
|
}
|
|
4810
|
+
function emptyContext(view, filter, infiniteScroll) {
|
|
4811
|
+
if (view.pageRows.length > 0 || view.columns.length === 0 || infiniteScroll?.hasMore === true) {
|
|
4812
|
+
return null;
|
|
4813
|
+
}
|
|
4814
|
+
return { filtered: filter.length > 0 };
|
|
4815
|
+
}
|
|
4750
4816
|
function DataGrid(props) {
|
|
4751
4817
|
const {
|
|
4752
4818
|
borders,
|
|
@@ -4835,6 +4901,11 @@ function DataGrid(props) {
|
|
|
4835
4901
|
sentinelRef,
|
|
4836
4902
|
config: infiniteScroll
|
|
4837
4903
|
});
|
|
4904
|
+
const empty = emptyContext(view, state.filter, infiniteScroll);
|
|
4905
|
+
const emptyWidth = useElementWidth(
|
|
4906
|
+
gridRef,
|
|
4907
|
+
empty !== null && resizeMode !== "fit"
|
|
4908
|
+
);
|
|
4838
4909
|
function columnOf(columnId) {
|
|
4839
4910
|
return view.dataColumns.find((candidate) => candidate.id === columnId)?.column;
|
|
4840
4911
|
}
|
|
@@ -4912,20 +4983,36 @@ function DataGrid(props) {
|
|
|
4912
4983
|
),
|
|
4913
4984
|
[view.columns]
|
|
4914
4985
|
);
|
|
4986
|
+
function pinOf(columnId) {
|
|
4987
|
+
const column = definitions.get(columnId);
|
|
4988
|
+
return column === void 0 ? "none" : resolveColumnPin2(column, state.columnPinning);
|
|
4989
|
+
}
|
|
4915
4990
|
function handleDrop(target, movedId) {
|
|
4916
4991
|
if (target.kind === "group-by") {
|
|
4917
4992
|
controller.moveGroupBy(movedId, target.beforeColumnId);
|
|
4918
4993
|
return;
|
|
4919
4994
|
}
|
|
4920
|
-
const next =
|
|
4995
|
+
const next = moveColumnInPinGroup(
|
|
4996
|
+
orderedIds,
|
|
4997
|
+
pinOf,
|
|
4998
|
+
movedId,
|
|
4999
|
+
target.beforeId
|
|
5000
|
+
);
|
|
4921
5001
|
if (next === orderedIds) {
|
|
4922
5002
|
return;
|
|
4923
5003
|
}
|
|
4924
5004
|
controller.moveColumn(movedId, target.beforeId);
|
|
4925
|
-
const
|
|
4926
|
-
const
|
|
5005
|
+
const pin = pinOf(movedId);
|
|
5006
|
+
const group = next.filter(
|
|
5007
|
+
(id) => pinOf(id) === pin && displayedIds.includes(id)
|
|
5008
|
+
);
|
|
5009
|
+
const position = displayedIds.findIndex((id) => pinOf(id) === pin) + group.indexOf(movedId);
|
|
4927
5010
|
announce(
|
|
4928
|
-
messages.columnMoved(
|
|
5011
|
+
messages.columnMoved(
|
|
5012
|
+
columnName(movedId),
|
|
5013
|
+
position + 1,
|
|
5014
|
+
displayedIds.length
|
|
5015
|
+
)
|
|
4929
5016
|
);
|
|
4930
5017
|
nav.focusCell(headerFocus3(position));
|
|
4931
5018
|
}
|
|
@@ -4933,6 +5020,7 @@ function DataGrid(props) {
|
|
|
4933
5020
|
order: displayedIds,
|
|
4934
5021
|
groupBy: state.groupBy,
|
|
4935
5022
|
groupByDraggableIds,
|
|
5023
|
+
pinOf,
|
|
4936
5024
|
onDrop: handleDrop
|
|
4937
5025
|
});
|
|
4938
5026
|
const draggedColumnAlreadyGrouped = drag.draggedColumnId !== null && state.groupBy.some((entry) => entry.columnId === drag.draggedColumnId);
|
|
@@ -5097,7 +5185,7 @@ function DataGrid(props) {
|
|
|
5097
5185
|
ref: viewportRef,
|
|
5098
5186
|
tabIndex: -1,
|
|
5099
5187
|
children: [
|
|
5100
|
-
/* @__PURE__ */
|
|
5188
|
+
/* @__PURE__ */ jsx27(
|
|
5101
5189
|
GridToolbar,
|
|
5102
5190
|
{
|
|
5103
5191
|
toolbar: props.toolbar,
|
|
@@ -5109,7 +5197,7 @@ function DataGrid(props) {
|
|
|
5109
5197
|
announce
|
|
5110
5198
|
}
|
|
5111
5199
|
),
|
|
5112
|
-
showGroupByBar && /* @__PURE__ */
|
|
5200
|
+
showGroupByBar && /* @__PURE__ */ jsx27(
|
|
5113
5201
|
GroupByBar,
|
|
5114
5202
|
{
|
|
5115
5203
|
columns: view.columns,
|
|
@@ -5137,7 +5225,7 @@ function DataGrid(props) {
|
|
|
5137
5225
|
height,
|
|
5138
5226
|
headerHeight,
|
|
5139
5227
|
footerHeight,
|
|
5140
|
-
|
|
5228
|
+
pinnedWidths2(view.columns)
|
|
5141
5229
|
),
|
|
5142
5230
|
...ariaAttr(multiselectable, "aria-multiselectable", true),
|
|
5143
5231
|
...ariaAttr(labelledBy !== void 0, "aria-labelledby", labelledBy),
|
|
@@ -5170,8 +5258,8 @@ function DataGrid(props) {
|
|
|
5170
5258
|
style: { width: totalColumnWidth(view.columns) },
|
|
5171
5259
|
className: classNames(gridTableClassName, "gridkit-data-grid-header"),
|
|
5172
5260
|
children: [
|
|
5173
|
-
/* @__PURE__ */
|
|
5174
|
-
/* @__PURE__ */
|
|
5261
|
+
/* @__PURE__ */ jsx27(GridColgroup, { columns: view.columns }),
|
|
5262
|
+
/* @__PURE__ */ jsx27(
|
|
5175
5263
|
GridHeader,
|
|
5176
5264
|
{
|
|
5177
5265
|
columns: view.columns,
|
|
@@ -5192,7 +5280,7 @@ function DataGrid(props) {
|
|
|
5192
5280
|
]
|
|
5193
5281
|
}
|
|
5194
5282
|
),
|
|
5195
|
-
/* @__PURE__ */
|
|
5283
|
+
/* @__PURE__ */ jsx27(
|
|
5196
5284
|
"div",
|
|
5197
5285
|
{
|
|
5198
5286
|
className: "gridkit-data-grid-body",
|
|
@@ -5207,8 +5295,8 @@ function DataGrid(props) {
|
|
|
5207
5295
|
style: { width: totalColumnWidth(view.columns) },
|
|
5208
5296
|
className: gridTableClassName,
|
|
5209
5297
|
children: [
|
|
5210
|
-
/* @__PURE__ */
|
|
5211
|
-
/* @__PURE__ */
|
|
5298
|
+
/* @__PURE__ */ jsx27(GridColgroup, { columns: view.columns }),
|
|
5299
|
+
/* @__PURE__ */ jsx27(
|
|
5212
5300
|
GridBody,
|
|
5213
5301
|
{
|
|
5214
5302
|
columns: view.columns,
|
|
@@ -5223,6 +5311,9 @@ function DataGrid(props) {
|
|
|
5223
5311
|
virtualRange: virtualized ? virtualizer : null,
|
|
5224
5312
|
infiniteScroll,
|
|
5225
5313
|
sentinelRef,
|
|
5314
|
+
empty,
|
|
5315
|
+
emptyTemplate: props.emptyTemplate,
|
|
5316
|
+
viewportWidth: viewportWidth ?? emptyWidth,
|
|
5226
5317
|
locale,
|
|
5227
5318
|
getRowProps,
|
|
5228
5319
|
onRowClick,
|
|
@@ -5248,8 +5339,8 @@ function DataGrid(props) {
|
|
|
5248
5339
|
"gridkit-data-grid-footer"
|
|
5249
5340
|
),
|
|
5250
5341
|
children: [
|
|
5251
|
-
/* @__PURE__ */
|
|
5252
|
-
/* @__PURE__ */
|
|
5342
|
+
/* @__PURE__ */ jsx27(GridColgroup, { columns: view.columns }),
|
|
5343
|
+
/* @__PURE__ */ jsx27(
|
|
5253
5344
|
GridFooter,
|
|
5254
5345
|
{
|
|
5255
5346
|
columns: view.columns,
|
|
@@ -5266,8 +5357,8 @@ function DataGrid(props) {
|
|
|
5266
5357
|
]
|
|
5267
5358
|
}
|
|
5268
5359
|
),
|
|
5269
|
-
/* @__PURE__ */
|
|
5270
|
-
/* @__PURE__ */
|
|
5360
|
+
/* @__PURE__ */ jsx27(GridContextMenu, { contextMenu }),
|
|
5361
|
+
/* @__PURE__ */ jsx27(
|
|
5271
5362
|
GridPanels,
|
|
5272
5363
|
{
|
|
5273
5364
|
panels,
|
|
@@ -5276,7 +5367,7 @@ function DataGrid(props) {
|
|
|
5276
5367
|
messages
|
|
5277
5368
|
}
|
|
5278
5369
|
),
|
|
5279
|
-
paginated && (pager?.template ? pager.template(pagerContext) : /* @__PURE__ */
|
|
5370
|
+
paginated && (pager?.template ? pager.template(pagerContext) : /* @__PURE__ */ jsx27(GridPager, { pager: pagerContext, config: pager, messages }))
|
|
5280
5371
|
]
|
|
5281
5372
|
}
|
|
5282
5373
|
);
|