react-glide-table 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -20,50 +20,70 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- DataTable: () => DataTable,
24
- Table: () => Table,
25
- createTable: () => createTable
23
+ CELL_SELECTION_EDGES_CLASS: () => CELL_SELECTION_EDGES_CLASS,
24
+ DEFAULT_DATA_TABLE_LABELS: () => DEFAULT_DATA_TABLE_LABELS,
25
+ DEFAULT_TREE_CHILDREN_FIELD: () => DEFAULT_TREE_CHILDREN_FIELD,
26
+ DEFAULT_TREE_ID_FIELD: () => DEFAULT_TREE_ID_FIELD,
27
+ DEFAULT_TREE_PARENT_ID_FIELD: () => DEFAULT_TREE_PARENT_ID_FIELD,
28
+ DEFAULT_TREE_QTY_FIELD: () => DEFAULT_TREE_QTY_FIELD,
29
+ applyCellEdit: () => applyCellEdit,
30
+ applyFillData: () => applyFillData,
31
+ applySelectionUpdater: () => applySelectionUpdater,
32
+ buildColumnRowSpanMap: () => buildColumnRowSpanMap,
33
+ canExpandRow: () => canExpandRow,
34
+ collectFillChanges: () => collectFillChanges,
35
+ collectRowSpanColumns: () => collectRowSpanColumns,
36
+ getCellEditDraftValue: () => getCellEditDraftValue,
37
+ getCellSelectionEdgeStyle: () => getCellSelectionEdgeStyle,
38
+ getColumnEditType: () => getColumnEditType,
39
+ getRowIndexInMergedCell: () => getRowIndexInMergedCell,
40
+ hasCellSelectionEdges: () => hasCellSelectionEdges,
41
+ isCellInSelection: () => isCellInSelection,
42
+ isColumnEditable: () => isColumnEditable,
43
+ parseCellEditValue: () => parseCellEditValue,
44
+ resolveDataTableLabels: () => resolveDataTableLabels,
45
+ resolveRowSelection: () => resolveRowSelection,
46
+ resolveRowSpanAt: () => resolveRowSpanAt,
47
+ toggleExpandedRowId: () => toggleExpandedRowId,
48
+ useCellEdit: () => useCellEdit,
49
+ useCellSelection: () => useCellSelection,
50
+ useConvertTreeData: () => useConvertTreeData,
51
+ useGlideTable: () => useGlideTable
26
52
  });
27
53
  module.exports = __toCommonJS(index_exports);
28
54
 
29
- // src/components/ui/table/components/DataTable/DataTable.tsx
30
- var import_react_table2 = require("@tanstack/react-table");
31
- var import_react_virtual = require("@tanstack/react-virtual");
32
- var import_react6 = require("react");
55
+ // src/core/labels.ts
56
+ var DEFAULT_DATA_TABLE_LABELS = {
57
+ empty: "No data",
58
+ loading: "Loading...",
59
+ selection: (selectedCount) => selectedCount > 0 ? `\u2713 ${selectedCount} selected` : null,
60
+ expandRow: "Expand row",
61
+ collapseRow: "Collapse row"
62
+ };
63
+ function resolveDataTableLabels(partial) {
64
+ return {
65
+ ...DEFAULT_DATA_TABLE_LABELS,
66
+ ...partial
67
+ };
68
+ }
69
+
70
+ // src/core/treeDefaults.ts
71
+ var DEFAULT_TREE_ID_FIELD = "id";
72
+ var DEFAULT_TREE_PARENT_ID_FIELD = "parentId";
73
+ var DEFAULT_TREE_CHILDREN_FIELD = "children";
74
+ var DEFAULT_TREE_QTY_FIELD = "qty";
33
75
 
34
- // src/components/ui/table/components/DataTable/DataTableRow.tsx
76
+ // src/core/useGlideTable.ts
35
77
  var import_react_table = require("@tanstack/react-table");
36
- var import_react3 = require("react");
78
+ var import_react_virtual = require("@tanstack/react-virtual");
79
+ var import_react4 = require("react");
37
80
 
38
81
  // src/components/ui/table/constants.ts
39
- var CELL_ALIGN_CLASS = {
40
- left: "cell-align-left",
41
- center: "cell-align-center",
42
- right: "cell-align-right"
43
- };
44
- var ROW_HOVER_CLASS = "row-hoverable";
45
- var ROW_HOVERED_BG_CLASS = "row-hovered";
46
- var CELL_SELECTION_FILL_CLASS = "cell-selection-fill";
47
82
  var DATA_TABLE_ROW_HEIGHT = 44;
48
83
  var DATA_TABLE_VIRTUAL_OVERSCAN = 8;
49
84
 
50
- // src/components/ui/table/DataTableContext.tsx
85
+ // src/components/ui/table/features/cell-edit/useCellEdit.ts
51
86
  var import_react = require("react");
52
- var import_jsx_runtime = require("react/jsx-runtime");
53
- var DataTableContext = (0, import_react.createContext)(null);
54
- function useDataTableRowContext() {
55
- const context = (0, import_react.use)(DataTableContext);
56
- if (!context) {
57
- throw new Error("useDataTableRowContext must be used within a DataTableContextProvider");
58
- }
59
- return context;
60
- }
61
- function DataTableContextProvider({
62
- value,
63
- children
64
- }) {
65
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DataTableContext, { value, children });
66
- }
67
87
 
68
88
  // src/components/ui/table/features/cell-edit/cellEdit.ts
69
89
  function getColumnAccessorKey(columnDef) {
@@ -111,6 +131,87 @@ function applyCellEdit(data, rows, rowIndex, colIndex, raw) {
111
131
  return newData;
112
132
  }
113
133
 
134
+ // src/components/ui/table/features/cell-edit/useCellEdit.ts
135
+ function useCellEdit({
136
+ data,
137
+ rows,
138
+ onDataChange,
139
+ onCellChange
140
+ }) {
141
+ const [editingCell, setEditingCell] = (0, import_react.useState)(null);
142
+ const [draftValue, setDraftValue] = (0, import_react.useState)("");
143
+ const draftValueRef = (0, import_react.useRef)(draftValue);
144
+ const editingCellRef = (0, import_react.useRef)(editingCell);
145
+ (0, import_react.useEffect)(() => {
146
+ draftValueRef.current = draftValue;
147
+ }, [draftValue]);
148
+ (0, import_react.useEffect)(() => {
149
+ editingCellRef.current = editingCell;
150
+ }, [editingCell]);
151
+ const cancelEdit = (0, import_react.useCallback)(() => {
152
+ setEditingCell(null);
153
+ setDraftValue("");
154
+ }, []);
155
+ const commitEdit = (0, import_react.useCallback)(
156
+ (raw) => {
157
+ const current = editingCellRef.current;
158
+ if (!current) return true;
159
+ if (!onCellChange && !onDataChange) {
160
+ cancelEdit();
161
+ return true;
162
+ }
163
+ const row = rows[current.rowIndex];
164
+ const cell = row?.getVisibleCells()[current.colIndex];
165
+ if (!row || !cell) {
166
+ cancelEdit();
167
+ return true;
168
+ }
169
+ const value = raw ?? draftValueRef.current;
170
+ if (!isColumnEditable(cell.column.columnDef)) {
171
+ cancelEdit();
172
+ return true;
173
+ }
174
+ const parsed = parseCellEditValue(value, getColumnEditType(cell.column.columnDef));
175
+ if (!parsed.ok) return false;
176
+ if (onCellChange) {
177
+ onCellChange(row.id, cell.column.id, parsed.value);
178
+ cancelEdit();
179
+ return true;
180
+ }
181
+ const next = applyCellEdit(data, rows, current.rowIndex, current.colIndex, value);
182
+ if (!next) return false;
183
+ onDataChange?.(next);
184
+ cancelEdit();
185
+ return true;
186
+ },
187
+ [cancelEdit, data, onCellChange, onDataChange, rows]
188
+ );
189
+ const startEdit = (0, import_react.useCallback)(
190
+ (rowIndex, colIndex) => {
191
+ const cell = rows[rowIndex]?.getVisibleCells()[colIndex];
192
+ if (!cell || !isColumnEditable(cell.column.columnDef)) return;
193
+ const current = editingCellRef.current;
194
+ if (current && (current.rowIndex !== rowIndex || current.colIndex !== colIndex) && !commitEdit()) {
195
+ return;
196
+ }
197
+ setEditingCell({ rowIndex, colIndex });
198
+ setDraftValue(getCellEditDraftValue(cell.getValue()));
199
+ },
200
+ [commitEdit, rows]
201
+ );
202
+ return {
203
+ editingCell,
204
+ draftValue,
205
+ setDraftValue,
206
+ startEdit,
207
+ commitEdit,
208
+ cancelEdit
209
+ };
210
+ }
211
+
212
+ // src/components/ui/table/features/cell-selection/useCellSelection.ts
213
+ var import_react2 = require("react");
214
+
114
215
  // src/components/ui/table/features/cell-selection/cellSelection.ts
115
216
  var INITIAL_DRAG_STATE = {
116
217
  isSelecting: false,
@@ -134,7 +235,10 @@ function getRowIndexInMergedCell(clientY, cellElement, rowIndex, rowSpan) {
134
235
  const rect = cellElement.getBoundingClientRect();
135
236
  const relativeY = clientY - rect.top;
136
237
  const rowHeight = rect.height / rowSpan;
137
- const offset = Math.min(Math.max(Math.floor(relativeY / rowHeight), 0), rowSpan - 1);
238
+ const offset = Math.min(
239
+ Math.max(Math.floor(relativeY / rowHeight), 0),
240
+ rowSpan - 1
241
+ );
138
242
  return rowIndex + offset;
139
243
  }
140
244
  function isCellInSelection(rowIndex, colIndex, bounds, rowSpan = 1) {
@@ -150,31 +254,348 @@ function getActiveSelectionBounds(dragState, selectionBounds) {
150
254
  }
151
255
  var SELECTION_EDGE_WIDTH_PX = 2;
152
256
  var SELECTION_EDGE_COLOR = "var(--color-brand-primary)";
153
- function getCellSelectionEdgeStyle(rowIndex, colIndex, bounds, rowSpan = 1) {
154
- if (!isCellInSelection(rowIndex, colIndex, bounds, rowSpan) || !bounds) return void 0;
257
+ var CELL_SELECTION_EDGES_CLASS = "cell-selection-edges";
258
+ function getMergedCellStepEdges(rowIndex, colIndex, bounds, rowSpan, isVisuallySelectedAt) {
259
+ const cellEndRow = rowIndex + rowSpan - 1;
260
+ const span = cellEndRow - rowIndex + 1;
261
+ if (span <= 1) return [];
262
+ const edges = [];
263
+ const isNeighborSelected = (row, neighborCol) => {
264
+ if (isVisuallySelectedAt) {
265
+ return isVisuallySelectedAt(row, neighborCol);
266
+ }
267
+ return row >= bounds.startRow && row <= bounds.endRow && neighborCol >= bounds.startCol && neighborCol <= bounds.endCol;
268
+ };
269
+ const pushUnselectedRuns = (side, neighborCol, fromRow, toRowExclusive) => {
270
+ let runStart = null;
271
+ for (let row = fromRow; row < toRowExclusive; row++) {
272
+ if (!isNeighborSelected(row, neighborCol)) {
273
+ if (runStart === null) runStart = row;
274
+ continue;
275
+ }
276
+ if (runStart !== null) {
277
+ edges.push({
278
+ side,
279
+ offsetRatio: (runStart - rowIndex) / span,
280
+ heightRatio: (row - runStart) / span
281
+ });
282
+ runStart = null;
283
+ }
284
+ }
285
+ if (runStart !== null) {
286
+ edges.push({
287
+ side,
288
+ offsetRatio: (runStart - rowIndex) / span,
289
+ heightRatio: (toRowExclusive - runStart) / span
290
+ });
291
+ }
292
+ };
293
+ const collectSide = (side, neighborCol) => {
294
+ if (bounds.startRow > rowIndex) {
295
+ pushUnselectedRuns(
296
+ side,
297
+ neighborCol,
298
+ rowIndex,
299
+ Math.min(bounds.startRow, cellEndRow + 1)
300
+ );
301
+ }
302
+ if (bounds.endRow < cellEndRow) {
303
+ pushUnselectedRuns(
304
+ side,
305
+ neighborCol,
306
+ Math.max(bounds.endRow + 1, rowIndex),
307
+ cellEndRow + 1
308
+ );
309
+ }
310
+ };
311
+ if (colIndex < bounds.endCol) {
312
+ collectSide("right", colIndex + 1);
313
+ }
314
+ if (colIndex > bounds.startCol) {
315
+ collectSide("left", colIndex - 1);
316
+ }
317
+ return edges;
318
+ }
319
+ function buildPartialVerticalGradient(edge) {
320
+ const startPct = edge.offsetRatio * 100;
321
+ const endPct = (edge.offsetRatio + edge.heightRatio) * 100;
322
+ const overlapPx = SELECTION_EDGE_WIDTH_PX + 1;
323
+ const isTopProtrusion = edge.offsetRatio === 0 && edge.heightRatio < 1;
324
+ const isBottomProtrusion = edge.offsetRatio > 0;
325
+ const startStop = isBottomProtrusion ? `calc(${startPct}% - ${overlapPx}px)` : `${startPct}%`;
326
+ const endStop = isTopProtrusion ? `calc(${endPct}% + ${overlapPx}px)` : `${endPct}%`;
327
+ const xPos = edge.side === "left" ? "0" : "100%";
328
+ const layers = [
329
+ {
330
+ image: `linear-gradient(to bottom, transparent 0%, transparent ${startStop}, ${SELECTION_EDGE_COLOR} ${startStop}, ${SELECTION_EDGE_COLOR} ${endStop}, transparent ${endStop}, transparent 100%)`,
331
+ size: `${SELECTION_EDGE_WIDTH_PX}px 100%`,
332
+ position: `${xPos} 0`
333
+ }
334
+ ];
335
+ if (isTopProtrusion || isBottomProtrusion) {
336
+ const capTop = isTopProtrusion ? `calc(${endPct}% - ${SELECTION_EDGE_WIDTH_PX}px)` : `calc(${startPct}% - ${SELECTION_EDGE_WIDTH_PX}px)`;
337
+ layers.push({
338
+ image: `linear-gradient(${SELECTION_EDGE_COLOR}, ${SELECTION_EDGE_COLOR})`,
339
+ size: `${SELECTION_EDGE_WIDTH_PX}px ${SELECTION_EDGE_WIDTH_PX}px`,
340
+ position: `${xPos} ${capTop}`
341
+ });
342
+ }
343
+ return layers;
344
+ }
345
+ function getCellSelectionEdgeStyle(rowIndex, colIndex, bounds, rowSpan = 1, isVisuallySelectedAt) {
346
+ if (!isCellInSelection(rowIndex, colIndex, bounds, rowSpan) || !bounds)
347
+ return void 0;
155
348
  const cellEndRow = rowIndex + rowSpan - 1;
156
349
  const isTopEdge = bounds.startRow >= rowIndex && bounds.startRow <= cellEndRow;
157
350
  const isBottomEdge = bounds.endRow >= rowIndex && bounds.endRow <= cellEndRow;
158
351
  const isLeftEdge = colIndex === bounds.startCol;
159
352
  const isRightEdge = colIndex === bounds.endCol;
353
+ const selectionContinuesBelow = cellEndRow < bounds.endRow;
160
354
  const shadows = [];
161
355
  if (isTopEdge) {
162
- shadows.push(`inset 0 ${SELECTION_EDGE_WIDTH_PX}px 0 0 ${SELECTION_EDGE_COLOR}`);
356
+ shadows.push(
357
+ `inset 0 ${SELECTION_EDGE_WIDTH_PX}px 0 0 ${SELECTION_EDGE_COLOR}`
358
+ );
163
359
  }
164
360
  if (isBottomEdge) {
165
- shadows.push(`inset 0 -${SELECTION_EDGE_WIDTH_PX}px 0 0 ${SELECTION_EDGE_COLOR}`);
361
+ shadows.push(
362
+ `inset 0 -${SELECTION_EDGE_WIDTH_PX}px 0 0 ${SELECTION_EDGE_COLOR}`
363
+ );
166
364
  }
167
365
  if (isLeftEdge) {
168
- shadows.push(`inset ${SELECTION_EDGE_WIDTH_PX}px 0 0 0 ${SELECTION_EDGE_COLOR}`);
366
+ shadows.push(
367
+ `inset ${SELECTION_EDGE_WIDTH_PX}px 0 0 0 ${SELECTION_EDGE_COLOR}`
368
+ );
169
369
  }
170
370
  if (isRightEdge) {
171
- shadows.push(`inset -${SELECTION_EDGE_WIDTH_PX}px 0 0 0 ${SELECTION_EDGE_COLOR}`);
371
+ shadows.push(
372
+ `inset -${SELECTION_EDGE_WIDTH_PX}px 0 0 0 ${SELECTION_EDGE_COLOR}`
373
+ );
374
+ }
375
+ const stepEdges = getMergedCellStepEdges(
376
+ rowIndex,
377
+ colIndex,
378
+ bounds,
379
+ rowSpan,
380
+ isVisuallySelectedAt
381
+ );
382
+ const gradients = [];
383
+ const sizes = [];
384
+ const positions = [];
385
+ for (const edge of stepEdges) {
386
+ for (const partial of buildPartialVerticalGradient(edge)) {
387
+ gradients.push(partial.image);
388
+ sizes.push(partial.size);
389
+ positions.push(partial.position);
390
+ }
391
+ }
392
+ if (shadows.length === 0 && gradients.length === 0 && !selectionContinuesBelow) {
393
+ return void 0;
394
+ }
395
+ const style = {};
396
+ if (shadows.length > 0) {
397
+ style["--selection-edge-shadows"] = shadows.join(", ");
398
+ }
399
+ if (gradients.length > 0) {
400
+ style["--selection-edge-gradients"] = gradients.join(", ");
401
+ style["--selection-edge-sizes"] = sizes.join(", ");
402
+ style["--selection-edge-positions"] = positions.join(", ");
403
+ }
404
+ if (selectionContinuesBelow) {
405
+ style.borderBottomColor = "var(--color-brand-surface)";
406
+ }
407
+ return style;
408
+ }
409
+ function hasCellSelectionEdges(style) {
410
+ return Boolean(
411
+ style?.["--selection-edge-shadows"] || style?.["--selection-edge-gradients"]
412
+ );
413
+ }
414
+
415
+ // src/components/ui/table/features/cell-selection/fillData.ts
416
+ function getColumnAccessorKey2(columnDef) {
417
+ if ("accessorKey" in columnDef && columnDef.accessorKey) {
418
+ return String(columnDef.accessorKey);
419
+ }
420
+ return columnDef.id;
421
+ }
422
+ function collectFillTargets(rows, sourceBounds, fillBounds) {
423
+ const targets = [];
424
+ const sourceHeight = sourceBounds.endRow - sourceBounds.startRow + 1;
425
+ const sourceWidth = sourceBounds.endCol - sourceBounds.startCol + 1;
426
+ for (let rowIndex = fillBounds.startRow; rowIndex <= fillBounds.endRow; rowIndex += 1) {
427
+ for (let colIndex = fillBounds.startCol; colIndex <= fillBounds.endCol; colIndex += 1) {
428
+ if (isCellInSelection(rowIndex, colIndex, sourceBounds)) continue;
429
+ const offsetRow = rowIndex - sourceBounds.startRow;
430
+ const offsetCol = colIndex - sourceBounds.startCol;
431
+ const sourceRowIndex = sourceBounds.startRow + (offsetRow % sourceHeight + sourceHeight) % sourceHeight;
432
+ const sourceColIndex = sourceBounds.startCol + (offsetCol % sourceWidth + sourceWidth) % sourceWidth;
433
+ const targetRow = rows[rowIndex];
434
+ const targetCell = targetRow?.getVisibleCells()[colIndex];
435
+ const sourceCell = rows[sourceRowIndex]?.getVisibleCells()[sourceColIndex];
436
+ if (!targetRow || !targetCell || !sourceCell) continue;
437
+ const accessorKey = getColumnAccessorKey2(
438
+ targetCell.column.columnDef
439
+ );
440
+ if (!accessorKey) continue;
441
+ targets.push({
442
+ rowIndex,
443
+ accessorKey,
444
+ columnId: targetCell.column.id,
445
+ value: sourceCell.getValue(),
446
+ rowId: targetRow.id
447
+ });
448
+ }
449
+ }
450
+ return targets;
451
+ }
452
+ function collectFillChanges(rows, sourceBounds, fillBounds) {
453
+ return collectFillTargets(rows, sourceBounds, fillBounds).map(
454
+ ({ rowId, columnId, value }) => ({ rowId, columnId, value })
455
+ );
456
+ }
457
+ function applyFillData(data, rows, sourceBounds, fillBounds) {
458
+ const newData = data.map((row) => ({ ...row }));
459
+ const targets = collectFillTargets(rows, sourceBounds, fillBounds);
460
+ for (const target of targets) {
461
+ if (!newData[target.rowIndex]) continue;
462
+ newData[target.rowIndex][target.accessorKey] = target.value;
172
463
  }
173
- return shadows.length > 0 ? { boxShadow: shadows.join(", ") } : void 0;
464
+ return newData;
465
+ }
466
+ function hasFillExtension(sourceBounds, fillBounds) {
467
+ if (!sourceBounds) return false;
468
+ return fillBounds.startRow < sourceBounds.startRow || fillBounds.endRow > sourceBounds.endRow || fillBounds.startCol < sourceBounds.startCol || fillBounds.endCol > sourceBounds.endCol;
469
+ }
470
+
471
+ // src/components/ui/table/features/cell-selection/useCellSelection.ts
472
+ function useCellSelection({
473
+ data,
474
+ rows,
475
+ enabled = true,
476
+ onDataChange,
477
+ onBatchChange
478
+ }) {
479
+ const [dragState, setDragState] = (0, import_react2.useState)(INITIAL_DRAG_STATE);
480
+ const cellSelectionBounds = getCellSelectionBounds(dragState.start, dragState.end);
481
+ const activeSelectionBounds = enabled ? getActiveSelectionBounds(dragState, cellSelectionBounds) : null;
482
+ const handleCellMouseDown = (0, import_react2.useCallback)(
483
+ (rowIndex, colIndex) => {
484
+ if (!enabled) return;
485
+ setDragState({
486
+ isSelecting: true,
487
+ isFillDragging: false,
488
+ start: { row: rowIndex, col: colIndex },
489
+ end: { row: rowIndex, col: colIndex },
490
+ fillAnchor: null,
491
+ fillEnd: null
492
+ });
493
+ },
494
+ [enabled]
495
+ );
496
+ const handleCellMouseEnter = (0, import_react2.useCallback)(
497
+ (rowIndex, colIndex) => {
498
+ if (!enabled) return;
499
+ setDragState((prev) => {
500
+ if (prev.isSelecting) {
501
+ return { ...prev, end: { row: rowIndex, col: colIndex } };
502
+ }
503
+ if (prev.isFillDragging) {
504
+ return { ...prev, fillEnd: { row: rowIndex, col: colIndex } };
505
+ }
506
+ return prev;
507
+ });
508
+ },
509
+ [enabled]
510
+ );
511
+ const handleFillHandleMouseDown = (0, import_react2.useCallback)(
512
+ (rowIndex, colIndex) => {
513
+ if (!enabled) return;
514
+ setDragState((prev) => {
515
+ const bounds = getCellSelectionBounds(prev.start, prev.end);
516
+ if (!bounds) return prev;
517
+ return {
518
+ ...prev,
519
+ isSelecting: false,
520
+ isFillDragging: true,
521
+ fillAnchor: { row: bounds.startRow, col: bounds.startCol },
522
+ fillEnd: { row: rowIndex, col: colIndex }
523
+ };
524
+ });
525
+ },
526
+ [enabled]
527
+ );
528
+ (0, import_react2.useEffect)(() => {
529
+ if (!enabled) {
530
+ setDragState(INITIAL_DRAG_STATE);
531
+ }
532
+ }, [enabled]);
533
+ (0, import_react2.useEffect)(() => {
534
+ if (!enabled) return;
535
+ const handleKeyDown = (e) => {
536
+ if ((e.ctrlKey || e.metaKey) && e.key === "c" && activeSelectionBounds) {
537
+ const { startRow, endRow, startCol, endCol } = activeSelectionBounds;
538
+ const selectedData = rows.slice(startRow, endRow + 1).map((row) => {
539
+ const cells = row.getVisibleCells();
540
+ return cells.slice(startCol, endCol + 1).map((cell) => cell.getValue()).join(" ");
541
+ }).join("\n");
542
+ navigator.clipboard.writeText(selectedData);
543
+ }
544
+ };
545
+ window.addEventListener("keydown", handleKeyDown);
546
+ return () => window.removeEventListener("keydown", handleKeyDown);
547
+ }, [activeSelectionBounds, enabled, rows]);
548
+ (0, import_react2.useEffect)(() => {
549
+ if (!enabled) return;
550
+ const handleMouseUp = () => {
551
+ setDragState((prev) => {
552
+ if (prev.isFillDragging && prev.fillAnchor && prev.fillEnd) {
553
+ const sourceBounds = getCellSelectionBounds(prev.start, prev.end);
554
+ const newBounds = getCellSelectionBounds(prev.fillAnchor, prev.fillEnd);
555
+ if (newBounds) {
556
+ if (hasFillExtension(sourceBounds, newBounds) && sourceBounds) {
557
+ if (onBatchChange) {
558
+ const changes = collectFillChanges(rows, sourceBounds, newBounds);
559
+ if (changes.length > 0) {
560
+ onBatchChange(changes);
561
+ }
562
+ } else if (onDataChange) {
563
+ onDataChange(applyFillData(data, rows, sourceBounds, newBounds));
564
+ }
565
+ }
566
+ return {
567
+ isSelecting: false,
568
+ isFillDragging: false,
569
+ start: { row: newBounds.startRow, col: newBounds.startCol },
570
+ end: { row: newBounds.endRow, col: newBounds.endCol },
571
+ fillAnchor: null,
572
+ fillEnd: null
573
+ };
574
+ }
575
+ }
576
+ if (prev.isSelecting) {
577
+ return { ...prev, isSelecting: false };
578
+ }
579
+ if (prev.isFillDragging) {
580
+ return { ...prev, isFillDragging: false, fillAnchor: null, fillEnd: null };
581
+ }
582
+ return prev;
583
+ });
584
+ };
585
+ window.addEventListener("mouseup", handleMouseUp);
586
+ return () => window.removeEventListener("mouseup", handleMouseUp);
587
+ }, [data, enabled, onBatchChange, onDataChange, rows]);
588
+ return {
589
+ dragState: enabled ? dragState : INITIAL_DRAG_STATE,
590
+ activeSelectionBounds,
591
+ handleCellMouseDown,
592
+ handleCellMouseEnter,
593
+ handleFillHandleMouseDown
594
+ };
174
595
  }
175
596
 
176
597
  // src/components/ui/table/features/row-expand/row-expand.ts
177
- var import_react2 = require("react");
598
+ var import_react3 = require("react");
178
599
  function getFieldValue(row, key) {
179
600
  return row[key];
180
601
  }
@@ -195,20 +616,21 @@ function toggleExpandedRowId(rowId, previous) {
195
616
  var useConvertTreeData = ({
196
617
  data,
197
618
  enabled = true,
198
- toggleField = "materialCode",
199
- childField = "assemblyCode",
200
- flattenField = "assemblyMaterials",
619
+ toggleField = DEFAULT_TREE_ID_FIELD,
620
+ childField = DEFAULT_TREE_PARENT_ID_FIELD,
621
+ flattenField = DEFAULT_TREE_CHILDREN_FIELD,
622
+ qtyField = DEFAULT_TREE_QTY_FIELD,
201
623
  preventExpand = false,
202
624
  startIndex = 1,
203
625
  expandedRows,
204
626
  onExpandedRowsChange
205
627
  }) => {
206
- const onExpandedRowsChangeRef = (0, import_react2.useRef)(onExpandedRowsChange);
207
- const hasInitializedRef = (0, import_react2.useRef)(false);
208
- (0, import_react2.useEffect)(() => {
628
+ const onExpandedRowsChangeRef = (0, import_react3.useRef)(onExpandedRowsChange);
629
+ const hasInitializedRef = (0, import_react3.useRef)(false);
630
+ (0, import_react3.useEffect)(() => {
209
631
  onExpandedRowsChangeRef.current = onExpandedRowsChange;
210
632
  }, [onExpandedRowsChange]);
211
- (0, import_react2.useEffect)(() => {
633
+ (0, import_react3.useEffect)(() => {
212
634
  if (!data || data.length === 0) {
213
635
  hasInitializedRef.current = false;
214
636
  return;
@@ -218,7 +640,7 @@ var useConvertTreeData = ({
218
640
  onExpandedRowsChangeRef.current?.(new Set(ids));
219
641
  hasInitializedRef.current = true;
220
642
  }, [enabled, data, toggleField]);
221
- const processedData = (0, import_react2.useMemo)(() => {
643
+ const processedData = (0, import_react3.useMemo)(() => {
222
644
  if (!enabled || !data || data.length === 0) return [];
223
645
  const flattenedData = [];
224
646
  const flattenItems = (items) => {
@@ -236,738 +658,124 @@ var useConvertTreeData = ({
236
658
  ;
237
659
  child[childField] = newItem[toggleField];
238
660
  }
239
- });
240
- flattenItems(children);
241
- } else {
242
- flattenedData.push(newItem);
243
- }
244
- });
245
- };
246
- flattenItems(data);
247
- const dataWithLevels = flattenedData.map((item) => ({
248
- ...item,
249
- level: 0,
250
- children: [],
251
- processed: false
252
- }));
253
- const itemMap = /* @__PURE__ */ new Map();
254
- dataWithLevels.forEach((item) => {
255
- const key = getFieldValue(item, toggleField);
256
- if (typeof key !== "string" || !key) return;
257
- if (!itemMap.has(key)) {
258
- itemMap.set(key, []);
259
- }
260
- itemMap.get(key)?.push(item);
261
- });
262
- const rootItems = [];
263
- dataWithLevels.forEach((item) => {
264
- if (!getFieldValue(item, childField)) {
265
- rootItems.push(item);
266
- item.processed = true;
267
- }
268
- });
269
- dataWithLevels.forEach((item) => {
270
- const parentKey = getFieldValue(item, childField);
271
- if (!parentKey || item.processed) return;
272
- const parentItems = dataWithLevels.filter(
273
- (parent) => getFieldValue(parent, toggleField) === parentKey && !getFieldValue(parent, childField)
274
- );
275
- if (parentItems.length > 0) {
276
- const parent = parentItems[0];
277
- item.level = parent.level + 1;
278
- parent.children.push(item);
279
- item.processed = true;
280
- } else {
281
- const otherParents = itemMap.get(String(parentKey)) || [];
282
- if (otherParents.length > 0) {
283
- const parent = otherParents[0];
284
- item.level = parent.level + 1;
285
- parent.children.push(item);
286
- item.processed = true;
287
- } else {
288
- rootItems.push(item);
289
- item.processed = true;
290
- }
291
- }
292
- });
293
- return rootItems;
294
- }, [enabled, data, toggleField, childField, flattenField]);
295
- const flattenTree = (0, import_react2.useMemo)(() => {
296
- if (!enabled) return [];
297
- const flatten = (nodes, result = [], level = 0) => {
298
- nodes.forEach((node, index) => {
299
- const currentIndex = level === 0 ? `${index + startIndex}` : `${level}-${index + 1}`;
300
- const toggleValue = getFieldValue(node, toggleField);
301
- const uniqueId = `${index}-${String(toggleValue ?? "")}`;
302
- result.push({
303
- ...node,
304
- treeNo: currentIndex,
305
- uniqueId,
306
- processed: true
307
- });
308
- const shouldExpandChildren = node.children.length > 0 && (preventExpand || typeof toggleValue === "string" && expandedRows?.has(toggleValue));
309
- if (shouldExpandChildren) {
310
- flatten(node.children, result, index + startIndex);
311
- }
312
- });
313
- return result;
314
- };
315
- const flattenedData = flatten(processedData, [], 0);
316
- flattenedData.forEach((item) => {
317
- if (getFieldValue(item, childField)) {
318
- const parentItem = flattenedData.find(
319
- (parent) => getFieldValue(parent, toggleField) === getFieldValue(item, childField)
320
- );
321
- const parentAmount = parentItem ? Number(getFieldValue(parentItem, "amount") ?? 1) : 1;
322
- item.parentCount = parentAmount || 1;
323
- } else {
324
- item.parentCount = 1;
325
- }
326
- });
327
- return flattenedData;
328
- }, [enabled, processedData, startIndex, toggleField, childField, preventExpand, expandedRows]);
329
- const sortedData = (0, import_react2.useMemo)(() => {
330
- if (!enabled) {
331
- return data ?? [];
332
- }
333
- return [...flattenTree].sort((a, b) => {
334
- const aParts = String(a.treeNo ?? "").split("-").map(Number);
335
- const bParts = String(b.treeNo ?? "").split("-").map(Number);
336
- for (let i = 0; i < Math.max(aParts.length, bParts.length); i++) {
337
- const aVal = aParts[i] || 0;
338
- const bVal = bParts[i] || 0;
339
- if (aVal !== bVal) {
340
- return aVal - bVal;
341
- }
342
- }
343
- return 0;
344
- });
345
- }, [enabled, data, flattenTree]);
346
- return sortedData;
347
- };
348
-
349
- // src/components/ui/table/components/icons.tsx
350
- var import_jsx_runtime2 = require("react/jsx-runtime");
351
- function ChevronDown({ className, "aria-hidden": ariaHidden = true }) {
352
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
353
- "svg",
354
- {
355
- className,
356
- "aria-hidden": ariaHidden,
357
- width: "16",
358
- height: "16",
359
- viewBox: "0 0 24 24",
360
- fill: "none",
361
- stroke: "currentColor",
362
- strokeWidth: "2",
363
- strokeLinecap: "round",
364
- strokeLinejoin: "round",
365
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m6 9 6 6 6-6" })
366
- }
367
- );
368
- }
369
- function ChevronUp({ className, "aria-hidden": ariaHidden = true }) {
370
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
371
- "svg",
372
- {
373
- className,
374
- "aria-hidden": ariaHidden,
375
- width: "16",
376
- height: "16",
377
- viewBox: "0 0 24 24",
378
- fill: "none",
379
- stroke: "currentColor",
380
- strokeWidth: "2",
381
- strokeLinecap: "round",
382
- strokeLinejoin: "round",
383
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m18 15-6-6-6 6" })
384
- }
385
- );
386
- }
387
- function ChevronLeft({ className, "aria-hidden": ariaHidden = true }) {
388
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
389
- "svg",
390
- {
391
- className,
392
- "aria-hidden": ariaHidden,
393
- width: "16",
394
- height: "16",
395
- viewBox: "0 0 24 24",
396
- fill: "none",
397
- stroke: "currentColor",
398
- strokeWidth: "2",
399
- strokeLinecap: "round",
400
- strokeLinejoin: "round",
401
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m15 18-6-6 6-6" })
402
- }
403
- );
404
- }
405
- function ChevronRight({ className, "aria-hidden": ariaHidden = true }) {
406
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
407
- "svg",
408
- {
409
- className,
410
- "aria-hidden": ariaHidden,
411
- width: "16",
412
- height: "16",
413
- viewBox: "0 0 24 24",
414
- fill: "none",
415
- stroke: "currentColor",
416
- strokeWidth: "2",
417
- strokeLinecap: "round",
418
- strokeLinejoin: "round",
419
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m9 18 6-6-6-6" })
420
- }
421
- );
422
- }
423
- function ArrowUp({ className, "aria-hidden": ariaHidden = true }) {
424
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
425
- "svg",
426
- {
427
- className,
428
- "aria-hidden": ariaHidden,
429
- width: "14",
430
- height: "14",
431
- viewBox: "0 0 24 24",
432
- fill: "none",
433
- stroke: "currentColor",
434
- strokeWidth: "2",
435
- strokeLinecap: "round",
436
- strokeLinejoin: "round",
437
- children: [
438
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m18 15-6-6-6 6" }),
439
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 21V9" })
440
- ]
441
- }
442
- );
443
- }
444
- function ArrowDown({ className, "aria-hidden": ariaHidden = true }) {
445
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
446
- "svg",
447
- {
448
- className,
449
- "aria-hidden": ariaHidden,
450
- width: "14",
451
- height: "14",
452
- viewBox: "0 0 24 24",
453
- fill: "none",
454
- stroke: "currentColor",
455
- strokeWidth: "2",
456
- strokeLinecap: "round",
457
- strokeLinejoin: "round",
458
- children: [
459
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m6 9 6 6 6-6" }),
460
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 3v12" })
461
- ]
462
- }
463
- );
464
- }
465
- function ArrowUpDown({ className, "aria-hidden": ariaHidden = true }) {
466
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
467
- "svg",
468
- {
469
- className,
470
- "aria-hidden": ariaHidden,
471
- width: "14",
472
- height: "14",
473
- viewBox: "0 0 24 24",
474
- fill: "none",
475
- stroke: "currentColor",
476
- strokeWidth: "2",
477
- strokeLinecap: "round",
478
- strokeLinejoin: "round",
479
- children: [
480
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m21 16-4 4-4-4" }),
481
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M17 20V4" }),
482
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m3 8 4-4 4 4" }),
483
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7 4v16" })
484
- ]
485
- }
486
- );
487
- }
488
-
489
- // src/lib/cn.ts
490
- function cn(...inputs) {
491
- return inputs.filter(Boolean).join(" ");
492
- }
493
-
494
- // src/components/ui/table/components/DataTable/DataTableRow.tsx
495
- var import_jsx_runtime3 = require("react/jsx-runtime");
496
- function resolveExpandCellIndex(cells, toggleField) {
497
- if (!toggleField) return 0;
498
- const matchedIndex = cells.findIndex(
499
- (cell) => cell.column.id === toggleField
500
- );
501
- if (matchedIndex >= 0) return matchedIndex;
502
- const noColumnIndex = cells.findIndex(
503
- (cell) => cell.column.id === "no" || cell.column.id === "treeNo"
504
- );
505
- if (noColumnIndex >= 0 && noColumnIndex + 1 < cells.length) {
506
- return noColumnIndex + 1;
507
- }
508
- return 0;
509
- }
510
- function DataTableRow({
511
- row,
512
- onToggleSelect,
513
- virtualIndex,
514
- measureElement
515
- }) {
516
- const { rowSpan, selection, cellSelection, cellEdit, expand } = useDataTableRowContext();
517
- const {
518
- enableRowSpan,
519
- primaryRowSpanKey,
520
- columnRowSpanMap,
521
- hoveredRowIndex,
522
- hoveredGroupKey,
523
- selectedGroupKeys,
524
- onRowHover
525
- } = rowSpan;
526
- const { rowSelectionMode, selectOnRowClick, onRowClick, getRowClassName } = selection;
527
- const {
528
- activeSelectionBounds,
529
- dragState,
530
- onCellMouseDown,
531
- onCellMouseEnter,
532
- onFillHandleMouseDown
533
- } = cellSelection;
534
- const {
535
- editingCell,
536
- draftValue,
537
- onDraftValueChange,
538
- onStartEdit,
539
- onCommitEdit,
540
- onCancelEdit
541
- } = cellEdit;
542
- const {
543
- enableExpand,
544
- toggleField,
545
- expandedRows,
546
- preventExpand,
547
- onToggleExpand
548
- } = expand;
549
- const rowIndex = row.index;
550
- const rowData = row.original;
551
- const isRowHovered = hoveredRowIndex === rowIndex;
552
- const isRowSelected = row.getIsSelected();
553
- const rowGroupKey = primaryRowSpanKey !== void 0 && rowData[primaryRowSpanKey] !== null && rowData[primaryRowSpanKey] !== void 0 ? String(rowData[primaryRowSpanKey]) : null;
554
- const isGroupHovered = enableRowSpan && hoveredGroupKey !== null && rowGroupKey === hoveredGroupKey;
555
- const isGroupSelected = enableRowSpan && rowGroupKey !== null && selectedGroupKeys.has(rowGroupKey);
556
- const visibleCells = row.getVisibleCells();
557
- const expandCellIndex = enableExpand ? resolveExpandCellIndex(visibleCells, toggleField) : -1;
558
- const canExpand = enableExpand && !preventExpand && canExpandRow(rowData);
559
- const expandKey = toggleField && rowData[toggleField] !== null && rowData[toggleField] !== void 0 ? String(rowData[toggleField]) : null;
560
- const isExpanded = expandKey !== null && Boolean(expandedRows?.has(expandKey));
561
- const rowLevel = typeof rowData.level === "number" ? rowData.level : 0;
562
- const editInputRef = (0, import_react3.useRef)(null);
563
- const isRowEditing = editingCell?.rowIndex === rowIndex;
564
- (0, import_react3.useEffect)(() => {
565
- if (!isRowEditing) return;
566
- editInputRef.current?.focus();
567
- editInputRef.current?.select();
568
- }, [isRowEditing, editingCell?.colIndex]);
569
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
570
- "tr",
571
- {
572
- ref: measureElement,
573
- "data-index": virtualIndex,
574
- className: cn(
575
- "DataTableRowJSX",
576
- !enableRowSpan && ROW_HOVER_CLASS,
577
- enableRowSpan && isRowHovered && !isRowSelected && ROW_HOVERED_BG_CLASS,
578
- isRowSelected && "is-selected",
579
- enableExpand && canExpand && "is-expandable",
580
- getRowClassName?.(rowData, rowIndex)
581
- ),
582
- onMouseEnter: () => onRowHover(rowIndex, rowData),
583
- onClick: () => {
584
- if (isRowEditing) return;
585
- onRowClick?.(rowData, rowIndex);
586
- if (rowSelectionMode !== "none" && selectOnRowClick) {
587
- onToggleSelect();
588
- }
589
- },
590
- children: visibleCells.map((cell, cellIndex) => {
591
- const columnId = cell.column.id;
592
- const meta = cell.column.columnDef.meta;
593
- const align = meta?.align ?? "center";
594
- const cellClassName = meta?.className;
595
- const isRowSpanColumn = Boolean(enableRowSpan && meta?.rowSpan);
596
- const isExpandCell = cellIndex === expandCellIndex;
597
- const editable = isColumnEditable(cell.column.columnDef);
598
- const editType = getColumnEditType(cell.column.columnDef);
599
- let rowSpanInfo;
600
- if (isRowSpanColumn) {
601
- rowSpanInfo = columnRowSpanMap.get(columnId)?.[rowIndex];
602
- if (rowSpanInfo && rowSpanInfo.rowSpan === 0) {
603
- return null;
604
- }
605
- }
606
- const isEditing = editingCell?.rowIndex === rowIndex && editingCell?.colIndex === cellIndex;
607
- const showCellHover = isRowSpanColumn ? isGroupHovered : isRowHovered;
608
- const showCellSelected = isRowSpanColumn ? isGroupSelected : isRowSelected;
609
- const cellRowSpan = rowSpanInfo?.rowSpan ?? 1;
610
- const isCellDragSelected = isCellInSelection(
611
- rowIndex,
612
- cellIndex,
613
- activeSelectionBounds,
614
- cellRowSpan
615
- );
616
- const isBottomRightCell = !isEditing && activeSelectionBounds && !dragState.isSelecting && activeSelectionBounds.endRow >= rowIndex && activeSelectionBounds.endRow <= rowIndex + cellRowSpan - 1 && cellIndex === activeSelectionBounds.endCol;
617
- const resolveCellRowIndex = (clientY, element) => getRowIndexInMergedCell(clientY, element, rowIndex, cellRowSpan);
618
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
619
- "td",
620
- {
621
- rowSpan: rowSpanInfo && rowSpanInfo.rowSpan > 1 ? rowSpanInfo.rowSpan : void 0,
622
- onMouseDown: (event) => {
623
- if (isEditing) {
624
- event.stopPropagation();
625
- return;
626
- }
627
- event.preventDefault();
628
- onCellMouseDown(
629
- resolveCellRowIndex(event.clientY, event.currentTarget),
630
- cellIndex
631
- );
632
- },
633
- onMouseEnter: (event) => onCellMouseEnter(
634
- resolveCellRowIndex(event.clientY, event.currentTarget),
635
- cellIndex
636
- ),
637
- onMouseMove: (event) => {
638
- if (!dragState.isSelecting && !dragState.isFillDragging) return;
639
- onCellMouseEnter(
640
- resolveCellRowIndex(event.clientY, event.currentTarget),
641
- cellIndex
642
- );
643
- },
644
- onDoubleClick: (event) => {
645
- if (!editable) return;
646
- event.preventDefault();
647
- event.stopPropagation();
648
- onStartEdit(rowIndex, cellIndex);
649
- },
650
- style: getCellSelectionEdgeStyle(
651
- rowIndex,
652
- cellIndex,
653
- activeSelectionBounds,
654
- cellRowSpan
655
- ),
656
- className: cn(
657
- "data-table-cell",
658
- CELL_ALIGN_CLASS[align],
659
- cellClassName,
660
- enableRowSpan && showCellSelected && "is-group-selected",
661
- enableRowSpan && showCellHover && !showCellSelected && "is-group-hovered",
662
- isCellDragSelected && CELL_SELECTION_FILL_CLASS,
663
- editable && "is-editable"
664
- ),
665
- children: [
666
- isEditing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
667
- "input",
668
- {
669
- ref: editInputRef,
670
- type: editType === "number" ? "number" : "text",
671
- defaultValue: draftValue,
672
- className: cn("cell-edit-input", CELL_ALIGN_CLASS[align]),
673
- onChange: (event) => onDraftValueChange(event.target.value),
674
- onMouseDown: (event) => event.stopPropagation(),
675
- onClick: (event) => event.stopPropagation(),
676
- onKeyDown: (event) => {
677
- if (event.key === "Enter") {
678
- event.preventDefault();
679
- onCommitEdit(event.currentTarget.value);
680
- }
681
- if (event.key === "Escape") {
682
- event.preventDefault();
683
- onCancelEdit();
684
- }
685
- },
686
- onBlur: (event) => {
687
- onCommitEdit(event.currentTarget.value);
688
- }
689
- }
690
- ) : isExpandCell && enableExpand ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "expand-cell", children: [
691
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "expand-cell-content", children: [
692
- rowLevel > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "expand-cell-indent", children: "\xB7" }),
693
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "expand-cell-value", children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()) })
694
- ] }),
695
- canExpand && expandKey && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
696
- "button",
697
- {
698
- type: "button",
699
- "aria-label": isExpanded ? "\uD589 \uC811\uAE30" : "\uD589 \uD3BC\uCE58\uAE30",
700
- className: "expand-toggle-button",
701
- onClick: (event) => {
702
- event.stopPropagation();
703
- onToggleExpand?.(expandKey);
704
- },
705
- onMouseDown: (event) => event.stopPropagation(),
706
- children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronUp, { className: "expand-toggle-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronDown, { className: "expand-toggle-icon" })
707
- }
708
- )
709
- ] }) : (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()),
710
- isBottomRightCell && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
711
- "div",
712
- {
713
- role: "presentation",
714
- className: "fill-handle",
715
- onMouseDown: (event) => {
716
- event.stopPropagation();
717
- event.preventDefault();
718
- onFillHandleMouseDown(rowIndex, cellIndex);
719
- }
720
- }
721
- )
722
- ]
723
- },
724
- cell.id
725
- );
726
- })
727
- }
728
- );
729
- }
730
-
731
- // src/components/ui/table/components/DataTable/DataTableToolbar.tsx
732
- var import_jsx_runtime4 = require("react/jsx-runtime");
733
- function DefaultSelectionLabel({ selectedCount }) {
734
- if (selectedCount <= 0) return null;
735
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "toolbar-selection", children: [
736
- "\u2713 ",
737
- selectedCount,
738
- "\uAC1C \uC120\uD0DD\uB428"
739
- ] });
740
- }
741
- function DataTableToolbar({
742
- filteredCount,
743
- totalCount,
744
- summary,
745
- selectedCount,
746
- selectionLabel,
747
- toolbar,
748
- className
749
- }) {
750
- const displayFiltered = filteredCount ?? totalCount;
751
- const hasCount = displayFiltered !== void 0 || totalCount !== void 0;
752
- const hasLeftContent = hasCount || Boolean(summary);
753
- const hasToolbar = Boolean(toolbar);
754
- const selectionContent = selectionLabel ? selectionLabel(selectedCount) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DefaultSelectionLabel, { selectedCount });
755
- const hasSelectionContent = selectionContent !== null && selectionContent !== false;
756
- if (!hasLeftContent && !hasToolbar && !hasSelectionContent) return null;
757
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cn("DataTableToolbarJSX", className), children: [
758
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "toolbar-left", children: [
759
- hasCount && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "toolbar-count", children: displayFiltered !== void 0 && totalCount !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
760
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "toolbar-count-primary", children: displayFiltered }),
761
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "toolbar-count-placeholder", children: [
762
- " / ",
763
- totalCount
764
- ] })
765
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "toolbar-count-primary", children: displayFiltered ?? totalCount }) }),
766
- summary
767
- ] }),
768
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "toolbar-right", children: [
769
- selectionContent,
770
- hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "toolbar-actions", children: toolbar })
771
- ] })
772
- ] });
773
- }
774
-
775
- // src/components/ui/table/features/cell-edit/useCellEdit.ts
776
- var import_react4 = require("react");
777
- function useCellEdit({
778
- data,
779
- rows,
780
- onDataChange
781
- }) {
782
- const [editingCell, setEditingCell] = (0, import_react4.useState)(null);
783
- const [draftValue, setDraftValue] = (0, import_react4.useState)("");
784
- const draftValueRef = (0, import_react4.useRef)(draftValue);
785
- const editingCellRef = (0, import_react4.useRef)(editingCell);
786
- (0, import_react4.useEffect)(() => {
787
- draftValueRef.current = draftValue;
788
- }, [draftValue]);
789
- (0, import_react4.useEffect)(() => {
790
- editingCellRef.current = editingCell;
791
- }, [editingCell]);
792
- const cancelEdit = (0, import_react4.useCallback)(() => {
793
- setEditingCell(null);
794
- setDraftValue("");
795
- }, []);
796
- const commitEdit = (0, import_react4.useCallback)(
797
- (raw) => {
798
- const current = editingCellRef.current;
799
- if (!current) return true;
800
- if (!onDataChange) {
801
- cancelEdit();
802
- return true;
803
- }
804
- const value = raw ?? draftValueRef.current;
805
- const next = applyCellEdit(data, rows, current.rowIndex, current.colIndex, value);
806
- if (!next) return false;
807
- onDataChange(next);
808
- cancelEdit();
809
- return true;
810
- },
811
- [cancelEdit, data, onDataChange, rows]
812
- );
813
- const startEdit = (0, import_react4.useCallback)(
814
- (rowIndex, colIndex) => {
815
- const cell = rows[rowIndex]?.getVisibleCells()[colIndex];
816
- if (!cell || !isColumnEditable(cell.column.columnDef)) return;
817
- const current = editingCellRef.current;
818
- if (current && (current.rowIndex !== rowIndex || current.colIndex !== colIndex) && !commitEdit()) {
819
- return;
820
- }
821
- setEditingCell({ rowIndex, colIndex });
822
- setDraftValue(getCellEditDraftValue(cell.getValue()));
823
- },
824
- [commitEdit, rows]
825
- );
826
- return {
827
- editingCell,
828
- draftValue,
829
- setDraftValue,
830
- startEdit,
831
- commitEdit,
832
- cancelEdit
833
- };
834
- }
835
-
836
- // src/components/ui/table/features/cell-selection/useCellSelection.ts
837
- var import_react5 = require("react");
838
-
839
- // src/components/ui/table/features/cell-selection/fillData.ts
840
- function getColumnAccessorKey2(columnDef) {
841
- if ("accessorKey" in columnDef && columnDef.accessorKey) {
842
- return String(columnDef.accessorKey);
843
- }
844
- return columnDef.id;
845
- }
846
- function applyFillData(data, rows, sourceBounds, fillBounds) {
847
- const newData = data.map((row) => ({ ...row }));
848
- const sourceHeight = sourceBounds.endRow - sourceBounds.startRow + 1;
849
- const sourceWidth = sourceBounds.endCol - sourceBounds.startCol + 1;
850
- for (let rowIndex = fillBounds.startRow; rowIndex <= fillBounds.endRow; rowIndex += 1) {
851
- for (let colIndex = fillBounds.startCol; colIndex <= fillBounds.endCol; colIndex += 1) {
852
- if (isCellInSelection(rowIndex, colIndex, sourceBounds)) continue;
853
- const offsetRow = rowIndex - sourceBounds.startRow;
854
- const offsetCol = colIndex - sourceBounds.startCol;
855
- const sourceRowIndex = sourceBounds.startRow + (offsetRow % sourceHeight + sourceHeight) % sourceHeight;
856
- const sourceColIndex = sourceBounds.startCol + (offsetCol % sourceWidth + sourceWidth) % sourceWidth;
857
- const targetCell = rows[rowIndex]?.getVisibleCells()[colIndex];
858
- const sourceCell = rows[sourceRowIndex]?.getVisibleCells()[sourceColIndex];
859
- if (!targetCell || !sourceCell) continue;
860
- const accessorKey = getColumnAccessorKey2(
861
- targetCell.column.columnDef
862
- );
863
- if (!accessorKey) continue;
864
- newData[rowIndex][accessorKey] = sourceCell.getValue();
865
- }
866
- }
867
- return newData;
868
- }
869
- function hasFillExtension(sourceBounds, fillBounds) {
870
- if (!sourceBounds) return false;
871
- return fillBounds.startRow < sourceBounds.startRow || fillBounds.endRow > sourceBounds.endRow || fillBounds.startCol < sourceBounds.startCol || fillBounds.endCol > sourceBounds.endCol;
872
- }
873
-
874
- // src/components/ui/table/features/cell-selection/useCellSelection.ts
875
- function useCellSelection({
876
- data,
877
- rows,
878
- onDataChange
879
- }) {
880
- const [dragState, setDragState] = (0, import_react5.useState)(INITIAL_DRAG_STATE);
881
- const cellSelectionBounds = getCellSelectionBounds(dragState.start, dragState.end);
882
- const activeSelectionBounds = getActiveSelectionBounds(dragState, cellSelectionBounds);
883
- const handleCellMouseDown = (0, import_react5.useCallback)((rowIndex, colIndex) => {
884
- setDragState({
885
- isSelecting: true,
886
- isFillDragging: false,
887
- start: { row: rowIndex, col: colIndex },
888
- end: { row: rowIndex, col: colIndex },
889
- fillAnchor: null,
890
- fillEnd: null
891
- });
892
- }, []);
893
- const handleCellMouseEnter = (0, import_react5.useCallback)((rowIndex, colIndex) => {
894
- setDragState((prev) => {
895
- if (prev.isSelecting) {
896
- return { ...prev, end: { row: rowIndex, col: colIndex } };
897
- }
898
- if (prev.isFillDragging) {
899
- return { ...prev, fillEnd: { row: rowIndex, col: colIndex } };
661
+ });
662
+ flattenItems(children);
663
+ } else {
664
+ flattenedData.push(newItem);
665
+ }
666
+ });
667
+ };
668
+ flattenItems(data);
669
+ const dataWithLevels = flattenedData.map((item) => ({
670
+ ...item,
671
+ level: 0,
672
+ children: [],
673
+ processed: false
674
+ }));
675
+ const itemMap = /* @__PURE__ */ new Map();
676
+ dataWithLevels.forEach((item) => {
677
+ const key = getFieldValue(item, toggleField);
678
+ if (typeof key !== "string" || !key) return;
679
+ if (!itemMap.has(key)) {
680
+ itemMap.set(key, []);
900
681
  }
901
- return prev;
902
- });
903
- }, []);
904
- const handleFillHandleMouseDown = (0, import_react5.useCallback)((rowIndex, colIndex) => {
905
- setDragState((prev) => {
906
- const bounds = getCellSelectionBounds(prev.start, prev.end);
907
- if (!bounds) return prev;
908
- return {
909
- ...prev,
910
- isSelecting: false,
911
- isFillDragging: true,
912
- fillAnchor: { row: bounds.startRow, col: bounds.startCol },
913
- fillEnd: { row: rowIndex, col: colIndex }
914
- };
682
+ itemMap.get(key)?.push(item);
915
683
  });
916
- }, []);
917
- (0, import_react5.useEffect)(() => {
918
- const handleKeyDown = (e) => {
919
- if ((e.ctrlKey || e.metaKey) && e.key === "c" && activeSelectionBounds) {
920
- const { startRow, endRow, startCol, endCol } = activeSelectionBounds;
921
- const selectedData = rows.slice(startRow, endRow + 1).map((row) => {
922
- const cells = row.getVisibleCells();
923
- return cells.slice(startCol, endCol + 1).map((cell) => cell.getValue()).join(" ");
924
- }).join("\n");
925
- navigator.clipboard.writeText(selectedData);
684
+ const rootItems = [];
685
+ dataWithLevels.forEach((item) => {
686
+ if (!getFieldValue(item, childField)) {
687
+ rootItems.push(item);
688
+ item.processed = true;
926
689
  }
927
- };
928
- window.addEventListener("keydown", handleKeyDown);
929
- return () => window.removeEventListener("keydown", handleKeyDown);
930
- }, [activeSelectionBounds, rows]);
931
- (0, import_react5.useEffect)(() => {
932
- const handleMouseUp = () => {
933
- setDragState((prev) => {
934
- if (prev.isFillDragging && prev.fillAnchor && prev.fillEnd) {
935
- const sourceBounds = getCellSelectionBounds(prev.start, prev.end);
936
- const newBounds = getCellSelectionBounds(prev.fillAnchor, prev.fillEnd);
937
- if (newBounds) {
938
- if (hasFillExtension(sourceBounds, newBounds) && sourceBounds && onDataChange) {
939
- onDataChange(applyFillData(data, rows, sourceBounds, newBounds));
940
- }
941
- return {
942
- isSelecting: false,
943
- isFillDragging: false,
944
- start: { row: newBounds.startRow, col: newBounds.startCol },
945
- end: { row: newBounds.endRow, col: newBounds.endCol },
946
- fillAnchor: null,
947
- fillEnd: null
948
- };
949
- }
950
- }
951
- if (prev.isSelecting) {
952
- return { ...prev, isSelecting: false };
690
+ });
691
+ dataWithLevels.forEach((item) => {
692
+ const parentKey = getFieldValue(item, childField);
693
+ if (!parentKey || item.processed) return;
694
+ const parentItems = dataWithLevels.filter(
695
+ (parent) => getFieldValue(parent, toggleField) === parentKey && !getFieldValue(parent, childField)
696
+ );
697
+ if (parentItems.length > 0) {
698
+ const parent = parentItems[0];
699
+ item.level = parent.level + 1;
700
+ parent.children.push(item);
701
+ item.processed = true;
702
+ } else {
703
+ const otherParents = itemMap.get(String(parentKey)) || [];
704
+ if (otherParents.length > 0) {
705
+ const parent = otherParents[0];
706
+ item.level = parent.level + 1;
707
+ parent.children.push(item);
708
+ item.processed = true;
709
+ } else {
710
+ rootItems.push(item);
711
+ item.processed = true;
953
712
  }
954
- if (prev.isFillDragging) {
955
- return { ...prev, isFillDragging: false, fillAnchor: null, fillEnd: null };
713
+ }
714
+ });
715
+ return rootItems;
716
+ }, [enabled, data, toggleField, childField, flattenField]);
717
+ const flattenTree = (0, import_react3.useMemo)(() => {
718
+ if (!enabled) return [];
719
+ const flatten = (nodes, result = [], level = 0) => {
720
+ nodes.forEach((node, index) => {
721
+ const currentIndex = level === 0 ? `${index + startIndex}` : `${level}-${index + 1}`;
722
+ const toggleValue = getFieldValue(node, toggleField);
723
+ const uniqueId = `${index}-${String(toggleValue ?? "")}`;
724
+ result.push({
725
+ ...node,
726
+ treeNo: currentIndex,
727
+ uniqueId,
728
+ processed: true
729
+ });
730
+ const shouldExpandChildren = node.children.length > 0 && (preventExpand || typeof toggleValue === "string" && expandedRows?.has(toggleValue));
731
+ if (shouldExpandChildren) {
732
+ flatten(node.children, result, index + startIndex);
956
733
  }
957
- return prev;
958
734
  });
735
+ return result;
959
736
  };
960
- window.addEventListener("mouseup", handleMouseUp);
961
- return () => window.removeEventListener("mouseup", handleMouseUp);
962
- }, [data, onDataChange, rows]);
963
- return {
964
- dragState,
965
- activeSelectionBounds,
966
- handleCellMouseDown,
967
- handleCellMouseEnter,
968
- handleFillHandleMouseDown
969
- };
970
- }
737
+ const flattenedData = flatten(processedData, [], 0);
738
+ flattenedData.forEach((item) => {
739
+ if (getFieldValue(item, childField)) {
740
+ const parentItem = flattenedData.find(
741
+ (parent) => getFieldValue(parent, toggleField) === getFieldValue(item, childField)
742
+ );
743
+ const parentAmount = parentItem ? Number(getFieldValue(parentItem, qtyField) ?? 1) : 1;
744
+ item.parentCount = parentAmount || 1;
745
+ } else {
746
+ item.parentCount = 1;
747
+ }
748
+ });
749
+ return flattenedData;
750
+ }, [
751
+ enabled,
752
+ processedData,
753
+ startIndex,
754
+ toggleField,
755
+ childField,
756
+ qtyField,
757
+ preventExpand,
758
+ expandedRows
759
+ ]);
760
+ const sortedData = (0, import_react3.useMemo)(() => {
761
+ if (!enabled) {
762
+ return data ?? [];
763
+ }
764
+ return [...flattenTree].sort((a, b) => {
765
+ const aParts = String(a.treeNo ?? "").split("-").map(Number);
766
+ const bParts = String(b.treeNo ?? "").split("-").map(Number);
767
+ for (let i = 0; i < Math.max(aParts.length, bParts.length); i++) {
768
+ const aVal = aParts[i] || 0;
769
+ const bVal = bParts[i] || 0;
770
+ if (aVal !== bVal) {
771
+ return aVal - bVal;
772
+ }
773
+ }
774
+ return 0;
775
+ });
776
+ }, [enabled, data, flattenTree]);
777
+ return sortedData;
778
+ };
971
779
 
972
780
  // src/components/ui/table/features/row-selection/rowSelection.ts
973
781
  function resolveRowSelection(mode, controlledSelection, internalSelection) {
@@ -1010,6 +818,22 @@ function computeRowSpans(data, rowSpanKey) {
1010
818
  }
1011
819
  return result;
1012
820
  }
821
+ function resolveRowSpanAt(rowSpans, rowIndex) {
822
+ if (!rowSpans?.[rowIndex]) {
823
+ return { startRow: rowIndex, rowSpan: 1 };
824
+ }
825
+ const current = rowSpans[rowIndex];
826
+ if (current.rowSpan > 0) {
827
+ return { startRow: rowIndex, rowSpan: current.rowSpan };
828
+ }
829
+ for (let row = rowIndex - 1; row >= 0; row--) {
830
+ const info = rowSpans[row];
831
+ if (info && info.rowSpan > 0) {
832
+ return { startRow: row, rowSpan: info.rowSpan };
833
+ }
834
+ }
835
+ return { startRow: rowIndex, rowSpan: 1 };
836
+ }
1013
837
  function buildColumnRowSpanMap(data, columnKeys) {
1014
838
  const map = /* @__PURE__ */ new Map();
1015
839
  for (const { columnId, rowSpanKey } of columnKeys) {
@@ -1037,51 +861,62 @@ function collectRowSpanColumns(columns) {
1037
861
  return result;
1038
862
  }
1039
863
 
1040
- // src/components/ui/table/components/DataTable/DataTable.tsx
1041
- var import_jsx_runtime5 = require("react/jsx-runtime");
1042
- function DataTable({
1043
- data,
1044
- columns,
1045
- rowSelectionMode = "none",
1046
- rowSelection: controlledRowSelection,
1047
- onRowSelectionChange,
1048
- totalCount,
1049
- filteredCount,
1050
- summary,
1051
- toolbar,
1052
- selectionLabel,
1053
- isPending = false,
1054
- emptyText = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.",
1055
- enableRowSpan = false,
1056
- getRowId,
1057
- onRowClick,
1058
- getRowClassName,
1059
- getRowCanSelect,
1060
- selectOnRowClick = true,
1061
- onDataChange,
1062
- className,
1063
- preserveRowSelection = false,
1064
- toggleField,
1065
- childField,
1066
- flattenField,
1067
- expandedRows: controlledExpandedRows,
1068
- onExpandedRowsChange,
1069
- preventExpand = false,
1070
- enableVirtualization = true,
1071
- estimateRowHeight = DATA_TABLE_ROW_HEIGHT,
1072
- virtualOverscan = DATA_TABLE_VIRTUAL_OVERSCAN
1073
- }) {
864
+ // src/core/useGlideTable.ts
865
+ function useGlideTable(options) {
866
+ const {
867
+ data,
868
+ columns,
869
+ rowSelectionMode = "none",
870
+ rowSelection: controlledRowSelection,
871
+ onRowSelectionChange,
872
+ selectionLabel,
873
+ emptyText,
874
+ loadingText,
875
+ labels: labelsProp,
876
+ enableRowSpan = false,
877
+ getRowId,
878
+ onRowClick,
879
+ getRowClassName,
880
+ getRowCanSelect,
881
+ selectOnRowClick = true,
882
+ enableCellSelection = true,
883
+ onDataChange,
884
+ onCellChange,
885
+ onBatchChange,
886
+ preserveRowSelection = false,
887
+ toggleField,
888
+ childField,
889
+ flattenField,
890
+ qtyField,
891
+ expandedRows: controlledExpandedRows,
892
+ onExpandedRowsChange,
893
+ preventExpand = false,
894
+ enableVirtualization = true,
895
+ estimateRowHeight = DATA_TABLE_ROW_HEIGHT,
896
+ virtualOverscan = DATA_TABLE_VIRTUAL_OVERSCAN
897
+ } = options;
898
+ const labels = (0, import_react4.useMemo)(() => {
899
+ const resolved = resolveDataTableLabels(labelsProp);
900
+ return {
901
+ ...resolved,
902
+ empty: labelsProp?.empty ?? emptyText ?? resolved.empty,
903
+ loading: labelsProp?.loading ?? loadingText ?? resolved.loading,
904
+ selection: labelsProp?.selection ?? selectionLabel ?? resolved.selection
905
+ };
906
+ }, [labelsProp, emptyText, loadingText, selectionLabel]);
1074
907
  const enableExpand = Boolean(toggleField);
1075
- const [internalRowSelection, setInternalRowSelection] = (0, import_react6.useState)({});
1076
- const [internalExpandedRows, setInternalExpandedRows] = (0, import_react6.useState)(() => /* @__PURE__ */ new Set());
1077
- const [hoveredRowIndex, setHoveredRowIndex] = (0, import_react6.useState)(null);
1078
- const [hoveredGroupKey, setHoveredGroupKey] = (0, import_react6.useState)(null);
1079
- const scrollRef = (0, import_react6.useRef)(null);
908
+ const [internalRowSelection, setInternalRowSelection] = (0, import_react4.useState)({});
909
+ const [internalExpandedRows, setInternalExpandedRows] = (0, import_react4.useState)(
910
+ () => /* @__PURE__ */ new Set()
911
+ );
912
+ const [hoveredRowIndex, setHoveredRowIndex] = (0, import_react4.useState)(null);
913
+ const [hoveredGroupKey, setHoveredGroupKey] = (0, import_react4.useState)(null);
914
+ const scrollRef = (0, import_react4.useRef)(null);
1080
915
  const shouldVirtualize = enableVirtualization && !enableRowSpan;
1081
- (0, import_react6.useEffect)(() => {
916
+ (0, import_react4.useEffect)(() => {
1082
917
  if (enableVirtualization && enableRowSpan) {
1083
918
  console.warn(
1084
- "[DataTable] enableRowSpan\uC774 \uCF1C\uC838 \uC788\uC73C\uBA74 \uC140 \uBCD1\uD569 \uC720\uC9C0\uB97C \uC704\uD574 \uAC00\uC0C1\uD654\uB97C \uBE44\uD65C\uC131\uD654\uD569\uB2C8\uB2E4."
919
+ "[useGlideTable] enableRowSpan is on; virtualization is disabled to preserve cell merges."
1085
920
  );
1086
921
  }
1087
922
  }, [enableVirtualization, enableRowSpan]);
@@ -1091,7 +926,7 @@ function DataTable({
1091
926
  internalRowSelection
1092
927
  );
1093
928
  const expandedRows = controlledExpandedRows ?? internalExpandedRows;
1094
- const handleExpandedRowsChange = (0, import_react6.useCallback)(
929
+ const handleExpandedRowsChange = (0, import_react4.useCallback)(
1095
930
  (next) => {
1096
931
  if (onExpandedRowsChange) {
1097
932
  onExpandedRowsChange(next);
@@ -1107,11 +942,12 @@ function DataTable({
1107
942
  toggleField,
1108
943
  childField,
1109
944
  flattenField,
945
+ qtyField,
1110
946
  expandedRows,
1111
947
  onExpandedRowsChange: enableExpand ? handleExpandedRowsChange : void 0,
1112
948
  preventExpand
1113
949
  });
1114
- const table = (0, import_react_table2.useReactTable)({
950
+ const table = (0, import_react_table.useReactTable)({
1115
951
  data: tableData,
1116
952
  columns,
1117
953
  state: {
@@ -1130,15 +966,15 @@ function DataTable({
1130
966
  (previous) => applySelectionUpdater(rowSelectionMode, updater, previous)
1131
967
  );
1132
968
  },
1133
- getCoreRowModel: (0, import_react_table2.getCoreRowModel)(),
969
+ getCoreRowModel: (0, import_react_table.getCoreRowModel)(),
1134
970
  getRowId: getRowId ? (originalRow, index) => getRowId(originalRow, index) : (_originalRow, index) => String(index)
1135
971
  });
1136
- const rowSpanColumnKeys = (0, import_react6.useMemo)(() => {
972
+ const rowSpanColumnKeys = (0, import_react4.useMemo)(() => {
1137
973
  if (!enableRowSpan) return [];
1138
974
  return collectRowSpanColumns(columns);
1139
975
  }, [enableRowSpan, columns]);
1140
976
  const primaryRowSpanKey = rowSpanColumnKeys[0]?.rowSpanKey;
1141
- const columnRowSpanMap = (0, import_react6.useMemo)(
977
+ const columnRowSpanMap = (0, import_react4.useMemo)(
1142
978
  () => buildColumnRowSpanMap(tableData, rowSpanColumnKeys),
1143
979
  [tableData, rowSpanColumnKeys]
1144
980
  );
@@ -1156,7 +992,7 @@ function DataTable({
1156
992
  const totalSize = rowVirtualizer.getTotalSize();
1157
993
  const paddingTop = virtualRows.length > 0 ? virtualRows[0]?.start ?? 0 : 0;
1158
994
  const paddingBottom = virtualRows.length > 0 ? totalSize - (virtualRows[virtualRows.length - 1]?.end ?? 0) : 0;
1159
- const selectedGroupKeys = (0, import_react6.useMemo)(() => {
995
+ const selectedGroupKeys = (0, import_react4.useMemo)(() => {
1160
996
  if (!enableRowSpan || !primaryRowSpanKey) return /* @__PURE__ */ new Set();
1161
997
  const keys = /* @__PURE__ */ new Set();
1162
998
  for (const selectedRow of selectedRows) {
@@ -1171,11 +1007,22 @@ function DataTable({
1171
1007
  handleCellMouseDown,
1172
1008
  handleCellMouseEnter,
1173
1009
  handleFillHandleMouseDown
1174
- } = useCellSelection({ data: tableData, rows, onDataChange });
1175
- const { editingCell, draftValue, setDraftValue, startEdit, commitEdit, cancelEdit } = useCellEdit(
1176
- { data: tableData, rows, onDataChange }
1177
- );
1178
- const handleCellMouseDownWithCommit = (0, import_react6.useCallback)(
1010
+ } = useCellSelection({
1011
+ data: tableData,
1012
+ rows,
1013
+ enabled: enableCellSelection,
1014
+ onDataChange,
1015
+ onBatchChange
1016
+ });
1017
+ const {
1018
+ editingCell,
1019
+ draftValue,
1020
+ setDraftValue,
1021
+ startEdit,
1022
+ commitEdit,
1023
+ cancelEdit
1024
+ } = useCellEdit({ data: tableData, rows, onDataChange, onCellChange });
1025
+ const handleCellMouseDownWithCommit = (0, import_react4.useCallback)(
1179
1026
  (rowIndex, colIndex) => {
1180
1027
  const isSameEditingCell = editingCell?.rowIndex === rowIndex && editingCell?.colIndex === colIndex;
1181
1028
  if (editingCell && !isSameEditingCell && !commitEdit()) {
@@ -1185,11 +1032,11 @@ function DataTable({
1185
1032
  },
1186
1033
  [commitEdit, editingCell, handleCellMouseDown]
1187
1034
  );
1188
- const clearHover = () => {
1035
+ const clearHover = (0, import_react4.useCallback)(() => {
1189
1036
  setHoveredRowIndex(null);
1190
1037
  setHoveredGroupKey(null);
1191
- };
1192
- const handleRowHover = (0, import_react6.useCallback)(
1038
+ }, []);
1039
+ const handleRowHover = (0, import_react4.useCallback)(
1193
1040
  (rowIndex, rowData) => {
1194
1041
  setHoveredRowIndex(rowIndex);
1195
1042
  if (!primaryRowSpanKey) {
@@ -1203,7 +1050,7 @@ function DataTable({
1203
1050
  },
1204
1051
  [primaryRowSpanKey]
1205
1052
  );
1206
- const handleToggleSelect = (0, import_react6.useCallback)(
1053
+ const handleToggleSelect = (0, import_react4.useCallback)(
1207
1054
  (row) => {
1208
1055
  if (!row.getCanSelect()) return;
1209
1056
  if (preserveRowSelection && row.getIsSelected()) {
@@ -1213,14 +1060,14 @@ function DataTable({
1213
1060
  },
1214
1061
  [preserveRowSelection]
1215
1062
  );
1216
- const handleToggleExpand = (0, import_react6.useCallback)(
1063
+ const handleToggleExpand = (0, import_react4.useCallback)(
1217
1064
  (rowKey) => {
1218
1065
  if (preventExpand) return;
1219
1066
  handleExpandedRowsChange(toggleExpandedRowId(rowKey, expandedRows));
1220
1067
  },
1221
1068
  [preventExpand, handleExpandedRowsChange, expandedRows]
1222
1069
  );
1223
- const rowContextValue = (0, import_react6.useMemo)(() => {
1070
+ const rowContextValue = (0, import_react4.useMemo)(() => {
1224
1071
  return {
1225
1072
  rowSpan: {
1226
1073
  enableRowSpan,
@@ -1238,6 +1085,7 @@ function DataTable({
1238
1085
  getRowClassName
1239
1086
  },
1240
1087
  cellSelection: {
1088
+ enableCellSelection,
1241
1089
  activeSelectionBounds,
1242
1090
  dragState,
1243
1091
  onCellMouseDown: handleCellMouseDownWithCommit,
@@ -1257,7 +1105,9 @@ function DataTable({
1257
1105
  toggleField,
1258
1106
  expandedRows,
1259
1107
  preventExpand,
1260
- onToggleExpand: handleToggleExpand
1108
+ onToggleExpand: handleToggleExpand,
1109
+ expandRowLabel: labels.expandRow,
1110
+ collapseRowLabel: labels.collapseRow
1261
1111
  }
1262
1112
  };
1263
1113
  }, [
@@ -1272,6 +1122,7 @@ function DataTable({
1272
1122
  selectOnRowClick,
1273
1123
  onRowClick,
1274
1124
  getRowClassName,
1125
+ enableCellSelection,
1275
1126
  activeSelectionBounds,
1276
1127
  dragState,
1277
1128
  handleCellMouseDownWithCommit,
@@ -1287,405 +1138,61 @@ function DataTable({
1287
1138
  toggleField,
1288
1139
  expandedRows,
1289
1140
  preventExpand,
1290
- handleToggleExpand
1141
+ handleToggleExpand,
1142
+ labels.expandRow,
1143
+ labels.collapseRow
1291
1144
  ]);
1292
- if (isPending) {
1293
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: cn("DataTableJSX", "DataTableJSX--pending", className), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "data-table-loading-text", children: "\uB85C\uB529 \uC911..." }) });
1294
- }
1295
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cn("DataTableJSX", className), children: [
1296
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1297
- DataTableToolbar,
1298
- {
1299
- filteredCount: filteredCount ?? tableData.length,
1300
- totalCount,
1301
- summary,
1302
- selectedCount,
1303
- selectionLabel,
1304
- toolbar
1305
- }
1306
- ),
1307
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: scrollRef, className: "data-table-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1308
- "table",
1309
- {
1310
- className: "data-table",
1311
- onDragStart: (event) => event.preventDefault(),
1312
- children: [
1313
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("thead", { className: "data-table-head", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { className: "data-table-head-row", children: headerGroup.headers.map((header) => {
1314
- const align = header.column.columnDef.meta?.align ?? "center";
1315
- const headerClassName = header.column.columnDef.meta?.headerClassName;
1316
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1317
- "th",
1318
- {
1319
- style: { width: header.getSize() !== 150 ? header.getSize() : void 0 },
1320
- className: cn(
1321
- "data-table-head-cell",
1322
- CELL_ALIGN_CLASS[align],
1323
- headerClassName
1324
- ),
1325
- children: header.isPlaceholder ? null : (0, import_react_table2.flexRender)(header.column.columnDef.header, header.getContext())
1326
- },
1327
- header.id
1328
- );
1329
- }) }, headerGroup.id)) }),
1330
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DataTableContextProvider, { value: rowContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tbody", { onMouseLeave: clearHover, className: "data-table-body", children: rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: columnCount, className: "data-table-empty-cell", children: emptyText }) }) : shouldVirtualize ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1331
- paddingTop > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { "aria-hidden": true, className: "data-table-virtual-spacer", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1332
- "td",
1333
- {
1334
- colSpan: columnCount,
1335
- style: { height: paddingTop },
1336
- className: "data-table-virtual-spacer-cell"
1337
- }
1338
- ) }),
1339
- virtualRows.map((virtualRow) => {
1340
- const row = rows[virtualRow.index];
1341
- if (!row) return null;
1342
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1343
- DataTableRow,
1344
- {
1345
- row,
1346
- virtualIndex: virtualRow.index,
1347
- measureElement: rowVirtualizer.measureElement,
1348
- onToggleSelect: () => handleToggleSelect(row)
1349
- },
1350
- row.id
1351
- );
1352
- }),
1353
- paddingBottom > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { "aria-hidden": true, className: "data-table-virtual-spacer", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1354
- "td",
1355
- {
1356
- colSpan: columnCount,
1357
- style: { height: paddingBottom },
1358
- className: "data-table-virtual-spacer-cell"
1359
- }
1360
- ) })
1361
- ] }) : rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1362
- DataTableRow,
1363
- {
1364
- row,
1365
- onToggleSelect: () => handleToggleSelect(row)
1366
- },
1367
- row.id
1368
- )) }) })
1369
- ]
1370
- }
1371
- ) })
1372
- ] });
1373
- }
1374
-
1375
- // src/components/ui/table/components/Table/Table.tsx
1376
- var import_react9 = require("react");
1377
-
1378
- // src/components/ui/table/components/Table/buildColumnDef.tsx
1379
- var import_jsx_runtime6 = require("react/jsx-runtime");
1380
- function SortableHeader({
1381
- label,
1382
- field,
1383
- sort,
1384
- onSort
1385
- }) {
1386
- const isActive = sort?.field === field;
1387
- const Icon = isActive ? sort.direction === "asc" ? ArrowUp : ArrowDown : ArrowUpDown;
1388
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1389
- "button",
1390
- {
1391
- type: "button",
1392
- className: cn("SortableHeaderJSX", isActive ? "is-active" : "is-inactive"),
1393
- onClick: () => onSort(field),
1394
- children: [
1395
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: label }),
1396
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { className: "sortable-header-icon" })
1397
- ]
1398
- }
1399
- );
1400
- }
1401
- function buildColumnDef(props, sort, onSort) {
1402
- const {
1403
- field,
1404
- virtual = false,
1405
- children,
1406
- sortable = false,
1407
- width,
1408
- align,
1409
- rowSpan,
1410
- rowSpanKey,
1411
- editable,
1412
- editType,
1413
- className,
1414
- headerClassName,
1415
- render
1416
- } = props;
1417
1145
  return {
1418
- id: field,
1419
- ...!virtual ? { accessorKey: field } : {},
1420
- size: width ?? 150,
1421
- header: sortable ? () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SortableHeader, { label: children, field, sort, onSort }) : (
1422
- // eslint-disable-next-line @typescript-eslint/promise-function-async
1423
- () => children
1424
- ),
1425
- ...render ? {
1426
- // eslint-disable-next-line @typescript-eslint/promise-function-async
1427
- cell: ({ row, getValue }) => render(
1428
- getValue(),
1429
- row,
1430
- row.index
1431
- )
1432
- } : {},
1433
- meta: {
1434
- align,
1435
- rowSpan,
1436
- rowSpanKey,
1437
- editable,
1438
- editType,
1439
- className,
1440
- headerClassName
1441
- }
1442
- };
1443
- }
1444
-
1445
- // src/components/ui/table/components/Table/parseTableChildren.ts
1446
- var import_react8 = require("react");
1447
-
1448
- // src/components/ui/table/components/Table/tableChildTypes.ts
1449
- var import_react7 = require("react");
1450
- var TABLE_HEADER_DISPLAY_NAME = "Table.Header";
1451
- var TABLE_BODY_DISPLAY_NAME = "Table.Body";
1452
- var TABLE_COLUMN_DISPLAY_NAME = "Table.Column";
1453
- var TABLE_PAGINATION_DISPLAY_NAME = "Table.Pagination";
1454
- function getComponentDisplayName(type) {
1455
- if (typeof type === "function" || typeof type === "object" && type !== null) {
1456
- return type.displayName;
1457
- }
1458
- return void 0;
1459
- }
1460
- function isTableHeaderElement(child) {
1461
- return (0, import_react7.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_HEADER_DISPLAY_NAME;
1462
- }
1463
- function isTableBodyElement(child) {
1464
- return (0, import_react7.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_BODY_DISPLAY_NAME;
1465
- }
1466
- function isTableColumnElement(child) {
1467
- return (0, import_react7.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_COLUMN_DISPLAY_NAME;
1468
- }
1469
- function isTablePaginationElement(child) {
1470
- return (0, import_react7.isValidElement)(child) && getComponentDisplayName(child.type) === TABLE_PAGINATION_DISPLAY_NAME;
1471
- }
1472
-
1473
- // src/components/ui/table/components/Table/parseTableChildren.ts
1474
- function parseTableChildren(children) {
1475
- const slots = {
1476
- header: null,
1477
- body: null,
1478
- pagination: null
1146
+ table,
1147
+ tableData,
1148
+ rows,
1149
+ columnCount,
1150
+ selectedCount,
1151
+ labels,
1152
+ emptyText: labels.empty,
1153
+ loadingText: labels.loading,
1154
+ selectionLabel: labels.selection,
1155
+ enableCellSelection,
1156
+ shouldVirtualize,
1157
+ scrollRef,
1158
+ rowVirtualizer,
1159
+ virtualRows,
1160
+ paddingTop,
1161
+ paddingBottom,
1162
+ rowContextValue,
1163
+ handleToggleSelect,
1164
+ clearHover
1479
1165
  };
1480
- for (const child of import_react8.Children.toArray(children)) {
1481
- if (isTableHeaderElement(child)) {
1482
- slots.header = child;
1483
- continue;
1484
- }
1485
- if (isTableBodyElement(child)) {
1486
- slots.body = child;
1487
- continue;
1488
- }
1489
- if (isTablePaginationElement(child)) {
1490
- slots.pagination = child;
1491
- }
1492
- }
1493
- return slots;
1494
- }
1495
- function extractColumnElements(header) {
1496
- if (!header) return [];
1497
- const { children } = header.props;
1498
- return import_react8.Children.toArray(children).filter(isTableColumnElement);
1499
- }
1500
-
1501
- // src/components/ui/table/components/Table/TableBody.tsx
1502
- function TableBody() {
1503
- return null;
1504
- }
1505
- TableBody.displayName = TABLE_BODY_DISPLAY_NAME;
1506
-
1507
- // src/components/ui/table/components/Table/TableColumn.tsx
1508
- function TableColumn(props) {
1509
- void props;
1510
- return null;
1511
- }
1512
- TableColumn.displayName = TABLE_COLUMN_DISPLAY_NAME;
1513
-
1514
- // src/components/ui/table/components/Table/tableDataPipeline.ts
1515
- function sortTableData(data, sort) {
1516
- if (!sort) return data;
1517
- const { field, direction } = sort;
1518
- const multiplier = direction === "asc" ? 1 : -1;
1519
- return [...data].sort((left, right) => {
1520
- const leftValue = left[field];
1521
- const rightValue = right[field];
1522
- if ((leftValue === null || leftValue === void 0) && (rightValue === null || rightValue === void 0)) {
1523
- return 0;
1524
- }
1525
- if (leftValue === null || leftValue === void 0) return 1;
1526
- if (rightValue === null || rightValue === void 0) return -1;
1527
- if (typeof leftValue === "number" && typeof rightValue === "number") {
1528
- return (leftValue - rightValue) * multiplier;
1529
- }
1530
- return String(leftValue).localeCompare(String(rightValue), "ko") * multiplier;
1531
- });
1532
- }
1533
- function paginateTableData(data, page, pageSize) {
1534
- const safePage = Math.max(1, page);
1535
- const start = (safePage - 1) * pageSize;
1536
- return data.slice(start, start + pageSize);
1537
- }
1538
- function getTotalPages(totalCount, pageSize) {
1539
- if (pageSize <= 0) return 1;
1540
- return Math.max(1, Math.ceil(totalCount / pageSize));
1541
- }
1542
-
1543
- // src/components/ui/table/components/Table/TableHeader.tsx
1544
- function TableHeader(props) {
1545
- void props;
1546
- return null;
1547
- }
1548
- TableHeader.displayName = TABLE_HEADER_DISPLAY_NAME;
1549
-
1550
- // src/components/ui/table/components/Table/TablePagination.tsx
1551
- var import_jsx_runtime7 = require("react/jsx-runtime");
1552
- function TablePagination({
1553
- page,
1554
- pageSize = 10,
1555
- totalCount = 0,
1556
- onChange,
1557
- className
1558
- }) {
1559
- const totalPages = getTotalPages(totalCount, pageSize);
1560
- const safePage = Math.min(Math.max(1, page), totalPages);
1561
- const canGoPrev = safePage > 1;
1562
- const canGoNext = safePage < totalPages;
1563
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn("TablePaginationJSX", className), children: [
1564
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1565
- "button",
1566
- {
1567
- type: "button",
1568
- className: "pagination-button",
1569
- disabled: !canGoPrev,
1570
- onClick: () => onChange(safePage - 1),
1571
- "aria-label": "\uC774\uC804 \uD398\uC774\uC9C0",
1572
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronLeft, { className: "pagination-button-icon" })
1573
- }
1574
- ),
1575
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "pagination-label", children: [
1576
- safePage,
1577
- " / ",
1578
- totalPages
1579
- ] }),
1580
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1581
- "button",
1582
- {
1583
- type: "button",
1584
- className: "pagination-button",
1585
- disabled: !canGoNext,
1586
- onClick: () => onChange(safePage + 1),
1587
- "aria-label": "\uB2E4\uC74C \uD398\uC774\uC9C0",
1588
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronRight, { className: "pagination-button-icon" })
1589
- }
1590
- )
1591
- ] });
1592
- }
1593
- TablePagination.displayName = TABLE_PAGINATION_DISPLAY_NAME;
1594
-
1595
- // src/components/ui/table/components/Table/Table.tsx
1596
- var import_jsx_runtime8 = require("react/jsx-runtime");
1597
- function TableRoot({
1598
- data,
1599
- children,
1600
- className,
1601
- totalCount,
1602
- filteredCount,
1603
- ...dataTableProps
1604
- }) {
1605
- const { header, pagination: paginationElement } = (0, import_react9.useMemo)(
1606
- () => parseTableChildren(children),
1607
- [children]
1608
- );
1609
- const [sort, setSort] = (0, import_react9.useState)(null);
1610
- const handleSort = (0, import_react9.useCallback)((field) => {
1611
- setSort((previous) => {
1612
- if (previous?.field !== field) {
1613
- return { field, direction: "asc" };
1614
- }
1615
- if (previous.direction === "asc") {
1616
- return { field, direction: "desc" };
1617
- }
1618
- return null;
1619
- });
1620
- }, []);
1621
- const columns = (0, import_react9.useMemo)(() => {
1622
- return extractColumnElements(header).map(
1623
- (columnElement) => buildColumnDef(columnElement.props, sort, handleSort)
1624
- );
1625
- }, [header, sort, handleSort]);
1626
- const paginationProps = paginationElement?.props;
1627
- const pageSize = paginationProps?.pageSize ?? 10;
1628
- const page = paginationProps?.page ?? 1;
1629
- const resolvedTotalCount = paginationProps?.totalCount ?? totalCount ?? data.length;
1630
- const tableData = (0, import_react9.useMemo)(() => {
1631
- const sortedData = sortTableData(data, sort);
1632
- if (!paginationProps) return sortedData;
1633
- return paginateTableData(sortedData, page, pageSize);
1634
- }, [data, sort, paginationProps, page, pageSize]);
1635
- if (columns.length === 0) {
1636
- console.warn("[Table] Table.Header \uC548\uC5D0 Table.Column\uC744 \uD558\uB098 \uC774\uC0C1 \uC120\uC5B8\uD574 \uC8FC\uC138\uC694.");
1637
- }
1638
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "TableJSX", children: [
1639
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1640
- DataTable,
1641
- {
1642
- ...dataTableProps,
1643
- data: tableData,
1644
- columns,
1645
- totalCount: paginationProps ? resolvedTotalCount : totalCount,
1646
- filteredCount: filteredCount ?? data.length,
1647
- className: cn(className, paginationProps && "DataTableJSX--with-pagination")
1648
- }
1649
- ),
1650
- paginationProps && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1651
- TablePagination,
1652
- {
1653
- page,
1654
- pageSize,
1655
- totalCount: resolvedTotalCount,
1656
- onChange: paginationProps.onChange,
1657
- className: paginationProps.className
1658
- }
1659
- )
1660
- ] });
1661
- }
1662
- function createTable() {
1663
- function Column(props) {
1664
- void props;
1665
- return null;
1666
- }
1667
- Column.displayName = TABLE_COLUMN_DISPLAY_NAME;
1668
- return Object.assign(
1669
- function BoundTable(props) {
1670
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TableRoot, { ...props });
1671
- },
1672
- {
1673
- Header: TableHeader,
1674
- Column,
1675
- Body: TableBody,
1676
- Pagination: TablePagination
1677
- }
1678
- );
1679
1166
  }
1680
- var Table = Object.assign(TableRoot, {
1681
- Header: TableHeader,
1682
- Column: TableColumn,
1683
- Body: TableBody,
1684
- Pagination: TablePagination
1685
- });
1686
1167
  // Annotate the CommonJS export names for ESM import in node:
1687
1168
  0 && (module.exports = {
1688
- DataTable,
1689
- Table,
1690
- createTable
1169
+ CELL_SELECTION_EDGES_CLASS,
1170
+ DEFAULT_DATA_TABLE_LABELS,
1171
+ DEFAULT_TREE_CHILDREN_FIELD,
1172
+ DEFAULT_TREE_ID_FIELD,
1173
+ DEFAULT_TREE_PARENT_ID_FIELD,
1174
+ DEFAULT_TREE_QTY_FIELD,
1175
+ applyCellEdit,
1176
+ applyFillData,
1177
+ applySelectionUpdater,
1178
+ buildColumnRowSpanMap,
1179
+ canExpandRow,
1180
+ collectFillChanges,
1181
+ collectRowSpanColumns,
1182
+ getCellEditDraftValue,
1183
+ getCellSelectionEdgeStyle,
1184
+ getColumnEditType,
1185
+ getRowIndexInMergedCell,
1186
+ hasCellSelectionEdges,
1187
+ isCellInSelection,
1188
+ isColumnEditable,
1189
+ parseCellEditValue,
1190
+ resolveDataTableLabels,
1191
+ resolveRowSelection,
1192
+ resolveRowSpanAt,
1193
+ toggleExpandedRowId,
1194
+ useCellEdit,
1195
+ useCellSelection,
1196
+ useConvertTreeData,
1197
+ useGlideTable
1691
1198
  });