react-glide-table 1.7.0 → 2.0.2
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/README.md +87 -6
- package/dist/compound.cjs +474 -98
- package/dist/compound.d.cts +2 -2
- package/dist/compound.d.ts +2 -2
- package/dist/compound.js +459 -83
- package/dist/core.cjs +416 -12
- package/dist/core.d.cts +58 -4
- package/dist/core.d.ts +58 -4
- package/dist/core.js +407 -12
- package/dist/index.cjs +574 -166
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +545 -146
- package/dist/{types-Cs9MiZs1.d.cts → types-bgEceyRV.d.cts} +82 -4
- package/dist/{types-Cs9MiZs1.d.ts → types-bgEceyRV.d.ts} +82 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -106,6 +106,37 @@ function applyCellEdit(data, rows, rowIndex, colIndex, raw) {
|
|
|
106
106
|
return newData;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
// src/components/ui/table/features/cell-render/commitCellValue.ts
|
|
110
|
+
function commitCellValue({
|
|
111
|
+
data,
|
|
112
|
+
rows,
|
|
113
|
+
rowId,
|
|
114
|
+
columnId,
|
|
115
|
+
value,
|
|
116
|
+
onCellChange,
|
|
117
|
+
onDataChange
|
|
118
|
+
}) {
|
|
119
|
+
if (!onCellChange && !onDataChange) return true;
|
|
120
|
+
if (onCellChange) {
|
|
121
|
+
onCellChange(rowId, columnId, value);
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
const row = rows.find((item) => item.id === rowId);
|
|
125
|
+
if (!row) return false;
|
|
126
|
+
const cell = row.getAllCells().find((item) => item.column.id === columnId) ?? row.getVisibleCells().find((item) => item.column.id === columnId);
|
|
127
|
+
if (!cell) return false;
|
|
128
|
+
const accessorKey = getColumnAccessorKey(cell.column.columnDef);
|
|
129
|
+
if (!accessorKey) return false;
|
|
130
|
+
const dataIndex = row.index;
|
|
131
|
+
if (dataIndex < 0 || dataIndex >= data.length) return false;
|
|
132
|
+
const next = data.map((item) => ({ ...item }));
|
|
133
|
+
const target = next[dataIndex];
|
|
134
|
+
if (!target) return false;
|
|
135
|
+
target[accessorKey] = value;
|
|
136
|
+
onDataChange?.(next);
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
|
|
109
140
|
// src/components/ui/table/features/cell-edit/useCellEdit.ts
|
|
110
141
|
function useCellEdit({
|
|
111
142
|
data,
|
|
@@ -141,21 +172,23 @@ function useCellEdit({
|
|
|
141
172
|
cancelEdit();
|
|
142
173
|
return true;
|
|
143
174
|
}
|
|
144
|
-
const value = raw ?? draftValueRef.current;
|
|
145
175
|
if (!isColumnEditable(cell.column.columnDef)) {
|
|
146
176
|
cancelEdit();
|
|
147
177
|
return true;
|
|
148
178
|
}
|
|
179
|
+
const value = raw ?? draftValueRef.current;
|
|
149
180
|
const parsed = parseCellEditValue(value, getColumnEditType(cell.column.columnDef));
|
|
150
181
|
if (!parsed.ok) return false;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
182
|
+
const committed = commitCellValue({
|
|
183
|
+
data,
|
|
184
|
+
rows,
|
|
185
|
+
rowId: row.id,
|
|
186
|
+
columnId: cell.column.id,
|
|
187
|
+
value: parsed.value,
|
|
188
|
+
onCellChange,
|
|
189
|
+
onDataChange
|
|
190
|
+
});
|
|
191
|
+
if (!committed) return false;
|
|
159
192
|
cancelEdit();
|
|
160
193
|
return true;
|
|
161
194
|
},
|
|
@@ -184,6 +217,228 @@ function useCellEdit({
|
|
|
184
217
|
};
|
|
185
218
|
}
|
|
186
219
|
|
|
220
|
+
// src/components/ui/table/features/cell-render/builtins.tsx
|
|
221
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
222
|
+
function asString(value) {
|
|
223
|
+
if (value == null) return "";
|
|
224
|
+
return String(value);
|
|
225
|
+
}
|
|
226
|
+
function asStringList(value) {
|
|
227
|
+
if (Array.isArray(value)) {
|
|
228
|
+
return value.map((item) => asString(item)).filter(Boolean);
|
|
229
|
+
}
|
|
230
|
+
if (value == null || value === "") return [];
|
|
231
|
+
return [asString(value)];
|
|
232
|
+
}
|
|
233
|
+
function asDrilldownItems(value) {
|
|
234
|
+
if (!Array.isArray(value)) return [];
|
|
235
|
+
return value.flatMap((item) => {
|
|
236
|
+
if (item == null) return [];
|
|
237
|
+
if (typeof item === "string") return [{ text: item }];
|
|
238
|
+
if (typeof item === "object") {
|
|
239
|
+
const record = item;
|
|
240
|
+
const text = asString(record.text ?? record.label ?? "");
|
|
241
|
+
if (!text) return [];
|
|
242
|
+
const img = record.img ?? record.image;
|
|
243
|
+
return [{ text, ...typeof img === "string" ? { img } : {} }];
|
|
244
|
+
}
|
|
245
|
+
return [{ text: asString(item) }];
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function escapeHtml(text) {
|
|
249
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
250
|
+
}
|
|
251
|
+
function simpleMarkdownToHtml(source) {
|
|
252
|
+
const escaped = escapeHtml(source);
|
|
253
|
+
return escaped.replace(/`([^`]+)`/g, "<code>$1</code>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(/\*([^*]+)\*/g, "<em>$1</em>").replace(/\n/g, "<br />");
|
|
254
|
+
}
|
|
255
|
+
function TextCell({ value }) {
|
|
256
|
+
return asString(value);
|
|
257
|
+
}
|
|
258
|
+
function NumberCell({ value }) {
|
|
259
|
+
if (value == null || value === "") return null;
|
|
260
|
+
return asString(value);
|
|
261
|
+
}
|
|
262
|
+
function BooleanCell({ value, update, cellProps }) {
|
|
263
|
+
const checked = Boolean(value);
|
|
264
|
+
const readonly = Boolean(cellProps?.readonly);
|
|
265
|
+
return /* @__PURE__ */ jsx(
|
|
266
|
+
"input",
|
|
267
|
+
{
|
|
268
|
+
type: "checkbox",
|
|
269
|
+
className: "data-table-cell-boolean",
|
|
270
|
+
checked,
|
|
271
|
+
disabled: readonly,
|
|
272
|
+
"aria-checked": checked,
|
|
273
|
+
onChange: (event) => {
|
|
274
|
+
if (readonly) return;
|
|
275
|
+
update(event.target.checked);
|
|
276
|
+
},
|
|
277
|
+
onClick: (event) => {
|
|
278
|
+
event.stopPropagation();
|
|
279
|
+
},
|
|
280
|
+
onMouseDown: (event) => {
|
|
281
|
+
event.stopPropagation();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
function sanitizeUriHref(raw) {
|
|
287
|
+
const href = raw.trim();
|
|
288
|
+
if (!href) return null;
|
|
289
|
+
if (href.startsWith("/") || href.startsWith("#") || href.startsWith("?") || href.startsWith("./") || href.startsWith("../")) {
|
|
290
|
+
return href;
|
|
291
|
+
}
|
|
292
|
+
try {
|
|
293
|
+
const parsed = new URL(href);
|
|
294
|
+
const protocol = parsed.protocol.toLowerCase();
|
|
295
|
+
if (protocol === "http:" || protocol === "https:" || protocol === "mailto:") {
|
|
296
|
+
return href;
|
|
297
|
+
}
|
|
298
|
+
return null;
|
|
299
|
+
} catch {
|
|
300
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(href)) return null;
|
|
301
|
+
return href;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function UriCell({ value }) {
|
|
305
|
+
const raw = asString(value);
|
|
306
|
+
if (!raw) return null;
|
|
307
|
+
const href = sanitizeUriHref(raw);
|
|
308
|
+
if (!href) {
|
|
309
|
+
return /* @__PURE__ */ jsx("span", { className: "data-table-cell-uri", children: raw });
|
|
310
|
+
}
|
|
311
|
+
return /* @__PURE__ */ jsx(
|
|
312
|
+
"a",
|
|
313
|
+
{
|
|
314
|
+
className: "data-table-cell-uri",
|
|
315
|
+
href,
|
|
316
|
+
target: "_blank",
|
|
317
|
+
rel: "noopener noreferrer",
|
|
318
|
+
onClick: (event) => event.stopPropagation(),
|
|
319
|
+
onMouseDown: (event) => event.stopPropagation(),
|
|
320
|
+
children: raw
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
function ImageCell({ value }) {
|
|
325
|
+
const urls = asStringList(value);
|
|
326
|
+
if (urls.length === 0) return null;
|
|
327
|
+
return /* @__PURE__ */ jsx("span", { className: "data-table-cell-image", children: urls.map((url, index) => /* @__PURE__ */ jsx(
|
|
328
|
+
"img",
|
|
329
|
+
{
|
|
330
|
+
src: url,
|
|
331
|
+
alt: "",
|
|
332
|
+
className: "data-table-cell-image-item"
|
|
333
|
+
},
|
|
334
|
+
`${index}:${url}`
|
|
335
|
+
)) });
|
|
336
|
+
}
|
|
337
|
+
function BubbleCell({ value }) {
|
|
338
|
+
const items = asStringList(value);
|
|
339
|
+
if (items.length === 0) return null;
|
|
340
|
+
return /* @__PURE__ */ jsx("span", { className: "data-table-cell-bubble", children: items.map((item, index) => /* @__PURE__ */ jsx("span", { className: "data-table-cell-bubble-item", children: item }, `${index}:${item}`)) });
|
|
341
|
+
}
|
|
342
|
+
function MarkdownCell({ value }) {
|
|
343
|
+
const source = asString(value);
|
|
344
|
+
if (!source) return null;
|
|
345
|
+
return /* @__PURE__ */ jsx(
|
|
346
|
+
"span",
|
|
347
|
+
{
|
|
348
|
+
className: "data-table-cell-markdown",
|
|
349
|
+
dangerouslySetInnerHTML: { __html: simpleMarkdownToHtml(source) }
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
function DrilldownCell({ value }) {
|
|
354
|
+
const items = asDrilldownItems(value);
|
|
355
|
+
if (items.length === 0) return null;
|
|
356
|
+
return /* @__PURE__ */ jsx("span", { className: "data-table-cell-drilldown", children: items.map((item, index) => /* @__PURE__ */ jsxs(
|
|
357
|
+
"span",
|
|
358
|
+
{
|
|
359
|
+
className: "data-table-cell-drilldown-item",
|
|
360
|
+
children: [
|
|
361
|
+
item.img ? /* @__PURE__ */ jsx(
|
|
362
|
+
"img",
|
|
363
|
+
{
|
|
364
|
+
src: item.img,
|
|
365
|
+
alt: "",
|
|
366
|
+
className: "data-table-cell-drilldown-image"
|
|
367
|
+
}
|
|
368
|
+
) : null,
|
|
369
|
+
/* @__PURE__ */ jsx("span", { className: "data-table-cell-drilldown-text", children: item.text })
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
`${index}:${item.text}:${item.img ?? ""}`
|
|
373
|
+
)) });
|
|
374
|
+
}
|
|
375
|
+
function LoadingCell() {
|
|
376
|
+
return /* @__PURE__ */ jsx("span", { className: "data-table-cell-loading", "aria-busy": "true" });
|
|
377
|
+
}
|
|
378
|
+
function ProtectedCell() {
|
|
379
|
+
return /* @__PURE__ */ jsx("span", { className: "data-table-cell-protected", "aria-label": "protected", children: "****" });
|
|
380
|
+
}
|
|
381
|
+
function RowIdCell({ value }) {
|
|
382
|
+
return /* @__PURE__ */ jsx("span", { className: "data-table-cell-row-id", children: asString(value) });
|
|
383
|
+
}
|
|
384
|
+
var BUILTIN_RENDER_MAP = {
|
|
385
|
+
text: TextCell,
|
|
386
|
+
number: NumberCell,
|
|
387
|
+
boolean: BooleanCell,
|
|
388
|
+
uri: UriCell,
|
|
389
|
+
image: ImageCell,
|
|
390
|
+
bubble: BubbleCell,
|
|
391
|
+
markdown: MarkdownCell,
|
|
392
|
+
drilldown: DrilldownCell,
|
|
393
|
+
loading: LoadingCell,
|
|
394
|
+
protected: ProtectedCell,
|
|
395
|
+
"row-id": RowIdCell
|
|
396
|
+
};
|
|
397
|
+
var BUILTIN_CELL_RENDERERS = Object.keys(BUILTIN_RENDER_MAP).map((kind) => ({
|
|
398
|
+
kind,
|
|
399
|
+
render: BUILTIN_RENDER_MAP[kind]
|
|
400
|
+
}));
|
|
401
|
+
|
|
402
|
+
// src/components/ui/table/features/cell-render/registry.ts
|
|
403
|
+
function createCellRendererRegistry(customRenderers = []) {
|
|
404
|
+
const registry = /* @__PURE__ */ new Map();
|
|
405
|
+
for (const renderer of BUILTIN_CELL_RENDERERS) {
|
|
406
|
+
registry.set(renderer.kind, renderer);
|
|
407
|
+
}
|
|
408
|
+
for (const renderer of customRenderers) {
|
|
409
|
+
registry.set(renderer.kind, renderer);
|
|
410
|
+
}
|
|
411
|
+
return registry;
|
|
412
|
+
}
|
|
413
|
+
function resolveCellRenderer(registry, kind, ctx) {
|
|
414
|
+
if (!kind) return void 0;
|
|
415
|
+
const renderer = registry.get(kind);
|
|
416
|
+
if (!renderer) return void 0;
|
|
417
|
+
if (renderer.isMatch && !renderer.isMatch(ctx)) {
|
|
418
|
+
return void 0;
|
|
419
|
+
}
|
|
420
|
+
return renderer;
|
|
421
|
+
}
|
|
422
|
+
function formatDefaultCellValue(value) {
|
|
423
|
+
if (value == null) return null;
|
|
424
|
+
if (typeof value === "string") return value;
|
|
425
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
426
|
+
return String(value);
|
|
427
|
+
}
|
|
428
|
+
if (typeof value === "bigint") return value.toString();
|
|
429
|
+
return String(value);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// src/components/ui/table/features/cell-render/withCellUpdate.ts
|
|
433
|
+
function withCellUpdate(context, commitValue) {
|
|
434
|
+
return {
|
|
435
|
+
...context,
|
|
436
|
+
update: (next) => {
|
|
437
|
+
commitValue(context.row.id, context.column.id, next);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
|
|
187
442
|
// src/components/ui/table/features/cell-selection/useCellSelection.ts
|
|
188
443
|
import { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
189
444
|
|
|
@@ -493,9 +748,34 @@ function hasCellSelectionEdges(style) {
|
|
|
493
748
|
}
|
|
494
749
|
|
|
495
750
|
// src/components/ui/table/features/cell-selection/copyData.ts
|
|
751
|
+
function formatPrimitive(value) {
|
|
752
|
+
if (value === null || value === void 0) return "";
|
|
753
|
+
if (typeof value === "string") return value;
|
|
754
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
755
|
+
return String(value);
|
|
756
|
+
}
|
|
757
|
+
return "";
|
|
758
|
+
}
|
|
759
|
+
function formatObjectValue(value) {
|
|
760
|
+
const text = value.text ?? value.label ?? value.name ?? value.title;
|
|
761
|
+
if (text != null && text !== "") {
|
|
762
|
+
return formatCellValue(text);
|
|
763
|
+
}
|
|
764
|
+
try {
|
|
765
|
+
return JSON.stringify(value);
|
|
766
|
+
} catch {
|
|
767
|
+
return "";
|
|
768
|
+
}
|
|
769
|
+
}
|
|
496
770
|
function formatCellValue(value) {
|
|
497
771
|
if (value === null || value === void 0) return "";
|
|
498
|
-
|
|
772
|
+
if (Array.isArray(value)) {
|
|
773
|
+
return value.map((item) => formatCellValue(item)).filter((item) => item.length > 0).join(", ");
|
|
774
|
+
}
|
|
775
|
+
if (typeof value === "object") {
|
|
776
|
+
return formatObjectValue(value);
|
|
777
|
+
}
|
|
778
|
+
return formatPrimitive(value);
|
|
499
779
|
}
|
|
500
780
|
function getNestedValue(row, path) {
|
|
501
781
|
if (!path.includes(".")) return row[path];
|
|
@@ -1119,10 +1399,40 @@ function getColumnFreezeStyle(offset, options) {
|
|
|
1119
1399
|
return {
|
|
1120
1400
|
position: "sticky",
|
|
1121
1401
|
...offset.side === "left" ? { left: offset.offset } : { right: offset.offset },
|
|
1122
|
-
zIndex: zBase + offset.stack
|
|
1123
|
-
...options?.isHeader ? { top: options.headerTop ?? 0 } : {}
|
|
1402
|
+
zIndex: zBase + offset.stack
|
|
1124
1403
|
};
|
|
1125
1404
|
}
|
|
1405
|
+
function resolveHeaderFreezeOffset(column, freezeOffsets) {
|
|
1406
|
+
const direct = freezeOffsets.get(column.id);
|
|
1407
|
+
if (direct) return direct;
|
|
1408
|
+
const leaves = typeof column.getLeafColumns === "function" ? column.getLeafColumns() : column.columns && column.columns.length > 0 ? flattenHeaderLeaves(column) : [];
|
|
1409
|
+
if (leaves.length === 0) return void 0;
|
|
1410
|
+
const leafOffsets = [];
|
|
1411
|
+
for (const leaf of leaves) {
|
|
1412
|
+
const offset2 = freezeOffsets.get(leaf.id);
|
|
1413
|
+
if (!offset2) return void 0;
|
|
1414
|
+
leafOffsets.push(offset2);
|
|
1415
|
+
}
|
|
1416
|
+
const side = leafOffsets[0]?.side;
|
|
1417
|
+
if (!side || leafOffsets.some((offset2) => offset2.side !== side)) {
|
|
1418
|
+
return void 0;
|
|
1419
|
+
}
|
|
1420
|
+
const offset = Math.min(...leafOffsets.map((item) => item.offset));
|
|
1421
|
+
const leftmost = leafOffsets[0];
|
|
1422
|
+
const rightmost = leafOffsets[leafOffsets.length - 1];
|
|
1423
|
+
return {
|
|
1424
|
+
side,
|
|
1425
|
+
offset,
|
|
1426
|
+
edgeLeft: leftmost.edgeLeft,
|
|
1427
|
+
edgeRight: rightmost.edgeRight,
|
|
1428
|
+
isEdge: leftmost.edgeLeft || rightmost.edgeRight,
|
|
1429
|
+
stack: Math.max(...leafOffsets.map((item) => item.stack))
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
function flattenHeaderLeaves(column) {
|
|
1433
|
+
if (!column.columns || column.columns.length === 0) return [column];
|
|
1434
|
+
return column.columns.flatMap((child) => flattenHeaderLeaves(child));
|
|
1435
|
+
}
|
|
1126
1436
|
|
|
1127
1437
|
// src/components/ui/table/features/inline-search/inlineSearch.ts
|
|
1128
1438
|
var INLINE_SEARCH_MAX_RESULTS = 1e3;
|
|
@@ -1873,6 +2183,7 @@ function useGlideTable(options) {
|
|
|
1873
2183
|
onDataChange,
|
|
1874
2184
|
onCellChange,
|
|
1875
2185
|
onBatchChange,
|
|
2186
|
+
cellRenderers,
|
|
1876
2187
|
preserveRowSelection = false,
|
|
1877
2188
|
toggleField,
|
|
1878
2189
|
childField,
|
|
@@ -2098,6 +2409,26 @@ function useGlideTable(options) {
|
|
|
2098
2409
|
commitEdit,
|
|
2099
2410
|
cancelEdit
|
|
2100
2411
|
} = useCellEdit({ data: tableData, rows, onDataChange, onCellChange });
|
|
2412
|
+
const cellRendererRegistry = useMemo3(
|
|
2413
|
+
() => createCellRendererRegistry(cellRenderers),
|
|
2414
|
+
[cellRenderers]
|
|
2415
|
+
);
|
|
2416
|
+
const commitRenderedCellValue = useCallback4(
|
|
2417
|
+
(rowId, columnId, value) => commitCellValue({
|
|
2418
|
+
data: tableData,
|
|
2419
|
+
rows,
|
|
2420
|
+
rowId,
|
|
2421
|
+
columnId,
|
|
2422
|
+
value,
|
|
2423
|
+
onCellChange,
|
|
2424
|
+
onDataChange
|
|
2425
|
+
}),
|
|
2426
|
+
[onCellChange, onDataChange, rows, tableData]
|
|
2427
|
+
);
|
|
2428
|
+
const getCellContext = useCallback4(
|
|
2429
|
+
(cell) => withCellUpdate(cell.getContext(), commitRenderedCellValue),
|
|
2430
|
+
[commitRenderedCellValue]
|
|
2431
|
+
);
|
|
2101
2432
|
const handleCellMouseDownWithCommit = useCallback4(
|
|
2102
2433
|
(rowIndex, colIndex, options2) => {
|
|
2103
2434
|
const isSameEditingCell = editingCell?.rowIndex === rowIndex && editingCell?.colIndex === colIndex;
|
|
@@ -2334,6 +2665,10 @@ function useGlideTable(options) {
|
|
|
2334
2665
|
onCommitEdit: commitEdit,
|
|
2335
2666
|
onCancelEdit: cancelEdit
|
|
2336
2667
|
},
|
|
2668
|
+
cellRender: {
|
|
2669
|
+
registry: cellRendererRegistry,
|
|
2670
|
+
commitValue: commitRenderedCellValue
|
|
2671
|
+
},
|
|
2337
2672
|
expand: {
|
|
2338
2673
|
enableExpand,
|
|
2339
2674
|
toggleField,
|
|
@@ -2380,6 +2715,8 @@ function useGlideTable(options) {
|
|
|
2380
2715
|
startEdit,
|
|
2381
2716
|
commitEdit,
|
|
2382
2717
|
cancelEdit,
|
|
2718
|
+
cellRendererRegistry,
|
|
2719
|
+
commitRenderedCellValue,
|
|
2383
2720
|
enableExpand,
|
|
2384
2721
|
toggleField,
|
|
2385
2722
|
expandedRows,
|
|
@@ -2424,6 +2761,7 @@ function useGlideTable(options) {
|
|
|
2424
2761
|
paddingTop,
|
|
2425
2762
|
paddingBottom,
|
|
2426
2763
|
rowContextValue,
|
|
2764
|
+
getCellContext,
|
|
2427
2765
|
handleToggleSelect,
|
|
2428
2766
|
clearHover,
|
|
2429
2767
|
copySelection: stableCopySelection,
|
|
@@ -2444,6 +2782,60 @@ function useGlideTable(options) {
|
|
|
2444
2782
|
};
|
|
2445
2783
|
}
|
|
2446
2784
|
|
|
2785
|
+
// src/components/ui/table/features/cell-render/ResolvedTableCell.tsx
|
|
2786
|
+
import { useCallback as useCallback5 } from "react";
|
|
2787
|
+
|
|
2788
|
+
// src/components/ui/table/DataTableContext.tsx
|
|
2789
|
+
import { createContext, use } from "react";
|
|
2790
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2791
|
+
var DataTableContext = createContext(null);
|
|
2792
|
+
function useDataTableRowContext() {
|
|
2793
|
+
const context = use(DataTableContext);
|
|
2794
|
+
if (!context) {
|
|
2795
|
+
throw new Error("useDataTableRowContext must be used within a DataTableContextProvider");
|
|
2796
|
+
}
|
|
2797
|
+
return context;
|
|
2798
|
+
}
|
|
2799
|
+
function DataTableContextProvider({
|
|
2800
|
+
value,
|
|
2801
|
+
children
|
|
2802
|
+
}) {
|
|
2803
|
+
return /* @__PURE__ */ jsx2(DataTableContext, { value, children });
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
// src/components/ui/table/features/cell-render/ResolvedTableCell.tsx
|
|
2807
|
+
function ResolvedTableCell({
|
|
2808
|
+
info
|
|
2809
|
+
}) {
|
|
2810
|
+
const { cellRender } = useDataTableRowContext();
|
|
2811
|
+
const { row, column, getValue } = info;
|
|
2812
|
+
const meta = column.columnDef.meta;
|
|
2813
|
+
const value = getValue();
|
|
2814
|
+
const columnId = column.id;
|
|
2815
|
+
const update = useCallback5(
|
|
2816
|
+
(next) => {
|
|
2817
|
+
cellRender.commitValue(row.id, columnId, next);
|
|
2818
|
+
},
|
|
2819
|
+
[cellRender, columnId, row.id]
|
|
2820
|
+
);
|
|
2821
|
+
const ctx = {
|
|
2822
|
+
value,
|
|
2823
|
+
row,
|
|
2824
|
+
index: row.index,
|
|
2825
|
+
columnId,
|
|
2826
|
+
cellProps: meta?.cellProps,
|
|
2827
|
+
update
|
|
2828
|
+
};
|
|
2829
|
+
if (meta?.cellRender) {
|
|
2830
|
+
return meta.cellRender(ctx);
|
|
2831
|
+
}
|
|
2832
|
+
const renderer = resolveCellRenderer(cellRender.registry, meta?.kind, ctx);
|
|
2833
|
+
if (renderer) {
|
|
2834
|
+
return renderer.render(ctx);
|
|
2835
|
+
}
|
|
2836
|
+
return formatDefaultCellValue(value);
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2447
2839
|
// src/components/ui/table/features/column-resize/columnResize.ts
|
|
2448
2840
|
function getColumnSizeStyle(size, options) {
|
|
2449
2841
|
const { force = false, lockMax = false } = options ?? {};
|
|
@@ -2465,28 +2857,10 @@ import { useMemo as useMemo4 } from "react";
|
|
|
2465
2857
|
import { flexRender } from "@tanstack/react-table";
|
|
2466
2858
|
import { useEffect as useEffect6, useRef as useRef6 } from "react";
|
|
2467
2859
|
|
|
2468
|
-
// src/components/ui/table/DataTableContext.tsx
|
|
2469
|
-
import { createContext, use } from "react";
|
|
2470
|
-
import { jsx } from "react/jsx-runtime";
|
|
2471
|
-
var DataTableContext = createContext(null);
|
|
2472
|
-
function useDataTableRowContext() {
|
|
2473
|
-
const context = use(DataTableContext);
|
|
2474
|
-
if (!context) {
|
|
2475
|
-
throw new Error("useDataTableRowContext must be used within a DataTableContextProvider");
|
|
2476
|
-
}
|
|
2477
|
-
return context;
|
|
2478
|
-
}
|
|
2479
|
-
function DataTableContextProvider({
|
|
2480
|
-
value,
|
|
2481
|
-
children
|
|
2482
|
-
}) {
|
|
2483
|
-
return /* @__PURE__ */ jsx(DataTableContext, { value, children });
|
|
2484
|
-
}
|
|
2485
|
-
|
|
2486
2860
|
// src/components/ui/table/components/icons.tsx
|
|
2487
|
-
import { jsx as
|
|
2861
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2488
2862
|
function ChevronDown({ className, "aria-hidden": ariaHidden = true }) {
|
|
2489
|
-
return /* @__PURE__ */
|
|
2863
|
+
return /* @__PURE__ */ jsx3(
|
|
2490
2864
|
"svg",
|
|
2491
2865
|
{
|
|
2492
2866
|
className,
|
|
@@ -2499,12 +2873,12 @@ function ChevronDown({ className, "aria-hidden": ariaHidden = true }) {
|
|
|
2499
2873
|
strokeWidth: "2",
|
|
2500
2874
|
strokeLinecap: "round",
|
|
2501
2875
|
strokeLinejoin: "round",
|
|
2502
|
-
children: /* @__PURE__ */
|
|
2876
|
+
children: /* @__PURE__ */ jsx3("path", { d: "m6 9 6 6 6-6" })
|
|
2503
2877
|
}
|
|
2504
2878
|
);
|
|
2505
2879
|
}
|
|
2506
2880
|
function ChevronUp({ className, "aria-hidden": ariaHidden = true }) {
|
|
2507
|
-
return /* @__PURE__ */
|
|
2881
|
+
return /* @__PURE__ */ jsx3(
|
|
2508
2882
|
"svg",
|
|
2509
2883
|
{
|
|
2510
2884
|
className,
|
|
@@ -2517,12 +2891,12 @@ function ChevronUp({ className, "aria-hidden": ariaHidden = true }) {
|
|
|
2517
2891
|
strokeWidth: "2",
|
|
2518
2892
|
strokeLinecap: "round",
|
|
2519
2893
|
strokeLinejoin: "round",
|
|
2520
|
-
children: /* @__PURE__ */
|
|
2894
|
+
children: /* @__PURE__ */ jsx3("path", { d: "m18 15-6-6-6 6" })
|
|
2521
2895
|
}
|
|
2522
2896
|
);
|
|
2523
2897
|
}
|
|
2524
2898
|
function ChevronLeft({ className, "aria-hidden": ariaHidden = true }) {
|
|
2525
|
-
return /* @__PURE__ */
|
|
2899
|
+
return /* @__PURE__ */ jsx3(
|
|
2526
2900
|
"svg",
|
|
2527
2901
|
{
|
|
2528
2902
|
className,
|
|
@@ -2535,12 +2909,12 @@ function ChevronLeft({ className, "aria-hidden": ariaHidden = true }) {
|
|
|
2535
2909
|
strokeWidth: "2",
|
|
2536
2910
|
strokeLinecap: "round",
|
|
2537
2911
|
strokeLinejoin: "round",
|
|
2538
|
-
children: /* @__PURE__ */
|
|
2912
|
+
children: /* @__PURE__ */ jsx3("path", { d: "m15 18-6-6 6-6" })
|
|
2539
2913
|
}
|
|
2540
2914
|
);
|
|
2541
2915
|
}
|
|
2542
2916
|
function ChevronRight({ className, "aria-hidden": ariaHidden = true }) {
|
|
2543
|
-
return /* @__PURE__ */
|
|
2917
|
+
return /* @__PURE__ */ jsx3(
|
|
2544
2918
|
"svg",
|
|
2545
2919
|
{
|
|
2546
2920
|
className,
|
|
@@ -2553,12 +2927,12 @@ function ChevronRight({ className, "aria-hidden": ariaHidden = true }) {
|
|
|
2553
2927
|
strokeWidth: "2",
|
|
2554
2928
|
strokeLinecap: "round",
|
|
2555
2929
|
strokeLinejoin: "round",
|
|
2556
|
-
children: /* @__PURE__ */
|
|
2930
|
+
children: /* @__PURE__ */ jsx3("path", { d: "m9 18 6-6-6-6" })
|
|
2557
2931
|
}
|
|
2558
2932
|
);
|
|
2559
2933
|
}
|
|
2560
2934
|
function ArrowUp({ className, "aria-hidden": ariaHidden = true }) {
|
|
2561
|
-
return /* @__PURE__ */
|
|
2935
|
+
return /* @__PURE__ */ jsxs2(
|
|
2562
2936
|
"svg",
|
|
2563
2937
|
{
|
|
2564
2938
|
className,
|
|
@@ -2572,14 +2946,14 @@ function ArrowUp({ className, "aria-hidden": ariaHidden = true }) {
|
|
|
2572
2946
|
strokeLinecap: "round",
|
|
2573
2947
|
strokeLinejoin: "round",
|
|
2574
2948
|
children: [
|
|
2575
|
-
/* @__PURE__ */
|
|
2576
|
-
/* @__PURE__ */
|
|
2949
|
+
/* @__PURE__ */ jsx3("path", { d: "m18 15-6-6-6 6" }),
|
|
2950
|
+
/* @__PURE__ */ jsx3("path", { d: "M12 21V9" })
|
|
2577
2951
|
]
|
|
2578
2952
|
}
|
|
2579
2953
|
);
|
|
2580
2954
|
}
|
|
2581
2955
|
function ArrowDown({ className, "aria-hidden": ariaHidden = true }) {
|
|
2582
|
-
return /* @__PURE__ */
|
|
2956
|
+
return /* @__PURE__ */ jsxs2(
|
|
2583
2957
|
"svg",
|
|
2584
2958
|
{
|
|
2585
2959
|
className,
|
|
@@ -2593,14 +2967,14 @@ function ArrowDown({ className, "aria-hidden": ariaHidden = true }) {
|
|
|
2593
2967
|
strokeLinecap: "round",
|
|
2594
2968
|
strokeLinejoin: "round",
|
|
2595
2969
|
children: [
|
|
2596
|
-
/* @__PURE__ */
|
|
2597
|
-
/* @__PURE__ */
|
|
2970
|
+
/* @__PURE__ */ jsx3("path", { d: "m6 9 6 6 6-6" }),
|
|
2971
|
+
/* @__PURE__ */ jsx3("path", { d: "M12 3v12" })
|
|
2598
2972
|
]
|
|
2599
2973
|
}
|
|
2600
2974
|
);
|
|
2601
2975
|
}
|
|
2602
2976
|
function ArrowUpDown({ className, "aria-hidden": ariaHidden = true }) {
|
|
2603
|
-
return /* @__PURE__ */
|
|
2977
|
+
return /* @__PURE__ */ jsxs2(
|
|
2604
2978
|
"svg",
|
|
2605
2979
|
{
|
|
2606
2980
|
className,
|
|
@@ -2614,10 +2988,10 @@ function ArrowUpDown({ className, "aria-hidden": ariaHidden = true }) {
|
|
|
2614
2988
|
strokeLinecap: "round",
|
|
2615
2989
|
strokeLinejoin: "round",
|
|
2616
2990
|
children: [
|
|
2617
|
-
/* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
/* @__PURE__ */
|
|
2620
|
-
/* @__PURE__ */
|
|
2991
|
+
/* @__PURE__ */ jsx3("path", { d: "m21 16-4 4-4-4" }),
|
|
2992
|
+
/* @__PURE__ */ jsx3("path", { d: "M17 20V4" }),
|
|
2993
|
+
/* @__PURE__ */ jsx3("path", { d: "m3 8 4-4 4 4" }),
|
|
2994
|
+
/* @__PURE__ */ jsx3("path", { d: "M7 4v16" })
|
|
2621
2995
|
]
|
|
2622
2996
|
}
|
|
2623
2997
|
);
|
|
@@ -2629,7 +3003,7 @@ function cn(...inputs) {
|
|
|
2629
3003
|
}
|
|
2630
3004
|
|
|
2631
3005
|
// src/components/ui/table/components/DataTable/DataTableRow.tsx
|
|
2632
|
-
import { jsx as
|
|
3006
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2633
3007
|
function isInteractiveMouseTarget(target) {
|
|
2634
3008
|
if (!(target instanceof Element)) return false;
|
|
2635
3009
|
const interactiveSelector = [
|
|
@@ -2669,6 +3043,7 @@ function DataTableRow({
|
|
|
2669
3043
|
selection,
|
|
2670
3044
|
cellSelection,
|
|
2671
3045
|
cellEdit,
|
|
3046
|
+
cellRender,
|
|
2672
3047
|
expand,
|
|
2673
3048
|
columnResize,
|
|
2674
3049
|
columnFreeze,
|
|
@@ -2706,6 +3081,10 @@ function DataTableRow({
|
|
|
2706
3081
|
onCommitEdit,
|
|
2707
3082
|
onCancelEdit
|
|
2708
3083
|
} = cellEdit;
|
|
3084
|
+
const renderCell = (tableCell) => flexRender(
|
|
3085
|
+
tableCell.column.columnDef.cell,
|
|
3086
|
+
withCellUpdate(tableCell.getContext(), cellRender.commitValue)
|
|
3087
|
+
);
|
|
2709
3088
|
const {
|
|
2710
3089
|
enableExpand,
|
|
2711
3090
|
toggleField,
|
|
@@ -2781,7 +3160,7 @@ function DataTableRow({
|
|
|
2781
3160
|
editInputRef.current?.focus();
|
|
2782
3161
|
editInputRef.current?.select();
|
|
2783
3162
|
}, [isRowEditing, editingCell?.colIndex]);
|
|
2784
|
-
return /* @__PURE__ */
|
|
3163
|
+
return /* @__PURE__ */ jsx4(
|
|
2785
3164
|
"tr",
|
|
2786
3165
|
{
|
|
2787
3166
|
ref: measureElement,
|
|
@@ -2875,7 +3254,7 @@ function DataTableRow({
|
|
|
2875
3254
|
const searchMatchKey = buildSearchMatchKey(cellIndex, rowIndex);
|
|
2876
3255
|
const isSearchMatch = enableInlineSearch && searchMatchKeys.has(searchMatchKey);
|
|
2877
3256
|
const isSearchActive = isSearchMatch && activeMatch !== null && activeMatch[0] === cellIndex && activeMatch[1] === rowIndex;
|
|
2878
|
-
return /* @__PURE__ */
|
|
3257
|
+
return /* @__PURE__ */ jsxs3(
|
|
2879
3258
|
"td",
|
|
2880
3259
|
{
|
|
2881
3260
|
"data-row-index": rowIndex,
|
|
@@ -2949,7 +3328,7 @@ function DataTableRow({
|
|
|
2949
3328
|
classNames?.cell
|
|
2950
3329
|
),
|
|
2951
3330
|
children: [
|
|
2952
|
-
isEditing ? /* @__PURE__ */
|
|
3331
|
+
isEditing ? /* @__PURE__ */ jsx4(
|
|
2953
3332
|
"input",
|
|
2954
3333
|
{
|
|
2955
3334
|
...editInputProps,
|
|
@@ -2992,8 +3371,8 @@ function DataTableRow({
|
|
|
2992
3371
|
onCommitEdit(event.currentTarget.value);
|
|
2993
3372
|
}
|
|
2994
3373
|
}
|
|
2995
|
-
) : isExpandCell && enableExpand ? /* @__PURE__ */
|
|
2996
|
-
/* @__PURE__ */
|
|
3374
|
+
) : isExpandCell && enableExpand ? /* @__PURE__ */ jsxs3("div", { className: cn("expand-cell", classNames?.expandCell), children: [
|
|
3375
|
+
/* @__PURE__ */ jsxs3(
|
|
2997
3376
|
"div",
|
|
2998
3377
|
{
|
|
2999
3378
|
className: cn(
|
|
@@ -3001,7 +3380,7 @@ function DataTableRow({
|
|
|
3001
3380
|
classNames?.expandCellContent
|
|
3002
3381
|
),
|
|
3003
3382
|
children: [
|
|
3004
|
-
rowLevel > 0 && /* @__PURE__ */
|
|
3383
|
+
rowLevel > 0 && /* @__PURE__ */ jsx4(
|
|
3005
3384
|
"span",
|
|
3006
3385
|
{
|
|
3007
3386
|
className: cn(
|
|
@@ -3011,20 +3390,20 @@ function DataTableRow({
|
|
|
3011
3390
|
children: "\xB7"
|
|
3012
3391
|
}
|
|
3013
3392
|
),
|
|
3014
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ jsx4(
|
|
3015
3394
|
"div",
|
|
3016
3395
|
{
|
|
3017
3396
|
className: cn(
|
|
3018
3397
|
"expand-cell-value",
|
|
3019
3398
|
classNames?.expandCellValue
|
|
3020
3399
|
),
|
|
3021
|
-
children:
|
|
3400
|
+
children: renderCell(cell)
|
|
3022
3401
|
}
|
|
3023
3402
|
)
|
|
3024
3403
|
]
|
|
3025
3404
|
}
|
|
3026
3405
|
),
|
|
3027
|
-
canExpand && expandKey && /* @__PURE__ */
|
|
3406
|
+
canExpand && expandKey && /* @__PURE__ */ jsx4(
|
|
3028
3407
|
"button",
|
|
3029
3408
|
{
|
|
3030
3409
|
type: "button",
|
|
@@ -3038,7 +3417,7 @@ function DataTableRow({
|
|
|
3038
3417
|
onToggleExpand?.(expandKey);
|
|
3039
3418
|
},
|
|
3040
3419
|
onMouseDown: (event) => event.stopPropagation(),
|
|
3041
|
-
children: isExpanded ? /* @__PURE__ */
|
|
3420
|
+
children: isExpanded ? /* @__PURE__ */ jsx4(
|
|
3042
3421
|
ChevronUp,
|
|
3043
3422
|
{
|
|
3044
3423
|
className: cn(
|
|
@@ -3046,7 +3425,7 @@ function DataTableRow({
|
|
|
3046
3425
|
classNames?.expandToggleIcon
|
|
3047
3426
|
)
|
|
3048
3427
|
}
|
|
3049
|
-
) : /* @__PURE__ */
|
|
3428
|
+
) : /* @__PURE__ */ jsx4(
|
|
3050
3429
|
ChevronDown,
|
|
3051
3430
|
{
|
|
3052
3431
|
className: cn(
|
|
@@ -3057,8 +3436,8 @@ function DataTableRow({
|
|
|
3057
3436
|
)
|
|
3058
3437
|
}
|
|
3059
3438
|
)
|
|
3060
|
-
] }) :
|
|
3061
|
-
isBottomRightCell && /* @__PURE__ */
|
|
3439
|
+
] }) : renderCell(cell),
|
|
3440
|
+
isBottomRightCell && /* @__PURE__ */ jsx4(
|
|
3062
3441
|
"div",
|
|
3063
3442
|
{
|
|
3064
3443
|
role: "presentation",
|
|
@@ -3080,9 +3459,9 @@ function DataTableRow({
|
|
|
3080
3459
|
}
|
|
3081
3460
|
|
|
3082
3461
|
// src/components/ui/table/components/DataTable/DataTableSearch.tsx
|
|
3083
|
-
import { jsx as
|
|
3462
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3084
3463
|
function SearchCloseIcon({ className }) {
|
|
3085
|
-
return /* @__PURE__ */
|
|
3464
|
+
return /* @__PURE__ */ jsxs4(
|
|
3086
3465
|
"svg",
|
|
3087
3466
|
{
|
|
3088
3467
|
className,
|
|
@@ -3096,8 +3475,8 @@ function SearchCloseIcon({ className }) {
|
|
|
3096
3475
|
strokeLinecap: "round",
|
|
3097
3476
|
strokeLinejoin: "round",
|
|
3098
3477
|
children: [
|
|
3099
|
-
/* @__PURE__ */
|
|
3100
|
-
/* @__PURE__ */
|
|
3478
|
+
/* @__PURE__ */ jsx5("path", { d: "M18 6 6 18" }),
|
|
3479
|
+
/* @__PURE__ */ jsx5("path", { d: "m6 6 12 12" })
|
|
3101
3480
|
]
|
|
3102
3481
|
}
|
|
3103
3482
|
);
|
|
@@ -3143,15 +3522,15 @@ function DataTableSearch({
|
|
|
3143
3522
|
onPrevious();
|
|
3144
3523
|
}
|
|
3145
3524
|
};
|
|
3146
|
-
return /* @__PURE__ */
|
|
3525
|
+
return /* @__PURE__ */ jsxs4(
|
|
3147
3526
|
"div",
|
|
3148
3527
|
{
|
|
3149
3528
|
className: cn("data-table-search", classNames?.search),
|
|
3150
3529
|
role: "search",
|
|
3151
3530
|
onMouseDown: (event) => event.stopPropagation(),
|
|
3152
3531
|
children: [
|
|
3153
|
-
/* @__PURE__ */
|
|
3154
|
-
/* @__PURE__ */
|
|
3532
|
+
/* @__PURE__ */ jsxs4("div", { className: "data-table-search-row", children: [
|
|
3533
|
+
/* @__PURE__ */ jsx5(
|
|
3155
3534
|
"input",
|
|
3156
3535
|
{
|
|
3157
3536
|
ref: searchInputRef,
|
|
@@ -3167,7 +3546,7 @@ function DataTableSearch({
|
|
|
3167
3546
|
onKeyDown: handleKeyDown
|
|
3168
3547
|
}
|
|
3169
3548
|
),
|
|
3170
|
-
/* @__PURE__ */
|
|
3549
|
+
/* @__PURE__ */ jsx5(
|
|
3171
3550
|
"button",
|
|
3172
3551
|
{
|
|
3173
3552
|
type: "button",
|
|
@@ -3177,10 +3556,10 @@ function DataTableSearch({
|
|
|
3177
3556
|
event.stopPropagation();
|
|
3178
3557
|
onPrevious();
|
|
3179
3558
|
},
|
|
3180
|
-
children: /* @__PURE__ */
|
|
3559
|
+
children: /* @__PURE__ */ jsx5(ChevronUp, { className: "data-table-search-icon" })
|
|
3181
3560
|
}
|
|
3182
3561
|
),
|
|
3183
|
-
/* @__PURE__ */
|
|
3562
|
+
/* @__PURE__ */ jsx5(
|
|
3184
3563
|
"button",
|
|
3185
3564
|
{
|
|
3186
3565
|
type: "button",
|
|
@@ -3190,10 +3569,10 @@ function DataTableSearch({
|
|
|
3190
3569
|
event.stopPropagation();
|
|
3191
3570
|
onNext();
|
|
3192
3571
|
},
|
|
3193
|
-
children: /* @__PURE__ */
|
|
3572
|
+
children: /* @__PURE__ */ jsx5(ChevronDown, { className: "data-table-search-icon" })
|
|
3194
3573
|
}
|
|
3195
3574
|
),
|
|
3196
|
-
canClose ? /* @__PURE__ */
|
|
3575
|
+
canClose ? /* @__PURE__ */ jsx5(
|
|
3197
3576
|
"button",
|
|
3198
3577
|
{
|
|
3199
3578
|
type: "button",
|
|
@@ -3203,11 +3582,11 @@ function DataTableSearch({
|
|
|
3203
3582
|
event.stopPropagation();
|
|
3204
3583
|
onClose();
|
|
3205
3584
|
},
|
|
3206
|
-
children: /* @__PURE__ */
|
|
3585
|
+
children: /* @__PURE__ */ jsx5(SearchCloseIcon, { className: "data-table-search-icon" })
|
|
3207
3586
|
}
|
|
3208
3587
|
) : null
|
|
3209
3588
|
] }),
|
|
3210
|
-
/* @__PURE__ */
|
|
3589
|
+
/* @__PURE__ */ jsx5(
|
|
3211
3590
|
"div",
|
|
3212
3591
|
{
|
|
3213
3592
|
className: cn("data-table-search-status", classNames?.searchStatus),
|
|
@@ -3215,7 +3594,7 @@ function DataTableSearch({
|
|
|
3215
3594
|
children: resultString
|
|
3216
3595
|
}
|
|
3217
3596
|
),
|
|
3218
|
-
searchStatus !== void 0 ? /* @__PURE__ */
|
|
3597
|
+
searchStatus !== void 0 ? /* @__PURE__ */ jsx5(
|
|
3219
3598
|
"div",
|
|
3220
3599
|
{
|
|
3221
3600
|
className: cn(
|
|
@@ -3226,7 +3605,7 @@ function DataTableSearch({
|
|
|
3226
3605
|
"aria-valuemin": 0,
|
|
3227
3606
|
"aria-valuemax": 100,
|
|
3228
3607
|
"aria-valuenow": progress,
|
|
3229
|
-
children: /* @__PURE__ */
|
|
3608
|
+
children: /* @__PURE__ */ jsx5(
|
|
3230
3609
|
"div",
|
|
3231
3610
|
{
|
|
3232
3611
|
className: "data-table-search-progress-bar",
|
|
@@ -3241,7 +3620,7 @@ function DataTableSearch({
|
|
|
3241
3620
|
}
|
|
3242
3621
|
|
|
3243
3622
|
// src/components/ui/table/components/DataTable/DataTableToolbar.tsx
|
|
3244
|
-
import { Fragment, jsx as
|
|
3623
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3245
3624
|
function DataTableToolbar({
|
|
3246
3625
|
filteredCount,
|
|
3247
3626
|
totalCount,
|
|
@@ -3259,20 +3638,20 @@ function DataTableToolbar({
|
|
|
3259
3638
|
const selectionContent = selectionLabel?.(selectedCount) ?? null;
|
|
3260
3639
|
const hasSelectionContent = selectionContent !== null && selectionContent !== false && selectionContent !== void 0 && typeof selectionContent !== "boolean";
|
|
3261
3640
|
if (!hasLeftContent && !hasToolbar && !hasSelectionContent) return null;
|
|
3262
|
-
return /* @__PURE__ */
|
|
3263
|
-
/* @__PURE__ */
|
|
3264
|
-
hasCount && /* @__PURE__ */
|
|
3265
|
-
/* @__PURE__ */
|
|
3266
|
-
/* @__PURE__ */
|
|
3641
|
+
return /* @__PURE__ */ jsxs5("div", { className: cn("DataTableToolbarJSX", classNames?.toolbar, className), children: [
|
|
3642
|
+
/* @__PURE__ */ jsxs5("div", { className: cn("toolbar-left", classNames?.toolbarLeft), children: [
|
|
3643
|
+
hasCount && /* @__PURE__ */ jsx6("span", { className: cn("toolbar-count", classNames?.toolbarCount), children: displayFiltered !== void 0 && totalCount !== void 0 ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
3644
|
+
/* @__PURE__ */ jsx6("span", { className: "toolbar-count-primary", children: displayFiltered }),
|
|
3645
|
+
/* @__PURE__ */ jsxs5("span", { className: "toolbar-count-placeholder", children: [
|
|
3267
3646
|
" / ",
|
|
3268
3647
|
totalCount
|
|
3269
3648
|
] })
|
|
3270
|
-
] }) : /* @__PURE__ */
|
|
3649
|
+
] }) : /* @__PURE__ */ jsx6("span", { className: "toolbar-count-primary", children: displayFiltered ?? totalCount }) }),
|
|
3271
3650
|
summary
|
|
3272
3651
|
] }),
|
|
3273
|
-
/* @__PURE__ */
|
|
3274
|
-
hasSelectionContent && (typeof selectionContent === "string" || typeof selectionContent === "number" ? /* @__PURE__ */
|
|
3275
|
-
hasToolbar && /* @__PURE__ */
|
|
3652
|
+
/* @__PURE__ */ jsxs5("div", { className: cn("toolbar-right", classNames?.toolbarRight), children: [
|
|
3653
|
+
hasSelectionContent && (typeof selectionContent === "string" || typeof selectionContent === "number" ? /* @__PURE__ */ jsx6("span", { className: cn("toolbar-selection", classNames?.toolbarSelection), children: selectionContent }) : selectionContent),
|
|
3654
|
+
hasToolbar && /* @__PURE__ */ jsx6("div", { className: cn("toolbar-actions", classNames?.toolbarActions), children: toolbar })
|
|
3276
3655
|
] })
|
|
3277
3656
|
] });
|
|
3278
3657
|
}
|
|
@@ -3310,20 +3689,20 @@ function getMergedHeaderGroups(headerGroups) {
|
|
|
3310
3689
|
}
|
|
3311
3690
|
|
|
3312
3691
|
// src/components/ui/table/components/DataTable/DataTable.tsx
|
|
3313
|
-
import { Fragment as Fragment2, jsx as
|
|
3692
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3314
3693
|
function DefaultScroll({
|
|
3315
3694
|
scrollRef,
|
|
3316
3695
|
children,
|
|
3317
3696
|
className
|
|
3318
3697
|
}) {
|
|
3319
|
-
return /* @__PURE__ */
|
|
3698
|
+
return /* @__PURE__ */ jsx7("div", { ref: scrollRef, className: cn("data-table-scroll", className), children });
|
|
3320
3699
|
}
|
|
3321
3700
|
function DefaultPending({
|
|
3322
3701
|
loadingText,
|
|
3323
3702
|
className,
|
|
3324
3703
|
classNames
|
|
3325
3704
|
}) {
|
|
3326
|
-
return /* @__PURE__ */
|
|
3705
|
+
return /* @__PURE__ */ jsx7(
|
|
3327
3706
|
"div",
|
|
3328
3707
|
{
|
|
3329
3708
|
className: cn(
|
|
@@ -3333,7 +3712,7 @@ function DefaultPending({
|
|
|
3333
3712
|
classNames?.pending,
|
|
3334
3713
|
className
|
|
3335
3714
|
),
|
|
3336
|
-
children: /* @__PURE__ */
|
|
3715
|
+
children: /* @__PURE__ */ jsx7("span", { className: cn("data-table-loading-text", classNames?.loadingText), children: loadingText })
|
|
3337
3716
|
}
|
|
3338
3717
|
);
|
|
3339
3718
|
}
|
|
@@ -3342,7 +3721,7 @@ function DefaultEmpty({
|
|
|
3342
3721
|
columnCount,
|
|
3343
3722
|
classNames
|
|
3344
3723
|
}) {
|
|
3345
|
-
return /* @__PURE__ */
|
|
3724
|
+
return /* @__PURE__ */ jsx7("tr", { children: /* @__PURE__ */ jsx7(
|
|
3346
3725
|
"td",
|
|
3347
3726
|
{
|
|
3348
3727
|
colSpan: columnCount,
|
|
@@ -3400,7 +3779,7 @@ function DataTable({
|
|
|
3400
3779
|
[rowContextValue, classNames]
|
|
3401
3780
|
);
|
|
3402
3781
|
if (isPending) {
|
|
3403
|
-
return /* @__PURE__ */
|
|
3782
|
+
return /* @__PURE__ */ jsx7(
|
|
3404
3783
|
PendingSlot,
|
|
3405
3784
|
{
|
|
3406
3785
|
loadingText,
|
|
@@ -3409,7 +3788,7 @@ function DataTable({
|
|
|
3409
3788
|
}
|
|
3410
3789
|
);
|
|
3411
3790
|
}
|
|
3412
|
-
return /* @__PURE__ */
|
|
3791
|
+
return /* @__PURE__ */ jsxs6(
|
|
3413
3792
|
"div",
|
|
3414
3793
|
{
|
|
3415
3794
|
ref: rootRef,
|
|
@@ -3423,7 +3802,7 @@ function DataTable({
|
|
|
3423
3802
|
className
|
|
3424
3803
|
),
|
|
3425
3804
|
children: [
|
|
3426
|
-
/* @__PURE__ */
|
|
3805
|
+
/* @__PURE__ */ jsx7(
|
|
3427
3806
|
ToolbarSlot,
|
|
3428
3807
|
{
|
|
3429
3808
|
filteredCount: filteredCount ?? tableData.length,
|
|
@@ -3435,7 +3814,7 @@ function DataTable({
|
|
|
3435
3814
|
classNames
|
|
3436
3815
|
}
|
|
3437
3816
|
),
|
|
3438
|
-
enableInlineSearch ? /* @__PURE__ */
|
|
3817
|
+
enableInlineSearch ? /* @__PURE__ */ jsx7(
|
|
3439
3818
|
DataTableSearch,
|
|
3440
3819
|
{
|
|
3441
3820
|
showSearch: inlineSearch.showSearch,
|
|
@@ -3457,14 +3836,14 @@ function DataTable({
|
|
|
3457
3836
|
onPrevious: inlineSearch.goToPrevious
|
|
3458
3837
|
}
|
|
3459
3838
|
) : null,
|
|
3460
|
-
/* @__PURE__ */
|
|
3839
|
+
/* @__PURE__ */ jsx7(ScrollSlot, { scrollRef, className: classNames?.scroll, children: /* @__PURE__ */ jsxs6(
|
|
3461
3840
|
"table",
|
|
3462
3841
|
{
|
|
3463
3842
|
className: cn("data-table", classNames?.table),
|
|
3464
3843
|
style: enableColumnResize ? { width: table.getTotalSize() } : void 0,
|
|
3465
3844
|
onDragStart: enableCellSelection ? (event) => event.preventDefault() : void 0,
|
|
3466
3845
|
children: [
|
|
3467
|
-
/* @__PURE__ */
|
|
3846
|
+
/* @__PURE__ */ jsx7("thead", { className: cn("data-table-head", classNames?.head), children: headerGroups.map((headerGroup) => /* @__PURE__ */ jsx7(
|
|
3468
3847
|
"tr",
|
|
3469
3848
|
{
|
|
3470
3849
|
className: cn("data-table-head-row", classNames?.headRow),
|
|
@@ -3476,7 +3855,7 @@ function DataTable({
|
|
|
3476
3855
|
force: enableColumnResize,
|
|
3477
3856
|
lockMax: enableColumnResize
|
|
3478
3857
|
});
|
|
3479
|
-
const freezeOffset = enableColumnFreeze ?
|
|
3858
|
+
const freezeOffset = enableColumnFreeze ? resolveHeaderFreezeOffset(header.column, freezeOffsets) : void 0;
|
|
3480
3859
|
const freezeStyle = getColumnFreezeStyle(freezeOffset, {
|
|
3481
3860
|
isHeader: true,
|
|
3482
3861
|
headerTop: header.depth * DATA_TABLE_HEADER_ROW_HEIGHT
|
|
@@ -3485,7 +3864,7 @@ function DataTable({
|
|
|
3485
3864
|
...sizeStyle,
|
|
3486
3865
|
...freezeStyle
|
|
3487
3866
|
};
|
|
3488
|
-
return /* @__PURE__ */
|
|
3867
|
+
return /* @__PURE__ */ jsxs6(
|
|
3489
3868
|
"th",
|
|
3490
3869
|
{
|
|
3491
3870
|
colSpan: header.colSpan,
|
|
@@ -3502,8 +3881,11 @@ function DataTable({
|
|
|
3502
3881
|
headerClassName
|
|
3503
3882
|
),
|
|
3504
3883
|
children: [
|
|
3505
|
-
header.isPlaceholder ? null : flexRender2(
|
|
3506
|
-
|
|
3884
|
+
header.isPlaceholder ? null : flexRender2(
|
|
3885
|
+
header.column.columnDef.header,
|
|
3886
|
+
header.getContext()
|
|
3887
|
+
),
|
|
3888
|
+
canResize ? /* @__PURE__ */ jsx7(
|
|
3507
3889
|
"div",
|
|
3508
3890
|
{
|
|
3509
3891
|
role: "separator",
|
|
@@ -3529,20 +3911,20 @@ function DataTable({
|
|
|
3529
3911
|
},
|
|
3530
3912
|
headerGroup.id
|
|
3531
3913
|
)) }),
|
|
3532
|
-
/* @__PURE__ */
|
|
3914
|
+
/* @__PURE__ */ jsx7(DataTableContextProvider, { value: contextValue, children: /* @__PURE__ */ jsx7(
|
|
3533
3915
|
"tbody",
|
|
3534
3916
|
{
|
|
3535
3917
|
onMouseLeave: clearHover,
|
|
3536
3918
|
className: cn("data-table-body", classNames?.body),
|
|
3537
|
-
children: rows.length === 0 ? /* @__PURE__ */
|
|
3919
|
+
children: rows.length === 0 ? /* @__PURE__ */ jsx7(
|
|
3538
3920
|
EmptySlot,
|
|
3539
3921
|
{
|
|
3540
3922
|
emptyText,
|
|
3541
3923
|
columnCount,
|
|
3542
3924
|
classNames
|
|
3543
3925
|
}
|
|
3544
|
-
) : shouldVirtualize ? /* @__PURE__ */
|
|
3545
|
-
paddingTop > 0 && /* @__PURE__ */
|
|
3926
|
+
) : shouldVirtualize ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
3927
|
+
paddingTop > 0 && /* @__PURE__ */ jsx7(
|
|
3546
3928
|
"tr",
|
|
3547
3929
|
{
|
|
3548
3930
|
"aria-hidden": true,
|
|
@@ -3550,7 +3932,7 @@ function DataTable({
|
|
|
3550
3932
|
"data-table-virtual-spacer",
|
|
3551
3933
|
classNames?.virtualSpacer
|
|
3552
3934
|
),
|
|
3553
|
-
children: /* @__PURE__ */
|
|
3935
|
+
children: /* @__PURE__ */ jsx7(
|
|
3554
3936
|
"td",
|
|
3555
3937
|
{
|
|
3556
3938
|
colSpan: columnCount,
|
|
@@ -3566,7 +3948,7 @@ function DataTable({
|
|
|
3566
3948
|
virtualRows.map((virtualRow) => {
|
|
3567
3949
|
const row = rows[virtualRow.index];
|
|
3568
3950
|
if (!row) return null;
|
|
3569
|
-
return /* @__PURE__ */
|
|
3951
|
+
return /* @__PURE__ */ jsx7(
|
|
3570
3952
|
RowSlot,
|
|
3571
3953
|
{
|
|
3572
3954
|
row,
|
|
@@ -3577,7 +3959,7 @@ function DataTable({
|
|
|
3577
3959
|
row.id
|
|
3578
3960
|
);
|
|
3579
3961
|
}),
|
|
3580
|
-
paddingBottom > 0 && /* @__PURE__ */
|
|
3962
|
+
paddingBottom > 0 && /* @__PURE__ */ jsx7(
|
|
3581
3963
|
"tr",
|
|
3582
3964
|
{
|
|
3583
3965
|
"aria-hidden": true,
|
|
@@ -3585,7 +3967,7 @@ function DataTable({
|
|
|
3585
3967
|
"data-table-virtual-spacer",
|
|
3586
3968
|
classNames?.virtualSpacer
|
|
3587
3969
|
),
|
|
3588
|
-
children: /* @__PURE__ */
|
|
3970
|
+
children: /* @__PURE__ */ jsx7(
|
|
3589
3971
|
"td",
|
|
3590
3972
|
{
|
|
3591
3973
|
colSpan: columnCount,
|
|
@@ -3598,7 +3980,7 @@ function DataTable({
|
|
|
3598
3980
|
)
|
|
3599
3981
|
}
|
|
3600
3982
|
)
|
|
3601
|
-
] }) : rows.map((row) => /* @__PURE__ */
|
|
3983
|
+
] }) : rows.map((row) => /* @__PURE__ */ jsx7(
|
|
3602
3984
|
RowSlot,
|
|
3603
3985
|
{
|
|
3604
3986
|
row,
|
|
@@ -3617,10 +3999,10 @@ function DataTable({
|
|
|
3617
3999
|
}
|
|
3618
4000
|
|
|
3619
4001
|
// src/components/ui/table/components/Table/Table.tsx
|
|
3620
|
-
import { useCallback as
|
|
4002
|
+
import { useCallback as useCallback6, useMemo as useMemo5, useState as useState5 } from "react";
|
|
3621
4003
|
|
|
3622
4004
|
// src/components/ui/table/components/Table/buildColumnDef.tsx
|
|
3623
|
-
import { jsx as
|
|
4005
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3624
4006
|
function SortableHeader({
|
|
3625
4007
|
label,
|
|
3626
4008
|
field,
|
|
@@ -3629,15 +4011,18 @@ function SortableHeader({
|
|
|
3629
4011
|
}) {
|
|
3630
4012
|
const isActive = sort?.field === field;
|
|
3631
4013
|
const Icon = isActive ? sort.direction === "asc" ? ArrowUp : ArrowDown : ArrowUpDown;
|
|
3632
|
-
return /* @__PURE__ */
|
|
4014
|
+
return /* @__PURE__ */ jsxs7(
|
|
3633
4015
|
"button",
|
|
3634
4016
|
{
|
|
3635
4017
|
type: "button",
|
|
3636
|
-
className: cn(
|
|
4018
|
+
className: cn(
|
|
4019
|
+
"SortableHeaderJSX",
|
|
4020
|
+
isActive ? "is-active" : "is-inactive"
|
|
4021
|
+
),
|
|
3637
4022
|
onClick: () => onSort(field),
|
|
3638
4023
|
children: [
|
|
3639
|
-
/* @__PURE__ */
|
|
3640
|
-
/* @__PURE__ */
|
|
4024
|
+
/* @__PURE__ */ jsx8("span", { children: label }),
|
|
4025
|
+
/* @__PURE__ */ jsx8(Icon, { className: "sortable-header-icon" })
|
|
3641
4026
|
]
|
|
3642
4027
|
}
|
|
3643
4028
|
);
|
|
@@ -3659,6 +4044,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
3659
4044
|
editable,
|
|
3660
4045
|
editType,
|
|
3661
4046
|
editInputProps,
|
|
4047
|
+
kind,
|
|
4048
|
+
cellProps,
|
|
3662
4049
|
className,
|
|
3663
4050
|
headerClassName,
|
|
3664
4051
|
render
|
|
@@ -3670,18 +4057,20 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
3670
4057
|
...minWidth != null ? { minSize: minWidth } : {},
|
|
3671
4058
|
...maxWidth != null ? { maxSize: maxWidth } : {},
|
|
3672
4059
|
...resizable === false ? { enableResizing: false } : {},
|
|
3673
|
-
header: sortable ? () => /* @__PURE__ */
|
|
4060
|
+
header: sortable ? () => /* @__PURE__ */ jsx8(
|
|
4061
|
+
SortableHeader,
|
|
4062
|
+
{
|
|
4063
|
+
label: children,
|
|
4064
|
+
field,
|
|
4065
|
+
sort,
|
|
4066
|
+
onSort
|
|
4067
|
+
}
|
|
4068
|
+
) : (
|
|
3674
4069
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
3675
4070
|
() => children
|
|
3676
4071
|
),
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
cell: ({ row, getValue }) => render(
|
|
3680
|
-
getValue(),
|
|
3681
|
-
row,
|
|
3682
|
-
row.index
|
|
3683
|
-
)
|
|
3684
|
-
} : {},
|
|
4072
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
4073
|
+
cell: (info) => /* @__PURE__ */ jsx8(ResolvedTableCell, { info }),
|
|
3685
4074
|
meta: {
|
|
3686
4075
|
align,
|
|
3687
4076
|
rowSpan,
|
|
@@ -3689,6 +4078,9 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
3689
4078
|
editable,
|
|
3690
4079
|
editType,
|
|
3691
4080
|
editInputProps,
|
|
4081
|
+
kind,
|
|
4082
|
+
cellProps,
|
|
4083
|
+
cellRender: render,
|
|
3692
4084
|
frozen,
|
|
3693
4085
|
className,
|
|
3694
4086
|
headerClassName
|
|
@@ -3711,10 +4103,8 @@ function buildColumnDefsFromTree(nodes, sort, onSort) {
|
|
|
3711
4103
|
const { header, align, headerClassName } = node.props;
|
|
3712
4104
|
return {
|
|
3713
4105
|
id: resolveGroupId(node.props, index),
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
() => header
|
|
3717
|
-
),
|
|
4106
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
4107
|
+
header: () => header,
|
|
3718
4108
|
columns: childDefs,
|
|
3719
4109
|
enableResizing: false,
|
|
3720
4110
|
meta: {
|
|
@@ -3881,7 +4271,7 @@ function TableHeader(props) {
|
|
|
3881
4271
|
TableHeader.displayName = TABLE_HEADER_DISPLAY_NAME;
|
|
3882
4272
|
|
|
3883
4273
|
// src/components/ui/table/components/Table/TablePagination.tsx
|
|
3884
|
-
import { jsx as
|
|
4274
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3885
4275
|
function TablePagination({
|
|
3886
4276
|
page,
|
|
3887
4277
|
pageSize = 10,
|
|
@@ -3893,8 +4283,8 @@ function TablePagination({
|
|
|
3893
4283
|
const safePage = Math.min(Math.max(1, page), totalPages);
|
|
3894
4284
|
const canGoPrev = safePage > 1;
|
|
3895
4285
|
const canGoNext = safePage < totalPages;
|
|
3896
|
-
return /* @__PURE__ */
|
|
3897
|
-
/* @__PURE__ */
|
|
4286
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("TablePaginationJSX", className), children: [
|
|
4287
|
+
/* @__PURE__ */ jsx9(
|
|
3898
4288
|
"button",
|
|
3899
4289
|
{
|
|
3900
4290
|
type: "button",
|
|
@@ -3902,15 +4292,15 @@ function TablePagination({
|
|
|
3902
4292
|
disabled: !canGoPrev,
|
|
3903
4293
|
onClick: () => onChange(safePage - 1),
|
|
3904
4294
|
"aria-label": "Previous page",
|
|
3905
|
-
children: /* @__PURE__ */
|
|
4295
|
+
children: /* @__PURE__ */ jsx9(ChevronLeft, { className: "pagination-button-icon" })
|
|
3906
4296
|
}
|
|
3907
4297
|
),
|
|
3908
|
-
/* @__PURE__ */
|
|
4298
|
+
/* @__PURE__ */ jsxs8("span", { className: "pagination-label", children: [
|
|
3909
4299
|
safePage,
|
|
3910
4300
|
" / ",
|
|
3911
4301
|
totalPages
|
|
3912
4302
|
] }),
|
|
3913
|
-
/* @__PURE__ */
|
|
4303
|
+
/* @__PURE__ */ jsx9(
|
|
3914
4304
|
"button",
|
|
3915
4305
|
{
|
|
3916
4306
|
type: "button",
|
|
@@ -3918,7 +4308,7 @@ function TablePagination({
|
|
|
3918
4308
|
disabled: !canGoNext,
|
|
3919
4309
|
onClick: () => onChange(safePage + 1),
|
|
3920
4310
|
"aria-label": "Next page",
|
|
3921
|
-
children: /* @__PURE__ */
|
|
4311
|
+
children: /* @__PURE__ */ jsx9(ChevronRight, { className: "pagination-button-icon" })
|
|
3922
4312
|
}
|
|
3923
4313
|
)
|
|
3924
4314
|
] });
|
|
@@ -3926,7 +4316,7 @@ function TablePagination({
|
|
|
3926
4316
|
TablePagination.displayName = TABLE_PAGINATION_DISPLAY_NAME;
|
|
3927
4317
|
|
|
3928
4318
|
// src/components/ui/table/components/Table/Table.tsx
|
|
3929
|
-
import { jsx as
|
|
4319
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3930
4320
|
function TableRoot({
|
|
3931
4321
|
data,
|
|
3932
4322
|
children,
|
|
@@ -3940,7 +4330,7 @@ function TableRoot({
|
|
|
3940
4330
|
[children]
|
|
3941
4331
|
);
|
|
3942
4332
|
const [sort, setSort] = useState5(null);
|
|
3943
|
-
const handleSort =
|
|
4333
|
+
const handleSort = useCallback6((field) => {
|
|
3944
4334
|
setSort((previous) => {
|
|
3945
4335
|
if (previous?.field !== field) {
|
|
3946
4336
|
return { field, direction: "asc" };
|
|
@@ -3968,8 +4358,8 @@ function TableRoot({
|
|
|
3968
4358
|
if (countLeafColumns(columnTree) === 0) {
|
|
3969
4359
|
console.warn("[Table] Declare at least one Table.Column inside Table.Header.");
|
|
3970
4360
|
}
|
|
3971
|
-
return /* @__PURE__ */
|
|
3972
|
-
/* @__PURE__ */
|
|
4361
|
+
return /* @__PURE__ */ jsxs9("div", { className: "TableJSX", children: [
|
|
4362
|
+
/* @__PURE__ */ jsx10(
|
|
3973
4363
|
DataTable,
|
|
3974
4364
|
{
|
|
3975
4365
|
...dataTableProps,
|
|
@@ -3980,7 +4370,7 @@ function TableRoot({
|
|
|
3980
4370
|
className: cn(className, paginationProps && "DataTableJSX--with-pagination")
|
|
3981
4371
|
}
|
|
3982
4372
|
),
|
|
3983
|
-
paginationProps && /* @__PURE__ */
|
|
4373
|
+
paginationProps && /* @__PURE__ */ jsx10(
|
|
3984
4374
|
TablePagination,
|
|
3985
4375
|
{
|
|
3986
4376
|
page,
|
|
@@ -4005,7 +4395,7 @@ function createTable() {
|
|
|
4005
4395
|
ColumnGroup.displayName = TABLE_COLUMN_GROUP_DISPLAY_NAME;
|
|
4006
4396
|
return Object.assign(
|
|
4007
4397
|
function BoundTable(props) {
|
|
4008
|
-
return /* @__PURE__ */
|
|
4398
|
+
return /* @__PURE__ */ jsx10(TableRoot, { ...props });
|
|
4009
4399
|
},
|
|
4010
4400
|
{
|
|
4011
4401
|
Header: TableHeader,
|
|
@@ -4024,6 +4414,7 @@ var Table = Object.assign(TableRoot, {
|
|
|
4024
4414
|
Pagination: TablePagination
|
|
4025
4415
|
});
|
|
4026
4416
|
export {
|
|
4417
|
+
BUILTIN_CELL_RENDERERS,
|
|
4027
4418
|
CELL_SELECTION_EDGES_CLASS,
|
|
4028
4419
|
DEFAULT_DATA_TABLE_LABELS,
|
|
4029
4420
|
DEFAULT_TREE_CHILDREN_FIELD,
|
|
@@ -4032,6 +4423,7 @@ export {
|
|
|
4032
4423
|
DEFAULT_TREE_QTY_FIELD,
|
|
4033
4424
|
DataTable,
|
|
4034
4425
|
INLINE_SEARCH_MAX_RESULTS,
|
|
4426
|
+
ResolvedTableCell,
|
|
4035
4427
|
Table,
|
|
4036
4428
|
applyCellEdit,
|
|
4037
4429
|
applyFillData,
|
|
@@ -4051,10 +4443,14 @@ export {
|
|
|
4051
4443
|
collectFillChanges,
|
|
4052
4444
|
collectRowSpanColumns,
|
|
4053
4445
|
collectSearchMatchesInRange,
|
|
4446
|
+
commitCellValue,
|
|
4447
|
+
createCellRendererRegistry,
|
|
4054
4448
|
createSearchRegex,
|
|
4055
4449
|
createTable,
|
|
4056
4450
|
escapeSearchRegex,
|
|
4057
4451
|
flattenSubtreeRows,
|
|
4452
|
+
formatCellValue,
|
|
4453
|
+
formatDefaultCellValue,
|
|
4058
4454
|
formatSearchResultLabel,
|
|
4059
4455
|
getCellEditDraftValue,
|
|
4060
4456
|
getCellSelectionEdgeStyle,
|
|
@@ -4076,8 +4472,10 @@ export {
|
|
|
4076
4472
|
parseClipboardTSV,
|
|
4077
4473
|
parseClipboardTSVWithDepths,
|
|
4078
4474
|
previousSearchIndex,
|
|
4475
|
+
resolveCellRenderer,
|
|
4079
4476
|
resolveColumnFreezeSide,
|
|
4080
4477
|
resolveDataTableLabels,
|
|
4478
|
+
resolveHeaderFreezeOffset,
|
|
4081
4479
|
resolvePasteColumnIds,
|
|
4082
4480
|
resolveRowSelection,
|
|
4083
4481
|
resolveRowSpanAt,
|
|
@@ -4090,5 +4488,6 @@ export {
|
|
|
4090
4488
|
useConvertTreeData,
|
|
4091
4489
|
useGlideTable,
|
|
4092
4490
|
useInlineSearch,
|
|
4491
|
+
withCellUpdate,
|
|
4093
4492
|
writeSelectionToClipboard
|
|
4094
4493
|
};
|