@carbon/ibm-products 2.43.2-canary.33 → 2.43.2-canary.35
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 +12 -0
- 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 +12 -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 +12 -0
- 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 +12 -0
- 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/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +53 -8
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +10 -2
- package/es/components/Datagrid/useInlineEdit.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +52 -7
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +10 -2
- package/lib/components/Datagrid/useInlineEdit.js +1 -1
- package/package.json +5 -4
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +13 -0
@@ -8,7 +8,7 @@
|
|
8
8
|
import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, defineProperty as _defineProperty, extends as _extends, typeof as _typeof } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { useContext, useState, useRef, useEffect, useCallback } from 'react';
|
10
10
|
import PropTypes from '../../../../../../node_modules/prop-types/index.js';
|
11
|
-
import { Dropdown, DatePicker, DatePickerInput, NumberInput, TextInput } from '@carbon/react';
|
11
|
+
import { Dropdown, DatePicker, DatePickerInput, NumberInput, Checkbox, TextInput } from '@carbon/react';
|
12
12
|
import { Edit, CaretSort, ChevronDown, Calendar } from '@carbon/react/icons';
|
13
13
|
import { pkg } from '../../../../../../settings.js';
|
14
14
|
import cx from 'classnames';
|
@@ -66,6 +66,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
66
66
|
var _ref2 = config || {},
|
67
67
|
inputProps = _ref2.inputProps;
|
68
68
|
var textInputRef = useRef();
|
69
|
+
var checkboxRef = useRef();
|
69
70
|
var numberInputRef = useRef();
|
70
71
|
var dropdownRef = useRef();
|
71
72
|
var datePickerRef = useRef();
|
@@ -208,10 +209,36 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
208
209
|
var handleKeyDown = function handleKeyDown(event) {
|
209
210
|
var key = event.key;
|
210
211
|
switch (key) {
|
212
|
+
case 'ArrowRight':
|
213
|
+
case 'ArrowLeft':
|
214
|
+
case 'ArrowUp':
|
215
|
+
case 'ArrowDown':
|
216
|
+
if (inEditMode && event.target.type === 'checkbox') {
|
217
|
+
var newCellId = getNewCellId(key);
|
218
|
+
saveCellData(cellValue);
|
219
|
+
setInitialValue(cellValue);
|
220
|
+
dispatch({
|
221
|
+
type: 'EXIT_EDIT_MODE',
|
222
|
+
payload: newCellId
|
223
|
+
});
|
224
|
+
setInEditMode(false);
|
225
|
+
sendFocusBackToGrid();
|
226
|
+
}
|
227
|
+
break;
|
211
228
|
// Save cell contents to data
|
212
229
|
case 'Tab':
|
213
230
|
case 'Enter':
|
214
231
|
{
|
232
|
+
if (type === 'checkbox') {
|
233
|
+
// Since checkbox doesn't need to click into it to enter `inEditMode` we don't need to check for it
|
234
|
+
var _newCellId = getNewCellId(key);
|
235
|
+
dispatch({
|
236
|
+
type: 'EXIT_EDIT_MODE',
|
237
|
+
payload: _newCellId
|
238
|
+
});
|
239
|
+
setInEditMode(false);
|
240
|
+
sendFocusBackToGrid();
|
241
|
+
}
|
215
242
|
if (inEditMode) {
|
216
243
|
// Dropdown saves are handled in the Dropdown's/DatePicker's onChange prop
|
217
244
|
if (type === 'selection' || type === 'date') {
|
@@ -225,12 +252,12 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
225
252
|
if (isInvalid) {
|
226
253
|
return;
|
227
254
|
}
|
228
|
-
var
|
255
|
+
var _newCellId2 = getNewCellId(key);
|
229
256
|
saveCellData(cellValue);
|
230
257
|
setInitialValue(cellValue);
|
231
258
|
dispatch({
|
232
259
|
type: 'EXIT_EDIT_MODE',
|
233
|
-
payload:
|
260
|
+
payload: _newCellId2
|
234
261
|
});
|
235
262
|
setInEditMode(false);
|
236
263
|
sendFocusBackToGrid();
|
@@ -425,9 +452,27 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
425
452
|
ref: numberInputRef
|
426
453
|
}));
|
427
454
|
};
|
455
|
+
var renderCheckBoxCell = function renderCheckBoxCell() {
|
456
|
+
return /*#__PURE__*/React__default.createElement(Checkbox, _extends({
|
457
|
+
labelText: cellLabel || 'Checkbox'
|
458
|
+
}, inputProps, {
|
459
|
+
className: cx("".concat(blockClass, "__inline-edit--outer-cell-checkbox"), _defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-checkbox-focus"), activeCellId === cellId)),
|
460
|
+
id: cellId,
|
461
|
+
hideLabel: true,
|
462
|
+
checked: cellValue,
|
463
|
+
onChange: function onChange(event, _ref10) {
|
464
|
+
var checked = _ref10.checked;
|
465
|
+
setCellValue(checked);
|
466
|
+
if (inputProps.onChange) {
|
467
|
+
inputProps.onChange(checked);
|
468
|
+
}
|
469
|
+
},
|
470
|
+
ref: checkboxRef
|
471
|
+
}));
|
472
|
+
};
|
428
473
|
var renderTextInput = function renderTextInput() {
|
429
|
-
var
|
430
|
-
validator =
|
474
|
+
var _ref11 = config || {},
|
475
|
+
validator = _ref11.validator;
|
431
476
|
var isInvalid = validator === null || validator === void 0 ? void 0 : validator(cellValue);
|
432
477
|
return /*#__PURE__*/React__default.createElement(TextInput, _extends({
|
433
478
|
labelText: cellLabel,
|
@@ -478,7 +523,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
478
523
|
onClick: !nonEditCell ? handleInlineCellClick : addActiveState,
|
479
524
|
onKeyDown: !nonEditCell ? handleKeyDown : null,
|
480
525
|
className: cx("".concat(blockClass, "__inline-edit--outer-cell-button"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"), inEditMode && (config === null || config === void 0 || (_config$validator = config.validator) === null || _config$validator === void 0 ? void 0 : _config$validator.call(config, cellValue))), "".concat(blockClass, "__static--outer-cell"), !disabledCell))
|
481
|
-
}, !nonEditCell && !disabledCell && renderRegularCell(), (!inEditMode || disabledCell) && /*#__PURE__*/React__default.createElement(InlineEditButton, {
|
526
|
+
}, !nonEditCell && !disabledCell && type !== 'checkbox' && renderRegularCell(), (!inEditMode || disabledCell) && type !== 'checkbox' && /*#__PURE__*/React__default.createElement(InlineEditButton, {
|
482
527
|
isActiveCell: cellId === activeCellId,
|
483
528
|
renderIcon: setRenderIcon(),
|
484
529
|
label: getLabel(),
|
@@ -489,7 +534,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
489
534
|
nonEditCell: nonEditCell,
|
490
535
|
columnConfig: cell.column,
|
491
536
|
type: type
|
492
|
-
}), !nonEditCell && inEditMode && cellId === activeCellId && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, type === 'text' && renderTextInput(), type === 'number' && renderNumberInput(), type === 'selection' && renderSelectCell(), type === 'date' && renderDateCell()))
|
537
|
+
}), type === 'checkbox' && renderCheckBoxCell(), !nonEditCell && inEditMode && cellId === activeCellId && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, type === 'text' && renderTextInput(), type === 'number' && renderNumberInput(), type === 'selection' && renderSelectCell(), type === 'date' && renderDateCell()))
|
493
538
|
);
|
494
539
|
};
|
495
540
|
InlineEditCell.propTypes = {
|
@@ -507,7 +552,7 @@ InlineEditCell.propTypes = {
|
|
507
552
|
nonEditCell: PropTypes.bool,
|
508
553
|
placeholder: PropTypes.string,
|
509
554
|
tabIndex: PropTypes.number,
|
510
|
-
type: PropTypes.oneOf(['text', 'number', 'selection', 'date']),
|
555
|
+
type: PropTypes.oneOf(['text', 'number', 'selection', 'date', 'checkbox']),
|
511
556
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.object])
|
512
557
|
};
|
513
558
|
|
@@ -74,7 +74,7 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
|
|
74
74
|
};
|
75
75
|
|
76
76
|
// Stop grid key listener when in edit mode
|
77
|
-
var isEditing = document.activeElement.id === activeCellId && document.activeElement.id === editId || dropdownIsActive() || datePickerIsActive();
|
77
|
+
var isEditing = focusedCell.getAttribute('data-inline-type') !== 'checkbox' && document.activeElement.id === activeCellId && document.activeElement.id === editId || dropdownIsActive() || datePickerIsActive();
|
78
78
|
if (isEditing || !gridActive) {
|
79
79
|
return;
|
80
80
|
}
|
@@ -87,6 +87,7 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
|
|
87
87
|
event.preventDefault();
|
88
88
|
}
|
89
89
|
var isDisabledCell = focusedCell.getAttribute('data-disabled') === 'false' ? false : true;
|
90
|
+
var isEditableCell = !event.target.classList.contains("".concat(blockClass, "__inline-edit-button--non-edit"));
|
90
91
|
var sharedUpdateParams = {
|
91
92
|
oldId: activeCellId,
|
92
93
|
instance: instance
|
@@ -194,7 +195,7 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
|
|
194
195
|
case 'Enter':
|
195
196
|
{
|
196
197
|
// Disabled cells are not allowed to go into edit mode
|
197
|
-
if (isDisabledCell) {
|
198
|
+
if (isDisabledCell || !isEditableCell) {
|
198
199
|
return;
|
199
200
|
}
|
200
201
|
// Only go into edit mode if there is no editId, meaning that we're not already in edit mode
|
@@ -207,6 +208,13 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
|
|
207
208
|
dropdownTrigger === null || dropdownTrigger === void 0 || dropdownTrigger.click();
|
208
209
|
}, 1);
|
209
210
|
}
|
211
|
+
if (focusedType === 'checkbox') {
|
212
|
+
setTimeout(function () {
|
213
|
+
var checkboxTrigger = focusedCell.querySelector('input');
|
214
|
+
checkboxTrigger === null || checkboxTrigger === void 0 || checkboxTrigger.click();
|
215
|
+
checkboxTrigger === null || checkboxTrigger === void 0 || checkboxTrigger.focus();
|
216
|
+
}, 1);
|
217
|
+
}
|
210
218
|
if (focusedType === 'date') {
|
211
219
|
setTimeout(function () {
|
212
220
|
var dateInputTrigger = focusedCell.querySelector('input');
|
@@ -40,7 +40,7 @@ var useInlineEdit = function useInlineEdit(hooks) {
|
|
40
40
|
return [props, {
|
41
41
|
className: cx("".concat(blockClass, "__cell"), "".concat(blockClass, "__cell-inline-edit")),
|
42
42
|
role: 'gridcell',
|
43
|
-
children: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !staticCell && inlineEditType === 'text' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'number' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'selection' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'date' && renderInlineEditComponent(inlineEditType), staticCell && /*#__PURE__*/React__default.createElement(InlineEditCell, {
|
43
|
+
children: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !staticCell && inlineEditType === 'text' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'number' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'selection' && renderInlineEditComponent(inlineEditType), inlineEditType === 'checkbox' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'date' && renderInlineEditComponent(inlineEditType), staticCell && /*#__PURE__*/React__default.createElement(InlineEditCell, {
|
44
44
|
config: columnInlineEditConfig,
|
45
45
|
tabIndex: -1,
|
46
46
|
value: (_cell$value3 = cell.value) === null || _cell$value3 === void 0 ? void 0 : _cell$value3.value,
|
package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js
CHANGED
@@ -57,7 +57,7 @@ InlineEditButton.propTypes = {
|
|
57
57
|
nonEditCell: index["default"].bool,
|
58
58
|
placeholder: index["default"].string,
|
59
59
|
renderIcon: index["default"].oneOfType([index["default"].func, index["default"].object]),
|
60
|
-
type: index["default"].oneOf(['text', 'number', 'selection', 'date']),
|
60
|
+
type: index["default"].oneOf(['text', 'number', 'selection', 'date', 'checkbox']),
|
61
61
|
value: index["default"].oneOfType([index["default"].string, index["default"].node])
|
62
62
|
};
|
63
63
|
|
@@ -75,6 +75,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
75
75
|
var _ref2 = config || {},
|
76
76
|
inputProps = _ref2.inputProps;
|
77
77
|
var textInputRef = React.useRef();
|
78
|
+
var checkboxRef = React.useRef();
|
78
79
|
var numberInputRef = React.useRef();
|
79
80
|
var dropdownRef = React.useRef();
|
80
81
|
var datePickerRef = React.useRef();
|
@@ -217,10 +218,36 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
217
218
|
var handleKeyDown = function handleKeyDown(event) {
|
218
219
|
var key = event.key;
|
219
220
|
switch (key) {
|
221
|
+
case 'ArrowRight':
|
222
|
+
case 'ArrowLeft':
|
223
|
+
case 'ArrowUp':
|
224
|
+
case 'ArrowDown':
|
225
|
+
if (inEditMode && event.target.type === 'checkbox') {
|
226
|
+
var newCellId = getNewCellId(key);
|
227
|
+
saveCellData(cellValue);
|
228
|
+
setInitialValue(cellValue);
|
229
|
+
dispatch({
|
230
|
+
type: 'EXIT_EDIT_MODE',
|
231
|
+
payload: newCellId
|
232
|
+
});
|
233
|
+
setInEditMode(false);
|
234
|
+
sendFocusBackToGrid();
|
235
|
+
}
|
236
|
+
break;
|
220
237
|
// Save cell contents to data
|
221
238
|
case 'Tab':
|
222
239
|
case 'Enter':
|
223
240
|
{
|
241
|
+
if (type === 'checkbox') {
|
242
|
+
// Since checkbox doesn't need to click into it to enter `inEditMode` we don't need to check for it
|
243
|
+
var _newCellId = getNewCellId(key);
|
244
|
+
dispatch({
|
245
|
+
type: 'EXIT_EDIT_MODE',
|
246
|
+
payload: _newCellId
|
247
|
+
});
|
248
|
+
setInEditMode(false);
|
249
|
+
sendFocusBackToGrid();
|
250
|
+
}
|
224
251
|
if (inEditMode) {
|
225
252
|
// Dropdown saves are handled in the Dropdown's/DatePicker's onChange prop
|
226
253
|
if (type === 'selection' || type === 'date') {
|
@@ -234,12 +261,12 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
234
261
|
if (isInvalid) {
|
235
262
|
return;
|
236
263
|
}
|
237
|
-
var
|
264
|
+
var _newCellId2 = getNewCellId(key);
|
238
265
|
saveCellData(cellValue);
|
239
266
|
setInitialValue(cellValue);
|
240
267
|
dispatch({
|
241
268
|
type: 'EXIT_EDIT_MODE',
|
242
|
-
payload:
|
269
|
+
payload: _newCellId2
|
243
270
|
});
|
244
271
|
setInEditMode(false);
|
245
272
|
sendFocusBackToGrid();
|
@@ -434,9 +461,27 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
434
461
|
ref: numberInputRef
|
435
462
|
}));
|
436
463
|
};
|
464
|
+
var renderCheckBoxCell = function renderCheckBoxCell() {
|
465
|
+
return /*#__PURE__*/React__default["default"].createElement(react.Checkbox, _rollupPluginBabelHelpers["extends"]({
|
466
|
+
labelText: cellLabel || 'Checkbox'
|
467
|
+
}, inputProps, {
|
468
|
+
className: cx__default["default"]("".concat(blockClass, "__inline-edit--outer-cell-checkbox"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-checkbox-focus"), activeCellId === cellId)),
|
469
|
+
id: cellId,
|
470
|
+
hideLabel: true,
|
471
|
+
checked: cellValue,
|
472
|
+
onChange: function onChange(event, _ref10) {
|
473
|
+
var checked = _ref10.checked;
|
474
|
+
setCellValue(checked);
|
475
|
+
if (inputProps.onChange) {
|
476
|
+
inputProps.onChange(checked);
|
477
|
+
}
|
478
|
+
},
|
479
|
+
ref: checkboxRef
|
480
|
+
}));
|
481
|
+
};
|
437
482
|
var renderTextInput = function renderTextInput() {
|
438
|
-
var
|
439
|
-
validator =
|
483
|
+
var _ref11 = config || {},
|
484
|
+
validator = _ref11.validator;
|
440
485
|
var isInvalid = validator === null || validator === void 0 ? void 0 : validator(cellValue);
|
441
486
|
return /*#__PURE__*/React__default["default"].createElement(react.TextInput, _rollupPluginBabelHelpers["extends"]({
|
442
487
|
labelText: cellLabel,
|
@@ -487,7 +532,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
487
532
|
onClick: !nonEditCell ? handleInlineCellClick : addActiveState,
|
488
533
|
onKeyDown: !nonEditCell ? handleKeyDown : null,
|
489
534
|
className: cx__default["default"]("".concat(blockClass, "__inline-edit--outer-cell-button"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"), inEditMode && (config === null || config === void 0 || (_config$validator = config.validator) === null || _config$validator === void 0 ? void 0 : _config$validator.call(config, cellValue))), "".concat(blockClass, "__static--outer-cell"), !disabledCell))
|
490
|
-
}, !nonEditCell && !disabledCell && renderRegularCell(), (!inEditMode || disabledCell) && /*#__PURE__*/React__default["default"].createElement(InlineEditButton.InlineEditButton, {
|
535
|
+
}, !nonEditCell && !disabledCell && type !== 'checkbox' && renderRegularCell(), (!inEditMode || disabledCell) && type !== 'checkbox' && /*#__PURE__*/React__default["default"].createElement(InlineEditButton.InlineEditButton, {
|
491
536
|
isActiveCell: cellId === activeCellId,
|
492
537
|
renderIcon: setRenderIcon(),
|
493
538
|
label: getLabel(),
|
@@ -498,7 +543,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
498
543
|
nonEditCell: nonEditCell,
|
499
544
|
columnConfig: cell.column,
|
500
545
|
type: type
|
501
|
-
}), !nonEditCell && inEditMode && cellId === activeCellId && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, type === 'text' && renderTextInput(), type === 'number' && renderNumberInput(), type === 'selection' && renderSelectCell(), type === 'date' && renderDateCell()))
|
546
|
+
}), type === 'checkbox' && renderCheckBoxCell(), !nonEditCell && inEditMode && cellId === activeCellId && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, type === 'text' && renderTextInput(), type === 'number' && renderNumberInput(), type === 'selection' && renderSelectCell(), type === 'date' && renderDateCell()))
|
502
547
|
);
|
503
548
|
};
|
504
549
|
InlineEditCell.propTypes = {
|
@@ -516,7 +561,7 @@ InlineEditCell.propTypes = {
|
|
516
561
|
nonEditCell: index["default"].bool,
|
517
562
|
placeholder: index["default"].string,
|
518
563
|
tabIndex: index["default"].number,
|
519
|
-
type: index["default"].oneOf(['text', 'number', 'selection', 'date']),
|
564
|
+
type: index["default"].oneOf(['text', 'number', 'selection', 'date', 'checkbox']),
|
520
565
|
value: index["default"].oneOfType([index["default"].string, index["default"].node, index["default"].object])
|
521
566
|
};
|
522
567
|
|
@@ -78,7 +78,7 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
|
|
78
78
|
};
|
79
79
|
|
80
80
|
// Stop grid key listener when in edit mode
|
81
|
-
var isEditing = document.activeElement.id === activeCellId && document.activeElement.id === editId || dropdownIsActive() || datePickerIsActive();
|
81
|
+
var isEditing = focusedCell.getAttribute('data-inline-type') !== 'checkbox' && document.activeElement.id === activeCellId && document.activeElement.id === editId || dropdownIsActive() || datePickerIsActive();
|
82
82
|
if (isEditing || !gridActive) {
|
83
83
|
return;
|
84
84
|
}
|
@@ -91,6 +91,7 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
|
|
91
91
|
event.preventDefault();
|
92
92
|
}
|
93
93
|
var isDisabledCell = focusedCell.getAttribute('data-disabled') === 'false' ? false : true;
|
94
|
+
var isEditableCell = !event.target.classList.contains("".concat(blockClass, "__inline-edit-button--non-edit"));
|
94
95
|
var sharedUpdateParams = {
|
95
96
|
oldId: activeCellId,
|
96
97
|
instance: instance
|
@@ -198,7 +199,7 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
|
|
198
199
|
case 'Enter':
|
199
200
|
{
|
200
201
|
// Disabled cells are not allowed to go into edit mode
|
201
|
-
if (isDisabledCell) {
|
202
|
+
if (isDisabledCell || !isEditableCell) {
|
202
203
|
return;
|
203
204
|
}
|
204
205
|
// Only go into edit mode if there is no editId, meaning that we're not already in edit mode
|
@@ -211,6 +212,13 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
|
|
211
212
|
dropdownTrigger === null || dropdownTrigger === void 0 || dropdownTrigger.click();
|
212
213
|
}, 1);
|
213
214
|
}
|
215
|
+
if (focusedType === 'checkbox') {
|
216
|
+
setTimeout(function () {
|
217
|
+
var checkboxTrigger = focusedCell.querySelector('input');
|
218
|
+
checkboxTrigger === null || checkboxTrigger === void 0 || checkboxTrigger.click();
|
219
|
+
checkboxTrigger === null || checkboxTrigger === void 0 || checkboxTrigger.focus();
|
220
|
+
}, 1);
|
221
|
+
}
|
214
222
|
if (focusedType === 'date') {
|
215
223
|
setTimeout(function () {
|
216
224
|
var dateInputTrigger = focusedCell.querySelector('input');
|
@@ -49,7 +49,7 @@ var useInlineEdit = function useInlineEdit(hooks) {
|
|
49
49
|
return [props, {
|
50
50
|
className: cx__default["default"]("".concat(blockClass, "__cell"), "".concat(blockClass, "__cell-inline-edit")),
|
51
51
|
role: 'gridcell',
|
52
|
-
children: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !staticCell && inlineEditType === 'text' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'number' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'selection' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'date' && renderInlineEditComponent(inlineEditType), staticCell && /*#__PURE__*/React__default["default"].createElement(InlineEditCell.InlineEditCell, {
|
52
|
+
children: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !staticCell && inlineEditType === 'text' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'number' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'selection' && renderInlineEditComponent(inlineEditType), inlineEditType === 'checkbox' && renderInlineEditComponent(inlineEditType), !staticCell && inlineEditType === 'date' && renderInlineEditComponent(inlineEditType), staticCell && /*#__PURE__*/React__default["default"].createElement(InlineEditCell.InlineEditCell, {
|
53
53
|
config: columnInlineEditConfig,
|
54
54
|
tabIndex: -1,
|
55
55
|
value: (_cell$value3 = cell.value) === null || _cell$value3 === void 0 ? void 0 : _cell$value3.value,
|
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.2-canary.
|
4
|
+
"version": "2.43.2-canary.35+b1761a0fd",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -26,7 +26,8 @@
|
|
26
26
|
"lib",
|
27
27
|
"scss",
|
28
28
|
"flags.js",
|
29
|
-
"telemetry.yml"
|
29
|
+
"telemetry.yml",
|
30
|
+
".playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json"
|
30
31
|
],
|
31
32
|
"keywords": [
|
32
33
|
"carbon",
|
@@ -95,7 +96,7 @@
|
|
95
96
|
"dependencies": {
|
96
97
|
"@babel/runtime": "^7.23.9",
|
97
98
|
"@carbon/feature-flags": "^0.20.0",
|
98
|
-
"@carbon/ibm-products-styles": "^2.39.
|
99
|
+
"@carbon/ibm-products-styles": "^2.39.1-canary.45+b1761a0fd",
|
99
100
|
"@carbon/telemetry": "^0.1.0",
|
100
101
|
"@dnd-kit/core": "^6.0.8",
|
101
102
|
"@dnd-kit/modifiers": "^7.0.0",
|
@@ -119,5 +120,5 @@
|
|
119
120
|
"react": "^16.8.6 || ^17.0.1 || ^18.2.0",
|
120
121
|
"react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
|
121
122
|
},
|
122
|
-
"gitHead": "
|
123
|
+
"gitHead": "b1761a0fd713a3682dd812cebe98f4503ef70f04"
|
123
124
|
}
|
@@ -80,6 +80,19 @@ $row-heights: (
|
|
80
80
|
align-items: center;
|
81
81
|
}
|
82
82
|
|
83
|
+
.#{variables.$block-class}__inline-edit--outer-cell-checkbox-focus
|
84
|
+
.cds--checkbox-label::before {
|
85
|
+
outline: $spacing-01 solid $focus;
|
86
|
+
outline-offset: 1px;
|
87
|
+
}
|
88
|
+
|
89
|
+
.#{variables.$block-class}__inline-edit--outer-cell-checkbox {
|
90
|
+
display: flex;
|
91
|
+
height: -webkit-fill-available;
|
92
|
+
justify-content: center;
|
93
|
+
padding-inline: $spacing-05;
|
94
|
+
}
|
95
|
+
|
83
96
|
.#{variables.$block-class}__static--outer-cell {
|
84
97
|
display: flex;
|
85
98
|
height: -webkit-fill-available;
|