@carbon/ibm-products 1.61.1 → 1.62.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +156 -68
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +1753 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +156 -68
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +156 -68
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- package/css/index.min.css.map +1 -1
- package/es/components/Coachmark/Coachmark.js +17 -5
- package/es/components/Coachmark/CoachmarkDragbar.js +12 -5
- package/es/components/Coachmark/CoachmarkHeader.js +2 -1
- package/es/components/Coachmark/CoachmarkOverlay.js +105 -9
- package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +5 -2
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +26 -6
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +28 -3
- package/es/components/CoachmarkStack/CoachmarkStack.js +19 -4
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +45 -11
- package/es/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +4 -4
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +41 -25
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +5 -2
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +12 -11
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +29 -23
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +18 -18
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +50 -14
- package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
- package/es/components/Datagrid/useActionsColumn.js +9 -9
- package/es/components/Datagrid/useDatagrid.js +13 -1
- package/es/components/Datagrid/useFlexResize.js +19 -9
- package/es/components/Datagrid/useInfiniteScroll.js +10 -9
- package/es/components/Datagrid/useOnRowClick.js +6 -7
- package/es/components/Datagrid/useParentDimensions.js +6 -6
- package/es/components/Datagrid/useResizeTable.js +7 -7
- package/es/components/Datagrid/useSelectAllToggle.js +2 -2
- package/es/components/Datagrid/useSelectRows.js +31 -21
- package/es/components/Datagrid/useSkeletonRows.js +6 -6
- package/es/components/Datagrid/useSortableColumns.js +4 -5
- package/es/components/Datagrid/useStickyColumn.js +13 -6
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -0
- package/es/components/EmptyStates/assets/ErrorIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NoDataIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +6 -4
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -4
- package/es/global/js/hooks/index.js +3 -2
- package/es/global/js/hooks/usePrefix.js +11 -0
- package/es/global/js/package-settings.js +1 -2
- package/lib/components/Coachmark/Coachmark.js +16 -4
- package/lib/components/Coachmark/CoachmarkDragbar.js +12 -5
- package/lib/components/Coachmark/CoachmarkHeader.js +2 -1
- package/lib/components/Coachmark/CoachmarkOverlay.js +105 -8
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +5 -2
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +25 -5
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +28 -3
- package/lib/components/CoachmarkStack/CoachmarkStack.js +18 -3
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +44 -10
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +4 -4
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +41 -32
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +5 -2
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +6 -4
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +29 -23
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +12 -12
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +52 -15
- package/lib/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
- package/lib/components/Datagrid/useActionsColumn.js +9 -12
- package/lib/components/Datagrid/useDatagrid.js +13 -1
- package/lib/components/Datagrid/useFlexResize.js +19 -9
- package/lib/components/Datagrid/useInfiniteScroll.js +9 -9
- package/lib/components/Datagrid/useOnRowClick.js +6 -7
- package/lib/components/Datagrid/useParentDimensions.js +5 -6
- package/lib/components/Datagrid/useResizeTable.js +6 -7
- package/lib/components/Datagrid/useSelectAllToggle.js +2 -2
- package/lib/components/Datagrid/useSelectRows.js +31 -21
- package/lib/components/Datagrid/useSkeletonRows.js +6 -6
- package/lib/components/Datagrid/useSortableColumns.js +4 -5
- package/lib/components/Datagrid/useStickyColumn.js +8 -0
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -0
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -4
- package/lib/global/js/hooks/index.js +8 -1
- package/lib/global/js/hooks/usePrefix.js +19 -0
- package/lib/global/js/package-settings.js +1 -2
- package/package.json +2 -2
- package/scss/components/Checklist/_checklist.scss +13 -25
- package/scss/components/Coachmark/styles/_coachmark-dragbar.scss +1 -45
- package/scss/components/Coachmark/styles/_coachmark-header.scss +0 -33
- package/scss/components/Coachmark/styles/_coachmark-overlay.scss +113 -5
- package/scss/components/Coachmark/styles/_coachmark-tagline.scss +18 -0
- package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +19 -1
- package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +2 -0
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -0
- package/scss/components/CoachmarkStack/_coachmark-stack.scss +3 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +31 -5
- package/scss/components/Datagrid/styles/_useNestedRows.scss +1 -1
- package/scss/components/_index-released-only.scss +1 -0
@@ -31,7 +31,7 @@ var TableContainer = DataTable.TableContainer,
|
|
31
31
|
Table = DataTable.Table;
|
32
32
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
33
33
|
export var DatagridContent = function DatagridContent(_ref) {
|
34
|
-
var
|
34
|
+
var _cx5;
|
35
35
|
var datagridState = _ref.datagridState,
|
36
36
|
title = _ref.title;
|
37
37
|
var _useContext = useContext(InlineEditContext),
|
@@ -44,8 +44,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
44
44
|
var activeCellId = inlineEditState.activeCellId,
|
45
45
|
gridActive = inlineEditState.gridActive,
|
46
46
|
editId = inlineEditState.editId;
|
47
|
-
var
|
48
|
-
getTableProps = _datagridState$getTab === void 0 ? function () {} : _datagridState$getTab,
|
47
|
+
var getTableProps = datagridState.getTableProps,
|
49
48
|
getFilterFlyoutProps = datagridState.getFilterFlyoutProps,
|
50
49
|
withVirtualScroll = datagridState.withVirtualScroll,
|
51
50
|
DatagridPagination = datagridState.DatagridPagination,
|
@@ -68,6 +67,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
68
67
|
state = datagridState.state,
|
69
68
|
page = datagridState.page,
|
70
69
|
rows = datagridState.rows;
|
70
|
+
var columnResizing = state.columnResizing;
|
71
71
|
var contentRows = DatagridPagination && page || rows;
|
72
72
|
var gridAreaRef = useRef();
|
73
73
|
var multiKeyTrackingRef = useRef();
|
@@ -89,10 +89,11 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
89
89
|
var renderTable = function renderTable() {
|
90
90
|
var _getTableProps;
|
91
91
|
return /*#__PURE__*/React.createElement(Table, _extends({}, getTableProps(), {
|
92
|
-
className: cx(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), _defineProperty({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), _defineProperty({}, "".concat(blockClass, "__table-grid-active"), gridActive), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
|
92
|
+
className: cx(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), _defineProperty({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), _defineProperty({}, "".concat(blockClass, "__table-grid-active"), gridActive), _defineProperty({}, "".concat(blockClass, "__table-is-resizing"), typeof columnResizing.isResizingColumn === 'string'), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
|
93
93
|
role: withInlineEdit && 'grid',
|
94
94
|
tabIndex: withInlineEdit && 0,
|
95
|
-
onKeyDown:
|
95
|
+
onKeyDown: /* istanbul ignore next */
|
96
|
+
withInlineEdit && function (event) {
|
96
97
|
return handleGridKeyPress({
|
97
98
|
event: event,
|
98
99
|
dispatch: dispatch,
|
@@ -101,10 +102,10 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
101
102
|
state: inlineEditState,
|
102
103
|
usingMac: usingMac
|
103
104
|
});
|
104
|
-
}
|
105
|
-
onFocus: withInlineEdit
|
105
|
+
},
|
106
|
+
onFocus: withInlineEdit && function () {
|
106
107
|
return handleGridFocus(inlineEditState, dispatch);
|
107
|
-
}
|
108
|
+
},
|
108
109
|
title: title
|
109
110
|
}), !withVirtualScroll && /*#__PURE__*/React.createElement(DatagridHead, datagridState), /*#__PURE__*/React.createElement(DatagridBody, _extends({}, datagridState, {
|
110
111
|
rows: contentRows
|
@@ -133,6 +134,8 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
133
134
|
useSubscribeToEventEmitter(CLEAR_SINGLE_FILTER, function (id) {
|
134
135
|
return clearSingleFilter(id, setAllFilters, state);
|
135
136
|
});
|
137
|
+
|
138
|
+
/* istanbul ignore next */
|
136
139
|
var renderFilterSummary = function renderFilterSummary() {
|
137
140
|
return state.filters.length > 0 && /*#__PURE__*/React.createElement(FilterSummary, {
|
138
141
|
className: "".concat(blockClass, "__filter-summary"),
|
@@ -145,7 +148,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
145
148
|
});
|
146
149
|
};
|
147
150
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableContainer, {
|
148
|
-
className: cx("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : '', (
|
151
|
+
className: cx("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : '', (_cx5 = {}, _defineProperty(_cx5, "".concat(blockClass, "__grid-container-grid-active"), gridActive), _defineProperty(_cx5, "".concat(blockClass, "__grid-container-inline-edit"), withInlineEdit), _defineProperty(_cx5, "".concat(blockClass, "__grid-container-grid-active--without-toolbar"), withInlineEdit && !DatagridActions), _cx5)),
|
149
152
|
title: gridTitle,
|
150
153
|
description: gridDescription
|
151
154
|
}, /*#__PURE__*/React.createElement(DatagridToolbar, datagridState), /*#__PURE__*/React.createElement("div", {
|
@@ -13,10 +13,10 @@ var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
13
13
|
var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentComponent) {
|
14
14
|
return function (datagridState) {
|
15
15
|
var row = datagridState.row;
|
16
|
-
var
|
17
|
-
expandedContentHeight = _ref.expandedContentHeight;
|
16
|
+
var expandedContentHeight = row.expandedContentHeight;
|
18
17
|
var toggleParentHoverClass = function toggleParentHoverClass(event, eventType) {
|
19
18
|
var _event$target, _event$target$parentN;
|
19
|
+
/* istanbul ignore else */
|
20
20
|
if (event !== null && event !== void 0 && (_event$target = event.target) !== null && _event$target !== void 0 && (_event$target$parentN = _event$target.parentNode) !== null && _event$target$parentN !== void 0 && _event$target$parentN.previousElementSibling) {
|
21
21
|
var parentNode = event.target.parentNode.previousElementSibling;
|
22
22
|
if (eventType === 'enter') {
|
@@ -37,9 +37,9 @@ var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentCompone
|
|
37
37
|
}, /*#__PURE__*/React.createElement("div", {
|
38
38
|
className: "".concat(blockClass, "__expanded-row-content"),
|
39
39
|
style: {
|
40
|
-
height: expandedContentHeight
|
40
|
+
height: expandedContentHeight && expandedContentHeight
|
41
41
|
}
|
42
|
-
}, ExpandedRowContentComponent
|
42
|
+
}, /*#__PURE__*/React.createElement(ExpandedRowContentComponent, datagridState)));
|
43
43
|
};
|
44
44
|
};
|
45
45
|
export default DatagridExpandedRow;
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
4
6
|
/**
|
5
7
|
* Copyright IBM Corp. 2020, 2023
|
6
8
|
*
|
@@ -28,35 +30,45 @@ var getAccessibilityProps = function getAccessibilityProps(header) {
|
|
28
30
|
return props;
|
29
31
|
};
|
30
32
|
var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
33
|
+
var resizerAriaLabel = datagridState.resizerAriaLabel;
|
31
34
|
// Used to measure the height of the table and uses that value
|
32
35
|
// to display a vertical line to indicate the column you are resizing
|
33
36
|
useEffect(function () {
|
34
37
|
var tableId = datagridState.tableId;
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
var
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
});
|
55
|
-
}
|
38
|
+
var gridElement = document.querySelector("#".concat(tableId));
|
39
|
+
var tableElement = gridElement.querySelector('table');
|
40
|
+
var headerRowElement = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head"));
|
41
|
+
var hasHorizontalScrollbar = tableElement.scrollWidth > tableElement.clientWidth;
|
42
|
+
var scrollBuffer = hasHorizontalScrollbar ? 18 : 2;
|
43
|
+
var tableToolbar = gridElement.querySelector(".".concat(blockClass, "__table-toolbar"));
|
44
|
+
var tableToolbarHeight = (tableToolbar === null || tableToolbar === void 0 ? void 0 : tableToolbar.offsetHeight) || 0;
|
45
|
+
var setCustomValues = function setCustomValues(_ref) {
|
46
|
+
var _ref$rowHeight = _ref.rowHeight,
|
47
|
+
rowHeight = _ref$rowHeight === void 0 ? 48 : _ref$rowHeight,
|
48
|
+
gridHeight = _ref.gridHeight;
|
49
|
+
headerRowElement.style.setProperty("--".concat(blockClass, "--row-height"), px(rowHeight));
|
50
|
+
headerRowElement.style.setProperty("--".concat(blockClass, "--grid-height"), px(gridHeight - scrollBuffer - tableToolbarHeight));
|
51
|
+
headerRowElement.style.setProperty("--".concat(blockClass, "--header-height"), px(headerRowElement.offsetHeight));
|
52
|
+
};
|
53
|
+
setCustomValues({
|
54
|
+
gridHeight: gridElement.offsetHeight,
|
55
|
+
rowHeight: headerRowElement.clientHeight
|
56
|
+
});
|
56
57
|
}, [datagridState.rowSize, datagridState.tableId, datagridState]);
|
57
58
|
var _useState = useState(2),
|
58
59
|
_useState2 = _slicedToArray(_useState, 1),
|
59
60
|
incrementAmount = _useState2[0];
|
61
|
+
var handleOnMouseDownResize = function handleOnMouseDownResize(event, resizeProps) {
|
62
|
+
var _resizeProps = _objectSpread({}, resizeProps()),
|
63
|
+
onMouseDown = _resizeProps.onMouseDown;
|
64
|
+
// When event.button is 2, that is a right click
|
65
|
+
// and we do not want to resize
|
66
|
+
if (event.button === 2 || event.ctrlKey) {
|
67
|
+
event.target.blur();
|
68
|
+
return;
|
69
|
+
}
|
70
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
|
71
|
+
};
|
60
72
|
return /*#__PURE__*/React.createElement(TableRow, _extends({}, headerGroup.getHeaderGroupProps({
|
61
73
|
role: false
|
62
74
|
}), {
|
@@ -80,15 +92,19 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
80
92
|
dispatch = datagridState.dispatch,
|
81
93
|
onColResizeEnd = datagridState.onColResizeEnd;
|
82
94
|
var columnResizing = state.columnResizing;
|
83
|
-
var
|
95
|
+
var _ref4 = columnResizing || {},
|
96
|
+
columnWidths = _ref4.columnWidths;
|
84
97
|
var originalCol = visibleColumns[index];
|
85
98
|
return /*#__PURE__*/React.createElement(TableHeader, _extends({}, header.getHeaderProps({
|
86
99
|
role: false
|
87
100
|
}), {
|
88
|
-
className: cx((_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__resizableColumn"), header.getResizerProps), _defineProperty(_cx, "".concat(blockClass, "__isResizing"), header.isResizing), _defineProperty(_cx, "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), _defineProperty(_cx, "".concat(blockClass, "__isSorted"), header.isSorted), _cx), header.getHeaderProps().className),
|
101
|
+
className: cx((_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__resizableColumn"), header.getResizerProps), _defineProperty(_cx, "".concat(blockClass, "__isResizing"), header.isResizing), _defineProperty(_cx, "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), _defineProperty(_cx, "".concat(blockClass, "__isSorted"), header.isSorted), _defineProperty(_cx, "".concat(blockClass, "__header-actions-column"), header.isAction), _cx), header.getHeaderProps().className),
|
89
102
|
key: header.id,
|
90
103
|
"aria-hidden": header.id === 'spacer' && 'true'
|
91
|
-
}, getAccessibilityProps(header)), header.render('Header'), header.getResizerProps && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({}, header.getResizerProps(), {
|
104
|
+
}, getAccessibilityProps(header)), header.render('Header'), header.getResizerProps && !header.isAction && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({}, header.getResizerProps(), {
|
105
|
+
onMouseDown: function onMouseDown(event) {
|
106
|
+
return handleOnMouseDownResize(event, header.getResizerProps);
|
107
|
+
},
|
92
108
|
onKeyDown: function onKeyDown(event) {
|
93
109
|
var key = event.key;
|
94
110
|
if (key === 'ArrowLeft' || key === 'ArrowRight') {
|
@@ -112,7 +128,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
112
128
|
className: cx("".concat(blockClass, "__col-resizer-range")),
|
113
129
|
type: "range",
|
114
130
|
defaultValue: originalCol.width,
|
115
|
-
"aria-label":
|
131
|
+
"aria-label": resizerAriaLabel || 'Resize column'
|
116
132
|
})), /*#__PURE__*/React.createElement("span", {
|
117
133
|
className: "".concat(blockClass, "__col-resize-indicator")
|
118
134
|
})));
|
@@ -28,8 +28,11 @@ var DatagridRefBody = function DatagridRefBody(datagridState) {
|
|
28
28
|
className: cx("".concat(blockClass, "__simple-body"), getTableBodyProps().className)
|
29
29
|
}), rows.map(function (row) {
|
30
30
|
prepareRow(row);
|
31
|
+
var _row$getRowProps = row.getRowProps(),
|
32
|
+
key = _row$getRowProps.key;
|
31
33
|
return row.RowRenderer(_objectSpread(_objectSpread({}, datagridState), {}, {
|
32
|
-
row: row
|
34
|
+
row: row,
|
35
|
+
key: key
|
33
36
|
}));
|
34
37
|
}));
|
35
38
|
};
|
@@ -35,7 +35,8 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
35
35
|
var row = datagridState.row,
|
36
36
|
rowSize = datagridState.rowSize,
|
37
37
|
withNestedRows = datagridState.withNestedRows,
|
38
|
-
prepareRow = datagridState.prepareRow
|
38
|
+
prepareRow = datagridState.prepareRow,
|
39
|
+
key = datagridState.key;
|
39
40
|
var getVisibleNestedRowCount = function getVisibleNestedRowCount(_ref) {
|
40
41
|
var isExpanded = _ref.isExpanded,
|
41
42
|
subRows = _ref.subRows;
|
@@ -93,7 +94,9 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
93
94
|
}
|
94
95
|
};
|
95
96
|
var rowClassNames = cx("".concat(blockClass, "__carbon-row"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), _defineProperty(_cx, "".concat(blockClass, "__carbon-row-expandable"), row.canExpand), _defineProperty(_cx, "".concat(carbon.prefix, "--data-table--selected"), row.isSelected), _cx));
|
96
|
-
return /*#__PURE__*/React.createElement(React.Fragment,
|
97
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
98
|
+
key: key
|
99
|
+
}, /*#__PURE__*/React.createElement(TableRow, _extends({
|
97
100
|
className: rowClassNames
|
98
101
|
}, row.getRowProps({
|
99
102
|
role: false
|
@@ -3,14 +3,13 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
5
5
|
var _excluded = ["onChange"];
|
6
|
-
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
6
|
+
/**
|
7
|
+
* Copyright IBM Corp. 2020, 2023
|
8
|
+
*
|
9
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
12
11
|
*/
|
13
|
-
|
12
|
+
|
14
13
|
import React, { useLayoutEffect, useState } from 'react';
|
15
14
|
import { DataTable } from 'carbon-components-react';
|
16
15
|
import cx from 'classnames';
|
@@ -23,6 +22,7 @@ var SelectAll = function SelectAll(datagridState) {
|
|
23
22
|
windowSize = _useState2[0],
|
24
23
|
setWindowSize = _useState2[1];
|
25
24
|
useLayoutEffect(function () {
|
25
|
+
/* istanbul ignore next */
|
26
26
|
function updateSize() {
|
27
27
|
setWindowSize(window.innerWidth);
|
28
28
|
}
|
@@ -43,15 +43,15 @@ var SelectAll = function SelectAll(datagridState) {
|
|
43
43
|
var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
|
44
44
|
if (hideSelectAll || radio) {
|
45
45
|
return /*#__PURE__*/React.createElement("div", {
|
46
|
-
className: cx("".concat(blockClass, "__head-hidden-select-all"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"),
|
46
|
+
className: cx("".concat(blockClass, "__head-hidden-select-all"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), /* istanbul ignore next */
|
47
|
+
isFirstColumnStickyLeft && windowSize > 671))
|
47
48
|
});
|
48
49
|
}
|
49
50
|
var getProps = DatagridPagination ? getToggleAllPageRowsSelectedProps : getToggleAllRowsSelectedProps;
|
50
51
|
var _getProps = getProps(),
|
51
52
|
onChange = _getProps.onChange,
|
52
53
|
selectProps = _objectWithoutProperties(_getProps, _excluded);
|
53
|
-
var
|
54
|
-
indeterminate = _ref.indeterminate;
|
54
|
+
var indeterminate = selectProps.indeterminate;
|
55
55
|
var handleSelectAllChange = function handleSelectAllChange(event) {
|
56
56
|
if (indeterminate) {
|
57
57
|
return onChange === null || onChange === void 0 ? void 0 : onChange({
|
@@ -63,7 +63,8 @@ var SelectAll = function SelectAll(datagridState) {
|
|
63
63
|
return onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
64
64
|
};
|
65
65
|
return /*#__PURE__*/React.createElement("div", {
|
66
|
-
className: cx("".concat(blockClass, "__head-select-all"), "".concat(blockClass, "__checkbox-cell"), _defineProperty({}, "".concat(blockClass, "__checkbox-cell-sticky-left"),
|
66
|
+
className: cx("".concat(blockClass, "__head-select-all"), "".concat(blockClass, "__checkbox-cell"), _defineProperty({}, "".concat(blockClass, "__checkbox-cell-sticky-left"), /* istanbul ignore next */
|
67
|
+
isFirstColumnStickyLeft && windowSize > 671))
|
67
68
|
}, /*#__PURE__*/React.createElement(TableSelectAll, _extends({}, selectProps, {
|
68
69
|
name: "".concat(tableId, "-select-all-checkbox-name"),
|
69
70
|
onSelect: handleSelectAllChange,
|
@@ -25,8 +25,11 @@ var DatagridSimpleBody = function DatagridSimpleBody(datagridState) {
|
|
25
25
|
className: cx("".concat(blockClass, "__simple-body"), getTableBodyProps().className)
|
26
26
|
}), rows.map(function (row) {
|
27
27
|
prepareRow(row);
|
28
|
+
var _row$getRowProps = row.getRowProps(),
|
29
|
+
key = _row$getRowProps.key;
|
28
30
|
return row.RowRenderer(_objectSpread(_objectSpread({}, datagridState), {}, {
|
29
|
-
row: row
|
31
|
+
row: row,
|
32
|
+
key: key
|
30
33
|
}));
|
31
34
|
}));
|
32
35
|
};
|
@@ -15,9 +15,10 @@ import { ButtonMenu, ButtonMenuItem } from '../../ButtonMenu';
|
|
15
15
|
import { pkg, carbon } from '../../../settings';
|
16
16
|
import cx from 'classnames';
|
17
17
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
18
|
+
var toolbarClass = "".concat(blockClass, "__table-toolbar");
|
19
|
+
var menuClass = "".concat(blockClass, "__button-menu");
|
18
20
|
var TableToolbar = DataTable.TableToolbar;
|
19
21
|
var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridState, width, ref) {
|
20
|
-
var _Object$keys;
|
21
22
|
var _useState = useState(false),
|
22
23
|
_useState2 = _slicedToArray(_useState, 2),
|
23
24
|
displayAllInMenu = _useState2[0],
|
@@ -33,8 +34,12 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
33
34
|
var selectedRowIds = datagridState.state.selectedRowIds,
|
34
35
|
toggleAllRowsSelected = datagridState.toggleAllRowsSelected,
|
35
36
|
toolbarBatchActions = datagridState.toolbarBatchActions,
|
36
|
-
setGlobalFilter = datagridState.setGlobalFilter
|
37
|
-
|
37
|
+
setGlobalFilter = datagridState.setGlobalFilter,
|
38
|
+
batchActionMenuButtonLabel = datagridState.batchActionMenuButtonLabel,
|
39
|
+
translateWithIdBatchActions = datagridState.translateWithIdBatchActions;
|
40
|
+
var batchActionMenuButtonLabelText = batchActionMenuButtonLabel !== null && batchActionMenuButtonLabel !== void 0 ? batchActionMenuButtonLabel : 'More';
|
41
|
+
var selectedKeys = Object.keys(selectedRowIds || {});
|
42
|
+
var totalSelected = selectedKeys.length;
|
38
43
|
|
39
44
|
// Get initial width of batch actions container,
|
40
45
|
// used to measure when all items are put inside
|
@@ -64,25 +69,25 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
64
69
|
return null;
|
65
70
|
}
|
66
71
|
return /*#__PURE__*/React.createElement(ButtonMenu, {
|
67
|
-
label: width > minWidthBeforeOverflowIcon ?
|
72
|
+
label: width > minWidthBeforeOverflowIcon ? batchActionMenuButtonLabelText : null,
|
68
73
|
renderIcon: width > minWidthBeforeOverflowIcon ? Add16 : OverflowMenuVertical16,
|
69
|
-
className: cx(
|
70
|
-
menuOptionsClass: "".concat(
|
74
|
+
className: cx([menuClass, _defineProperty({}, "".concat(menuClass, "--icon-only"), width <= minWidthBeforeOverflowIcon)]),
|
75
|
+
menuOptionsClass: "".concat(menuClass, "-options"),
|
71
76
|
flipped: true
|
72
|
-
}, toolbarBatchActions
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
77
|
+
}, toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
78
|
+
var hidden = index < 2 && !displayAllInMenu;
|
79
|
+
if (!hidden) {
|
80
|
+
return /*#__PURE__*/React.createElement(ButtonMenuItem, {
|
81
|
+
key: "".concat(batchAction.label, "-").concat(index),
|
82
|
+
itemText: batchAction.label,
|
83
|
+
onClick: function onClick() {
|
84
|
+
batchAction.onClick();
|
85
|
+
if (batchAction.type === 'select_all') {
|
86
|
+
toggleAllRowsSelected(true);
|
87
|
+
}
|
83
88
|
}
|
84
|
-
}
|
85
|
-
}
|
89
|
+
});
|
90
|
+
}
|
86
91
|
}));
|
87
92
|
};
|
88
93
|
|
@@ -95,7 +100,8 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
95
100
|
onCancel: function onCancel() {
|
96
101
|
toggleAllRowsSelected(false);
|
97
102
|
setGlobalFilter(null);
|
98
|
-
}
|
103
|
+
},
|
104
|
+
translateWithId: translateWithIdBatchActions
|
99
105
|
}, !displayAllInMenu && toolbarBatchActions && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
100
106
|
if (index < 2 && toolbarBatchActions.length > 3 || index < 3 && toolbarBatchActions.length <= 3) {
|
101
107
|
return /*#__PURE__*/React.createElement(TableBatchAction, {
|
@@ -120,12 +126,12 @@ var DatagridToolbar = function DatagridToolbar(datagridState) {
|
|
120
126
|
DatagridBatchActions = datagridState.DatagridBatchActions,
|
121
127
|
batchActions = datagridState.batchActions,
|
122
128
|
rowSize = datagridState.rowSize;
|
123
|
-
var getRowHeight = rowSize
|
129
|
+
var getRowHeight = rowSize || 'lg';
|
124
130
|
return batchActions && DatagridActions ? /*#__PURE__*/React.createElement("div", {
|
125
131
|
ref: ref,
|
126
|
-
className: cx(
|
132
|
+
className: cx([toolbarClass, "".concat(toolbarClass, "--").concat(getRowHeight)])
|
127
133
|
}, /*#__PURE__*/React.createElement(TableToolbar, null, DatagridActions && DatagridActions(datagridState), DatagridBatchActionsToolbar && DatagridBatchActionsToolbar(datagridState, width, ref))) : DatagridActions ? /*#__PURE__*/React.createElement("div", {
|
128
|
-
className:
|
134
|
+
className: toolbarClass
|
129
135
|
}, /*#__PURE__*/React.createElement(TableToolbar, null, DatagridActions && DatagridActions(datagridState), DatagridBatchActions && DatagridBatchActions(datagridState))) : null;
|
130
136
|
};
|
131
137
|
export default DatagridToolbar;
|
@@ -2,13 +2,13 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
4
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
5
|
-
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
5
|
+
/**
|
6
|
+
* Copyright IBM Corp. 2020, 2023
|
7
|
+
*
|
8
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
11
10
|
*/
|
11
|
+
|
12
12
|
import React, { useEffect } from 'react';
|
13
13
|
import { VariableSizeList } from 'react-window';
|
14
14
|
import { DataTable } from 'carbon-components-react';
|
@@ -23,12 +23,7 @@ var rowSizeMap = {
|
|
23
23
|
sm: 32,
|
24
24
|
md: 40,
|
25
25
|
lg: 48,
|
26
|
-
xl: 64
|
27
|
-
// TODO: deprecate the below values in next major release (v8) on carbon-components-react
|
28
|
-
short: 32,
|
29
|
-
compact: 24,
|
30
|
-
normal: 48,
|
31
|
-
tall: 64
|
26
|
+
xl: 64
|
32
27
|
};
|
33
28
|
var defaultRowHeight = rowSizeMap.lg;
|
34
29
|
var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
@@ -47,13 +42,17 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
47
42
|
page = datagridState.page,
|
48
43
|
handleResize = datagridState.handleResize,
|
49
44
|
gridRef = datagridState.gridRef;
|
45
|
+
|
46
|
+
/* istanbul ignore next */
|
50
47
|
var handleVirtualGridResize = function handleVirtualGridResize() {
|
51
48
|
var gridRefElement = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current;
|
52
49
|
gridRefElement.style.width = gridRefElement === null || gridRefElement === void 0 ? void 0 : gridRefElement.clientWidth;
|
53
50
|
};
|
54
51
|
useResizeObserver(gridRef, handleVirtualGridResize);
|
55
|
-
|
56
|
-
|
52
|
+
|
53
|
+
/* istanbul ignore next */
|
54
|
+
var syncScroll = function syncScroll(event) {
|
55
|
+
var virtualBody = event.target;
|
57
56
|
document.querySelector(".".concat(blockClass, "__head-wrap")).scrollLeft = virtualBody.scrollLeft;
|
58
57
|
var spacerColumn = document.querySelector(".".concat(blockClass, "__head-wrap thead th:last-child"));
|
59
58
|
spacerColumn.style.width = px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
|
@@ -76,9 +75,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
76
75
|
}, /*#__PURE__*/React.createElement(DatagridHead, datagridState)), /*#__PURE__*/React.createElement(TableBody, _extends({}, getTableBodyProps({
|
77
76
|
role: false
|
78
77
|
}), {
|
79
|
-
onScroll:
|
80
|
-
return syncScroll(e);
|
81
|
-
}
|
78
|
+
onScroll: syncScroll
|
82
79
|
}), /*#__PURE__*/React.createElement(VariableSizeList, {
|
83
80
|
height: virtualHeight || tableHeight,
|
84
81
|
itemCount: visibleRows.length,
|
@@ -98,10 +95,13 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
98
95
|
style = _ref.style;
|
99
96
|
var row = visibleRows[index];
|
100
97
|
prepareRow(row);
|
98
|
+
var _row$getRowProps = row.getRowProps(),
|
99
|
+
key = _row$getRowProps.key;
|
101
100
|
return /*#__PURE__*/React.createElement("div", {
|
102
101
|
style: _objectSpread({}, style)
|
103
102
|
}, row.RowRenderer(_objectSpread(_objectSpread({}, datagridState), {}, {
|
104
|
-
row: row
|
103
|
+
row: row,
|
104
|
+
key: key
|
105
105
|
})));
|
106
106
|
})));
|
107
107
|
};
|
@@ -15,6 +15,7 @@ var COLUMN_RESIZE_START = 'columnStartResizing';
|
|
15
15
|
var COLUMN_RESIZING = 'columnResizing';
|
16
16
|
var COLUMN_RESIZE_END = 'columnDoneResizing';
|
17
17
|
var INIT = 'init';
|
18
|
+
var TOGGLE_ROW_SELECTED = 'toggleRowSelected';
|
18
19
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
19
20
|
export var handleColumnResizeEndEvent = function handleColumnResizeEndEvent(dispatch, onColResizeEnd, headerId, isKeyEvent) {
|
20
21
|
dispatch({
|
@@ -46,8 +47,43 @@ export var handleColumnResizingEvent = function handleColumnResizingEvent(dispat
|
|
46
47
|
}
|
47
48
|
});
|
48
49
|
};
|
50
|
+
export var handleToggleRowSelected = function handleToggleRowSelected(dispatch, rowData, isChecked) {
|
51
|
+
return dispatch({
|
52
|
+
type: TOGGLE_ROW_SELECTED,
|
53
|
+
payload: {
|
54
|
+
rowData: rowData,
|
55
|
+
isChecked: isChecked
|
56
|
+
}
|
57
|
+
});
|
58
|
+
};
|
49
59
|
export var stateReducer = function stateReducer(newState, action) {
|
50
60
|
switch (action.type) {
|
61
|
+
case TOGGLE_ROW_SELECTED:
|
62
|
+
{
|
63
|
+
var _ref = action.payload || {},
|
64
|
+
rowData = _ref.rowData,
|
65
|
+
isChecked = _ref.isChecked;
|
66
|
+
if (!rowData) {
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
if (isChecked) {
|
70
|
+
return _objectSpread(_objectSpread({}, newState), {}, {
|
71
|
+
selectedRowData: _objectSpread(_objectSpread({}, newState.selectedRowData), {}, _defineProperty({}, rowData.index, rowData))
|
72
|
+
});
|
73
|
+
}
|
74
|
+
if (rowData && !isChecked) {
|
75
|
+
var newData = _objectSpread({}, newState.selectedRowData);
|
76
|
+
var dataWithRemovedRow = Object.fromEntries(Object.entries(newData).filter(function (_ref2) {
|
77
|
+
var _ref3 = _slicedToArray(_ref2, 1),
|
78
|
+
key = _ref3[0];
|
79
|
+
return parseInt(key) !== parseInt(rowData.index);
|
80
|
+
}));
|
81
|
+
return _objectSpread(_objectSpread({}, newState), {}, {
|
82
|
+
selectedRowData: dataWithRemovedRow
|
83
|
+
});
|
84
|
+
}
|
85
|
+
return _objectSpread({}, newState);
|
86
|
+
}
|
51
87
|
case INIT:
|
52
88
|
{
|
53
89
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
@@ -56,27 +92,27 @@ export var stateReducer = function stateReducer(newState, action) {
|
|
56
92
|
}
|
57
93
|
case COLUMN_RESIZE_START:
|
58
94
|
{
|
59
|
-
var
|
60
|
-
headerId =
|
95
|
+
var _ref4 = action.payload || {},
|
96
|
+
headerId = _ref4.headerId;
|
61
97
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
62
98
|
isResizing: headerId
|
63
99
|
});
|
64
100
|
}
|
65
101
|
case COLUMN_RESIZING:
|
66
102
|
{
|
67
|
-
var
|
68
|
-
_headerId =
|
69
|
-
newWidth =
|
70
|
-
defaultWidth =
|
103
|
+
var _ref5 = action.payload || {},
|
104
|
+
_headerId = _ref5.headerId,
|
105
|
+
newWidth = _ref5.newWidth,
|
106
|
+
defaultWidth = _ref5.defaultWidth;
|
71
107
|
var newColumnWidth = {};
|
72
108
|
if (typeof _headerId === 'undefined') {
|
73
109
|
return _objectSpread({}, newState);
|
74
110
|
}
|
75
111
|
newColumnWidth[_headerId] = newWidth;
|
76
|
-
var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (
|
77
|
-
var
|
78
|
-
_ =
|
79
|
-
value =
|
112
|
+
var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (_ref6) {
|
113
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
114
|
+
_ = _ref7[0],
|
115
|
+
value = _ref7[1];
|
80
116
|
return !isNaN(value);
|
81
117
|
}));
|
82
118
|
var headerIdArray = newState.columnResizing.headerIdWidths || [];
|
@@ -91,10 +127,10 @@ export var stateReducer = function stateReducer(newState, action) {
|
|
91
127
|
}
|
92
128
|
case COLUMN_RESIZE_END:
|
93
129
|
{
|
94
|
-
var
|
95
|
-
onColResizeEnd =
|
96
|
-
_headerId2 =
|
97
|
-
isKeyEvent =
|
130
|
+
var _ref8 = action.payload || {},
|
131
|
+
onColResizeEnd = _ref8.onColResizeEnd,
|
132
|
+
_headerId2 = _ref8.headerId,
|
133
|
+
isKeyEvent = _ref8.isKeyEvent;
|
98
134
|
var currentColumn = {};
|
99
135
|
currentColumn[_headerId2] = newState.columnResizing.columnWidths[_headerId2];
|
100
136
|
var allChangedColumns = newState.columnResizing.columnWidths;
|
@@ -45,7 +45,7 @@
|
|
45
45
|
|
46
46
|
// ## Sample usage:
|
47
47
|
// 1. include \`useActionsColumn\` hook
|
48
|
-
// 2. add \`isAction = true\` to the column object in which you
|
48
|
+
// 2. add \`isAction = true\` to the column object in which you wish to add the overflow menu actions
|
49
49
|
// 3. add \`rowActions = []\` array to the props
|
50
50
|
// - \`rowActions[].id\` for callback to identify the action is called
|
51
51
|
// - \`rowActions[].onClick(actionId: string, row: Row, event: ClickEvent)\` callback on menuitem clicked. [Row properties](https://react-table.tanstack.com/docs/api/useTable#row-properties)
|