@stenajs-webui/grid 16.0.0 → 17.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/CHANGELOG.md +16 -0
- package/dist/components/GridHooksTable.d.ts +5 -1
- package/dist/index.es.js +131 -140
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +131 -140
- package/dist/index.js.map +1 -1
- package/package.json +17 -17
package/dist/index.js
CHANGED
|
@@ -157,10 +157,10 @@ var tableBorderColor = "var(--lhds-color-ui-300)";
|
|
|
157
157
|
var tableBorderColorExpanded = "var(--lhds-color-blue-500)";
|
|
158
158
|
var tableBackgroundColorExpanded = "var(--lhds-color-blue-50)";
|
|
159
159
|
var tableBackgroundHoverColorExpanded = "var(--lhds-color-blue-100)";
|
|
160
|
-
var tableBorder = "1px solid "
|
|
160
|
+
var tableBorder = "1px solid ".concat(tableBorderColor);
|
|
161
161
|
var tableBorderHidden = "1px solid transparent";
|
|
162
162
|
var tableBorderLeft = "var(--swui-expand-highlight-border-width) solid transparent";
|
|
163
|
-
var tableBorderLeftExpanded = "var(--swui-expand-highlight-border-width) solid "
|
|
163
|
+
var tableBorderLeftExpanded = "var(--swui-expand-highlight-border-width) solid ".concat(tableBorderColorExpanded);
|
|
164
164
|
var defaultTableRowHeight = "40px";
|
|
165
165
|
var defaultTableHeadRowHeight = "40px";
|
|
166
166
|
var smallTableRowWidth = "40px";
|
|
@@ -400,32 +400,34 @@ var isCharacter = function (key) { return !!key.match(/^[-+*<>]$/); };
|
|
|
400
400
|
var isLetter = function (key) { return !!key.match(/^[a-zA-Z0-9]$/); };
|
|
401
401
|
var isNumeric = function (key) { return !isNaN(parseInt(key, 10)); };
|
|
402
402
|
var createKeyDownHandler$1 = function (_, // isEditing
|
|
403
|
-
isEditable, startEditing, setLastKeyEvent, allowedInputType, transformEnteredValue, revertableValue) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
e.preventDefault();
|
|
412
|
-
e.stopPropagation();
|
|
413
|
-
}
|
|
414
|
-
else if (isEditable) {
|
|
415
|
-
// TODO Find nice way to allow full user control, while also providing simplicity.
|
|
416
|
-
var lastKeyEvent = createKeyDownEvent(e);
|
|
417
|
-
if ((isNumeric(e.key) && allowsNumerics(allowedInputType)) ||
|
|
418
|
-
(isLetter(e.key) && allowsLetters(allowedInputType)) ||
|
|
419
|
-
isCharacter(e.key)) {
|
|
420
|
-
startEditing(lastKeyEvent);
|
|
421
|
-
setLastKeyEvent(lastKeyEvent);
|
|
403
|
+
isEditable, startEditing, setLastKeyEvent, allowedInputType, transformEnteredValue, revertableValue) {
|
|
404
|
+
return function (e) {
|
|
405
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
if (e.key === "Enter" && isEditable) {
|
|
409
|
+
setLastKeyEvent(undefined);
|
|
410
|
+
startEditing();
|
|
422
411
|
revertableValue.commit();
|
|
423
|
-
revertableValue.setValue(transformEnteredValue(lastKeyEvent.key));
|
|
424
412
|
e.preventDefault();
|
|
425
413
|
e.stopPropagation();
|
|
426
414
|
}
|
|
427
|
-
|
|
428
|
-
|
|
415
|
+
else if (isEditable) {
|
|
416
|
+
// TODO Find nice way to allow full user control, while also providing simplicity.
|
|
417
|
+
var lastKeyEvent = createKeyDownEvent(e);
|
|
418
|
+
if ((isNumeric(e.key) && allowsNumerics(allowedInputType)) ||
|
|
419
|
+
(isLetter(e.key) && allowsLetters(allowedInputType)) ||
|
|
420
|
+
isCharacter(e.key)) {
|
|
421
|
+
startEditing(lastKeyEvent);
|
|
422
|
+
setLastKeyEvent(lastKeyEvent);
|
|
423
|
+
revertableValue.commit();
|
|
424
|
+
revertableValue.setValue(transformEnteredValue(lastKeyEvent.key));
|
|
425
|
+
e.preventDefault();
|
|
426
|
+
e.stopPropagation();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
};
|
|
429
431
|
|
|
430
432
|
var wrapBounds = function (x, y, maxX, maxY) {
|
|
431
433
|
var realX = x;
|
|
@@ -545,14 +547,8 @@ var useGridNavigation = function (options) {
|
|
|
545
547
|
onCellMove,
|
|
546
548
|
onCellNavigation,
|
|
547
549
|
]);
|
|
548
|
-
var onKeyDown = React.useMemo(function () { return createKeyDownHandler(moveHandler); }, [
|
|
549
|
-
|
|
550
|
-
]);
|
|
551
|
-
var id = React.useMemo(function () { return createCellId(tableId, rowIndex, colIndex); }, [
|
|
552
|
-
tableId,
|
|
553
|
-
rowIndex,
|
|
554
|
-
colIndex,
|
|
555
|
-
]);
|
|
550
|
+
var onKeyDown = React.useMemo(function () { return createKeyDownHandler(moveHandler); }, [moveHandler]);
|
|
551
|
+
var id = React.useMemo(function () { return createCellId(tableId, rowIndex, colIndex); }, [tableId, rowIndex, colIndex]);
|
|
556
552
|
var requiredProps = React.useMemo(function () { return ({
|
|
557
553
|
tabIndex: 0,
|
|
558
554
|
onKeyDown: onKeyDown,
|
|
@@ -564,13 +560,27 @@ var useGridNavigation = function (options) {
|
|
|
564
560
|
requiredProps: requiredProps,
|
|
565
561
|
};
|
|
566
562
|
};
|
|
567
|
-
var createMoveHandler = function (tableId, rowIndex, colIndex, numRows, numCols, edgeMode, onCellMove, onCellNavigation) {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
if (
|
|
573
|
-
onCellMove
|
|
563
|
+
var createMoveHandler = function (tableId, rowIndex, colIndex, numRows, numCols, edgeMode, onCellMove, onCellNavigation) {
|
|
564
|
+
return function (direction) {
|
|
565
|
+
var pos = getNextPositionWrappedOrClamped(rowIndex, colIndex, numRows, numCols, direction, edgeMode);
|
|
566
|
+
var colDidChange = colIndex !== pos.colIndex;
|
|
567
|
+
var rowDidChange = rowIndex !== pos.rowIndex;
|
|
568
|
+
if (colDidChange || rowDidChange) {
|
|
569
|
+
if (onCellMove) {
|
|
570
|
+
onCellMove({
|
|
571
|
+
direction: direction,
|
|
572
|
+
fromRowIndex: rowIndex,
|
|
573
|
+
fromColIndex: colIndex,
|
|
574
|
+
rowIndex: pos.rowIndex,
|
|
575
|
+
colIndex: pos.colIndex,
|
|
576
|
+
colDidChange: colDidChange,
|
|
577
|
+
rowDidChange: rowDidChange,
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
focusOnCell(tableId, pos);
|
|
581
|
+
}
|
|
582
|
+
if (onCellNavigation) {
|
|
583
|
+
onCellNavigation({
|
|
574
584
|
direction: direction,
|
|
575
585
|
fromRowIndex: rowIndex,
|
|
576
586
|
fromColIndex: colIndex,
|
|
@@ -578,56 +588,46 @@ var createMoveHandler = function (tableId, rowIndex, colIndex, numRows, numCols,
|
|
|
578
588
|
colIndex: pos.colIndex,
|
|
579
589
|
colDidChange: colDidChange,
|
|
580
590
|
rowDidChange: rowDidChange,
|
|
591
|
+
cellDidChange: colDidChange || rowDidChange,
|
|
581
592
|
});
|
|
582
593
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
}
|
|
618
|
-
else if (e.key === "ArrowDown") {
|
|
619
|
-
moveHandler("down");
|
|
620
|
-
e.preventDefault();
|
|
621
|
-
e.stopPropagation();
|
|
622
|
-
return true;
|
|
623
|
-
}
|
|
624
|
-
else {
|
|
625
|
-
return false;
|
|
626
|
-
}
|
|
627
|
-
}; };
|
|
594
|
+
};
|
|
595
|
+
};
|
|
596
|
+
var createCellId = function (tableId, rowIndex, colIndex) { return ensureDomIdIsCorrect("table-".concat(tableId, "-").concat(rowIndex, "-").concat(colIndex)); };
|
|
597
|
+
var createKeyDownHandler = function (moveHandler) {
|
|
598
|
+
return function (e) {
|
|
599
|
+
if (e.key === "ArrowLeft") {
|
|
600
|
+
moveHandler("left");
|
|
601
|
+
e.preventDefault();
|
|
602
|
+
e.stopPropagation();
|
|
603
|
+
return true;
|
|
604
|
+
}
|
|
605
|
+
else if (e.key === "ArrowUp") {
|
|
606
|
+
moveHandler("up");
|
|
607
|
+
e.preventDefault();
|
|
608
|
+
e.stopPropagation();
|
|
609
|
+
return true;
|
|
610
|
+
}
|
|
611
|
+
else if (e.key === "ArrowRight") {
|
|
612
|
+
moveHandler("right");
|
|
613
|
+
e.preventDefault();
|
|
614
|
+
e.stopPropagation();
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
617
|
+
else if (e.key === "ArrowDown") {
|
|
618
|
+
moveHandler("down");
|
|
619
|
+
e.preventDefault();
|
|
620
|
+
e.stopPropagation();
|
|
621
|
+
return true;
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
};
|
|
628
628
|
var focusOnCell = function (tableId, pos) {
|
|
629
|
-
var el = (document.querySelector("#"
|
|
630
|
-
document.querySelector("#"
|
|
629
|
+
var el = (document.querySelector("#".concat(createCellId(tableId, pos.rowIndex, pos.colIndex))) ||
|
|
630
|
+
document.querySelector("#".concat(createCellId(tableId, pos.rowIndex, pos.colIndex))));
|
|
631
631
|
if (el) {
|
|
632
632
|
el.focus();
|
|
633
633
|
}
|
|
@@ -770,7 +770,7 @@ var createInternalStandardTableActions = function () { return ({
|
|
|
770
770
|
fields: redux.createEntityActions(),
|
|
771
771
|
}); };
|
|
772
772
|
|
|
773
|
-
var getReducerIdFor = function (reducerId, reducerIdSuffix) { return reducerId
|
|
773
|
+
var getReducerIdFor = function (reducerId, reducerIdSuffix) { return "".concat(reducerId, ".").concat(reducerIdSuffix); };
|
|
774
774
|
|
|
775
775
|
var createStandardTableInitialState = function (sortBy, desc, selectedIds, expandedRows) {
|
|
776
776
|
if (sortBy === void 0) { sortBy = undefined; }
|
|
@@ -1196,7 +1196,7 @@ var getStickyPropsPerColumnWithNoGroups = function (config) {
|
|
|
1196
1196
|
sum[columnId] = {
|
|
1197
1197
|
sticky: sticky,
|
|
1198
1198
|
left: sticky
|
|
1199
|
-
? "calc(var(--current-left-offset) + "
|
|
1199
|
+
? "calc(var(--current-left-offset) + ".concat((_a = columnConfig.left) !== null && _a !== void 0 ? _a : "0px", ")")
|
|
1200
1200
|
: undefined,
|
|
1201
1201
|
right: sticky ? columnConfig.right : undefined,
|
|
1202
1202
|
type: "column",
|
|
@@ -1385,10 +1385,7 @@ var useRowCheckbox = function (item, idListForEnabledItems) {
|
|
|
1385
1385
|
var _a = useStandardTableState(), selectedIds = _a.selectedIds.selectedIds, lastSelectedId = _a.fields.lastSelectedId;
|
|
1386
1386
|
var _b = useStandardTableActions(), _c = _b.actions, setSelectedIds = _c.setSelectedIds, setLastSelectedId = _c.setLastSelectedId, dispatch = _b.dispatch;
|
|
1387
1387
|
var itemKey = React.useMemo(function () { return keyResolver(item); }, [keyResolver, item]);
|
|
1388
|
-
var isSelected = React.useMemo(function () { return selectedIds.includes(itemKey); }, [
|
|
1389
|
-
selectedIds,
|
|
1390
|
-
itemKey,
|
|
1391
|
-
]);
|
|
1388
|
+
var isSelected = React.useMemo(function () { return selectedIds.includes(itemKey); }, [selectedIds, itemKey]);
|
|
1392
1389
|
var _d = core.useArraySet(selectedIds, function (ids) { return dispatch(setSelectedIds(ids)); }), toggle = _d.toggle, addMultiple = _d.addMultiple, removeMultiple = _d.removeMultiple;
|
|
1393
1390
|
var shiftAndToggleSelected = React.useCallback(function () {
|
|
1394
1391
|
if (idListForEnabledItems && lastSelectedId) {
|
|
@@ -1436,10 +1433,7 @@ var useExpandCollapseActions = function (item) {
|
|
|
1436
1433
|
var selectedIds = useStandardTableState().expandedRows.selectedIds;
|
|
1437
1434
|
var _a = useStandardTableActions(), expandByIds = _a.actions.expandByIds, dispatch = _a.dispatch;
|
|
1438
1435
|
var itemKey = React.useMemo(function () { return keyResolver(item); }, [keyResolver, item]);
|
|
1439
|
-
var isExpanded = React.useMemo(function () { return selectedIds.includes(itemKey); }, [
|
|
1440
|
-
selectedIds,
|
|
1441
|
-
itemKey,
|
|
1442
|
-
]);
|
|
1436
|
+
var isExpanded = React.useMemo(function () { return selectedIds.includes(itemKey); }, [selectedIds, itemKey]);
|
|
1443
1437
|
var toggle = core.useArraySet(selectedIds, function (ids) {
|
|
1444
1438
|
return dispatch(expandByIds(ids));
|
|
1445
1439
|
}).toggle;
|
|
@@ -1479,11 +1473,7 @@ var getBackgroundColor$1 = function (backgroundResolver, item, background) {
|
|
|
1479
1473
|
return backgroundResolver ? backgroundResolver(item) : background;
|
|
1480
1474
|
};
|
|
1481
1475
|
var useBackground = function (backgroundResolver, item, background) {
|
|
1482
|
-
return React.useMemo(function () { return getBackgroundColor$1(backgroundResolver, item, background); }, [
|
|
1483
|
-
backgroundResolver,
|
|
1484
|
-
item,
|
|
1485
|
-
background,
|
|
1486
|
-
]);
|
|
1476
|
+
return React.useMemo(function () { return getBackgroundColor$1(backgroundResolver, item, background); }, [backgroundResolver, item, background]);
|
|
1487
1477
|
};
|
|
1488
1478
|
var useCellBackgroundByColumnId = function (columnId, item) {
|
|
1489
1479
|
var _a = useColumnConfigById(columnId), background = _a.background, backgroundResolver = _a.backgroundResolver;
|
|
@@ -1640,20 +1630,20 @@ var StandardTableRowExpansion = function StandardTableRowExpansion(_a) {
|
|
|
1640
1630
|
|
|
1641
1631
|
var TrWithHoverBackground = styled__default["default"].tr(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", ";\n ", ";\n ", ";\n ", "\n"], ["\n ", "\n ", ";\n ", ";\n ", ";\n ", "\n"])), function (_a) {
|
|
1642
1632
|
var focusBackground = _a.focusBackground;
|
|
1643
|
-
return focusBackground ? "--focus-within-background: "
|
|
1633
|
+
return focusBackground ? "--focus-within-background: ".concat(focusBackground, ";") : "";
|
|
1644
1634
|
}, function (_a) {
|
|
1645
1635
|
var borderLeft = _a.borderLeft;
|
|
1646
|
-
return (borderLeft ? "border-left: "
|
|
1636
|
+
return (borderLeft ? "border-left: ".concat(borderLeft, ";") : "");
|
|
1647
1637
|
}, function (_a) {
|
|
1648
1638
|
var background = _a.background;
|
|
1649
|
-
return (background ? "background: "
|
|
1639
|
+
return (background ? "background: ".concat(background, ";") : "");
|
|
1650
1640
|
}, function (_a) {
|
|
1651
1641
|
var height = _a.height;
|
|
1652
|
-
return (height ? "height: "
|
|
1642
|
+
return (height ? "height: ".concat(height, ";") : "");
|
|
1653
1643
|
}, function (_a) {
|
|
1654
1644
|
var hoverBackground = _a.hoverBackground;
|
|
1655
1645
|
return hoverBackground
|
|
1656
|
-
? " &:hover {\n background: "
|
|
1646
|
+
? " &:hover {\n background: ".concat(hoverBackground, ";\n }\n")
|
|
1657
1647
|
: "";
|
|
1658
1648
|
});
|
|
1659
1649
|
var templateObject_1;
|
|
@@ -1676,10 +1666,7 @@ var StandardTableRow = React__namespace.memo(function StandardTableRow(_a) {
|
|
|
1676
1666
|
var background = getBackgroundColor(resolvedBackgroundResult, isSelected, isExpanded);
|
|
1677
1667
|
var hoverBackground = getHoverBackgroundColor(resolvedBackgroundResult, isSelected, isExpanded);
|
|
1678
1668
|
var focusBackground = getFocusBackgroundColor(resolvedBackgroundResult, isSelected, hoverBackground);
|
|
1679
|
-
var disabled = React.useMemo(function () { return checkboxDisabledResolver === null || checkboxDisabledResolver === void 0 ? void 0 : checkboxDisabledResolver(item); }, [
|
|
1680
|
-
item,
|
|
1681
|
-
checkboxDisabledResolver,
|
|
1682
|
-
]);
|
|
1669
|
+
var disabled = React.useMemo(function () { return checkboxDisabledResolver === null || checkboxDisabledResolver === void 0 ? void 0 : checkboxDisabledResolver(item); }, [item, checkboxDisabledResolver]);
|
|
1683
1670
|
var firstColumn = useFirstColumnConfig();
|
|
1684
1671
|
var firstColumnBackground = useCellBackgroundByColumnConfig(firstColumn, item);
|
|
1685
1672
|
var lastColumn = useLastColumnConfig();
|
|
@@ -1821,11 +1808,7 @@ var SummaryCell = React__namespace.memo(function SummaryCell(_a) {
|
|
|
1821
1808
|
? "var(--swui-sticky-column-shadow-right)"
|
|
1822
1809
|
: undefined;
|
|
1823
1810
|
var text = React.useMemo(function () { return summaryText === null || summaryText === void 0 ? void 0 : summaryText({ items: items }); }, [items, summaryText]);
|
|
1824
|
-
var renderResult = React.useMemo(function () { return renderSummaryCell === null || renderSummaryCell === void 0 ? void 0 : renderSummaryCell({ items: items, text: text }); }, [
|
|
1825
|
-
items,
|
|
1826
|
-
renderSummaryCell,
|
|
1827
|
-
text,
|
|
1828
|
-
]);
|
|
1811
|
+
var renderResult = React.useMemo(function () { return renderSummaryCell === null || renderSummaryCell === void 0 ? void 0 : renderSummaryCell({ items: items, text: text }); }, [items, renderSummaryCell, text]);
|
|
1829
1812
|
return (React__namespace.createElement("td", { colSpan: colSpan, style: {
|
|
1830
1813
|
borderLeft: activeBorderLeft,
|
|
1831
1814
|
position: stickyProps.sticky ? "sticky" : undefined,
|
|
@@ -1884,9 +1867,11 @@ var SummaryRowSwitcher = function SummaryRowSwitcher(_a) {
|
|
|
1884
1867
|
return React__namespace.createElement(StandardTableSummaryRow, { items: items });
|
|
1885
1868
|
};
|
|
1886
1869
|
|
|
1887
|
-
var filterItemsOnEnabledCheckboxes = function (checkboxDisabledResolver) {
|
|
1888
|
-
return
|
|
1889
|
-
|
|
1870
|
+
var filterItemsOnEnabledCheckboxes = function (checkboxDisabledResolver) {
|
|
1871
|
+
return function (item) {
|
|
1872
|
+
return (checkboxDisabledResolver === null || checkboxDisabledResolver === void 0 ? void 0 : checkboxDisabledResolver(item)) ? false : true ;
|
|
1873
|
+
};
|
|
1874
|
+
};
|
|
1890
1875
|
|
|
1891
1876
|
var StandardTableRowList = React__namespace.memo(function StandardTableRowList(_a) {
|
|
1892
1877
|
var items = _a.items, _b = _a.colIndexOffset, colIndexOffset = _b === void 0 ? 0 : _b, _c = _a.rowIndexOffset, rowIndexOffset = _c === void 0 ? 0 : _c;
|
|
@@ -2112,10 +2097,10 @@ var StandardTableHeadItem = React__namespace.memo(function StandardTableHeaderIt
|
|
|
2112
2097
|
|
|
2113
2098
|
var getTopPosition = function (headerRowOffsetTop, columnGroupOrder, height, stickyHeader) {
|
|
2114
2099
|
if (headerRowOffsetTop && columnGroupOrder !== undefined) {
|
|
2115
|
-
return "calc("
|
|
2100
|
+
return "calc(".concat(headerRowOffsetTop, " + ").concat(height, ")");
|
|
2116
2101
|
}
|
|
2117
2102
|
else if (stickyHeader && columnGroupOrder) {
|
|
2118
|
-
return "calc(0px + "
|
|
2103
|
+
return "calc(0px + ".concat(height, ")");
|
|
2119
2104
|
}
|
|
2120
2105
|
else if (headerRowOffsetTop) {
|
|
2121
2106
|
return headerRowOffsetTop;
|
|
@@ -2182,7 +2167,7 @@ var ColGroups = function () {
|
|
|
2182
2167
|
var rowIndent = core.booleanOrNumberToNumber(config.rowIndent);
|
|
2183
2168
|
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2184
2169
|
rowIndent ? (React__namespace.createElement("colgroup", null,
|
|
2185
|
-
React__namespace.createElement("col", { style: { width: "calc(var(--swui-metrics-indent) * "
|
|
2170
|
+
React__namespace.createElement("col", { style: { width: "calc(var(--swui-metrics-indent) * ".concat(rowIndent, ")") } }))) : null,
|
|
2186
2171
|
hasExtraColGroup && (React__namespace.createElement("colgroup", null,
|
|
2187
2172
|
config.enableExpandCollapse && (React__namespace.createElement("col", { style: { width: "var(--swui-expand-cell-width)" } })),
|
|
2188
2173
|
config.showRowCheckbox && (React__namespace.createElement("col", { style: { width: "var(--swui-checkbox-cell-width)" } })))),
|
|
@@ -2194,7 +2179,7 @@ var ColGroups = function () {
|
|
|
2194
2179
|
} })); })));
|
|
2195
2180
|
}),
|
|
2196
2181
|
rowIndent ? (React__namespace.createElement("colgroup", null,
|
|
2197
|
-
React__namespace.createElement("col", { style: { width: "calc(var(--swui-metrics-indent) * "
|
|
2182
|
+
React__namespace.createElement("col", { style: { width: "calc(var(--swui-metrics-indent) * ".concat(rowIndent, ")") } }))) : null));
|
|
2198
2183
|
};
|
|
2199
2184
|
|
|
2200
2185
|
var StandardTable = function StandardTable(_a) {
|
|
@@ -2270,24 +2255,30 @@ var createColumnConfig = function (itemValueResolver, options) {
|
|
|
2270
2255
|
return __assign(__assign({}, options), { itemValueResolver: itemValueResolver });
|
|
2271
2256
|
};
|
|
2272
2257
|
|
|
2273
|
-
var createStandardEditableTextCell = function () {
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
React__namespace.createElement(
|
|
2277
|
-
}
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2258
|
+
var createStandardEditableTextCell = function () {
|
|
2259
|
+
return function (_a) {
|
|
2260
|
+
var label = _a.label, _b = _a.gridCell, editorValue = _b.editorValue, isEditing = _b.isEditing, setEditorValue = _b.setEditorValue, stopEditingAndRevert = _b.stopEditingAndRevert, lastKeyEvent = _b.lastKeyEvent, stopEditing = _b.stopEditing, stopEditingAndMove = _b.stopEditingAndMove;
|
|
2261
|
+
return isEditing ? (React__namespace.createElement(forms.TextInput, { onValueChange: setEditorValue, value: editorValue, onDone: stopEditing, onEsc: stopEditingAndRevert, autoFocus: true, selectAllOnMount: !lastKeyEvent, onMove: stopEditingAndMove })) : (React__namespace.createElement(core.Indent, null,
|
|
2262
|
+
React__namespace.createElement(core.Text, { color: "var(--swui-primary-action-color)" }, label)));
|
|
2263
|
+
};
|
|
2264
|
+
};
|
|
2265
|
+
|
|
2266
|
+
var createEditableTextCellWithStatus = function (warningOnEmpty, crudStatusProvider, modifiedFieldProvider) {
|
|
2267
|
+
return function (_a) {
|
|
2268
|
+
var label = _a.label, item = _a.item, _b = _a.gridCell, editorValue = _b.editorValue, isEditing = _b.isEditing, setEditorValue = _b.setEditorValue, stopEditingAndRevert = _b.stopEditingAndRevert, lastKeyEvent = _b.lastKeyEvent, stopEditing = _b.stopEditing, stopEditingAndMove = _b.stopEditingAndMove, isEditable = _a.isEditable;
|
|
2269
|
+
var warnOnEmpty = typeof warningOnEmpty === "function"
|
|
2270
|
+
? warningOnEmpty(item)
|
|
2271
|
+
: warningOnEmpty;
|
|
2272
|
+
var crudStatus = crudStatusProvider
|
|
2273
|
+
? crudStatusProvider(item)
|
|
2274
|
+
: undefined;
|
|
2275
|
+
var modifiedField = modifiedFieldProvider
|
|
2276
|
+
? modifiedFieldProvider(item)
|
|
2277
|
+
: undefined;
|
|
2278
|
+
return isEditable && isEditing ? (React__namespace.createElement(forms.TextInput, { onValueChange: setEditorValue, value: editorValue, onDone: stopEditing, onEsc: stopEditingAndRevert, autoFocus: true, selectAllOnMount: !lastKeyEvent, onMove: stopEditingAndMove })) : (React__namespace.createElement(core.Indent, { row: true, alignItems: "center" },
|
|
2279
|
+
React__namespace.createElement(ModifiedField, { value: label, modifiedField: modifiedField, crudStatus: crudStatus, isEditable: isEditable, warningOnEmpty: warnOnEmpty })));
|
|
2280
|
+
};
|
|
2281
|
+
};
|
|
2291
2282
|
|
|
2292
2283
|
exports.CrudStatusIndicator = CrudStatusIndicator;
|
|
2293
2284
|
exports.EditableTextCellWithCrudAndModified = EditableTextCellWithCrudAndModified;
|