@carbon/ibm-products 2.44.0-rc.0 → 2.44.0-rc.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 +17 -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 +17 -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 +17 -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/DataSpreadsheet/DataSpreadsheet.d.ts +12 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +22 -3
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +12 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +22 -6
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +3 -0
- 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/es/components/EditTearsheet/EditTearsheet.d.ts +5 -1
- package/es/components/EditTearsheet/EditTearsheet.js +0 -1
- package/es/components/EditTearsheet/EditTearsheetForm.d.ts +45 -2
- package/es/components/EditTearsheet/EditTearsheetForm.js +3 -0
- package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
- package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
- package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
- package/es/components/RemoveModal/RemoveModal.d.ts +4 -0
- package/es/components/RemoveModal/RemoveModal.js +7 -1
- package/es/components/StatusIndicator/StatusIndicatorStep.js +87 -0
- package/es/components/Toolbar/ToolbarButton.js +1 -1
- package/es/components/index.d.ts +1 -1
- package/es/index.js +1 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +12 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +22 -3
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +12 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +22 -6
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +3 -0
- 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/lib/components/EditTearsheet/EditTearsheet.d.ts +5 -1
- package/lib/components/EditTearsheet/EditTearsheet.js +0 -1
- package/lib/components/EditTearsheet/EditTearsheetForm.d.ts +45 -2
- package/lib/components/EditTearsheet/EditTearsheetForm.js +3 -0
- package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
- package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
- package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
- package/lib/components/RemoveModal/RemoveModal.d.ts +4 -0
- package/lib/components/RemoveModal/RemoveModal.js +7 -1
- package/lib/components/StatusIndicator/StatusIndicatorStep.js +94 -0
- package/lib/components/Toolbar/ToolbarButton.js +1 -1
- package/lib/components/index.d.ts +1 -1
- package/lib/index.js +5 -0
- package/package.json +5 -4
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +7 -0
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +13 -0
- package/telemetry.yml +7 -0
@@ -32,7 +32,7 @@ import { useSpreadsheetOutsideClick } from './hooks/useSpreadsheetOutsideClick.j
|
|
32
32
|
import { useMoveActiveCell } from './hooks/useMoveActiveCell.js';
|
33
33
|
import { useSpreadsheetEdit } from './hooks/useSpreadsheetEdit.js';
|
34
34
|
|
35
|
-
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
35
|
+
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "renderRowHeader", "renderRowHeaderDirection", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
36
36
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
37
37
|
var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
|
38
38
|
var componentName = 'DataSpreadsheet';
|
@@ -67,6 +67,8 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
67
67
|
onActiveCellChange = _ref$onActiveCellChan === void 0 ? defaults.onActiveCellChange : _ref$onActiveCellChan,
|
68
68
|
_ref$onSelectionAreaC = _ref.onSelectionAreaChange,
|
69
69
|
onSelectionAreaChange = _ref$onSelectionAreaC === void 0 ? defaults.onSelectionAreaChange : _ref$onSelectionAreaC,
|
70
|
+
renderRowHeader = _ref.renderRowHeader,
|
71
|
+
renderRowHeaderDirection = _ref.renderRowHeaderDirection,
|
70
72
|
selectAllAriaLabel = _ref.selectAllAriaLabel,
|
71
73
|
spreadsheetAriaLabel = _ref.spreadsheetAriaLabel,
|
72
74
|
theme = _ref.theme,
|
@@ -138,13 +140,15 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
138
140
|
setActiveCellContent = _useState26[1];
|
139
141
|
var activeCellRef = useRef();
|
140
142
|
var cellEditorRulerRef = useRef();
|
143
|
+
var hasCustomRowHeader = typeof renderRowHeader === 'function';
|
144
|
+
var maxNumRowsCount = data.length.toString().length;
|
141
145
|
var defaultColumn = useMemo(function () {
|
142
146
|
return {
|
143
147
|
width: 150,
|
144
|
-
rowHeaderWidth: 64,
|
148
|
+
rowHeaderWidth: hasCustomRowHeader ? 40 + maxNumRowsCount * 8.56 : 64,
|
145
149
|
rowHeight: cellSizeValue
|
146
150
|
};
|
147
|
-
}, [cellSizeValue]);
|
151
|
+
}, [cellSizeValue, hasCustomRowHeader, maxNumRowsCount]);
|
148
152
|
var _useMultipleKeyTracki = useMultipleKeyTracking({
|
149
153
|
ref: multiKeyTrackingRef,
|
150
154
|
containerHasFocus: containerHasFocus,
|
@@ -654,7 +658,10 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
654
658
|
headerGroups: headerGroups,
|
655
659
|
defaultColumn: defaultColumn,
|
656
660
|
getTableBodyProps: getTableBodyProps,
|
661
|
+
hasCustomRowHeader: hasCustomRowHeader,
|
657
662
|
onDataUpdate: onDataUpdate,
|
663
|
+
renderRowHeaderDirection: renderRowHeaderDirection,
|
664
|
+
renderRowHeader: renderRowHeader,
|
658
665
|
onActiveCellChange: onActiveCellChange,
|
659
666
|
onSelectionAreaChange: onSelectionAreaChange,
|
660
667
|
prepareRow: prepareRow,
|
@@ -753,6 +760,10 @@ DataSpreadsheet.propTypes = {
|
|
753
760
|
* Sets the number of empty rows to be created when there is no data provided
|
754
761
|
*/
|
755
762
|
defaultEmptyRowCount: PropTypes.number,
|
763
|
+
/**
|
764
|
+
* Check if spreadsheet is using custom row header component attached
|
765
|
+
*/
|
766
|
+
hasCustomRowHeader: PropTypes.bool,
|
756
767
|
/**
|
757
768
|
* The spreadsheet id
|
758
769
|
*/
|
@@ -769,6 +780,14 @@ DataSpreadsheet.propTypes = {
|
|
769
780
|
* The event handler that is called when the selection area values change
|
770
781
|
*/
|
771
782
|
onSelectionAreaChange: PropTypes.func,
|
783
|
+
/**
|
784
|
+
* Component next to numbering rows
|
785
|
+
*/
|
786
|
+
renderRowHeader: PropTypes.func,
|
787
|
+
/**
|
788
|
+
* Component next to numbering rows
|
789
|
+
*/
|
790
|
+
renderRowHeaderDirection: PropTypes.oneOf(['left', 'right']),
|
772
791
|
/**
|
773
792
|
* The aria label applied to the Select all button
|
774
793
|
*/
|
@@ -52,6 +52,18 @@ interface DataSpreadsheetBodyProps {
|
|
52
52
|
* The event handler that is called when the active cell changes
|
53
53
|
*/
|
54
54
|
onActiveCellChange?: () => void;
|
55
|
+
/**
|
56
|
+
* Check if user is using custom component
|
57
|
+
*/
|
58
|
+
hasCustomRowHeader?: boolean;
|
59
|
+
/**
|
60
|
+
* Component next to numbering rows
|
61
|
+
*/
|
62
|
+
renderRowHeader?: (index: number) => any[];
|
63
|
+
/**
|
64
|
+
* Component next to numbering rows
|
65
|
+
*/
|
66
|
+
renderRowHeaderDirection?: string;
|
55
67
|
/**
|
56
68
|
* The event handler that is called to set the rows for the empty spreadsheet
|
57
69
|
*/
|
@@ -35,6 +35,9 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
35
35
|
headerGroups = _ref.headerGroups,
|
36
36
|
id = _ref.id,
|
37
37
|
onDataUpdate = _ref.onDataUpdate,
|
38
|
+
renderRowHeader = _ref.renderRowHeader,
|
39
|
+
renderRowHeaderDirection = _ref.renderRowHeaderDirection,
|
40
|
+
hasCustomRowHeader = _ref.hasCustomRowHeader,
|
38
41
|
prepareRow = _ref.prepareRow,
|
39
42
|
rows = _ref.rows,
|
40
43
|
selectionAreaData = _ref.selectionAreaData,
|
@@ -138,7 +141,7 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
138
141
|
return;
|
139
142
|
});
|
140
143
|
}
|
141
|
-
}, [selectionAreas, setSelectionAreas, defaultColumn, onSelectionAreaChange, setSelectionAreaData, ref, activeCellCoordinates, setActiveCellInsideSelectionArea, visibleColumns]);
|
144
|
+
}, [selectionAreas, setSelectionAreas, defaultColumn, onSelectionAreaChange, setSelectionAreaData, ref, activeCellCoordinates, setActiveCellInsideSelectionArea, visibleColumns, hasCustomRowHeader]);
|
142
145
|
var populateSelectionAreaCellData = function populateSelectionAreaCellData(_ref2) {
|
143
146
|
var rowStart = _ref2.rowStart,
|
144
147
|
rowEnd = _ref2.rowEnd,
|
@@ -212,7 +215,7 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
212
215
|
});
|
213
216
|
}
|
214
217
|
}
|
215
|
-
}, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns]);
|
218
|
+
}, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns, hasCustomRowHeader]);
|
216
219
|
|
217
220
|
//this method will check for any duplicate selection area and remove.
|
218
221
|
//same selections are those have the same height, width, top, left styles. These inline styles are being set in createCellSelection util.
|
@@ -338,11 +341,12 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
338
341
|
"data-column-index": "header",
|
339
342
|
type: "button",
|
340
343
|
onClick: handleRowHeaderClickEvent(index),
|
341
|
-
className: cx("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__td-th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || checkActiveHeaderCell(index, selectionAreas, 'row')), "".concat(blockClass, "__td-th--selected-header"), checkSelectedHeaderCell(index, selectionAreas, 'row', columns))),
|
344
|
+
className: cx("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__td_custom"), hasCustomRowHeader ? true : false), "".concat(blockClass, "__td-th--active-header"), !hasCustomRowHeader && ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || checkActiveHeaderCell(index, selectionAreas, 'row'))), "".concat(blockClass, "__td-th--selected-header"), !hasCustomRowHeader && checkSelectedHeaderCell(index, selectionAreas, 'row', columns))),
|
342
345
|
style: {
|
343
|
-
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
|
346
|
+
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth,
|
347
|
+
flexDirection: hasCustomRowHeader ? renderRowHeaderDirection === 'Left' ? 'row-reverse' : row : undefined
|
344
348
|
}
|
345
|
-
}, index + 1)), row.cells.map(function (cell, index) {
|
349
|
+
}, index + 1, hasCustomRowHeader && typeof renderRowHeader === 'function' && renderRowHeader(index))), row.cells.map(function (cell, index) {
|
346
350
|
var _cell$column;
|
347
351
|
var cellProps = prepareProps(cell.getCellProps(), 'key');
|
348
352
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
@@ -367,7 +371,7 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
367
371
|
}, cell.render('Cell')));
|
368
372
|
}));
|
369
373
|
}
|
370
|
-
}, [prepareRow, rows, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, defaultColumn, columns]);
|
374
|
+
}, [prepareRow, renderRowHeader, renderRowHeaderDirection, rows, hasCustomRowHeader, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, defaultColumn, columns]);
|
371
375
|
var spreadsheetBodyRef = useRef();
|
372
376
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
373
377
|
ref: spreadsheetBodyRef,
|
@@ -433,6 +437,10 @@ DataSpreadsheetBody.propTypes = {
|
|
433
437
|
*/
|
434
438
|
/**@ts-ignore */
|
435
439
|
getTableBodyProps: PropTypes.func,
|
440
|
+
/**
|
441
|
+
* Check if spreadsheet is using custom row header component attached
|
442
|
+
*/
|
443
|
+
hasCustomRowHeader: PropTypes.bool,
|
436
444
|
/**
|
437
445
|
* Headers provided from useTable hook
|
438
446
|
*/
|
@@ -457,6 +465,14 @@ DataSpreadsheetBody.propTypes = {
|
|
457
465
|
* Prepare row function from react-table
|
458
466
|
*/
|
459
467
|
prepareRow: PropTypes.func,
|
468
|
+
/**
|
469
|
+
* Component next to numbering rows
|
470
|
+
*/
|
471
|
+
renderRowHeader: PropTypes.func,
|
472
|
+
/**
|
473
|
+
* Component next to numbering rows
|
474
|
+
*/
|
475
|
+
renderRowHeaderDirection: PropTypes.string,
|
460
476
|
/**
|
461
477
|
* All of the spreadsheet row data
|
462
478
|
*/
|
@@ -175,6 +175,9 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
175
175
|
"data-row-index": "header",
|
176
176
|
"data-column-index": "header",
|
177
177
|
type: "button",
|
178
|
+
style: {
|
179
|
+
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
|
180
|
+
},
|
178
181
|
tabIndex: -1,
|
179
182
|
"aria-label": selectAllAriaLabel,
|
180
183
|
onClick: handleSelectAllClick,
|
package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js
CHANGED
@@ -48,7 +48,7 @@ InlineEditButton.propTypes = {
|
|
48
48
|
nonEditCell: PropTypes.bool,
|
49
49
|
placeholder: PropTypes.string,
|
50
50
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
51
|
-
type: PropTypes.oneOf(['text', 'number', 'selection', 'date']),
|
51
|
+
type: PropTypes.oneOf(['text', 'number', 'selection', 'date', 'checkbox']),
|
52
52
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|
53
53
|
};
|
54
54
|
|
@@ -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,
|
@@ -5,7 +5,11 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
import React, { ReactNode, PropsWithChildren } from 'react';
|
8
|
-
export
|
8
|
+
export type FormContextType = {
|
9
|
+
currentForm: number;
|
10
|
+
setFormTitle: () => void;
|
11
|
+
};
|
12
|
+
export declare const FormContext: React.Context<FormContextType | null>;
|
9
13
|
export declare const FormNumberContext: React.Context<number>;
|
10
14
|
interface EditTearsheetProps extends PropsWithChildren {
|
11
15
|
/**
|
@@ -18,7 +18,6 @@ import { prepareProps } from '../../global/js/utils/props-helper.js';
|
|
18
18
|
var _excluded = ["cancelButtonText", "children", "className", "description", "influencerWidth", "label", "onClose", "open", "submitButtonText", "title", "verticalPosition", "onRequestSubmit", "onFormChange", "sideNavAriaLabel"];
|
19
19
|
var componentName = 'EditTearsheet';
|
20
20
|
var blockClass = "".concat(pkg.prefix, "--tearsheet-edit");
|
21
|
-
|
22
21
|
// This is a general context for the forms container
|
23
22
|
// containing information about the state of the container
|
24
23
|
// and providing some callback methods for forms to use
|
@@ -1,2 +1,45 @@
|
|
1
|
-
|
2
|
-
|
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.
|
6
|
+
*/
|
7
|
+
import React, { ReactNode } from 'react';
|
8
|
+
interface EditTearsheetFormBaseProps {
|
9
|
+
/**
|
10
|
+
* Content that shows in the tearsheet form
|
11
|
+
*/
|
12
|
+
children?: ReactNode;
|
13
|
+
/**
|
14
|
+
* Sets an optional className to be added to the tearsheet form
|
15
|
+
*/
|
16
|
+
className?: string;
|
17
|
+
/**
|
18
|
+
* Sets an optional description on the form component
|
19
|
+
*/
|
20
|
+
description?: string;
|
21
|
+
/**
|
22
|
+
* This optional prop will render your form content inside of a fieldset html element
|
23
|
+
* and is defaulted to true.
|
24
|
+
* You can set this prop to `false` if you have multiple fieldset elements or want to control the children of your Full Page's form content.
|
25
|
+
*/
|
26
|
+
hasFieldset?: boolean;
|
27
|
+
/**
|
28
|
+
* Sets an optional subtitle on the form component
|
29
|
+
*/
|
30
|
+
subtitle?: string;
|
31
|
+
/**
|
32
|
+
* Sets the title text for a tearsheet form
|
33
|
+
*/
|
34
|
+
title: ReactNode;
|
35
|
+
}
|
36
|
+
type EditTearsheetFormFieldsetTypes = {
|
37
|
+
hasFieldset?: false;
|
38
|
+
fieldsetLegendText: string;
|
39
|
+
} | {
|
40
|
+
hasFieldset: true;
|
41
|
+
fieldsetLegendText: string;
|
42
|
+
};
|
43
|
+
type EditTearsheetFormProps = EditTearsheetFormBaseProps & EditTearsheetFormFieldsetTypes;
|
44
|
+
export declare let EditTearsheetForm: React.ForwardRefExoticComponent<EditTearsheetFormProps & React.RefAttributes<HTMLDivElement>>;
|
45
|
+
export {};
|
@@ -82,6 +82,7 @@ EditTearsheetForm.propTypes = {
|
|
82
82
|
* You can set the `hasFieldset` prop to false if you have multiple fieldset elements or want to control the children of your Full Page's form content.
|
83
83
|
* Otherwise, use CSS to hide/remove this label text.
|
84
84
|
*/
|
85
|
+
/**@ts-ignore */
|
85
86
|
fieldsetLegendText: PropTypes.string.isRequired.if(function (_ref2) {
|
86
87
|
var hasFieldset = _ref2.hasFieldset;
|
87
88
|
return !!hasFieldset;
|
@@ -91,10 +92,12 @@ EditTearsheetForm.propTypes = {
|
|
91
92
|
* and is defaulted to true.
|
92
93
|
* You can set this prop to `false` if you have multiple fieldset elements or want to control the children of your Full Page's form content.
|
93
94
|
*/
|
95
|
+
/**@ts-ignore*/
|
94
96
|
hasFieldset: PropTypes.bool,
|
95
97
|
/**
|
96
98
|
* Sets an optional subtitle on the form component
|
97
99
|
*/
|
100
|
+
/**@ts-ignore*/
|
98
101
|
subtitle: PropTypes.string,
|
99
102
|
/**
|
100
103
|
* Sets the title text for a tearsheet form
|
@@ -44,6 +44,12 @@ var HTTPError403 = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
44
44
|
}));
|
45
45
|
});
|
46
46
|
|
47
|
+
/**@ts-ignore*/
|
48
|
+
HTTPError403.deprecated = {
|
49
|
+
level: 'warn',
|
50
|
+
details: "Please replace ".concat(componentName, " with FullPageError")
|
51
|
+
};
|
52
|
+
|
47
53
|
// Return a placeholder if not released and not enabled by feature flag
|
48
54
|
HTTPError403 = pkg.checkComponentEnabled(HTTPError403, componentName);
|
49
55
|
|
@@ -44,6 +44,12 @@ var HTTPError404 = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
44
44
|
}));
|
45
45
|
});
|
46
46
|
|
47
|
+
/**@ts-ignore*/
|
48
|
+
HTTPError404.deprecated = {
|
49
|
+
level: 'warn',
|
50
|
+
details: "Please replace ".concat(componentName, " with FullPageError")
|
51
|
+
};
|
52
|
+
|
47
53
|
// Return a placeholder if not released and not enabled by feature flag
|
48
54
|
HTTPError404 = pkg.checkComponentEnabled(HTTPError404, componentName);
|
49
55
|
|
@@ -44,6 +44,12 @@ var HTTPErrorOther = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
44
44
|
}));
|
45
45
|
});
|
46
46
|
|
47
|
+
/**@ts-ignore*/
|
48
|
+
HTTPErrorOther.deprecated = {
|
49
|
+
level: 'warn',
|
50
|
+
details: "Please replace ".concat(componentName, " with FullPageError")
|
51
|
+
};
|
52
|
+
|
47
53
|
// Return a placeholder if not released and not enabled by feature flag
|
48
54
|
HTTPErrorOther = pkg.checkComponentEnabled(HTTPErrorOther, componentName);
|
49
55
|
|
@@ -58,6 +58,10 @@ interface RemoveModalProps extends React.ComponentProps<typeof ComposedModal> {
|
|
58
58
|
* Specify the text for the primary button
|
59
59
|
*/
|
60
60
|
primaryButtonText?: string;
|
61
|
+
/**
|
62
|
+
* Specify the danger description on the primary button
|
63
|
+
*/
|
64
|
+
primaryDangerDescription?: string;
|
61
65
|
/**
|
62
66
|
* The name of the resource being acted upon
|
63
67
|
*/
|
@@ -16,7 +16,7 @@ import { pkg } from '../../settings.js';
|
|
16
16
|
import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
|
17
17
|
import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
|
18
18
|
|
19
|
-
var _excluded = ["body", "className", "iconDescription", "inputInvalidText", "inputLabelText", "inputPlaceholderText", "label", "onClose", "onRequestSubmit", "open", "portalTarget", "preventCloseOnClickOutside", "primaryButtonDisabled", "primaryButtonText", "resourceName", "secondaryButtonText", "textConfirmation", "title"];
|
19
|
+
var _excluded = ["body", "className", "iconDescription", "inputInvalidText", "inputLabelText", "inputPlaceholderText", "label", "onClose", "onRequestSubmit", "open", "portalTarget", "preventCloseOnClickOutside", "primaryButtonDisabled", "primaryButtonText", "primaryDangerDescription", "resourceName", "secondaryButtonText", "textConfirmation", "title"];
|
20
20
|
var componentName = 'RemoveModal';
|
21
21
|
|
22
22
|
/**
|
@@ -40,6 +40,7 @@ var RemoveModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
40
40
|
preventCloseOnClickOutside = _ref.preventCloseOnClickOutside,
|
41
41
|
primaryButtonDisabled = _ref.primaryButtonDisabled,
|
42
42
|
primaryButtonText = _ref.primaryButtonText,
|
43
|
+
primaryDangerDescription = _ref.primaryDangerDescription,
|
43
44
|
resourceName = _ref.resourceName,
|
44
45
|
secondaryButtonText = _ref.secondaryButtonText,
|
45
46
|
textConfirmation = _ref.textConfirmation,
|
@@ -109,6 +110,7 @@ var RemoveModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
109
110
|
}, secondaryButtonText), /*#__PURE__*/React__default.createElement(Button, {
|
110
111
|
type: "submit",
|
111
112
|
kind: "danger",
|
113
|
+
dangerDescription: primaryDangerDescription,
|
112
114
|
onClick: onRequestSubmit,
|
113
115
|
disabled: primaryButtonStatus
|
114
116
|
}, primaryButtonText))));
|
@@ -173,6 +175,10 @@ RemoveModal.propTypes = {
|
|
173
175
|
* Specify the text for the primary button
|
174
176
|
*/
|
175
177
|
primaryButtonText: PropTypes.string,
|
178
|
+
/**
|
179
|
+
* Specify the danger description on the primary button
|
180
|
+
*/
|
181
|
+
primaryDangerDescription: PropTypes.string,
|
176
182
|
/**
|
177
183
|
* The name of the resource being acted upon
|
178
184
|
*/
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
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.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default from 'react';
|
10
|
+
import PropTypes from '../../node_modules/prop-types/index.js';
|
11
|
+
import cx from 'classnames';
|
12
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
13
|
+
import { pkg } from '../../settings.js';
|
14
|
+
import { InlineLoading } from '@carbon/react';
|
15
|
+
import { CircleStroke, ErrorOutline, CheckmarkOutline } from '@carbon/react/icons';
|
16
|
+
|
17
|
+
var _CircleStroke, _InlineLoading, _ErrorOutline, _CheckmarkOutline;
|
18
|
+
var _excluded = ["className", "description", "errorMessage", "status"];
|
19
|
+
|
20
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
21
|
+
var blockClass = "".concat(pkg.prefix, "--status-indicator-step");
|
22
|
+
var componentName = 'StatusIndicatorStep';
|
23
|
+
var defaults = {
|
24
|
+
status: 'inactive'
|
25
|
+
};
|
26
|
+
|
27
|
+
/**
|
28
|
+
* An icon/description pair that describes one step of the `StatusIndicator`.
|
29
|
+
*/
|
30
|
+
var StatusIndicatorStep = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
31
|
+
var className = _ref.className,
|
32
|
+
description = _ref.description,
|
33
|
+
errorMessage = _ref.errorMessage,
|
34
|
+
_ref$status = _ref.status,
|
35
|
+
status = _ref$status === void 0 ? defaults.status : _ref$status,
|
36
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
37
|
+
return /*#__PURE__*/React__default.createElement("li", _extends({}, rest, {
|
38
|
+
className: cx(blockClass, className, "".concat(blockClass, "--").concat(status)),
|
39
|
+
ref: ref
|
40
|
+
}, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement("div", {
|
41
|
+
className: "".concat(blockClass, "__details")
|
42
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
43
|
+
className: "".concat(blockClass, "__icon")
|
44
|
+
}, status === 'inactive' && (_CircleStroke || (_CircleStroke = /*#__PURE__*/React__default.createElement(CircleStroke, {
|
45
|
+
size: 16,
|
46
|
+
viewBox: "1 1 14 14"
|
47
|
+
}))), status === 'active' && (_InlineLoading || (_InlineLoading = /*#__PURE__*/React__default.createElement(InlineLoading, null))), status === 'error' && (_ErrorOutline || (_ErrorOutline = /*#__PURE__*/React__default.createElement(ErrorOutline, {
|
48
|
+
size: 16
|
49
|
+
}))), status === 'finished' && (_CheckmarkOutline || (_CheckmarkOutline = /*#__PURE__*/React__default.createElement(CheckmarkOutline, {
|
50
|
+
size: 16
|
51
|
+
})))), /*#__PURE__*/React__default.createElement("div", {
|
52
|
+
className: "".concat(blockClass, "__text")
|
53
|
+
}, description)), status === 'error' && errorMessage && /*#__PURE__*/React__default.createElement("div", {
|
54
|
+
className: "".concat(blockClass, "__error-message")
|
55
|
+
}, errorMessage));
|
56
|
+
});
|
57
|
+
|
58
|
+
// Return a placeholder if not released and not enabled by feature flag
|
59
|
+
StatusIndicatorStep = pkg.checkComponentEnabled(StatusIndicatorStep, componentName);
|
60
|
+
|
61
|
+
// The display name of the component, used by React. Note that displayName
|
62
|
+
// is used in preference to relying on function.name.
|
63
|
+
StatusIndicatorStep.displayName = componentName;
|
64
|
+
|
65
|
+
// The types and DocGen commentary for the component props,
|
66
|
+
// in alphabetical order (for consistency).
|
67
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
68
|
+
StatusIndicatorStep.propTypes = {
|
69
|
+
/**
|
70
|
+
* Provide an optional class to be applied to the containing node.
|
71
|
+
*/
|
72
|
+
className: PropTypes.string,
|
73
|
+
/**
|
74
|
+
* The text associated with the icon.
|
75
|
+
*/
|
76
|
+
description: PropTypes.string.isRequired,
|
77
|
+
/**
|
78
|
+
* This message will appear below the description if the `status` is "error".
|
79
|
+
*/
|
80
|
+
errorMessage: PropTypes.string,
|
81
|
+
/**
|
82
|
+
* Each `status` represents a different icon..
|
83
|
+
*/
|
84
|
+
status: PropTypes.oneOf(['inactive', 'active', 'error', 'finished']).isRequired
|
85
|
+
};
|
86
|
+
|
87
|
+
export { StatusIndicatorStep };
|
@@ -28,7 +28,7 @@ var ToolbarButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
28
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
29
29
|
var Icon = renderIcon;
|
30
30
|
return /*#__PURE__*/React__default.createElement(IconButton, _extends({
|
31
|
-
align: (
|
31
|
+
align: (_useContext = useContext(ToolbarContext)) !== null && _useContext !== void 0 && _useContext.vertical ? 'right' : 'top'
|
32
32
|
}, rest, {
|
33
33
|
label: iconDescription,
|
34
34
|
ref: ref,
|