@carbon/ibm-products 1.40.0 → 1.41.1
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 +39 -65
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -2
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +1 -0
- 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 +39 -65
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +39 -65
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/css/index.min.css.map +1 -1
- package/es/components/APIKeyModal/APIKeyDownloader.js +21 -23
- package/es/components/APIKeyModal/APIKeyModal.js +43 -45
- package/es/components/AddSelect/AddSelectBody.js +1 -1
- package/es/components/AddSelect/hooks/usePath.js +7 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +1 -1
- package/es/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +1 -1
- package/es/components/CreateFullPage/CreateFullPage.js +8 -2
- package/es/components/CreateTearsheet/CreateTearsheet.js +8 -2
- package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +4 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +1 -3
- package/es/components/DataSpreadsheet/utils/handleCellDeletion.js +5 -4
- package/es/components/Datagrid/Datagrid/DatagridContent.js +18 -6
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +9 -3
- package/es/components/Datagrid/Datagrid/DatagridRow.js +2 -8
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +27 -8
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +7 -9
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +11 -13
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +26 -24
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/{CustomizeColumnsModal.js → CustomizeColumnsTearsheet.js} +32 -32
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +51 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +6 -7
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +26 -36
- package/es/components/Datagrid/Datagrid.stories/index.js +1 -1
- package/es/components/Datagrid/useCustomizeColumns.js +13 -15
- package/es/components/Datagrid/useFiltering.js +0 -2
- package/es/components/Datagrid/useParentDimensions.js +3 -1
- package/es/components/Datagrid/utils/getArgTypes.js +5 -0
- package/es/components/Datagrid/utils/getInlineEditColumns.js +6 -1
- package/es/components/ImportModal/ImportModal.js +42 -44
- package/es/components/index.js +1 -1
- package/es/global/js/hooks/useCreateComponentFocus.js +31 -10
- package/es/global/js/hooks/useCreateComponentStepChange.js +73 -79
- package/es/global/js/utils/test-helper.js +12 -14
- package/es/global/js/utils/unwrap-if-fragment.js +1 -1
- package/lib/components/APIKeyModal/APIKeyDownloader.js +21 -23
- package/lib/components/APIKeyModal/APIKeyModal.js +43 -45
- package/lib/components/AddSelect/AddSelectBody.js +1 -1
- package/lib/components/AddSelect/hooks/usePath.js +6 -0
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +1 -1
- package/lib/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +1 -1
- package/lib/components/CreateFullPage/CreateFullPage.js +8 -2
- package/lib/components/CreateTearsheet/CreateTearsheet.js +8 -2
- package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +4 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +1 -3
- package/lib/components/DataSpreadsheet/utils/handleCellDeletion.js +5 -4
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +18 -6
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +9 -3
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +2 -11
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +27 -8
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +7 -9
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +6 -6
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +26 -24
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/{CustomizeColumnsModal.js → CustomizeColumnsTearsheet.js} +26 -25
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/{ModalWrapper.js → TearsheetWrapper.js} +30 -33
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +3 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +26 -36
- package/lib/components/Datagrid/Datagrid.stories/index.js +1 -1
- package/lib/components/Datagrid/useCustomizeColumns.js +7 -7
- package/lib/components/Datagrid/useFiltering.js +0 -2
- package/lib/components/Datagrid/useParentDimensions.js +3 -1
- package/lib/components/Datagrid/utils/getArgTypes.js +5 -0
- package/lib/components/Datagrid/utils/getInlineEditColumns.js +6 -1
- package/lib/components/ImportModal/ImportModal.js +42 -44
- package/lib/components/index.js +6 -0
- package/lib/global/js/hooks/useCreateComponentFocus.js +32 -10
- package/lib/global/js/hooks/useCreateComponentStepChange.js +73 -79
- package/lib/global/js/utils/test-helper.js +12 -14
- package/lib/global/js/utils/unwrap-if-fragment.js +1 -1
- package/package.json +10 -10
- package/scss/components/Datagrid/_storybook-styles.scss +7 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +22 -0
- package/scss/components/Datagrid/styles/_draggableElement.scss +9 -8
- package/scss/components/Datagrid/styles/_index.scss +8 -8
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsTearsheet.scss +60 -0
- package/scss/components/FilterSummary/_filter-summary.scss +1 -0
- package/scss/components/Tearsheet/_tearsheet.scss +2 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +0 -56
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsModal.scss +0 -86
|
@@ -160,54 +160,52 @@ export var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
160
160
|
var submitHandler = /*#__PURE__*/function () {
|
|
161
161
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(e) {
|
|
162
162
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
163
|
-
while (1) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
_context.next = 5;
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
setCurrentStep(currentStep + 1);
|
|
172
|
-
_context.next = 22;
|
|
163
|
+
while (1) switch (_context.prev = _context.next) {
|
|
164
|
+
case 0:
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
if (!hasNextStep) {
|
|
167
|
+
_context.next = 5;
|
|
173
168
|
break;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
onCopy(apiKey);
|
|
184
|
-
_context.next = 19;
|
|
169
|
+
}
|
|
170
|
+
setCurrentStep(currentStep + 1);
|
|
171
|
+
_context.next = 22;
|
|
172
|
+
break;
|
|
173
|
+
case 5:
|
|
174
|
+
if (!apiKeyLoaded) {
|
|
175
|
+
_context.next = 21;
|
|
185
176
|
break;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
_context.next =
|
|
189
|
-
return navigator.clipboard.writeText(apiKey);
|
|
190
|
-
case 13:
|
|
191
|
-
_context.next = 19;
|
|
177
|
+
}
|
|
178
|
+
if (!onCopy) {
|
|
179
|
+
_context.next = 10;
|
|
192
180
|
break;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
181
|
+
}
|
|
182
|
+
onCopy(apiKey);
|
|
183
|
+
_context.next = 19;
|
|
184
|
+
break;
|
|
185
|
+
case 10:
|
|
186
|
+
_context.prev = 10;
|
|
187
|
+
_context.next = 13;
|
|
188
|
+
return navigator.clipboard.writeText(apiKey);
|
|
189
|
+
case 13:
|
|
190
|
+
_context.next = 19;
|
|
191
|
+
break;
|
|
192
|
+
case 15:
|
|
193
|
+
_context.prev = 15;
|
|
194
|
+
_context.t0 = _context["catch"](10);
|
|
195
|
+
console.error(_context.t0);
|
|
196
|
+
setCopyError(true);
|
|
197
|
+
case 19:
|
|
198
|
+
_context.next = 22;
|
|
199
|
+
break;
|
|
200
|
+
case 21:
|
|
201
|
+
if (editing) {
|
|
202
|
+
onRequestEdit(name);
|
|
203
|
+
} else {
|
|
204
|
+
onRequestGenerate(name);
|
|
205
|
+
}
|
|
206
|
+
case 22:
|
|
207
|
+
case "end":
|
|
208
|
+
return _context.stop();
|
|
211
209
|
}
|
|
212
210
|
}, _callee, null, [[10, 15]]);
|
|
213
211
|
}));
|
|
@@ -152,7 +152,7 @@ export var AddSelectBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
152
152
|
onCloseHandler();
|
|
153
153
|
};
|
|
154
154
|
var setShowBreadsCrumbs = function setShowBreadsCrumbs() {
|
|
155
|
-
if (
|
|
155
|
+
if (useNormalizedItems === false || searchTerm || globalFiltersApplied) {
|
|
156
156
|
return false;
|
|
157
157
|
}
|
|
158
158
|
return true;
|
|
@@ -10,7 +10,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
10
10
|
// LICENSE file in the root directory of this source tree.
|
|
11
11
|
//
|
|
12
12
|
|
|
13
|
-
import { useState } from 'react';
|
|
13
|
+
import { useState, useEffect } from 'react';
|
|
14
14
|
var usePath = function usePath() {
|
|
15
15
|
var itemsLabel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
16
16
|
var _useState = useState([{
|
|
@@ -20,6 +20,12 @@ var usePath = function usePath() {
|
|
|
20
20
|
_useState2 = _slicedToArray(_useState, 2),
|
|
21
21
|
path = _useState2[0],
|
|
22
22
|
setPath = _useState2[1];
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
setPath([{
|
|
25
|
+
id: 'base_of_path',
|
|
26
|
+
title: itemsLabel
|
|
27
|
+
}]);
|
|
28
|
+
}, [itemsLabel]);
|
|
23
29
|
var handler = function handler(id, title, parentId) {
|
|
24
30
|
if (path.find(function (entry) {
|
|
25
31
|
return entry.id === id;
|
|
@@ -7,7 +7,7 @@ var _excluded = ["breadcrumbs", "className", "maxVisible", "noTrailingSlash", "o
|
|
|
7
7
|
_excluded3 = ["className", "key", "label", "title"];
|
|
8
8
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
9
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
//
|
|
12
12
|
// Copyright IBM Corp. 2020, 2021
|
|
13
13
|
//
|
|
@@ -10,7 +10,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
10
10
|
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; }
|
|
11
11
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
12
12
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
14
|
//
|
|
15
15
|
// Copyright IBM Corp. 2020, 2021
|
|
16
16
|
//
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "modalDangerButtonText", "modalDescription", "modalSecondaryButtonText", "modalTitle", "nextButtonText", "onClose", "onRequestSubmit", "submitButtonText"];
|
|
4
|
+
var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "modalDangerButtonText", "modalDescription", "modalSecondaryButtonText", "modalTitle", "nextButtonText", "onClose", "onRequestSubmit", "firstFocusElement", "submitButtonText"];
|
|
5
5
|
/**
|
|
6
6
|
* Copyright IBM Corp. 2021, 2022
|
|
7
7
|
*
|
|
@@ -47,6 +47,7 @@ export var CreateFullPage = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
47
47
|
nextButtonText = _ref.nextButtonText,
|
|
48
48
|
onClose = _ref.onClose,
|
|
49
49
|
onRequestSubmit = _ref.onRequestSubmit,
|
|
50
|
+
firstFocusElement = _ref.firstFocusElement,
|
|
50
51
|
submitButtonText = _ref.submitButtonText,
|
|
51
52
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
52
53
|
var _useState = useState([]),
|
|
@@ -113,7 +114,8 @@ export var CreateFullPage = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
113
114
|
previousState: previousState,
|
|
114
115
|
currentStep: currentStep,
|
|
115
116
|
blockClass: blockClass,
|
|
116
|
-
onMount: onMount
|
|
117
|
+
onMount: onMount,
|
|
118
|
+
firstFocusElement: firstFocusElement
|
|
117
119
|
});
|
|
118
120
|
useValidCreateStepCount(stepData.length, componentName);
|
|
119
121
|
useCreateComponentStepChange({
|
|
@@ -233,6 +235,10 @@ CreateFullPage.propTypes = {
|
|
|
233
235
|
* Provide an optional class to be applied to the containing node.
|
|
234
236
|
*/
|
|
235
237
|
className: PropTypes.string,
|
|
238
|
+
/**
|
|
239
|
+
* Specifies elements to focus on first on render.
|
|
240
|
+
*/
|
|
241
|
+
firstFocusElement: PropTypes.string,
|
|
236
242
|
/**
|
|
237
243
|
* The primary 'danger' button text in the modal
|
|
238
244
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "description", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "submitButtonText", "title", "verticalPosition"];
|
|
4
|
+
var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "description", "influencerWidth", "initialStep", "label", "nextButtonText", "onClose", "onRequestSubmit", "open", "firstFocusElement", "submitButtonText", "title", "verticalPosition"];
|
|
5
5
|
/**
|
|
6
6
|
* Copyright IBM Corp. 2021, 2022
|
|
7
7
|
*
|
|
@@ -52,6 +52,7 @@ export var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
52
52
|
onClose = _ref.onClose,
|
|
53
53
|
onRequestSubmit = _ref.onRequestSubmit,
|
|
54
54
|
open = _ref.open,
|
|
55
|
+
firstFocusElement = _ref.firstFocusElement,
|
|
55
56
|
submitButtonText = _ref.submitButtonText,
|
|
56
57
|
title = _ref.title,
|
|
57
58
|
_ref$verticalPosition = _ref.verticalPosition,
|
|
@@ -122,7 +123,8 @@ export var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
122
123
|
previousState: previousState,
|
|
123
124
|
currentStep: currentStep,
|
|
124
125
|
blockClass: blockClass,
|
|
125
|
-
onMount: onMount
|
|
126
|
+
onMount: onMount,
|
|
127
|
+
firstFocusElement: firstFocusElement
|
|
126
128
|
});
|
|
127
129
|
useValidCreateStepCount(stepData.length, componentName);
|
|
128
130
|
useResetCreateComponent({
|
|
@@ -248,6 +250,10 @@ CreateTearsheet.propTypes = {
|
|
|
248
250
|
* A description of the flow, displayed in the header area of the tearsheet.
|
|
249
251
|
*/
|
|
250
252
|
description: PropTypes.node,
|
|
253
|
+
/**
|
|
254
|
+
* Specifies elements to focus on first on render.
|
|
255
|
+
*/
|
|
256
|
+
firstFocusElement: PropTypes.string,
|
|
251
257
|
/**
|
|
252
258
|
* Used to set the size of the influencer
|
|
253
259
|
*/
|
|
@@ -47,7 +47,8 @@ export var MultiStepTearsheet = function MultiStepTearsheet(_ref2) {
|
|
|
47
47
|
label = _ref2.label,
|
|
48
48
|
nextButtonText = _ref2.nextButtonText,
|
|
49
49
|
submitButtonText = _ref2.submitButtonText,
|
|
50
|
-
title = _ref2.title
|
|
50
|
+
title = _ref2.title,
|
|
51
|
+
firstFocusElement = _ref2.firstFocusElement;
|
|
51
52
|
var _useState = useState(750),
|
|
52
53
|
_useState2 = _slicedToArray(_useState, 1),
|
|
53
54
|
simulatedDelay = _useState2[0];
|
|
@@ -130,7 +131,8 @@ export var MultiStepTearsheet = function MultiStepTearsheet(_ref2) {
|
|
|
130
131
|
resolve();
|
|
131
132
|
}, simulatedDelay);
|
|
132
133
|
});
|
|
133
|
-
}
|
|
134
|
+
},
|
|
135
|
+
firstFocusElement: firstFocusElement
|
|
134
136
|
}, /*#__PURE__*/React.createElement(CreateTearsheetStep, {
|
|
135
137
|
onNext: function onNext() {
|
|
136
138
|
return new Promise(function (resolve, reject) {
|
|
@@ -186,9 +186,7 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
186
186
|
// Removes the active cell element
|
|
187
187
|
var removeActiveCell = useCallback(function () {
|
|
188
188
|
var activeCellHighlight = spreadsheetRef.current.querySelector(".".concat(blockClass, "__active-cell--highlight"));
|
|
189
|
-
|
|
190
|
-
activeCellHighlight.style.display = 'none';
|
|
191
|
-
}
|
|
189
|
+
activeCellHighlight.style.display = 'none';
|
|
192
190
|
}, [spreadsheetRef]);
|
|
193
191
|
var removeCellEditor = useCallback(function () {
|
|
194
192
|
setCellEditorValue('');
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { deepCloneObject } from '../../../global/js/utils/deepCloneObject';
|
|
9
9
|
import { rangeWithCallback } from '../../../global/js/utils/rangeWithCallback';
|
|
10
10
|
export var handleCellDeletion = function handleCellDeletion(_ref) {
|
|
11
|
+
var _selectionAreaToEmpty, _selectionAreaToEmpty2, _selectionAreaToEmpty3, _selectionAreaToEmpty4, _selectionAreaToEmpty5, _selectionAreaToEmpty6, _selectionAreaToEmpty7, _selectionAreaToEmpty8;
|
|
11
12
|
var activeCellCoordinates = _ref.activeCellCoordinates,
|
|
12
13
|
selectionAreas = _ref.selectionAreas,
|
|
13
14
|
currentMatcher = _ref.currentMatcher,
|
|
@@ -25,10 +26,10 @@ export var handleCellDeletion = function handleCellDeletion(_ref) {
|
|
|
25
26
|
return item.matcher === currentMatcher;
|
|
26
27
|
});
|
|
27
28
|
var selectionAreaToEmptyContents = selectionAreaClone[indexOfCurrentSelectionArea];
|
|
28
|
-
var lowestColumnIndex = Math.min(selectionAreaToEmptyContents.point1.column, selectionAreaToEmptyContents.point2.column);
|
|
29
|
-
var greatestColumnIndex = Math.max(selectionAreaToEmptyContents.point1.column, selectionAreaToEmptyContents.point2.column);
|
|
30
|
-
var lowestRowIndex = Math.min(selectionAreaToEmptyContents.point1.row, selectionAreaToEmptyContents.point2.row);
|
|
31
|
-
var greatestRowIndex = Math.max(selectionAreaToEmptyContents.point1.row, selectionAreaToEmptyContents.point2.row);
|
|
29
|
+
var lowestColumnIndex = Math.min(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty === void 0 ? void 0 : _selectionAreaToEmpty.column, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty2 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty2 === void 0 ? void 0 : _selectionAreaToEmpty2.column);
|
|
30
|
+
var greatestColumnIndex = Math.max(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty3 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty3 === void 0 ? void 0 : _selectionAreaToEmpty3.column, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty4 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty4 === void 0 ? void 0 : _selectionAreaToEmpty4.column);
|
|
31
|
+
var lowestRowIndex = Math.min(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty5 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty5 === void 0 ? void 0 : _selectionAreaToEmpty5.row, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty6 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty6 === void 0 ? void 0 : _selectionAreaToEmpty6.row);
|
|
32
|
+
var greatestRowIndex = Math.max(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty7 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty7 === void 0 ? void 0 : _selectionAreaToEmpty7.row, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty8 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty8 === void 0 ? void 0 : _selectionAreaToEmpty8.row);
|
|
32
33
|
rangeWithCallback(lowestColumnIndex, greatestColumnIndex, function (columnIndex) {
|
|
33
34
|
rangeWithCallback(lowestRowIndex, greatestRowIndex, function (rowIndex) {
|
|
34
35
|
var cellProps = rows[rowIndex].cells[columnIndex];
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
/**
|
|
4
|
+
* Copyright IBM Corp. 2022, 2022
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
3
10
|
import React, { useContext, useEffect, useRef } from 'react';
|
|
4
11
|
import cx from 'classnames';
|
|
5
12
|
import PropTypes from 'prop-types';
|
|
@@ -29,7 +36,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
|
29
36
|
withVirtualScroll = datagridState.withVirtualScroll,
|
|
30
37
|
DatagridPagination = datagridState.DatagridPagination,
|
|
31
38
|
isFetching = datagridState.isFetching,
|
|
32
|
-
|
|
39
|
+
CustomizeColumnsTearsheet = datagridState.CustomizeColumnsTearsheet,
|
|
33
40
|
leftPanel = datagridState.leftPanel,
|
|
34
41
|
fullHeightDatagrid = datagridState.fullHeightDatagrid,
|
|
35
42
|
_datagridState$vertic = datagridState.verticalAlign,
|
|
@@ -41,7 +48,8 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
|
41
48
|
withInlineEdit = datagridState.withInlineEdit,
|
|
42
49
|
tableId = datagridState.tableId,
|
|
43
50
|
DatagridActions = datagridState.DatagridActions,
|
|
44
|
-
totalColumnsWidth = datagridState.totalColumnsWidth
|
|
51
|
+
totalColumnsWidth = datagridState.totalColumnsWidth,
|
|
52
|
+
gridRef = datagridState.gridRef;
|
|
45
53
|
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
|
46
54
|
var gridActive = state.gridActive,
|
|
47
55
|
editId = state.editId;
|
|
@@ -81,7 +89,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
|
81
89
|
onFocus: withInlineEdit ? function () {
|
|
82
90
|
return handleGridFocus(state, dispatch);
|
|
83
91
|
} : null
|
|
84
|
-
}), /*#__PURE__*/React.createElement(DatagridHead, datagridState), /*#__PURE__*/React.createElement(DatagridBody, _extends({}, datagridState, {
|
|
92
|
+
}), !withVirtualScroll ? /*#__PURE__*/React.createElement(DatagridHead, datagridState) : null, /*#__PURE__*/React.createElement(DatagridBody, _extends({}, datagridState, {
|
|
85
93
|
rows: rows
|
|
86
94
|
})));
|
|
87
95
|
};
|
|
@@ -116,7 +124,10 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
|
116
124
|
className: "".concat(blockClass, "__datagridLeftPanel")
|
|
117
125
|
}, leftPanel.panelContent), withInlineEdit ? /*#__PURE__*/React.createElement("div", {
|
|
118
126
|
ref: multiKeyTrackingRef
|
|
119
|
-
}, renderTable()) :
|
|
127
|
+
}, renderTable()) : withVirtualScroll ? /*#__PURE__*/React.createElement("div", {
|
|
128
|
+
className: "".concat(blockClass, "__virtualScrollContainer"),
|
|
129
|
+
ref: gridRef
|
|
130
|
+
}, renderTable()) : renderTable())), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && /*#__PURE__*/React.createElement(DatagridPagination, datagridState), CustomizeColumnsTearsheet && /*#__PURE__*/React.createElement(CustomizeColumnsTearsheet, {
|
|
120
131
|
instance: datagridState
|
|
121
132
|
}));
|
|
122
133
|
};
|
|
@@ -126,7 +137,7 @@ DatagridContent.propTypes = {
|
|
|
126
137
|
withVirtualScroll: PropTypes.bool,
|
|
127
138
|
DatagridActions: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
128
139
|
DatagridPagination: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
129
|
-
|
|
140
|
+
CustomizeColumnsTearsheet: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
130
141
|
isFetching: PropTypes.bool,
|
|
131
142
|
leftPanel: PropTypes.object,
|
|
132
143
|
fullHeightDatagrid: PropTypes.bool,
|
|
@@ -139,6 +150,7 @@ DatagridContent.propTypes = {
|
|
|
139
150
|
page: PropTypes.arrayOf(PropTypes.object),
|
|
140
151
|
rows: PropTypes.arrayOf(PropTypes.object),
|
|
141
152
|
tableId: PropTypes.string,
|
|
142
|
-
totalColumnsWidth: PropTypes.number
|
|
153
|
+
totalColumnsWidth: PropTypes.number,
|
|
154
|
+
gridRef: PropTypes.object
|
|
143
155
|
})
|
|
144
156
|
};
|
|
@@ -22,7 +22,9 @@ var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
|
|
|
22
22
|
emptyStateSize = datagridState.emptyStateSize,
|
|
23
23
|
_datagridState$emptyS = datagridState.emptyStateType,
|
|
24
24
|
emptyStateType = _datagridState$emptyS === void 0 ? 'noData' : _datagridState$emptyS,
|
|
25
|
-
illustrationTheme = datagridState.illustrationTheme
|
|
25
|
+
illustrationTheme = datagridState.illustrationTheme,
|
|
26
|
+
emptyStateAction = datagridState.emptyStateAction,
|
|
27
|
+
emptyStateLink = datagridState.emptyStateLink;
|
|
26
28
|
return /*#__PURE__*/React.createElement(TableBody, _extends({}, getTableBodyProps(), {
|
|
27
29
|
className: "".concat(blockClass, "__empty-state-body")
|
|
28
30
|
}), /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, {
|
|
@@ -31,12 +33,16 @@ var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
|
|
|
31
33
|
illustrationTheme: illustrationTheme,
|
|
32
34
|
size: emptyStateSize,
|
|
33
35
|
title: emptyStateTitle,
|
|
34
|
-
subtitle: emptyStateDescription
|
|
36
|
+
subtitle: emptyStateDescription,
|
|
37
|
+
action: emptyStateAction,
|
|
38
|
+
link: emptyStateLink
|
|
35
39
|
}), emptyStateType === 'noData' && /*#__PURE__*/React.createElement(NoDataEmptyState, {
|
|
36
40
|
illustrationTheme: illustrationTheme,
|
|
37
41
|
size: emptyStateSize,
|
|
38
42
|
title: emptyStateTitle,
|
|
39
|
-
subtitle: emptyStateDescription
|
|
43
|
+
subtitle: emptyStateDescription,
|
|
44
|
+
action: emptyStateAction,
|
|
45
|
+
link: emptyStateLink
|
|
40
46
|
}))));
|
|
41
47
|
};
|
|
42
48
|
export default DatagridEmptyBody;
|
|
@@ -10,14 +10,12 @@ var _excluded = ["children"];
|
|
|
10
10
|
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
11
11
|
*/
|
|
12
12
|
// @flow
|
|
13
|
-
import React
|
|
13
|
+
import React from 'react';
|
|
14
14
|
import { DataTable, SkeletonText } from 'carbon-components-react';
|
|
15
15
|
import { px } from '@carbon/layout';
|
|
16
16
|
import cx from 'classnames';
|
|
17
17
|
import { selectionColumnId } from '../common-column-ids';
|
|
18
18
|
import { pkg, carbon } from '../../../settings';
|
|
19
|
-
import { InlineEditContext } from './addons/InlineEdit/InlineEditContext/InlineEditContext';
|
|
20
|
-
import { getCellIdAsObject } from './addons/InlineEdit/InlineEditContext/getCellIdAsObject';
|
|
21
19
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
22
20
|
var TableRow = DataTable.TableRow,
|
|
23
21
|
TableCell = DataTable.TableCell;
|
|
@@ -35,10 +33,6 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
|
35
33
|
var row = datagridState.row,
|
|
36
34
|
rowSize = datagridState.rowSize,
|
|
37
35
|
withNestedRows = datagridState.withNestedRows;
|
|
38
|
-
var _useContext = useContext(InlineEditContext),
|
|
39
|
-
state = _useContext.state;
|
|
40
|
-
var activeCellId = state.activeCellId;
|
|
41
|
-
var activeCellObject = activeCellId && getCellIdAsObject(activeCellId);
|
|
42
36
|
var getVisibleNestedRowCount = function getVisibleNestedRowCount(_ref) {
|
|
43
37
|
var isExpanded = _ref.isExpanded,
|
|
44
38
|
subRows = _ref.subRows;
|
|
@@ -52,7 +46,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
|
52
46
|
return size;
|
|
53
47
|
};
|
|
54
48
|
return /*#__PURE__*/React.createElement(TableRow, _extends({
|
|
55
|
-
className: 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),
|
|
49
|
+
className: 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))
|
|
56
50
|
}, row.getRowProps(), {
|
|
57
51
|
key: row.id,
|
|
58
52
|
onMouseEnter: function onMouseEnter(event) {
|
|
@@ -13,6 +13,8 @@ import React, { useEffect } from 'react';
|
|
|
13
13
|
import { VariableSizeList } from 'react-window';
|
|
14
14
|
import { DataTable } from 'carbon-components-react';
|
|
15
15
|
import { pkg } from '../../../settings';
|
|
16
|
+
import DatagridHead from './DatagridHead';
|
|
17
|
+
import { px } from '@carbon/layout';
|
|
16
18
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
17
19
|
var TableBody = DataTable.TableBody;
|
|
18
20
|
var rowSizeMap = {
|
|
@@ -29,6 +31,7 @@ var rowSizeMap = {
|
|
|
29
31
|
};
|
|
30
32
|
var defaultRowHeight = rowSizeMap.lg;
|
|
31
33
|
var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
34
|
+
var _gridRef$current, _gridRef$current2;
|
|
32
35
|
var getTableBodyProps = datagridState.getTableBodyProps,
|
|
33
36
|
rows = datagridState.rows,
|
|
34
37
|
prepareRow = datagridState.prepareRow,
|
|
@@ -42,7 +45,14 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
|
42
45
|
DatagridPagination = datagridState.DatagridPagination,
|
|
43
46
|
page = datagridState.page,
|
|
44
47
|
handleResize = datagridState.handleResize,
|
|
45
|
-
|
|
48
|
+
gridRef = datagridState.gridRef;
|
|
49
|
+
var syncScroll = function syncScroll(e) {
|
|
50
|
+
var virtualBody = e.target;
|
|
51
|
+
document.querySelector(".".concat(blockClass, "__head-warp")).scrollLeft = virtualBody.scrollLeft;
|
|
52
|
+
var spacerColumn = document.querySelector(".".concat(blockClass, "__head-warp thead th:last-child"));
|
|
53
|
+
spacerColumn.style.width = px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
|
|
54
|
+
};
|
|
55
|
+
|
|
46
56
|
useEffect(function () {
|
|
47
57
|
handleResize();
|
|
48
58
|
}, [handleResize]);
|
|
@@ -51,8 +61,16 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
|
51
61
|
listRef.current.resetAfterIndex(0);
|
|
52
62
|
}
|
|
53
63
|
var visibleRows = DatagridPagination && page || rows;
|
|
54
|
-
return /*#__PURE__*/React.createElement(
|
|
55
|
-
|
|
64
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: "".concat(blockClass, "__head-warp"),
|
|
66
|
+
style: {
|
|
67
|
+
width: (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
|
|
68
|
+
overflow: 'hidden'
|
|
69
|
+
}
|
|
70
|
+
}, /*#__PURE__*/React.createElement(DatagridHead, datagridState)), /*#__PURE__*/React.createElement(TableBody, _extends({}, getTableBodyProps(), {
|
|
71
|
+
onScroll: function onScroll(e) {
|
|
72
|
+
return syncScroll(e);
|
|
73
|
+
}
|
|
56
74
|
}), /*#__PURE__*/React.createElement(VariableSizeList, {
|
|
57
75
|
height: virtualHeight || tableHeight,
|
|
58
76
|
itemCount: visibleRows.length,
|
|
@@ -63,19 +81,20 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
|
63
81
|
onScroll: onScroll,
|
|
64
82
|
innerRef: innerListRef,
|
|
65
83
|
ref: listRef,
|
|
66
|
-
className: "".concat(blockClass, "__virtual-scrollbar")
|
|
84
|
+
className: "".concat(blockClass, "__virtual-scrollbar"),
|
|
85
|
+
style: {
|
|
86
|
+
width: (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.clientWidth
|
|
87
|
+
}
|
|
67
88
|
}, function (_ref) {
|
|
68
89
|
var index = _ref.index,
|
|
69
90
|
style = _ref.style;
|
|
70
91
|
var row = visibleRows[index];
|
|
71
92
|
prepareRow(row);
|
|
72
93
|
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
-
style: _objectSpread(
|
|
74
|
-
overflow: withOverflowRow ? 'visible' : 'hidden'
|
|
75
|
-
})
|
|
94
|
+
style: _objectSpread({}, style)
|
|
76
95
|
}, row.RowRenderer(_objectSpread(_objectSpread({}, datagridState), {}, {
|
|
77
96
|
row: row
|
|
78
97
|
})));
|
|
79
|
-
}));
|
|
98
|
+
})));
|
|
80
99
|
};
|
|
81
100
|
export default DatagridVirtualBody;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
7
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022, 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
import PropTypes from 'prop-types';
|
|
@@ -17,11 +15,11 @@ var Actions = function Actions(_ref) {
|
|
|
17
15
|
setSearchText = _ref.setSearchText,
|
|
18
16
|
findColumnPlaceholderLabel = _ref.findColumnPlaceholderLabel;
|
|
19
17
|
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
-
className: "".concat(blockClass, "__customize-columns-
|
|
18
|
+
className: "".concat(blockClass, "__customize-columns-tearsheet--actions")
|
|
21
19
|
}, /*#__PURE__*/React.createElement(Search, {
|
|
22
20
|
placeholder: findColumnPlaceholderLabel,
|
|
23
21
|
value: searchText,
|
|
24
|
-
size: "
|
|
22
|
+
size: "xl",
|
|
25
23
|
labelText: findColumnPlaceholderLabel,
|
|
26
24
|
onChange: function onChange(e) {
|
|
27
25
|
// TODO: is it performant?
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["onClick", "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
10
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
3
|
+
var _excluded = ["onClick", "setIsTearsheetOpen", "isTearsheetOpen", "iconTooltipLabel"];
|
|
4
|
+
/**
|
|
5
|
+
* Copyright IBM Corp. 2022, 2022
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
9
|
*/
|
|
12
10
|
|
|
13
11
|
import * as React from 'react';
|
|
@@ -18,8 +16,8 @@ import { pkg } from '../../../../../settings';
|
|
|
18
16
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
19
17
|
var ButtonWrapper = function ButtonWrapper(_ref) {
|
|
20
18
|
var _onClick = _ref.onClick,
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
setIsTearsheetOpen = _ref.setIsTearsheetOpen,
|
|
20
|
+
isTearsheetOpen = _ref.isTearsheetOpen,
|
|
23
21
|
_ref$iconTooltipLabel = _ref.iconTooltipLabel,
|
|
24
22
|
iconTooltipLabel = _ref$iconTooltipLabel === void 0 ? 'Customize columns' : _ref$iconTooltipLabel,
|
|
25
23
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -31,7 +29,7 @@ var ButtonWrapper = function ButtonWrapper(_ref) {
|
|
|
31
29
|
hasIconOnly: true,
|
|
32
30
|
"test-id": "".concat(blockClass, "__customize-columns-trigger"),
|
|
33
31
|
onClick: function onClick() {
|
|
34
|
-
|
|
32
|
+
setIsTearsheetOpen(!isTearsheetOpen);
|
|
35
33
|
if (typeof _onClick === 'function') {
|
|
36
34
|
_onClick();
|
|
37
35
|
}
|
|
@@ -40,8 +38,8 @@ var ButtonWrapper = function ButtonWrapper(_ref) {
|
|
|
40
38
|
};
|
|
41
39
|
ButtonWrapper.propTypes = {
|
|
42
40
|
iconTooltipLabel: PropTypes.string,
|
|
43
|
-
|
|
41
|
+
isTearsheetOpen: PropTypes.bool.isRequired,
|
|
44
42
|
onClick: PropTypes.func.isRequired,
|
|
45
|
-
|
|
43
|
+
setIsTearsheetOpen: PropTypes.func.isRequired
|
|
46
44
|
};
|
|
47
45
|
export default ButtonWrapper;
|