@carbon/ibm-products 2.15.2 → 2.17.0-alpha.8
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/config-dev.css +3 -0
- package/css/config-dev.css.map +1 -0
- package/css/index-full-carbon.css +195 -1
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +1852 -38
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +195 -1
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +5 -1
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +3 -3
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +36 -22
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +12 -11
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +7 -3
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +24 -13
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +2 -2
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +50 -14
- package/es/components/Datagrid/Datagrid.docs-page.js +4 -4
- package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
- package/es/components/Datagrid/useActionsColumn.js +1 -4
- package/es/components/Datagrid/useDatagrid.js +5 -1
- package/es/components/Datagrid/useFlexResize.js +19 -9
- package/es/components/Datagrid/useInfiniteScroll.js +1 -5
- package/es/components/Datagrid/useOnRowClick.js +6 -7
- package/es/components/Datagrid/useSelectRows.js +8 -5
- package/es/components/Datagrid/useSortableColumns.js +5 -7
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +2 -1
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +2 -1
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +2 -1
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +2 -1
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +2 -1
- package/es/components/EmptyStates/assets/ErrorIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NoDataIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +5 -3
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -3
- package/es/components/InlineTip/InlineTip.docs-page.js +13 -0
- package/es/components/InlineTip/InlineTip.js +217 -0
- package/es/components/InlineTip/InlineTipButton.js +53 -0
- package/es/components/InlineTip/InlineTipLink.js +57 -0
- package/es/components/InlineTip/index.js +10 -0
- package/es/components/InlineTip/utils.js +36 -0
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.docs-page.js +11 -0
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +140 -0
- package/es/components/SteppedAnimatedMedia/assets/index.js +4 -0
- package/es/components/SteppedAnimatedMedia/index.js +8 -0
- package/es/global/js/package-settings.js +3 -4
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +3 -3
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +41 -29
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +11 -11
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +7 -3
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +23 -12
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +2 -2
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +51 -15
- package/lib/components/Datagrid/Datagrid.docs-page.js +4 -4
- package/lib/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
- package/lib/components/Datagrid/useActionsColumn.js +1 -7
- package/lib/components/Datagrid/useDatagrid.js +5 -1
- package/lib/components/Datagrid/useFlexResize.js +19 -9
- package/lib/components/Datagrid/useInfiniteScroll.js +0 -4
- package/lib/components/Datagrid/useOnRowClick.js +6 -7
- package/lib/components/Datagrid/useSelectRows.js +8 -5
- package/lib/components/Datagrid/useSortableColumns.js +5 -7
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +2 -1
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +2 -1
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +2 -1
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +2 -1
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +2 -1
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -3
- package/lib/components/InlineTip/InlineTip.docs-page.js +23 -0
- package/lib/components/InlineTip/InlineTip.js +224 -0
- package/lib/components/InlineTip/InlineTipButton.js +57 -0
- package/lib/components/InlineTip/InlineTipLink.js +61 -0
- package/lib/components/InlineTip/index.js +26 -0
- package/lib/components/InlineTip/utils.js +43 -0
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.docs-page.js +21 -0
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +148 -0
- package/lib/components/SteppedAnimatedMedia/assets/index.js +9 -0
- package/lib/components/SteppedAnimatedMedia/index.js +12 -0
- package/lib/global/js/package-settings.js +3 -4
- package/package.json +6 -7
- package/scss/components/Datagrid/styles/_datagrid.scss +5 -0
- package/scss/components/{TooltipTrigger/_storybook-styles.scss → InlineTip/_index.scss} +2 -0
- package/scss/components/InlineTip/_inline-tip.scss +229 -0
- package/scss/components/SidePanel/_side-panel.scss +1 -4
- package/scss/components/_index-released-only-with-carbon.scss +1 -0
- package/scss/components/_index-released-only.scss +1 -0
- package/scss/components/_index.scss +1 -0
- package/scss/config-dev.scss +3 -0
- package/scss/components/APIKeyModal/_storybook-styles.scss +0 -35
- package/scss/components/AboutModal/_storybook-styles.scss +0 -29
- package/scss/components/ActionBar/_storybook-styles.scss +0 -8
- package/scss/components/ActionSet/_storybook-styles.scss +0 -36
- package/scss/components/AddSelect/_storybook-styles.scss +0 -6
- package/scss/components/BreadcrumbWithOverflow/_storybook-styles.scss +0 -8
- package/scss/components/ButtonMenu/_storybook-styles.scss +0 -6
- package/scss/components/ButtonSetWithOverflow/_storybook-styles.scss +0 -8
- package/scss/components/Card/_storybook-styles.scss +0 -12
- package/scss/components/Cascade/_storybook-styles.scss +0 -34
- package/scss/components/Checklist/_storybook-styles.scss +0 -13
- package/scss/components/CreateFullPage/_storybook-styles.scss +0 -67
- package/scss/components/CreateModal/_storybook-styles.scss +0 -54
- package/scss/components/CreateSidePanel/_storybook-styles.scss +0 -32
- package/scss/components/CreateTearsheet/_storybook-styles.scss +0 -56
- package/scss/components/CreateTearsheetNarrow/_storybook-styles.scss +0 -27
- package/scss/components/DataSpreadsheet/_storybook-styles.scss +0 -17
- package/scss/components/Datagrid/_storybook-styles.scss +0 -157
- package/scss/components/EditFullPage/_storybook-styles.scss +0 -10
- package/scss/components/EditInPlace/_storybook-styles.scss +0 -15
- package/scss/components/EditSidePanel/_storybook-styles.scss +0 -32
- package/scss/components/EditTearsheet/_storybook-styles.scss +0 -59
- package/scss/components/EditTearsheetNarrow/_storybook-styles.scss +0 -10
- package/scss/components/EditUpdateCards/_storybook-styles.scss +0 -55
- package/scss/components/EmptyStates/_storybook-styles.scss +0 -6
- package/scss/components/ExampleComponent/_storybook-styles.scss +0 -6
- package/scss/components/ExportModal/_storybook-styles.scss +0 -6
- package/scss/components/ExpressiveCard/_storybook-styles.scss +0 -26
- package/scss/components/FilterSummary/_storybook-styles.scss +0 -16
- package/scss/components/ImportModal/_storybook-styles.scss +0 -6
- package/scss/components/MultiAddSelect/_storybook-styles.scss +0 -6
- package/scss/components/NotificationsPanel/_storybook-styles.scss +0 -23
- package/scss/components/OptionsTile/_storybook-styles.scss +0 -29
- package/scss/components/PageHeader/_storybook-styles.scss +0 -90
- package/scss/components/ProductiveCard/_storybook-styles.scss +0 -23
- package/scss/components/RemoveModal/_storybook-styles.scss +0 -6
- package/scss/components/Saving/_storybook-styles.scss +0 -12
- package/scss/components/SidePanel/_storybook-styles.scss +0 -52
- package/scss/components/SingleAddSelect/_storybook-styles.scss +0 -6
- package/scss/components/StatusIcon/_storybook-styles.scss +0 -6
- package/scss/components/TagSet/_storybook-styles.scss +0 -8
- package/scss/components/Tearsheet/_storybook-styles.scss +0 -25
- package/scss/components/UserProfileImage/_storybook.scss +0 -6
- package/scss/components/WebTerminal/_storybook-styles.scss +0 -46
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["className", "playStep", "filePaths"];
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
/**
|
|
8
|
+
* Copyright IBM Corp. 2023, 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.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// Import portions of React that are needed.
|
|
15
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
16
|
+
import lottie from 'lottie-web';
|
|
17
|
+
import clamp from 'lodash/clamp';
|
|
18
|
+
// Other standard imports.
|
|
19
|
+
import PropTypes from 'prop-types';
|
|
20
|
+
import cx from 'classnames';
|
|
21
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
|
22
|
+
import { pkg } from '../../settings';
|
|
23
|
+
|
|
24
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
25
|
+
var blockClass = "".concat(pkg.prefix, "--stepped-animated-media");
|
|
26
|
+
var componentName = 'SteppedAnimatedMedia';
|
|
27
|
+
|
|
28
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
|
29
|
+
|
|
30
|
+
// Default values for props
|
|
31
|
+
var defaults = {
|
|
32
|
+
playStep: 0
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The SteppedAnimatedMedia is a Novice to Pro internal component and is not intended for general use.
|
|
37
|
+
*/
|
|
38
|
+
export var SteppedAnimatedMedia = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
39
|
+
var className = _ref.className,
|
|
40
|
+
_ref$playStep = _ref.playStep,
|
|
41
|
+
playStep = _ref$playStep === void 0 ? defaults.playStep : _ref$playStep,
|
|
42
|
+
filePaths = _ref.filePaths,
|
|
43
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
44
|
+
var _useState = useState([]),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
jsonData = _useState2[0],
|
|
47
|
+
setJsonData = _useState2[1];
|
|
48
|
+
var animRef = useRef();
|
|
49
|
+
var backupRef = useRef();
|
|
50
|
+
var localRef = ref !== null && ref !== void 0 ? ref : backupRef;
|
|
51
|
+
// load animation source
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
var isJsonFile = function isJsonFile(filePath) {
|
|
54
|
+
return filePath.includes('.json');
|
|
55
|
+
};
|
|
56
|
+
function loadArtifact() {
|
|
57
|
+
return _loadArtifact.apply(this, arguments);
|
|
58
|
+
}
|
|
59
|
+
function _loadArtifact() {
|
|
60
|
+
_loadArtifact = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
61
|
+
var allJsonArtifacts, rawResponse, jsonResponse, fileData;
|
|
62
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
63
|
+
while (1) switch (_context.prev = _context.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
if (!(filePaths && filePaths.every(isJsonFile))) {
|
|
66
|
+
_context.next = 10;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
allJsonArtifacts = filePaths.map(function (el) {
|
|
70
|
+
return fetch(el);
|
|
71
|
+
});
|
|
72
|
+
_context.next = 4;
|
|
73
|
+
return Promise.all(allJsonArtifacts);
|
|
74
|
+
case 4:
|
|
75
|
+
rawResponse = _context.sent;
|
|
76
|
+
jsonResponse = rawResponse.map(function (el) {
|
|
77
|
+
return el.json();
|
|
78
|
+
});
|
|
79
|
+
_context.next = 8;
|
|
80
|
+
return Promise.all(jsonResponse);
|
|
81
|
+
case 8:
|
|
82
|
+
fileData = _context.sent;
|
|
83
|
+
setJsonData(fileData);
|
|
84
|
+
case 10:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context.stop();
|
|
87
|
+
}
|
|
88
|
+
}, _callee);
|
|
89
|
+
}));
|
|
90
|
+
return _loadArtifact.apply(this, arguments);
|
|
91
|
+
}
|
|
92
|
+
loadArtifact();
|
|
93
|
+
}, [filePaths]);
|
|
94
|
+
useEffect(function () {
|
|
95
|
+
var _window;
|
|
96
|
+
var prefersReducedMotion = (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)').matches : true;
|
|
97
|
+
if (localRef.current) {
|
|
98
|
+
var _animRef$current, _animRef$current2, _animRef$current3;
|
|
99
|
+
(_animRef$current = animRef.current) === null || _animRef$current === void 0 || _animRef$current.destroy();
|
|
100
|
+
animRef.current = lottie.loadAnimation({
|
|
101
|
+
container: localRef.current,
|
|
102
|
+
renderer: 'svg',
|
|
103
|
+
animationData: jsonData[clamp(playStep, 0, jsonData.length - 1)],
|
|
104
|
+
loop: false,
|
|
105
|
+
autoplay: false,
|
|
106
|
+
rendererSettings: {
|
|
107
|
+
preserveAspectRatio: 'xMidYMid slice'
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
prefersReducedMotion ? (_animRef$current2 = animRef.current) === null || _animRef$current2 === void 0 ? void 0 : _animRef$current2.goToAndStop(0) : (_animRef$current3 = animRef.current) === null || _animRef$current3 === void 0 ? void 0 : _animRef$current3.goToAndPlay(0);
|
|
111
|
+
}
|
|
112
|
+
return function () {
|
|
113
|
+
var _animRef$current4;
|
|
114
|
+
return (_animRef$current4 = animRef.current) === null || _animRef$current4 === void 0 ? void 0 : _animRef$current4.destroy();
|
|
115
|
+
};
|
|
116
|
+
}, [jsonData, localRef, playStep]);
|
|
117
|
+
if (!jsonData) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
121
|
+
className: cx(blockClass, className),
|
|
122
|
+
role: "img",
|
|
123
|
+
ref: localRef
|
|
124
|
+
}, getDevtoolsProps(componentName)));
|
|
125
|
+
});
|
|
126
|
+
SteppedAnimatedMedia.displayName = componentName;
|
|
127
|
+
SteppedAnimatedMedia.propTypes = {
|
|
128
|
+
/**
|
|
129
|
+
* Optional class name for this component.
|
|
130
|
+
*/
|
|
131
|
+
className: PropTypes.string,
|
|
132
|
+
/**
|
|
133
|
+
* The file path(s) to json formatted Lottie animation files.
|
|
134
|
+
*/
|
|
135
|
+
filePaths: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
136
|
+
/**
|
|
137
|
+
* Which animation step from the filePaths array to play.
|
|
138
|
+
*/
|
|
139
|
+
playStep: PropTypes.number
|
|
140
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var HowACaseIsCreated1 = new URL('./illustrations/how-a-case-is-created-1', import.meta.url).pathname;
|
|
2
|
+
var HowACaseIsCreated2 = new URL('./illustrations/how-a-case-is-created-2', import.meta.url).pathname;
|
|
3
|
+
var HowACaseIsCreated3 = new URL('./illustrations/how-a-case-is-created-3', import.meta.url).pathname;
|
|
4
|
+
export { HowACaseIsCreated1, HowACaseIsCreated2, HowACaseIsCreated3 };
|
|
@@ -25,6 +25,7 @@ var defaults = {
|
|
|
25
25
|
CreateTearsheet: true,
|
|
26
26
|
CreateTearsheetStep: true,
|
|
27
27
|
CreateTearsheetDivider: true,
|
|
28
|
+
Datagrid: true,
|
|
28
29
|
EditInPlace: true,
|
|
29
30
|
EmptyState: true,
|
|
30
31
|
ErrorEmptyState: true,
|
|
@@ -63,7 +64,6 @@ var defaults = {
|
|
|
63
64
|
EditSidePanel: false,
|
|
64
65
|
CancelableTextEdit: false,
|
|
65
66
|
DataSpreadsheet: false,
|
|
66
|
-
Datagrid: false,
|
|
67
67
|
EditTearsheet: false,
|
|
68
68
|
EditTearsheetForm: false,
|
|
69
69
|
EditTearsheetNarrow: false,
|
|
@@ -72,17 +72,16 @@ var defaults = {
|
|
|
72
72
|
/* new component flags here - comment used by generate CLI */
|
|
73
73
|
|
|
74
74
|
// Novice to pro components not yet reviewed and released:
|
|
75
|
-
Checklist: false
|
|
75
|
+
Checklist: false,
|
|
76
|
+
InlineTip: false
|
|
76
77
|
},
|
|
77
78
|
// feature level flags
|
|
78
79
|
feature: {
|
|
79
80
|
'default-portal-target-body': true,
|
|
80
|
-
'Datagrid.useInfiniteScroll': false,
|
|
81
81
|
'Datagrid.useInlineEdit': false,
|
|
82
82
|
'Datagrid.useEditableCell': false,
|
|
83
83
|
'Datagrid.useExpandedRow': false,
|
|
84
84
|
'Datagrid.useNestedRows': false,
|
|
85
|
-
'Datagrid.useActionsColumn': false,
|
|
86
85
|
'Datagrid.useFiltering': false,
|
|
87
86
|
'Datagrid.useCustomizeColumns': false,
|
|
88
87
|
'ExampleComponent.secondaryIcon': false,
|
|
@@ -39,7 +39,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
39
39
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
40
40
|
var gcClass = "".concat(blockClass, "__grid-container");
|
|
41
41
|
var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
42
|
-
var
|
|
42
|
+
var _cx5;
|
|
43
43
|
var datagridState = _ref.datagridState,
|
|
44
44
|
title = _ref.title;
|
|
45
45
|
var _useContext = (0, _react.useContext)(_InlineEditContext.InlineEditContext),
|
|
@@ -52,8 +52,7 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
|
52
52
|
var activeCellId = inlineEditState.activeCellId,
|
|
53
53
|
gridActive = inlineEditState.gridActive,
|
|
54
54
|
editId = inlineEditState.editId;
|
|
55
|
-
var
|
|
56
|
-
getTableProps = _datagridState$getTab === void 0 ? function () {} : _datagridState$getTab,
|
|
55
|
+
var getTableProps = datagridState.getTableProps,
|
|
57
56
|
getFilterFlyoutProps = datagridState.getFilterFlyoutProps,
|
|
58
57
|
withVirtualScroll = datagridState.withVirtualScroll,
|
|
59
58
|
DatagridPagination = datagridState.DatagridPagination,
|
|
@@ -76,6 +75,7 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
|
76
75
|
state = datagridState.state,
|
|
77
76
|
page = datagridState.page,
|
|
78
77
|
rows = datagridState.rows;
|
|
78
|
+
var columnResizing = state.columnResizing;
|
|
79
79
|
var contentRows = DatagridPagination && page || rows;
|
|
80
80
|
var gridAreaRef = (0, _react.useRef)();
|
|
81
81
|
var multiKeyTrackingRef = (0, _react.useRef)();
|
|
@@ -97,10 +97,11 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
|
97
97
|
var renderTable = function renderTable() {
|
|
98
98
|
var _getTableProps;
|
|
99
99
|
return /*#__PURE__*/_react.default.createElement(_react2.Table, (0, _extends2.default)({}, getTableProps(), {
|
|
100
|
-
className: (0, _classnames.default)(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-grid-active"), gridActive), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
|
|
100
|
+
className: (0, _classnames.default)(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-grid-active"), gridActive), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-is-resizing"), typeof columnResizing.isResizingColumn === 'string'), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
|
|
101
101
|
role: withInlineEdit ? 'grid' : undefined,
|
|
102
102
|
tabIndex: withInlineEdit ? 0 : -1,
|
|
103
|
-
onKeyDown:
|
|
103
|
+
onKeyDown: /* istanbul ignore next */
|
|
104
|
+
withInlineEdit && function (event) {
|
|
104
105
|
return (0, _handleGridKeyPress.handleGridKeyPress)({
|
|
105
106
|
event: event,
|
|
106
107
|
dispatch: dispatch,
|
|
@@ -109,10 +110,10 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
|
109
110
|
state: inlineEditState,
|
|
110
111
|
usingMac: usingMac
|
|
111
112
|
});
|
|
112
|
-
}
|
|
113
|
-
onFocus: withInlineEdit
|
|
113
|
+
},
|
|
114
|
+
onFocus: withInlineEdit && function () {
|
|
114
115
|
return (0, _handleGridFocus.handleGridFocus)(inlineEditState, dispatch);
|
|
115
|
-
}
|
|
116
|
+
},
|
|
116
117
|
title: title
|
|
117
118
|
}), !withVirtualScroll && /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState), /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
|
|
118
119
|
rows: contentRows
|
|
@@ -141,6 +142,8 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
|
141
142
|
(0, _hooks3.useSubscribeToEventEmitter)(_constants.CLEAR_SINGLE_FILTER, function (id) {
|
|
142
143
|
return (0, _FilterProvider.clearSingleFilter)(id, setAllFilters, state);
|
|
143
144
|
});
|
|
145
|
+
|
|
146
|
+
/* istanbul ignore next */
|
|
144
147
|
var renderFilterSummary = function renderFilterSummary() {
|
|
145
148
|
return state.filters.length > 0 && /*#__PURE__*/_react.default.createElement(_FilterSummary.FilterSummary, {
|
|
146
149
|
className: "".concat(blockClass, "__filter-summary"),
|
|
@@ -153,7 +156,7 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
|
153
156
|
});
|
|
154
157
|
};
|
|
155
158
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_react2.TableContainer, {
|
|
156
|
-
className: (0, _classnames.default)("".concat(gcClass), (
|
|
159
|
+
className: (0, _classnames.default)("".concat(gcClass), (_cx5 = {}, (0, _defineProperty2.default)(_cx5, "".concat(gcClass, "-active"), gridActive), (0, _defineProperty2.default)(_cx5, "".concat(gcClass, "-active--without-toolbar"), withInlineEdit && !DatagridActions), (0, _defineProperty2.default)(_cx5, "".concat(gcClass, "-inline-edit"), withInlineEdit), (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__full-height"), withVirtualScroll || fullHeightDatagrid), (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__with-pagination"), DatagridPagination), (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__dense-header"), useDenseHeader), _cx5)),
|
|
157
160
|
title: gridTitle,
|
|
158
161
|
description: gridDescription
|
|
159
162
|
}, /*#__PURE__*/_react.default.createElement(_DatagridToolbar.default, datagridState), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -20,10 +20,10 @@ var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
|
20
20
|
var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentComponent) {
|
|
21
21
|
return function (datagridState) {
|
|
22
22
|
var row = datagridState.row;
|
|
23
|
-
var
|
|
24
|
-
expandedContentHeight = _ref.expandedContentHeight;
|
|
23
|
+
var expandedContentHeight = row.expandedContentHeight;
|
|
25
24
|
var toggleParentHoverClass = function toggleParentHoverClass(event, eventType) {
|
|
26
25
|
var _event$target;
|
|
26
|
+
/* istanbul ignore else */
|
|
27
27
|
if (event !== null && event !== void 0 && (_event$target = event.target) !== null && _event$target !== void 0 && (_event$target = _event$target.parentNode) !== null && _event$target !== void 0 && _event$target.previousElementSibling) {
|
|
28
28
|
var parentNode = event.target.parentNode.previousElementSibling;
|
|
29
29
|
if (eventType === 'enter') {
|
|
@@ -44,7 +44,7 @@ var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentCompone
|
|
|
44
44
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
45
45
|
className: "".concat(blockClass, "__expanded-row-content"),
|
|
46
46
|
style: {
|
|
47
|
-
height: expandedContentHeight
|
|
47
|
+
height: expandedContentHeight && expandedContentHeight
|
|
48
48
|
}
|
|
49
49
|
}, /*#__PURE__*/_react.default.createElement(ExpandedRowContentComponent, datagridState)));
|
|
50
50
|
};
|
|
@@ -19,13 +19,13 @@ var _stateReducer = require("./addons/stateReducer");
|
|
|
19
19
|
var _getNodeTextContent = require("../../../global/js/utils/getNodeTextContent");
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
24
|
+
* Copyright IBM Corp. 2020, 2023
|
|
25
|
+
*
|
|
26
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
27
|
+
* LICENSE file in the root directory of this source tree.
|
|
28
|
+
*/
|
|
29
29
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
30
30
|
var getAccessibilityProps = function getAccessibilityProps(header) {
|
|
31
31
|
var props = {};
|
|
@@ -38,35 +38,44 @@ var getAccessibilityProps = function getAccessibilityProps(header) {
|
|
|
38
38
|
return props;
|
|
39
39
|
};
|
|
40
40
|
var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
41
|
+
var resizerAriaLabel = datagridState.resizerAriaLabel;
|
|
41
42
|
// Used to measure the height of the table and uses that value
|
|
42
43
|
// to display a vertical line to indicate the column you are resizing
|
|
43
44
|
(0, _react.useEffect)(function () {
|
|
44
45
|
var tableId = datagridState.tableId;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
rowHeight: headerRowElement.clientHeight
|
|
64
|
-
});
|
|
65
|
-
}
|
|
46
|
+
var gridElement = document.querySelector("#".concat(tableId));
|
|
47
|
+
var tableElement = gridElement.querySelector('table');
|
|
48
|
+
var headerRowElement = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head"));
|
|
49
|
+
var hasHorizontalScrollbar = tableElement.scrollWidth > tableElement.clientWidth;
|
|
50
|
+
var scrollBuffer = hasHorizontalScrollbar ? 18 : 2;
|
|
51
|
+
var tableToolbar = gridElement.querySelector(".".concat(blockClass, "__table-toolbar"));
|
|
52
|
+
var tableToolbarHeight = (tableToolbar === null || tableToolbar === void 0 ? void 0 : tableToolbar.offsetHeight) || 0;
|
|
53
|
+
var setCustomValues = function setCustomValues(_ref) {
|
|
54
|
+
var rowHeight = _ref.rowHeight,
|
|
55
|
+
gridHeight = _ref.gridHeight;
|
|
56
|
+
headerRowElement.style.setProperty("--".concat(blockClass, "--row-height"), (0, _layout.px)(rowHeight));
|
|
57
|
+
headerRowElement.style.setProperty("--".concat(blockClass, "--grid-height"), (0, _layout.px)(gridHeight - scrollBuffer - tableToolbarHeight));
|
|
58
|
+
headerRowElement.style.setProperty("--".concat(blockClass, "--header-height"), (0, _layout.px)(headerRowElement.offsetHeight));
|
|
59
|
+
};
|
|
60
|
+
setCustomValues({
|
|
61
|
+
gridHeight: gridElement.offsetHeight,
|
|
62
|
+
rowHeight: headerRowElement.clientHeight
|
|
63
|
+
});
|
|
66
64
|
}, [datagridState.rowSize, datagridState.tableId, datagridState]);
|
|
67
65
|
var _useState = (0, _react.useState)(2),
|
|
68
66
|
_useState2 = (0, _slicedToArray2.default)(_useState, 1),
|
|
69
67
|
incrementAmount = _useState2[0];
|
|
68
|
+
var handleOnMouseDownResize = function handleOnMouseDownResize(event, resizeProps) {
|
|
69
|
+
var _resizeProps = _objectSpread({}, resizeProps()),
|
|
70
|
+
onMouseDown = _resizeProps.onMouseDown;
|
|
71
|
+
// When event.button is 2, that is a right click
|
|
72
|
+
// and we do not want to resize
|
|
73
|
+
if (event.button === 2 || event.ctrlKey) {
|
|
74
|
+
event.target.blur();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
onMouseDown === null || onMouseDown === void 0 || onMouseDown(event);
|
|
78
|
+
};
|
|
70
79
|
return /*#__PURE__*/_react.default.createElement(_react2.TableRow, (0, _extends2.default)({}, headerGroup.getHeaderGroupProps(), {
|
|
71
80
|
className: (0, _classnames.default)("".concat(blockClass, "__head"), headerGroup.getHeaderGroupProps().className),
|
|
72
81
|
ref: headRef
|
|
@@ -96,6 +105,9 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
|
96
105
|
key: header.id,
|
|
97
106
|
"aria-hidden": header.id === 'spacer' && 'true'
|
|
98
107
|
}, getAccessibilityProps(header)), header.render('Header'), header.getResizerProps && !header.isAction && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({}, header.getResizerProps(), {
|
|
108
|
+
onMouseDown: function onMouseDown(event) {
|
|
109
|
+
return handleOnMouseDownResize(event, header.getResizerProps);
|
|
110
|
+
},
|
|
99
111
|
onKeyDown: function onKeyDown(event) {
|
|
100
112
|
var key = event.key;
|
|
101
113
|
if (key === 'ArrowLeft' || key === 'ArrowRight') {
|
|
@@ -119,7 +131,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
|
119
131
|
className: (0, _classnames.default)("".concat(blockClass, "__col-resizer-range")),
|
|
120
132
|
type: "range",
|
|
121
133
|
defaultValue: originalCol.width,
|
|
122
|
-
"aria-label":
|
|
134
|
+
"aria-label": resizerAriaLabel || 'Resize column'
|
|
123
135
|
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
124
136
|
className: "".concat(blockClass, "__col-resize-indicator")
|
|
125
137
|
})));
|
|
@@ -15,14 +15,12 @@ var _react2 = require("@carbon/react");
|
|
|
15
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
16
|
var _settings = require("../../../settings");
|
|
17
17
|
var _excluded = ["onChange"];
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
18
|
+
/**
|
|
19
|
+
* Copyright IBM Corp. 2020, 2023
|
|
20
|
+
*
|
|
21
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
22
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
23
|
*/
|
|
25
|
-
// @flow
|
|
26
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
27
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
26
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
@@ -33,6 +31,7 @@ var SelectAll = exports.SelectAll = function SelectAll(datagridState) {
|
|
|
33
31
|
windowSize = _useState2[0],
|
|
34
32
|
setWindowSize = _useState2[1];
|
|
35
33
|
(0, _react.useLayoutEffect)(function () {
|
|
34
|
+
/* istanbul ignore next */
|
|
36
35
|
function updateSize() {
|
|
37
36
|
setWindowSize(window.innerWidth);
|
|
38
37
|
}
|
|
@@ -53,15 +52,15 @@ var SelectAll = exports.SelectAll = function SelectAll(datagridState) {
|
|
|
53
52
|
var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
|
|
54
53
|
if (hideSelectAll || radio) {
|
|
55
54
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
56
|
-
className: (0, _classnames.default)("".concat(blockClass, "__head-hidden-select-all"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__select-all-sticky-left"),
|
|
55
|
+
className: (0, _classnames.default)("".concat(blockClass, "__head-hidden-select-all"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__select-all-sticky-left"), /* istanbul ignore next */
|
|
56
|
+
isFirstColumnStickyLeft && windowSize > 671))
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
var getProps = DatagridPagination ? getToggleAllPageRowsSelectedProps : getToggleAllRowsSelectedProps;
|
|
60
60
|
var _getProps = getProps(),
|
|
61
61
|
onChange = _getProps.onChange,
|
|
62
62
|
selectProps = (0, _objectWithoutProperties2.default)(_getProps, _excluded);
|
|
63
|
-
var
|
|
64
|
-
indeterminate = _ref.indeterminate;
|
|
63
|
+
var indeterminate = selectProps.indeterminate;
|
|
65
64
|
var handleSelectAllChange = function handleSelectAllChange(event) {
|
|
66
65
|
if (indeterminate) {
|
|
67
66
|
return onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
@@ -73,7 +72,8 @@ var SelectAll = exports.SelectAll = function SelectAll(datagridState) {
|
|
|
73
72
|
return onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
74
73
|
};
|
|
75
74
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
76
|
-
className: (0, _classnames.default)("".concat(blockClass, "__head-select-all"), "".concat(blockClass, "__checkbox-cell"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__checkbox-cell-sticky-left"),
|
|
75
|
+
className: (0, _classnames.default)("".concat(blockClass, "__head-select-all"), "".concat(blockClass, "__checkbox-cell"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__checkbox-cell-sticky-left"), /* istanbul ignore next */
|
|
76
|
+
isFirstColumnStickyLeft && windowSize > 671))
|
|
77
77
|
}, /*#__PURE__*/_react.default.createElement(_react2.TableSelectAll, (0, _extends2.default)({}, selectProps, {
|
|
78
78
|
name: "".concat(tableId, "-select-all-checkbox-name"),
|
|
79
79
|
onSelect: handleSelectAllChange,
|
|
@@ -41,7 +41,10 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
|
41
41
|
toggleAllRowsSelected = datagridState.toggleAllRowsSelected,
|
|
42
42
|
toolbarBatchActions = datagridState.toolbarBatchActions,
|
|
43
43
|
setGlobalFilter = datagridState.setGlobalFilter,
|
|
44
|
-
rows = datagridState.rows
|
|
44
|
+
rows = datagridState.rows,
|
|
45
|
+
batchActionMenuButtonLabel = datagridState.batchActionMenuButtonLabel,
|
|
46
|
+
translateWithIdBatchActions = datagridState.translateWithIdBatchActions;
|
|
47
|
+
var batchActionMenuButtonLabelText = batchActionMenuButtonLabel !== null && batchActionMenuButtonLabel !== void 0 ? batchActionMenuButtonLabel : 'More';
|
|
45
48
|
var selectedKeys = Object.keys(selectedRowIds || {});
|
|
46
49
|
var totalSelected = selectedKeys.length;
|
|
47
50
|
|
|
@@ -94,7 +97,7 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
|
94
97
|
});
|
|
95
98
|
};
|
|
96
99
|
return /*#__PURE__*/_react.default.createElement(_react2.MenuButton, {
|
|
97
|
-
label:
|
|
100
|
+
label: batchActionMenuButtonLabelText,
|
|
98
101
|
className: (0, _classnames.default)([menuClass, (0, _defineProperty2.default)({}, "".concat(menuClass, "-icon-only"), width <= minWidthBeforeOverflowIcon)])
|
|
99
102
|
}, toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
|
100
103
|
var hidden = index < 2 && !displayAllInMenu;
|
|
@@ -126,7 +129,8 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
|
126
129
|
totalSelected: totalSelected,
|
|
127
130
|
onCancel: onCancelHandler,
|
|
128
131
|
onSelectAll: onSelectAllHandler,
|
|
129
|
-
totalCount: rows && rows.length
|
|
132
|
+
totalCount: rows && rows.length,
|
|
133
|
+
translateWithId: translateWithIdBatchActions
|
|
130
134
|
}, !displayAllInMenu && toolbarBatchActions && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
|
131
135
|
if (index < 2 && toolbarBatchActions.length > 3 || index < 3 && toolbarBatchActions.length <= 3) {
|
|
132
136
|
return /*#__PURE__*/_react.default.createElement(_react2.TableBatchAction, {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
11
|
var _reactWindow = require("react-window");
|
|
@@ -48,19 +47,15 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
|
48
47
|
DatagridPagination = datagridState.DatagridPagination,
|
|
49
48
|
page = datagridState.page,
|
|
50
49
|
handleResize = datagridState.handleResize,
|
|
51
|
-
gridRef = datagridState.gridRef
|
|
50
|
+
gridRef = datagridState.gridRef,
|
|
51
|
+
tableId = datagridState.tableId;
|
|
52
|
+
|
|
53
|
+
/* istanbul ignore next */
|
|
52
54
|
var handleVirtualGridResize = function handleVirtualGridResize() {
|
|
53
55
|
var gridRefElement = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current;
|
|
54
56
|
gridRefElement.style.width = gridRefElement === null || gridRefElement === void 0 ? void 0 : gridRefElement.clientWidth;
|
|
55
57
|
};
|
|
56
58
|
(0, _useResizeObserver.useResizeObserver)(gridRef, handleVirtualGridResize);
|
|
57
|
-
var syncScroll = function syncScroll(event) {
|
|
58
|
-
var virtualBody = event.target;
|
|
59
|
-
document.querySelector(".".concat(blockClass, "__head-wrap")).scrollLeft = virtualBody.scrollLeft;
|
|
60
|
-
var spacerColumn = document.querySelector(".".concat(blockClass, "__head-wrap thead th:last-child"));
|
|
61
|
-
spacerColumn.style.width = (0, _layout.px)(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
|
|
62
|
-
};
|
|
63
|
-
|
|
64
59
|
(0, _react.useEffect)(function () {
|
|
65
60
|
handleResize();
|
|
66
61
|
}, [handleResize]);
|
|
@@ -69,15 +64,30 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
|
69
64
|
listRef.current.resetAfterIndex(0);
|
|
70
65
|
}
|
|
71
66
|
var visibleRows = DatagridPagination && page || rows;
|
|
67
|
+
var testRef = (0, _react.useRef)();
|
|
68
|
+
|
|
69
|
+
// Sync the scrollLeft position of the virtual body to the table header
|
|
70
|
+
(0, _react.useEffect)(function () {
|
|
71
|
+
function handleScroll(event) {
|
|
72
|
+
var virtualBody = event.target;
|
|
73
|
+
document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap")).scrollLeft = virtualBody.scrollLeft;
|
|
74
|
+
var spacerColumn = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap thead th:last-child"));
|
|
75
|
+
spacerColumn.style.width = (0, _layout.px)(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
var testRefValue = testRef.current;
|
|
79
|
+
testRefValue.addEventListener('scroll', handleScroll);
|
|
80
|
+
return function () {
|
|
81
|
+
testRefValue.removeEventListener('scroll', handleScroll);
|
|
82
|
+
};
|
|
83
|
+
});
|
|
72
84
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
73
85
|
className: "".concat(blockClass, "__head-wrap"),
|
|
74
86
|
style: {
|
|
75
87
|
width: (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
|
|
76
88
|
overflow: 'hidden'
|
|
77
89
|
}
|
|
78
|
-
}, /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState)), /*#__PURE__*/_react.default.createElement(_react2.TableBody, (
|
|
79
|
-
onScroll: syncScroll
|
|
80
|
-
}), /*#__PURE__*/_react.default.createElement(_reactWindow.VariableSizeList, {
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState)), /*#__PURE__*/_react.default.createElement(_react2.TableBody, getTableBodyProps(), /*#__PURE__*/_react.default.createElement(_reactWindow.VariableSizeList, {
|
|
81
91
|
height: virtualHeight || tableHeight,
|
|
82
92
|
itemCount: visibleRows.length,
|
|
83
93
|
itemSize: function itemSize(index) {
|
|
@@ -86,6 +96,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
|
86
96
|
estimatedItemSize: rowHeight,
|
|
87
97
|
onScroll: onScroll,
|
|
88
98
|
innerRef: innerListRef,
|
|
99
|
+
outerRef: testRef,
|
|
89
100
|
ref: listRef,
|
|
90
101
|
className: "".concat(blockClass, "__virtual-scrollbar"),
|
|
91
102
|
style: {
|
|
@@ -71,10 +71,10 @@ var DraggableItemsList = exports.DraggableItemsList = function DraggableItemsLis
|
|
|
71
71
|
if (destOverCol !== null && destOverCol !== void 0 && destOverCol.length && (_destOverCol$ = destOverCol[0]) !== null && _destOverCol$ !== void 0 && _destOverCol$.disabled) {
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
var fromVisibleIndex =
|
|
74
|
+
var fromVisibleIndex = updatedDragCols.findIndex(function (col) {
|
|
75
75
|
return matchedColsById(col, active);
|
|
76
76
|
});
|
|
77
|
-
var toVisibleIndex =
|
|
77
|
+
var toVisibleIndex = updatedDragCols.findIndex(function (col) {
|
|
78
78
|
return matchedColsById(col, over);
|
|
79
79
|
});
|
|
80
80
|
var colTitle = (0, _getNodeTextContent.getNodeTextContent)(updatedDragCols[fromVisibleIndex].Header);
|