@carbon/ibm-products 1.61.1 → 1.62.1
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +172 -70
- 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 +1768 -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 +172 -70
- 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 +172 -70
- 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/Carousel/Carousel.js +194 -119
- package/es/components/Carousel/CarouselItem.js +8 -21
- 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 +34 -10
- 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 +6 -4
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +42 -25
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +23 -11
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +31 -12
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +43 -23
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +18 -18
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +93 -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/useExpandedRow.js +3 -6
- package/es/components/Datagrid/useFlexResize.js +19 -9
- package/es/components/Datagrid/useFocusRowExpander.js +40 -0
- package/es/components/Datagrid/useInfiniteScroll.js +10 -9
- package/es/components/Datagrid/useNestedRowExpander.js +9 -0
- package/es/components/Datagrid/useNestedRows.js +0 -4
- 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/useRowExpander.js +9 -0
- package/es/components/Datagrid/useSelectAllToggle.js +2 -2
- package/es/components/Datagrid/useSelectRows.js +52 -30
- 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/components/Guidebanner/Guidebanner.js +9 -12
- 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 -4
- package/lib/components/Carousel/Carousel.js +190 -114
- package/lib/components/Carousel/CarouselItem.js +9 -25
- 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 +34 -10
- 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 +6 -4
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +42 -32
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +17 -4
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +25 -5
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +43 -23
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +12 -12
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +96 -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/useExpandedRow.js +2 -5
- package/lib/components/Datagrid/useFlexResize.js +19 -9
- package/lib/components/Datagrid/useFocusRowExpander.js +46 -0
- package/lib/components/Datagrid/useInfiniteScroll.js +9 -9
- package/lib/components/Datagrid/useNestedRowExpander.js +9 -0
- package/lib/components/Datagrid/useNestedRows.js +0 -4
- 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/useRowExpander.js +9 -0
- package/lib/components/Datagrid/useSelectAllToggle.js +2 -2
- package/lib/components/Datagrid/useSelectRows.js +46 -23
- 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/components/Guidebanner/Guidebanner.js +9 -12
- 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 -4
- package/package.json +2 -2
- package/scss/components/Carousel/_carousel.scss +1 -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/_useExpandedRow.scss +21 -0
- package/scss/components/Datagrid/styles/_useNestedRows.scss +1 -1
- package/scss/components/Datagrid/styles/addons/_RowSizeDropdown.scss +9 -0
- package/scss/components/_index-released-only.scss +1 -0
- package/es/components/Carousel/utils.js +0 -98
- package/lib/components/Carousel/utils.js +0 -108
@@ -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,46 @@ 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
|
+
event.target.focus();
|
65
|
+
// When event.button is 2, that is a right click
|
66
|
+
// and we do not want to resize
|
67
|
+
if (event.button === 2 || event.ctrlKey) {
|
68
|
+
event.target.blur();
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
|
72
|
+
};
|
60
73
|
return /*#__PURE__*/React.createElement(TableRow, _extends({}, headerGroup.getHeaderGroupProps({
|
61
74
|
role: false
|
62
75
|
}), {
|
@@ -80,15 +93,19 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
80
93
|
dispatch = datagridState.dispatch,
|
81
94
|
onColResizeEnd = datagridState.onColResizeEnd;
|
82
95
|
var columnResizing = state.columnResizing;
|
83
|
-
var
|
96
|
+
var _ref4 = columnResizing || {},
|
97
|
+
columnWidths = _ref4.columnWidths;
|
84
98
|
var originalCol = visibleColumns[index];
|
85
99
|
return /*#__PURE__*/React.createElement(TableHeader, _extends({}, header.getHeaderProps({
|
86
100
|
role: false
|
87
101
|
}), {
|
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),
|
102
|
+
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
103
|
key: header.id,
|
90
104
|
"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(), {
|
105
|
+
}, getAccessibilityProps(header)), header.render('Header'), header.getResizerProps && !header.isAction && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({}, header.getResizerProps(), {
|
106
|
+
onMouseDown: function onMouseDown(event) {
|
107
|
+
return handleOnMouseDownResize(event, header.getResizerProps);
|
108
|
+
},
|
92
109
|
onKeyDown: function onKeyDown(event) {
|
93
110
|
var key = event.key;
|
94
111
|
if (key === 'ArrowLeft' || key === 'ArrowRight') {
|
@@ -112,7 +129,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
112
129
|
className: cx("".concat(blockClass, "__col-resizer-range")),
|
113
130
|
type: "range",
|
114
131
|
defaultValue: originalCol.width,
|
115
|
-
"aria-label":
|
132
|
+
"aria-label": resizerAriaLabel || 'Resize column'
|
116
133
|
})), /*#__PURE__*/React.createElement("span", {
|
117
134
|
className: "".concat(blockClass, "__col-resize-indicator")
|
118
135
|
})));
|
@@ -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
|
};
|
@@ -4,14 +4,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
var _excluded = ["children"];
|
5
5
|
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; }
|
6
6
|
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; }
|
7
|
-
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
7
|
+
/**
|
8
|
+
* Copyright IBM Corp. 2020, 2023
|
9
|
+
*
|
10
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
13
12
|
*/
|
14
|
-
|
13
|
+
|
15
14
|
import React from 'react';
|
16
15
|
import { DataTable, SkeletonText } from 'carbon-components-react';
|
17
16
|
import { px } from '@carbon/layout';
|
@@ -35,7 +34,10 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
35
34
|
var row = datagridState.row,
|
36
35
|
rowSize = datagridState.rowSize,
|
37
36
|
withNestedRows = datagridState.withNestedRows,
|
38
|
-
prepareRow = datagridState.prepareRow
|
37
|
+
prepareRow = datagridState.prepareRow,
|
38
|
+
key = datagridState.key,
|
39
|
+
tableId = datagridState.tableId,
|
40
|
+
withExpandedRows = datagridState.withExpandedRows;
|
39
41
|
var getVisibleNestedRowCount = function getVisibleNestedRowCount(_ref) {
|
40
42
|
var isExpanded = _ref.isExpanded,
|
41
43
|
subRows = _ref.subRows;
|
@@ -64,7 +66,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
64
66
|
hoverRow === null || hoverRow === void 0 ? void 0 : (_hoverRow$style3 = hoverRow.style) === null || _hoverRow$style3 === void 0 ? void 0 : _hoverRow$style3.setProperty("--".concat(blockClass, "--indicator-offset-amount"), px((rowExpanderButton === null || rowExpanderButton === void 0 ? void 0 : rowExpanderButton.offsetLeft) || 0));
|
65
67
|
};
|
66
68
|
var focusRemover = function focusRemover() {
|
67
|
-
var elements = document.querySelectorAll(".".concat(blockClass, "__carbon-row-expanded"));
|
69
|
+
var elements = document.querySelectorAll("#".concat(tableId, " .").concat(blockClass, "__carbon-row-expanded"));
|
68
70
|
elements.forEach(function (el) {
|
69
71
|
el.classList.remove("".concat(blockClass, "__carbon-row-expanded-hover-active"));
|
70
72
|
});
|
@@ -93,7 +95,17 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
93
95
|
}
|
94
96
|
};
|
95
97
|
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
|
-
|
98
|
+
var setAdditionalRowProps = function setAdditionalRowProps() {
|
99
|
+
if (withNestedRows || withExpandedRows) {
|
100
|
+
return {
|
101
|
+
'data-nested-row-id': row.id
|
102
|
+
};
|
103
|
+
}
|
104
|
+
return {};
|
105
|
+
};
|
106
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
107
|
+
key: key
|
108
|
+
}, /*#__PURE__*/React.createElement(TableRow, _extends({
|
97
109
|
className: rowClassNames
|
98
110
|
}, row.getRowProps({
|
99
111
|
role: false
|
@@ -104,7 +116,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
104
116
|
onFocus: hoverHandler,
|
105
117
|
onBlur: focusRemover,
|
106
118
|
onKeyUp: handleOnKeyUp
|
107
|
-
}), row.cells.map(function (cell, index) {
|
119
|
+
}, setAdditionalRowProps()), row.cells.map(function (cell, index) {
|
108
120
|
var _cell$column;
|
109
121
|
var cellProps = cell.getCellProps({
|
110
122
|
role: false
|
@@ -3,18 +3,18 @@ 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';
|
17
16
|
import { pkg } from '../../../settings';
|
17
|
+
import { handleSelectAllRowData } from './addons/stateReducer';
|
18
18
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
19
19
|
var SelectAll = function SelectAll(datagridState) {
|
20
20
|
var _columns$;
|
@@ -23,6 +23,7 @@ var SelectAll = function SelectAll(datagridState) {
|
|
23
23
|
windowSize = _useState2[0],
|
24
24
|
setWindowSize = _useState2[1];
|
25
25
|
useLayoutEffect(function () {
|
26
|
+
/* istanbul ignore next */
|
26
27
|
function updateSize() {
|
27
28
|
setWindowSize(window.innerWidth);
|
28
29
|
}
|
@@ -39,31 +40,49 @@ var SelectAll = function SelectAll(datagridState) {
|
|
39
40
|
DatagridPagination = datagridState.DatagridPagination,
|
40
41
|
radio = datagridState.radio,
|
41
42
|
columns = datagridState.columns,
|
42
|
-
withStickyColumn = datagridState.withStickyColumn
|
43
|
+
withStickyColumn = datagridState.withStickyColumn,
|
44
|
+
dispatch = datagridState.dispatch,
|
45
|
+
rows = datagridState.rows,
|
46
|
+
getRowId = datagridState.getRowId,
|
47
|
+
toggleAllRowsSelected = datagridState.toggleAllRowsSelected;
|
43
48
|
var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
|
44
49
|
if (hideSelectAll || radio) {
|
45
50
|
return /*#__PURE__*/React.createElement("div", {
|
46
|
-
className: cx("".concat(blockClass, "__head-hidden-select-all"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"),
|
51
|
+
className: cx("".concat(blockClass, "__head-hidden-select-all"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), /* istanbul ignore next */
|
52
|
+
isFirstColumnStickyLeft && windowSize > 671))
|
47
53
|
});
|
48
54
|
}
|
49
55
|
var getProps = DatagridPagination ? getToggleAllPageRowsSelectedProps : getToggleAllRowsSelectedProps;
|
50
56
|
var _getProps = getProps(),
|
51
57
|
onChange = _getProps.onChange,
|
52
58
|
selectProps = _objectWithoutProperties(_getProps, _excluded);
|
53
|
-
var
|
54
|
-
indeterminate = _ref.indeterminate;
|
59
|
+
var indeterminate = selectProps.indeterminate;
|
55
60
|
var handleSelectAllChange = function handleSelectAllChange(event) {
|
56
61
|
if (indeterminate) {
|
62
|
+
handleSelectAllRowData({
|
63
|
+
dispatch: dispatch,
|
64
|
+
rows: rows,
|
65
|
+
getRowId: getRowId,
|
66
|
+
indeterminate: true
|
67
|
+
});
|
68
|
+
toggleAllRowsSelected(false);
|
57
69
|
return onChange === null || onChange === void 0 ? void 0 : onChange({
|
58
70
|
target: {
|
59
71
|
checked: false
|
60
72
|
}
|
61
73
|
});
|
62
74
|
}
|
75
|
+
handleSelectAllRowData({
|
76
|
+
dispatch: dispatch,
|
77
|
+
rows: rows,
|
78
|
+
getRowId: getRowId,
|
79
|
+
isChecked: event.target.checked
|
80
|
+
});
|
63
81
|
return onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
64
82
|
};
|
65
83
|
return /*#__PURE__*/React.createElement("div", {
|
66
|
-
className: cx("".concat(blockClass, "__head-select-all"), "".concat(blockClass, "__checkbox-cell"), _defineProperty({}, "".concat(blockClass, "__checkbox-cell-sticky-left"),
|
84
|
+
className: cx("".concat(blockClass, "__head-select-all"), "".concat(blockClass, "__checkbox-cell"), _defineProperty({}, "".concat(blockClass, "__checkbox-cell-sticky-left"), /* istanbul ignore next */
|
85
|
+
isFirstColumnStickyLeft && windowSize > 671))
|
67
86
|
}, /*#__PURE__*/React.createElement(TableSelectAll, _extends({}, selectProps, {
|
68
87
|
name: "".concat(tableId, "-select-all-checkbox-name"),
|
69
88
|
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
|
};
|
@@ -14,10 +14,12 @@ import { useResizeObserver } from '../../../global/js/hooks/useResizeObserver';
|
|
14
14
|
import { ButtonMenu, ButtonMenuItem } from '../../ButtonMenu';
|
15
15
|
import { pkg, carbon } from '../../../settings';
|
16
16
|
import cx from 'classnames';
|
17
|
+
import { handleSelectAllRowData } from './addons/stateReducer';
|
17
18
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
19
|
+
var toolbarClass = "".concat(blockClass, "__table-toolbar");
|
20
|
+
var menuClass = "".concat(blockClass, "__button-menu");
|
18
21
|
var TableToolbar = DataTable.TableToolbar;
|
19
22
|
var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridState, width, ref) {
|
20
|
-
var _Object$keys;
|
21
23
|
var _useState = useState(false),
|
22
24
|
_useState2 = _slicedToArray(_useState, 2),
|
23
25
|
displayAllInMenu = _useState2[0],
|
@@ -33,8 +35,15 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
33
35
|
var selectedRowIds = datagridState.state.selectedRowIds,
|
34
36
|
toggleAllRowsSelected = datagridState.toggleAllRowsSelected,
|
35
37
|
toolbarBatchActions = datagridState.toolbarBatchActions,
|
36
|
-
setGlobalFilter = datagridState.setGlobalFilter
|
37
|
-
|
38
|
+
setGlobalFilter = datagridState.setGlobalFilter,
|
39
|
+
dispatch = datagridState.dispatch,
|
40
|
+
getRowId = datagridState.getRowId,
|
41
|
+
batchActionMenuButtonLabel = datagridState.batchActionMenuButtonLabel,
|
42
|
+
translateWithIdBatchActions = datagridState.translateWithIdBatchActions,
|
43
|
+
rows = datagridState.rows;
|
44
|
+
var batchActionMenuButtonLabelText = batchActionMenuButtonLabel !== null && batchActionMenuButtonLabel !== void 0 ? batchActionMenuButtonLabel : 'More';
|
45
|
+
var selectedKeys = Object.keys(selectedRowIds || {});
|
46
|
+
var totalSelected = selectedKeys.length;
|
38
47
|
|
39
48
|
// Get initial width of batch actions container,
|
40
49
|
// used to measure when all items are put inside
|
@@ -64,25 +73,30 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
64
73
|
return null;
|
65
74
|
}
|
66
75
|
return /*#__PURE__*/React.createElement(ButtonMenu, {
|
67
|
-
label: width > minWidthBeforeOverflowIcon ?
|
76
|
+
label: width > minWidthBeforeOverflowIcon ? batchActionMenuButtonLabelText : null,
|
68
77
|
renderIcon: width > minWidthBeforeOverflowIcon ? Add16 : OverflowMenuVertical16,
|
69
|
-
className: cx(
|
70
|
-
menuOptionsClass: "".concat(
|
78
|
+
className: cx([menuClass, _defineProperty({}, "".concat(menuClass, "--icon-only"), width <= minWidthBeforeOverflowIcon)]),
|
79
|
+
menuOptionsClass: "".concat(menuClass, "-options"),
|
71
80
|
flipped: true
|
72
|
-
}, toolbarBatchActions
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
}, toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
82
|
+
var hidden = index < 2 && !displayAllInMenu;
|
83
|
+
if (!hidden) {
|
84
|
+
return /*#__PURE__*/React.createElement(ButtonMenuItem, {
|
85
|
+
key: "".concat(batchAction.label, "-").concat(index),
|
86
|
+
itemText: batchAction.label,
|
87
|
+
onClick: function onClick() {
|
88
|
+
batchAction.onClick();
|
89
|
+
if (batchAction.type === 'select_all') {
|
90
|
+
toggleAllRowsSelected(true);
|
91
|
+
handleSelectAllRowData({
|
92
|
+
dispatch: dispatch,
|
93
|
+
rows: rows,
|
94
|
+
getRowId: getRowId
|
95
|
+
});
|
96
|
+
}
|
83
97
|
}
|
84
|
-
}
|
85
|
-
}
|
98
|
+
});
|
99
|
+
}
|
86
100
|
}));
|
87
101
|
};
|
88
102
|
|
@@ -95,7 +109,8 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
95
109
|
onCancel: function onCancel() {
|
96
110
|
toggleAllRowsSelected(false);
|
97
111
|
setGlobalFilter(null);
|
98
|
-
}
|
112
|
+
},
|
113
|
+
translateWithId: translateWithIdBatchActions
|
99
114
|
}, !displayAllInMenu && toolbarBatchActions && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
100
115
|
if (index < 2 && toolbarBatchActions.length > 3 || index < 3 && toolbarBatchActions.length <= 3) {
|
101
116
|
return /*#__PURE__*/React.createElement(TableBatchAction, {
|
@@ -105,6 +120,11 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
105
120
|
batchAction.onClick();
|
106
121
|
if (batchAction.type === 'select_all') {
|
107
122
|
toggleAllRowsSelected(true);
|
123
|
+
handleSelectAllRowData({
|
124
|
+
dispatch: dispatch,
|
125
|
+
rows: rows,
|
126
|
+
getRowId: getRowId
|
127
|
+
});
|
108
128
|
}
|
109
129
|
},
|
110
130
|
iconDescription: batchAction.label
|
@@ -120,12 +140,12 @@ var DatagridToolbar = function DatagridToolbar(datagridState) {
|
|
120
140
|
DatagridBatchActions = datagridState.DatagridBatchActions,
|
121
141
|
batchActions = datagridState.batchActions,
|
122
142
|
rowSize = datagridState.rowSize;
|
123
|
-
var getRowHeight = rowSize
|
143
|
+
var getRowHeight = rowSize || 'lg';
|
124
144
|
return batchActions && DatagridActions ? /*#__PURE__*/React.createElement("div", {
|
125
145
|
ref: ref,
|
126
|
-
className: cx(
|
146
|
+
className: cx([toolbarClass, "".concat(toolbarClass, "--").concat(getRowHeight)])
|
127
147
|
}, /*#__PURE__*/React.createElement(TableToolbar, null, DatagridActions && DatagridActions(datagridState), DatagridBatchActionsToolbar && DatagridBatchActionsToolbar(datagridState, width, ref))) : DatagridActions ? /*#__PURE__*/React.createElement("div", {
|
128
|
-
className:
|
148
|
+
className: toolbarClass
|
129
149
|
}, /*#__PURE__*/React.createElement(TableToolbar, null, DatagridActions && DatagridActions(datagridState), DatagridBatchActions && DatagridBatchActions(datagridState))) : null;
|
130
150
|
};
|
131
151
|
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,8 @@ 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';
|
19
|
+
var TOGGLE_ALL_ROWS_SELECTED = 'toggleAllRowsSelected';
|
18
20
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
19
21
|
export var handleColumnResizeEndEvent = function handleColumnResizeEndEvent(dispatch, onColResizeEnd, headerId, isKeyEvent) {
|
20
22
|
dispatch({
|
@@ -46,8 +48,85 @@ export var handleColumnResizingEvent = function handleColumnResizingEvent(dispat
|
|
46
48
|
}
|
47
49
|
});
|
48
50
|
};
|
51
|
+
export var handleToggleRowSelected = function handleToggleRowSelected(_ref) {
|
52
|
+
var dispatch = _ref.dispatch,
|
53
|
+
rowData = _ref.rowData,
|
54
|
+
isChecked = _ref.isChecked,
|
55
|
+
getRowId = _ref.getRowId,
|
56
|
+
selectAll = _ref.selectAll;
|
57
|
+
return dispatch({
|
58
|
+
type: TOGGLE_ROW_SELECTED,
|
59
|
+
payload: {
|
60
|
+
rowData: rowData,
|
61
|
+
isChecked: isChecked,
|
62
|
+
getRowId: getRowId,
|
63
|
+
selectAll: selectAll
|
64
|
+
}
|
65
|
+
});
|
66
|
+
};
|
67
|
+
export var handleSelectAllRowData = function handleSelectAllRowData(_ref2) {
|
68
|
+
var dispatch = _ref2.dispatch,
|
69
|
+
rows = _ref2.rows,
|
70
|
+
getRowId = _ref2.getRowId,
|
71
|
+
indeterminate = _ref2.indeterminate,
|
72
|
+
isChecked = _ref2.isChecked;
|
73
|
+
return dispatch({
|
74
|
+
type: TOGGLE_ALL_ROWS_SELECTED,
|
75
|
+
payload: {
|
76
|
+
rows: rows,
|
77
|
+
getRowId: getRowId,
|
78
|
+
indeterminate: indeterminate,
|
79
|
+
isChecked: isChecked
|
80
|
+
}
|
81
|
+
});
|
82
|
+
};
|
49
83
|
export var stateReducer = function stateReducer(newState, action) {
|
50
84
|
switch (action.type) {
|
85
|
+
case TOGGLE_ALL_ROWS_SELECTED:
|
86
|
+
{
|
87
|
+
var _ref3 = action.payload || {},
|
88
|
+
rows = _ref3.rows,
|
89
|
+
getRowId = _ref3.getRowId,
|
90
|
+
indeterminate = _ref3.indeterminate,
|
91
|
+
isChecked = _ref3.isChecked;
|
92
|
+
if (rows) {
|
93
|
+
var newSelectedRowData = {};
|
94
|
+
rows.forEach(function (row) {
|
95
|
+
newSelectedRowData[getRowId(row, row.index)] = row;
|
96
|
+
});
|
97
|
+
return _objectSpread(_objectSpread({}, newState), {}, {
|
98
|
+
selectedRowData: indeterminate || !isChecked ? {} : newSelectedRowData
|
99
|
+
});
|
100
|
+
}
|
101
|
+
return _objectSpread({}, newState);
|
102
|
+
}
|
103
|
+
case TOGGLE_ROW_SELECTED:
|
104
|
+
{
|
105
|
+
var _ref4 = action.payload || {},
|
106
|
+
rowData = _ref4.rowData,
|
107
|
+
_isChecked = _ref4.isChecked,
|
108
|
+
_getRowId = _ref4.getRowId;
|
109
|
+
if (!rowData) {
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
if (_isChecked) {
|
113
|
+
return _objectSpread(_objectSpread({}, newState), {}, {
|
114
|
+
selectedRowData: _objectSpread(_objectSpread({}, newState.selectedRowData), {}, _defineProperty({}, _getRowId(rowData, rowData.index), rowData))
|
115
|
+
});
|
116
|
+
}
|
117
|
+
if (rowData && !_isChecked) {
|
118
|
+
var newData = _objectSpread({}, newState.selectedRowData);
|
119
|
+
var dataWithRemovedRow = Object.fromEntries(Object.entries(newData).filter(function (_ref5) {
|
120
|
+
var _ref6 = _slicedToArray(_ref5, 1),
|
121
|
+
key = _ref6[0];
|
122
|
+
return parseInt(key) !== parseInt(rowData.index);
|
123
|
+
}));
|
124
|
+
return _objectSpread(_objectSpread({}, newState), {}, {
|
125
|
+
selectedRowData: dataWithRemovedRow
|
126
|
+
});
|
127
|
+
}
|
128
|
+
return _objectSpread({}, newState);
|
129
|
+
}
|
51
130
|
case INIT:
|
52
131
|
{
|
53
132
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
@@ -56,27 +135,27 @@ export var stateReducer = function stateReducer(newState, action) {
|
|
56
135
|
}
|
57
136
|
case COLUMN_RESIZE_START:
|
58
137
|
{
|
59
|
-
var
|
60
|
-
headerId =
|
138
|
+
var _ref7 = action.payload || {},
|
139
|
+
headerId = _ref7.headerId;
|
61
140
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
62
141
|
isResizing: headerId
|
63
142
|
});
|
64
143
|
}
|
65
144
|
case COLUMN_RESIZING:
|
66
145
|
{
|
67
|
-
var
|
68
|
-
_headerId =
|
69
|
-
newWidth =
|
70
|
-
defaultWidth =
|
146
|
+
var _ref8 = action.payload || {},
|
147
|
+
_headerId = _ref8.headerId,
|
148
|
+
newWidth = _ref8.newWidth,
|
149
|
+
defaultWidth = _ref8.defaultWidth;
|
71
150
|
var newColumnWidth = {};
|
72
151
|
if (typeof _headerId === 'undefined') {
|
73
152
|
return _objectSpread({}, newState);
|
74
153
|
}
|
75
154
|
newColumnWidth[_headerId] = newWidth;
|
76
|
-
var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (
|
77
|
-
var
|
78
|
-
_ =
|
79
|
-
value =
|
155
|
+
var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (_ref9) {
|
156
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
157
|
+
_ = _ref10[0],
|
158
|
+
value = _ref10[1];
|
80
159
|
return !isNaN(value);
|
81
160
|
}));
|
82
161
|
var headerIdArray = newState.columnResizing.headerIdWidths || [];
|
@@ -91,10 +170,10 @@ export var stateReducer = function stateReducer(newState, action) {
|
|
91
170
|
}
|
92
171
|
case COLUMN_RESIZE_END:
|
93
172
|
{
|
94
|
-
var
|
95
|
-
onColResizeEnd =
|
96
|
-
_headerId2 =
|
97
|
-
isKeyEvent =
|
173
|
+
var _ref11 = action.payload || {},
|
174
|
+
onColResizeEnd = _ref11.onColResizeEnd,
|
175
|
+
_headerId2 = _ref11.headerId,
|
176
|
+
isKeyEvent = _ref11.isKeyEvent;
|
98
177
|
var currentColumn = {};
|
99
178
|
currentColumn[_headerId2] = newState.columnResizing.columnWidths[_headerId2];
|
100
179
|
var allChangedColumns = newState.columnResizing.columnWidths;
|