@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
package/es/components/index.d.ts
CHANGED
@@ -50,7 +50,6 @@ export { Nav } from "./Nav";
|
|
50
50
|
export { StringFormatter } from "./StringFormatter";
|
51
51
|
export { UserAvatar } from "./UserAvatar";
|
52
52
|
export { ScrollGradient } from "./ScrollGradient";
|
53
|
-
export { StatusIndicator } from "./StatusIndicator";
|
54
53
|
export { TagOverflow } from "./TagOverflow";
|
55
54
|
export { ActionBar } from "./ActionBar";
|
56
55
|
export { ConditionBuilder } from "./ConditionBuilder";
|
@@ -68,5 +67,6 @@ export { EditTearsheet, EditTearsheetForm } from "./EditTearsheet";
|
|
68
67
|
export { Guidebanner, GuidebannerElement, GuidebannerElementButton, GuidebannerElementLink } from "./Guidebanner";
|
69
68
|
export { InlineTip, InlineTipButton, InlineTipLink } from "./InlineTip";
|
70
69
|
export { DescriptionList, DescriptionListBody, DescriptionListCell, DescriptionListRow } from "./DescriptionList";
|
70
|
+
export { StatusIndicator, StatusIndicatorStep } from "./StatusIndicator";
|
71
71
|
export { FilterPanel, FilterPanelAccordion, FilterPanelAccordionItem, FilterPanelCheckbox, FilterPanelCheckboxWithOverflow, FilterPanelGroup, FilterPanelLabel, FilterPanelSearch } from "./FilterPanel";
|
72
72
|
export { FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags } from "./FeatureFlags";
|
package/es/index.js
CHANGED
@@ -122,6 +122,7 @@ export { StringFormatter } from './components/StringFormatter/StringFormatter.js
|
|
122
122
|
export { UserAvatar } from './components/UserAvatar/UserAvatar.js';
|
123
123
|
export { ScrollGradient } from './components/ScrollGradient/ScrollGradient.js';
|
124
124
|
export { StatusIndicator } from './components/StatusIndicator/StatusIndicator.js';
|
125
|
+
export { StatusIndicatorStep } from './components/StatusIndicator/StatusIndicatorStep.js';
|
125
126
|
export { TagOverflow } from './components/TagOverflow/TagOverflow.js';
|
126
127
|
export { ActionBar } from './components/ActionBar/ActionBar.js';
|
127
128
|
export { FilterPanel } from './components/FilterPanel/FilterPanel.js';
|
@@ -28,6 +28,10 @@ interface DataSpreadsheetProps {
|
|
28
28
|
* Sets the number of empty rows to be created when there is no data provided
|
29
29
|
*/
|
30
30
|
defaultEmptyRowCount?: number;
|
31
|
+
/**
|
32
|
+
* Check if has custom row header component attached
|
33
|
+
*/
|
34
|
+
hasCustomRowHeader?: boolean;
|
31
35
|
/**
|
32
36
|
* The spreadsheet id
|
33
37
|
*/
|
@@ -46,6 +50,14 @@ interface DataSpreadsheetProps {
|
|
46
50
|
* The event handler that is called when the selection area values change
|
47
51
|
*/
|
48
52
|
onSelectionAreaChange?: () => void;
|
53
|
+
/**
|
54
|
+
* Position of the custom row numbering component
|
55
|
+
*/
|
56
|
+
renderRowHeaderDirection?: 'left' | 'right';
|
57
|
+
/**
|
58
|
+
* Component next to numbering rows
|
59
|
+
*/
|
60
|
+
renderRowHeader?: (index: number) => any[];
|
49
61
|
/**
|
50
62
|
* The aria label applied to the Select all button
|
51
63
|
*/
|
@@ -41,7 +41,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
41
41
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
42
42
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
43
43
|
|
44
|
-
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
44
|
+
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "renderRowHeader", "renderRowHeaderDirection", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
45
45
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
46
46
|
var blockClass = "".concat(settings.pkg.prefix, "--data-spreadsheet");
|
47
47
|
var componentName = 'DataSpreadsheet';
|
@@ -76,6 +76,8 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
76
76
|
onActiveCellChange = _ref$onActiveCellChan === void 0 ? defaults.onActiveCellChange : _ref$onActiveCellChan,
|
77
77
|
_ref$onSelectionAreaC = _ref.onSelectionAreaChange,
|
78
78
|
onSelectionAreaChange = _ref$onSelectionAreaC === void 0 ? defaults.onSelectionAreaChange : _ref$onSelectionAreaC,
|
79
|
+
renderRowHeader = _ref.renderRowHeader,
|
80
|
+
renderRowHeaderDirection = _ref.renderRowHeaderDirection,
|
79
81
|
selectAllAriaLabel = _ref.selectAllAriaLabel,
|
80
82
|
spreadsheetAriaLabel = _ref.spreadsheetAriaLabel,
|
81
83
|
theme = _ref.theme,
|
@@ -147,13 +149,15 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
147
149
|
setActiveCellContent = _useState26[1];
|
148
150
|
var activeCellRef = React.useRef();
|
149
151
|
var cellEditorRulerRef = React.useRef();
|
152
|
+
var hasCustomRowHeader = typeof renderRowHeader === 'function';
|
153
|
+
var maxNumRowsCount = data.length.toString().length;
|
150
154
|
var defaultColumn = React.useMemo(function () {
|
151
155
|
return {
|
152
156
|
width: 150,
|
153
|
-
rowHeaderWidth: 64,
|
157
|
+
rowHeaderWidth: hasCustomRowHeader ? 40 + maxNumRowsCount * 8.56 : 64,
|
154
158
|
rowHeight: cellSizeValue
|
155
159
|
};
|
156
|
-
}, [cellSizeValue]);
|
160
|
+
}, [cellSizeValue, hasCustomRowHeader, maxNumRowsCount]);
|
157
161
|
var _useMultipleKeyTracki = useMultipleKeyTracking.useMultipleKeyTracking({
|
158
162
|
ref: multiKeyTrackingRef,
|
159
163
|
containerHasFocus: containerHasFocus,
|
@@ -663,7 +667,10 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
663
667
|
headerGroups: headerGroups,
|
664
668
|
defaultColumn: defaultColumn,
|
665
669
|
getTableBodyProps: getTableBodyProps,
|
670
|
+
hasCustomRowHeader: hasCustomRowHeader,
|
666
671
|
onDataUpdate: onDataUpdate,
|
672
|
+
renderRowHeaderDirection: renderRowHeaderDirection,
|
673
|
+
renderRowHeader: renderRowHeader,
|
667
674
|
onActiveCellChange: onActiveCellChange,
|
668
675
|
onSelectionAreaChange: onSelectionAreaChange,
|
669
676
|
prepareRow: prepareRow,
|
@@ -762,6 +769,10 @@ exports.DataSpreadsheet.propTypes = {
|
|
762
769
|
* Sets the number of empty rows to be created when there is no data provided
|
763
770
|
*/
|
764
771
|
defaultEmptyRowCount: index["default"].number,
|
772
|
+
/**
|
773
|
+
* Check if spreadsheet is using custom row header component attached
|
774
|
+
*/
|
775
|
+
hasCustomRowHeader: index["default"].bool,
|
765
776
|
/**
|
766
777
|
* The spreadsheet id
|
767
778
|
*/
|
@@ -778,6 +789,14 @@ exports.DataSpreadsheet.propTypes = {
|
|
778
789
|
* The event handler that is called when the selection area values change
|
779
790
|
*/
|
780
791
|
onSelectionAreaChange: index["default"].func,
|
792
|
+
/**
|
793
|
+
* Component next to numbering rows
|
794
|
+
*/
|
795
|
+
renderRowHeader: index["default"].func,
|
796
|
+
/**
|
797
|
+
* Component next to numbering rows
|
798
|
+
*/
|
799
|
+
renderRowHeaderDirection: index["default"].oneOf(['left', 'right']),
|
781
800
|
/**
|
782
801
|
* The aria label applied to the Select all button
|
783
802
|
*/
|
@@ -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
|
*/
|
@@ -44,6 +44,9 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
44
44
|
headerGroups = _ref.headerGroups,
|
45
45
|
id = _ref.id,
|
46
46
|
onDataUpdate = _ref.onDataUpdate,
|
47
|
+
renderRowHeader = _ref.renderRowHeader,
|
48
|
+
renderRowHeaderDirection = _ref.renderRowHeaderDirection,
|
49
|
+
hasCustomRowHeader = _ref.hasCustomRowHeader,
|
47
50
|
prepareRow = _ref.prepareRow,
|
48
51
|
rows = _ref.rows,
|
49
52
|
selectionAreaData = _ref.selectionAreaData,
|
@@ -147,7 +150,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
147
150
|
return;
|
148
151
|
});
|
149
152
|
}
|
150
|
-
}, [selectionAreas, setSelectionAreas, defaultColumn, onSelectionAreaChange, setSelectionAreaData, ref, activeCellCoordinates, setActiveCellInsideSelectionArea, visibleColumns]);
|
153
|
+
}, [selectionAreas, setSelectionAreas, defaultColumn, onSelectionAreaChange, setSelectionAreaData, ref, activeCellCoordinates, setActiveCellInsideSelectionArea, visibleColumns, hasCustomRowHeader]);
|
151
154
|
var populateSelectionAreaCellData = function populateSelectionAreaCellData(_ref2) {
|
152
155
|
var rowStart = _ref2.rowStart,
|
153
156
|
rowEnd = _ref2.rowEnd,
|
@@ -221,7 +224,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
221
224
|
});
|
222
225
|
}
|
223
226
|
}
|
224
|
-
}, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns]);
|
227
|
+
}, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns, hasCustomRowHeader]);
|
225
228
|
|
226
229
|
//this method will check for any duplicate selection area and remove.
|
227
230
|
//same selections are those have the same height, width, top, left styles. These inline styles are being set in createCellSelection util.
|
@@ -347,11 +350,12 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
347
350
|
"data-column-index": "header",
|
348
351
|
type: "button",
|
349
352
|
onClick: handleRowHeaderClickEvent(index),
|
350
|
-
className: cx__default["default"]("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__td-th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || checkActiveHeaderCell.checkActiveHeaderCell(index, selectionAreas, 'row')), "".concat(blockClass, "__td-th--selected-header"), checkSelectedHeaderCell.checkSelectedHeaderCell(index, selectionAreas, 'row', columns))),
|
353
|
+
className: cx__default["default"]("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.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.checkActiveHeaderCell(index, selectionAreas, 'row'))), "".concat(blockClass, "__td-th--selected-header"), !hasCustomRowHeader && checkSelectedHeaderCell.checkSelectedHeaderCell(index, selectionAreas, 'row', columns))),
|
351
354
|
style: {
|
352
|
-
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
|
355
|
+
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth,
|
356
|
+
flexDirection: hasCustomRowHeader ? renderRowHeaderDirection === 'Left' ? 'row-reverse' : row : undefined
|
353
357
|
}
|
354
|
-
}, index + 1)), row.cells.map(function (cell, index) {
|
358
|
+
}, index + 1, hasCustomRowHeader && typeof renderRowHeader === 'function' && renderRowHeader(index))), row.cells.map(function (cell, index) {
|
355
359
|
var _cell$column;
|
356
360
|
var cellProps = propsHelper.prepareProps(cell.getCellProps(), 'key');
|
357
361
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
@@ -376,7 +380,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
376
380
|
}, cell.render('Cell')));
|
377
381
|
}));
|
378
382
|
}
|
379
|
-
}, [prepareRow, rows, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, defaultColumn, columns]);
|
383
|
+
}, [prepareRow, renderRowHeader, renderRowHeaderDirection, rows, hasCustomRowHeader, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, defaultColumn, columns]);
|
380
384
|
var spreadsheetBodyRef = React.useRef();
|
381
385
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
382
386
|
ref: spreadsheetBodyRef,
|
@@ -442,6 +446,10 @@ DataSpreadsheetBody.propTypes = {
|
|
442
446
|
*/
|
443
447
|
/**@ts-ignore */
|
444
448
|
getTableBodyProps: index["default"].func,
|
449
|
+
/**
|
450
|
+
* Check if spreadsheet is using custom row header component attached
|
451
|
+
*/
|
452
|
+
hasCustomRowHeader: index["default"].bool,
|
445
453
|
/**
|
446
454
|
* Headers provided from useTable hook
|
447
455
|
*/
|
@@ -466,6 +474,14 @@ DataSpreadsheetBody.propTypes = {
|
|
466
474
|
* Prepare row function from react-table
|
467
475
|
*/
|
468
476
|
prepareRow: index["default"].func,
|
477
|
+
/**
|
478
|
+
* Component next to numbering rows
|
479
|
+
*/
|
480
|
+
renderRowHeader: index["default"].func,
|
481
|
+
/**
|
482
|
+
* Component next to numbering rows
|
483
|
+
*/
|
484
|
+
renderRowHeaderDirection: index["default"].string,
|
469
485
|
/**
|
470
486
|
* All of the spreadsheet row data
|
471
487
|
*/
|
@@ -184,6 +184,9 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
184
184
|
"data-row-index": "header",
|
185
185
|
"data-column-index": "header",
|
186
186
|
type: "button",
|
187
|
+
style: {
|
188
|
+
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
|
189
|
+
},
|
187
190
|
tabIndex: -1,
|
188
191
|
"aria-label": selectAllAriaLabel,
|
189
192
|
onClick: handleSelectAllClick,
|
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,
|
@@ -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
|
/**
|
@@ -27,7 +27,6 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
27
27
|
var _excluded = ["cancelButtonText", "children", "className", "description", "influencerWidth", "label", "onClose", "open", "submitButtonText", "title", "verticalPosition", "onRequestSubmit", "onFormChange", "sideNavAriaLabel"];
|
28
28
|
var componentName = 'EditTearsheet';
|
29
29
|
var blockClass = "".concat(settings.pkg.prefix, "--tearsheet-edit");
|
30
|
-
|
31
30
|
// This is a general context for the forms container
|
32
31
|
// containing information about the state of the container
|
33
32
|
// 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 {};
|
@@ -91,6 +91,7 @@ exports.EditTearsheetForm.propTypes = {
|
|
91
91
|
* 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.
|
92
92
|
* Otherwise, use CSS to hide/remove this label text.
|
93
93
|
*/
|
94
|
+
/**@ts-ignore */
|
94
95
|
fieldsetLegendText: index["default"].string.isRequired.if(function (_ref2) {
|
95
96
|
var hasFieldset = _ref2.hasFieldset;
|
96
97
|
return !!hasFieldset;
|
@@ -100,10 +101,12 @@ exports.EditTearsheetForm.propTypes = {
|
|
100
101
|
* and is defaulted to true.
|
101
102
|
* 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.
|
102
103
|
*/
|
104
|
+
/**@ts-ignore*/
|
103
105
|
hasFieldset: index["default"].bool,
|
104
106
|
/**
|
105
107
|
* Sets an optional subtitle on the form component
|
106
108
|
*/
|
109
|
+
/**@ts-ignore*/
|
107
110
|
subtitle: index["default"].string,
|
108
111
|
/**
|
109
112
|
* Sets the title text for a tearsheet form
|
@@ -53,6 +53,12 @@ exports.HTTPError403 = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
53
53
|
}));
|
54
54
|
});
|
55
55
|
|
56
|
+
/**@ts-ignore*/
|
57
|
+
exports.HTTPError403.deprecated = {
|
58
|
+
level: 'warn',
|
59
|
+
details: "Please replace ".concat(componentName, " with FullPageError")
|
60
|
+
};
|
61
|
+
|
56
62
|
// Return a placeholder if not released and not enabled by feature flag
|
57
63
|
exports.HTTPError403 = settings.pkg.checkComponentEnabled(exports.HTTPError403, componentName);
|
58
64
|
|
@@ -53,6 +53,12 @@ exports.HTTPError404 = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
53
53
|
}));
|
54
54
|
});
|
55
55
|
|
56
|
+
/**@ts-ignore*/
|
57
|
+
exports.HTTPError404.deprecated = {
|
58
|
+
level: 'warn',
|
59
|
+
details: "Please replace ".concat(componentName, " with FullPageError")
|
60
|
+
};
|
61
|
+
|
56
62
|
// Return a placeholder if not released and not enabled by feature flag
|
57
63
|
exports.HTTPError404 = settings.pkg.checkComponentEnabled(exports.HTTPError404, componentName);
|
58
64
|
|
@@ -53,6 +53,12 @@ exports.HTTPErrorOther = /*#__PURE__*/React__default["default"].forwardRef(funct
|
|
53
53
|
}));
|
54
54
|
});
|
55
55
|
|
56
|
+
/**@ts-ignore*/
|
57
|
+
exports.HTTPErrorOther.deprecated = {
|
58
|
+
level: 'warn',
|
59
|
+
details: "Please replace ".concat(componentName, " with FullPageError")
|
60
|
+
};
|
61
|
+
|
56
62
|
// Return a placeholder if not released and not enabled by feature flag
|
57
63
|
exports.HTTPErrorOther = settings.pkg.checkComponentEnabled(exports.HTTPErrorOther, componentName);
|
58
64
|
|
@@ -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
|
*/
|
@@ -25,7 +25,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
25
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
26
26
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
27
27
|
|
28
|
-
var _excluded = ["body", "className", "iconDescription", "inputInvalidText", "inputLabelText", "inputPlaceholderText", "label", "onClose", "onRequestSubmit", "open", "portalTarget", "preventCloseOnClickOutside", "primaryButtonDisabled", "primaryButtonText", "resourceName", "secondaryButtonText", "textConfirmation", "title"];
|
28
|
+
var _excluded = ["body", "className", "iconDescription", "inputInvalidText", "inputLabelText", "inputPlaceholderText", "label", "onClose", "onRequestSubmit", "open", "portalTarget", "preventCloseOnClickOutside", "primaryButtonDisabled", "primaryButtonText", "primaryDangerDescription", "resourceName", "secondaryButtonText", "textConfirmation", "title"];
|
29
29
|
var componentName = 'RemoveModal';
|
30
30
|
|
31
31
|
/**
|
@@ -49,6 +49,7 @@ exports.RemoveModal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
49
49
|
preventCloseOnClickOutside = _ref.preventCloseOnClickOutside,
|
50
50
|
primaryButtonDisabled = _ref.primaryButtonDisabled,
|
51
51
|
primaryButtonText = _ref.primaryButtonText,
|
52
|
+
primaryDangerDescription = _ref.primaryDangerDescription,
|
52
53
|
resourceName = _ref.resourceName,
|
53
54
|
secondaryButtonText = _ref.secondaryButtonText,
|
54
55
|
textConfirmation = _ref.textConfirmation,
|
@@ -118,6 +119,7 @@ exports.RemoveModal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
118
119
|
}, secondaryButtonText), /*#__PURE__*/React__default["default"].createElement(react.Button, {
|
119
120
|
type: "submit",
|
120
121
|
kind: "danger",
|
122
|
+
dangerDescription: primaryDangerDescription,
|
121
123
|
onClick: onRequestSubmit,
|
122
124
|
disabled: primaryButtonStatus
|
123
125
|
}, primaryButtonText))));
|
@@ -182,6 +184,10 @@ exports.RemoveModal.propTypes = {
|
|
182
184
|
* Specify the text for the primary button
|
183
185
|
*/
|
184
186
|
primaryButtonText: index["default"].string,
|
187
|
+
/**
|
188
|
+
* Specify the danger description on the primary button
|
189
|
+
*/
|
190
|
+
primaryDangerDescription: index["default"].string,
|
185
191
|
/**
|
186
192
|
* The name of the resource being acted upon
|
187
193
|
*/
|