@carbon/ibm-products 1.13.0 → 1.16.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/components/Datagrid/styles/addons/CustomizeColumnsModal.css +47 -0
- package/css/components/Datagrid/styles/addons/CustomizeColumnsModal.css.map +1 -0
- package/css/components/Datagrid/styles/addons/RowSizeDropdown.css +20 -0
- package/css/components/Datagrid/styles/addons/RowSizeDropdown.css.map +1 -0
- package/css/components/Datagrid/styles/datagrid.css +268 -0
- package/css/components/Datagrid/styles/datagrid.css.map +1 -0
- package/css/components/Datagrid/styles/index.css +513 -0
- package/css/components/Datagrid/styles/index.css.map +1 -0
- package/css/components/Datagrid/styles/useActionsColumn.css +23 -0
- package/css/components/Datagrid/styles/useActionsColumn.css.map +1 -0
- package/css/components/Datagrid/styles/useColumnRightAlign.css +28 -0
- package/css/components/Datagrid/styles/useColumnRightAlign.css.map +1 -0
- package/css/components/Datagrid/styles/useNestedRows.css +15 -0
- package/css/components/Datagrid/styles/useNestedRows.css.map +1 -0
- package/css/components/Datagrid/styles/useNestedTable.css +25 -0
- package/css/components/Datagrid/styles/useNestedTable.css.map +1 -0
- package/css/components/Datagrid/styles/useSelectAllToggle.css +28 -0
- package/css/components/Datagrid/styles/useSelectAllToggle.css.map +1 -0
- package/css/components/Datagrid/styles/useSortableColumns.css +50 -0
- package/css/components/Datagrid/styles/useSortableColumns.css.map +1 -0
- package/css/components/Datagrid/styles/useStickyColumn.css +35 -0
- package/css/components/Datagrid/styles/useStickyColumn.css.map +1 -0
- package/css/index-full-carbon.css +611 -10
- 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 +7 -4
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +2 -2
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +611 -10
- 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 +611 -10
- 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 +106 -43
- package/es/components/AddSelect/AddSelectFilter.js +172 -0
- package/es/components/AddSelect/add-select-utils.js +30 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +255 -175
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +78 -17
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +65 -20
- package/es/components/DataSpreadsheet/hooks/index.js +11 -0
- package/es/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +139 -0
- package/es/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +2 -4
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetEdit.js +68 -0
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +1 -3
- package/es/components/DataSpreadsheet/utils/createCellSelectionArea.js +20 -8
- package/es/components/DataSpreadsheet/utils/generateData.js +17 -9
- package/es/components/DataSpreadsheet/utils/getSelectionAreaPoints.js +18 -0
- package/es/components/DataSpreadsheet/utils/getSpreadsheetWidth.js +30 -0
- package/es/components/DataSpreadsheet/utils/handleActiveCellInSelectionEnter.js +121 -0
- package/es/components/DataSpreadsheet/utils/handleActiveCellInSelectionTab.js +108 -0
- package/es/components/DataSpreadsheet/utils/handleEditSubmit.js +87 -0
- package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +42 -8
- package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +225 -13
- package/es/components/DataSpreadsheet/utils/selectAllCells.js +53 -0
- package/es/components/Datagrid/Datagrid/Datagrid.js +70 -0
- package/es/components/Datagrid/Datagrid/DatagridBody.js +36 -0
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +19 -0
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +26 -0
- package/es/components/Datagrid/Datagrid/DatagridHead.js +31 -0
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +57 -0
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +37 -0
- package/es/components/Datagrid/Datagrid/DatagridRow.js +60 -0
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +50 -0
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +122 -0
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +36 -0
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +22 -0
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +87 -0
- package/es/components/Datagrid/Datagrid/DraggableElement.js +188 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +78 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +51 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +140 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +157 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +62 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +13 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +9 -0
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +62 -0
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +139 -0
- package/es/components/Datagrid/Datagrid/addons/RowSize/index.js +8 -0
- package/es/components/Datagrid/Datagrid/index.js +8 -0
- package/es/components/Datagrid/Datagrid.stories/CustomizeColumnStory.js +6 -0
- package/es/components/Datagrid/Datagrid.stories/LeftPanelStory.js +6 -0
- package/es/components/Datagrid/Datagrid.stories/RowSizeDropdownStory.js +6 -0
- package/es/components/Datagrid/Datagrid.stories/SelectAllWithToggleStory.js +6 -0
- package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +92 -0
- package/es/components/Datagrid/Datagrid.stories/common.js +199 -0
- package/es/components/Datagrid/Datagrid.stories/index.js +5 -0
- package/es/components/Datagrid/common-column-ids.js +8 -0
- package/es/components/Datagrid/index.js +22 -0
- package/es/components/Datagrid/useActionsColumn.js +86 -0
- package/es/components/Datagrid/useColumnRightAlign.js +52 -0
- package/es/components/Datagrid/useCustomizeColumns.js +45 -0
- package/es/components/Datagrid/useDatagrid.js +44 -0
- package/es/components/Datagrid/useDefaultStringRenderer.js +48 -0
- package/es/components/Datagrid/useDisableSelectRows.js +84 -0
- package/es/components/Datagrid/useExpandedRow.js +52 -0
- package/es/components/Datagrid/useFlexResize.js +51 -0
- package/es/components/Datagrid/useFloatingScroll.js +88 -0
- package/es/components/Datagrid/useInfiniteScroll.js +54 -0
- package/es/components/Datagrid/useNestedRows.js +53 -0
- package/es/components/Datagrid/useOnRowClick.js +37 -0
- package/es/components/Datagrid/useParentDimensions.js +65 -0
- package/es/components/Datagrid/useResizeTable.js +40 -0
- package/es/components/Datagrid/useRowExpander.js +34 -0
- package/es/components/Datagrid/useRowIsMouseOver.js +61 -0
- package/es/components/Datagrid/useRowRenderer.js +30 -0
- package/es/components/Datagrid/useRowSize.js +56 -0
- package/es/components/Datagrid/useSelectAllToggle.js +74 -0
- package/es/components/Datagrid/useSelectRows.js +107 -0
- package/es/components/Datagrid/useSkeletonRows.js +32 -0
- package/es/components/Datagrid/useSortableColumns.js +110 -0
- package/es/components/Datagrid/useStickyColumn.js +183 -0
- package/es/components/MultiAddSelect/MultiAddSelect.js +150 -3
- package/es/components/PageHeader/PageHeader.js +3 -1
- package/es/components/SingleAddSelect/SingleAddSelect.js +90 -4
- package/es/components/TagSet/TagSet.js +13 -6
- package/es/components/Tearsheet/TearsheetShell.js +34 -10
- package/es/components/index.js +2 -1
- package/es/global/js/package-settings.js +4 -2
- package/lib/components/AddSelect/AddSelect.js +105 -41
- package/lib/components/AddSelect/AddSelectFilter.js +190 -0
- package/lib/components/AddSelect/add-select-utils.js +35 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +261 -177
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +79 -23
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +67 -21
- package/lib/components/DataSpreadsheet/hooks/index.js +45 -0
- package/lib/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +151 -0
- package/lib/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +2 -4
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetEdit.js +79 -0
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +1 -3
- package/lib/components/DataSpreadsheet/utils/createCellSelectionArea.js +21 -8
- package/lib/components/DataSpreadsheet/utils/generateData.js +17 -9
- package/lib/components/DataSpreadsheet/utils/getSelectionAreaPoints.js +27 -0
- package/lib/components/DataSpreadsheet/utils/getSpreadsheetWidth.js +40 -0
- package/lib/components/DataSpreadsheet/utils/handleActiveCellInSelectionEnter.js +127 -0
- package/lib/components/DataSpreadsheet/utils/handleActiveCellInSelectionTab.js +118 -0
- package/lib/components/DataSpreadsheet/utils/handleEditSubmit.js +94 -0
- package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +44 -8
- package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +235 -20
- package/lib/components/DataSpreadsheet/utils/selectAllCells.js +60 -0
- package/lib/components/Datagrid/Datagrid/Datagrid.js +86 -0
- package/lib/components/Datagrid/Datagrid/DatagridBody.js +50 -0
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +31 -0
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +38 -0
- package/lib/components/Datagrid/Datagrid/DatagridHead.js +43 -0
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +73 -0
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +44 -0
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +68 -0
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +55 -0
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +139 -0
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +44 -0
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +35 -0
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +101 -0
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +210 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +92 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +65 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +166 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +173 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +73 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +25 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/index.js +23 -0
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +80 -0
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +160 -0
- package/lib/components/Datagrid/Datagrid/addons/RowSize/index.js +15 -0
- package/lib/components/Datagrid/Datagrid/index.js +15 -0
- package/lib/components/Datagrid/Datagrid.stories/CustomizeColumnStory.js +13 -0
- package/lib/components/Datagrid/Datagrid.stories/LeftPanelStory.js +13 -0
- package/lib/components/Datagrid/Datagrid.stories/RowSizeDropdownStory.js +13 -0
- package/lib/components/Datagrid/Datagrid.stories/SelectAllWithToggleStory.js +13 -0
- package/lib/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +112 -0
- package/lib/components/Datagrid/Datagrid.stories/common.js +215 -0
- package/lib/components/Datagrid/Datagrid.stories/index.js +47 -0
- package/lib/components/Datagrid/common-column-ids.js +16 -0
- package/lib/components/Datagrid/index.js +127 -0
- package/lib/components/Datagrid/useActionsColumn.js +94 -0
- package/lib/components/Datagrid/useColumnRightAlign.js +59 -0
- package/lib/components/Datagrid/useCustomizeColumns.js +55 -0
- package/lib/components/Datagrid/useDatagrid.js +58 -0
- package/lib/components/Datagrid/useDefaultStringRenderer.js +54 -0
- package/lib/components/Datagrid/useDisableSelectRows.js +92 -0
- package/lib/components/Datagrid/useExpandedRow.js +58 -0
- package/lib/components/Datagrid/useFlexResize.js +61 -0
- package/lib/components/Datagrid/useFloatingScroll.js +101 -0
- package/lib/components/Datagrid/useInfiniteScroll.js +67 -0
- package/lib/components/Datagrid/useNestedRows.js +65 -0
- package/lib/components/Datagrid/useOnRowClick.js +45 -0
- package/lib/components/Datagrid/useParentDimensions.js +75 -0
- package/lib/components/Datagrid/useResizeTable.js +48 -0
- package/lib/components/Datagrid/useRowExpander.js +45 -0
- package/lib/components/Datagrid/useRowIsMouseOver.js +66 -0
- package/lib/components/Datagrid/useRowRenderer.js +40 -0
- package/lib/components/Datagrid/useRowSize.js +67 -0
- package/lib/components/Datagrid/useSelectAllToggle.js +88 -0
- package/lib/components/Datagrid/useSelectRows.js +119 -0
- package/lib/components/Datagrid/useSkeletonRows.js +42 -0
- package/lib/components/Datagrid/useSortableColumns.js +117 -0
- package/lib/components/Datagrid/useStickyColumn.js +190 -0
- package/lib/components/MultiAddSelect/MultiAddSelect.js +150 -2
- package/lib/components/PageHeader/PageHeader.js +3 -1
- package/lib/components/SingleAddSelect/SingleAddSelect.js +91 -3
- package/lib/components/TagSet/TagSet.js +13 -6
- package/lib/components/Tearsheet/TearsheetShell.js +36 -10
- package/lib/components/index.js +9 -1
- package/lib/global/js/package-settings.js +4 -2
- package/package.json +16 -12
- package/scss/components/AboutModal/_about-modal.scss +4 -0
- package/scss/components/AddSelect/_add-select.scss +46 -2
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +41 -4
- package/scss/components/Datagrid/_datagrid.scss +66 -0
- package/scss/components/Datagrid/_index.scss +8 -0
- package/scss/components/Datagrid/_storybook-styles.scss +26 -0
- package/scss/components/Datagrid/styles/_variables.scss +9 -0
- package/scss/components/Datagrid/styles/addons/CustomizeColumnsModal.scss +48 -0
- package/scss/components/Datagrid/styles/addons/RowSizeDropdown.scss +23 -0
- package/scss/components/Datagrid/styles/datagrid.scss +326 -0
- package/scss/components/Datagrid/styles/index.scss +17 -0
- package/scss/components/Datagrid/styles/useActionsColumn.scss +24 -0
- package/scss/components/Datagrid/styles/useColumnRightAlign.scss +29 -0
- package/scss/components/Datagrid/styles/useNestedRows.scss +17 -0
- package/scss/components/Datagrid/styles/useNestedTable.scss +28 -0
- package/scss/components/Datagrid/styles/useSelectAllToggle.scss +28 -0
- package/scss/components/Datagrid/styles/useSortableColumns.scss +55 -0
- package/scss/components/Datagrid/styles/useStickyColumn.scss +38 -0
- package/scss/components/ExportModal/_export-modal.scss +0 -4
- package/scss/components/Tearsheet/_tearsheet.scss +4 -0
- package/scss/components/_index.scss +1 -0
@@ -1,36 +1,87 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
4
6
|
value: true
|
5
7
|
});
|
6
|
-
exports.handleMultipleKeys = void 0;
|
8
|
+
exports.includesShift = exports.includesResourceKey = exports.handleMultipleKeys = void 0;
|
9
|
+
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
7
11
|
|
8
12
|
var _deepCloneObject = require("../../../global/js/utils/deepCloneObject");
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
var _uuidv = _interopRequireDefault(require("../../../global/js/utils/uuidv4"));
|
15
|
+
|
16
|
+
var _selectAllCells = require("./selectAllCells");
|
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 includesResourceKey = function includesResourceKey(arr, usingMac) {
|
23
|
+
if (usingMac) {
|
24
|
+
return includesMeta(arr);
|
25
|
+
}
|
26
|
+
|
27
|
+
if (!usingMac) {
|
28
|
+
return includesControl(arr);
|
29
|
+
}
|
30
|
+
};
|
31
|
+
|
32
|
+
exports.includesResourceKey = includesResourceKey;
|
33
|
+
|
34
|
+
var includesShift = function includesShift(arr) {
|
35
|
+
if (arr.includes('ShiftLeft') || arr.includes('ShiftRight')) {
|
36
|
+
return true;
|
37
|
+
}
|
38
|
+
|
39
|
+
return false;
|
40
|
+
};
|
41
|
+
|
42
|
+
exports.includesShift = includesShift;
|
43
|
+
|
44
|
+
var includesMeta = function includesMeta(arr) {
|
45
|
+
if (arr.includes('MetaLeft') || arr.includes('MetaRight')) {
|
46
|
+
return true;
|
47
|
+
}
|
48
|
+
|
49
|
+
return false;
|
50
|
+
};
|
51
|
+
|
52
|
+
var includesControl = function includesControl(arr) {
|
53
|
+
if (arr.includes('ControlLeft') || arr.includes('ControlRight')) {
|
54
|
+
return true;
|
55
|
+
}
|
56
|
+
|
57
|
+
return false;
|
58
|
+
};
|
59
|
+
|
16
60
|
var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
17
|
-
var _selectionAreasClone
|
61
|
+
var _selectionAreasClone$, _selectionAreasClone$2, _selectionAreasClone$3;
|
18
62
|
|
19
|
-
var
|
63
|
+
var activeCellCoordinates = _ref.activeCellCoordinates,
|
64
|
+
event = _ref.event,
|
65
|
+
keysPressedList = _ref.keysPressedList,
|
20
66
|
selectionAreas = _ref.selectionAreas,
|
21
67
|
currentMatcher = _ref.currentMatcher,
|
22
68
|
rows = _ref.rows,
|
23
69
|
setSelectionAreas = _ref.setSelectionAreas,
|
24
|
-
columns = _ref.columns
|
25
|
-
|
70
|
+
columns = _ref.columns,
|
71
|
+
updateActiveCellCoordinates = _ref.updateActiveCellCoordinates,
|
72
|
+
spreadsheetRef = _ref.spreadsheetRef,
|
73
|
+
removeCellSelections = _ref.removeCellSelections,
|
74
|
+
blockClass = _ref.blockClass,
|
75
|
+
setCurrentMatcher = _ref.setCurrentMatcher,
|
76
|
+
usingMac = _ref.usingMac;
|
26
77
|
var selectionAreasClone = (0, _deepCloneObject.deepCloneObject)(selectionAreas);
|
27
78
|
var indexOfCurrentArea = selectionAreasClone.findIndex(function (item) {
|
28
79
|
return item.matcher === currentMatcher;
|
29
80
|
});
|
30
|
-
var pointToUpdate = (_selectionAreasClone$ = selectionAreasClone[indexOfCurrentArea]) !== null && _selectionAreasClone$ !== void 0 && _selectionAreasClone$.point2 ? selectionAreasClone[indexOfCurrentArea].point2 : selectionAreasClone[indexOfCurrentArea].point1; // Down + Shift
|
81
|
+
var pointToUpdate = (_selectionAreasClone$ = selectionAreasClone[indexOfCurrentArea]) !== null && _selectionAreasClone$ !== void 0 && _selectionAreasClone$.point2 ? (_selectionAreasClone$2 = selectionAreasClone[indexOfCurrentArea]) === null || _selectionAreasClone$2 === void 0 ? void 0 : _selectionAreasClone$2.point2 : (_selectionAreasClone$3 = selectionAreasClone[indexOfCurrentArea]) === null || _selectionAreasClone$3 === void 0 ? void 0 : _selectionAreasClone$3.point1; // Down + Shift
|
31
82
|
|
32
|
-
if (
|
33
|
-
if (rows.length - 1 === pointToUpdate.row) {
|
83
|
+
if (includesShift(keysPressedList) && keysPressedList.includes('ArrowDown') && keysPressedList.length === 2) {
|
84
|
+
if (rows.length - 1 === (pointToUpdate === null || pointToUpdate === void 0 ? void 0 : pointToUpdate.row) || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
|
34
85
|
return;
|
35
86
|
}
|
36
87
|
|
@@ -44,8 +95,8 @@ var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
|
44
95
|
} // Right + Shift
|
45
96
|
|
46
97
|
|
47
|
-
if (
|
48
|
-
if (columns.length - 1 === pointToUpdate.column) {
|
98
|
+
if (includesShift(keysPressedList) && keysPressedList.includes('ArrowRight') && keysPressedList.length === 2) {
|
99
|
+
if (columns.length - 1 === (pointToUpdate === null || pointToUpdate === void 0 ? void 0 : pointToUpdate.column) || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
|
49
100
|
return;
|
50
101
|
}
|
51
102
|
|
@@ -59,8 +110,8 @@ var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
|
59
110
|
} // Up + Shift
|
60
111
|
|
61
112
|
|
62
|
-
if (
|
63
|
-
if (pointToUpdate.row === 0) {
|
113
|
+
if (includesShift(keysPressedList) && keysPressedList.includes('ArrowUp') && keysPressedList.length === 2) {
|
114
|
+
if ((pointToUpdate === null || pointToUpdate === void 0 ? void 0 : pointToUpdate.row) === 0 || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
|
64
115
|
return;
|
65
116
|
}
|
66
117
|
|
@@ -74,8 +125,8 @@ var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
|
74
125
|
} // Left + Shift
|
75
126
|
|
76
127
|
|
77
|
-
if (
|
78
|
-
if (pointToUpdate.column === 0) {
|
128
|
+
if (includesShift(keysPressedList) && keysPressedList.includes('ArrowLeft') && keysPressedList.length === 2) {
|
129
|
+
if ((pointToUpdate === null || pointToUpdate === void 0 ? void 0 : pointToUpdate.column) === 0 || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
|
79
130
|
return;
|
80
131
|
}
|
81
132
|
|
@@ -86,6 +137,170 @@ var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
|
86
137
|
selectionAreasClone[indexOfCurrentArea].point2 = _newPoint3;
|
87
138
|
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
88
139
|
setSelectionAreas(selectionAreasClone);
|
140
|
+
} // CMD + a (select all)
|
141
|
+
|
142
|
+
|
143
|
+
if (includesResourceKey(keysPressedList, usingMac) && keysPressedList.includes('KeyA')) {
|
144
|
+
event.preventDefault();
|
145
|
+
var selectionPoint1 = {
|
146
|
+
row: 0,
|
147
|
+
column: 0
|
148
|
+
};
|
149
|
+
var selectionPoint2 = {
|
150
|
+
row: rows.length - 1,
|
151
|
+
column: columns.length - 1
|
152
|
+
}; // If indexOfCurrentArea is -1, it means the active cell is in a cell header position
|
153
|
+
|
154
|
+
if (indexOfCurrentArea === -1) {
|
155
|
+
(0, _selectAllCells.selectAllCells)({
|
156
|
+
ref: spreadsheetRef,
|
157
|
+
setCurrentMatcher: setCurrentMatcher,
|
158
|
+
setSelectionAreas: setSelectionAreas,
|
159
|
+
rows: rows,
|
160
|
+
columns: columns,
|
161
|
+
activeCellCoordinates: activeCellCoordinates,
|
162
|
+
updateActiveCellCoordinates: updateActiveCellCoordinates
|
163
|
+
});
|
164
|
+
}
|
165
|
+
|
166
|
+
selectionAreasClone[indexOfCurrentArea].point1 = selectionPoint1;
|
167
|
+
selectionAreasClone[indexOfCurrentArea].point2 = selectionPoint2;
|
168
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
169
|
+
setSelectionAreas(selectionAreasClone);
|
170
|
+
} // CONTROL + SPACE (Select current column)
|
171
|
+
|
172
|
+
|
173
|
+
if (includesControl(keysPressedList) && keysPressedList.includes('Space')) {
|
174
|
+
var _selectionPoint = {
|
175
|
+
row: 0,
|
176
|
+
column: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column
|
177
|
+
};
|
178
|
+
var _selectionPoint2 = {
|
179
|
+
row: rows.length - 1,
|
180
|
+
column: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column
|
181
|
+
}; // If indexOfCurrentArea is -1, it means the active cell is in a cell header position
|
182
|
+
|
183
|
+
if (indexOfCurrentArea === -1) {
|
184
|
+
var tempMatcher = (0, _uuidv.default)();
|
185
|
+
var newSelectionArea = {
|
186
|
+
point1: _selectionPoint,
|
187
|
+
point2: _selectionPoint2,
|
188
|
+
areaCreated: false,
|
189
|
+
matcher: tempMatcher
|
190
|
+
};
|
191
|
+
|
192
|
+
var coordinatesClone = _objectSpread({}, activeCellCoordinates);
|
193
|
+
|
194
|
+
updateActiveCellCoordinates({
|
195
|
+
coords: coordinatesClone,
|
196
|
+
updatedValue: {
|
197
|
+
column: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column,
|
198
|
+
row: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row
|
199
|
+
}
|
200
|
+
});
|
201
|
+
setCurrentMatcher(tempMatcher);
|
202
|
+
return setSelectionAreas([newSelectionArea]);
|
203
|
+
}
|
204
|
+
|
205
|
+
selectionAreasClone[indexOfCurrentArea].point1 = _selectionPoint;
|
206
|
+
selectionAreasClone[indexOfCurrentArea].point2 = _selectionPoint2;
|
207
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
208
|
+
setSelectionAreas(selectionAreasClone);
|
209
|
+
} // Shift + SPACE (Select current row)
|
210
|
+
|
211
|
+
|
212
|
+
if (includesShift(keysPressedList) && keysPressedList.includes('Space')) {
|
213
|
+
var _selectionPoint3 = {
|
214
|
+
row: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row,
|
215
|
+
column: 0
|
216
|
+
};
|
217
|
+
var _selectionPoint4 = {
|
218
|
+
row: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row,
|
219
|
+
column: columns.length - 1
|
220
|
+
}; // If indexOfCurrentArea is -1, it means the active cell is in a cell header position
|
221
|
+
|
222
|
+
if (indexOfCurrentArea === -1) {
|
223
|
+
var _tempMatcher = (0, _uuidv.default)();
|
224
|
+
|
225
|
+
var _newSelectionArea = {
|
226
|
+
point1: _selectionPoint3,
|
227
|
+
point2: _selectionPoint4,
|
228
|
+
areaCreated: false,
|
229
|
+
matcher: _tempMatcher
|
230
|
+
};
|
231
|
+
|
232
|
+
var _coordinatesClone = _objectSpread({}, activeCellCoordinates);
|
233
|
+
|
234
|
+
updateActiveCellCoordinates({
|
235
|
+
coords: _coordinatesClone,
|
236
|
+
updatedValue: {
|
237
|
+
column: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column,
|
238
|
+
row: (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' ? 0 : activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row
|
239
|
+
}
|
240
|
+
});
|
241
|
+
setCurrentMatcher(_tempMatcher);
|
242
|
+
return setSelectionAreas([_newSelectionArea]);
|
243
|
+
}
|
244
|
+
|
245
|
+
selectionAreasClone[indexOfCurrentArea].point1 = _selectionPoint3;
|
246
|
+
selectionAreasClone[indexOfCurrentArea].point2 = _selectionPoint4;
|
247
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
248
|
+
setSelectionAreas(selectionAreasClone);
|
249
|
+
} // CMD + HOME (Selects first cell in first row)
|
250
|
+
|
251
|
+
|
252
|
+
if (includesResourceKey(keysPressedList, usingMac) && keysPressedList.includes('Home')) {
|
253
|
+
var scrollElement = spreadsheetRef.current.querySelector(".".concat(blockClass, "__list--container"));
|
254
|
+
scrollElement.scrollTop = 0;
|
255
|
+
|
256
|
+
var _coordinatesClone2 = _objectSpread({}, activeCellCoordinates);
|
257
|
+
|
258
|
+
removeCellSelections({
|
259
|
+
spreadsheetRef: spreadsheetRef
|
260
|
+
});
|
261
|
+
updateActiveCellCoordinates({
|
262
|
+
coords: _coordinatesClone2,
|
263
|
+
updatedValue: {
|
264
|
+
column: 0,
|
265
|
+
row: 0
|
266
|
+
}
|
267
|
+
});
|
268
|
+
} // CMD + END (Selects last cell in last row)
|
269
|
+
|
270
|
+
|
271
|
+
if (includesResourceKey(keysPressedList, usingMac) && keysPressedList.includes('End')) {
|
272
|
+
var _scrollElement = spreadsheetRef.current.querySelector(".".concat(blockClass, "__list--container"));
|
273
|
+
|
274
|
+
_scrollElement.scrollTop = _scrollElement.scrollHeight;
|
275
|
+
|
276
|
+
var _coordinatesClone3 = _objectSpread({}, activeCellCoordinates);
|
277
|
+
|
278
|
+
removeCellSelections({
|
279
|
+
spreadsheetRef: spreadsheetRef
|
280
|
+
});
|
281
|
+
var lastCellExists = !!rows[(rows === null || rows === void 0 ? void 0 : rows.length) - 1].cells[(columns === null || columns === void 0 ? void 0 : columns.length) - 1];
|
282
|
+
|
283
|
+
var updateToLastCell = function updateToLastCell() {
|
284
|
+
updateActiveCellCoordinates({
|
285
|
+
coords: _coordinatesClone3,
|
286
|
+
updatedValue: {
|
287
|
+
column: columns.length - 1,
|
288
|
+
row: rows.length - 1
|
289
|
+
}
|
290
|
+
});
|
291
|
+
}; // With the spreadsheet supporting virtualized data, it's possible that the last cell
|
292
|
+
// has never been rendered yet, if that's the case we scroll to the bottom of the spreadsheet
|
293
|
+
// and add a timeout to wait for the last row to render to the DOM before updating the active cell coordinates.
|
294
|
+
// If we're able to verify that the last row has been rendered, no timeout is used.
|
295
|
+
|
296
|
+
|
297
|
+
if (lastCellExists) {
|
298
|
+
updateToLastCell();
|
299
|
+
} else {
|
300
|
+
setTimeout(function () {
|
301
|
+
updateToLastCell();
|
302
|
+
}, 1);
|
303
|
+
}
|
89
304
|
}
|
90
305
|
};
|
91
306
|
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.selectAllCells = void 0;
|
9
|
+
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
|
+
|
12
|
+
var _removeCellSelections = require("./removeCellSelections");
|
13
|
+
|
14
|
+
var _uuidv = _interopRequireDefault(require("../../../global/js/utils/uuidv4"));
|
15
|
+
|
16
|
+
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; }
|
17
|
+
|
18
|
+
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; }
|
19
|
+
|
20
|
+
var selectAllCells = function selectAllCells(_ref) {
|
21
|
+
var activeCellCoordinates = _ref.activeCellCoordinates,
|
22
|
+
columns = _ref.columns,
|
23
|
+
setCurrentMatcher = _ref.setCurrentMatcher,
|
24
|
+
setSelectionAreas = _ref.setSelectionAreas,
|
25
|
+
ref = _ref.ref,
|
26
|
+
rows = _ref.rows,
|
27
|
+
updateActiveCellCoordinates = _ref.updateActiveCellCoordinates;
|
28
|
+
(0, _removeCellSelections.removeCellSelections)({
|
29
|
+
spreadsheetRef: ref
|
30
|
+
});
|
31
|
+
var selectionPoint1 = {
|
32
|
+
row: 0,
|
33
|
+
column: 0
|
34
|
+
};
|
35
|
+
var selectionPoint2 = {
|
36
|
+
row: rows.length - 1,
|
37
|
+
column: columns.length - 1
|
38
|
+
};
|
39
|
+
var tempMatcher = (0, _uuidv.default)();
|
40
|
+
var newSelectionArea = {
|
41
|
+
point1: selectionPoint1,
|
42
|
+
point2: selectionPoint2,
|
43
|
+
areaCreated: false,
|
44
|
+
matcher: tempMatcher
|
45
|
+
};
|
46
|
+
|
47
|
+
var coordinatesClone = _objectSpread({}, activeCellCoordinates);
|
48
|
+
|
49
|
+
updateActiveCellCoordinates({
|
50
|
+
coords: coordinatesClone,
|
51
|
+
updatedValue: {
|
52
|
+
column: 0,
|
53
|
+
row: 0
|
54
|
+
}
|
55
|
+
});
|
56
|
+
setCurrentMatcher(tempMatcher);
|
57
|
+
return setSelectionAreas([newSelectionArea]);
|
58
|
+
};
|
59
|
+
|
60
|
+
exports.selectAllCells = selectAllCells;
|
@@ -0,0 +1,86 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11
|
+
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
13
|
+
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
15
|
+
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
17
|
+
|
18
|
+
var _carbonComponentsReact = require("carbon-components-react");
|
19
|
+
|
20
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
21
|
+
|
22
|
+
var _DatagridHead = _interopRequireDefault(require("./DatagridHead"));
|
23
|
+
|
24
|
+
var _DatagridBody = _interopRequireDefault(require("./DatagridBody"));
|
25
|
+
|
26
|
+
var _DatagridToolbar = _interopRequireDefault(require("./DatagridToolbar"));
|
27
|
+
|
28
|
+
var _devtools = require("../../../global/js/utils/devtools");
|
29
|
+
|
30
|
+
var _settings = require("../../../settings");
|
31
|
+
|
32
|
+
var _excluded = ["getTableProps", "withVirtualScroll", "DatagridPagination", "isFetching", "tableId", "CustomizeColumnsModal", "leftPanel", "fullHeightDatagrid", "verticalAlign", "variableRowHeight", "className"];
|
33
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
34
|
+
var componentName = 'Datagrid';
|
35
|
+
var TableContainer = _carbonComponentsReact.DataTable.TableContainer,
|
36
|
+
Table = _carbonComponentsReact.DataTable.Table;
|
37
|
+
|
38
|
+
var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (datagridState, ref) {
|
39
|
+
var _getTableProps;
|
40
|
+
|
41
|
+
var _datagridState$getTab = datagridState.getTableProps,
|
42
|
+
getTableProps = _datagridState$getTab === void 0 ? function () {} : _datagridState$getTab,
|
43
|
+
withVirtualScroll = datagridState.withVirtualScroll,
|
44
|
+
DatagridPagination = datagridState.DatagridPagination,
|
45
|
+
isFetching = datagridState.isFetching,
|
46
|
+
tableId = datagridState.tableId,
|
47
|
+
CustomizeColumnsModal = datagridState.CustomizeColumnsModal,
|
48
|
+
leftPanel = datagridState.leftPanel,
|
49
|
+
fullHeightDatagrid = datagridState.fullHeightDatagrid,
|
50
|
+
_datagridState$vertic = datagridState.verticalAlign,
|
51
|
+
verticalAlign = _datagridState$vertic === void 0 ? 'center' : _datagridState$vertic,
|
52
|
+
variableRowHeight = datagridState.variableRowHeight,
|
53
|
+
className = datagridState.className,
|
54
|
+
rest = (0, _objectWithoutProperties2.default)(datagridState, _excluded);
|
55
|
+
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
56
|
+
|
57
|
+
var dataGrid = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TableContainer, {
|
58
|
+
className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '')
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(Table, (0, _extends2.default)({}, getTableProps(), {
|
60
|
+
className: (0, _classnames.default)(DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className)
|
61
|
+
}), /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState), /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
|
62
|
+
rows: rows
|
63
|
+
})))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/_react.default.createElement(CustomizeColumnsModal, {
|
64
|
+
instance: datagridState
|
65
|
+
}));
|
66
|
+
|
67
|
+
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
68
|
+
id: tableId,
|
69
|
+
ref: ref,
|
70
|
+
className: (0, _classnames.default)(className, blockClass, withVirtualScroll ? "".concat(blockClass, "__datagridWrap") : "".concat(blockClass, "__datagridWrap-simple"))
|
71
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_DatagridToolbar.default, datagridState), leftPanel && /*#__PURE__*/_react.default.createElement("div", {
|
72
|
+
className: "".concat(blockClass, "__grid-container ").concat(blockClass, "__displayFlex")
|
73
|
+
}, leftPanel && leftPanel.isOpen && /*#__PURE__*/_react.default.createElement("div", {
|
74
|
+
className: "".concat(blockClass, "__datagridLeftPanel")
|
75
|
+
}, leftPanel.panelContent), /*#__PURE__*/_react.default.createElement("div", {
|
76
|
+
className: "".concat(blockClass, "__datagridWithPanel")
|
77
|
+
}, dataGrid)), leftPanel === undefined && dataGrid);
|
78
|
+
}); // Return a placeholder if not released and not enabled by feature flag
|
79
|
+
|
80
|
+
|
81
|
+
Datagrid = _settings.pkg.checkComponentEnabled(Datagrid, componentName); // The display name of the component, used by React. Note that displayName
|
82
|
+
// is used in preference to relying on function.name.
|
83
|
+
|
84
|
+
Datagrid.displayName = componentName;
|
85
|
+
var _default = Datagrid;
|
86
|
+
exports.default = _default;
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
11
|
+
|
12
|
+
var _DatagridEmptyBody = _interopRequireDefault(require("./DatagridEmptyBody"));
|
13
|
+
|
14
|
+
var _DatagridVirtualBody = _interopRequireDefault(require("./DatagridVirtualBody"));
|
15
|
+
|
16
|
+
var _DatagridSimpleBody = _interopRequireDefault(require("./DatagridSimpleBody"));
|
17
|
+
|
18
|
+
var _DatagridRefBody = _interopRequireDefault(require("./DatagridRefBody"));
|
19
|
+
|
20
|
+
/*
|
21
|
+
* Licensed Materials - Property of IBM
|
22
|
+
* 5724-Q36
|
23
|
+
* (c) Copyright IBM Corp. 2021
|
24
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
25
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
26
|
+
*/
|
27
|
+
var DatagridBody = function DatagridBody(datagridState) {
|
28
|
+
var isFetching = datagridState.isFetching,
|
29
|
+
_datagridState$rows = datagridState.rows,
|
30
|
+
rows = _datagridState$rows === void 0 ? [] : _datagridState$rows,
|
31
|
+
withVirtualScroll = datagridState.withVirtualScroll,
|
32
|
+
withStickyColumn = datagridState.withStickyColumn;
|
33
|
+
|
34
|
+
if (!isFetching && rows.length === 0) {
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_DatagridEmptyBody.default, datagridState);
|
36
|
+
}
|
37
|
+
|
38
|
+
if (withVirtualScroll) {
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_DatagridVirtualBody.default, datagridState);
|
40
|
+
}
|
41
|
+
|
42
|
+
if (withStickyColumn) {
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_DatagridRefBody.default, datagridState);
|
44
|
+
}
|
45
|
+
|
46
|
+
return /*#__PURE__*/_react.default.createElement(_DatagridSimpleBody.default, datagridState);
|
47
|
+
};
|
48
|
+
|
49
|
+
var _default = DatagridBody;
|
50
|
+
exports.default = _default;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
11
|
+
|
12
|
+
var _settings = require("../../../settings");
|
13
|
+
|
14
|
+
/*
|
15
|
+
* Licensed Materials - Property of IBM
|
16
|
+
* 5724-Q36
|
17
|
+
* (c) Copyright IBM Corp. 2020
|
18
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
19
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
20
|
+
*/
|
21
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
22
|
+
|
23
|
+
var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
|
24
|
+
var EmptyState = datagridState.EmptyState;
|
25
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
26
|
+
className: "".concat(blockClass, "__empty-state-body")
|
27
|
+
}, EmptyState);
|
28
|
+
};
|
29
|
+
|
30
|
+
var _default = DatagridEmptyBody;
|
31
|
+
exports.default = _default;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
11
|
+
|
12
|
+
var _settings = require("../../../settings");
|
13
|
+
|
14
|
+
/*
|
15
|
+
* Licensed Materials - Property of IBM
|
16
|
+
* 5724-Q36
|
17
|
+
* (c) Copyright IBM Corp. 2020
|
18
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
19
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
20
|
+
*/
|
21
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid"); // eslint-disable-next-line react/prop-types
|
22
|
+
|
23
|
+
var DatagridExpandedRow = function DatagridExpandedRow(PreviousRowRenderer, ExpandedRowContentComponent) {
|
24
|
+
return function (datagridState) {
|
25
|
+
var row = datagridState.row;
|
26
|
+
|
27
|
+
if (!row.isExpanded) {
|
28
|
+
return PreviousRowRenderer(datagridState);
|
29
|
+
}
|
30
|
+
|
31
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
32
|
+
className: "".concat(blockClass, "__expanded-row")
|
33
|
+
}, PreviousRowRenderer(datagridState), ExpandedRowContentComponent(datagridState));
|
34
|
+
};
|
35
|
+
};
|
36
|
+
|
37
|
+
var _default = DatagridExpandedRow;
|
38
|
+
exports.default = _default;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11
|
+
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
13
|
+
|
14
|
+
var _carbonComponentsReact = require("carbon-components-react");
|
15
|
+
|
16
|
+
/*
|
17
|
+
* Licensed Materials - Property of IBM
|
18
|
+
* 5724-Q36
|
19
|
+
* (c) Copyright IBM Corp. 2020, 2021
|
20
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
21
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
22
|
+
*/
|
23
|
+
var TableHead = _carbonComponentsReact.DataTable.TableHead;
|
24
|
+
|
25
|
+
var DatagridHead = function DatagridHead(datagridState) {
|
26
|
+
var _datagridState$header = datagridState.headerGroups,
|
27
|
+
headerGroups = _datagridState$header === void 0 ? [] : _datagridState$header,
|
28
|
+
headRef = datagridState.headRef,
|
29
|
+
HeaderRow = datagridState.HeaderRow;
|
30
|
+
return /*#__PURE__*/_react.default.createElement(TableHead, null, headerGroups.map(function (headerGroup, index) {
|
31
|
+
return (
|
32
|
+
/*#__PURE__*/
|
33
|
+
// doesn't support header grouping.
|
34
|
+
_react.default.createElement("div", (0, _extends2.default)({}, headerGroup.getHeaderGroupProps(), {
|
35
|
+
ref: headRef,
|
36
|
+
key: "header_".concat(index)
|
37
|
+
}), HeaderRow(datagridState))
|
38
|
+
);
|
39
|
+
}));
|
40
|
+
};
|
41
|
+
|
42
|
+
var _default = DatagridHead;
|
43
|
+
exports.default = _default;
|