@carbon/ibm-products 2.43.1-canary.5 → 2.43.1-canary.7
Sign up to get free protection for your applications and to get access to all the features.
- package/es/components/Datagrid/Datagrid/DatagridContent.d.ts +1 -0
- package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +19 -14
- package/es/global/js/hooks/usePortalTarget.js +1 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.d.ts +1 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +1 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +19 -14
- package/lib/global/js/hooks/usePortalTarget.js +1 -0
- package/package.json +3 -5
@@ -6,6 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { defineProperty as _defineProperty, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import '../../../feature-flags.js';
|
9
10
|
import React__default, { useContext, useRef, useEffect } from 'react';
|
10
11
|
import { TableContainer, Table } from '@carbon/react';
|
11
12
|
import { pkg, carbon } from '../../../settings.js';
|
@@ -6,6 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import '../../../../../feature-flags.js';
|
9
10
|
import React__default, { useContext, useEffect } from 'react';
|
10
11
|
import PropTypes from '../../../../../node_modules/prop-types/index.js';
|
11
12
|
import CustomizeColumnsTearsheet from './CustomizeColumnsTearsheet.js';
|
@@ -134,9 +134,14 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
134
134
|
// in edit mode, otherwise `initialValue` becomes stale
|
135
135
|
useEffect(function () {
|
136
136
|
if ((previousState === null || previousState === void 0 ? void 0 : previousState.editId) === cellId && (previousState === null || previousState === void 0 ? void 0 : previousState.activeCellId) === cellId && activeCellId !== cellId) {
|
137
|
-
|
137
|
+
var _ref4 = config || {},
|
138
|
+
validator = _ref4.validator;
|
139
|
+
var isInvalid = validator === null || validator === void 0 ? void 0 : validator(cellValue);
|
140
|
+
if (!isInvalid) {
|
141
|
+
setInitialValue(cellValue);
|
142
|
+
}
|
138
143
|
}
|
139
|
-
}, [previousState, cellId, cellValue, activeCellId]);
|
144
|
+
}, [previousState, cellId, cellValue, activeCellId, config]);
|
140
145
|
var handleInlineCellClick = function handleInlineCellClick() {
|
141
146
|
if (!inEditMode) {
|
142
147
|
dispatch({
|
@@ -212,8 +217,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
212
217
|
if (type === 'selection' || type === 'date') {
|
213
218
|
return;
|
214
219
|
}
|
215
|
-
var
|
216
|
-
validator =
|
220
|
+
var _ref5 = config || {},
|
221
|
+
validator = _ref5.validator;
|
217
222
|
var isInvalid = validator === null || validator === void 0 ? void 0 : validator(cellValue);
|
218
223
|
// If an invalid state is detected, Tab/Enter should not do anything
|
219
224
|
// until the input has a valid state once again
|
@@ -268,8 +273,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
268
273
|
} : null;
|
269
274
|
};
|
270
275
|
var renderSelectCell = function renderSelectCell() {
|
271
|
-
var
|
272
|
-
inputProps =
|
276
|
+
var _ref6 = config || {},
|
277
|
+
inputProps = _ref6.inputProps;
|
273
278
|
return /*#__PURE__*/React__default.createElement(Dropdown, _extends({
|
274
279
|
id: cellId,
|
275
280
|
label: cellLabel || 'Dropdown menu options',
|
@@ -299,8 +304,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
299
304
|
},
|
300
305
|
downshiftProps: {
|
301
306
|
onStateChange: function onStateChange(downshiftState) {
|
302
|
-
var
|
303
|
-
isOpen =
|
307
|
+
var _ref7 = downshiftState || {},
|
308
|
+
isOpen = _ref7.isOpen;
|
304
309
|
// !isOpen does not work in this case because a state change occurs on hover of the
|
305
310
|
// menu items and isOpen is changed to undefined which causes dispatch to be called unexpectedly
|
306
311
|
if (isOpen === false) {
|
@@ -399,8 +404,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
399
404
|
return null;
|
400
405
|
};
|
401
406
|
var renderNumberInput = function renderNumberInput() {
|
402
|
-
var
|
403
|
-
validator =
|
407
|
+
var _ref8 = config || {},
|
408
|
+
validator = _ref8.validator;
|
404
409
|
return /*#__PURE__*/React__default.createElement(NumberInput, _extends({
|
405
410
|
placeholder: placeholder,
|
406
411
|
label: cellLabel
|
@@ -410,8 +415,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
410
415
|
defaultValue: cellValue,
|
411
416
|
invalid: validator === null || validator === void 0 ? void 0 : validator(cellValue),
|
412
417
|
invalidText: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.invalidText) || 'Provide missing invalidText',
|
413
|
-
onChange: function onChange(event,
|
414
|
-
var value =
|
418
|
+
onChange: function onChange(event, _ref9) {
|
419
|
+
var value = _ref9.value;
|
415
420
|
setCellValue(value);
|
416
421
|
if (inputProps.onChange) {
|
417
422
|
inputProps.onChange(value);
|
@@ -421,8 +426,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
421
426
|
}));
|
422
427
|
};
|
423
428
|
var renderTextInput = function renderTextInput() {
|
424
|
-
var
|
425
|
-
validator =
|
429
|
+
var _ref10 = config || {},
|
430
|
+
validator = _ref10.validator;
|
426
431
|
var isInvalid = validator === null || validator === void 0 ? void 0 : validator(cellValue);
|
427
432
|
return /*#__PURE__*/React__default.createElement(TextInput, _extends({
|
428
433
|
labelText: cellLabel,
|
@@ -6,6 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import '../../../feature-flags.js';
|
9
10
|
import { useState, useEffect, useCallback } from 'react';
|
10
11
|
import { pkg } from '../../../settings.js';
|
11
12
|
import { createPortal } from 'react-dom';
|
@@ -10,6 +10,7 @@
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
require('../../../feature-flags.js');
|
13
14
|
var React = require('react');
|
14
15
|
var react = require('@carbon/react');
|
15
16
|
var settings = require('../../../settings.js');
|
@@ -10,6 +10,7 @@
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
require('../../../../../feature-flags.js');
|
13
14
|
var React = require('react');
|
14
15
|
var index = require('../../../../../node_modules/prop-types/index.js');
|
15
16
|
var CustomizeColumnsTearsheet = require('./CustomizeColumnsTearsheet.js');
|
@@ -143,9 +143,14 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
143
143
|
// in edit mode, otherwise `initialValue` becomes stale
|
144
144
|
React.useEffect(function () {
|
145
145
|
if ((previousState === null || previousState === void 0 ? void 0 : previousState.editId) === cellId && (previousState === null || previousState === void 0 ? void 0 : previousState.activeCellId) === cellId && activeCellId !== cellId) {
|
146
|
-
|
146
|
+
var _ref4 = config || {},
|
147
|
+
validator = _ref4.validator;
|
148
|
+
var isInvalid = validator === null || validator === void 0 ? void 0 : validator(cellValue);
|
149
|
+
if (!isInvalid) {
|
150
|
+
setInitialValue(cellValue);
|
151
|
+
}
|
147
152
|
}
|
148
|
-
}, [previousState, cellId, cellValue, activeCellId]);
|
153
|
+
}, [previousState, cellId, cellValue, activeCellId, config]);
|
149
154
|
var handleInlineCellClick = function handleInlineCellClick() {
|
150
155
|
if (!inEditMode) {
|
151
156
|
dispatch({
|
@@ -221,8 +226,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
221
226
|
if (type === 'selection' || type === 'date') {
|
222
227
|
return;
|
223
228
|
}
|
224
|
-
var
|
225
|
-
validator =
|
229
|
+
var _ref5 = config || {},
|
230
|
+
validator = _ref5.validator;
|
226
231
|
var isInvalid = validator === null || validator === void 0 ? void 0 : validator(cellValue);
|
227
232
|
// If an invalid state is detected, Tab/Enter should not do anything
|
228
233
|
// until the input has a valid state once again
|
@@ -277,8 +282,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
277
282
|
} : null;
|
278
283
|
};
|
279
284
|
var renderSelectCell = function renderSelectCell() {
|
280
|
-
var
|
281
|
-
inputProps =
|
285
|
+
var _ref6 = config || {},
|
286
|
+
inputProps = _ref6.inputProps;
|
282
287
|
return /*#__PURE__*/React__default["default"].createElement(react.Dropdown, _rollupPluginBabelHelpers["extends"]({
|
283
288
|
id: cellId,
|
284
289
|
label: cellLabel || 'Dropdown menu options',
|
@@ -308,8 +313,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
308
313
|
},
|
309
314
|
downshiftProps: {
|
310
315
|
onStateChange: function onStateChange(downshiftState) {
|
311
|
-
var
|
312
|
-
isOpen =
|
316
|
+
var _ref7 = downshiftState || {},
|
317
|
+
isOpen = _ref7.isOpen;
|
313
318
|
// !isOpen does not work in this case because a state change occurs on hover of the
|
314
319
|
// menu items and isOpen is changed to undefined which causes dispatch to be called unexpectedly
|
315
320
|
if (isOpen === false) {
|
@@ -408,8 +413,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
408
413
|
return null;
|
409
414
|
};
|
410
415
|
var renderNumberInput = function renderNumberInput() {
|
411
|
-
var
|
412
|
-
validator =
|
416
|
+
var _ref8 = config || {},
|
417
|
+
validator = _ref8.validator;
|
413
418
|
return /*#__PURE__*/React__default["default"].createElement(react.NumberInput, _rollupPluginBabelHelpers["extends"]({
|
414
419
|
placeholder: placeholder,
|
415
420
|
label: cellLabel
|
@@ -419,8 +424,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
419
424
|
defaultValue: cellValue,
|
420
425
|
invalid: validator === null || validator === void 0 ? void 0 : validator(cellValue),
|
421
426
|
invalidText: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.invalidText) || 'Provide missing invalidText',
|
422
|
-
onChange: function onChange(event,
|
423
|
-
var value =
|
427
|
+
onChange: function onChange(event, _ref9) {
|
428
|
+
var value = _ref9.value;
|
424
429
|
setCellValue(value);
|
425
430
|
if (inputProps.onChange) {
|
426
431
|
inputProps.onChange(value);
|
@@ -430,8 +435,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
430
435
|
}));
|
431
436
|
};
|
432
437
|
var renderTextInput = function renderTextInput() {
|
433
|
-
var
|
434
|
-
validator =
|
438
|
+
var _ref10 = config || {},
|
439
|
+
validator = _ref10.validator;
|
435
440
|
var isInvalid = validator === null || validator === void 0 ? void 0 : validator(cellValue);
|
436
441
|
return /*#__PURE__*/React__default["default"].createElement(react.TextInput, _rollupPluginBabelHelpers["extends"]({
|
437
442
|
labelText: cellLabel,
|
@@ -10,6 +10,7 @@
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
require('../../../feature-flags.js');
|
13
14
|
var React = require('react');
|
14
15
|
var settings = require('../../../settings.js');
|
15
16
|
var reactDom = require('react-dom');
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "2.43.1-canary.
|
4
|
+
"version": "2.43.1-canary.7+59b76216c",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -18,9 +18,7 @@
|
|
18
18
|
"**/global/js/utils/props-helper.js",
|
19
19
|
"**/*.css",
|
20
20
|
"**/*.scss",
|
21
|
-
"
|
22
|
-
"lib/feature-flags.js",
|
23
|
-
"src/feature-flags.js"
|
21
|
+
"**/feature-flags.js"
|
24
22
|
],
|
25
23
|
"files": [
|
26
24
|
"css",
|
@@ -121,5 +119,5 @@
|
|
121
119
|
"react": "^16.8.6 || ^17.0.1 || ^18.2.0",
|
122
120
|
"react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
|
123
121
|
},
|
124
|
-
"gitHead": "
|
122
|
+
"gitHead": "59b76216c649caf03f803118c9957d1e3a844f35"
|
125
123
|
}
|