@carbon/ibm-products 1.59.1 → 1.61.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +99 -45
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +4 -4
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +9 -3
- 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 +89 -30
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +89 -45
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- package/css/index.min.css.map +1 -1
- package/es/components/Datagrid/Datagrid/Datagrid.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridContent.js +10 -2
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -4
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +2 -2
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +13 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +3 -15
- package/es/components/Datagrid/Datagrid/DraggableElement.js +32 -135
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +14 -38
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +134 -45
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +7 -6
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +104 -18
- package/es/components/Datagrid/Datagrid/addons/Filtering/constants.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +37 -4
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +6 -12
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +0 -5
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +17 -5
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +4 -3
- package/es/components/Datagrid/useFiltering.js +4 -1
- package/es/components/Datagrid/useInlineEdit.js +1 -6
- package/es/components/Datagrid/useNestedRowExpander.js +22 -9
- package/es/components/Datagrid/useRowExpander.js +22 -9
- package/es/components/Datagrid/useSortableColumns.js +5 -4
- package/es/components/Datagrid/utils/getArgTypes.js +12 -0
- package/es/components/EmptyStates/EmptyState.js +1 -1
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
- package/es/components/EmptyStates/assets/ErrorIllustration.js +6 -11
- package/es/components/EmptyStates/assets/NoDataIllustration.js +6 -11
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +6 -12
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +6 -12
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +6 -12
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -12
- package/es/components/FilterSummary/FilterSummary.js +15 -5
- package/es/components/TagSet/TagSet.js +14 -10
- package/es/components/TagSet/TagSetOverflow.js +16 -5
- package/es/global/js/hooks/useWindowScroll.js +5 -0
- package/es/global/js/utils/getNodeTextContent.js +51 -0
- package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +9 -1
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -3
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +2 -2
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +13 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +3 -15
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +34 -140
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +17 -38
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +134 -52
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +7 -6
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +104 -24
- package/lib/components/Datagrid/Datagrid/addons/Filtering/constants.js +4 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +36 -3
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +6 -12
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +0 -5
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +15 -3
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +7 -3
- package/lib/components/Datagrid/useFiltering.js +4 -1
- package/lib/components/Datagrid/useInlineEdit.js +1 -6
- package/lib/components/Datagrid/useNestedRowExpander.js +24 -9
- package/lib/components/Datagrid/useRowExpander.js +24 -9
- package/lib/components/Datagrid/useSortableColumns.js +5 -4
- package/lib/components/Datagrid/utils/getArgTypes.js +12 -0
- package/lib/components/EmptyStates/EmptyState.js +1 -1
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +6 -11
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +6 -11
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +6 -12
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +6 -12
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +6 -12
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -12
- package/lib/components/FilterSummary/FilterSummary.js +15 -12
- package/lib/components/TagSet/TagSet.js +13 -9
- package/lib/components/TagSet/TagSetOverflow.js +16 -5
- package/lib/global/js/hooks/useWindowScroll.js +6 -0
- package/lib/global/js/utils/getNodeTextContent.js +59 -0
- package/package.json +8 -7
- package/scss/components/Datagrid/_datagrid.scss +2 -1
- package/scss/components/Datagrid/styles/_draggableElement.scss +44 -20
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +7 -11
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsTearsheet.scss +0 -1
- package/scss/components/Datagrid/styles/addons/_RowSizeDropdown.scss +42 -1
- package/scss/components/TagSet/_tag-set.scss +13 -3
- package/es/components/Datagrid/utils/getColTitle.js +0 -25
- package/lib/components/Datagrid/utils/getColTitle.js +0 -32
@@ -1,3 +1,6 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
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; }
|
3
|
+
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; }
|
1
4
|
/**
|
2
5
|
* Copyright IBM Corp. 2023, 2023
|
3
6
|
*
|
@@ -11,89 +14,175 @@ import { Checkbox } from 'carbon-components-react';
|
|
11
14
|
import { isColumnVisible } from './common';
|
12
15
|
import DraggableElement from '../../DraggableElement';
|
13
16
|
import { pkg } from '../../../../../settings';
|
14
|
-
import
|
17
|
+
import { getNodeTextContent } from '../../../../../global/js/utils/getNodeTextContent';
|
18
|
+
import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from '@dnd-kit/core';
|
19
|
+
import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
15
20
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
21
|
+
var matchedColsById = function matchedColsById(col1, col2) {
|
22
|
+
return col1 && col2 && col1.id === col2.id;
|
23
|
+
};
|
16
24
|
export var DraggableItemsList = function DraggableItemsList(_ref) {
|
17
25
|
var columns = _ref.columns,
|
18
26
|
filterString = _ref.filterString,
|
19
|
-
|
20
|
-
getNextIndex = _ref.getNextIndex,
|
27
|
+
id = _ref.id,
|
21
28
|
moveElement = _ref.moveElement,
|
22
29
|
onSelectColumn = _ref.onSelectColumn,
|
23
|
-
setAriaRegionText = _ref.setAriaRegionText
|
24
|
-
|
25
|
-
|
26
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, columns
|
30
|
+
setAriaRegionText = _ref.setAriaRegionText;
|
31
|
+
var draggableClass = "".concat(blockClass, "__draggable-item");
|
32
|
+
var visibleCols = columns
|
27
33
|
// hide the columns without Header, e.g the sticky actions, spacer
|
28
34
|
.filter(function (colDef) {
|
29
|
-
return
|
35
|
+
return getNodeTextContent(colDef.Header).trim().length !== 0;
|
30
36
|
}).filter(Boolean).filter(function (colDef) {
|
31
37
|
return !colDef.isAction;
|
32
38
|
}).filter(function (colDef) {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
39
|
+
return colDef.id !== 'spacer';
|
40
|
+
}).filter(function (colDef) {
|
41
|
+
return filterString.length === 0 || getNodeTextContent(colDef.Header).toLowerCase().includes(filterString);
|
42
|
+
});
|
43
|
+
|
44
|
+
// let localRefCopy;
|
45
|
+
var handleDragEnd = function handleDragEnd(event) {
|
46
|
+
var active = event.active,
|
47
|
+
over = event.over;
|
48
|
+
var fromVisibleIndex = columns.findIndex(function (col) {
|
49
|
+
return matchedColsById(col, active);
|
50
|
+
});
|
51
|
+
var toVisibleIndex = columns.findIndex(function (col) {
|
52
|
+
return matchedColsById(col, over);
|
53
|
+
});
|
54
|
+
var colTitle = getNodeTextContent(visibleCols[fromVisibleIndex].Header);
|
55
|
+
setAriaRegionText("".concat(colTitle, " dropped. New position ").concat(toVisibleIndex + 1, " of ").concat(visibleCols.length, "."));
|
56
|
+
var fromIndex = columns.findIndex(function (col) {
|
57
|
+
return matchedColsById(col, active);
|
58
|
+
});
|
59
|
+
var toIndex = columns.findIndex(function (col) {
|
60
|
+
return matchedColsById(col, over);
|
61
|
+
});
|
62
|
+
moveElement(fromIndex, toIndex);
|
63
|
+
};
|
64
|
+
var handleDragStart = function handleDragStart(event) {
|
65
|
+
var active = event.active;
|
66
|
+
var fromIndex = visibleCols.findIndex(function (col) {
|
67
|
+
return matchedColsById(col, active);
|
68
|
+
});
|
69
|
+
var colTitle = getNodeTextContent(visibleCols[fromIndex].Header);
|
70
|
+
setAriaRegionText("".concat(colTitle, " grabbed. Current position ").concat(fromIndex + 1, " of ").concat(visibleCols.length, "."));
|
71
|
+
};
|
72
|
+
var handleDragUpdate = function handleDragUpdate(event) {
|
73
|
+
var active = event.active,
|
74
|
+
over = event.over;
|
75
|
+
var fromIndex = visibleCols.findIndex(function (col) {
|
76
|
+
return matchedColsById(col, active);
|
77
|
+
});
|
78
|
+
var toIndex = visibleCols.findIndex(function (col) {
|
79
|
+
return matchedColsById(col, over);
|
80
|
+
});
|
81
|
+
var colTitle = getNodeTextContent(visibleCols[fromIndex].Header);
|
82
|
+
setAriaRegionText("".concat(colTitle, " grabbed. Original position ").concat(fromIndex + 1, ", new position ").concat(toIndex + 1, " of ").concat(visibleCols.length, "."));
|
83
|
+
};
|
84
|
+
var pointerSensor = useSensor(PointerSensor, {
|
85
|
+
// Require the mouse to move by 10 pixels before activating
|
86
|
+
activationConstraint: {
|
87
|
+
distance: 4
|
88
|
+
}
|
89
|
+
});
|
90
|
+
var keyboardSensor = useSensor(KeyboardSensor, {
|
91
|
+
coordinateGetter: function coordinateGetter(event, args) {
|
92
|
+
var currentCoordinates = args.currentCoordinates;
|
93
|
+
var target = event.target;
|
94
|
+
while (target && !target.classList.contains(draggableClass)) {
|
95
|
+
target = target.parentNode;
|
96
|
+
}
|
97
|
+
var delta = target.offsetHeight;
|
98
|
+
switch (event.code) {
|
99
|
+
case 'ArrowRight':
|
100
|
+
case 'ArrowLeft':
|
101
|
+
// ignore right and left
|
102
|
+
return currentCoordinates;
|
103
|
+
case 'ArrowUp':
|
104
|
+
return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
|
105
|
+
y: currentCoordinates.y - delta
|
106
|
+
});
|
107
|
+
case 'ArrowDown':
|
108
|
+
return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
|
109
|
+
y: currentCoordinates.y + delta
|
110
|
+
});
|
111
|
+
case 'Space':
|
112
|
+
break;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
});
|
116
|
+
var sensors = useSensors(pointerSensor, keyboardSensor);
|
117
|
+
var handleCheckboxKeydown = function handleCheckboxKeydown(event, colDef) {
|
118
|
+
if (event.code === 'Space') {
|
119
|
+
onSelectColumn(colDef, !isColumnVisible(colDef));
|
120
|
+
event.preventDefault();
|
121
|
+
event.stopPropagation();
|
122
|
+
return false;
|
123
|
+
}
|
124
|
+
};
|
125
|
+
return /*#__PURE__*/React.createElement(DndContext, {
|
126
|
+
collisionDetection: closestCenter,
|
127
|
+
onDragEnd: handleDragEnd,
|
128
|
+
onDragStart: handleDragStart,
|
129
|
+
onDragMove: handleDragUpdate,
|
130
|
+
sensors: sensors
|
131
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
132
|
+
className: "".concat(blockClass, "__draggable-underlay"),
|
133
|
+
"aria-hidden": "true",
|
134
|
+
key: "draggable-underlay-".concat(id)
|
135
|
+
}, visibleCols.map(function (colDef) {
|
136
|
+
return /*#__PURE__*/React.createElement("div", {
|
137
|
+
className: "".concat(blockClass, "__draggable-underlay-item"),
|
138
|
+
key: colDef.id
|
139
|
+
});
|
140
|
+
})), /*#__PURE__*/React.createElement(SortableContext, {
|
141
|
+
items: visibleCols,
|
142
|
+
strategy: verticalListSortingStrategy
|
143
|
+
}, visibleCols.map(function (colDef) {
|
144
|
+
var colHeaderTitle = getNodeTextContent(colDef.Header);
|
37
145
|
var searchString = new RegExp('(' + filterString + ')');
|
38
146
|
var res = filterString.length ? colHeaderTitle.toLowerCase().split(searchString) : null;
|
39
147
|
var firstWord = res !== null ? res[0] === '' ? res[1].charAt(0).toUpperCase() + res[1].substring(1) : res[0].charAt(0).toUpperCase() + res[0].substring(1) : null;
|
40
148
|
var highlightedText = res !== null ? res[0] === '' ? "<strong>".concat(firstWord, "</strong>") + res[2] : firstWord + "<strong>".concat(res[1], "</strong>") + res[2] : colHeaderTitle;
|
41
149
|
var isFrozenColumn = !!colDef.sticky;
|
42
150
|
var listContents = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Checkbox, {
|
43
|
-
wrapperClassName: "".concat(blockClass, "__customize-columns-checkbox-wrapper"),
|
44
151
|
checked: isColumnVisible(colDef),
|
45
152
|
disabled: isFrozenColumn,
|
46
|
-
onChange:
|
153
|
+
onChange: function onChange(checked) {
|
154
|
+
return onSelectColumn(colDef, checked);
|
155
|
+
},
|
47
156
|
id: "".concat(blockClass, "__customization-column-").concat(colDef.id),
|
48
157
|
labelText: colHeaderTitle,
|
49
158
|
title: colHeaderTitle,
|
50
159
|
className: "".concat(blockClass, "__customize-columns-checkbox"),
|
51
|
-
hideLabel: true
|
160
|
+
hideLabel: true,
|
161
|
+
onKeyDown: function onKeyDown(event) {
|
162
|
+
return handleCheckboxKeydown(event, colDef);
|
163
|
+
}
|
52
164
|
}), /*#__PURE__*/React.createElement("div", {
|
53
165
|
dangerouslySetInnerHTML: {
|
54
166
|
__html: highlightedText
|
55
|
-
}
|
167
|
+
},
|
168
|
+
className: "".concat(blockClass, "__customize-columns-checkbox-visible-label")
|
56
169
|
}));
|
57
170
|
return /*#__PURE__*/React.createElement(DraggableElement, {
|
171
|
+
classList: draggableClass,
|
58
172
|
key: colDef.id,
|
59
|
-
|
60
|
-
listData: columns,
|
61
|
-
setListData: setColumnsObject,
|
62
|
-
id: "dnd-datagrid-columns-".concat(colDef.id),
|
63
|
-
type: "column-customization",
|
173
|
+
id: colDef.id,
|
64
174
|
disabled: filterString.length > 0 || isFrozenColumn,
|
65
175
|
ariaLabel: colHeaderTitle,
|
66
|
-
onGrab: setAriaRegionText,
|
67
|
-
isFocused: focusIndex === i,
|
68
|
-
moveElement: moveElement,
|
69
|
-
onArrowKeyDown: function onArrowKeyDown(e, isGrabbed, currentIndex) {
|
70
|
-
if (isGrabbed) {
|
71
|
-
var _columns$nextIndex;
|
72
|
-
var nextIndex = getNextIndex(columns, currentIndex, e.key);
|
73
|
-
e.preventDefault();
|
74
|
-
e.stopPropagation();
|
75
|
-
if (nextIndex >= 0 && !((_columns$nextIndex = columns[nextIndex]) !== null && _columns$nextIndex !== void 0 && _columns$nextIndex.sticky)) {
|
76
|
-
setFocusIndex(nextIndex);
|
77
|
-
moveElement(currentIndex, nextIndex);
|
78
|
-
e.target.scrollIntoView({
|
79
|
-
block: 'center'
|
80
|
-
});
|
81
|
-
}
|
82
|
-
}
|
83
|
-
},
|
84
176
|
isSticky: isFrozenColumn,
|
85
177
|
selected: isColumnVisible(colDef)
|
86
178
|
}, listContents);
|
87
|
-
}));
|
179
|
+
}))));
|
88
180
|
};
|
89
181
|
DraggableItemsList.propTypes = {
|
90
182
|
columns: PropTypes.array.isRequired,
|
91
183
|
filterString: PropTypes.string.isRequired,
|
92
|
-
|
93
|
-
getNextIndex: PropTypes.func.isRequired,
|
184
|
+
id: PropTypes.string.isRequired,
|
94
185
|
moveElement: PropTypes.func.isRequired,
|
95
186
|
onSelectColumn: PropTypes.func.isRequired,
|
96
|
-
setAriaRegionText: PropTypes.func.isRequired
|
97
|
-
setColumnsObject: PropTypes.func.isRequired,
|
98
|
-
setFocusIndex: PropTypes.func.isRequired
|
187
|
+
setAriaRegionText: PropTypes.func.isRequired
|
99
188
|
};
|
@@ -61,13 +61,19 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
61
61
|
_useState2 = _slicedToArray(_useState, 2),
|
62
62
|
showDividerLine = _useState2[0],
|
63
63
|
setShowDividerLine = _useState2[1];
|
64
|
+
|
65
|
+
/** Context */
|
66
|
+
var _useContext = useContext(FilterContext),
|
67
|
+
panelOpen = _useContext.panelOpen,
|
68
|
+
setPanelOpen = _useContext.setPanelOpen;
|
64
69
|
var _useFilters = useFilters({
|
65
70
|
updateMethod: updateMethod,
|
66
71
|
filters: filterSections,
|
67
72
|
setAllFilters: setAllFilters,
|
68
73
|
variation: PANEL,
|
69
74
|
reactTableFiltersState: reactTableFiltersState,
|
70
|
-
onCancel: onCancel
|
75
|
+
onCancel: onCancel,
|
76
|
+
panelOpen: panelOpen
|
71
77
|
}),
|
72
78
|
filtersState = _useFilters.filtersState,
|
73
79
|
prevFiltersObjectArrayRef = _useFilters.prevFiltersObjectArrayRef,
|
@@ -99,11 +105,6 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
99
105
|
return updateMethod === BATCH;
|
100
106
|
}, [updateMethod]);
|
101
107
|
|
102
|
-
/** Context */
|
103
|
-
var _useContext = useContext(FilterContext),
|
104
|
-
panelOpen = _useContext.panelOpen,
|
105
|
-
setPanelOpen = _useContext.setPanelOpen;
|
106
|
-
|
107
108
|
/** Methods */
|
108
109
|
var closePanel = function closePanel() {
|
109
110
|
cancel();
|
@@ -1,13 +1,17 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
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
|
+
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; }
|
2
6
|
/**
|
3
|
-
* Copyright IBM Corp. 2022,
|
7
|
+
* Copyright IBM Corp. 2022, 2023
|
4
8
|
*
|
5
9
|
* This source code is licensed under the Apache-2.0 license found in the
|
6
10
|
* LICENSE file in the root directory of this source tree.
|
7
11
|
*/
|
8
12
|
import React, { createContext, useState } from 'react';
|
9
13
|
import PropTypes from 'prop-types';
|
10
|
-
import { DATE, DROPDOWN, NUMBER, RADIO, CHECKBOX } from './constants';
|
14
|
+
import { DATE, DROPDOWN, NUMBER, RADIO, CHECKBOX, CLEAR_SINGLE_FILTER } from './constants';
|
11
15
|
export var FilterContext = /*#__PURE__*/createContext();
|
12
16
|
var EventEmitter = {
|
13
17
|
events: {},
|
@@ -27,42 +31,123 @@ var EventEmitter = {
|
|
27
31
|
}
|
28
32
|
}
|
29
33
|
};
|
30
|
-
var
|
34
|
+
var removeFilterItem = function removeFilterItem(state, index) {
|
35
|
+
return state.splice(index, 1);
|
36
|
+
};
|
37
|
+
var updateFilterState = function updateFilterState(state, type, value) {
|
38
|
+
if (type === CHECKBOX) {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
if (type === DATE) {
|
42
|
+
var _filterTagIndex = state.findIndex(function (val) {
|
43
|
+
return formatDateRange(val.value[0], val.value[1]) === formatDateRange(value[0], value[1]);
|
44
|
+
});
|
45
|
+
return removeFilterItem(state, _filterTagIndex);
|
46
|
+
}
|
47
|
+
var filterTagIndex = state.findIndex(function (val) {
|
48
|
+
return val.value === value;
|
49
|
+
});
|
50
|
+
return removeFilterItem(state, filterTagIndex);
|
51
|
+
};
|
52
|
+
export var clearSingleFilter = function clearSingleFilter(_ref, setAllFilters, state) {
|
53
|
+
var key = _ref.key,
|
54
|
+
value = _ref.value;
|
55
|
+
var tempState = _toConsumableArray(state.filters);
|
56
|
+
tempState.forEach(function (f, filterIndex) {
|
57
|
+
if (f.id === key) {
|
58
|
+
var filterValues = f.value;
|
59
|
+
var filterType = f.type;
|
60
|
+
updateFilterState(tempState, filterType, value);
|
61
|
+
if (filterType === CHECKBOX) {
|
62
|
+
/**
|
63
|
+
When all checkboxes of a group are all unselected the value still exists in the filtersObjectArray
|
64
|
+
This checks if all the checkboxes are selected = false and removes it from the array
|
65
|
+
*/
|
66
|
+
var valueIndex = filterValues.findIndex(function (val) {
|
67
|
+
return val.id === value;
|
68
|
+
});
|
69
|
+
filterValues[valueIndex].selected = false;
|
70
|
+
var updatedFilterObject = _objectSpread(_objectSpread({}, f), {}, {
|
71
|
+
value: _toConsumableArray(filterValues)
|
72
|
+
});
|
73
|
+
tempState[filterIndex] = updatedFilterObject;
|
74
|
+
var index = tempState.findIndex(function (filter) {
|
75
|
+
return filter.id === key;
|
76
|
+
});
|
77
|
+
|
78
|
+
// If all the selected state is false remove from array
|
79
|
+
var shouldRemoveFromArray = tempState[index].value.every(function (val) {
|
80
|
+
return val.selected === false;
|
81
|
+
});
|
82
|
+
if (shouldRemoveFromArray) {
|
83
|
+
removeFilterItem(tempState, index);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
});
|
88
|
+
setAllFilters(tempState);
|
89
|
+
};
|
90
|
+
var handleSingleFilterRemoval = function handleSingleFilterRemoval(key, value) {
|
91
|
+
EventEmitter.dispatch(CLEAR_SINGLE_FILTER, {
|
92
|
+
key: key,
|
93
|
+
value: value
|
94
|
+
});
|
95
|
+
};
|
96
|
+
var formatDateRange = function formatDateRange(startDate, endDate) {
|
97
|
+
var startDateObj = new Date(startDate);
|
98
|
+
var endDateObj = new Date(endDate);
|
99
|
+
return "".concat(startDateObj.toLocaleDateString(), " - ").concat(endDateObj.toLocaleDateString());
|
100
|
+
};
|
101
|
+
var prepareFiltersForTags = function prepareFiltersForTags(filters, renderDateLabel) {
|
31
102
|
var tags = [];
|
32
|
-
filters.forEach(function (
|
33
|
-
var id =
|
34
|
-
type =
|
35
|
-
value =
|
103
|
+
filters.forEach(function (_ref2) {
|
104
|
+
var id = _ref2.id,
|
105
|
+
type = _ref2.type,
|
106
|
+
value = _ref2.value;
|
107
|
+
var sharedFilterProps = {
|
108
|
+
filter: true,
|
109
|
+
onClose: function onClose() {
|
110
|
+
return handleSingleFilterRemoval(id, value);
|
111
|
+
}
|
112
|
+
};
|
36
113
|
if (type === DROPDOWN || type === RADIO || type === NUMBER) {
|
37
|
-
tags.push({
|
114
|
+
tags.push(_objectSpread({
|
38
115
|
key: id,
|
39
116
|
value: value
|
40
|
-
});
|
117
|
+
}, sharedFilterProps));
|
41
118
|
} else if (type === DATE) {
|
119
|
+
var _renderDateLabel;
|
42
120
|
var _value = _slicedToArray(value, 2),
|
43
121
|
startDate = _value[0],
|
44
122
|
endDate = _value[1];
|
45
|
-
tags.push({
|
123
|
+
tags.push(_objectSpread({
|
46
124
|
key: id,
|
47
|
-
value:
|
48
|
-
});
|
125
|
+
value: (_renderDateLabel = renderDateLabel === null || renderDateLabel === void 0 ? void 0 : renderDateLabel(startDate, endDate)) !== null && _renderDateLabel !== void 0 ? _renderDateLabel : formatDateRange(startDate, endDate)
|
126
|
+
}, sharedFilterProps));
|
49
127
|
} else if (type === CHECKBOX) {
|
50
128
|
value.forEach(function (checkbox) {
|
51
129
|
if (checkbox.selected) {
|
52
|
-
tags.push({
|
130
|
+
tags.push(_objectSpread(_objectSpread({
|
53
131
|
key: id,
|
54
132
|
value: checkbox.value
|
55
|
-
})
|
133
|
+
}, sharedFilterProps), {}, {
|
134
|
+
onClose: function onClose() {
|
135
|
+
return handleSingleFilterRemoval(id, checkbox.value);
|
136
|
+
}
|
137
|
+
}));
|
56
138
|
}
|
57
139
|
});
|
58
140
|
}
|
59
141
|
});
|
60
142
|
return tags;
|
61
143
|
};
|
62
|
-
export var FilterProvider = function FilterProvider(
|
63
|
-
var children =
|
64
|
-
filters =
|
65
|
-
|
144
|
+
export var FilterProvider = function FilterProvider(_ref3) {
|
145
|
+
var children = _ref3.children,
|
146
|
+
filters = _ref3.filters,
|
147
|
+
filterProps = _ref3.filterProps;
|
148
|
+
var _ref4 = filterProps || {},
|
149
|
+
renderDateLabel = _ref4.renderDateLabel;
|
150
|
+
var filterTags = prepareFiltersForTags(filters, renderDateLabel);
|
66
151
|
var _useState = useState(false),
|
67
152
|
_useState2 = _slicedToArray(_useState, 2),
|
68
153
|
panelOpen = _useState2[0],
|
@@ -79,5 +164,6 @@ export var FilterProvider = function FilterProvider(_ref2) {
|
|
79
164
|
};
|
80
165
|
FilterProvider.propTypes = {
|
81
166
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
167
|
+
filterProps: PropTypes.object,
|
82
168
|
filters: PropTypes.arrayOf(PropTypes.object).isRequired
|
83
169
|
};
|
@@ -11,10 +11,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
11
11
|
* US Government Users Restricted Rights - Use, duplication or disclosure
|
12
12
|
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
13
13
|
*/
|
14
|
-
import React, { useState, useRef, useEffect } from 'react';
|
14
|
+
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
15
15
|
import { Checkbox, DatePicker, DatePickerInput, Dropdown, FormGroup, NumberInput, RadioButton, RadioButtonGroup } from 'carbon-components-react';
|
16
16
|
import { INSTANT, BATCH, DATE, CHECKBOX, NUMBER, RADIO, DROPDOWN, PANEL } from '../constants';
|
17
17
|
import { getInitialStateFromFilters } from '../utils';
|
18
|
+
import { usePreviousValue } from '../../../../../../global/js/hooks';
|
18
19
|
var useFilters = function useFilters(_ref) {
|
19
20
|
var updateMethod = _ref.updateMethod,
|
20
21
|
_ref$filters = _ref.filters,
|
@@ -23,7 +24,8 @@ var useFilters = function useFilters(_ref) {
|
|
23
24
|
variation = _ref.variation,
|
24
25
|
reactTableFiltersState = _ref.reactTableFiltersState,
|
25
26
|
_ref$onCancel = _ref.onCancel,
|
26
|
-
onCancel = _ref$onCancel === void 0 ? function () {} : _ref$onCancel
|
27
|
+
onCancel = _ref$onCancel === void 0 ? function () {} : _ref$onCancel,
|
28
|
+
panelOpen = _ref.panelOpen;
|
27
29
|
/** State */
|
28
30
|
var _useState = useState(getInitialStateFromFilters(filters, variation, reactTableFiltersState)),
|
29
31
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -33,11 +35,17 @@ var useFilters = function useFilters(_ref) {
|
|
33
35
|
_useState4 = _slicedToArray(_useState3, 2),
|
34
36
|
filtersObjectArray = _useState4[0],
|
35
37
|
setFiltersObjectArray = _useState4[1];
|
38
|
+
var previousState = usePreviousValue({
|
39
|
+
panelOpen: panelOpen
|
40
|
+
});
|
36
41
|
|
37
42
|
// When using batch actions we have to store the filters to then apply them later
|
38
43
|
var prevFiltersRef = useRef(JSON.stringify(filtersState));
|
39
44
|
var lastAppliedFilters = useRef(JSON.stringify(reactTableFiltersState));
|
40
45
|
var prevFiltersObjectArrayRef = useRef(JSON.stringify(filtersObjectArray));
|
46
|
+
var holdingPrevFiltersRef = useRef();
|
47
|
+
var holdingLastAppliedFiltersRef = useRef([]);
|
48
|
+
var holdingPrevFiltersObjectArrayRef = useRef([]);
|
41
49
|
|
42
50
|
/** Methods */
|
43
51
|
// If the user decides to cancel or click outside the flyout, it reverts back to the filters that were
|
@@ -46,8 +54,14 @@ var useFilters = function useFilters(_ref) {
|
|
46
54
|
setFiltersState(JSON.parse(prevFiltersRef.current));
|
47
55
|
setFiltersObjectArray(JSON.parse(prevFiltersObjectArrayRef.current));
|
48
56
|
setAllFilters(JSON.parse(lastAppliedFilters.current));
|
57
|
+
|
58
|
+
// Set the temp prev refs, these will be used to populate the prev values once the
|
59
|
+
// panel opens again
|
60
|
+
holdingPrevFiltersRef.current = JSON.parse(prevFiltersRef.current);
|
61
|
+
holdingLastAppliedFiltersRef.current = JSON.parse(prevFiltersObjectArrayRef.current);
|
62
|
+
holdingPrevFiltersObjectArrayRef.current = JSON.parse(lastAppliedFilters.current);
|
49
63
|
};
|
50
|
-
var reset = function
|
64
|
+
var reset = useCallback(function () {
|
51
65
|
// When we reset we want the "initialFilters" to be an empty array
|
52
66
|
var resetFiltersArray = [];
|
53
67
|
|
@@ -63,7 +77,7 @@ var useFilters = function useFilters(_ref) {
|
|
63
77
|
// Update their respective refs so everything is in sync
|
64
78
|
prevFiltersRef.current = JSON.stringify(initialFiltersState);
|
65
79
|
prevFiltersObjectArrayRef.current = JSON.stringify(initialFiltersObjectArray);
|
66
|
-
};
|
80
|
+
}, [filters, setAllFilters, variation]);
|
67
81
|
var applyFilters = function applyFilters(_ref2) {
|
68
82
|
var column = _ref2.column,
|
69
83
|
value = _ref2.value,
|
@@ -291,6 +305,25 @@ var useFilters = function useFilters(_ref) {
|
|
291
305
|
key: column
|
292
306
|
}, filter);
|
293
307
|
};
|
308
|
+
|
309
|
+
/** This useEffect will properly handle the previous filters when the panel closes
|
310
|
+
* 1. If the panel closes we need to call the reset fn but also store the
|
311
|
+
* previous filters in a (new) temporary place.
|
312
|
+
* 2. When the panel opens again, take the values from the temporary place
|
313
|
+
* and populate the filter state with them
|
314
|
+
*/
|
315
|
+
useEffect(function () {
|
316
|
+
if (!panelOpen && previousState !== null && previousState !== void 0 && previousState.panelOpen) {
|
317
|
+
setAllFilters(holdingLastAppliedFiltersRef.current);
|
318
|
+
}
|
319
|
+
if (panelOpen && !(previousState !== null && previousState !== void 0 && previousState.panelOpen)) {
|
320
|
+
if (holdingPrevFiltersRef.current && holdingLastAppliedFiltersRef.current && holdingPrevFiltersObjectArrayRef.current) {
|
321
|
+
setFiltersState(holdingPrevFiltersRef.current);
|
322
|
+
setFiltersObjectArray(holdingLastAppliedFiltersRef.current);
|
323
|
+
setAllFilters(JSON.parse(prevFiltersObjectArrayRef.current));
|
324
|
+
}
|
325
|
+
}
|
326
|
+
}, [panelOpen, previousState, previousState === null || previousState === void 0 ? void 0 : previousState.panelOpen, reset, setAllFilters]);
|
294
327
|
var cancel = function cancel() {
|
295
328
|
// Reverting to previous filters only applies when using batch actions
|
296
329
|
if (updateMethod === BATCH) {
|
package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
-
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
2
|
+
/**
|
3
|
+
* Copyright IBM Corp. 2022, 2023
|
4
|
+
*
|
5
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
8
7
|
*/
|
9
8
|
|
10
9
|
import React from 'react';
|
@@ -22,12 +21,9 @@ export var InlineEditButton = function InlineEditButton(_ref) {
|
|
22
21
|
nonEditCell = _ref.nonEditCell,
|
23
22
|
isActiveCell = _ref.isActiveCell,
|
24
23
|
columnConfig = _ref.columnConfig,
|
25
|
-
totalInlineEditColumns = _ref.totalInlineEditColumns,
|
26
|
-
totalColumns = _ref.totalColumns,
|
27
24
|
type = _ref.type;
|
28
|
-
var inlineEditColsLessThanHalfOfTotal = totalInlineEditColumns < totalColumns / 2;
|
29
25
|
return /*#__PURE__*/React.createElement("div", {
|
30
|
-
className: cx("".concat(blockClass, "__inline-edit-button"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--disabled"), disabled || nonEditCell), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--with-label-icon"), LabelIcon), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--non-edit"), nonEditCell), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--active"), isActiveCell), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--
|
26
|
+
className: cx("".concat(blockClass, "__inline-edit-button"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--disabled"), disabled || nonEditCell), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--with-label-icon"), LabelIcon), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--non-edit"), nonEditCell), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--active"), isActiveCell), _defineProperty(_cx, "".concat(blockClass, "__inline-edit-button--").concat(type), type === 'date' || type === 'selection'), _cx)),
|
31
27
|
tabIndex: isActiveCell ? 0 : -1,
|
32
28
|
"data-disabled": disabled || nonEditCell,
|
33
29
|
"aria-disabled": disabled || nonEditCell,
|
@@ -52,8 +48,6 @@ InlineEditButton.propTypes = {
|
|
52
48
|
nonEditCell: PropTypes.bool,
|
53
49
|
placeholder: PropTypes.string,
|
54
50
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
55
|
-
totalColumns: PropTypes.number,
|
56
|
-
totalInlineEditColumns: PropTypes.number,
|
57
51
|
type: PropTypes.oneOf(['text', 'number', 'selection', 'date']),
|
58
52
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|
59
53
|
};
|
@@ -32,14 +32,12 @@ export var InlineEditCell = function InlineEditCell(_ref) {
|
|
32
32
|
tabIndex = _ref.tabIndex,
|
33
33
|
value = _ref.value,
|
34
34
|
nonEditCell = _ref.nonEditCell,
|
35
|
-
totalInlineEditColumns = _ref.totalInlineEditColumns,
|
36
35
|
type = _ref.type;
|
37
36
|
var columnId = cell.column.id;
|
38
37
|
var columnIndex = instance.columns.findIndex(function (col) {
|
39
38
|
return col.id === columnId;
|
40
39
|
});
|
41
40
|
var cellId = "column-".concat(columnIndex, "-row-").concat(cell.row.index);
|
42
|
-
var totalColumns = instance.columns.length;
|
43
41
|
var _useContext = useContext(InlineEditContext),
|
44
42
|
state = _useContext.state,
|
45
43
|
dispatch = _useContext.dispatch;
|
@@ -442,8 +440,6 @@ export var InlineEditCell = function InlineEditCell(_ref) {
|
|
442
440
|
tabIndex: tabIndex,
|
443
441
|
nonEditCell: nonEditCell,
|
444
442
|
columnConfig: cell.column,
|
445
|
-
totalInlineEditColumns: totalInlineEditColumns,
|
446
|
-
totalColumns: totalColumns,
|
447
443
|
type: type
|
448
444
|
}), !nonEditCell && inEditMode && cellId === activeCellId && /*#__PURE__*/React.createElement(React.Fragment, null, type === 'text' && renderTextInput(), type === 'number' && renderNumberInput(), type === 'selection' && renderSelectCell(), type === 'date' && renderDateCell()))
|
449
445
|
);
|
@@ -461,7 +457,6 @@ InlineEditCell.propTypes = {
|
|
461
457
|
nonEditCell: PropTypes.bool,
|
462
458
|
placeholder: PropTypes.string,
|
463
459
|
tabIndex: PropTypes.number,
|
464
|
-
totalInlineEditColumns: PropTypes.number,
|
465
460
|
type: PropTypes.oneOf(['text', 'number', 'selection', 'date']),
|
466
461
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.object])
|
467
462
|
};
|
@@ -10,23 +10,31 @@ var _excluded = ["legendText"];
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
11
11
|
*/
|
12
12
|
|
13
|
-
import React, { useRef, useState } from 'react';
|
13
|
+
import React, { useRef, useState, useEffect } from 'react';
|
14
14
|
import PropTypes from 'prop-types';
|
15
15
|
import { Settings16 } from '@carbon/icons-react';
|
16
16
|
import { Button } from 'carbon-components-react';
|
17
17
|
import cx from 'classnames';
|
18
18
|
import RowSizeRadioGroup from './RowSizeRadioGroup';
|
19
|
-
import { pkg } from '../../../../../settings';
|
19
|
+
import { pkg, carbon } from '../../../../../settings';
|
20
20
|
var blockClass = "".concat(pkg.prefix, "--datagrid__row-size");
|
21
21
|
var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
22
22
|
var _ref$legendText = _ref.legendText,
|
23
|
-
legendText = _ref$legendText === void 0 ? 'Row
|
23
|
+
legendText = _ref$legendText === void 0 ? 'Row settings' : _ref$legendText,
|
24
24
|
props = _objectWithoutProperties(_ref, _excluded);
|
25
25
|
var buttonRef = useRef(null);
|
26
|
+
var radioGroupRef = useRef();
|
26
27
|
var _useState = useState(false),
|
27
28
|
_useState2 = _slicedToArray(_useState, 2),
|
28
29
|
isOpen = _useState2[0],
|
29
30
|
setIsOpen = _useState2[1];
|
31
|
+
useEffect(function () {
|
32
|
+
if (isOpen) {
|
33
|
+
var radioGroupParentElement = radioGroupRef === null || radioGroupRef === void 0 ? void 0 : radioGroupRef.current;
|
34
|
+
var checkedRadioChild = radioGroupParentElement === null || radioGroupParentElement === void 0 ? void 0 : radioGroupParentElement.querySelector(".".concat(carbon.prefix, "--radio-button:checked"));
|
35
|
+
checkedRadioChild === null || checkedRadioChild === void 0 ? void 0 : checkedRadioChild.focus();
|
36
|
+
}
|
37
|
+
}, [isOpen]);
|
30
38
|
var onCloseHandler = function onCloseHandler() {
|
31
39
|
setIsOpen(false);
|
32
40
|
};
|
@@ -36,7 +44,9 @@ var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
|
36
44
|
}
|
37
45
|
};
|
38
46
|
var onClickHandler = function onClickHandler() {
|
39
|
-
setIsOpen(
|
47
|
+
setIsOpen(function (prev) {
|
48
|
+
return !prev;
|
49
|
+
});
|
40
50
|
};
|
41
51
|
var onKeyHandler = function onKeyHandler(e) {
|
42
52
|
if (e.key === 'Escape') {
|
@@ -59,7 +69,9 @@ var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
|
59
69
|
iconDescription: legendText,
|
60
70
|
className: cx("".concat(blockClass, "-button"), _defineProperty({}, "".concat(blockClass, "-button--open"), isOpen)),
|
61
71
|
onClick: onClickHandler
|
62
|
-
}), isOpen && /*#__PURE__*/React.createElement(RowSizeRadioGroup, _extends({
|
72
|
+
}), isOpen && /*#__PURE__*/React.createElement(RowSizeRadioGroup, _extends({
|
73
|
+
ref: radioGroupRef
|
74
|
+
}, props, {
|
63
75
|
legendText: legendText,
|
64
76
|
buttonRef: buttonRef
|
65
77
|
})));
|