@carbon/ibm-products 1.61.0 → 1.62.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/css/index-full-carbon.css +154 -79
- 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 +154 -79
- 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 +154 -79
- 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 +45 -73
- 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 +73 -24
- package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
- package/es/components/Datagrid/useActionsColumn.js +9 -9
- package/es/components/Datagrid/useColumnCenterAlign.js +6 -6
- package/es/components/Datagrid/useColumnRightAlign.js +6 -6
- 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/useNestedRowExpander.js +10 -1
- 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 +11 -1
- 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 +5 -6
- 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 +3 -3
- package/es/components/Guidebanner/GuidebannerElement.js +9 -3
- package/es/components/Guidebanner/GuidebannerElementButton.js +9 -4
- package/es/components/Guidebanner/GuidebannerElementLink.js +9 -3
- package/es/components/InlineTip/InlineTipButton.js +7 -0
- package/es/components/InlineTip/InlineTipLink.js +7 -0
- package/es/components/index.js +2 -2
- 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 +6 -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 +44 -80
- 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 +75 -33
- 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/useNestedRowExpander.js +10 -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/useRowExpander.js +11 -9
- 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 +5 -6
- 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 +3 -3
- package/lib/components/Guidebanner/GuidebannerElement.js +8 -1
- package/lib/components/Guidebanner/GuidebannerElementButton.js +8 -1
- package/lib/components/Guidebanner/GuidebannerElementLink.js +8 -1
- package/lib/components/InlineTip/InlineTipButton.js +8 -1
- package/lib/components/InlineTip/InlineTipLink.js +8 -1
- package/lib/components/index.js +30 -0
- 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 +6 -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 +16 -13
- 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/_storybook-styles.scss +15 -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
|
*
|
|
@@ -8,14 +10,13 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
8
10
|
* LICENSE file in the root directory of this source tree.
|
|
9
11
|
*/
|
|
10
12
|
|
|
11
|
-
// @flow
|
|
12
13
|
import React, { useState, useEffect } from 'react';
|
|
13
14
|
import cx from 'classnames';
|
|
14
15
|
import { DataTable } from 'carbon-components-react';
|
|
15
16
|
import { px } from '@carbon/layout';
|
|
16
17
|
import { selectionColumnId } from '../common-column-ids';
|
|
17
18
|
import { pkg } from '../../../settings';
|
|
18
|
-
import { handleColumnResizeEndEvent,
|
|
19
|
+
import { handleColumnResizeEndEvent, handleColumnResizingEvent } from './addons/stateReducer';
|
|
19
20
|
import { getNodeTextContent } from '../../../global/js/utils/getNodeTextContent';
|
|
20
21
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
21
22
|
var getAccessibilityProps = function getAccessibilityProps(header) {
|
|
@@ -29,67 +30,45 @@ var getAccessibilityProps = function getAccessibilityProps(header) {
|
|
|
29
30
|
return props;
|
|
30
31
|
};
|
|
31
32
|
var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
33
|
+
var resizerAriaLabel = datagridState.resizerAriaLabel;
|
|
32
34
|
// Used to measure the height of the table and uses that value
|
|
33
35
|
// to display a vertical line to indicate the column you are resizing
|
|
34
36
|
useEffect(function () {
|
|
35
37
|
var tableId = datagridState.tableId;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
}
|
|
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
|
+
});
|
|
57
57
|
}, [datagridState.rowSize, datagridState.tableId, datagridState]);
|
|
58
58
|
var _useState = useState(2),
|
|
59
59
|
_useState2 = _slicedToArray(_useState, 1),
|
|
60
60
|
incrementAmount = _useState2[0];
|
|
61
|
-
var
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
69
|
}
|
|
70
|
-
|
|
71
|
-
var closestHeader = event.target.closest('th');
|
|
72
|
-
var closestHeaderCoords = closestHeader.getBoundingClientRect();
|
|
73
|
-
var headerOffset = closestHeaderCoords.left;
|
|
74
|
-
var offsetValue = clientX - headerOffset;
|
|
75
|
-
return offsetValue;
|
|
70
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
|
|
76
71
|
};
|
|
77
|
-
useEffect(function () {
|
|
78
|
-
var isResizing = datagridState.state.isResizing;
|
|
79
|
-
if (isResizing) {
|
|
80
|
-
var onColResizeEnd = datagridState.onColResizeEnd;
|
|
81
|
-
document.addEventListener('mouseup', function () {
|
|
82
|
-
handleColumnResizeEndEvent(datagridState.dispatch, onColResizeEnd, isResizing);
|
|
83
|
-
document.activeElement.blur();
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
return function () {
|
|
87
|
-
document.removeEventListener('mouseup', function () {
|
|
88
|
-
return handleColumnResizeEndEvent(datagridState.dispatch);
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
92
|
-
}, [datagridState.state.isResizing]);
|
|
93
72
|
return /*#__PURE__*/React.createElement(TableRow, _extends({}, headerGroup.getHeaderGroupProps({
|
|
94
73
|
role: false
|
|
95
74
|
}), {
|
|
@@ -112,32 +91,25 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
|
112
91
|
state = datagridState.state,
|
|
113
92
|
dispatch = datagridState.dispatch,
|
|
114
93
|
onColResizeEnd = datagridState.onColResizeEnd;
|
|
115
|
-
var columnResizing = state.columnResizing
|
|
116
|
-
|
|
117
|
-
|
|
94
|
+
var columnResizing = state.columnResizing;
|
|
95
|
+
var _ref4 = columnResizing || {},
|
|
96
|
+
columnWidths = _ref4.columnWidths;
|
|
118
97
|
var originalCol = visibleColumns[index];
|
|
119
98
|
return /*#__PURE__*/React.createElement(TableHeader, _extends({}, header.getHeaderProps({
|
|
120
99
|
role: false
|
|
121
100
|
}), {
|
|
122
|
-
className: cx((_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__resizableColumn"), header.getResizerProps), _defineProperty(_cx, "".concat(blockClass, "__isResizing"), header.isResizing), _defineProperty(_cx, "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable), _defineProperty(_cx, "".concat(blockClass, "__isSorted"), header.isSorted), _cx), header.getHeaderProps().className),
|
|
123
|
-
key: header.id
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// Sets a min width for resizing so at least one character from the column header is visible
|
|
129
|
-
if (newWidth >= 50) {
|
|
130
|
-
handleColumnResizingEvent(dispatch, header, newWidth);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
onMouseDown: function onMouseDown() {
|
|
135
|
-
return handleColumnResizeStartEvent(dispatch, header.id);
|
|
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),
|
|
102
|
+
key: header.id,
|
|
103
|
+
"aria-hidden": header.id === 'spacer' && 'true'
|
|
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);
|
|
136
107
|
},
|
|
137
108
|
onKeyDown: function onKeyDown(event) {
|
|
138
109
|
var key = event.key;
|
|
139
110
|
if (key === 'ArrowLeft' || key === 'ArrowRight') {
|
|
140
|
-
var
|
|
111
|
+
var originalColMinWidth = originalCol.minWidth || 90;
|
|
112
|
+
var currentColumnWidth = columnWidths[header.id] || (datagridState.isTableSortable && originalCol.width < originalColMinWidth ? originalColMinWidth : originalCol.width);
|
|
141
113
|
if (key === 'ArrowLeft') {
|
|
142
114
|
if (currentColumnWidth - incrementAmount > Math.max(minWidth, 50)) {
|
|
143
115
|
var newWidth = currentColumnWidth - incrementAmount;
|
|
@@ -151,12 +123,12 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
|
151
123
|
}
|
|
152
124
|
},
|
|
153
125
|
onKeyUp: function onKeyUp() {
|
|
154
|
-
return handleColumnResizeEndEvent(dispatch, onColResizeEnd, header.id);
|
|
126
|
+
return handleColumnResizeEndEvent(dispatch, onColResizeEnd, header.id, true);
|
|
155
127
|
},
|
|
156
128
|
className: cx("".concat(blockClass, "__col-resizer-range")),
|
|
157
129
|
type: "range",
|
|
158
130
|
defaultValue: originalCol.width,
|
|
159
|
-
"aria-label":
|
|
131
|
+
"aria-label": resizerAriaLabel || 'Resize column'
|
|
160
132
|
})), /*#__PURE__*/React.createElement("span", {
|
|
161
133
|
className: "".concat(blockClass, "__col-resize-indicator")
|
|
162
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
|
};
|