@carbon/ibm-products 1.27.0 → 1.32.0
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 +570 -80
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +942 -23
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -3
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +569 -79
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +570 -80
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelect.js +0 -3
- package/es/components/AddSelect/AddSelectBody.js +20 -3
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +11 -3
- package/es/components/AddSelect/AddSelectColumn.js +4 -3
- package/es/components/AddSelect/AddSelectFilter.js +4 -3
- package/es/components/AddSelect/AddSelectList.js +40 -14
- package/es/components/Card/Card.js +16 -6
- package/es/components/Card/CardFooter.js +3 -1
- package/es/components/Card/CardHeader.js +20 -1
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +63 -11
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
- package/es/components/DataSpreadsheet/utils/handleCellDeletion.js +31 -0
- package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
- package/es/components/Datagrid/Datagrid/Datagrid.js +10 -38
- package/es/components/Datagrid/Datagrid/DatagridContent.js +127 -0
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -3
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +12 -3
- package/es/components/Datagrid/Datagrid/DraggableElement.js +5 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +5 -40
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +35 -10
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +61 -24
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +3 -2
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +60 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +467 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +112 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +27 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +39 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +19 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +263 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +66 -0
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +6 -5
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
- package/es/components/Datagrid/index.js +3 -1
- package/es/components/Datagrid/useActionsColumn.js +28 -12
- package/es/components/Datagrid/useColumnOrder.js +8 -0
- package/es/components/Datagrid/useCustomizeColumns.js +5 -0
- package/es/components/Datagrid/useDisableSelectRows.js +6 -2
- package/es/components/Datagrid/useExpandedRow.js +0 -1
- package/es/components/Datagrid/useInlineEdit.js +71 -0
- package/es/components/Datagrid/useNestedRowExpander.js +42 -0
- package/es/components/Datagrid/useNestedRows.js +2 -2
- package/es/components/Datagrid/useRowSize.js +17 -6
- package/es/components/Datagrid/useSelectAllToggle.js +17 -4
- package/es/components/Datagrid/useSelectRows.js +12 -2
- package/es/components/Datagrid/useStickyColumn.js +11 -0
- package/es/components/Datagrid/utils/DatagridActions.js +121 -0
- package/es/components/Datagrid/utils/DatagridPagination.js +33 -0
- package/es/components/Datagrid/utils/Wrapper.js +21 -0
- package/es/components/Datagrid/utils/getArgTypes.js +85 -0
- package/es/components/Datagrid/utils/getInlineEditColumns.js +121 -0
- package/es/components/Datagrid/utils/makeData.js +17 -1
- package/es/components/ImportModal/ImportModal.js +2 -2
- package/es/components/InlineEdit/InlineEdit.js +4 -2
- package/es/components/ProductiveCard/ProductiveCard.js +5 -0
- package/es/components/index.js +1 -1
- package/es/global/js/hooks/useClickOutside.js +1 -1
- package/es/global/js/package-settings.js +3 -3
- package/es/global/js/utils/rangeWithCallback.js +13 -0
- package/es/global/js/utils/story-helper.js +5 -1
- package/es/global/js/utils/uuidv4.spec.js +4 -0
- package/lib/components/AddSelect/AddSelect.js +0 -4
- package/lib/components/AddSelect/AddSelectBody.js +20 -3
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +14 -3
- package/lib/components/AddSelect/AddSelectColumn.js +3 -2
- package/lib/components/AddSelect/AddSelectFilter.js +3 -2
- package/lib/components/AddSelect/AddSelectList.js +39 -13
- package/lib/components/Card/Card.js +16 -6
- package/lib/components/Card/CardFooter.js +3 -1
- package/lib/components/Card/CardHeader.js +21 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +63 -10
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
- package/lib/components/DataSpreadsheet/utils/handleCellDeletion.js +42 -0
- package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
- package/lib/components/Datagrid/Datagrid/Datagrid.js +12 -45
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +160 -0
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +12 -3
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +14 -3
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +5 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +12 -41
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +47 -25
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +59 -23
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +3 -2
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +76 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +13 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +491 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +13 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +129 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +36 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +19 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +45 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +28 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +272 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +78 -0
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +6 -5
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
- package/lib/components/Datagrid/index.js +17 -1
- package/lib/components/Datagrid/useActionsColumn.js +28 -13
- package/lib/components/Datagrid/useColumnOrder.js +17 -0
- package/lib/components/Datagrid/useCustomizeColumns.js +5 -0
- package/lib/components/Datagrid/useDisableSelectRows.js +6 -2
- package/lib/components/Datagrid/useExpandedRow.js +0 -1
- package/lib/components/Datagrid/useInlineEdit.js +85 -0
- package/lib/components/Datagrid/useNestedRowExpander.js +57 -0
- package/lib/components/Datagrid/useNestedRows.js +3 -3
- package/lib/components/Datagrid/useRowSize.js +18 -13
- package/lib/components/Datagrid/useSelectAllToggle.js +18 -4
- package/lib/components/Datagrid/useSelectRows.js +12 -2
- package/lib/components/Datagrid/useStickyColumn.js +11 -0
- package/lib/components/Datagrid/utils/DatagridActions.js +139 -0
- package/lib/components/Datagrid/utils/DatagridPagination.js +46 -0
- package/lib/components/Datagrid/utils/Wrapper.js +33 -0
- package/lib/components/Datagrid/utils/getArgTypes.js +93 -0
- package/lib/components/Datagrid/utils/getInlineEditColumns.js +133 -0
- package/lib/components/Datagrid/utils/makeData.js +17 -1
- package/lib/components/ImportModal/ImportModal.js +2 -2
- package/lib/components/InlineEdit/InlineEdit.js +4 -2
- package/lib/components/ProductiveCard/ProductiveCard.js +5 -0
- package/lib/components/index.js +12 -0
- package/lib/global/js/hooks/useClickOutside.js +1 -1
- package/lib/global/js/package-settings.js +3 -3
- package/lib/global/js/utils/rangeWithCallback.js +22 -0
- package/lib/global/js/utils/story-helper.js +5 -1
- package/lib/global/js/utils/uuidv4.spec.js +4 -0
- package/package.json +13 -13
- package/scss/components/AddSelect/_add-select.scss +126 -28
- package/scss/components/Card/_card.scss +1 -0
- package/scss/components/Cascade/_cascade.scss +1 -1
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -0
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +18 -1
- package/scss/components/Datagrid/_storybook-styles.scss +1 -1
- package/scss/components/Datagrid/styles/_datagrid.scss +27 -4
- package/scss/components/Datagrid/styles/_draggableElement.scss +26 -9
- package/scss/components/Datagrid/styles/_index.scss +1 -0
- package/scss/components/Datagrid/styles/_useActionsColumn.scss +12 -0
- package/scss/components/Datagrid/styles/_useExpandedRow.scss +30 -0
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +211 -0
- package/scss/components/Datagrid/styles/_useNestedRows.scss +15 -1
- package/scss/components/Datagrid/styles/_useStickyColumn.scss +30 -2
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsModal.scss +44 -6
- package/scss/components/NotificationsPanel/_notifications-panel.scss +5 -6
- package/scss/components/ProductiveCard/_productive-card.scss +39 -0
- package/scss/components/RemoveModal/_remove-modal.scss +0 -4
- package/scss/components/SidePanel/_side-panel.scss +4 -6
- package/scss/components/_index-released-only.scss +1 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.returnUpdatedActiveCell = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _settings = require("../../../../../../settings");
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
+
|
|
18
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid"); // This function returns the state back to the reducer after
|
|
19
|
+
// determining the new active cell value
|
|
20
|
+
|
|
21
|
+
var returnUpdatedActiveCell = function returnUpdatedActiveCell(_ref) {
|
|
22
|
+
var activeCellCoords = _ref.activeCellCoords,
|
|
23
|
+
direction = _ref.direction,
|
|
24
|
+
totalVisibleColumns = _ref.totalVisibleColumns,
|
|
25
|
+
state = _ref.state,
|
|
26
|
+
instance = _ref.instance;
|
|
27
|
+
|
|
28
|
+
var newActiveCoords = _objectSpread(_objectSpread({}, activeCellCoords), {}, {
|
|
29
|
+
column: direction === 'right' ? activeCellCoords.column < totalVisibleColumns.length - 1 ? activeCellCoords.column + 1 : activeCellCoords.column : direction === 'left' ? activeCellCoords.column === 0 ? 0 : activeCellCoords.column - 1 : activeCellCoords.column,
|
|
30
|
+
row: direction === 'up' ? activeCellCoords.row === 0 ? 0 : activeCellCoords.row - 1 : direction === 'down' ? activeCellCoords.row < instance.rows.length - 1 ? activeCellCoords.row + 1 : activeCellCoords.row : activeCellCoords.row
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var newActiveCellId = "column-".concat(newActiveCoords.column, "-row-").concat(newActiveCoords.row);
|
|
34
|
+
var newCellIdButton = document.querySelector("#".concat(instance.tableId, " .").concat(blockClass, "__table-with-inline-edit [data-cell-id=\"").concat(newActiveCellId, "\"] .").concat(blockClass, "__inline-edit-button")); // Allows scrollable area to keep focused/active cell id visible
|
|
35
|
+
|
|
36
|
+
if (newCellIdButton) {
|
|
37
|
+
newCellIdButton === null || newCellIdButton === void 0 ? void 0 : newCellIdButton.focus();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
41
|
+
activeCellId: newActiveCellId
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.returnUpdatedActiveCell = returnUpdatedActiveCell;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handleGridFocus = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Copyright IBM Corp. 2022, 2022
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/
|
|
14
|
+
var handleGridFocus = function handleGridFocus(state, dispatch) {
|
|
15
|
+
var gridActive = state.gridActive,
|
|
16
|
+
previousActiveCellId = state.previousActiveCellId;
|
|
17
|
+
|
|
18
|
+
if (!gridActive) {
|
|
19
|
+
// Initialize grid active state
|
|
20
|
+
dispatch({
|
|
21
|
+
type: 'ADD_GRID_ACTIVE_FOCUS',
|
|
22
|
+
payload: previousActiveCellId || 'column-0-row-0' // If there is a previous active cell id that is found use that, otherwise use the first cell in the grid area
|
|
23
|
+
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.handleGridFocus = handleGridFocus;
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.handleGridKeyPress = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _settings = require("../../../../../settings");
|
|
13
|
+
|
|
14
|
+
var _handleMultipleKeys = require("./handleMultipleKeys");
|
|
15
|
+
|
|
16
|
+
var _getCellIdAsObject = require("./InlineEditContext/getCellIdAsObject");
|
|
17
|
+
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
|
|
22
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
23
|
+
|
|
24
|
+
var handleGridKeyPress = function handleGridKeyPress(_ref) {
|
|
25
|
+
var event = _ref.event,
|
|
26
|
+
dispatch = _ref.dispatch,
|
|
27
|
+
state = _ref.state,
|
|
28
|
+
instance = _ref.instance,
|
|
29
|
+
keysPressedList = _ref.keysPressedList,
|
|
30
|
+
usingMac = _ref.usingMac;
|
|
31
|
+
var key = event.key;
|
|
32
|
+
var gridActive = state.gridActive,
|
|
33
|
+
activeCellId = state.activeCellId,
|
|
34
|
+
editId = state.editId;
|
|
35
|
+
var focusedCell = document.querySelector("#".concat(instance.tableId, " .").concat(blockClass, "__table-with-inline-edit [data-cell-id=\"").concat(activeCellId, "\"]")); // If we reach this it means that tab was pressed while in
|
|
36
|
+
// edit mode which should not remove the focus from the grid
|
|
37
|
+
|
|
38
|
+
if (activeCellId === editId && key === 'Tab') {
|
|
39
|
+
// Attempting to exit date picker
|
|
40
|
+
if (focusedCell.getAttribute('data-inline-type') === 'date') {
|
|
41
|
+
dispatch({
|
|
42
|
+
type: 'EXIT_EDIT_MODE',
|
|
43
|
+
payload: activeCellId
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
var inlineEditArea = document.querySelector("#".concat(instance.tableId, " .").concat(blockClass, "__table-with-inline-edit"));
|
|
49
|
+
inlineEditArea.focus();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (activeCellId === editId && key === 'Escape') {
|
|
54
|
+
if (focusedCell.getAttribute('data-inline-type') === 'date') {
|
|
55
|
+
dispatch({
|
|
56
|
+
type: 'EXIT_EDIT_MODE',
|
|
57
|
+
payload: activeCellId
|
|
58
|
+
});
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
|
|
61
|
+
var _inlineEditArea = document.querySelector("#".concat(instance.tableId, " .").concat(blockClass, "__table-with-inline-edit"));
|
|
62
|
+
|
|
63
|
+
_inlineEditArea.focus();
|
|
64
|
+
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
} // Checks if the dropdown menu is open
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
var dropdownIsActive = function dropdownIsActive() {
|
|
71
|
+
var focusedElementRole = document.activeElement.getAttribute('role');
|
|
72
|
+
|
|
73
|
+
if (focusedElementRole === 'listbox' && document.activeElement.classList.contains("".concat(_settings.carbon.prefix, "--list-box__menu"))) {
|
|
74
|
+
// Prevents arrow keys from scrolling any other content when dropdown menu is open
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return false;
|
|
80
|
+
}; // Checks if the date picker is open
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
var datePickerIsActive = function datePickerIsActive() {
|
|
84
|
+
var focusedCalendarElement = document.querySelector(".".concat(_settings.carbon.prefix, "--date-picker__input.flatpickr-input.active"));
|
|
85
|
+
|
|
86
|
+
if (focusedCalendarElement || document.activeElement.classList.contains("flatpickr-day")) {
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return false;
|
|
92
|
+
}; // Stop grid key listener when in edit mode
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
var isEditing = document.activeElement.id === activeCellId && document.activeElement.id === editId || dropdownIsActive() || datePickerIsActive();
|
|
96
|
+
|
|
97
|
+
if (isEditing || !gridActive) {
|
|
98
|
+
return;
|
|
99
|
+
} // Command keys need to be returned as there is default browser behavior with these keys
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
if (key === 'Meta' || key === 'Control') {
|
|
103
|
+
return;
|
|
104
|
+
} // Prevent arrow keys, home key, and end key from scrolling the page when the data spreadsheet container has focus
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
if (['End', 'Home', 'ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown'].indexOf(key) > -1 && !isEditing && keysPressedList.length < 2) {
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
var isDisabledCell = !!focusedCell.getAttribute('data-disabled');
|
|
112
|
+
var sharedUpdateParams = {
|
|
113
|
+
oldId: activeCellId,
|
|
114
|
+
instance: instance
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
if (keysPressedList.length > 1) {
|
|
118
|
+
(0, _handleMultipleKeys.handleMultipleKeys)({
|
|
119
|
+
usingMac: usingMac,
|
|
120
|
+
keysPressedList: keysPressedList,
|
|
121
|
+
dispatch: dispatch,
|
|
122
|
+
activeCellId: activeCellId,
|
|
123
|
+
instance: instance
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (keysPressedList.length < 2) {
|
|
128
|
+
switch (key) {
|
|
129
|
+
case 'Tab':
|
|
130
|
+
{
|
|
131
|
+
if (!editId) {
|
|
132
|
+
dispatch({
|
|
133
|
+
type: 'REMOVE_GRID_ACTIVE_FOCUS',
|
|
134
|
+
payload: activeCellId
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
case 'ArrowRight':
|
|
142
|
+
{
|
|
143
|
+
dispatch({
|
|
144
|
+
type: 'UPDATE_ACTIVE_CELL_ID',
|
|
145
|
+
payload: _objectSpread({
|
|
146
|
+
direction: 'right'
|
|
147
|
+
}, sharedUpdateParams)
|
|
148
|
+
});
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
case 'ArrowLeft':
|
|
153
|
+
{
|
|
154
|
+
dispatch({
|
|
155
|
+
type: 'UPDATE_ACTIVE_CELL_ID',
|
|
156
|
+
payload: _objectSpread({
|
|
157
|
+
direction: 'left'
|
|
158
|
+
}, sharedUpdateParams)
|
|
159
|
+
});
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
case 'ArrowUp':
|
|
164
|
+
{
|
|
165
|
+
dispatch({
|
|
166
|
+
type: 'UPDATE_ACTIVE_CELL_ID',
|
|
167
|
+
payload: _objectSpread({
|
|
168
|
+
direction: 'up'
|
|
169
|
+
}, sharedUpdateParams)
|
|
170
|
+
});
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
case 'ArrowDown':
|
|
175
|
+
{
|
|
176
|
+
dispatch({
|
|
177
|
+
type: 'UPDATE_ACTIVE_CELL_ID',
|
|
178
|
+
payload: _objectSpread({
|
|
179
|
+
direction: 'down'
|
|
180
|
+
}, sharedUpdateParams)
|
|
181
|
+
});
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
// Move active cell to first column in current row
|
|
185
|
+
|
|
186
|
+
case 'Home':
|
|
187
|
+
{
|
|
188
|
+
var activeCellObject = (0, _getCellIdAsObject.getCellIdAsObject)(activeCellId);
|
|
189
|
+
|
|
190
|
+
var newActiveCellCoords = _objectSpread(_objectSpread({}, activeCellObject), {}, {
|
|
191
|
+
column: 0
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
var newActiveCellId = "column-".concat(newActiveCellCoords.column, "-row-").concat(newActiveCellCoords.row);
|
|
195
|
+
var scrollElement = document.querySelector("#".concat(instance.tableId, " .").concat(_settings.pkg.prefix, "--datagrid__table-container")); // Scroll table container to the furthest left position
|
|
196
|
+
|
|
197
|
+
scrollElement.scrollLeft = 0;
|
|
198
|
+
dispatch({
|
|
199
|
+
type: 'UPDATE_ACTIVE_CELL_ID',
|
|
200
|
+
payload: newActiveCellId
|
|
201
|
+
});
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
// Move active cell to last column in current row
|
|
205
|
+
|
|
206
|
+
case 'End':
|
|
207
|
+
{
|
|
208
|
+
var _activeCellObject = (0, _getCellIdAsObject.getCellIdAsObject)(activeCellId);
|
|
209
|
+
|
|
210
|
+
var totalVisibleColumns = instance.visibleColumns.filter(function (item) {
|
|
211
|
+
return item.id !== 'spacer';
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
var _newActiveCellCoords = _objectSpread(_objectSpread({}, _activeCellObject), {}, {
|
|
215
|
+
column: totalVisibleColumns.length - 1
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
var _newActiveCellId = "column-".concat(_newActiveCellCoords.column, "-row-").concat(_newActiveCellCoords.row);
|
|
219
|
+
|
|
220
|
+
var _scrollElement = document.querySelector("#".concat(instance.tableId, " .").concat(_settings.pkg.prefix, "--datagrid__table-container")); // Scroll table container to the furthest right position
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
_scrollElement.scrollLeft = _scrollElement.scrollWidth;
|
|
224
|
+
dispatch({
|
|
225
|
+
type: 'UPDATE_ACTIVE_CELL_ID',
|
|
226
|
+
payload: _newActiveCellId
|
|
227
|
+
});
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
case ' ':
|
|
232
|
+
case 'F2':
|
|
233
|
+
case 'Enter':
|
|
234
|
+
{
|
|
235
|
+
// Disabled cells are not allowed to go into edit mode
|
|
236
|
+
if (isDisabledCell) {
|
|
237
|
+
return;
|
|
238
|
+
} // Only go into edit mode if there is no editId, meaning that we're not already in edit mode
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
if (!editId) {
|
|
242
|
+
var focusedType = focusedCell.getAttribute('data-inline-type'); // Open dropdown immediately after entering edit mode for selection type
|
|
243
|
+
|
|
244
|
+
if (focusedType === 'selection') {
|
|
245
|
+
setTimeout(function () {
|
|
246
|
+
var dropdownTrigger = focusedCell.querySelector('button');
|
|
247
|
+
dropdownTrigger === null || dropdownTrigger === void 0 ? void 0 : dropdownTrigger.click();
|
|
248
|
+
}, 1);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (focusedType === 'date') {
|
|
252
|
+
setTimeout(function () {
|
|
253
|
+
var dateInputTrigger = focusedCell.querySelector('input');
|
|
254
|
+
dateInputTrigger === null || dateInputTrigger === void 0 ? void 0 : dateInputTrigger.click();
|
|
255
|
+
dateInputTrigger === null || dateInputTrigger === void 0 ? void 0 : dateInputTrigger.focus();
|
|
256
|
+
}, 1);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
dispatch({
|
|
260
|
+
type: 'ENTER_EDIT_MODE',
|
|
261
|
+
payload: {
|
|
262
|
+
activeCellId: activeCellId,
|
|
263
|
+
editId: activeCellId
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
exports.handleGridKeyPress = handleGridKeyPress;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handleMultipleKeys = void 0;
|
|
7
|
+
|
|
8
|
+
var _handleMultipleKeys = require("../../../../DataSpreadsheet/utils/handleMultipleKeys");
|
|
9
|
+
|
|
10
|
+
var _settings = require("../../../../../settings");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Copyright IBM Corp. 2022, 2022
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/
|
|
18
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
19
|
+
|
|
20
|
+
var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
|
21
|
+
var usingMac = _ref.usingMac,
|
|
22
|
+
keysPressedList = _ref.keysPressedList,
|
|
23
|
+
dispatch = _ref.dispatch,
|
|
24
|
+
activeCellId = _ref.activeCellId,
|
|
25
|
+
instance = _ref.instance;
|
|
26
|
+
|
|
27
|
+
// Resource key and Home
|
|
28
|
+
// Move active cell to first cell in first row and column
|
|
29
|
+
if ((0, _handleMultipleKeys.includesResourceKey)(keysPressedList, usingMac) && keysPressedList.includes('Home')) {
|
|
30
|
+
var scrollElement = document.querySelector("#".concat(instance.tableId, " .").concat(_settings.pkg.prefix, "--datagrid__table-container")); // Scroll table container to the furthest top left position
|
|
31
|
+
|
|
32
|
+
scrollElement.scrollTop = 0;
|
|
33
|
+
scrollElement.scrollLeft = 0;
|
|
34
|
+
dispatch({
|
|
35
|
+
type: 'UPDATE_ACTIVE_CELL_ID',
|
|
36
|
+
payload: 'column-0-row-0'
|
|
37
|
+
});
|
|
38
|
+
} // Resource key and End
|
|
39
|
+
// Move active cell to last cell in in the last row and column
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if ((0, _handleMultipleKeys.includesResourceKey)(keysPressedList, usingMac) && keysPressedList.includes('End')) {
|
|
43
|
+
var _instance$rows;
|
|
44
|
+
|
|
45
|
+
var totalVisibleColumns = instance.visibleColumns.filter(function (item) {
|
|
46
|
+
return item.id !== 'spacer';
|
|
47
|
+
}).length;
|
|
48
|
+
var totalRows = (_instance$rows = instance.rows) === null || _instance$rows === void 0 ? void 0 : _instance$rows.length;
|
|
49
|
+
var lastCellDataId = "column-".concat(totalVisibleColumns - 1, "-row-").concat(totalRows - 1);
|
|
50
|
+
var lastCellElement = document.querySelector("#".concat(instance.tableId, " .").concat(blockClass, "__table-with-inline-edit [data-cell-id=\"").concat(activeCellId, "\"]"));
|
|
51
|
+
|
|
52
|
+
var _scrollElement = document.querySelector("#".concat(instance.tableId, " .").concat(_settings.pkg.prefix, "--datagrid__table-container")); // Scroll table container to the furthest bottom right position
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
_scrollElement.scrollTop = _scrollElement.scrollHeight;
|
|
56
|
+
_scrollElement.scrollLeft = _scrollElement.scrollWidth;
|
|
57
|
+
|
|
58
|
+
if (lastCellElement) {
|
|
59
|
+
dispatch({
|
|
60
|
+
type: 'UPDATE_ACTIVE_CELL_ID',
|
|
61
|
+
payload: lastCellDataId
|
|
62
|
+
});
|
|
63
|
+
} else {
|
|
64
|
+
// If a Datagrid component is using virtualized data, it's possible that the last cell
|
|
65
|
+
// has not yet been rendered. In this case, we simply need to wait until the scrollable
|
|
66
|
+
// container has scrolled to the bottom/right most position, then we can dispatch the
|
|
67
|
+
// update active cell id action
|
|
68
|
+
setTimeout(function () {
|
|
69
|
+
dispatch({
|
|
70
|
+
type: 'UPDATE_ACTIVE_CELL_ID',
|
|
71
|
+
payload: lastCellDataId
|
|
72
|
+
});
|
|
73
|
+
}, 250);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
exports.handleMultipleKeys = handleMultipleKeys;
|
|
@@ -31,7 +31,7 @@ var _RowSizeRadioGroup = _interopRequireDefault(require("./RowSizeRadioGroup"));
|
|
|
31
31
|
|
|
32
32
|
var _settings = require("../../../../../settings");
|
|
33
33
|
|
|
34
|
-
var _excluded = ["
|
|
34
|
+
var _excluded = ["legendText"];
|
|
35
35
|
|
|
36
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
37
|
|
|
@@ -40,8 +40,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
40
40
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
41
41
|
|
|
42
42
|
var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
|
43
|
-
var _ref$
|
|
44
|
-
|
|
43
|
+
var _ref$legendText = _ref.legendText,
|
|
44
|
+
legendText = _ref$legendText === void 0 ? 'Row height' : _ref$legendText,
|
|
45
45
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
46
46
|
var buttonRef = React.useRef({});
|
|
47
47
|
|
|
@@ -59,9 +59,10 @@ var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
|
|
59
59
|
onClick: function onClick() {
|
|
60
60
|
return setIsOpen(!isOpen);
|
|
61
61
|
},
|
|
62
|
-
iconDescription:
|
|
62
|
+
iconDescription: legendText,
|
|
63
63
|
className: (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(blockClass, "__row-size-button--open"), isOpen))
|
|
64
64
|
}), isOpen && /*#__PURE__*/React.createElement(_RowSizeRadioGroup.default, (0, _extends2.default)({}, props, {
|
|
65
|
+
legendText: legendText,
|
|
65
66
|
buttonRef: buttonRef,
|
|
66
67
|
hideRadioGroup: function hideRadioGroup() {
|
|
67
68
|
setIsOpen(false);
|
|
@@ -70,8 +71,8 @@ var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
RowSizeDropdown.propTypes = {
|
|
73
|
-
buttonLabel: _propTypes.default.string,
|
|
74
74
|
datagridName: _propTypes.default.string,
|
|
75
|
+
legendText: _propTypes.default.string,
|
|
75
76
|
light: _propTypes.default.bool,
|
|
76
77
|
onChange: _propTypes.default.func.isRequired,
|
|
77
78
|
selectedOption: _propTypes.default.string
|
|
@@ -42,8 +42,7 @@ var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
|
|
|
42
42
|
buttonRef = _ref.buttonRef,
|
|
43
43
|
onChange = _ref.onChange,
|
|
44
44
|
hideRadioGroup = _ref.hideRadioGroup,
|
|
45
|
-
|
|
46
|
-
legendText = _ref$legendText === void 0 ? 'Row height' : _ref$legendText,
|
|
45
|
+
legendText = _ref.legendText,
|
|
47
46
|
_ref$rowSizeLabels = _ref.rowSizeLabels,
|
|
48
47
|
rowSizeLabels = _ref$rowSizeLabels === void 0 ? {
|
|
49
48
|
xl: 'Extra large',
|
|
@@ -23,6 +23,12 @@ Object.defineProperty(exports, "useColumnCenterAlign", {
|
|
|
23
23
|
return _useColumnCenterAlign.default;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
+
Object.defineProperty(exports, "useColumnOrder", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function get() {
|
|
29
|
+
return _useColumnOrder.default;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
26
32
|
Object.defineProperty(exports, "useColumnRightAlign", {
|
|
27
33
|
enumerable: true,
|
|
28
34
|
get: function get() {
|
|
@@ -59,6 +65,12 @@ Object.defineProperty(exports, "useInfiniteScroll", {
|
|
|
59
65
|
return _useInfiniteScroll.default;
|
|
60
66
|
}
|
|
61
67
|
});
|
|
68
|
+
Object.defineProperty(exports, "useInlineEdit", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function get() {
|
|
71
|
+
return _useInlineEdit.default;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
62
74
|
Object.defineProperty(exports, "useNestedRows", {
|
|
63
75
|
enumerable: true,
|
|
64
76
|
get: function get() {
|
|
@@ -132,4 +144,8 @@ var _useCustomizeColumns = _interopRequireDefault(require("./useCustomizeColumns
|
|
|
132
144
|
|
|
133
145
|
var _useSelectAllToggle = _interopRequireDefault(require("./useSelectAllToggle"));
|
|
134
146
|
|
|
135
|
-
var _useColumnCenterAlign = _interopRequireDefault(require("./useColumnCenterAlign"));
|
|
147
|
+
var _useColumnCenterAlign = _interopRequireDefault(require("./useColumnCenterAlign"));
|
|
148
|
+
|
|
149
|
+
var _useColumnOrder = _interopRequireDefault(require("./useColumnOrder"));
|
|
150
|
+
|
|
151
|
+
var _useInlineEdit = _interopRequireDefault(require("./useInlineEdit"));
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
15
|
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -21,13 +21,15 @@ var _carbonComponentsReact = require("carbon-components-react");
|
|
|
21
21
|
|
|
22
22
|
var _settings = require("../../settings");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["id", "
|
|
24
|
+
var _excluded = ["id", "itemText", "onClick", "icon"],
|
|
25
|
+
_excluded2 = ["id", "onClick", "shouldHideMenuItem", "shouldDisableMenuItem", "disabled"];
|
|
25
26
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
26
27
|
|
|
27
28
|
var useActionsColumn = function useActionsColumn(hooks) {
|
|
28
29
|
var useAttachActionsOnInstance = function useAttachActionsOnInstance(instance) {
|
|
29
30
|
var rowActions = instance.rowActions,
|
|
30
|
-
isFetching = instance.isFetching
|
|
31
|
+
isFetching = instance.isFetching,
|
|
32
|
+
selectedFlatRows = instance.selectedFlatRows;
|
|
31
33
|
|
|
32
34
|
if (rowActions && Array.isArray(rowActions)) {
|
|
33
35
|
var addActionsMenu = function addActionsMenu(props, cellData) {
|
|
@@ -36,7 +38,7 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
|
36
38
|
column = cell.column;
|
|
37
39
|
|
|
38
40
|
if (column.isAction) {
|
|
39
|
-
var
|
|
41
|
+
var _cx3;
|
|
40
42
|
|
|
41
43
|
return [props, {
|
|
42
44
|
children: /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -48,26 +50,36 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
|
48
50
|
style: {
|
|
49
51
|
display: 'flex'
|
|
50
52
|
}
|
|
51
|
-
}, rowActions.map(function (action) {
|
|
53
|
+
}, rowActions.map(function (action, index) {
|
|
52
54
|
var id = action.id,
|
|
53
55
|
itemText = action.itemText,
|
|
54
56
|
_onClick = action.onClick,
|
|
55
|
-
icon = action.icon
|
|
57
|
+
icon = action.icon,
|
|
58
|
+
rest = (0, _objectWithoutProperties2.default)(action, _excluded);
|
|
59
|
+
var selectedRowId = selectedFlatRows === null || selectedFlatRows === void 0 ? void 0 : selectedFlatRows.filter(function (item) {
|
|
60
|
+
return item.id === row.id ? item.id : null;
|
|
61
|
+
});
|
|
56
62
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
57
|
-
className: "".concat(blockClass, "__actions-column-button"),
|
|
58
|
-
key: ""
|
|
59
|
-
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.OverflowMenu, {
|
|
63
|
+
className: (0, _classnames.default)("".concat(blockClass, "__actions-column-button"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__disabled-row-action-button"), selectedFlatRows && selectedFlatRows.length && selectedRowId && selectedRowId.length)),
|
|
64
|
+
key: "".concat(itemText, "__").concat(index)
|
|
65
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.OverflowMenu, (0, _extends2.default)({}, rest, {
|
|
60
66
|
renderIcon: icon,
|
|
61
67
|
hasIconOnly: true,
|
|
62
68
|
light: true,
|
|
63
69
|
iconDescription: itemText,
|
|
64
70
|
kind: "ghost",
|
|
71
|
+
className: (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(blockClass, "__disabled-row-action"), selectedFlatRows && selectedFlatRows.length && selectedRowId && selectedRowId.length)),
|
|
65
72
|
onClick: function onClick(e) {
|
|
73
|
+
if (selectedFlatRows && selectedFlatRows.length && selectedRowId && selectedRowId.length) {
|
|
74
|
+
// Row actions should be disabled if row is selected and batchActions toolbar is active
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
66
78
|
e.stopPropagation();
|
|
67
79
|
|
|
68
80
|
_onClick(id, row, e);
|
|
69
81
|
}
|
|
70
|
-
}));
|
|
82
|
+
})));
|
|
71
83
|
})), !isFetching && rowActions.length > 2 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.OverflowMenu, {
|
|
72
84
|
size: "sm",
|
|
73
85
|
light: true,
|
|
@@ -81,7 +93,7 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
|
81
93
|
shouldHideMenuItem = action.shouldHideMenuItem,
|
|
82
94
|
shouldDisableMenuItem = action.shouldDisableMenuItem,
|
|
83
95
|
disabled = action.disabled,
|
|
84
|
-
rest = (0, _objectWithoutProperties2.default)(action,
|
|
96
|
+
rest = (0, _objectWithoutProperties2.default)(action, _excluded2);
|
|
85
97
|
var hidden = typeof shouldHideMenuItem === 'function' && shouldHideMenuItem(row); // shouldDisableMenuItem will override disabled because it's more specific
|
|
86
98
|
// if shouldDisableMenuItem doesn't exists, fall back to disabled
|
|
87
99
|
|
|
@@ -101,7 +113,10 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
|
101
113
|
key: id
|
|
102
114
|
}));
|
|
103
115
|
})))),
|
|
104
|
-
className: (0, _classnames.default)((
|
|
116
|
+
className: (0, _classnames.default)((_cx3 = {}, (0, _defineProperty2.default)(_cx3, "".concat(blockClass, "__actions-column-cell"), true), (0, _defineProperty2.default)(_cx3, "".concat(blockClass, "__cell"), true), _cx3)),
|
|
117
|
+
style: {
|
|
118
|
+
width: 96
|
|
119
|
+
}
|
|
105
120
|
}];
|
|
106
121
|
}
|
|
107
122
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactTable = require("react-table");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Copyright IBM Corp. 2022, 2022
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
var _default = _reactTable.useColumnOrder;
|
|
17
|
+
exports.default = _default;
|
|
@@ -35,6 +35,10 @@ var useCustomizeColumns = function useCustomizeColumns(hooks) {
|
|
|
35
35
|
|
|
36
36
|
hooks.useInstance.push(function (instance) {
|
|
37
37
|
var customizeColumnsProps = instance.customizeColumnsProps;
|
|
38
|
+
|
|
39
|
+
var _ref = customizeColumnsProps || {},
|
|
40
|
+
labels = _ref.labels;
|
|
41
|
+
|
|
38
42
|
Object.assign(instance, {
|
|
39
43
|
customizeColumnsProps: _objectSpread(_objectSpread({}, customizeColumnsProps), {}, {
|
|
40
44
|
isModalOpen: isModalOpen,
|
|
@@ -42,6 +46,7 @@ var useCustomizeColumns = function useCustomizeColumns(hooks) {
|
|
|
42
46
|
}),
|
|
43
47
|
CustomizeColumnsButton: function CustomizeColumnsButton(props) {
|
|
44
48
|
return /*#__PURE__*/React.createElement(_CustomizeColumns.ToggleButtonWrapper, (0, _extends2.default)({
|
|
49
|
+
iconTooltipLabel: labels === null || labels === void 0 ? void 0 : labels.iconTooltipLabel,
|
|
45
50
|
isModalOpen: isModalOpen,
|
|
46
51
|
setIsModalOpen: setIsModalOpen
|
|
47
52
|
}, props));
|