eidos-ui 1.1.0 → 2.0.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/Table.types-Cl5gR8r9.d.cts +183 -0
- package/dist/Table.types-jhPb7JNU.d.ts +183 -0
- package/dist/{chunk-A5JVDHML.cjs → chunk-2ZENLZEQ.cjs} +59 -52
- package/dist/chunk-2ZENLZEQ.cjs.map +1 -0
- package/dist/{chunk-IZBJW37N.js → chunk-AJZTVCST.js} +9 -6
- package/dist/chunk-AJZTVCST.js.map +1 -0
- package/dist/{chunk-A5LHCAQY.js → chunk-MH2CD2QT.js} +33 -26
- package/dist/chunk-MH2CD2QT.js.map +1 -0
- package/dist/{chunk-IC2M4N7R.cjs → chunk-QONDJ5VM.cjs} +11 -11
- package/dist/chunk-QONDJ5VM.cjs.map +1 -0
- package/dist/{chunk-NFIK3KMT.js → chunk-VSFKM7FE.js} +2 -2
- package/dist/chunk-VSFKM7FE.js.map +1 -0
- package/dist/{chunk-PA4IT2XQ.cjs → chunk-XVSODE4K.cjs} +9 -6
- package/dist/chunk-XVSODE4K.cjs.map +1 -0
- package/dist/data-grid/index.cjs +4 -3
- package/dist/data-grid/index.cjs.map +1 -1
- package/dist/data-grid/index.d.cts +129 -48
- package/dist/data-grid/index.d.ts +129 -48
- package/dist/data-grid/index.js +3 -2
- package/dist/index.cjs +4 -4
- package/dist/index.css +42 -30
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/table/index.cjs +4 -3
- package/dist/table/index.cjs.map +1 -1
- package/dist/table/index.d.cts +5 -5
- package/dist/table/index.d.ts +5 -5
- package/dist/table/index.js +3 -2
- package/package.json +1 -1
- package/dist/Table.types-Bv9l7qxd.d.ts +0 -103
- package/dist/Table.types-DQ0ReOLj.d.cts +0 -103
- package/dist/chunk-A5JVDHML.cjs.map +0 -1
- package/dist/chunk-A5LHCAQY.js.map +0 -1
- package/dist/chunk-IC2M4N7R.cjs.map +0 -1
- package/dist/chunk-IZBJW37N.js.map +0 -1
- package/dist/chunk-NFIK3KMT.js.map +0 -1
- package/dist/chunk-PA4IT2XQ.cjs.map +0 -1
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkXVSODE4Kcjs = require('./chunk-XVSODE4K.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
var _chunkTROYIUDHcjs = require('./chunk-TROYIUDH.cjs');
|
|
@@ -71,6 +71,7 @@ var _reactdom = require('react-dom');
|
|
|
71
71
|
var _lucidereact = require('lucide-react');
|
|
72
72
|
var _jsxruntime = require('react/jsx-runtime');
|
|
73
73
|
var MIN_COLUMN_WIDTH_PX = 100;
|
|
74
|
+
var cellOf = (row, key) => row[key];
|
|
74
75
|
var QUICK_FILTER_RESET_VALUE = "";
|
|
75
76
|
var hasFilterValue = (value) => {
|
|
76
77
|
if (value === void 0 || value === null || value === "") return false;
|
|
@@ -84,7 +85,7 @@ function SortableTableRow({
|
|
|
84
85
|
className,
|
|
85
86
|
children
|
|
86
87
|
}) {
|
|
87
|
-
const { attributes, listeners, setNodeRef, transform, transition, isDragging } =
|
|
88
|
+
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = _chunkXVSODE4Kcjs.useSortable.call(void 0, {
|
|
88
89
|
id,
|
|
89
90
|
disabled
|
|
90
91
|
});
|
|
@@ -94,7 +95,7 @@ function SortableTableRow({
|
|
|
94
95
|
ref: setNodeRef,
|
|
95
96
|
className: [className, isDragging ? "eidos-datagrid-row--dragging" : ""].filter(Boolean).join(" "),
|
|
96
97
|
style: {
|
|
97
|
-
transform:
|
|
98
|
+
transform: _chunkXVSODE4Kcjs.CSS.Transform.toString(transform),
|
|
98
99
|
transition: _nullishCoalesce(transition, () => ( void 0)),
|
|
99
100
|
opacity: isDragging ? 0.4 : 1
|
|
100
101
|
},
|
|
@@ -167,9 +168,9 @@ function ExpandedCardPanel({
|
|
|
167
168
|
}
|
|
168
169
|
function DataGridInner({
|
|
169
170
|
// ── Existing props ─────────────────────────────────────────────────────────
|
|
170
|
-
columns,
|
|
171
|
+
columns: columnsProp,
|
|
171
172
|
data,
|
|
172
|
-
rowKey
|
|
173
|
+
rowKey,
|
|
173
174
|
onChange,
|
|
174
175
|
onRowAdd,
|
|
175
176
|
editable = false,
|
|
@@ -219,6 +220,8 @@ function DataGridInner({
|
|
|
219
220
|
cardViewBreakpoint = 640,
|
|
220
221
|
cardMinWidth = 280
|
|
221
222
|
}) {
|
|
223
|
+
const columns = columnsProp;
|
|
224
|
+
const rowKeyField = _nullishCoalesce(rowKey, () => ( "id"));
|
|
222
225
|
const [localData, _setLocalData] = _react.useState.call(void 0, data);
|
|
223
226
|
const localDataRef = _react.useRef.call(void 0, data);
|
|
224
227
|
const [editingCell, _setEditingCell] = _react.useState.call(void 0, null);
|
|
@@ -326,15 +329,15 @@ function DataGridInner({
|
|
|
326
329
|
[isControlledSelection, controlledSelectedRows, internalSelectedKeys]
|
|
327
330
|
);
|
|
328
331
|
const allKeys = _react.useMemo.call(void 0,
|
|
329
|
-
() => localData.map((row, idx) => String(_nullishCoalesce(row
|
|
330
|
-
[localData,
|
|
332
|
+
() => localData.map((row, idx) => String(_nullishCoalesce(cellOf(row, rowKeyField), () => ( idx)))),
|
|
333
|
+
[localData, rowKeyField]
|
|
331
334
|
);
|
|
332
335
|
const allSelected = allKeys.length > 0 && allKeys.every((k) => selectedSet.has(k));
|
|
333
336
|
const someSelected = !allSelected && allKeys.some((k) => selectedSet.has(k));
|
|
334
337
|
const hasSelection = selectedSet.size > 0;
|
|
335
338
|
const selectedItems = _react.useMemo.call(void 0,
|
|
336
|
-
() => localData.filter((row, idx) => selectedSet.has(String(_nullishCoalesce(row
|
|
337
|
-
[localData, selectedSet,
|
|
339
|
+
() => localData.filter((row, idx) => selectedSet.has(String(_nullishCoalesce(cellOf(row, rowKeyField), () => ( idx))))),
|
|
340
|
+
[localData, selectedSet, rowKeyField]
|
|
338
341
|
);
|
|
339
342
|
const expandedSet = _react.useMemo.call(void 0,
|
|
340
343
|
() => new Set(isControlledExpansion ? _nullishCoalesce(controlledExpandedRows, () => ( [])) : [...internalExpandedKeys]),
|
|
@@ -373,7 +376,7 @@ function DataGridInner({
|
|
|
373
376
|
if (filterEntries.length === 0) return localData;
|
|
374
377
|
return localData.filter(
|
|
375
378
|
(row) => filterEntries.every(([key, filterValue]) => {
|
|
376
|
-
const cellValue = row
|
|
379
|
+
const cellValue = cellOf(row, key);
|
|
377
380
|
if (Array.isArray(filterValue)) {
|
|
378
381
|
return filterValue.includes(String(_nullishCoalesce(cellValue, () => ( ""))));
|
|
379
382
|
}
|
|
@@ -394,8 +397,8 @@ function DataGridInner({
|
|
|
394
397
|
const sortedData = _react.useMemo.call(void 0, () => {
|
|
395
398
|
if (onSortChange || !activeSort) return filteredData;
|
|
396
399
|
return [...filteredData].sort((a, b) => {
|
|
397
|
-
const aVal = a
|
|
398
|
-
const bVal = b
|
|
400
|
+
const aVal = cellOf(a, activeSort.key);
|
|
401
|
+
const bVal = cellOf(b, activeSort.key);
|
|
399
402
|
if (aVal == null && bVal == null) return 0;
|
|
400
403
|
if (aVal == null) return 1;
|
|
401
404
|
if (bVal == null) return -1;
|
|
@@ -509,7 +512,7 @@ function DataGridInner({
|
|
|
509
512
|
localData.forEach((row, rowIndex) => {
|
|
510
513
|
for (const col of columns) {
|
|
511
514
|
if (!isCellEditable(col)) continue;
|
|
512
|
-
const error = validateCell(col, row
|
|
515
|
+
const error = validateCell(col, cellOf(row, col.key));
|
|
513
516
|
if (error) errors[cellErrorKey(rowIndex, col.key)] = error;
|
|
514
517
|
}
|
|
515
518
|
});
|
|
@@ -575,19 +578,20 @@ function DataGridInner({
|
|
|
575
578
|
);
|
|
576
579
|
const handleCellClick = _react.useCallback.call(void 0,
|
|
577
580
|
(rowIndex, col) => {
|
|
578
|
-
const
|
|
581
|
+
const row = localDataRef.current[rowIndex];
|
|
582
|
+
const value = row === void 0 ? void 0 : cellOf(row, col.key);
|
|
579
583
|
if (col.type === "checkbox") {
|
|
580
584
|
if (!editable || col.editable === false) return;
|
|
581
585
|
const newData = localDataRef.current.map(
|
|
582
|
-
(
|
|
586
|
+
(row2, idx) => idx === rowIndex ? { ...row2, [col.key]: !value } : row2
|
|
583
587
|
);
|
|
584
588
|
setLocalData(newData);
|
|
585
|
-
_optionalChain([onChange, 'optionalCall',
|
|
589
|
+
_optionalChain([onChange, 'optionalCall', _12 => _12(newData)]);
|
|
586
590
|
return;
|
|
587
591
|
}
|
|
588
592
|
if (!isCellEditable(col)) return;
|
|
589
593
|
const cell = editingCellRef.current;
|
|
590
|
-
if (_optionalChain([cell, 'optionalAccess',
|
|
594
|
+
if (_optionalChain([cell, 'optionalAccess', _13 => _13.rowIndex]) === rowIndex && _optionalChain([cell, 'optionalAccess', _14 => _14.colKey]) === col.key) return;
|
|
591
595
|
if (cell) commitEdit();
|
|
592
596
|
startEdit(rowIndex, col.key, value);
|
|
593
597
|
},
|
|
@@ -620,7 +624,7 @@ function DataGridInner({
|
|
|
620
624
|
commitValue(rowIndex, colKey, editValueRef.current);
|
|
621
625
|
if (next) {
|
|
622
626
|
setEditingCell(next);
|
|
623
|
-
setEditValue(localDataRef.current[next.rowIndex]
|
|
627
|
+
setEditValue(cellOf(localDataRef.current[next.rowIndex], next.colKey));
|
|
624
628
|
setEditError(_nullishCoalesce(cellErrors[cellErrorKey(next.rowIndex, next.colKey)], () => ( null)));
|
|
625
629
|
} else {
|
|
626
630
|
setEditingCell(null);
|
|
@@ -644,18 +648,18 @@ function DataGridInner({
|
|
|
644
648
|
const newRow = onRowAdd();
|
|
645
649
|
const newData = [newRow, ...localDataRef.current];
|
|
646
650
|
setLocalData(newData);
|
|
647
|
-
_optionalChain([onChange, 'optionalCall',
|
|
651
|
+
_optionalChain([onChange, 'optionalCall', _15 => _15(newData)]);
|
|
648
652
|
setCurrentPage(1);
|
|
649
653
|
}, [onRowAdd, onChange, setLocalData]);
|
|
650
654
|
const commitSelection = _react.useCallback.call(void 0,
|
|
651
655
|
(keys) => {
|
|
652
656
|
if (!isControlledSelection) setInternalSelectedKeys(new Set(keys));
|
|
653
657
|
const rows = localDataRef.current.filter(
|
|
654
|
-
(row, idx) => keys.includes(String(_nullishCoalesce(row
|
|
658
|
+
(row, idx) => keys.includes(String(_nullishCoalesce(cellOf(row, rowKeyField), () => ( idx))))
|
|
655
659
|
);
|
|
656
|
-
_optionalChain([onSelectionChange, 'optionalCall',
|
|
660
|
+
_optionalChain([onSelectionChange, 'optionalCall', _16 => _16(keys, rows)]);
|
|
657
661
|
},
|
|
658
|
-
[isControlledSelection,
|
|
662
|
+
[isControlledSelection, rowKeyField, onSelectionChange]
|
|
659
663
|
);
|
|
660
664
|
const toggleRow = _react.useCallback.call(void 0,
|
|
661
665
|
(key) => {
|
|
@@ -671,7 +675,7 @@ function DataGridInner({
|
|
|
671
675
|
const commitExpanded = _react.useCallback.call(void 0,
|
|
672
676
|
(keys) => {
|
|
673
677
|
if (!isControlledExpansion) setInternalExpandedKeys(new Set(keys));
|
|
674
|
-
_optionalChain([onExpandedRowsChange, 'optionalCall',
|
|
678
|
+
_optionalChain([onExpandedRowsChange, 'optionalCall', _17 => _17(keys)]);
|
|
675
679
|
},
|
|
676
680
|
[isControlledExpansion, onExpandedRowsChange]
|
|
677
681
|
);
|
|
@@ -686,11 +690,11 @@ function DataGridInner({
|
|
|
686
690
|
const handleSortClick = _react.useCallback.call(void 0,
|
|
687
691
|
(colKey) => {
|
|
688
692
|
if (onSortChange) {
|
|
689
|
-
const newDir = _optionalChain([currentSort, 'optionalAccess',
|
|
693
|
+
const newDir = _optionalChain([currentSort, 'optionalAccess', _18 => _18.key]) === colKey && _optionalChain([currentSort, 'optionalAccess', _19 => _19.direction]) === "asc" ? "desc" : "asc";
|
|
690
694
|
onSortChange(colKey, newDir);
|
|
691
695
|
} else {
|
|
692
696
|
setInternalSort((prev) => {
|
|
693
|
-
if (_optionalChain([prev, 'optionalAccess',
|
|
697
|
+
if (_optionalChain([prev, 'optionalAccess', _20 => _20.key]) === colKey) {
|
|
694
698
|
return prev.direction === "asc" ? { key: colKey, direction: "desc" } : null;
|
|
695
699
|
}
|
|
696
700
|
return { key: colKey, direction: "asc" };
|
|
@@ -735,7 +739,7 @@ function DataGridInner({
|
|
|
735
739
|
const handlePageChange = _react.useCallback.call(void 0,
|
|
736
740
|
(page) => {
|
|
737
741
|
setCurrentPage(page);
|
|
738
|
-
_optionalChain([onPageChange, 'optionalCall',
|
|
742
|
+
_optionalChain([onPageChange, 'optionalCall', _21 => _21(page, currentPageSize)]);
|
|
739
743
|
},
|
|
740
744
|
[currentPageSize, onPageChange]
|
|
741
745
|
);
|
|
@@ -743,13 +747,13 @@ function DataGridInner({
|
|
|
743
747
|
(newPageSize) => {
|
|
744
748
|
setCurrentPageSize(newPageSize);
|
|
745
749
|
setCurrentPage(1);
|
|
746
|
-
_optionalChain([onPageChange, 'optionalCall',
|
|
750
|
+
_optionalChain([onPageChange, 'optionalCall', _22 => _22(1, newPageSize)]);
|
|
747
751
|
},
|
|
748
752
|
[onPageChange]
|
|
749
753
|
);
|
|
750
|
-
const sensors =
|
|
751
|
-
|
|
752
|
-
|
|
754
|
+
const sensors = _chunkXVSODE4Kcjs.useSensors.call(void 0,
|
|
755
|
+
_chunkXVSODE4Kcjs.useSensor.call(void 0, _chunkXVSODE4Kcjs.PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
756
|
+
_chunkXVSODE4Kcjs.useSensor.call(void 0, _chunkXVSODE4Kcjs.KeyboardSensor)
|
|
753
757
|
);
|
|
754
758
|
const handleRowDragEnd = _react.useCallback.call(void 0,
|
|
755
759
|
(event) => {
|
|
@@ -757,18 +761,18 @@ function DataGridInner({
|
|
|
757
761
|
const { active, over } = event;
|
|
758
762
|
if (!over || active.id === over.id) return;
|
|
759
763
|
const oldIndex = localDataRef.current.findIndex(
|
|
760
|
-
(row, i) => String(_nullishCoalesce(row
|
|
764
|
+
(row, i) => String(_nullishCoalesce(cellOf(row, rowKeyField), () => ( i))) === String(active.id)
|
|
761
765
|
);
|
|
762
766
|
const newIndex = localDataRef.current.findIndex(
|
|
763
|
-
(row, i) => String(_nullishCoalesce(row
|
|
767
|
+
(row, i) => String(_nullishCoalesce(cellOf(row, rowKeyField), () => ( i))) === String(over.id)
|
|
764
768
|
);
|
|
765
769
|
if (oldIndex === -1 || newIndex === -1) return;
|
|
766
|
-
const newData =
|
|
770
|
+
const newData = _chunkXVSODE4Kcjs.arrayMove.call(void 0, localDataRef.current, oldIndex, newIndex);
|
|
767
771
|
setLocalData(newData);
|
|
768
|
-
_optionalChain([onChange, 'optionalCall',
|
|
769
|
-
_optionalChain([onRowReorder, 'optionalCall',
|
|
772
|
+
_optionalChain([onChange, 'optionalCall', _23 => _23(newData)]);
|
|
773
|
+
_optionalChain([onRowReorder, 'optionalCall', _24 => _24(newData)]);
|
|
770
774
|
},
|
|
771
|
-
[draggableRows,
|
|
775
|
+
[draggableRows, rowKeyField, setLocalData, onChange, onRowReorder]
|
|
772
776
|
);
|
|
773
777
|
const renderViewCell = (col, value, row, rowIndex) => {
|
|
774
778
|
if (col.renderCell) return col.renderCell(value, row, rowIndex);
|
|
@@ -784,7 +788,7 @@ function DataGridInner({
|
|
|
784
788
|
}
|
|
785
789
|
);
|
|
786
790
|
case "select": {
|
|
787
|
-
const option = _optionalChain([col, 'access',
|
|
791
|
+
const option = _optionalChain([col, 'access', _25 => _25.options, 'optionalAccess', _26 => _26.find, 'call', _27 => _27((o) => o.value === String(_nullishCoalesce(value, () => ( ""))))]);
|
|
788
792
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: option ? option.label : String(_nullishCoalesce(value, () => ( ""))) });
|
|
789
793
|
}
|
|
790
794
|
case "readonly":
|
|
@@ -850,7 +854,7 @@ function DataGridInner({
|
|
|
850
854
|
(r, i) => i === rowIndex ? { ...r, [col.key]: selected } : r
|
|
851
855
|
);
|
|
852
856
|
setLocalData(newData);
|
|
853
|
-
_optionalChain([onChange, 'optionalCall',
|
|
857
|
+
_optionalChain([onChange, 'optionalCall', _28 => _28(newData)]);
|
|
854
858
|
setEditingCell(null);
|
|
855
859
|
},
|
|
856
860
|
clearable: false
|
|
@@ -874,8 +878,8 @@ function DataGridInner({
|
|
|
874
878
|
}
|
|
875
879
|
};
|
|
876
880
|
const renderCardValue = (col, row, localIndex, baseClassName) => {
|
|
877
|
-
const value = row
|
|
878
|
-
const isEditing = _optionalChain([editingCell, 'optionalAccess',
|
|
881
|
+
const value = cellOf(row, col.key);
|
|
882
|
+
const isEditing = _optionalChain([editingCell, 'optionalAccess', _29 => _29.rowIndex]) === localIndex && _optionalChain([editingCell, 'optionalAccess', _30 => _30.colKey]) === col.key;
|
|
879
883
|
const canEdit = isCellEditable(col);
|
|
880
884
|
const isFlagged = cellErrorKey(localIndex, col.key) in cellErrors;
|
|
881
885
|
const hasError = isEditing && Boolean(editError);
|
|
@@ -948,7 +952,7 @@ function DataGridInner({
|
|
|
948
952
|
[dataColumns]
|
|
949
953
|
);
|
|
950
954
|
const totalCols = dataColumns.length + (showRowNumbers ? 1 : 0) + (actionsColumn ? 1 : 0) + (draggableRows ? 1 : 0) + (selectable ? 1 : 0) + (expandable ? 1 : 0);
|
|
951
|
-
const rowIds = displayData.map((row, i) => String(_nullishCoalesce(row
|
|
955
|
+
const rowIds = displayData.map((row, i) => String(_nullishCoalesce(cellOf(row, rowKeyField), () => ( i))));
|
|
952
956
|
const containerStyle = {};
|
|
953
957
|
if (stickyHeader && maxHeight) {
|
|
954
958
|
containerStyle.maxHeight = typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight;
|
|
@@ -1167,7 +1171,7 @@ function DataGridInner({
|
|
|
1167
1171
|
}
|
|
1168
1172
|
),
|
|
1169
1173
|
showFilters && filterDropdownColumns.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1170
|
-
|
|
1174
|
+
_chunkXVSODE4Kcjs.TableFiltersDropdown,
|
|
1171
1175
|
{
|
|
1172
1176
|
columns: filterDropdownColumns,
|
|
1173
1177
|
filters: dropdownFilters,
|
|
@@ -1186,7 +1190,7 @@ function DataGridInner({
|
|
|
1186
1190
|
style: { "--eidos-datagrid-card-min-width": `${cardMinWidth}px` },
|
|
1187
1191
|
children: displayData.length > 0 ? displayData.map((row, displayIndex) => {
|
|
1188
1192
|
const localIndex = localData.indexOf(row);
|
|
1189
|
-
const rowKeyValue = String(_nullishCoalesce(row
|
|
1193
|
+
const rowKeyValue = String(_nullishCoalesce(cellOf(row, rowKeyField), () => ( displayIndex)));
|
|
1190
1194
|
const isRowSelected = selectable && selectedSet.has(rowKeyValue);
|
|
1191
1195
|
const isRowExpanded = expandable && expandedSet.has(rowKeyValue);
|
|
1192
1196
|
const canExpandRow = !isRowExpandable || isRowExpandable(row);
|
|
@@ -1276,10 +1280,10 @@ function DataGridInner({
|
|
|
1276
1280
|
}
|
|
1277
1281
|
)
|
|
1278
1282
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1279
|
-
|
|
1283
|
+
_chunkXVSODE4Kcjs.DndContext,
|
|
1280
1284
|
{
|
|
1281
1285
|
sensors,
|
|
1282
|
-
collisionDetection:
|
|
1286
|
+
collisionDetection: _chunkXVSODE4Kcjs.closestCenter,
|
|
1283
1287
|
onDragEnd: handleRowDragEnd,
|
|
1284
1288
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "eidos-data-grid-scroll", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "table", { className: ["eidos-data-grid", densityClass].filter(Boolean).join(" "), children: [
|
|
1285
1289
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "thead", { ref: theadRef, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { children: [
|
|
@@ -1344,8 +1348,9 @@ function DataGridInner({
|
|
|
1344
1348
|
sortedColumns.map((col) => {
|
|
1345
1349
|
const colKey = col.key;
|
|
1346
1350
|
const isSortable = !!col.sortable;
|
|
1347
|
-
const isCurrentlySorted = _optionalChain([activeSort, 'optionalAccess',
|
|
1351
|
+
const isCurrentlySorted = _optionalChain([activeSort, 'optionalAccess', _31 => _31.key]) === colKey;
|
|
1348
1352
|
const sortDir = isCurrentlySorted ? activeSort.direction : null;
|
|
1353
|
+
const alignClass = `eidos-datagrid-align-${_nullishCoalesce(col.align, () => ( "left"))}`;
|
|
1349
1354
|
const { style: pinnedStyle, className: pinnedClass } = getHeaderPinnedProps(colKey);
|
|
1350
1355
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1351
1356
|
"th",
|
|
@@ -1354,6 +1359,7 @@ function DataGridInner({
|
|
|
1354
1359
|
"eidos-data-grid-header-cell",
|
|
1355
1360
|
isSortable && "eidos-datagrid-header-cell--sortable",
|
|
1356
1361
|
isCurrentlySorted && "eidos-datagrid-header-cell--sorted",
|
|
1362
|
+
alignClass,
|
|
1357
1363
|
pinnedClass
|
|
1358
1364
|
].filter(Boolean).join(" "),
|
|
1359
1365
|
style: {
|
|
@@ -1363,7 +1369,7 @@ function DataGridInner({
|
|
|
1363
1369
|
},
|
|
1364
1370
|
"data-col-key": colKey,
|
|
1365
1371
|
onClick: isSortable ? () => handleSortClick(colKey) : void 0,
|
|
1366
|
-
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
1372
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `eidos-datagrid-header-content ${alignClass}`, children: [
|
|
1367
1373
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "eidos-datagrid-header-label", children: col.header }),
|
|
1368
1374
|
isSortable && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "eidos-datagrid-sort-icon", children: [
|
|
1369
1375
|
sortDir === "asc" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArrowUp, { size: 14 }),
|
|
@@ -1383,9 +1389,9 @@ function DataGridInner({
|
|
|
1383
1389
|
}
|
|
1384
1390
|
)
|
|
1385
1391
|
] }) }),
|
|
1386
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1392
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXVSODE4Kcjs.SortableContext, { items: rowIds, strategy: _chunkXVSODE4Kcjs.verticalListSortingStrategy, children: displayData.length > 0 ? displayData.map((row, displayIndex) => {
|
|
1387
1393
|
const localIndex = localData.indexOf(row);
|
|
1388
|
-
const rowKeyValue = String(_nullishCoalesce(row
|
|
1394
|
+
const rowKeyValue = String(_nullishCoalesce(cellOf(row, rowKeyField), () => ( displayIndex)));
|
|
1389
1395
|
const isRowSelected = selectable && selectedSet.has(rowKeyValue);
|
|
1390
1396
|
const isRowExpanded = expandable && expandedSet.has(rowKeyValue);
|
|
1391
1397
|
const canExpandRow = !isRowExpandable || isRowExpandable(row);
|
|
@@ -1487,8 +1493,8 @@ function DataGridInner({
|
|
|
1487
1493
|
}
|
|
1488
1494
|
),
|
|
1489
1495
|
sortedColumns.map((col) => {
|
|
1490
|
-
const value = row
|
|
1491
|
-
const isEditing = _optionalChain([editingCell, 'optionalAccess',
|
|
1496
|
+
const value = cellOf(row, col.key);
|
|
1497
|
+
const isEditing = _optionalChain([editingCell, 'optionalAccess', _32 => _32.rowIndex]) === localIndex && _optionalChain([editingCell, 'optionalAccess', _33 => _33.colKey]) === col.key;
|
|
1492
1498
|
const canEdit = isCellEditable(col);
|
|
1493
1499
|
const isFlagged = cellErrorKey(localIndex, col.key) in cellErrors;
|
|
1494
1500
|
const hasError = isEditing && Boolean(editError);
|
|
@@ -1500,6 +1506,7 @@ function DataGridInner({
|
|
|
1500
1506
|
isFlagged && !hasError && "eidos-data-grid-cell--has-error",
|
|
1501
1507
|
canEdit && !isEditing && "eidos-data-grid-cell--editable",
|
|
1502
1508
|
col.type === "readonly" && "eidos-data-grid-cell--readonly",
|
|
1509
|
+
`eidos-datagrid-align-${_nullishCoalesce(col.align, () => ( "left"))}`,
|
|
1503
1510
|
pinnedClass
|
|
1504
1511
|
].filter(Boolean).join(" ");
|
|
1505
1512
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1606,4 +1613,4 @@ var DataGrid = Object.assign(DataGridInner, { displayName: "DataGrid" });
|
|
|
1606
1613
|
|
|
1607
1614
|
|
|
1608
1615
|
exports.DataGrid = DataGrid;
|
|
1609
|
-
//# sourceMappingURL=chunk-
|
|
1616
|
+
//# sourceMappingURL=chunk-2ZENLZEQ.cjs.map
|