@carbon/ibm-products 2.48.0 → 2.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/index-full-carbon.css +29 -14
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +11 -2
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +29 -14
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +29 -14
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/APIKeyModal/APIKeyModal.types.d.ts +1 -1
- package/es/components/Card/Card.js +4 -2
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +100 -24
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +30 -27
- package/es/components/ConditionBuilder/ConditionBuilder.d.ts +9 -2
- package/es/components/ConditionBuilder/ConditionBuilder.js +13 -9
- package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +151 -0
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +26 -12
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +7 -7
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +62 -27
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -3
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +86 -37
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.d.ts +29 -14
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +10 -9
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +40 -20
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +40 -37
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +10 -49
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +22 -31
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +6 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +7 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +81 -31
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +14 -8
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +27 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +2 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +30 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +12 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +35 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +16 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.d.ts +32 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +4 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +35 -14
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +5 -6
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +25 -10
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +44 -17
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +50 -40
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +30 -13
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +2 -3
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +9 -10
- package/es/components/ConditionBuilder/utils/useDataConfigs.d.ts +18 -0
- package/es/components/ConditionBuilder/utils/useDataConfigs.js +120 -0
- package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/useTranslations.js +4 -1
- package/es/components/ConditionBuilder/utils/util.d.ts +12 -0
- package/es/components/ConditionBuilder/utils/util.js +48 -2
- package/es/components/CreateFullPage/CreateFullPageStep.d.ts +2 -2
- package/es/components/CreateFullPage/index.d.ts +1 -0
- package/es/components/CreateTearsheet/CreateTearsheet.js +3 -4
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +8 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +8 -3
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +20 -11
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +12 -7
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +18 -16
- package/es/components/Datagrid/types/index.d.ts +1 -0
- package/es/components/Datagrid/useActionsColumn.js +1 -4
- package/es/components/Datagrid/useFiltering.d.ts +1 -0
- package/es/components/Datagrid/useFiltering.js +14 -3
- package/es/components/EditInPlace/EditInPlace.js +7 -5
- package/es/components/NotificationsPanel/NotificationsPanel.d.ts +2 -0
- package/es/components/NotificationsPanel/NotificationsPanel.js +75 -5
- package/es/components/TagOverflow/TagOverflow.d.ts +1 -0
- package/es/components/TagOverflow/TagOverflow.js +8 -2
- package/es/components/TagOverflow/TagOverflowPopover.d.ts +1 -0
- package/es/components/TagOverflow/TagOverflowPopover.js +7 -1
- package/es/components/TagSet/TagSetOverflow.js +1 -1
- package/es/components/Tearsheet/Tearsheet.d.ts +2 -2
- package/es/components/Tearsheet/TearsheetShell.js +7 -3
- package/es/components/Toolbar/ToolbarButton.d.ts +12 -1
- package/es/components/Toolbar/ToolbarButton.js +16 -8
- package/es/global/js/hooks/useFocus.d.ts +1 -1
- package/es/global/js/hooks/useFocus.js +40 -24
- package/es/global/js/utils/keyboardNavigation.d.ts +27 -0
- package/es/global/js/utils/keyboardNavigation.js +37 -0
- package/es/global/js/utils/wrapFocus.d.ts +25 -0
- package/es/global/js/utils/wrapFocus.js +68 -0
- package/lib/components/APIKeyModal/APIKeyModal.types.d.ts +1 -1
- package/lib/components/Card/Card.js +3 -1
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +100 -24
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +36 -33
- package/lib/components/ConditionBuilder/ConditionBuilder.d.ts +9 -2
- package/lib/components/ConditionBuilder/ConditionBuilder.js +15 -11
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +151 -0
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +26 -12
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +15 -15
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +62 -27
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +7 -8
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +86 -37
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +4 -4
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.d.ts +29 -14
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +11 -10
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +8 -5
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +40 -20
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +47 -44
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +10 -49
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +22 -31
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +6 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +7 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +81 -31
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +18 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +27 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +3 -4
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +30 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +13 -8
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +35 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +22 -15
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.d.ts +32 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +15 -15
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +35 -14
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +5 -6
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +25 -10
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +2 -2
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +44 -17
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +60 -50
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +30 -13
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +18 -19
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +12 -13
- package/lib/components/ConditionBuilder/utils/useDataConfigs.d.ts +18 -0
- package/lib/components/ConditionBuilder/utils/useDataConfigs.js +124 -0
- package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/useTranslations.js +4 -1
- package/lib/components/ConditionBuilder/utils/util.d.ts +12 -0
- package/lib/components/ConditionBuilder/utils/util.js +53 -3
- package/lib/components/CreateFullPage/CreateFullPageStep.d.ts +2 -2
- package/lib/components/CreateFullPage/index.d.ts +1 -0
- package/lib/components/CreateTearsheet/CreateTearsheet.js +3 -4
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +8 -3
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +19 -10
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +6 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +11 -6
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +18 -16
- package/lib/components/Datagrid/types/index.d.ts +1 -0
- package/lib/components/Datagrid/useActionsColumn.js +1 -4
- package/lib/components/Datagrid/useFiltering.d.ts +1 -0
- package/lib/components/Datagrid/useFiltering.js +13 -1
- package/lib/components/EditInPlace/EditInPlace.js +7 -5
- package/lib/components/NotificationsPanel/NotificationsPanel.d.ts +2 -0
- package/lib/components/NotificationsPanel/NotificationsPanel.js +74 -4
- package/lib/components/TagOverflow/TagOverflow.d.ts +1 -0
- package/lib/components/TagOverflow/TagOverflow.js +8 -2
- package/lib/components/TagOverflow/TagOverflowPopover.d.ts +1 -0
- package/lib/components/TagOverflow/TagOverflowPopover.js +7 -1
- package/lib/components/TagSet/TagSetOverflow.js +1 -1
- package/lib/components/Tearsheet/Tearsheet.d.ts +2 -2
- package/lib/components/Tearsheet/TearsheetShell.js +6 -2
- package/lib/components/Toolbar/ToolbarButton.d.ts +12 -1
- package/lib/components/Toolbar/ToolbarButton.js +15 -6
- package/lib/global/js/hooks/useFocus.d.ts +1 -1
- package/lib/global/js/hooks/useFocus.js +40 -24
- package/lib/global/js/utils/keyboardNavigation.d.ts +27 -0
- package/lib/global/js/utils/keyboardNavigation.js +43 -0
- package/lib/global/js/utils/wrapFocus.d.ts +25 -0
- package/lib/global/js/utils/wrapFocus.js +73 -0
- package/package.json +4 -4
- package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +33 -22
- package/scss/components/Datagrid/styles/_datagrid.scss +7 -0
- package/scss/components/Datagrid/styles/_useActionsColumn.scss +4 -0
- package/scss/components/EditInPlace/_edit-in-place.scss +2 -2
- package/telemetry.yml +15 -6
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +0 -28
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +0 -123
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +0 -28
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +0 -131
@@ -6,8 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import { blockClass } from '
|
10
|
-
import { focusThisItem, manageTabIndexAndFocus, traverseClockVise, traverseReverse, checkForHoldingKey, focusThisField } from './util.js';
|
9
|
+
import { blockClass, HIERARCHICAL_VARIANT, focusThisItem, manageTabIndexAndFocus, traverseClockVise, traverseReverse, checkForHoldingKey, focusThisField } from './util.js';
|
11
10
|
|
12
11
|
var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef, variant) {
|
13
12
|
var _activeElement$closes;
|
@@ -78,9 +77,9 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
|
|
78
77
|
if (document.activeElement.type !== 'button') {
|
79
78
|
var _document$activeEleme2;
|
80
79
|
//for button , enter key is click which already handled by framework, for other elements trigger click
|
80
|
+
evt.preventDefault();
|
81
81
|
(_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.click();
|
82
82
|
}
|
83
|
-
evt.preventDefault();
|
84
83
|
} else {
|
85
84
|
if (document.activeElement.type !== 'button') {
|
86
85
|
var _document$activeEleme3;
|
@@ -101,12 +100,12 @@ var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, co
|
|
101
100
|
switch (evt.key) {
|
102
101
|
case 'ArrowRight':
|
103
102
|
evt.preventDefault();
|
104
|
-
if (variant ==
|
103
|
+
if (variant == HIERARCHICAL_VARIANT) {
|
105
104
|
var _evt$target$closest;
|
106
105
|
var allCellsInRow = Array.from((_evt$target$closest = evt.target.closest('[role="row"]')) === null || _evt$target$closest === void 0 ? void 0 : _evt$target$closest.querySelectorAll('[role="gridcell"] button'));
|
107
106
|
if (allCellsInRow.length === 1) {
|
108
107
|
evt.target = evt.target.closest('[role="row"]');
|
109
|
-
|
108
|
+
handleRowNavigationHierarchical(evt, conditionBuilderRef, variant);
|
110
109
|
//focus next row
|
111
110
|
} else if (evt.target.getAttribute('role') == 'row') {
|
112
111
|
//when current focus is on a row, then we need to enter inside and focus the first cell of that row
|
@@ -128,7 +127,7 @@ var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, co
|
|
128
127
|
break;
|
129
128
|
case 'ArrowLeft':
|
130
129
|
evt.preventDefault();
|
131
|
-
if (variant ==
|
130
|
+
if (variant == HIERARCHICAL_VARIANT) {
|
132
131
|
if (evt.target.getAttribute('role') !== 'row') {
|
133
132
|
var _evt$target$closest2;
|
134
133
|
//when any cell is focussed, arrow left will select the previous cell or current row
|
@@ -150,8 +149,8 @@ var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, co
|
|
150
149
|
case 'ArrowUp':
|
151
150
|
case 'ArrowDown':
|
152
151
|
evt.preventDefault();
|
153
|
-
if (variant ==
|
154
|
-
|
152
|
+
if (variant == HIERARCHICAL_VARIANT) {
|
153
|
+
handleRowNavigationHierarchical(evt, conditionBuilderRef, variant);
|
155
154
|
} else {
|
156
155
|
handleRowNavigation(evt, conditionBuilderRef, variant);
|
157
156
|
}
|
@@ -179,7 +178,7 @@ var handleRowNavigation = function handleRowNavigation(evt, conditionBuilderRef,
|
|
179
178
|
var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
|
180
179
|
navigateToNextRowCell(evt, currentRowIndex, rows, variant, conditionBuilderRef);
|
181
180
|
};
|
182
|
-
var
|
181
|
+
var handleRowNavigationHierarchical = function handleRowNavigationHierarchical(evt, conditionBuilderRef, variant) {
|
183
182
|
var rows = getRows(conditionBuilderRef);
|
184
183
|
var currentRowIndex = getRowIndex(evt.target, conditionBuilderRef);
|
185
184
|
var nextRowIndex = currentRowIndex;
|
@@ -217,7 +216,7 @@ var navigateToNextRowCell = function navigateToNextRowCell(evt, currentRowIndex,
|
|
217
216
|
var itemName = evt.target.dataset.name;
|
218
217
|
if (nextRow !== null && nextRow !== void 0 && nextRow.querySelector("[data-name=\"".concat(itemName, "\"]"))) {
|
219
218
|
manageTabIndexAndFocus(nextRow === null || nextRow === void 0 ? void 0 : nextRow.querySelector("[data-name=\"".concat(itemName, "\"]")), conditionBuilderRef);
|
220
|
-
} else if (variant ===
|
219
|
+
} else if (variant === HIERARCHICAL_VARIANT) {
|
221
220
|
//when the next row is a if statement , then that row is focused. From any cell of last row of an group , arrow down select the next row (if)
|
222
221
|
manageTabIndexAndFocus(nextRow, conditionBuilderRef);
|
223
222
|
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
export function useDataConfigs(): {
|
2
|
+
statementConfig: {
|
3
|
+
label: string;
|
4
|
+
id: string;
|
5
|
+
connector: string;
|
6
|
+
text1: any;
|
7
|
+
text2: string;
|
8
|
+
}[];
|
9
|
+
connectorConfig: {
|
10
|
+
label: any;
|
11
|
+
id: string;
|
12
|
+
}[];
|
13
|
+
operatorConfig: {
|
14
|
+
label: any;
|
15
|
+
id: string;
|
16
|
+
type: string;
|
17
|
+
}[];
|
18
|
+
};
|
@@ -0,0 +1,120 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import { useTranslations } from './useTranslations.js';
|
10
|
+
|
11
|
+
var useDataConfigs = function useDataConfigs() {
|
12
|
+
var _useTranslations = useTranslations(['ifAll', 'ifAny', 'unlessAll', 'unlessAny', 'and', 'or', 'is', 'greater', 'greaterEqual', 'lower', 'lowerEqual', 'startsWith', 'endsWith', 'contains', 'oneOf', 'before', 'after', 'between']),
|
13
|
+
_useTranslations2 = _slicedToArray(_useTranslations, 18),
|
14
|
+
ifAll = _useTranslations2[0],
|
15
|
+
ifAny = _useTranslations2[1],
|
16
|
+
unlessAll = _useTranslations2[2],
|
17
|
+
unlessAny = _useTranslations2[3],
|
18
|
+
and = _useTranslations2[4],
|
19
|
+
or = _useTranslations2[5],
|
20
|
+
is = _useTranslations2[6],
|
21
|
+
greater = _useTranslations2[7],
|
22
|
+
greaterEqual = _useTranslations2[8],
|
23
|
+
lower = _useTranslations2[9],
|
24
|
+
lowerEqual = _useTranslations2[10],
|
25
|
+
startsWith = _useTranslations2[11],
|
26
|
+
endsWith = _useTranslations2[12],
|
27
|
+
contains = _useTranslations2[13],
|
28
|
+
oneOf = _useTranslations2[14],
|
29
|
+
before = _useTranslations2[15],
|
30
|
+
after = _useTranslations2[16],
|
31
|
+
between = _useTranslations2[17];
|
32
|
+
var statementConfig = [{
|
33
|
+
label: 'ifText',
|
34
|
+
id: 'ifAll',
|
35
|
+
connector: 'and',
|
36
|
+
text1: ifAll,
|
37
|
+
text2: '(a && b)'
|
38
|
+
}, {
|
39
|
+
label: 'ifText',
|
40
|
+
id: 'ifAny',
|
41
|
+
connector: 'or',
|
42
|
+
text1: ifAny,
|
43
|
+
text2: '(a || b)'
|
44
|
+
}, {
|
45
|
+
label: 'unlessText',
|
46
|
+
id: 'unlessAll',
|
47
|
+
connector: 'and',
|
48
|
+
text1: unlessAll,
|
49
|
+
text2: '! (a && b)'
|
50
|
+
}, {
|
51
|
+
label: 'unlessText',
|
52
|
+
id: 'unlessAny',
|
53
|
+
connector: 'or',
|
54
|
+
text1: unlessAny,
|
55
|
+
text2: '! (a || b)'
|
56
|
+
}];
|
57
|
+
var connectorConfig = [{
|
58
|
+
label: and,
|
59
|
+
id: 'and'
|
60
|
+
}, {
|
61
|
+
label: or,
|
62
|
+
id: 'or'
|
63
|
+
}];
|
64
|
+
var operatorConfig = [{
|
65
|
+
label: is,
|
66
|
+
id: 'is',
|
67
|
+
type: 'all'
|
68
|
+
}, {
|
69
|
+
label: greater,
|
70
|
+
id: 'greater',
|
71
|
+
type: 'number'
|
72
|
+
}, {
|
73
|
+
label: greaterEqual,
|
74
|
+
id: 'greaterEqual',
|
75
|
+
type: 'number'
|
76
|
+
}, {
|
77
|
+
label: lower,
|
78
|
+
id: 'lower',
|
79
|
+
type: 'number'
|
80
|
+
}, {
|
81
|
+
label: lowerEqual,
|
82
|
+
id: 'lowerEqual',
|
83
|
+
type: 'number'
|
84
|
+
}, {
|
85
|
+
label: startsWith,
|
86
|
+
id: 'startsWith',
|
87
|
+
type: 'text,textarea'
|
88
|
+
}, {
|
89
|
+
label: endsWith,
|
90
|
+
id: 'endsWith',
|
91
|
+
type: 'text,textarea'
|
92
|
+
}, {
|
93
|
+
label: contains,
|
94
|
+
id: 'contains',
|
95
|
+
type: 'text,textarea'
|
96
|
+
}, {
|
97
|
+
label: oneOf,
|
98
|
+
id: 'oneOf',
|
99
|
+
type: 'option'
|
100
|
+
}, {
|
101
|
+
label: before,
|
102
|
+
id: 'before',
|
103
|
+
type: 'date,time'
|
104
|
+
}, {
|
105
|
+
label: after,
|
106
|
+
id: 'after',
|
107
|
+
type: 'date,time'
|
108
|
+
}, {
|
109
|
+
label: between,
|
110
|
+
id: 'between',
|
111
|
+
type: 'date'
|
112
|
+
}];
|
113
|
+
return {
|
114
|
+
statementConfig: statementConfig,
|
115
|
+
connectorConfig: connectorConfig,
|
116
|
+
operatorConfig: operatorConfig
|
117
|
+
};
|
118
|
+
};
|
119
|
+
|
120
|
+
export { useDataConfigs };
|
@@ -1 +1 @@
|
|
1
|
-
export function useTranslations(translationKeys: any): any;
|
1
|
+
export function useTranslations(translationKeys: any, alterTranslationKeyMap: any): any;
|
@@ -9,10 +9,13 @@ import { useContext } from 'react';
|
|
9
9
|
import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
|
10
10
|
import { translationsObject } from '../ConditionBuilderContext/translationObject.js';
|
11
11
|
|
12
|
-
var useTranslations = function useTranslations(translationKeys) {
|
12
|
+
var useTranslations = function useTranslations(translationKeys, alterTranslationKeyMap) {
|
13
13
|
var _useContext = useContext(ConditionBuilderContext),
|
14
14
|
translateWithId = _useContext.translateWithId;
|
15
15
|
return translationKeys.map(function (translationKey) {
|
16
|
+
if (alterTranslationKeyMap !== null && alterTranslationKeyMap !== void 0 && alterTranslationKeyMap[translationKey]) {
|
17
|
+
translationKey = alterTranslationKeyMap[translationKey];
|
18
|
+
}
|
16
19
|
if (translateWithId !== null && translateWithId !== void 0 && translateWithId(translationKey)) {
|
17
20
|
return translateWithId(translationKey);
|
18
21
|
} else if (translationsObject[translationKey]) {
|
@@ -1,3 +1,6 @@
|
|
1
|
+
export const blockClass: string;
|
2
|
+
export const NON_HIERARCHICAL_VARIANT: "Non-Hierarchical";
|
3
|
+
export const HIERARCHICAL_VARIANT: "Hierarchical";
|
1
4
|
export function focusThisField(evt: any, conditionBuilderRef: any): void;
|
2
5
|
export function focusThisItem(currentElement: any, conditionBuilderRef: any): void;
|
3
6
|
export function traverseClockVise(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any, conditionBuilderRef: any): void;
|
@@ -5,3 +8,12 @@ export function traverseReverse(eachElem: any, index: any, allElements: any, rot
|
|
5
8
|
export function checkForHoldingKey(evt: any, key: any): any;
|
6
9
|
export function checkIsValid(item: any): any;
|
7
10
|
export function manageTabIndexAndFocus(currentElement: any, conditionBuilderRef: any): void;
|
11
|
+
export namespace getValue {
|
12
|
+
function text(value: any): any;
|
13
|
+
function textarea(value: any): any;
|
14
|
+
function time(value: any): any;
|
15
|
+
function number(value: any): any;
|
16
|
+
function option(value: any): any;
|
17
|
+
function date(value: any): any;
|
18
|
+
function custom(value: any): any;
|
19
|
+
}
|
@@ -5,8 +5,11 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import {
|
8
|
+
import { pkg } from '../../../settings.js';
|
9
9
|
|
10
|
+
var blockClass = "".concat(pkg.prefix, "--condition-builder");
|
11
|
+
var NON_HIERARCHICAL_VARIANT = 'Non-Hierarchical';
|
12
|
+
var HIERARCHICAL_VARIANT = 'Hierarchical';
|
10
13
|
var focusThisField = function focusThisField(evt, conditionBuilderRef) {
|
11
14
|
if (evt) {
|
12
15
|
setTimeout(function () {
|
@@ -66,5 +69,48 @@ var manageTabIndexAndFocus = function manageTabIndexAndFocus(currentElement, con
|
|
66
69
|
(_conditionBuilderRef$ = conditionBuilderRef.current) === null || _conditionBuilderRef$ === void 0 || (_conditionBuilderRef$ = _conditionBuilderRef$.querySelector(".".concat(blockClass, "__statement-button"))) === null || _conditionBuilderRef$ === void 0 || _conditionBuilderRef$.setAttribute('tabindex', '1');
|
67
70
|
currentElement === null || currentElement === void 0 || currentElement.focus();
|
68
71
|
};
|
72
|
+
var formatDate = function formatDate(date) {
|
73
|
+
var day = String(date.getDate()).padStart(2, '0');
|
74
|
+
var month = String(date.getMonth() + 1).padStart(2, '0');
|
75
|
+
var year = date.getFullYear();
|
76
|
+
return "".concat(day, "/").concat(month, "/").concat(year);
|
77
|
+
};
|
78
|
+
var getValue = {
|
79
|
+
text: function text(value) {
|
80
|
+
return value;
|
81
|
+
},
|
82
|
+
textarea: function textarea(value) {
|
83
|
+
return value;
|
84
|
+
},
|
85
|
+
time: function time(value) {
|
86
|
+
return value;
|
87
|
+
},
|
88
|
+
number: function number(value) {
|
89
|
+
return value;
|
90
|
+
},
|
91
|
+
option: function option(value) {
|
92
|
+
if (value && typeof value !== 'string') {
|
93
|
+
var selectedValues = Array.isArray(value) ? value : [value];
|
94
|
+
return selectedValues.map(function (option) {
|
95
|
+
return option.label;
|
96
|
+
}).join(', ');
|
97
|
+
}
|
98
|
+
return value;
|
99
|
+
},
|
100
|
+
date: function date(value) {
|
101
|
+
if (Array.isArray(value) && value.length > 1) {
|
102
|
+
var start = value !== null && value !== void 0 && value[0] && !isNaN(new Date(value[0])) ? formatDate(new Date(value[0])) : '';
|
103
|
+
var end = value !== null && value !== void 0 && value[1] && !isNaN(new Date(value[1])) ? formatDate(new Date(value[1])) : '';
|
104
|
+
return "".concat(start, " To ").concat(end);
|
105
|
+
} else if (Array.isArray(value) && !isNaN(new Date(value[0]))) {
|
106
|
+
return formatDate(new Date(value[0]));
|
107
|
+
} else {
|
108
|
+
return value;
|
109
|
+
}
|
110
|
+
},
|
111
|
+
custom: function custom(value) {
|
112
|
+
return value;
|
113
|
+
}
|
114
|
+
};
|
69
115
|
|
70
|
-
export { checkForHoldingKey, checkIsValid, focusThisField, focusThisItem, manageTabIndexAndFocus, traverseClockVise, traverseReverse };
|
116
|
+
export { HIERARCHICAL_VARIANT, NON_HIERARCHICAL_VARIANT, blockClass, checkForHoldingKey, checkIsValid, focusThisField, focusThisItem, getValue, manageTabIndexAndFocus, traverseClockVise, traverseReverse };
|
@@ -21,7 +21,7 @@ interface CreateFullPageStepBaseProps extends PropsWithChildren {
|
|
21
21
|
/**
|
22
22
|
* This optional prop will render your form content inside of a fieldset html element
|
23
23
|
*/
|
24
|
-
hasFieldset
|
24
|
+
hasFieldset?: boolean;
|
25
25
|
/**
|
26
26
|
* This prop is used to help track dynamic steps. If this value is `false` then the step is not included in the visible steps or the ProgressIndicator
|
27
27
|
* steps. If this value is `true` then the step will be included in the list of visible steps, as well as being included in the ProgressIndicator step list
|
@@ -66,6 +66,6 @@ type CreateFullPageStepFieldsetProps = {
|
|
66
66
|
hasFieldset?: true;
|
67
67
|
fieldsetLegendText: string;
|
68
68
|
};
|
69
|
-
type CreateFullPageStepProps = CreateFullPageStepBaseProps & CreateFullPageStepFieldsetProps;
|
69
|
+
export type CreateFullPageStepProps = CreateFullPageStepBaseProps & CreateFullPageStepFieldsetProps;
|
70
70
|
export declare let CreateFullPageStep: React.ForwardRefExoticComponent<CreateFullPageStepProps & React.RefAttributes<HTMLDivElement>>;
|
71
71
|
export {};
|
@@ -111,10 +111,11 @@ var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
111
111
|
var contentRef = useRef(null);
|
112
112
|
useEffect(function () {
|
113
113
|
var firstItem = stepData.findIndex(function (item) {
|
114
|
-
return item ===
|
114
|
+
return item.shouldIncludeStep === true;
|
115
115
|
}) + 1;
|
116
116
|
var lastItem = lastIndexInArray(stepData, 'shouldIncludeStep', true);
|
117
117
|
if (firstItem !== firstIncludedStep) {
|
118
|
+
setCurrentStep(firstItem);
|
118
119
|
setFirstIncludedStep(firstItem);
|
119
120
|
}
|
120
121
|
if (lastItem !== lastIncludedStep) {
|
@@ -123,10 +124,8 @@ var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
123
124
|
if (open && initialStep) {
|
124
125
|
var numberOfHiddenSteps = getNumberOfHiddenSteps(stepData, initialStep);
|
125
126
|
setCurrentStep(Number(initialStep + numberOfHiddenSteps));
|
126
|
-
} else {
|
127
|
-
setCurrentStep(firstIncludedStep);
|
128
127
|
}
|
129
|
-
}, [
|
128
|
+
}, [firstIncludedStep, initialStep, lastIncludedStep, open, stepData]);
|
130
129
|
useCreateComponentFocus({
|
131
130
|
previousState: previousState,
|
132
131
|
currentStep: currentStep,
|
@@ -19,6 +19,7 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
|
19
19
|
import { getScrollbarWidth } from '../../global/js/utils/getScrollbarWidth.js';
|
20
20
|
import { handleEditSubmit } from './utils/handleEditSubmit.js';
|
21
21
|
import { handleHeaderCellSelection } from './utils/handleHeaderCellSelection.js';
|
22
|
+
import { getNodeTextContent } from '../../global/js/utils/getNodeTextContent.js';
|
22
23
|
import { handleKeyPress } from './utils/commonEventHandlers.js';
|
23
24
|
import { pkg } from '../../settings.js';
|
24
25
|
import { removeCellSelections } from './utils/removeCellSelections.js';
|
@@ -205,7 +206,13 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
205
206
|
var currentHeaders = [];
|
206
207
|
if (Object.keys(currentColumns).length > 0) {
|
207
208
|
Object.keys(currentColumns).forEach(function (itemIndex) {
|
208
|
-
if (currentColumns[itemIndex].Header) {
|
209
|
+
if (_typeof(currentColumns[itemIndex].Header) === 'object') {
|
210
|
+
if (currentColumns[itemIndex].column_name) {
|
211
|
+
currentHeaders.push(currentColumns[itemIndex].column_name);
|
212
|
+
} else {
|
213
|
+
currentHeaders.push(getNodeTextContent(currentColumns[itemIndex].Header));
|
214
|
+
}
|
215
|
+
} else if (currentColumns[itemIndex].Header) {
|
209
216
|
currentHeaders.push(currentColumns[itemIndex].Header);
|
210
217
|
}
|
211
218
|
});
|
@@ -33,6 +33,7 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
33
33
|
selectedRowIds = datagridState.state.selectedRowIds,
|
34
34
|
toggleAllRowsSelected = datagridState.toggleAllRowsSelected,
|
35
35
|
toolbarBatchActions = datagridState.toolbarBatchActions,
|
36
|
+
toolbarBatchActionsDisplayMin = datagridState.toolbarBatchActionsDisplayMin,
|
36
37
|
setGlobalFilter = datagridState.setGlobalFilter,
|
37
38
|
rows = datagridState.rows,
|
38
39
|
dispatch = datagridState.dispatch,
|
@@ -80,7 +81,7 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
80
81
|
var minWidthBeforeOverflowIcon = 380;
|
81
82
|
// Do not render ButtonMenu when there are 3 or less items
|
82
83
|
// and if there is enough available space to render all the items
|
83
|
-
if (toolbarBatchActions && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.length) <= 3 &&
|
84
|
+
if (toolbarBatchActions && !displayAllInMenu && (!toolbarBatchActionsDisplayMin && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.length) <= 3 || toolbarBatchActionsDisplayMin !== undefined && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.length) <= toolbarBatchActionsDisplayMin)) {
|
84
85
|
return;
|
85
86
|
}
|
86
87
|
var renderItem = function renderItem(batchAction, index) {
|
@@ -98,7 +99,10 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
98
99
|
tabIndex: totalSelected > 0 ? 0 : -1,
|
99
100
|
menuAlignment: "bottom"
|
100
101
|
}, toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
101
|
-
var hidden = index < 2 && !displayAllInMenu;
|
102
|
+
var hidden = toolbarBatchActionsDisplayMin === undefined && index < 2 && !displayAllInMenu;
|
103
|
+
if (toolbarBatchActionsDisplayMin !== undefined && index < toolbarBatchActionsDisplayMin && !displayAllInMenu) {
|
104
|
+
hidden = true;
|
105
|
+
}
|
102
106
|
if (!hidden) {
|
103
107
|
return renderItem(batchAction, index);
|
104
108
|
}
|
@@ -144,13 +148,14 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
144
148
|
totalCount: rows && rows.length,
|
145
149
|
translateWithId: translateWithIdBatchActions
|
146
150
|
}, !displayAllInMenu && toolbarBatchActions && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
147
|
-
if (index < 2 && toolbarBatchActions.length > 3 || index < 3 && toolbarBatchActions.length <= 3) {
|
151
|
+
if (!toolbarBatchActionsDisplayMin && index < 2 && toolbarBatchActions.length > 3 || index < 3 && toolbarBatchActions.length <= 3 || toolbarBatchActionsDisplayMin !== undefined && index < toolbarBatchActionsDisplayMin) {
|
148
152
|
return /*#__PURE__*/React__default.createElement(TableBatchAction, {
|
149
153
|
key: "".concat(batchAction.label, "-").concat(index),
|
150
154
|
renderIcon: batchAction.renderIcon,
|
151
155
|
onClick: function onClick(event) {
|
152
156
|
return onClickHandler(event, batchAction);
|
153
157
|
},
|
158
|
+
className: cx(_defineProperty({}, "".concat(carbon.prefix, "--noLabel"), !batchAction.label || batchAction.label === '')),
|
154
159
|
iconDescription: batchAction.label,
|
155
160
|
tabIndex: totalSelected > 0 ? 0 : -1
|
156
161
|
}, batchAction.label);
|
@@ -6,12 +6,13 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { extends as _extends, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default, {
|
9
|
+
import React__default, { useRef, useEffect } from 'react';
|
10
10
|
import { VariableSizeList } from 'react-window';
|
11
11
|
import { TableBody } from '@carbon/react';
|
12
12
|
import { pkg } from '../../../settings.js';
|
13
13
|
import DatagridHead from './DatagridHead.js';
|
14
14
|
import { useResizeObserver } from '../../../global/js/hooks/useResizeObserver.js';
|
15
|
+
import { useIsomorphicEffect } from '../../../global/js/hooks/useIsomorphicEffect.js';
|
15
16
|
|
16
17
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
17
18
|
var rowSizeMap = {
|
@@ -23,7 +24,6 @@ var rowSizeMap = {
|
|
23
24
|
};
|
24
25
|
var defaultRowHeight = rowSizeMap.lg;
|
25
26
|
var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
26
|
-
var _gridRef$current, _gridRef$current2;
|
27
27
|
var getTableBodyProps = datagridState.getTableBodyProps,
|
28
28
|
rows = datagridState.rows,
|
29
29
|
prepareRow = datagridState.prepareRow,
|
@@ -40,6 +40,8 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
40
40
|
gridRef = datagridState.gridRef,
|
41
41
|
tableId = datagridState.tableId,
|
42
42
|
onVirtualScroll = datagridState.onVirtualScroll;
|
43
|
+
var headWrapRef = useRef(null);
|
44
|
+
var innerRef = useRef(null);
|
43
45
|
|
44
46
|
/* istanbul ignore next */
|
45
47
|
var handleVirtualGridResize = function handleVirtualGridResize() {
|
@@ -60,7 +62,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
60
62
|
if (listRef && listRef.current) {
|
61
63
|
listRef.current.resetAfterIndex(0);
|
62
64
|
}
|
63
|
-
}, [listRef]);
|
65
|
+
}, [listRef, rowHeight]);
|
64
66
|
var visibleRows = DatagridPagination && page || rows;
|
65
67
|
var testRef = useRef(null);
|
66
68
|
|
@@ -80,12 +82,21 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
80
82
|
testRefValue === null || testRefValue === void 0 || testRefValue.removeEventListener('scroll', handleScroll);
|
81
83
|
};
|
82
84
|
});
|
85
|
+
useIsomorphicEffect(function () {
|
86
|
+
if (headWrapRef.current && headWrapRef.current.style) {
|
87
|
+
var _gridRef$current;
|
88
|
+
headWrapRef.current.style.width = "".concat(gridRef === null || gridRef === void 0 || (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth, "px");
|
89
|
+
}
|
90
|
+
}, [headWrapRef, gridRef]);
|
91
|
+
useIsomorphicEffect(function () {
|
92
|
+
if (testRef !== null && testRef !== void 0 && testRef.current && testRef.current.style) {
|
93
|
+
var _gridRef$current2;
|
94
|
+
testRef.current.style.width = "".concat(gridRef === null || gridRef === void 0 || (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.clientWidth, "px");
|
95
|
+
}
|
96
|
+
}, [testRef, gridRef]);
|
83
97
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
84
98
|
className: "".concat(blockClass, "__head-wrap"),
|
85
|
-
|
86
|
-
width: gridRef === null || gridRef === void 0 || (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
|
87
|
-
overflow: 'hidden'
|
88
|
-
}
|
99
|
+
ref: headWrapRef
|
89
100
|
}, /*#__PURE__*/React__default.createElement(DatagridHead, datagridState)), /*#__PURE__*/React__default.createElement(TableBody, _extends({}, getTableBodyProps({
|
90
101
|
role: undefined
|
91
102
|
}), {
|
@@ -105,10 +116,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
105
116
|
innerRef: innerListRef,
|
106
117
|
outerRef: testRef,
|
107
118
|
ref: listRef,
|
108
|
-
className: "".concat(blockClass, "__virtual-scrollbar")
|
109
|
-
style: {
|
110
|
-
width: gridRef === null || gridRef === void 0 || (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.clientWidth
|
111
|
-
}
|
119
|
+
className: "".concat(blockClass, "__virtual-scrollbar")
|
112
120
|
}, function (_ref) {
|
113
121
|
var _row$RowRenderer;
|
114
122
|
var index = _ref.index,
|
@@ -118,6 +126,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
118
126
|
var _row$getRowProps = row.getRowProps(),
|
119
127
|
key = _row$getRowProps.key;
|
120
128
|
return /*#__PURE__*/React__default.createElement("div", {
|
129
|
+
ref: innerRef,
|
121
130
|
style: _objectSpread2({}, style)
|
122
131
|
}, row === null || row === void 0 || (_row$RowRenderer = row.RowRenderer) === null || _row$RowRenderer === void 0 ? void 0 : _row$RowRenderer.call(row, _objectSpread2(_objectSpread2({}, datagridState), {}, {
|
123
132
|
row: row,
|
package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2 } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default, { useState, useCallback, useEffect } from 'react';
|
9
|
+
import React__default, { useState, useRef, useCallback, useEffect } from 'react';
|
10
10
|
import PropTypes from '../../../../../node_modules/prop-types/index.js';
|
11
11
|
import '../../../../Tearsheet/Tearsheet.js';
|
12
12
|
import { TearsheetNarrow } from '../../../../Tearsheet/TearsheetNarrow.js';
|
@@ -59,6 +59,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
59
59
|
_useState10 = _slicedToArray(_useState9, 2),
|
60
60
|
isDirty = _useState10[0],
|
61
61
|
setIsDirty = _useState10[1];
|
62
|
+
var prevColumnDefinitions = useRef();
|
62
63
|
var onRequestClose = function onRequestClose() {
|
63
64
|
setColumnObjects(columnDefinitions);
|
64
65
|
setIsTearsheetOpen(false);
|
@@ -121,6 +122,9 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
121
122
|
}, [columnObjects]);
|
122
123
|
var string = searchText.trim().toLowerCase();
|
123
124
|
useEffect(function () {
|
125
|
+
if (prevColumnDefinitions.current !== columnDefinitions) {
|
126
|
+
setColumnObjects(columnDefinitions);
|
127
|
+
}
|
124
128
|
var actionCount = columnObjects.filter(function (col) {
|
125
129
|
return col.id === 'actions';
|
126
130
|
}).length;
|
@@ -129,7 +133,8 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
129
133
|
}).length;
|
130
134
|
setVisibleColumnsCount(getVisibleColumnsCount() - actionCount - datagridSelectionCount < 0 ? 0 : getVisibleColumnsCount() - actionCount - datagridSelectionCount);
|
131
135
|
setTotalColumns(columnObjects.length - actionCount - datagridSelectionCount);
|
132
|
-
|
136
|
+
prevColumnDefinitions.current = columnDefinitions;
|
137
|
+
}, [getVisibleColumnsCount, columnObjects, columnDefinitions]);
|
133
138
|
return /*#__PURE__*/React__default.createElement(TearsheetNarrow, {
|
134
139
|
className: "".concat(blockClass, "__customize-columns-tearsheet"),
|
135
140
|
open: isOpen,
|
@@ -8,7 +8,7 @@
|
|
8
8
|
import { slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { Button, Layer, Search, Accordion, AccordionItem } from '@carbon/react';
|
10
10
|
import { PANEL, BATCH, CLEAR_FILTERS, INSTANT } from './constants.js';
|
11
|
-
import React__default, { useState, useContext, useRef, useMemo, useEffect } from 'react';
|
11
|
+
import React__default, { useState, useContext, useRef, useMemo, useEffect, useCallback } from 'react';
|
12
12
|
import { panelVariants, innerContainerVariants, actionSetVariants } from './motion/variants.js';
|
13
13
|
import { motion, useReducedMotion } from 'framer-motion';
|
14
14
|
import { ActionSet } from '../../../../ActionSet/ActionSet.js';
|
@@ -21,6 +21,7 @@ import { rem } from '@carbon/layout';
|
|
21
21
|
import useFilters from './hooks/useFilters.js';
|
22
22
|
import useShouldDisableButtons from './hooks/useShouldDisableButtons.js';
|
23
23
|
import useSubscribeToEventEmitter from './hooks/useSubscribeToEventEmitter.js';
|
24
|
+
import { useIsomorphicEffect } from '../../../../../global/js/hooks/useIsomorphicEffect.js';
|
24
25
|
|
25
26
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
26
27
|
var componentClass = "".concat(blockClass, "-filter-panel");
|
@@ -102,7 +103,7 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
102
103
|
var filterHeadingRef = useRef();
|
103
104
|
var filterSearchRef = useRef();
|
104
105
|
var actionSetRef = useRef();
|
105
|
-
|
106
|
+
var innerContainerRef = useRef();
|
106
107
|
/** State from hooks */
|
107
108
|
var _useShouldDisableButt = useShouldDisableButtons({
|
108
109
|
initialValue: true,
|
@@ -189,7 +190,7 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
189
190
|
useSubscribeToEventEmitter(CLEAR_FILTERS, function (tableId) {
|
190
191
|
reset(tableId);
|
191
192
|
});
|
192
|
-
var getScrollableContainerHeight = function
|
193
|
+
var getScrollableContainerHeight = useCallback(function () {
|
193
194
|
var _filterHeadingRef$cur, _filterSearchRef$curr, _actionSetRef$current;
|
194
195
|
var filterHeadingHeight = (_filterHeadingRef$cur = filterHeadingRef.current) === null || _filterHeadingRef$cur === void 0 ? void 0 : _filterHeadingRef$cur.getBoundingClientRect().height;
|
195
196
|
var filterSearchHeight = (_filterSearchRef$curr = filterSearchRef.current) === null || _filterSearchRef$curr === void 0 ? void 0 : _filterSearchRef$curr.getBoundingClientRect().height;
|
@@ -197,7 +198,13 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
197
198
|
var height = panelOpen ? "calc(100vh - ".concat(filterHeadingHeight, "px - ").concat( /* istanbul ignore next */
|
198
199
|
showFilterSearch ? filterSearchHeight : 0, "px - ").concat(updateMethod === BATCH ? actionSetHeight : 0, "px)") : 0;
|
199
200
|
return height;
|
200
|
-
};
|
201
|
+
}, [filterHeadingRef, filterSearchRef, actionSetRef, panelOpen, showFilterSearch, updateMethod]);
|
202
|
+
useIsomorphicEffect(function () {
|
203
|
+
var height = getScrollableContainerHeight();
|
204
|
+
if (innerContainerRef.current && innerContainerRef.current.style) {
|
205
|
+
innerContainerRef.current.style.height = height;
|
206
|
+
}
|
207
|
+
}, [getScrollableContainerHeight, innerContainerRef]);
|
201
208
|
return /*#__PURE__*/React__default.createElement(motion.div, {
|
202
209
|
ref: filterPanelRef,
|
203
210
|
className: cx(componentClass, "".concat(componentClass, "__container"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentClass, "--open"), panelOpen), "".concat(componentClass, "--batch"), showActionSet), "".concat(componentClass, "--instant"), !showActionSet)),
|
@@ -237,9 +244,7 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
237
244
|
size: "sm"
|
238
245
|
})))), /*#__PURE__*/React__default.createElement("div", {
|
239
246
|
className: "".concat(componentClass, "__inner-container"),
|
240
|
-
|
241
|
-
height: getScrollableContainerHeight()
|
242
|
-
},
|
247
|
+
ref: innerContainerRef,
|
243
248
|
onScroll: onInnerContainerScroll
|
244
249
|
}, filterSections.map(function (_ref2, index) {
|
245
250
|
var _ref2$categoryTitle = _ref2.categoryTitle,
|