@stenajs-webui/grid 13.4.0 → 14.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/features/standard-table/components/StandardTable.d.ts +5 -0
- package/dist/features/standard-table/components/StandardTableContent.d.ts +1 -1
- package/dist/features/standard-table/config/StandardTableColumnConfig.d.ts +20 -4
- package/dist/features/standard-table/config/StandardTableConfig.d.ts +2 -2
- package/dist/features/standard-table/features/sticky-columns/StickyColumnGroupOffsetCalculator.d.ts +1 -1
- package/dist/features/standard-table/features/summary-row/SummaryRowVisibilityCalculator.d.ts +2 -2
- package/dist/features/standard-table/hooks/UseCellBackground.d.ts +1 -1
- package/dist/features/standard-table/hooks/UseColumnConfigById.d.ts +3 -3
- package/dist/features/standard-table/stories/StandardTable.stories.d.ts +1 -0
- package/dist/features/standard-table/stories/StandardTableStoryHelper.d.ts +1 -0
- package/dist/features/standard-table/stories/States.stories.d.ts +1 -0
- package/dist/features/table-ui/components/CrudStatusIndicator.d.ts +1 -1
- package/dist/index.es.js +36 -17
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +34 -15
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var faExclamationTriangle = require('@fortawesome/free-solid-svg-icons/faExclamationTriangle');
|
|
7
7
|
var elements = require('@stenajs-webui/elements');
|
|
8
|
+
var theme = require('@stenajs-webui/theme');
|
|
8
9
|
var tooltip = require('@stenajs-webui/tooltip');
|
|
9
10
|
var core = require('@stenajs-webui/core');
|
|
10
11
|
var faEllipsisV = require('@fortawesome/free-solid-svg-icons/faEllipsisV');
|
|
11
12
|
var faInfoCircle = require('@fortawesome/free-solid-svg-icons/faInfoCircle');
|
|
12
|
-
var theme = require('@stenajs-webui/theme');
|
|
13
13
|
var faSortAlphaDown = require('@fortawesome/free-solid-svg-icons/faSortAlphaDown');
|
|
14
14
|
var faSortAlphaUp = require('@fortawesome/free-solid-svg-icons/faSortAlphaUp');
|
|
15
15
|
var faSortAmountDownAlt = require('@fortawesome/free-solid-svg-icons/faSortAmountDownAlt');
|
|
@@ -51,10 +51,10 @@ var CrudStatusIndicator = function (_a) {
|
|
|
51
51
|
}
|
|
52
52
|
var errorMessage = crudStatus.errorMessage, hasError = crudStatus.hasError, loading = crudStatus.loading, creating = crudStatus.creating, deleting = crudStatus.deleting, updating = crudStatus.updating;
|
|
53
53
|
if (loading || creating || deleting || updating) {
|
|
54
|
-
return React.createElement(elements.InputSpinner, { color: "
|
|
54
|
+
return React.createElement(elements.InputSpinner, { color: theme.cssColor("--lhds-color-ui-500") });
|
|
55
55
|
}
|
|
56
56
|
if (hasError) {
|
|
57
|
-
var icon = (React.createElement(elements.Icon, { icon: faExclamationTriangle.faExclamationTriangle, color: "
|
|
57
|
+
var icon = (React.createElement(elements.Icon, { icon: faExclamationTriangle.faExclamationTriangle, color: theme.cssColor("--lhds-color-orange-600"), size: 14 }));
|
|
58
58
|
return (React.createElement(React.Fragment, null, errorMessage ? (React.createElement(tooltip.Tooltip, { label: errorMessage, zIndex: 100 }, icon)) : (icon)));
|
|
59
59
|
}
|
|
60
60
|
return null;
|
|
@@ -73,7 +73,7 @@ var ModifiedField = function (_a) {
|
|
|
73
73
|
React.createElement(core.Text, { color: "var(--swui-primary-action-color)", variant: "bold" }, modifiedField.newValue))),
|
|
74
74
|
hasRightIcon && React.createElement(core.Space, null),
|
|
75
75
|
showEmptyFieldWarning ? (React.createElement(tooltip.Tooltip, { label: warningOnEmpty, zIndex: 100 },
|
|
76
|
-
React.createElement(elements.Icon, { icon: faExclamationTriangle.faExclamationTriangle, color: "
|
|
76
|
+
React.createElement(elements.Icon, { icon: faExclamationTriangle.faExclamationTriangle, color: theme.cssColor("--lhds-color-orange-600"), size: 14 }))) : (React.createElement(CrudStatusIndicator, { crudStatus: crudStatus }))));
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
/*! *****************************************************************************
|
|
@@ -1257,7 +1257,8 @@ var useLocalStateTableContext = function (tableId, initialState) {
|
|
|
1257
1257
|
};
|
|
1258
1258
|
|
|
1259
1259
|
var getTotalNumColumns = function (config) {
|
|
1260
|
-
return (config.
|
|
1260
|
+
return (config.rowIndent ? 2 : 0) +
|
|
1261
|
+
(config.enableExpandCollapse ? 1 : 0) +
|
|
1261
1262
|
(config.showRowCheckbox ? 1 : 0) +
|
|
1262
1263
|
getNumUserColumns(config);
|
|
1263
1264
|
};
|
|
@@ -1514,14 +1515,14 @@ var StandardTableCell = React.memo(function StandardTableCell(_a) {
|
|
|
1514
1515
|
var _c = useStandardTableConfig(), keyResolver = _c.keyResolver, enableGridCell = _c.enableGridCell, gridCellOptionsForTable = _c.gridCellOptions;
|
|
1515
1516
|
var selectedIds = useStandardTableState().selectedIds.selectedIds;
|
|
1516
1517
|
var tableId = useStandardTableId();
|
|
1517
|
-
var
|
|
1518
|
+
var onKeyDownTable = useOnKeyDownContext();
|
|
1518
1519
|
var numNavigableColumns = useColumnIndexPerColumnIdContext().numNavigableColumns;
|
|
1519
1520
|
var stickyPropsPerColumnContext = useStickyPropsPerColumnContext();
|
|
1520
1521
|
var isSelected = React.useMemo(function () {
|
|
1521
1522
|
var itemId = keyResolver(item);
|
|
1522
1523
|
return selectedIds.indexOf(itemId) >= 0;
|
|
1523
1524
|
}, [item, keyResolver, selectedIds]);
|
|
1524
|
-
var _d = useColumnConfigById(columnId), itemValueResolver = _d.itemValueResolver, itemLabelFormatter = _d.itemLabelFormatter, width = _d.width, minWidth = _d.minWidth, _e = _d.justifyContentCell, justifyContentCell = _e === void 0 ? "flex-start" : _e, borderLeft = _d.borderLeft, renderCell = _d.renderCell, gridCellOptionsForColumn = _d.gridCellOptions, isEditable = _d.isEditable, onChange = _d.onChange, disableGridCell = _d.disableGridCell, zIndex = _d.zIndex;
|
|
1525
|
+
var _d = useColumnConfigById(columnId), itemValueResolver = _d.itemValueResolver, itemLabelFormatter = _d.itemLabelFormatter, width = _d.width, minWidth = _d.minWidth, _e = _d.justifyContentCell, justifyContentCell = _e === void 0 ? "flex-start" : _e, borderLeft = _d.borderLeft, renderCell = _d.renderCell, gridCellOptionsForColumn = _d.gridCellOptions, isEditable = _d.isEditable, onChange = _d.onChange, onKeyDownCell = _d.onKeyDown, disableGridCell = _d.disableGridCell, disableGridCellFocus = _d.disableGridCellFocus, zIndex = _d.zIndex;
|
|
1525
1526
|
var itemValue = React.useMemo(function () {
|
|
1526
1527
|
if (itemValueResolver) {
|
|
1527
1528
|
return itemValueResolver(item);
|
|
@@ -1542,8 +1543,13 @@ var StandardTableCell = React.memo(function StandardTableCell(_a) {
|
|
|
1542
1543
|
? isEditable(item)
|
|
1543
1544
|
: undefined;
|
|
1544
1545
|
var onKeyDownHandler = React.useCallback(function (ev) {
|
|
1545
|
-
|
|
1546
|
-
|
|
1546
|
+
onKeyDownTable === null || onKeyDownTable === void 0 ? void 0 : onKeyDownTable(ev, { columnId: columnId, item: item });
|
|
1547
|
+
onKeyDownCell === null || onKeyDownCell === void 0 ? void 0 : onKeyDownCell(ev, { columnId: columnId, item: item });
|
|
1548
|
+
if (ev.key !== "Tab" && (onKeyDownTable || onKeyDownCell)) {
|
|
1549
|
+
ev.preventDefault();
|
|
1550
|
+
ev.stopPropagation();
|
|
1551
|
+
}
|
|
1552
|
+
}, [onKeyDownTable, columnId, item, onKeyDownCell]);
|
|
1547
1553
|
var gridCell = useGridCell(label, __assign(__assign({ colIndex: colIndex,
|
|
1548
1554
|
rowIndex: rowIndex,
|
|
1549
1555
|
numRows: numRows, numCols: numNavigableColumns, tableId: tableId, isEditable: editable, onChange: onChange
|
|
@@ -1593,7 +1599,7 @@ var StandardTableCell = React.memo(function StandardTableCell(_a) {
|
|
|
1593
1599
|
height: "var(--current-row-height)",
|
|
1594
1600
|
background: background,
|
|
1595
1601
|
} },
|
|
1596
|
-
React.createElement(StandardTableCellUi, { enableGridCell: enableGridCell && !disableGridCell, gridCellRequiredProps: gridCell.requiredProps, isEditing: gridCell.isEditing, width: width, minWidth: minWidth, justifyContent: justifyContentCell, onKeyDown: onKeyDownHandler }, content)));
|
|
1602
|
+
React.createElement(StandardTableCellUi, { enableGridCell: enableGridCell && !disableGridCell && !disableGridCellFocus, gridCellRequiredProps: gridCell.requiredProps, isEditing: gridCell.isEditing, width: width, minWidth: minWidth, justifyContent: justifyContentCell, onKeyDown: onKeyDownHandler }, content)));
|
|
1597
1603
|
});
|
|
1598
1604
|
|
|
1599
1605
|
var StandardTableRowExpansion = function StandardTableRowExpansion(_a) {
|
|
@@ -1912,14 +1918,24 @@ var StandardTableRowList = React.memo(function StandardTableRowList(_a) {
|
|
|
1912
1918
|
});
|
|
1913
1919
|
|
|
1914
1920
|
var StandardTableContent = React.memo(function StandardTableContent(_a) {
|
|
1915
|
-
var
|
|
1921
|
+
var _b;
|
|
1922
|
+
var error = _a.error, bannerError = _a.bannerError, loading = _a.loading, items = _a.items, _c = _a.noItemsLabel, noItemsLabel = _c === void 0 ? "There is no data available." : _c, noItemsContentRight = _a.noItemsContentRight, noItemsContentBottom = _a.noItemsContentBottom, noItemsHeader = _a.noItemsHeader, colIndexOffset = _a.colIndexOffset, rowIndexOffset = _a.rowIndexOffset, variant = _a.variant, errorLabel = _a.errorLabel;
|
|
1916
1923
|
var totalNumColumns = useTotalNumColumns();
|
|
1917
|
-
if (
|
|
1924
|
+
if (bannerError) {
|
|
1918
1925
|
return (React.createElement("tbody", null,
|
|
1919
1926
|
React.createElement("tr", null,
|
|
1920
1927
|
React.createElement("td", { colSpan: totalNumColumns },
|
|
1921
|
-
React.createElement(core.Spacing, { num: 4 },
|
|
1922
|
-
React.createElement(
|
|
1928
|
+
React.createElement(core.Spacing, { num: 4, justifyContent: "center" },
|
|
1929
|
+
React.createElement(core.Box, { alignItems: "center" },
|
|
1930
|
+
React.createElement(elements.ResultListBanner, { bannerState: bannerError, variant: "error" })))))));
|
|
1931
|
+
}
|
|
1932
|
+
if (error || errorLabel) {
|
|
1933
|
+
return (React.createElement("tbody", null,
|
|
1934
|
+
React.createElement("tr", null,
|
|
1935
|
+
React.createElement("td", { colSpan: totalNumColumns },
|
|
1936
|
+
React.createElement(core.Spacing, { num: 4, justifyContent: "center" },
|
|
1937
|
+
React.createElement(core.Box, { alignItems: "center" },
|
|
1938
|
+
React.createElement(elements.Banner, { headerText: (_b = (error ? error.message : errorLabel)) !== null && _b !== void 0 ? _b : "Unknown error", variant: "error" })))))));
|
|
1923
1939
|
}
|
|
1924
1940
|
if (loading) {
|
|
1925
1941
|
return (React.createElement("tbody", null,
|
|
@@ -2178,7 +2194,10 @@ var StandardTable = function StandardTable(_a) {
|
|
|
2178
2194
|
return undefined;
|
|
2179
2195
|
}
|
|
2180
2196
|
catch (e) {
|
|
2181
|
-
|
|
2197
|
+
if (e instanceof Error) {
|
|
2198
|
+
return e;
|
|
2199
|
+
}
|
|
2200
|
+
return new Error("Unknown error");
|
|
2182
2201
|
}
|
|
2183
2202
|
}, [config]);
|
|
2184
2203
|
if (validationError) {
|