@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
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
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 { useState } from 'react';
|
|
11
|
+
import { RowSizeDropdown } from './Datagrid/addons/RowSize';
|
|
12
|
+
|
|
13
|
+
var useRowSize = function useRowSize(hooks) {
|
|
14
|
+
var _useState = useState(''),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
internalRowSize = _useState2[0],
|
|
17
|
+
setRowSize = _useState2[1];
|
|
18
|
+
|
|
19
|
+
hooks.useInstance.push(function (instance) {
|
|
20
|
+
var rowSizes = instance.rowSizes,
|
|
21
|
+
rowSize = instance.rowSize,
|
|
22
|
+
onRowSizeChange = instance.onRowSizeChange;
|
|
23
|
+
Object.assign(instance, {
|
|
24
|
+
rowSize: internalRowSize || rowSize,
|
|
25
|
+
rowSizeDropdownProps: {
|
|
26
|
+
rowSizes: rowSizes,
|
|
27
|
+
selectedOption: internalRowSize || rowSize,
|
|
28
|
+
onChange: function onChange(value) {
|
|
29
|
+
setRowSize(value);
|
|
30
|
+
|
|
31
|
+
if (typeof onRowSizeChange === 'function') {
|
|
32
|
+
onRowSizeChange(value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
RowSizeDropdown: RowSizeDropdown
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
var getTableProps = function getTableProps(props, _ref) {
|
|
41
|
+
var instance = _ref.instance;
|
|
42
|
+
var rowSize = instance.rowSize;
|
|
43
|
+
|
|
44
|
+
if (!rowSize) {
|
|
45
|
+
return props;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return [props, {
|
|
49
|
+
size: rowSize
|
|
50
|
+
}];
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
hooks.getTableProps.push(getTableProps);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default useRowSize;
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
// @flow
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { selectionColumnId } from './common-column-ids';
|
|
11
|
+
import SelectAllWithToggle from './Datagrid/DatagridSelectAllWithToggle';
|
|
12
|
+
import { pkg } from '../../settings';
|
|
13
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
14
|
+
|
|
15
|
+
var useSelectAllToggle = function useSelectAllToggle(hooks) {
|
|
16
|
+
useSelectAllWithToggleComponent(hooks);
|
|
17
|
+
useAddClassNameToSelectRow(hooks);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
var useSelectAllWithToggleComponent = function useSelectAllWithToggleComponent(hooks) {
|
|
21
|
+
var useInstance = function useInstance(instance) {
|
|
22
|
+
var headers = instance.headers,
|
|
23
|
+
DatagridPagination = instance.DatagridPagination;
|
|
24
|
+
var headersWithSelectAllToggle = headers.map(function (header) {
|
|
25
|
+
if (header.id === selectionColumnId && DatagridPagination) {
|
|
26
|
+
Object.assign(header, {
|
|
27
|
+
Header: Header
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return header;
|
|
32
|
+
});
|
|
33
|
+
Object.assign(instance, {
|
|
34
|
+
headers: headersWithSelectAllToggle
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
hooks.useInstance.push(useInstance);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var useAddClassNameToSelectRow = function useAddClassNameToSelectRow(hooks) {
|
|
42
|
+
hooks.getCellProps.push(function (props, data) {
|
|
43
|
+
var column = data.cell.column;
|
|
44
|
+
var DatagridPagination = data.instance.DatagridPagination;
|
|
45
|
+
|
|
46
|
+
if (column.id === selectionColumnId && DatagridPagination) {
|
|
47
|
+
return [props, {
|
|
48
|
+
className: "".concat(blockClass, "__select-all-toggle-on")
|
|
49
|
+
}];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return [props];
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var Header = function Header(gridState) {
|
|
57
|
+
var tableId = gridState.tableId,
|
|
58
|
+
isFetching = gridState.isFetching,
|
|
59
|
+
selectAllToggle = gridState.selectAllToggle,
|
|
60
|
+
getToggleAllPageRowsSelectedProps = gridState.getToggleAllPageRowsSelectedProps,
|
|
61
|
+
getToggleAllRowsSelectedProps = gridState.getToggleAllRowsSelectedProps,
|
|
62
|
+
isAllRowsSelected = gridState.isAllRowsSelected;
|
|
63
|
+
var props = {
|
|
64
|
+
tableId: tableId,
|
|
65
|
+
isFetching: isFetching,
|
|
66
|
+
selectAllToggle: selectAllToggle,
|
|
67
|
+
getToggleAllPageRowsSelectedProps: getToggleAllPageRowsSelectedProps,
|
|
68
|
+
getToggleAllRowsSelectedProps: getToggleAllRowsSelectedProps,
|
|
69
|
+
isAllRowsSelected: isAllRowsSelected
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/React.createElement(SelectAllWithToggle, props);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default useSelectAllToggle;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
var _excluded = ["onChange"];
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* Licensed Materials - Property of IBM
|
|
13
|
+
* 5724-Q36
|
|
14
|
+
* (c) Copyright IBM Corp. 2020
|
|
15
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
16
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
17
|
+
*/
|
|
18
|
+
// @flow
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import cx from 'classnames';
|
|
21
|
+
import { TableSelectRow } from 'carbon-components-react';
|
|
22
|
+
import { SelectAll } from './Datagrid/DatagridSelectAll';
|
|
23
|
+
import { selectionColumnId } from './common-column-ids';
|
|
24
|
+
import { pkg } from '../../settings';
|
|
25
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
26
|
+
|
|
27
|
+
var useSelectRows = function useSelectRows(hooks) {
|
|
28
|
+
useHighlightSelection(hooks);
|
|
29
|
+
|
|
30
|
+
var useInstance = function useInstance(instance) {
|
|
31
|
+
var rows = instance.rows;
|
|
32
|
+
var rowsWithSelect = rows.map(function (row) {
|
|
33
|
+
return _objectSpread(_objectSpread({}, row), {}, {
|
|
34
|
+
isSelectable: true
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
Object.assign(instance, {
|
|
38
|
+
rows: rowsWithSelect
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
hooks.useInstance.push(useInstance);
|
|
43
|
+
hooks.visibleColumns.push(function (columns) {
|
|
44
|
+
return [{
|
|
45
|
+
id: selectionColumnId,
|
|
46
|
+
Header: function Header(gridState) {
|
|
47
|
+
return /*#__PURE__*/React.createElement(SelectAll, gridState);
|
|
48
|
+
},
|
|
49
|
+
Cell: function Cell(gridState) {
|
|
50
|
+
return /*#__PURE__*/React.createElement(SelectRow, gridState);
|
|
51
|
+
}
|
|
52
|
+
}].concat(_toConsumableArray(columns));
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var useHighlightSelection = function useHighlightSelection(hooks) {
|
|
57
|
+
var getRowProps = function getRowProps(props, _ref) {
|
|
58
|
+
var row = _ref.row;
|
|
59
|
+
return [props, {
|
|
60
|
+
className: cx("".concat(blockClass, "__carbon-row"), row.getToggleRowSelectedProps().checked ? 'bx--data-table--selected' : '')
|
|
61
|
+
}];
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
hooks.getRowProps.push(getRowProps);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
var SelectRow = function SelectRow(datagridState) {
|
|
68
|
+
var _datagridState$isFetc = datagridState.isFetching,
|
|
69
|
+
isFetching = _datagridState$isFetc === void 0 ? false : _datagridState$isFetc,
|
|
70
|
+
tableId = datagridState.tableId,
|
|
71
|
+
row = datagridState.row,
|
|
72
|
+
cell = datagridState.cell,
|
|
73
|
+
radio = datagridState.radio,
|
|
74
|
+
toggleAllRowsSelected = datagridState.toggleAllRowsSelected,
|
|
75
|
+
onRadioSelect = datagridState.onRadioSelect;
|
|
76
|
+
var selectDisabled = isFetching || row.getRowProps().selectDisabled;
|
|
77
|
+
|
|
78
|
+
var _row$getToggleRowSele = row.getToggleRowSelectedProps(),
|
|
79
|
+
onChange = _row$getToggleRowSele.onChange,
|
|
80
|
+
selectProps = _objectWithoutProperties(_row$getToggleRowSele, _excluded);
|
|
81
|
+
|
|
82
|
+
var cellProps = cell.getCellProps();
|
|
83
|
+
return /*#__PURE__*/React.createElement(TableSelectRow, _extends({}, cellProps, selectProps, {
|
|
84
|
+
radio: radio,
|
|
85
|
+
onSelect: function onSelect(e) {
|
|
86
|
+
e.stopPropagation(); // avoid triggering onRowClick
|
|
87
|
+
|
|
88
|
+
if (radio) {
|
|
89
|
+
toggleAllRowsSelected(false);
|
|
90
|
+
|
|
91
|
+
if (onRadioSelect) {
|
|
92
|
+
onRadioSelect(row);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
onChange(e);
|
|
97
|
+
},
|
|
98
|
+
id: "".concat(tableId, "-").concat(row.index),
|
|
99
|
+
name: "".concat(tableId, "-").concat(row.index, "-name"),
|
|
100
|
+
className: cx("".concat(blockClass, "__checkbox-cell"), cellProps.className),
|
|
101
|
+
ariaLabel: "".concat(tableId, "-row-").concat(row.index) // TODO: aria label should be i18n'ed
|
|
102
|
+
,
|
|
103
|
+
disabled: selectDisabled
|
|
104
|
+
}));
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default useSelectRows;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Licensed Materials - Property of IBM
|
|
5
|
+
* 5724-Q36
|
|
6
|
+
* (c) Copyright IBM Corp. 2020
|
|
7
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
8
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
9
|
+
*/
|
|
10
|
+
var useSkeletons = function useSkeletons(hooks) {
|
|
11
|
+
var useInstance = function useInstance(instance) {
|
|
12
|
+
var isFetching = instance.isFetching,
|
|
13
|
+
rows = instance.rows;
|
|
14
|
+
|
|
15
|
+
var skeletonRow = function skeletonRow(id) {
|
|
16
|
+
return {
|
|
17
|
+
isSkeleton: true,
|
|
18
|
+
values: 'skeleton',
|
|
19
|
+
id: id
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var rowsWithSkeletons = [].concat(_toConsumableArray(rows), [skeletonRow('skeleton-row-1'), skeletonRow('skeleton-row-2'), skeletonRow('skeleton-row-3')]);
|
|
24
|
+
Object.assign(instance, {
|
|
25
|
+
rows: isFetching ? rowsWithSkeletons : rows
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
hooks.useInstance.push(useInstance);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default useSkeletons;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
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. 2020
|
|
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 { Button } from 'carbon-components-react';
|
|
17
|
+
import { ArrowUp16, ArrowDown16, Arrows16 } from '@carbon/icons-react';
|
|
18
|
+
var ordering = {
|
|
19
|
+
ASC: 'ASC',
|
|
20
|
+
DESC: 'DESC',
|
|
21
|
+
NONE: 'NONE'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var useSortableColumns = function useSortableColumns(hooks) {
|
|
25
|
+
var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref) {
|
|
26
|
+
var instance = _ref.instance;
|
|
27
|
+
var onSort = instance.onSort;
|
|
28
|
+
|
|
29
|
+
var onSortClick = function onSortClick(column) {
|
|
30
|
+
var key = column.id;
|
|
31
|
+
var sortDesc = column.isSortedDesc;
|
|
32
|
+
|
|
33
|
+
var _getNewSortOrder = getNewSortOrder(sortDesc),
|
|
34
|
+
newSortDesc = _getNewSortOrder.newSortDesc,
|
|
35
|
+
newOrder = _getNewSortOrder.newOrder;
|
|
36
|
+
|
|
37
|
+
if (onSort) {
|
|
38
|
+
onSort(key, newOrder);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
instance.toggleSortBy(key, newSortDesc, false);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var sortableColumns = visibleColumns.map(function (column) {
|
|
45
|
+
var icon = function icon(col) {
|
|
46
|
+
if (col.isSorted) {
|
|
47
|
+
switch (col.isSortedDesc) {
|
|
48
|
+
case false:
|
|
49
|
+
return ArrowUp16;
|
|
50
|
+
|
|
51
|
+
case true:
|
|
52
|
+
return ArrowDown16;
|
|
53
|
+
|
|
54
|
+
default:
|
|
55
|
+
return Arrows16;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return Arrows16;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var Header = function Header(headerProp) {
|
|
63
|
+
return column.disableSortBy === true ? column.Header : /*#__PURE__*/React.createElement(Button, {
|
|
64
|
+
onClick: function onClick() {
|
|
65
|
+
return onSortClick(headerProp.column);
|
|
66
|
+
},
|
|
67
|
+
kind: "ghost",
|
|
68
|
+
renderIcon: icon(headerProp.column)
|
|
69
|
+
}, column.Header);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
|
73
|
+
Header: Header
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
return _toConsumableArray(sortableColumns);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
var sortInstanceProps = function sortInstanceProps(instance) {
|
|
80
|
+
var onSort = instance.onSort;
|
|
81
|
+
Object.assign(instance, {
|
|
82
|
+
manualSortBy: !!onSort,
|
|
83
|
+
isTableSortable: true
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
var getNewSortOrder = function getNewSortOrder(sortOrder) {
|
|
88
|
+
var order = {
|
|
89
|
+
newSortDesc: undefined,
|
|
90
|
+
newOrder: ordering.NONE
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
if (sortOrder === false) {
|
|
94
|
+
order.newOrder = ordering.DESC;
|
|
95
|
+
order.newSortDesc = true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (sortOrder === undefined) {
|
|
99
|
+
order.newOrder = ordering.ASC;
|
|
100
|
+
order.newSortDesc = false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return order;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
hooks.visibleColumns.push(sortableVisibleColumns);
|
|
107
|
+
hooks.useInstance.push(sortInstanceProps);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default useSortableColumns;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Licensed Materials - Property of IBM
|
|
9
|
+
* 5724-Q36
|
|
10
|
+
* (c) Copyright IBM Corp. 2021
|
|
11
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
12
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
13
|
+
*/
|
|
14
|
+
import { useEffect, useRef } from 'react';
|
|
15
|
+
import debounce from 'lodash/debounce';
|
|
16
|
+
import cx from 'classnames';
|
|
17
|
+
import { pkg } from '../../settings';
|
|
18
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
19
|
+
var styleClassPrefix = "".concat(blockClass, "__right-sticky-column");
|
|
20
|
+
var OFFSET_SCROLL_CLASS = "".concat(styleClassPrefix, "-offset-scroll");
|
|
21
|
+
|
|
22
|
+
var useStickyColumn = function useStickyColumn(hooks) {
|
|
23
|
+
var tableBodyRef = useRef();
|
|
24
|
+
var stickyHeaderCellRef = useRef();
|
|
25
|
+
hooks.getCellProps.push(changeProps.bind(null, 'cell', null));
|
|
26
|
+
hooks.getHeaderProps.push(changeProps.bind(null, 'header', stickyHeaderCellRef));
|
|
27
|
+
hooks.getTableBodyProps.push(addTableBodyProps.bind(null, tableBodyRef));
|
|
28
|
+
hooks.getHeaderGroupProps.push(function (props) {
|
|
29
|
+
return [props, {
|
|
30
|
+
style: _objectSpread(_objectSpread({}, props.style), {}, {
|
|
31
|
+
minWidth: 'unset' // unset the min-width calculated by sum of all column min-width
|
|
32
|
+
|
|
33
|
+
})
|
|
34
|
+
}];
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
var useEventListener = function useEventListener(instance) {
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
var tableBodyElement = tableBodyRef.current;
|
|
40
|
+
var headerCellElement = stickyHeaderCellRef.current;
|
|
41
|
+
|
|
42
|
+
if (hasVertScroll(tableBodyElement) && headerCellElement) {
|
|
43
|
+
headerCellElement.classList.add(OFFSET_SCROLL_CLASS);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var boundListener = debounce(onBodyResize.bind(null, tableBodyElement, headerCellElement), 250);
|
|
47
|
+
window.addEventListener('resize', boundListener);
|
|
48
|
+
return function () {
|
|
49
|
+
window.removeEventListener('resize', boundListener);
|
|
50
|
+
};
|
|
51
|
+
}, [instance.rows, instance.isFetching]);
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
var tableBodyElement = tableBodyRef.current;
|
|
54
|
+
var headerCellElement = stickyHeaderCellRef.current;
|
|
55
|
+
|
|
56
|
+
var listener = function listener(evt) {
|
|
57
|
+
toggleStickyShadow(evt.target, headerCellElement);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
toggleStickyShadow(tableBodyElement, headerCellElement);
|
|
61
|
+
|
|
62
|
+
if (tableBodyElement) {
|
|
63
|
+
tableBodyElement.addEventListener('scroll', listener);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return function () {
|
|
67
|
+
if (tableBodyElement) {
|
|
68
|
+
tableBodyElement.removeEventListener('scroll', listener);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}, [instance.rows, instance.isFetching]);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var useCheckScroll = function useCheckScroll(instance) {
|
|
75
|
+
var tableBodyElement = tableBodyRef.current;
|
|
76
|
+
var headerCellElement = stickyHeaderCellRef.current;
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
onBodyResize(tableBodyElement, headerCellElement);
|
|
79
|
+
}, [instance.rows, headerCellElement, tableBodyElement]);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
hooks.useInstance.push(useEventListener);
|
|
83
|
+
hooks.useInstance.push(useCheckScroll);
|
|
84
|
+
hooks.useInstance.push(function (instance) {
|
|
85
|
+
Object.assign(instance, {
|
|
86
|
+
withStickyColumn: true
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
hooks.useInstance.push(function (instance) {
|
|
90
|
+
// sticky column is defined by consumer
|
|
91
|
+
// it will always comes after the spacer which is defined by useFlexResize
|
|
92
|
+
// swap them here to use the spacer to push
|
|
93
|
+
// sticky column to the right when there are few
|
|
94
|
+
// columns defined
|
|
95
|
+
var newColumns = instance.visibleColumns;
|
|
96
|
+
var spacerIdx = newColumns.findIndex(function (col) {
|
|
97
|
+
return col.id === 'spacer';
|
|
98
|
+
});
|
|
99
|
+
var stickyIdx = newColumns.findIndex(function (col) {
|
|
100
|
+
return col.sticky === 'right';
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (spacerIdx >= 0 && stickyIdx >= 0 && stickyIdx < spacerIdx) {
|
|
104
|
+
var temp = newColumns[spacerIdx];
|
|
105
|
+
newColumns[spacerIdx] = newColumns[stickyIdx];
|
|
106
|
+
newColumns[stickyIdx] = temp;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
var newHeaders = instance.headers;
|
|
110
|
+
spacerIdx = newHeaders.findIndex(function (col) {
|
|
111
|
+
return col.id === 'spacer';
|
|
112
|
+
});
|
|
113
|
+
stickyIdx = newHeaders.findIndex(function (col) {
|
|
114
|
+
return col.sticky === 'right';
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
if (spacerIdx >= 0 && stickyIdx >= 0 && stickyIdx < spacerIdx) {
|
|
118
|
+
var _temp = newHeaders[spacerIdx];
|
|
119
|
+
newHeaders[spacerIdx] = newHeaders[stickyIdx];
|
|
120
|
+
newHeaders[stickyIdx] = _temp;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
var addTableBodyProps = function addTableBodyProps(tableBodyRef, props) {
|
|
126
|
+
return [props, {
|
|
127
|
+
ref: tableBodyRef
|
|
128
|
+
}];
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
var changeProps = function changeProps(elementName, headerCellRef, props, data) {
|
|
132
|
+
var column = data.column || data.cell.column;
|
|
133
|
+
|
|
134
|
+
if (column.sticky === 'right') {
|
|
135
|
+
var _cx;
|
|
136
|
+
|
|
137
|
+
return [props, _objectSpread({
|
|
138
|
+
className: cx((_cx = {}, _defineProperty(_cx, "".concat(styleClassPrefix, "-").concat(elementName), true), _defineProperty(_cx, "".concat(blockClass, "__resizableColumn"), false), _defineProperty(_cx, "".concat(blockClass, "__sortableColumn"), false), _cx))
|
|
139
|
+
}, headerCellRef && {
|
|
140
|
+
ref: headerCellRef
|
|
141
|
+
})];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return [props];
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
var onBodyResize = function onBodyResize(tableBodyEle, headerCellEle) {
|
|
148
|
+
if (headerCellEle) {
|
|
149
|
+
if (hasVertScroll(tableBodyEle)) {
|
|
150
|
+
headerCellEle.classList.add(OFFSET_SCROLL_CLASS);
|
|
151
|
+
} else {
|
|
152
|
+
headerCellEle.classList.remove(OFFSET_SCROLL_CLASS);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
toggleStickyShadow(tableBodyEle, headerCellEle);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var toggleStickyShadow = function toggleStickyShadow(tableBodyEle, headerCellEle) {
|
|
160
|
+
if (tableBodyEle && headerCellEle) {
|
|
161
|
+
var isScrolledToRight = tableBodyEle.scrollLeft + tableBodyEle.clientWidth === tableBodyEle.scrollWidth;
|
|
162
|
+
|
|
163
|
+
if (isScrolledToRight) {
|
|
164
|
+
headerCellEle.classList.add("".concat(blockClass, "__sticky-noShadow"));
|
|
165
|
+
tableBodyEle.classList.add("".concat(blockClass, "__sticky-column-noShadow"));
|
|
166
|
+
} else {
|
|
167
|
+
headerCellEle.classList.remove("".concat(blockClass, "__sticky-noShadow"));
|
|
168
|
+
tableBodyEle.classList.remove("".concat(blockClass, "__sticky-column-noShadow"));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
var hasVertScroll = function hasVertScroll(element) {
|
|
174
|
+
if (!element) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
var scrollHeight = element.scrollHeight,
|
|
179
|
+
clientHeight = element.clientHeight;
|
|
180
|
+
return scrollHeight > clientHeight;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export default useStickyColumn;
|
|
@@ -13,10 +13,9 @@ export var HTTPErrorSvg403 = function HTTPErrorSvg403(_ref) {
|
|
|
13
13
|
return /*#__PURE__*/React.createElement("svg", {
|
|
14
14
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15
15
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
16
|
-
width: 1584,
|
|
17
|
-
height: 916,
|
|
18
16
|
viewBox: "0 0 1584 916",
|
|
19
|
-
className: className
|
|
17
|
+
className: className,
|
|
18
|
+
preserveAspectRatio: "xMinYMax meet"
|
|
20
19
|
}, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
21
20
|
id: "prefix__clip-path"
|
|
22
21
|
}, /*#__PURE__*/React.createElement("path", {
|
|
@@ -13,10 +13,9 @@ export var HTTPErrorSvg404 = function HTTPErrorSvg404(_ref) {
|
|
|
13
13
|
return /*#__PURE__*/React.createElement("svg", {
|
|
14
14
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15
15
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
16
|
-
width: 1584,
|
|
17
|
-
height: 916,
|
|
18
16
|
viewBox: "0 0 1584 916",
|
|
19
|
-
className: className
|
|
17
|
+
className: className,
|
|
18
|
+
preserveAspectRatio: "xMinYMax meet"
|
|
20
19
|
}, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
21
20
|
id: "prefix__clip-path"
|
|
22
21
|
}, /*#__PURE__*/React.createElement("path", {
|
|
@@ -13,10 +13,9 @@ export var HTTPErrorSvgOther = function HTTPErrorSvgOther(_ref) {
|
|
|
13
13
|
return /*#__PURE__*/React.createElement("svg", {
|
|
14
14
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15
15
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
16
|
-
width: 1584,
|
|
17
|
-
height: 916,
|
|
18
16
|
viewBox: "0 0 1584 916",
|
|
19
|
-
className: className
|
|
17
|
+
className: className,
|
|
18
|
+
preserveAspectRatio: "xMinYMax meet"
|
|
20
19
|
}, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
21
20
|
id: "prefix__clip-path"
|
|
22
21
|
}, /*#__PURE__*/React.createElement("path", {
|
|
@@ -23,7 +23,7 @@ import cx from 'classnames';
|
|
|
23
23
|
import PropTypes from 'prop-types';
|
|
24
24
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
|
25
25
|
import uuidv4 from '../../global/js/utils/uuidv4';
|
|
26
|
-
import { pkg } from '../../settings';
|
|
26
|
+
import { pkg, carbon } from '../../settings';
|
|
27
27
|
var componentName = 'ImportModal'; // Default values for props
|
|
28
28
|
|
|
29
29
|
var defaults = {
|
|
@@ -254,7 +254,7 @@ export var ImportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
254
254
|
size: "sm",
|
|
255
255
|
disabled: importButtonDisabled
|
|
256
256
|
}, inputButtonText)), /*#__PURE__*/React.createElement("div", {
|
|
257
|
-
className: "
|
|
257
|
+
className: "".concat(carbon.prefix, "--file-container ").concat(blockClass, "__file-container")
|
|
258
258
|
}, hasFiles && /*#__PURE__*/React.createElement("p", {
|
|
259
259
|
className: "".concat(blockClass, "__helper-text")
|
|
260
260
|
}, fileStatusString), files.map(function (file) {
|
|
@@ -33,15 +33,14 @@ var allTagsModalSearchThreshold = 10; // Default values for props
|
|
|
33
33
|
|
|
34
34
|
var defaults = {
|
|
35
35
|
align: 'start',
|
|
36
|
-
allTagsModalTarget: document.body,
|
|
36
|
+
// allTagsModalTarget: document.body,
|
|
37
37
|
overflowAlign: 'center',
|
|
38
38
|
overflowDirection: 'bottom'
|
|
39
39
|
};
|
|
40
40
|
export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
41
41
|
var _ref$align = _ref.align,
|
|
42
42
|
align = _ref$align === void 0 ? defaults.align : _ref$align,
|
|
43
|
-
|
|
44
|
-
allTagsModalTarget = _ref$allTagsModalTarg === void 0 ? defaults.allTagsModalTarget : _ref$allTagsModalTarg,
|
|
43
|
+
allTagsModalTargetIn = _ref.allTagsModalTarget,
|
|
45
44
|
className = _ref.className,
|
|
46
45
|
maxVisible = _ref.maxVisible,
|
|
47
46
|
_ref$overflowAlign = _ref.overflowAlign,
|
|
@@ -88,10 +87,20 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
88
87
|
|
|
89
88
|
var overflowTag = useRef(null);
|
|
90
89
|
|
|
90
|
+
var _useState11 = useState(null),
|
|
91
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
92
|
+
allTagsModalTarget = _useState12[0],
|
|
93
|
+
setAllTagsModalTarget = _useState12[1];
|
|
94
|
+
|
|
91
95
|
var handleShowAllClick = function handleShowAllClick() {
|
|
92
96
|
setShowAllModalOpen(true);
|
|
93
97
|
};
|
|
94
98
|
|
|
99
|
+
useEffect(function () {
|
|
100
|
+
var _document;
|
|
101
|
+
|
|
102
|
+
setAllTagsModalTarget(allTagsModalTargetIn !== null && allTagsModalTargetIn !== void 0 ? allTagsModalTargetIn : (_document = document) === null || _document === void 0 ? void 0 : _document.body);
|
|
103
|
+
}, [allTagsModalTargetIn]);
|
|
95
104
|
useEffect(function () {
|
|
96
105
|
var newSizingTags = []; // create sizing tags
|
|
97
106
|
|