@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
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["className", "columnInputPlaceholder", "description", "influencerTitle", "inputPlaceholder", "items", "itemsLabel", "multi", "noResultsDescription", "noResultsTitle", "noSelectionDescription", "noSelectionTitle", "onClose", "onCloseButtonText", "onSearchFilter", "onSubmit", "onSubmitButtonText", "open", "removeIconDescription", "textInputLabel", "title"];
|
|
5
|
+
var _excluded = ["className", "columnInputPlaceholder", "description", "globalFilters", "globalFiltersIconDescription", "globalFiltersPlaceholderText", "globalFiltersPrimaryButtonText", "globalFiltersSecondaryButtonText", "influencerTitle", "inputPlaceholder", "items", "itemsLabel", "multi", "noResultsDescription", "noResultsTitle", "noSelectionDescription", "noSelectionTitle", "onClose", "onCloseButtonText", "onSearchFilter", "onSubmit", "onSubmitButtonText", "open", "removeIconDescription", "searchResultsLabel", "textInputLabel", "title"];
|
|
6
6
|
//
|
|
7
7
|
// Copyright IBM Corp. 2022
|
|
8
8
|
//
|
|
@@ -12,7 +12,7 @@ var _excluded = ["className", "columnInputPlaceholder", "description", "influenc
|
|
|
12
12
|
import React, { forwardRef, useState, useEffect } from 'react';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
14
|
import cx from 'classnames';
|
|
15
|
-
import {
|
|
15
|
+
import { Tag } from 'carbon-components-react';
|
|
16
16
|
import { Tearsheet, TearsheetNarrow } from '../../components/Tearsheet';
|
|
17
17
|
import { NoDataEmptyState } from '../../components/EmptyStates/NoDataEmptyState';
|
|
18
18
|
import { pkg } from '../../settings';
|
|
@@ -20,7 +20,8 @@ import { AddSelectSidebar } from './AddSelectSidebar';
|
|
|
20
20
|
import { AddSelectBreadcrumbs } from './AddSelectBreadcrumbs';
|
|
21
21
|
import { AddSelectList } from './AddSelectList';
|
|
22
22
|
import { AddSelectColumn } from './AddSelectColumn';
|
|
23
|
-
import { normalize, flatten } from './add-select-utils';
|
|
23
|
+
import { normalize, flatten, getGlobalFilterValues } from './add-select-utils';
|
|
24
|
+
import { AddSelectFilter } from './AddSelectFilter';
|
|
24
25
|
var componentName = 'AddSelect';
|
|
25
26
|
export var AddSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
26
27
|
var _cx;
|
|
@@ -28,6 +29,11 @@ export var AddSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
28
29
|
var className = _ref.className,
|
|
29
30
|
columnInputPlaceholder = _ref.columnInputPlaceholder,
|
|
30
31
|
description = _ref.description,
|
|
32
|
+
globalFilters = _ref.globalFilters,
|
|
33
|
+
globalFiltersIconDescription = _ref.globalFiltersIconDescription,
|
|
34
|
+
globalFiltersPlaceholderText = _ref.globalFiltersPlaceholderText,
|
|
35
|
+
globalFiltersPrimaryButtonText = _ref.globalFiltersPrimaryButtonText,
|
|
36
|
+
globalFiltersSecondaryButtonText = _ref.globalFiltersSecondaryButtonText,
|
|
31
37
|
influencerTitle = _ref.influencerTitle,
|
|
32
38
|
inputPlaceholder = _ref.inputPlaceholder,
|
|
33
39
|
items = _ref.items,
|
|
@@ -44,6 +50,7 @@ export var AddSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
44
50
|
onSubmitButtonText = _ref.onSubmitButtonText,
|
|
45
51
|
open = _ref.open,
|
|
46
52
|
removeIconDescription = _ref.removeIconDescription,
|
|
53
|
+
searchResultsLabel = _ref.searchResultsLabel,
|
|
47
54
|
textInputLabel = _ref.textInputLabel,
|
|
48
55
|
title = _ref.title,
|
|
49
56
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -82,21 +89,42 @@ export var AddSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
82
89
|
|
|
83
90
|
var _useState13 = useState([]),
|
|
84
91
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
85
|
-
|
|
86
|
-
|
|
92
|
+
flatItems = _useState14[0],
|
|
93
|
+
setFlatItems = _useState14[1];
|
|
94
|
+
|
|
95
|
+
var _useState15 = useState([]),
|
|
96
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
97
|
+
globalFilterOpts = _useState16[0],
|
|
98
|
+
setGlobalFilterOpts = _useState16[1];
|
|
99
|
+
|
|
100
|
+
var _useState17 = useState({}),
|
|
101
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
102
|
+
appliedGlobalFilters = _useState18[0],
|
|
103
|
+
setAppliedGlobalFilters = _useState18[1];
|
|
87
104
|
|
|
88
105
|
useEffect(function () {
|
|
89
|
-
var entries = items.entries;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
106
|
+
var entries = items.entries; // flatItems is just a single array of all entries including children
|
|
107
|
+
|
|
108
|
+
var flattenedItems = flatten(entries);
|
|
109
|
+
|
|
110
|
+
if (multi) {
|
|
111
|
+
if (globalFilters !== null && globalFilters !== void 0 && globalFilters.length) {
|
|
112
|
+
var globalFilterValues = getGlobalFilterValues(globalFilters, flattenedItems);
|
|
113
|
+
setGlobalFilterOpts(globalFilterValues);
|
|
114
|
+
} // multi select with nested data needs to be normalized
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
if (entries.find(function (entry) {
|
|
118
|
+
return entry.children;
|
|
119
|
+
})) {
|
|
120
|
+
var newItems = normalize(items);
|
|
121
|
+
setNormalizedItems(newItems);
|
|
122
|
+
setUsedNormalizedItems(true);
|
|
123
|
+
}
|
|
98
124
|
}
|
|
99
|
-
|
|
125
|
+
|
|
126
|
+
setFlatItems(flattenedItems);
|
|
127
|
+
}, [items, multi, globalFilters]); // used to generate columns of results for multi select with hierarchy
|
|
100
128
|
|
|
101
129
|
var getPages = function getPages() {
|
|
102
130
|
var pages = [];
|
|
@@ -166,10 +194,32 @@ export var AddSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
166
194
|
return item.title.toLowerCase().includes(searchTerm);
|
|
167
195
|
});
|
|
168
196
|
return results;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
var getDisplayItems = function getDisplayItems() {
|
|
200
|
+
if (useNormalizedItems) {
|
|
201
|
+
// when global search or filter is in use the results are not in column format
|
|
202
|
+
var filters = Object.keys(appliedGlobalFilters);
|
|
203
|
+
|
|
204
|
+
if (searchTerm || filters.length) {
|
|
205
|
+
var results = flatItems.filter(function (item) {
|
|
206
|
+
return item.title.toLowerCase().includes(searchTerm);
|
|
207
|
+
}).filter(function (item) {
|
|
208
|
+
return filters.every(function (filter) {
|
|
209
|
+
return item[filter] === appliedGlobalFilters[filter];
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
return results;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return getPages();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return getFilteredItems();
|
|
169
219
|
}; // only multi select with hierarchy requires the the normalized items
|
|
170
220
|
|
|
171
221
|
|
|
172
|
-
var itemsToDisplay =
|
|
222
|
+
var itemsToDisplay = getDisplayItems();
|
|
173
223
|
var commonListProps = {
|
|
174
224
|
multi: multi,
|
|
175
225
|
multiSelection: multiSelection,
|
|
@@ -180,8 +230,12 @@ export var AddSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
180
230
|
singleSelection: singleSelection
|
|
181
231
|
}; // handlers
|
|
182
232
|
|
|
183
|
-
var handleSearch = function handleSearch(
|
|
184
|
-
setSearchTerm(
|
|
233
|
+
var handleSearch = function handleSearch(term) {
|
|
234
|
+
setSearchTerm(term);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
var handleFilter = function handleFilter(filters) {
|
|
238
|
+
setAppliedGlobalFilters(filters);
|
|
185
239
|
};
|
|
186
240
|
|
|
187
241
|
var submitHandler = function submitHandler() {
|
|
@@ -206,35 +260,69 @@ export var AddSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
206
260
|
};
|
|
207
261
|
var sidebarProps = {
|
|
208
262
|
influencerTitle: influencerTitle,
|
|
209
|
-
items:
|
|
263
|
+
items: flatItems,
|
|
210
264
|
multiSelection: multiSelection,
|
|
211
265
|
noSelectionDescription: noSelectionDescription,
|
|
212
266
|
noSelectionTitle: noSelectionTitle,
|
|
213
267
|
removeIconDescription: removeIconDescription,
|
|
214
268
|
setMultiSelection: setMultiSelection
|
|
215
269
|
};
|
|
216
|
-
var classNames = cx(className, blockClass, (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__single"), !multi), _defineProperty(_cx, "".concat(blockClass, "__multi"), multi), _cx));
|
|
270
|
+
var classNames = cx(className, blockClass, (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__single"), !multi), _defineProperty(_cx, "".concat(blockClass, "__multi"), multi), _cx));
|
|
271
|
+
|
|
272
|
+
var setShowBreadsCrumbs = function setShowBreadsCrumbs() {
|
|
273
|
+
if (searchTerm) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (path.length) {
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return false;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
var setShowTags = function setShowTags() {
|
|
285
|
+
if (searchTerm) {
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (useNormalizedItems) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return true;
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
var showBreadsCrumbs = setShowBreadsCrumbs();
|
|
297
|
+
var showTags = setShowTags();
|
|
298
|
+
var globalFiltersApplied = Object.keys(appliedGlobalFilters).length > 0; // main content
|
|
217
299
|
|
|
218
300
|
var body = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
219
301
|
className: "".concat(blockClass, "__header")
|
|
220
|
-
}, /*#__PURE__*/React.createElement(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
302
|
+
}, /*#__PURE__*/React.createElement(AddSelectFilter, {
|
|
303
|
+
textInputLabel: textInputLabel,
|
|
304
|
+
inputPlaceholder: inputPlaceholder,
|
|
305
|
+
searchTerm: searchTerm,
|
|
306
|
+
handleSearch: handleSearch,
|
|
307
|
+
multi: multi,
|
|
308
|
+
filterOpts: globalFilterOpts,
|
|
309
|
+
handleFilter: handleFilter,
|
|
310
|
+
primaryButtonText: globalFiltersPrimaryButtonText,
|
|
311
|
+
secondaryButtonText: globalFiltersSecondaryButtonText,
|
|
312
|
+
placeholder: globalFiltersPlaceholderText,
|
|
313
|
+
iconDescription: globalFiltersIconDescription
|
|
226
314
|
}), /*#__PURE__*/React.createElement("div", {
|
|
227
315
|
className: "".concat(blockClass, "__tag-container")
|
|
228
|
-
},
|
|
316
|
+
}, showBreadsCrumbs ? /*#__PURE__*/React.createElement(AddSelectBreadcrumbs, {
|
|
229
317
|
itemsLabel: itemsLabel,
|
|
230
318
|
path: path,
|
|
231
319
|
setPath: setPath
|
|
232
320
|
}) : /*#__PURE__*/React.createElement("p", {
|
|
233
321
|
className: "".concat(blockClass, "__tag-container-label")
|
|
234
|
-
}, itemsLabel),
|
|
322
|
+
}, searchTerm ? searchResultsLabel : itemsLabel), showTags && /*#__PURE__*/React.createElement(Tag, {
|
|
235
323
|
type: "gray",
|
|
236
324
|
size: "sm"
|
|
237
|
-
}, itemsToDisplay.length))), useNormalizedItems ? /*#__PURE__*/React.createElement("div", {
|
|
325
|
+
}, itemsToDisplay.length))), useNormalizedItems && !searchTerm && !globalFiltersApplied ? /*#__PURE__*/React.createElement("div", {
|
|
238
326
|
className: "".concat(blockClass, "__columns")
|
|
239
327
|
}, itemsToDisplay.map(function (page, idx) {
|
|
240
328
|
var _path;
|
|
@@ -246,7 +334,8 @@ export var AddSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
246
334
|
columnInputPlaceholder: columnInputPlaceholder
|
|
247
335
|
}));
|
|
248
336
|
})) : /*#__PURE__*/React.createElement("div", null, itemsToDisplay.length > 0 ? /*#__PURE__*/React.createElement(AddSelectList, _extends({}, commonListProps, {
|
|
249
|
-
filteredItems: itemsToDisplay
|
|
337
|
+
filteredItems: itemsToDisplay,
|
|
338
|
+
modifiers: items === null || items === void 0 ? void 0 : items.modifiers
|
|
250
339
|
})) : /*#__PURE__*/React.createElement("div", {
|
|
251
340
|
className: "".concat(blockClass, "__body")
|
|
252
341
|
}, /*#__PURE__*/React.createElement(NoDataEmptyState, {
|
|
@@ -265,9 +354,22 @@ AddSelect.propTypes = {
|
|
|
265
354
|
className: PropTypes.string,
|
|
266
355
|
columnInputPlaceholder: PropTypes.string,
|
|
267
356
|
description: PropTypes.string,
|
|
357
|
+
globalFilters: PropTypes.arrayOf(PropTypes.shape({
|
|
358
|
+
id: PropTypes.string,
|
|
359
|
+
label: PropTypes.string
|
|
360
|
+
})),
|
|
361
|
+
globalFiltersIconDescription: PropTypes.string,
|
|
362
|
+
globalFiltersPlaceholderText: PropTypes.string,
|
|
363
|
+
globalFiltersPrimaryButtonText: PropTypes.string,
|
|
364
|
+
globalFiltersSecondaryButtonText: PropTypes.string,
|
|
268
365
|
influencerTitle: PropTypes.string,
|
|
269
366
|
inputPlaceholder: PropTypes.string,
|
|
270
367
|
items: PropTypes.shape({
|
|
368
|
+
modifiers: PropTypes.shape({
|
|
369
|
+
label: PropTypes.string,
|
|
370
|
+
options: PropTypes.array,
|
|
371
|
+
property: PropTypes.string
|
|
372
|
+
}),
|
|
271
373
|
sortBy: PropTypes.array,
|
|
272
374
|
filterBy: PropTypes.array,
|
|
273
375
|
entries: PropTypes.arrayOf(PropTypes.shape({
|
|
@@ -290,6 +392,7 @@ AddSelect.propTypes = {
|
|
|
290
392
|
onSubmitButtonText: PropTypes.string,
|
|
291
393
|
open: PropTypes.bool,
|
|
292
394
|
removeIconDescription: PropTypes.string,
|
|
395
|
+
searchResultsLabel: PropTypes.string,
|
|
293
396
|
textInputLabel: PropTypes.string,
|
|
294
397
|
title: PropTypes.string
|
|
295
398
|
};
|
|
@@ -216,7 +216,6 @@ export var AddSelectColumn = function AddSelectColumn(_ref) {
|
|
|
216
216
|
size: "sm"
|
|
217
217
|
}, colItems.length))
|
|
218
218
|
})), /*#__PURE__*/React.createElement(AddSelectList, _extends({}, props, {
|
|
219
|
-
inColumn: true,
|
|
220
219
|
filteredItems: colItems,
|
|
221
220
|
setMultiSelection: setMultiSelection,
|
|
222
221
|
multiSelection: multiSelection
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
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
|
+
// Copyright IBM Corp. 2022
|
|
10
|
+
//
|
|
11
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
|
12
|
+
// LICENSE file in the root directory of this source tree.
|
|
13
|
+
//
|
|
14
|
+
import React, { useState } from 'react';
|
|
15
|
+
import { Button, ButtonSet, Dropdown, TextInput } from 'carbon-components-react';
|
|
16
|
+
import PropTypes from 'prop-types';
|
|
17
|
+
import { Filter16 } from '@carbon/icons-react';
|
|
18
|
+
import { pkg } from '../../settings';
|
|
19
|
+
var componentName = 'AddSelectFilter';
|
|
20
|
+
export var AddSelectFilter = function AddSelectFilter(_ref) {
|
|
21
|
+
var filterOpts = _ref.filterOpts,
|
|
22
|
+
handleFilter = _ref.handleFilter,
|
|
23
|
+
handleSearch = _ref.handleSearch,
|
|
24
|
+
iconDescription = _ref.iconDescription,
|
|
25
|
+
inputPlaceholder = _ref.inputPlaceholder,
|
|
26
|
+
multi = _ref.multi,
|
|
27
|
+
placeholder = _ref.placeholder,
|
|
28
|
+
primaryButtonText = _ref.primaryButtonText,
|
|
29
|
+
searchTerm = _ref.searchTerm,
|
|
30
|
+
secondaryButtonText = _ref.secondaryButtonText,
|
|
31
|
+
textInputLabel = _ref.textInputLabel;
|
|
32
|
+
|
|
33
|
+
var _useState = useState({}),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
filters = _useState2[0],
|
|
36
|
+
setFilters = _useState2[1];
|
|
37
|
+
|
|
38
|
+
var _useState3 = useState(false),
|
|
39
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
+
open = _useState4[0],
|
|
41
|
+
setOpen = _useState4[1];
|
|
42
|
+
|
|
43
|
+
var blockClass = "".concat(pkg.prefix, "--add-select__global-filter");
|
|
44
|
+
|
|
45
|
+
var searchHandler = function searchHandler(e) {
|
|
46
|
+
handleSearch(e.target.value);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var onchangeHandler = function onchangeHandler(_ref2, id) {
|
|
50
|
+
var selectedItem = _ref2.selectedItem;
|
|
51
|
+
setFilters(_objectSpread(_objectSpread({}, filters), {}, _defineProperty({}, id, selectedItem)));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var applyFilters = function applyFilters() {
|
|
55
|
+
handleFilter(filters);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var resetFilters = function resetFilters() {
|
|
59
|
+
setFilters({});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var getSelectedItem = function getSelectedItem(id) {
|
|
63
|
+
return filters[id] || '';
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var showFilter = multi && (filterOpts === null || filterOpts === void 0 ? void 0 : filterOpts.length) > 0;
|
|
67
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "".concat(blockClass, "-search")
|
|
69
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
70
|
+
id: "temp-id",
|
|
71
|
+
labelText: textInputLabel,
|
|
72
|
+
placeholder: inputPlaceholder,
|
|
73
|
+
value: searchTerm,
|
|
74
|
+
onChange: searchHandler
|
|
75
|
+
}), showFilter && /*#__PURE__*/React.createElement(Button, {
|
|
76
|
+
renderIcon: Filter16,
|
|
77
|
+
hasIconOnly: true,
|
|
78
|
+
kind: "ghost",
|
|
79
|
+
onClick: function onClick() {
|
|
80
|
+
return setOpen(!open);
|
|
81
|
+
},
|
|
82
|
+
iconDescription: iconDescription,
|
|
83
|
+
className: "".concat(blockClass, "-toggle"),
|
|
84
|
+
size: "md"
|
|
85
|
+
}), open && /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: "".concat(blockClass)
|
|
87
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "".concat(blockClass, "-content")
|
|
89
|
+
}, /*#__PURE__*/React.createElement("p", null, "Filters"), /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "".concat(blockClass, "-opts")
|
|
91
|
+
}, filterOpts.map(function (filterOpts) {
|
|
92
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
93
|
+
id: filterOpts.id,
|
|
94
|
+
key: filterOpts.id,
|
|
95
|
+
titleText: filterOpts.label,
|
|
96
|
+
items: filterOpts.opts,
|
|
97
|
+
light: true,
|
|
98
|
+
onChange: function onChange(value) {
|
|
99
|
+
return onchangeHandler(value, filterOpts.id);
|
|
100
|
+
},
|
|
101
|
+
selectedItem: getSelectedItem(filterOpts.id),
|
|
102
|
+
label: placeholder
|
|
103
|
+
});
|
|
104
|
+
}))), /*#__PURE__*/React.createElement(ButtonSet, {
|
|
105
|
+
className: "".concat(blockClass, "-button-set")
|
|
106
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
107
|
+
kind: "secondary",
|
|
108
|
+
onClick: resetFilters,
|
|
109
|
+
className: "".concat(blockClass, "-button")
|
|
110
|
+
}, secondaryButtonText), /*#__PURE__*/React.createElement(Button, {
|
|
111
|
+
kind: "primary",
|
|
112
|
+
onClick: applyFilters,
|
|
113
|
+
className: "".concat(blockClass, "-button")
|
|
114
|
+
}, primaryButtonText))));
|
|
115
|
+
};
|
|
116
|
+
AddSelectFilter.propTypes = {
|
|
117
|
+
filterOpts: PropTypes.array,
|
|
118
|
+
handleFilter: PropTypes.func,
|
|
119
|
+
handleSearch: PropTypes.func,
|
|
120
|
+
iconDescription: PropTypes.string,
|
|
121
|
+
inputPlaceholder: PropTypes.string,
|
|
122
|
+
multi: PropTypes.bool,
|
|
123
|
+
placeholder: PropTypes.string,
|
|
124
|
+
primaryButtonText: PropTypes.string,
|
|
125
|
+
searchTerm: PropTypes.string,
|
|
126
|
+
secondaryButtonText: PropTypes.string,
|
|
127
|
+
textInputLabel: PropTypes.string
|
|
128
|
+
};
|
|
129
|
+
AddSelectFilter.displayName = componentName;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
//
|
|
3
4
|
// Copyright IBM Corp. 2022
|
|
@@ -6,14 +7,16 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
6
7
|
// LICENSE file in the root directory of this source tree.
|
|
7
8
|
//
|
|
8
9
|
import React from 'react';
|
|
9
|
-
import { Checkbox, RadioButton, StructuredListRow, StructuredListWrapper, StructuredListBody, StructuredListCell } from 'carbon-components-react';
|
|
10
|
+
import { Checkbox, RadioButton, StructuredListRow, StructuredListWrapper, StructuredListBody, StructuredListCell, Dropdown } from 'carbon-components-react';
|
|
10
11
|
import { ChevronRight16 } from '@carbon/icons-react';
|
|
11
12
|
import PropTypes from 'prop-types';
|
|
13
|
+
import cx from 'classnames';
|
|
14
|
+
import { UserProfileImage } from '../UserProfileImage';
|
|
12
15
|
import { pkg } from '../../settings';
|
|
13
16
|
var componentName = 'AddSelectList';
|
|
14
17
|
export var AddSelectList = function AddSelectList(_ref) {
|
|
15
18
|
var filteredItems = _ref.filteredItems,
|
|
16
|
-
|
|
19
|
+
modifiers = _ref.modifiers,
|
|
17
20
|
multi = _ref.multi,
|
|
18
21
|
multiSelection = _ref.multiSelection,
|
|
19
22
|
path = _ref.path,
|
|
@@ -99,32 +102,75 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
|
99
102
|
}
|
|
100
103
|
};
|
|
101
104
|
|
|
105
|
+
var isSelected = function isSelected(id) {
|
|
106
|
+
return multiSelection.includes(id);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var getAvatarProps = function getAvatarProps(_ref3) {
|
|
110
|
+
var src = _ref3.src,
|
|
111
|
+
alt = _ref3.alt,
|
|
112
|
+
icon = _ref3.icon,
|
|
113
|
+
backgroundColor = _ref3.backgroundColor;
|
|
114
|
+
return {
|
|
115
|
+
className: "".concat(blockClass, "-cell-avatar"),
|
|
116
|
+
size: 'lg',
|
|
117
|
+
theme: 'light',
|
|
118
|
+
image: src,
|
|
119
|
+
imageDescription: alt,
|
|
120
|
+
icon: icon,
|
|
121
|
+
backgroundColor: backgroundColor
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
var getItemIcon = function getItemIcon(_ref4) {
|
|
126
|
+
var Icon = _ref4.icon;
|
|
127
|
+
return /*#__PURE__*/React.createElement(Icon, null);
|
|
128
|
+
};
|
|
129
|
+
|
|
102
130
|
return /*#__PURE__*/React.createElement("div", {
|
|
103
131
|
className: "".concat(blockClass, "-wrapper")
|
|
104
132
|
}, /*#__PURE__*/React.createElement(StructuredListWrapper, {
|
|
105
133
|
selection: true,
|
|
106
134
|
className: "".concat(blockClass)
|
|
107
135
|
}, /*#__PURE__*/React.createElement(StructuredListBody, null, filteredItems.map(function (item) {
|
|
136
|
+
var _modifiers$options;
|
|
137
|
+
|
|
108
138
|
return /*#__PURE__*/React.createElement(StructuredListRow, {
|
|
109
139
|
key: item.id,
|
|
110
|
-
className: "".concat(blockClass, "-row")
|
|
140
|
+
className: cx("".concat(blockClass, "-row"), _defineProperty({}, "".concat(blockClass, "-row-selected"), isSelected(item.id)))
|
|
111
141
|
}, /*#__PURE__*/React.createElement(StructuredListCell, {
|
|
112
142
|
className: "".concat(blockClass, "-cell")
|
|
113
143
|
}, /*#__PURE__*/React.createElement("div", {
|
|
114
144
|
className: "".concat(blockClass, "-cell-wrapper")
|
|
115
|
-
}, multi ? /*#__PURE__*/React.createElement(
|
|
116
|
-
className: "".concat(blockClass, "-checkbox")
|
|
145
|
+
}, multi ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
className: "".concat(blockClass, "-checkbox")
|
|
147
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
117
148
|
onChange: function onChange(checked) {
|
|
118
149
|
return handleMultiSelection(item.id, checked);
|
|
119
150
|
},
|
|
120
|
-
labelText:
|
|
121
|
-
className: "".concat(blockClass, "-cell-title")
|
|
122
|
-
}, item.title), /*#__PURE__*/React.createElement("span", {
|
|
123
|
-
className: "".concat(blockClass, "-cell-subtitle")
|
|
124
|
-
}, item.subtitle)) : item.title,
|
|
151
|
+
labelText: item.title,
|
|
125
152
|
id: item.id,
|
|
126
|
-
checked:
|
|
127
|
-
|
|
153
|
+
checked: isSelected(item.id),
|
|
154
|
+
className: "".concat(blockClass, "-checkbox-wrapper")
|
|
155
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
156
|
+
className: "".concat(blockClass, "-checkbox-label-wrapper")
|
|
157
|
+
}, item.avatar && /*#__PURE__*/React.createElement(UserProfileImage, getAvatarProps(item.avatar)), item.icon && /*#__PURE__*/React.createElement("div", {
|
|
158
|
+
className: "".concat(blockClass, "-cell-icon")
|
|
159
|
+
}, getItemIcon(item)), /*#__PURE__*/React.createElement("div", {
|
|
160
|
+
className: "".concat(blockClass, "-checkbox-label-text")
|
|
161
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
162
|
+
className: "".concat(blockClass, "-cell-title")
|
|
163
|
+
}, item.title), item.subtitle && /*#__PURE__*/React.createElement("span", {
|
|
164
|
+
className: "".concat(blockClass, "-cell-subtitle")
|
|
165
|
+
}, item.subtitle)))), (modifiers === null || modifiers === void 0 ? void 0 : (_modifiers$options = modifiers.options) === null || _modifiers$options === void 0 ? void 0 : _modifiers$options.length) && /*#__PURE__*/React.createElement(Dropdown, {
|
|
166
|
+
id: "".concat(item.id, "-modifier"),
|
|
167
|
+
type: "inline",
|
|
168
|
+
items: modifiers === null || modifiers === void 0 ? void 0 : modifiers.options,
|
|
169
|
+
light: true,
|
|
170
|
+
label: modifiers === null || modifiers === void 0 ? void 0 : modifiers.label,
|
|
171
|
+
disabled: !isSelected(item.id),
|
|
172
|
+
className: "".concat(blockClass, "-dropdown")
|
|
173
|
+
})) : /*#__PURE__*/React.createElement(RadioButton, {
|
|
128
174
|
className: "".concat(blockClass, "-radio"),
|
|
129
175
|
name: "add-select-selections",
|
|
130
176
|
id: item.id,
|
|
@@ -141,7 +187,7 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
|
141
187
|
};
|
|
142
188
|
AddSelectList.propTypes = {
|
|
143
189
|
filteredItems: PropTypes.array,
|
|
144
|
-
|
|
190
|
+
modifiers: PropTypes.object,
|
|
145
191
|
multi: PropTypes.bool,
|
|
146
192
|
multiSelection: PropTypes.array,
|
|
147
193
|
path: PropTypes.array,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
var _excluded = ["icon", "avatar"];
|
|
1
3
|
//
|
|
2
4
|
// Copyright IBM Corp. 2022
|
|
3
5
|
//
|
|
@@ -28,11 +30,19 @@ export var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
|
|
28
30
|
setMultiSelection(newSelections);
|
|
29
31
|
};
|
|
30
32
|
|
|
31
|
-
var sidebarItems = multiSelection.
|
|
32
|
-
|
|
33
|
-
return item.id ===
|
|
34
|
-
});
|
|
35
|
-
|
|
33
|
+
var sidebarItems = multiSelection.reduce(function (acc, cur) {
|
|
34
|
+
var selectedItem = items.find(function (item) {
|
|
35
|
+
return item.id === cur;
|
|
36
|
+
}); // certain properties should not be displayed in the sidebar
|
|
37
|
+
// eslint-disable-next-line no-unused-vars
|
|
38
|
+
|
|
39
|
+
var icon = selectedItem.icon,
|
|
40
|
+
avatar = selectedItem.avatar,
|
|
41
|
+
newItem = _objectWithoutProperties(selectedItem, _excluded);
|
|
42
|
+
|
|
43
|
+
acc.push(newItem);
|
|
44
|
+
return acc;
|
|
45
|
+
}, []);
|
|
36
46
|
|
|
37
47
|
var getTitle = function getTitle(_ref2) {
|
|
38
48
|
var title = _ref2.title,
|
|
@@ -61,4 +61,34 @@ export var flatten = function flatten(entries) {
|
|
|
61
61
|
|
|
62
62
|
return prev.concat(item).concat(children ? flatten(children.entries) : []);
|
|
63
63
|
}, []);
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* takes in a global filters array and a flat list of items
|
|
67
|
+
* it then searches through the items and finds any with the matching filter properties
|
|
68
|
+
* and adds those values to the array
|
|
69
|
+
* globalFilters looks like [{ id: someProperty }]
|
|
70
|
+
* the returned array would look like [{ id: someProperty, opts: [value, value]}]
|
|
71
|
+
* @param {Array} globalFilters - list of filter properties
|
|
72
|
+
* @param {Array} items - items to search through
|
|
73
|
+
* @returns an array of filter values
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
export var getGlobalFilterValues = function getGlobalFilterValues(globalFilters, items) {
|
|
77
|
+
var filterOpts = globalFilters.reduce(function (prevFilter, curFilter) {
|
|
78
|
+
var filterId = curFilter.id;
|
|
79
|
+
var opts = items.reduce(function (prevItem, curItem) {
|
|
80
|
+
var value = curItem[filterId];
|
|
81
|
+
|
|
82
|
+
if (value && !prevItem.includes(value)) {
|
|
83
|
+
prevItem.push(value);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return prevItem;
|
|
87
|
+
}, []);
|
|
88
|
+
prevFilter.push(_objectSpread({
|
|
89
|
+
opts: opts
|
|
90
|
+
}, curFilter));
|
|
91
|
+
return prevFilter;
|
|
92
|
+
}, []);
|
|
93
|
+
return filterOpts;
|
|
64
94
|
};
|
|
@@ -76,6 +76,8 @@ export var BreadcrumbWithOverflow = function BreadcrumbWithOverflow(_ref) {
|
|
|
76
76
|
key: "breadcrumb-overflow-".concat(internalId.current)
|
|
77
77
|
}, /*#__PURE__*/React.createElement(OverflowMenu, {
|
|
78
78
|
ariaLabel: overflowAriaLabel,
|
|
79
|
+
iconDescription: overflowAriaLabel // also needs setting to avoid a11y "Accessible name does not match or contain the visible label text"
|
|
80
|
+
,
|
|
79
81
|
renderIcon: OverflowMenuHorizontal32,
|
|
80
82
|
className: "".concat(blockClass, "__overflow-menu"),
|
|
81
83
|
menuOptionsClass: "".concat(blockClass, "__overflow-menu-options")
|