@carbon/ibm-products 1.41.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 +21 -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 +21 -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 +21 -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/Datagrid/Datagrid/DatagridContent.js +10 -3
- 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/useCustomizeColumns.js +13 -15
- 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/Datagrid/Datagrid/DatagridContent.js +10 -3
- 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/useCustomizeColumns.js +7 -7
- 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/styles/_datagrid.scss +5 -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/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) {
|
|
@@ -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,
|
|
@@ -120,7 +127,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
|
120
127
|
}, renderTable()) : withVirtualScroll ? /*#__PURE__*/React.createElement("div", {
|
|
121
128
|
className: "".concat(blockClass, "__virtualScrollContainer"),
|
|
122
129
|
ref: gridRef
|
|
123
|
-
}, renderTable()) : renderTable())), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && /*#__PURE__*/React.createElement(DatagridPagination, datagridState),
|
|
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, {
|
|
124
131
|
instance: datagridState
|
|
125
132
|
}));
|
|
126
133
|
};
|
|
@@ -130,7 +137,7 @@ DatagridContent.propTypes = {
|
|
|
130
137
|
withVirtualScroll: PropTypes.bool,
|
|
131
138
|
DatagridActions: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
132
139
|
DatagridPagination: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
133
|
-
|
|
140
|
+
CustomizeColumnsTearsheet: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
134
141
|
isFetching: PropTypes.bool,
|
|
135
142
|
leftPanel: PropTypes.object,
|
|
136
143
|
fullHeightDatagrid: PropTypes.bool,
|
|
@@ -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;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
9
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
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.
|
|
10
8
|
*/
|
|
11
9
|
|
|
12
10
|
import React from 'react';
|
|
@@ -31,7 +29,6 @@ var getNextIndex = function getNextIndex(array, currentIndex, key) {
|
|
|
31
29
|
return newIndex;
|
|
32
30
|
};
|
|
33
31
|
var Columns = function Columns(_ref) {
|
|
34
|
-
var _classNames;
|
|
35
32
|
var getVisibleColumnsCount = _ref.getVisibleColumnsCount,
|
|
36
33
|
filterString = _ref.filterString,
|
|
37
34
|
columns = _ref.columns,
|
|
@@ -70,12 +67,7 @@ var Columns = function Columns(_ref) {
|
|
|
70
67
|
e.stopPropagation();
|
|
71
68
|
}
|
|
72
69
|
},
|
|
73
|
-
tabIndex: 0
|
|
74
|
-
onFocus: function onFocus(e) {
|
|
75
|
-
if (e.target === e.currentTarget) {
|
|
76
|
-
setFocusIndex(0);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
70
|
+
tabIndex: 0
|
|
79
71
|
}, /*#__PURE__*/React.createElement("span", {
|
|
80
72
|
"aria-live": "assertive",
|
|
81
73
|
className: "".concat(blockClass, "__shared-ui--assistive-text")
|
|
@@ -84,7 +76,7 @@ var Columns = function Columns(_ref) {
|
|
|
84
76
|
className: "".concat(blockClass, "__shared-ui--assistive-text")
|
|
85
77
|
}, filterString.length === 0 ? assistiveTextInstructionsLabel : assistiveTextDisabledInstructionsLabel), /*#__PURE__*/React.createElement("div", {
|
|
86
78
|
id: "".concat(blockClass, "__customize-columns-select-all"),
|
|
87
|
-
className: classNames(
|
|
79
|
+
className: classNames("".concat(blockClass, "__customize-columns-select-all"), _defineProperty({}, "".concat(blockClass, "__customize-columns-select-all--selected"), getVisibleColumnsCount() > 0)),
|
|
88
80
|
selected: getVisibleColumnsCount() > 0
|
|
89
81
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
90
82
|
wrapperClassName: "".concat(blockClass, "__customize-columns-checkbox-wrapper"),
|
|
@@ -98,6 +90,24 @@ var Columns = function Columns(_ref) {
|
|
|
98
90
|
})), columns.filter(function (colDef) {
|
|
99
91
|
return filterString.length === 0 || colDef.Header.props.title.toLowerCase().includes(filterString);
|
|
100
92
|
}).map(function (colDef, i) {
|
|
93
|
+
var searchString = new RegExp('(' + filterString + ')');
|
|
94
|
+
var res = filterString.length ? colDef.Header.props.title.toLowerCase().split(searchString) : null;
|
|
95
|
+
var firstWord = res !== null ? res[0] === '' ? res[1].charAt(0).toUpperCase() + res[1].substring(1) : res[0].charAt(0).toUpperCase() + res[0].substring(1) : null;
|
|
96
|
+
var highlightedText = res !== null ? res[0] === '' ? "<strong>".concat(firstWord, "</strong>") + res[2] : firstWord + "<strong>".concat(res[1], "</strong>") + res[2] : colDef.Header.props.title;
|
|
97
|
+
var listContents = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
98
|
+
wrapperClassName: "".concat(blockClass, "__customize-columns-checkbox-wrapper"),
|
|
99
|
+
checked: isColumnVisible(colDef),
|
|
100
|
+
onChange: onSelectColumn.bind(null, colDef),
|
|
101
|
+
id: "".concat(blockClass, "__customization-column-").concat(colDef.id),
|
|
102
|
+
labelText: colDef.Header.props.title,
|
|
103
|
+
title: colDef.Header.props.title,
|
|
104
|
+
className: "".concat(blockClass, "__customize-columns-checkbox"),
|
|
105
|
+
hideLabel: true
|
|
106
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
107
|
+
dangerouslySetInnerHTML: {
|
|
108
|
+
__html: highlightedText
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
101
111
|
return /*#__PURE__*/React.createElement(DraggableElement, {
|
|
102
112
|
key: colDef.id,
|
|
103
113
|
index: i,
|
|
@@ -125,15 +135,7 @@ var Columns = function Columns(_ref) {
|
|
|
125
135
|
}
|
|
126
136
|
},
|
|
127
137
|
selected: isColumnVisible(colDef)
|
|
128
|
-
},
|
|
129
|
-
wrapperClassName: "".concat(blockClass, "__customize-columns-checkbox-wrapper"),
|
|
130
|
-
checked: isColumnVisible(colDef),
|
|
131
|
-
onChange: onSelectColumn.bind(null, colDef),
|
|
132
|
-
id: "".concat(blockClass, "__customization-column-").concat(colDef.id),
|
|
133
|
-
labelText: colDef.Header.props.title,
|
|
134
|
-
title: colDef.Header.props.title,
|
|
135
|
-
className: "".concat(blockClass, "__customize-columns-checkbox")
|
|
136
|
-
}));
|
|
138
|
+
}, listContents);
|
|
137
139
|
}))));
|
|
138
140
|
};
|
|
139
141
|
Columns.propTypes = {
|
|
@@ -2,31 +2,30 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
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. 2022, 2022
|
|
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
|
*/
|
|
12
|
-
|
|
11
|
+
|
|
13
12
|
import React, { useEffect, useState } from 'react';
|
|
14
13
|
import PropTypes from 'prop-types';
|
|
15
|
-
import { Modal } from 'carbon-components-react';
|
|
16
14
|
import { isColumnVisible } from './common';
|
|
17
15
|
import Columns from './Columns';
|
|
18
16
|
import Actions from './Actions';
|
|
19
17
|
import { pkg } from '../../../../../settings';
|
|
20
18
|
import { useCallback } from 'react';
|
|
19
|
+
import { TearsheetNarrow } from '../../../../Tearsheet';
|
|
21
20
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
22
|
-
var
|
|
21
|
+
var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
23
22
|
var isOpen = _ref.isOpen,
|
|
24
|
-
|
|
23
|
+
setIsTearsheetOpen = _ref.setIsTearsheetOpen,
|
|
25
24
|
onSaveColumnPrefs = _ref.onSaveColumnPrefs,
|
|
26
25
|
columnDefinitions = _ref.columnDefinitions,
|
|
27
26
|
originalColumnDefinitions = _ref.originalColumnDefinitions,
|
|
28
|
-
_ref$
|
|
29
|
-
|
|
27
|
+
_ref$customizeTearshe = _ref.customizeTearsheetHeadingLabel,
|
|
28
|
+
customizeTearsheetHeadingLabel = _ref$customizeTearshe === void 0 ? 'Customize columns' : _ref$customizeTearshe,
|
|
30
29
|
_ref$primaryButtonTex = _ref.primaryButtonTextLabel,
|
|
31
30
|
primaryButtonTextLabel = _ref$primaryButtonTex === void 0 ? 'Save' : _ref$primaryButtonTex,
|
|
32
31
|
_ref$secondaryButtonT = _ref.secondaryButtonTextLabel,
|
|
@@ -80,10 +79,10 @@ var CustomizeColumnsModal = function CustomizeColumnsModal(_ref) {
|
|
|
80
79
|
isDirty = _useState10[0],
|
|
81
80
|
setIsDirty = _useState10[1];
|
|
82
81
|
var onRequestClose = function onRequestClose() {
|
|
83
|
-
|
|
82
|
+
setIsTearsheetOpen(false);
|
|
84
83
|
};
|
|
85
84
|
var onRequestSubmit = function onRequestSubmit() {
|
|
86
|
-
|
|
85
|
+
setIsTearsheetOpen(false);
|
|
87
86
|
var updatedColumns = columnObjects.map(function (colDef) {
|
|
88
87
|
return {
|
|
89
88
|
id: colDef.id,
|
|
@@ -119,21 +118,22 @@ var CustomizeColumnsModal = function CustomizeColumnsModal(_ref) {
|
|
|
119
118
|
setVisibleColumnsCount(getVisibleColumnsCount());
|
|
120
119
|
setTotalColumns(columnObjects.length);
|
|
121
120
|
}, [getVisibleColumnsCount, columnObjects.length]);
|
|
122
|
-
return /*#__PURE__*/React.createElement(
|
|
123
|
-
className: "".concat(blockClass, "__customize-columns-
|
|
121
|
+
return /*#__PURE__*/React.createElement(TearsheetNarrow, {
|
|
122
|
+
className: "".concat(blockClass, "__customize-columns-tearsheet"),
|
|
124
123
|
open: isOpen,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
124
|
+
title: "".concat(customizeTearsheetHeadingLabel, " (").concat(visibleColumnsCount, "/").concat(totalColumns, ")"),
|
|
125
|
+
description: instructionsLabel,
|
|
126
|
+
actions: [{
|
|
127
|
+
kind: 'secondary',
|
|
128
|
+
label: secondaryButtonTextLabel,
|
|
129
|
+
onClick: onRequestClose
|
|
130
|
+
}, {
|
|
131
|
+
kind: 'primary',
|
|
132
|
+
label: primaryButtonTextLabel,
|
|
133
|
+
onClick: onRequestSubmit,
|
|
134
|
+
disabled: !isDirty
|
|
135
|
+
}]
|
|
136
|
+
}, /*#__PURE__*/React.createElement(Actions, {
|
|
137
137
|
columns: columnObjects,
|
|
138
138
|
originalColumnDefinitions: originalColumnDefinitions,
|
|
139
139
|
searchText: searchText,
|
|
@@ -158,11 +158,11 @@ var CustomizeColumnsModal = function CustomizeColumnsModal(_ref) {
|
|
|
158
158
|
selectAllLabel: selectAllLabel
|
|
159
159
|
}));
|
|
160
160
|
};
|
|
161
|
-
|
|
161
|
+
CustomizeColumnsTearsheet.propTypes = {
|
|
162
162
|
assistiveTextDisabledInstructionsLabel: PropTypes.string,
|
|
163
163
|
assistiveTextInstructionsLabel: PropTypes.string,
|
|
164
164
|
columnDefinitions: PropTypes.array.isRequired,
|
|
165
|
-
|
|
165
|
+
customizeTearsheetHeadingLabel: PropTypes.string,
|
|
166
166
|
findColumnPlaceholderLabel: PropTypes.string,
|
|
167
167
|
instructionsLabel: PropTypes.string,
|
|
168
168
|
isOpen: PropTypes.bool.isRequired,
|
|
@@ -172,6 +172,6 @@ CustomizeColumnsModal.propTypes = {
|
|
|
172
172
|
resetToDefaultLabel: PropTypes.string,
|
|
173
173
|
secondaryButtonTextLabel: PropTypes.string,
|
|
174
174
|
selectAllLabel: PropTypes.string,
|
|
175
|
-
|
|
175
|
+
setIsTearsheetOpen: PropTypes.func.isRequired
|
|
176
176
|
};
|
|
177
|
-
export default
|
|
177
|
+
export default CustomizeColumnsTearsheet;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["onSaveColumnPrefs", "isTearsheetOpen", "setIsTearsheetOpen", "labels"];
|
|
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.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import CustomizeColumnsTearsheet from './CustomizeColumnsTearsheet';
|
|
14
|
+
var TearsheetWrapper = function TearsheetWrapper(_ref) {
|
|
15
|
+
var instance = _ref.instance;
|
|
16
|
+
var _instance$customizeCo = instance.customizeColumnsProps,
|
|
17
|
+
_onSaveColumnPrefs = _instance$customizeCo.onSaveColumnPrefs,
|
|
18
|
+
isTearsheetOpen = _instance$customizeCo.isTearsheetOpen,
|
|
19
|
+
setIsTearsheetOpen = _instance$customizeCo.setIsTearsheetOpen,
|
|
20
|
+
labels = _instance$customizeCo.labels,
|
|
21
|
+
rest = _objectWithoutProperties(_instance$customizeCo, _excluded);
|
|
22
|
+
return /*#__PURE__*/React.createElement(CustomizeColumnsTearsheet, _extends({}, rest, labels, {
|
|
23
|
+
isOpen: isTearsheetOpen,
|
|
24
|
+
setIsTearsheetOpen: setIsTearsheetOpen,
|
|
25
|
+
columnDefinitions: instance.allColumns,
|
|
26
|
+
originalColumnDefinitions: instance.columns,
|
|
27
|
+
onSaveColumnPrefs: function onSaveColumnPrefs(updatedColDefs) {
|
|
28
|
+
var hiddenIds = updatedColDefs.filter(function (colDef) {
|
|
29
|
+
return !colDef.isVisible;
|
|
30
|
+
}).map(function (colDef) {
|
|
31
|
+
return colDef.id;
|
|
32
|
+
});
|
|
33
|
+
instance.setHiddenColumns(hiddenIds);
|
|
34
|
+
if (typeof instance.setColumnOrder === 'function') {
|
|
35
|
+
instance.setColumnOrder(updatedColDefs.map(function (colDef) {
|
|
36
|
+
return colDef.id;
|
|
37
|
+
}));
|
|
38
|
+
} else {
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.warn("Column order can not be updated. Did you forget to add 'useColumnOrder' in 'useDatagrid'");
|
|
41
|
+
}
|
|
42
|
+
if (typeof _onSaveColumnPrefs === 'function') {
|
|
43
|
+
_onSaveColumnPrefs(updatedColDefs);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
TearsheetWrapper.propTypes = {
|
|
49
|
+
instance: PropTypes.object.isRequired
|
|
50
|
+
};
|
|
51
|
+
export default TearsheetWrapper;
|