@carbon/ibm-products 1.11.2 → 1.14.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/README.md +0 -3
- 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 +264 -0
- package/css/components/Datagrid/styles/datagrid.css.map +1 -0
- package/css/components/Datagrid/styles/index.css +509 -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 +2019 -376
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +6 -6
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +18 -6
- 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 +679 -19
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +5 -5
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +679 -19
- package/css/index.css.map +1 -1
- package/css/index.min.css +6 -6
- package/css/index.min.css.map +1 -1
- package/es/components/ActionBar/ActionBar.js +3 -1
- package/es/components/ActionBar/ActionBarOverflowItems.js +5 -3
- package/es/components/AddSelect/AddSelect.js +133 -30
- package/es/components/AddSelect/AddSelectColumn.js +0 -1
- package/es/components/AddSelect/AddSelectFilter.js +129 -0
- package/es/components/AddSelect/AddSelectList.js +59 -13
- package/es/components/AddSelect/AddSelectSidebar.js +15 -5
- package/es/components/AddSelect/add-select-utils.js +30 -0
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +262 -164
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +191 -51
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +65 -13
- package/es/components/DataSpreadsheet/hooks/index.js +10 -0
- package/es/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +111 -0
- package/es/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +2 -4
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +6 -6
- package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +3 -1
- package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +80 -6
- 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 +50 -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/HTTPErrors/assets/HTTPErrorSvg403.js +2 -3
- package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +2 -3
- package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +2 -3
- package/es/components/ImportModal/ImportModal.js +2 -2
- package/es/components/TagSet/TagSet.js +12 -3
- package/es/components/UserProfileImage/UserProfileImage.js +38 -10
- package/es/components/index.js +2 -1
- package/es/global/js/package-settings.js +2 -1
- package/lib/components/ActionBar/ActionBar.js +3 -1
- package/lib/components/ActionBar/ActionBarOverflowItems.js +5 -3
- package/lib/components/AddSelect/AddSelect.js +132 -28
- package/lib/components/AddSelect/AddSelectColumn.js +0 -1
- package/lib/components/AddSelect/AddSelectFilter.js +147 -0
- package/lib/components/AddSelect/AddSelectList.js +61 -12
- package/lib/components/AddSelect/AddSelectSidebar.js +15 -11
- package/lib/components/AddSelect/add-select-utils.js +35 -2
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +267 -168
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +191 -57
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +67 -18
- package/lib/components/DataSpreadsheet/hooks/index.js +37 -0
- package/lib/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +123 -0
- package/lib/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +2 -4
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +6 -5
- package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +3 -1
- package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +83 -7
- 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 +56 -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/HTTPErrors/assets/HTTPErrorSvg403.js +2 -3
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +2 -3
- package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +2 -3
- package/lib/components/ImportModal/ImportModal.js +1 -1
- package/lib/components/TagSet/TagSet.js +12 -3
- package/lib/components/UserProfileImage/UserProfileImage.js +38 -10
- package/lib/components/index.js +9 -1
- package/lib/global/js/package-settings.js +2 -1
- package/package.json +19 -15
- package/scss/components/AboutModal/_about-modal.scss +2 -2
- package/scss/components/ActionSet/_action-set.scss +3 -1
- package/scss/components/AddSelect/_add-select.scss +87 -3
- package/scss/components/CreateModal/_create-modal.scss +7 -5
- package/scss/components/CreateModal/_storybook-styles.scss +8 -7
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +70 -10
- 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 +318 -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 +3 -3
- package/scss/components/HTTPErrors/_http-errors.scss +16 -16
- package/scss/components/InlineEdit/_inline-edit.scss +0 -1
- package/scss/components/ModifiedTabs/_modified-tabs.scss +0 -10
- package/scss/components/NotificationsPanel/_notifications-panel.scss +3 -3
- package/scss/components/OptionsTile/_options-tile.scss +0 -1
- package/scss/components/PageHeader/_page-header.scss +4 -0
- package/scss/components/RemoveModal/_remove-modal.scss +3 -3
- package/scss/components/TagSet/_tag-set.scss +2 -1
- package/scss/components/Tearsheet/_tearsheet.scss +5 -2
- package/scss/components/_index.scss +1 -0
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { useEffect } from 'react';
|
|
8
|
-
import { pkg } from '../../../settings';
|
|
8
|
+
import { pkg } from '../../../settings';
|
|
9
|
+
import { removeCellSelections } from '../utils/removeCellSelections'; // Click outside useEffect for spreadsheet
|
|
9
10
|
|
|
10
11
|
export var useSpreadsheetOutsideClick = function useSpreadsheetOutsideClick(_ref) {
|
|
11
12
|
var spreadsheetRef = _ref.spreadsheetRef,
|
|
@@ -14,9 +15,7 @@ export var useSpreadsheetOutsideClick = function useSpreadsheetOutsideClick(_ref
|
|
|
14
15
|
setActiveCellCoordinates = _ref.setActiveCellCoordinates,
|
|
15
16
|
setSelectionAreas = _ref.setSelectionAreas,
|
|
16
17
|
removeActiveCell = _ref.removeActiveCell,
|
|
17
|
-
removeCellSelections = _ref.removeCellSelections,
|
|
18
18
|
setContainerHasFocus = _ref.setContainerHasFocus,
|
|
19
|
-
activeKeys = _ref.activeKeys,
|
|
20
19
|
removeCellEditor = _ref.removeCellEditor;
|
|
21
20
|
useEffect(function () {
|
|
22
21
|
var handleOutsideClick = function handleOutsideClick(event) {
|
|
@@ -27,15 +26,16 @@ export var useSpreadsheetOutsideClick = function useSpreadsheetOutsideClick(_ref
|
|
|
27
26
|
setActiveCellCoordinates(null);
|
|
28
27
|
setSelectionAreas([]);
|
|
29
28
|
removeActiveCell();
|
|
30
|
-
removeCellSelections(
|
|
29
|
+
removeCellSelections({
|
|
30
|
+
spreadsheetRef: spreadsheetRef
|
|
31
|
+
});
|
|
31
32
|
setContainerHasFocus(false);
|
|
32
33
|
removeCellEditor();
|
|
33
|
-
activeKeys.current = [];
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
document.addEventListener('click', handleOutsideClick);
|
|
37
37
|
return function () {
|
|
38
38
|
document.removeEventListener('click', handleOutsideClick);
|
|
39
39
|
};
|
|
40
|
-
}, [spreadsheetRef, removeActiveCell,
|
|
40
|
+
}, [spreadsheetRef, removeActiveCell, blockClass, setActiveCellCoordinates, setContainerHasFocus, setSelectionAreas, removeCellEditor]);
|
|
41
41
|
};
|
|
@@ -16,7 +16,9 @@ export var handleHeaderCellSelection = function handleHeaderCellSelection(_ref)
|
|
|
16
16
|
setSelectionAreas = _ref.setSelectionAreas,
|
|
17
17
|
spreadsheetRef = _ref.spreadsheetRef,
|
|
18
18
|
index = _ref.index,
|
|
19
|
-
isKeyboard = _ref.isKeyboard
|
|
19
|
+
isKeyboard = _ref.isKeyboard,
|
|
20
|
+
setSelectionAreaData = _ref.setSelectionAreaData;
|
|
21
|
+
setSelectionAreaData([]);
|
|
20
22
|
var rowValue = isKeyboard ? activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row : index;
|
|
21
23
|
var columnValue = isKeyboard ? activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column : index;
|
|
22
24
|
var point1 = {
|
|
@@ -5,23 +5,48 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { deepCloneObject } from '../../../global/js/utils/deepCloneObject';
|
|
8
|
+
export var includesShift = function includesShift(arr) {
|
|
9
|
+
if (arr.includes('ShiftLeft') || arr.includes('ShiftRight')) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return false;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
var includesMeta = function includesMeta(arr) {
|
|
17
|
+
if (arr.includes('MetaLeft') || arr.includes('MetaRight')) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var includesControl = function includesControl(arr) {
|
|
25
|
+
if (arr.includes('ControlLeft') || arr.includes('ControlRight')) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
|
|
8
32
|
export var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
|
9
33
|
var _selectionAreasClone$;
|
|
10
34
|
|
|
11
|
-
var
|
|
35
|
+
var activeCellCoordinates = _ref.activeCellCoordinates,
|
|
36
|
+
event = _ref.event,
|
|
37
|
+
keysPressedList = _ref.keysPressedList,
|
|
12
38
|
selectionAreas = _ref.selectionAreas,
|
|
13
39
|
currentMatcher = _ref.currentMatcher,
|
|
14
40
|
rows = _ref.rows,
|
|
15
41
|
setSelectionAreas = _ref.setSelectionAreas,
|
|
16
42
|
columns = _ref.columns;
|
|
17
|
-
var activeKeyValues = activeKeys.current;
|
|
18
43
|
var selectionAreasClone = deepCloneObject(selectionAreas);
|
|
19
44
|
var indexOfCurrentArea = selectionAreasClone.findIndex(function (item) {
|
|
20
45
|
return item.matcher === currentMatcher;
|
|
21
46
|
});
|
|
22
47
|
var pointToUpdate = (_selectionAreasClone$ = selectionAreasClone[indexOfCurrentArea]) !== null && _selectionAreasClone$ !== void 0 && _selectionAreasClone$.point2 ? selectionAreasClone[indexOfCurrentArea].point2 : selectionAreasClone[indexOfCurrentArea].point1; // Down + Shift
|
|
23
48
|
|
|
24
|
-
if (
|
|
49
|
+
if (includesShift(keysPressedList) && keysPressedList.includes('ArrowDown') && keysPressedList.length === 2) {
|
|
25
50
|
if (rows.length - 1 === pointToUpdate.row) {
|
|
26
51
|
return;
|
|
27
52
|
}
|
|
@@ -36,7 +61,7 @@ export var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
|
|
36
61
|
} // Right + Shift
|
|
37
62
|
|
|
38
63
|
|
|
39
|
-
if (
|
|
64
|
+
if (includesShift(keysPressedList) && keysPressedList.includes('ArrowRight') && keysPressedList.length === 2) {
|
|
40
65
|
if (columns.length - 1 === pointToUpdate.column) {
|
|
41
66
|
return;
|
|
42
67
|
}
|
|
@@ -51,7 +76,7 @@ export var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
|
|
51
76
|
} // Up + Shift
|
|
52
77
|
|
|
53
78
|
|
|
54
|
-
if (
|
|
79
|
+
if (includesShift(keysPressedList) && keysPressedList.includes('ArrowUp') && keysPressedList.length === 2) {
|
|
55
80
|
if (pointToUpdate.row === 0) {
|
|
56
81
|
return;
|
|
57
82
|
}
|
|
@@ -66,7 +91,7 @@ export var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
|
|
66
91
|
} // Left + Shift
|
|
67
92
|
|
|
68
93
|
|
|
69
|
-
if (
|
|
94
|
+
if (includesShift(keysPressedList) && keysPressedList.includes('ArrowLeft') && keysPressedList.length === 2) {
|
|
70
95
|
if (pointToUpdate.column === 0) {
|
|
71
96
|
return;
|
|
72
97
|
}
|
|
@@ -78,5 +103,54 @@ export var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
|
|
78
103
|
selectionAreasClone[indexOfCurrentArea].point2 = _newPoint3;
|
|
79
104
|
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
|
80
105
|
setSelectionAreas(selectionAreasClone);
|
|
106
|
+
} // CMD + a (select all)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
if (includesMeta(keysPressedList) && keysPressedList.includes('KeyA')) {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
var selectionPoint1 = {
|
|
112
|
+
row: 0,
|
|
113
|
+
column: 0
|
|
114
|
+
};
|
|
115
|
+
var selectionPoint2 = {
|
|
116
|
+
row: rows.length - 1,
|
|
117
|
+
column: columns.length - 1
|
|
118
|
+
};
|
|
119
|
+
selectionAreasClone[indexOfCurrentArea].point1 = selectionPoint1;
|
|
120
|
+
selectionAreasClone[indexOfCurrentArea].point2 = selectionPoint2;
|
|
121
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
|
122
|
+
setSelectionAreas(selectionAreasClone);
|
|
123
|
+
} // CONTROL + SPACE (Select current column)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
if (includesControl(keysPressedList) && keysPressedList.includes('Space')) {
|
|
127
|
+
var _selectionPoint = {
|
|
128
|
+
row: 0,
|
|
129
|
+
column: activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column
|
|
130
|
+
};
|
|
131
|
+
var _selectionPoint2 = {
|
|
132
|
+
row: rows.length - 1,
|
|
133
|
+
column: activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column
|
|
134
|
+
};
|
|
135
|
+
selectionAreasClone[indexOfCurrentArea].point1 = _selectionPoint;
|
|
136
|
+
selectionAreasClone[indexOfCurrentArea].point2 = _selectionPoint2;
|
|
137
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
|
138
|
+
setSelectionAreas(selectionAreasClone);
|
|
139
|
+
} // Shift + SPACE (Select current row)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
if (includesShift(keysPressedList) && keysPressedList.includes('Space')) {
|
|
143
|
+
var _selectionPoint3 = {
|
|
144
|
+
row: activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row,
|
|
145
|
+
column: 0
|
|
146
|
+
};
|
|
147
|
+
var _selectionPoint4 = {
|
|
148
|
+
row: activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row,
|
|
149
|
+
column: columns.length - 1
|
|
150
|
+
};
|
|
151
|
+
selectionAreasClone[indexOfCurrentArea].point1 = _selectionPoint3;
|
|
152
|
+
selectionAreasClone[indexOfCurrentArea].point2 = _selectionPoint4;
|
|
153
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
|
154
|
+
setSelectionAreas(selectionAreasClone);
|
|
81
155
|
}
|
|
82
156
|
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["getTableProps", "withVirtualScroll", "DatagridPagination", "isFetching", "tableId", "CustomizeColumnsModal", "leftPanel", "fullHeightDatagrid", "verticalAlign", "variableRowHeight", "className"];
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Licensed Materials - Property of IBM
|
|
8
|
+
* 5724-Q36
|
|
9
|
+
* (c) Copyright IBM Corp. 2020 - 2021
|
|
10
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
11
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { DataTable } from 'carbon-components-react';
|
|
15
|
+
import cx from 'classnames';
|
|
16
|
+
import DatagridHead from './DatagridHead';
|
|
17
|
+
import DatagridBody from './DatagridBody';
|
|
18
|
+
import DatagridToolbar from './DatagridToolbar';
|
|
19
|
+
import { getDevtoolsProps } from '../../../global/js/utils/devtools';
|
|
20
|
+
import { pkg } from '../../../settings';
|
|
21
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
22
|
+
var componentName = 'Datagrid';
|
|
23
|
+
var TableContainer = DataTable.TableContainer,
|
|
24
|
+
Table = DataTable.Table;
|
|
25
|
+
var Datagrid = /*#__PURE__*/React.forwardRef(function (datagridState, ref) {
|
|
26
|
+
var _getTableProps;
|
|
27
|
+
|
|
28
|
+
var _datagridState$getTab = datagridState.getTableProps,
|
|
29
|
+
getTableProps = _datagridState$getTab === void 0 ? function () {} : _datagridState$getTab,
|
|
30
|
+
withVirtualScroll = datagridState.withVirtualScroll,
|
|
31
|
+
DatagridPagination = datagridState.DatagridPagination,
|
|
32
|
+
isFetching = datagridState.isFetching,
|
|
33
|
+
tableId = datagridState.tableId,
|
|
34
|
+
CustomizeColumnsModal = datagridState.CustomizeColumnsModal,
|
|
35
|
+
leftPanel = datagridState.leftPanel,
|
|
36
|
+
fullHeightDatagrid = datagridState.fullHeightDatagrid,
|
|
37
|
+
_datagridState$vertic = datagridState.verticalAlign,
|
|
38
|
+
verticalAlign = _datagridState$vertic === void 0 ? 'center' : _datagridState$vertic,
|
|
39
|
+
variableRowHeight = datagridState.variableRowHeight,
|
|
40
|
+
className = datagridState.className,
|
|
41
|
+
rest = _objectWithoutProperties(datagridState, _excluded);
|
|
42
|
+
|
|
43
|
+
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
|
44
|
+
var dataGrid = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableContainer, {
|
|
45
|
+
className: cx("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '')
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Table, _extends({}, getTableProps(), {
|
|
47
|
+
className: cx(DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className)
|
|
48
|
+
}), /*#__PURE__*/React.createElement(DatagridHead, datagridState), /*#__PURE__*/React.createElement(DatagridBody, _extends({}, datagridState, {
|
|
49
|
+
rows: rows
|
|
50
|
+
})))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/React.createElement(CustomizeColumnsModal, {
|
|
51
|
+
instance: datagridState
|
|
52
|
+
}));
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
54
|
+
id: tableId,
|
|
55
|
+
ref: ref,
|
|
56
|
+
className: cx(className, blockClass, withVirtualScroll ? "".concat(blockClass, "__datagridWrap") : "".concat(blockClass, "__datagridWrap-simple"))
|
|
57
|
+
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(DatagridToolbar, datagridState), leftPanel && /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "".concat(blockClass, "__grid-container ").concat(blockClass, "__displayFlex")
|
|
59
|
+
}, leftPanel && leftPanel.isOpen && /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: "".concat(blockClass, "__datagridLeftPanel")
|
|
61
|
+
}, leftPanel.panelContent), /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: "".concat(blockClass, "__datagridWithPanel")
|
|
63
|
+
}, dataGrid)), leftPanel === undefined && dataGrid);
|
|
64
|
+
}); // Return a placeholder if not released and not enabled by feature flag
|
|
65
|
+
|
|
66
|
+
Datagrid = pkg.checkComponentEnabled(Datagrid, componentName); // The display name of the component, used by React. Note that displayName
|
|
67
|
+
// is used in preference to relying on function.name.
|
|
68
|
+
|
|
69
|
+
Datagrid.displayName = componentName;
|
|
70
|
+
export default Datagrid;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed Materials - Property of IBM
|
|
3
|
+
* 5724-Q36
|
|
4
|
+
* (c) Copyright IBM Corp. 2021
|
|
5
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
6
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import DatagridEmptyBody from './DatagridEmptyBody';
|
|
10
|
+
import DatagridVirtualBody from './DatagridVirtualBody';
|
|
11
|
+
import DatagridSimpleBody from './DatagridSimpleBody';
|
|
12
|
+
import DatagridRefBody from './DatagridRefBody';
|
|
13
|
+
|
|
14
|
+
var DatagridBody = function DatagridBody(datagridState) {
|
|
15
|
+
var isFetching = datagridState.isFetching,
|
|
16
|
+
_datagridState$rows = datagridState.rows,
|
|
17
|
+
rows = _datagridState$rows === void 0 ? [] : _datagridState$rows,
|
|
18
|
+
withVirtualScroll = datagridState.withVirtualScroll,
|
|
19
|
+
withStickyColumn = datagridState.withStickyColumn;
|
|
20
|
+
|
|
21
|
+
if (!isFetching && rows.length === 0) {
|
|
22
|
+
return /*#__PURE__*/React.createElement(DatagridEmptyBody, datagridState);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (withVirtualScroll) {
|
|
26
|
+
return /*#__PURE__*/React.createElement(DatagridVirtualBody, datagridState);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (withStickyColumn) {
|
|
30
|
+
return /*#__PURE__*/React.createElement(DatagridRefBody, datagridState);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return /*#__PURE__*/React.createElement(DatagridSimpleBody, datagridState);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default DatagridBody;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed Materials - Property of IBM
|
|
3
|
+
* 5724-Q36
|
|
4
|
+
* (c) Copyright IBM Corp. 2020
|
|
5
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
6
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { pkg } from '../../../settings';
|
|
10
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
11
|
+
|
|
12
|
+
var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
|
|
13
|
+
var EmptyState = datagridState.EmptyState;
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: "".concat(blockClass, "__empty-state-body")
|
|
16
|
+
}, EmptyState);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default DatagridEmptyBody;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed Materials - Property of IBM
|
|
3
|
+
* 5724-Q36
|
|
4
|
+
* (c) Copyright IBM Corp. 2020
|
|
5
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
6
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { pkg } from '../../../settings';
|
|
10
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid"); // eslint-disable-next-line react/prop-types
|
|
11
|
+
|
|
12
|
+
var DatagridExpandedRow = function DatagridExpandedRow(PreviousRowRenderer, ExpandedRowContentComponent) {
|
|
13
|
+
return function (datagridState) {
|
|
14
|
+
var row = datagridState.row;
|
|
15
|
+
|
|
16
|
+
if (!row.isExpanded) {
|
|
17
|
+
return PreviousRowRenderer(datagridState);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "".concat(blockClass, "__expanded-row")
|
|
22
|
+
}, PreviousRowRenderer(datagridState), ExpandedRowContentComponent(datagridState));
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default DatagridExpandedRow;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Licensed Materials - Property of IBM
|
|
5
|
+
* 5724-Q36
|
|
6
|
+
* (c) Copyright IBM Corp. 2020, 2021
|
|
7
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
8
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { DataTable } from 'carbon-components-react';
|
|
12
|
+
var TableHead = DataTable.TableHead;
|
|
13
|
+
|
|
14
|
+
var DatagridHead = function DatagridHead(datagridState) {
|
|
15
|
+
var _datagridState$header = datagridState.headerGroups,
|
|
16
|
+
headerGroups = _datagridState$header === void 0 ? [] : _datagridState$header,
|
|
17
|
+
headRef = datagridState.headRef,
|
|
18
|
+
HeaderRow = datagridState.HeaderRow;
|
|
19
|
+
return /*#__PURE__*/React.createElement(TableHead, null, headerGroups.map(function (headerGroup, index) {
|
|
20
|
+
return (
|
|
21
|
+
/*#__PURE__*/
|
|
22
|
+
// doesn't support header grouping.
|
|
23
|
+
React.createElement("div", _extends({}, headerGroup.getHeaderGroupProps(), {
|
|
24
|
+
ref: headRef,
|
|
25
|
+
key: "header_".concat(index)
|
|
26
|
+
}), HeaderRow(datagridState))
|
|
27
|
+
);
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default DatagridHead;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Licensed Materials - Property of IBM
|
|
6
|
+
* 5724-Q36
|
|
7
|
+
* (c) Copyright IBM Corp. 2020, 2021
|
|
8
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
9
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
10
|
+
*/
|
|
11
|
+
// @flow
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import cx from 'classnames';
|
|
14
|
+
import { DataTable } from 'carbon-components-react';
|
|
15
|
+
import { selectionColumnId } from '../common-column-ids';
|
|
16
|
+
import { pkg } from '../../../settings';
|
|
17
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
18
|
+
|
|
19
|
+
var HeaderRow = function HeaderRow(datagridState) {
|
|
20
|
+
return /*#__PURE__*/React.createElement(TableRow, {
|
|
21
|
+
className: "".concat(blockClass, "__head")
|
|
22
|
+
}, datagridState.headers.filter(function (_ref) {
|
|
23
|
+
var isVisible = _ref.isVisible;
|
|
24
|
+
return isVisible;
|
|
25
|
+
}).map(function (header) {
|
|
26
|
+
var _cx;
|
|
27
|
+
|
|
28
|
+
if (header.id === selectionColumnId) {
|
|
29
|
+
// render directly without the wrapper TableHeader
|
|
30
|
+
return header.render('Header', {
|
|
31
|
+
key: header.id
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return /*#__PURE__*/React.createElement(TableHeader, _extends({}, header.getHeaderProps(), {
|
|
36
|
+
className: cx((_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__resizableColumn"), header.getResizerProps), _defineProperty(_cx, "".concat(blockClass, "__isResizing"), header.isResizing), _defineProperty(_cx, "".concat(blockClass, "__sortableColumn"), header.canSort), _defineProperty(_cx, "".concat(blockClass, "__isSorted"), header.isSorted), _cx), header.getHeaderProps().className),
|
|
37
|
+
key: header.id
|
|
38
|
+
}), header.render('Header'), header.getResizerProps && /*#__PURE__*/React.createElement("div", _extends({}, header.getResizerProps(), {
|
|
39
|
+
className: "".concat(blockClass, "__resizer")
|
|
40
|
+
})));
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var TableHeader = DataTable.TableHeader,
|
|
45
|
+
TableRow = DataTable.TableRow;
|
|
46
|
+
|
|
47
|
+
var useHeaderRow = function useHeaderRow(hooks) {
|
|
48
|
+
var useInstance = function useInstance(instance) {
|
|
49
|
+
Object.assign(instance, {
|
|
50
|
+
HeaderRow: HeaderRow
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
hooks.useInstance.push(useInstance);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default useHeaderRow;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
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; }
|
|
5
|
+
|
|
6
|
+
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) { _defineProperty(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; }
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Licensed Materials - Property of IBM
|
|
10
|
+
* 5724-Q36
|
|
11
|
+
* (c) Copyright IBM Corp. 2021
|
|
12
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
13
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
14
|
+
*/
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import cx from 'classnames';
|
|
17
|
+
import { pkg } from '../../../settings';
|
|
18
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid"); // TableBody from carbon is a functional component
|
|
19
|
+
// hence no way to pass the ref to html element without changes in carbon side
|
|
20
|
+
// define html directly here.
|
|
21
|
+
// ref should be passed in thru getTableBodyProps
|
|
22
|
+
|
|
23
|
+
var DatagridRefBody = function DatagridRefBody(datagridState) {
|
|
24
|
+
var getTableBodyProps = datagridState.getTableBodyProps,
|
|
25
|
+
rows = datagridState.rows,
|
|
26
|
+
prepareRow = datagridState.prepareRow;
|
|
27
|
+
return /*#__PURE__*/React.createElement("tbody", _extends({}, getTableBodyProps(), {
|
|
28
|
+
className: cx("".concat(blockClass, "__simple-body"), getTableBodyProps().className)
|
|
29
|
+
}), rows.map(function (row) {
|
|
30
|
+
prepareRow(row);
|
|
31
|
+
return row.RowRenderer(_objectSpread(_objectSpread({}, datagridState), {}, {
|
|
32
|
+
row: row
|
|
33
|
+
}));
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default DatagridRefBody;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children"];
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Licensed Materials - Property of IBM
|
|
7
|
+
* 5724-Q36
|
|
8
|
+
* (c) Copyright IBM Corp. 2020
|
|
9
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
10
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
11
|
+
*/
|
|
12
|
+
// @flow
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { DataTable, SkeletonText } from 'carbon-components-react';
|
|
15
|
+
import { selectionColumnId } from '../common-column-ids';
|
|
16
|
+
import { pkg } from '../../../settings';
|
|
17
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
18
|
+
var TableRow = DataTable.TableRow,
|
|
19
|
+
TableCell = DataTable.TableCell; // eslint-disable-next-line react/prop-types
|
|
20
|
+
|
|
21
|
+
var DatagridRow = function DatagridRow(datagridState) {
|
|
22
|
+
var row = datagridState.row;
|
|
23
|
+
return /*#__PURE__*/React.createElement(TableRow, _extends({
|
|
24
|
+
className: "".concat(blockClass, "__carbon-row")
|
|
25
|
+
}, row.getRowProps(), {
|
|
26
|
+
key: row.id
|
|
27
|
+
}), row.cells.map(function (cell) {
|
|
28
|
+
var cellProps = cell.getCellProps();
|
|
29
|
+
|
|
30
|
+
var children = cellProps.children,
|
|
31
|
+
restProps = _objectWithoutProperties(cellProps, _excluded);
|
|
32
|
+
|
|
33
|
+
var content = children || /*#__PURE__*/React.createElement(React.Fragment, null, !row.isSkeleton && cell.render('Cell'), row.isSkeleton && /*#__PURE__*/React.createElement(SkeletonText, null));
|
|
34
|
+
|
|
35
|
+
if (cell && cell.column && cell.column.id === selectionColumnId) {
|
|
36
|
+
// directly render component without the wrapping TableCell
|
|
37
|
+
return cell.render('Cell', {
|
|
38
|
+
key: cell.column.id
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return /*#__PURE__*/React.createElement(TableCell, _extends({
|
|
43
|
+
className: "".concat(blockClass, "__cell")
|
|
44
|
+
}, restProps, {
|
|
45
|
+
key: cell.column.id
|
|
46
|
+
}), content);
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default DatagridRow;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["onChange"];
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Licensed Materials - Property of IBM
|
|
7
|
+
* 5724-Q36
|
|
8
|
+
* (c) Copyright IBM Corp. 2020
|
|
9
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
10
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
11
|
+
*/
|
|
12
|
+
// @flow
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { DataTable } from 'carbon-components-react';
|
|
15
|
+
import { pkg } from '../../../settings';
|
|
16
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
17
|
+
|
|
18
|
+
var SelectAll = function SelectAll(datagridState) {
|
|
19
|
+
var isFetching = datagridState.isFetching,
|
|
20
|
+
getToggleAllRowsSelectedProps = datagridState.getToggleAllRowsSelectedProps,
|
|
21
|
+
getToggleAllPageRowsSelectedProps = datagridState.getToggleAllPageRowsSelectedProps,
|
|
22
|
+
tableId = datagridState.tableId,
|
|
23
|
+
hideSelectAll = datagridState.hideSelectAll,
|
|
24
|
+
DatagridPagination = datagridState.DatagridPagination,
|
|
25
|
+
radio = datagridState.radio;
|
|
26
|
+
|
|
27
|
+
if (hideSelectAll || radio) {
|
|
28
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "".concat(blockClass, "__head-hidden-select-all")
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var getProps = DatagridPagination ? getToggleAllPageRowsSelectedProps : getToggleAllRowsSelectedProps;
|
|
34
|
+
|
|
35
|
+
var _getProps = getProps(),
|
|
36
|
+
onChange = _getProps.onChange,
|
|
37
|
+
selectProps = _objectWithoutProperties(_getProps, _excluded);
|
|
38
|
+
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: "".concat(blockClass, "__head-select-all ").concat(blockClass, "__checkbox-cell")
|
|
41
|
+
}, /*#__PURE__*/React.createElement(TableSelectAll, _extends({}, selectProps, {
|
|
42
|
+
name: "".concat(tableId, "-select-all-checkbox-name"),
|
|
43
|
+
onSelect: onChange,
|
|
44
|
+
disabled: isFetching || selectProps.disabled,
|
|
45
|
+
id: "".concat(tableId, "-select-all-checkbox-id")
|
|
46
|
+
})));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var TableSelectAll = DataTable.TableSelectAll;
|
|
50
|
+
export { SelectAll };
|