@carbon/ibm-products 2.20.0 → 2.22.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +8 -5
- package/css/index-full-carbon.css +548 -253
- 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 +208 -177
- 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 +252 -189
- 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 +233 -193
- 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/ActionSet/ActionSet.js +3 -4
- package/es/components/AddSelect/AddSelectBody.js +2 -2
- package/es/components/AddSelect/AddSelectRow.js +2 -2
- package/es/components/Card/Card.js +1 -2
- package/es/components/Card/CardHeader.js +1 -2
- package/es/components/CreateFullPage/CreateFullPageStep.js +1 -2
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +1 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +1 -2
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -2
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +1 -2
- package/es/components/Datagrid/Datagrid/DatagridContent.js +10 -10
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -11
- package/es/components/Datagrid/Datagrid/DatagridRow.js +15 -11
- package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +21 -11
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +22 -12
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +31 -74
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +2 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/utils.js +1 -5
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +2 -3
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +2 -2
- package/es/components/Datagrid/useActionsColumn.js +1 -2
- package/es/components/Datagrid/useDefaultStringRenderer.js +1 -2
- package/es/components/Datagrid/useFiltering.js +1 -0
- package/es/components/Datagrid/useNestedRowExpander.js +1 -2
- package/es/components/Datagrid/useNestedRows.js +49 -33
- package/es/components/Datagrid/useOnRowClick.js +1 -1
- package/es/components/Datagrid/useRowIsMouseOver.js +3 -1
- package/es/components/Datagrid/useSelectRows.js +1 -2
- package/es/components/Datagrid/useSortableColumns.js +1 -2
- package/es/components/Datagrid/useStickyColumn.js +3 -4
- package/es/components/Datagrid/utils/filterPropsForTesting.js +149 -0
- package/es/components/DelimitedList/DelimitedList.docs-page.js +15 -0
- package/es/components/DelimitedList/DelimitedList.js +73 -0
- package/es/components/DelimitedList/index.js +8 -0
- package/es/components/EditInPlace/EditInPlace.js +1 -2
- package/es/components/EditTearsheet/EditTearsheetForm.js +1 -2
- package/es/components/FilterSummary/FilterSummary.js +15 -12
- package/es/components/NotificationsPanel/NotificationsPanel.js +2 -3
- package/es/components/PageHeader/PageHeader.js +9 -11
- package/es/components/Saving/Saving.js +6 -6
- package/es/components/SidePanel/SidePanel.js +147 -191
- package/es/components/TagSet/TagSet.js +21 -5
- package/es/components/TagSet/TagSetOverflow.js +14 -10
- package/es/components/Tearsheet/Tearsheet.js +5 -0
- package/es/components/Tearsheet/TearsheetNarrow.js +5 -0
- package/es/components/Tearsheet/TearsheetShell.js +9 -9
- package/es/components/WebTerminal/WebTerminal.js +1 -2
- package/es/components/index.js +2 -1
- package/es/global/js/hooks/useResizeObserver.js +5 -2
- package/es/global/js/package-settings.js +1 -0
- package/lib/components/ActionSet/ActionSet.js +3 -4
- package/lib/components/AddSelect/AddSelectBody.js +2 -2
- package/lib/components/AddSelect/AddSelectRow.js +2 -2
- package/lib/components/Card/Card.js +1 -2
- package/lib/components/Card/CardHeader.js +1 -2
- package/lib/components/CreateFullPage/CreateFullPageStep.js +1 -2
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +1 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +1 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +1 -2
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +10 -10
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -11
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +15 -11
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +21 -11
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +22 -12
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +31 -74
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +2 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/utils.js +1 -5
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +2 -3
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +2 -2
- package/lib/components/Datagrid/useActionsColumn.js +1 -2
- package/lib/components/Datagrid/useDefaultStringRenderer.js +1 -2
- package/lib/components/Datagrid/useFiltering.js +1 -0
- package/lib/components/Datagrid/useNestedRowExpander.js +1 -2
- package/lib/components/Datagrid/useNestedRows.js +49 -33
- package/lib/components/Datagrid/useOnRowClick.js +1 -1
- package/lib/components/Datagrid/useRowIsMouseOver.js +3 -1
- package/lib/components/Datagrid/useSelectRows.js +1 -2
- package/lib/components/Datagrid/useSortableColumns.js +1 -2
- package/lib/components/Datagrid/useStickyColumn.js +3 -4
- package/lib/components/Datagrid/utils/filterPropsForTesting.js +156 -0
- package/lib/components/DelimitedList/DelimitedList.docs-page.js +25 -0
- package/lib/components/DelimitedList/DelimitedList.js +78 -0
- package/lib/components/DelimitedList/index.js +12 -0
- package/lib/components/EditInPlace/EditInPlace.js +1 -2
- package/lib/components/EditTearsheet/EditTearsheetForm.js +1 -2
- package/lib/components/FilterSummary/FilterSummary.js +15 -12
- package/lib/components/NotificationsPanel/NotificationsPanel.js +2 -3
- package/lib/components/PageHeader/PageHeader.js +9 -11
- package/lib/components/Saving/Saving.js +6 -6
- package/lib/components/SidePanel/SidePanel.js +147 -191
- package/lib/components/TagSet/TagSet.js +21 -5
- package/lib/components/TagSet/TagSetOverflow.js +13 -9
- package/lib/components/Tearsheet/Tearsheet.js +5 -0
- package/lib/components/Tearsheet/TearsheetNarrow.js +5 -0
- package/lib/components/Tearsheet/TearsheetShell.js +9 -9
- package/lib/components/WebTerminal/WebTerminal.js +1 -2
- package/lib/components/index.js +8 -1
- package/lib/global/js/hooks/useResizeObserver.js +5 -2
- package/lib/global/js/package-settings.js +1 -0
- package/package.json +9 -8
- package/scss/components/Datagrid/_datagrid.scss +4 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +9 -1
- package/scss/components/Datagrid/styles/_useStickyColumn.scss +2 -0
- package/scss/components/DelimitedList/_carbon-imports.scss +9 -0
- package/scss/components/DelimitedList/_delimited-list.scss +27 -0
- package/scss/components/DelimitedList/_index-with-carbon.scss +9 -0
- package/scss/components/DelimitedList/_index.scss +8 -0
- package/scss/components/Saving/_saving.scss +6 -0
- package/scss/components/SidePanel/_side-panel-variables.scss +5 -1
- package/scss/components/SidePanel/_side-panel.scss +158 -186
- package/scss/components/TagSet/_tag-set.scss +4 -1
- package/scss/components/_index-with-carbon.scss +1 -0
- package/scss/components/_index.scss +1 -0
- package/telemetry.yml +790 -0
@@ -168,7 +168,6 @@ export var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
168
168
|
onClick: handleSelectAllClick,
|
169
169
|
className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__th--select-all"), _defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header'))
|
170
170
|
}, "\xA0")), headerGroup.headers.map(function (column, index) {
|
171
|
-
var _cx2;
|
172
171
|
var selectedHeader = checkSelectedHeaderCell(index, selectionAreas, 'column', rows);
|
173
172
|
return /*#__PURE__*/React.createElement("div", _extends({
|
174
173
|
key: "column_".concat(index),
|
@@ -188,7 +187,7 @@ export var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
188
187
|
height: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight,
|
189
188
|
width: (column === null || column === void 0 ? void 0 : column.width) || (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.width)
|
190
189
|
},
|
191
|
-
className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), (
|
190
|
+
className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === index || checkActiveHeaderCell(index, selectionAreas, 'column')), "".concat(blockClass, "__th--selected-header"), selectedHeader), "".concat(blockClass, "__th--selected-header-reorder-active"), selectedHeaderReorderActive)),
|
192
191
|
type: "button"
|
193
192
|
}, column.render('Header')));
|
194
193
|
}));
|
@@ -29,7 +29,6 @@ import { clearSingleFilter } from './addons/Filtering/FilterProvider';
|
|
29
29
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
30
30
|
var gcClass = "".concat(blockClass, "__grid-container");
|
31
31
|
export var DatagridContent = function DatagridContent(_ref) {
|
32
|
-
var _cx5;
|
33
32
|
var datagridState = _ref.datagridState,
|
34
33
|
title = _ref.title;
|
35
34
|
var _useContext = useContext(InlineEditContext),
|
@@ -86,7 +85,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
86
85
|
});
|
87
86
|
var renderTable = function renderTable() {
|
88
87
|
var _getTableProps;
|
89
|
-
return /*#__PURE__*/React.createElement(Table, _extends({}, getTableProps(), {
|
88
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Table, _extends({}, getTableProps(), {
|
90
89
|
className: cx(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), _defineProperty({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), _defineProperty({}, "".concat(blockClass, "__table-grid-active"), gridActive), _defineProperty({}, "".concat(blockClass, "__table-is-resizing"), typeof columnResizing.isResizingColumn === 'string'), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
|
91
90
|
role: withInlineEdit ? 'grid' : undefined,
|
92
91
|
tabIndex: withInlineEdit ? 0 : -1,
|
@@ -107,7 +106,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
107
106
|
title: title
|
108
107
|
}), !withVirtualScroll && /*#__PURE__*/React.createElement(DatagridHead, datagridState), /*#__PURE__*/React.createElement(DatagridBody, _extends({}, datagridState, {
|
109
108
|
rows: contentRows
|
110
|
-
})));
|
109
|
+
}))), (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && renderPagination());
|
111
110
|
};
|
112
111
|
var _useMultipleKeyTracki = useMultipleKeyTracking({
|
113
112
|
ref: withInlineEdit ? multiKeyTrackingRef : null,
|
@@ -132,8 +131,6 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
132
131
|
useSubscribeToEventEmitter(CLEAR_SINGLE_FILTER, function (id) {
|
133
132
|
return clearSingleFilter(id, setAllFilters, state);
|
134
133
|
});
|
135
|
-
|
136
|
-
/* istanbul ignore next */
|
137
134
|
var renderFilterSummary = function renderFilterSummary() {
|
138
135
|
return state.filters.length > 0 && /*#__PURE__*/React.createElement(FilterSummary, {
|
139
136
|
className: "".concat(blockClass, "__filter-summary"),
|
@@ -145,16 +142,19 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
145
142
|
overflowType: "tag"
|
146
143
|
});
|
147
144
|
};
|
145
|
+
var renderPagination = function renderPagination() {
|
146
|
+
if ((contentRows === null || contentRows === void 0 ? void 0 : contentRows.length) > 0 && !isFetching && DatagridPagination) {
|
147
|
+
return /*#__PURE__*/React.createElement(DatagridPagination, datagridState);
|
148
|
+
}
|
149
|
+
};
|
148
150
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableContainer, {
|
149
|
-
className: cx("".concat(gcClass), (
|
151
|
+
className: cx("".concat(gcClass), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(gcClass, "-active"), gridActive), "".concat(gcClass, "-active--without-toolbar"), withInlineEdit && !DatagridActions), "".concat(gcClass, "-inline-edit"), withInlineEdit), "".concat(blockClass, "__full-height"), withVirtualScroll || fullHeightDatagrid), "".concat(blockClass, "__with-pagination"), DatagridPagination), "".concat(blockClass, "__dense-header"), useDenseHeader)),
|
150
152
|
title: gridTitle,
|
151
153
|
description: gridDescription
|
152
154
|
}, /*#__PURE__*/React.createElement(DatagridToolbar, datagridState), /*#__PURE__*/React.createElement("div", {
|
153
155
|
className: cx("".concat(blockClass, "__table-container"), _defineProperty({}, "".concat(blockClass, "__table-container--filter-open"), panelOpen)),
|
154
156
|
ref: gridAreaRef
|
155
|
-
}, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/React.createElement(FilterPanel, _extends({
|
156
|
-
updateMethod: "batch"
|
157
|
-
}, getFilterFlyoutProps(), {
|
157
|
+
}, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/React.createElement(FilterPanel, _extends({}, getFilterFlyoutProps(), {
|
158
158
|
title: filterProps.panelTitle,
|
159
159
|
filterSections: filterProps.sections,
|
160
160
|
autoHideFilters: filterProps.autoHideFilters,
|
@@ -166,7 +166,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
166
166
|
}, renderTable()) : withVirtualScroll ? /*#__PURE__*/React.createElement("div", {
|
167
167
|
className: "".concat(blockClass, "__virtualScrollContainer"),
|
168
168
|
ref: gridRef
|
169
|
-
}, renderTable()) : renderTable()))), (
|
169
|
+
}, renderTable()) : renderTable()))), (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) !== 'panel' && renderPagination(), CustomizeColumnsTearsheet && /*#__PURE__*/React.createElement(CustomizeColumnsTearsheet, {
|
170
170
|
instance: datagridState
|
171
171
|
}));
|
172
172
|
};
|
@@ -46,6 +46,7 @@ var ResizeHeader = function ResizeHeader(_ref) {
|
|
46
46
|
dispatch = _ref.dispatch,
|
47
47
|
onColResizeEnd = _ref.onColResizeEnd,
|
48
48
|
resizerAriaLabel = _ref.resizerAriaLabel;
|
49
|
+
// eslint-disable-next-line no-unused-vars
|
49
50
|
var role = resizerProps.role,
|
50
51
|
headerProps = _objectWithoutProperties(resizerProps, _excluded);
|
51
52
|
var mouseDownHandler = function mouseDownHandler(evt) {
|
@@ -71,9 +72,7 @@ var ResizeHeader = function ResizeHeader(_ref) {
|
|
71
72
|
var keyUpHandler = function keyUpHandler() {
|
72
73
|
handleColumnResizeEndEvent(dispatch, onColResizeEnd, header.id, true);
|
73
74
|
};
|
74
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({}, headerProps,
|
75
|
-
role: role
|
76
|
-
}, {
|
75
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({}, headerProps, {
|
77
76
|
onMouseDown: mouseDownHandler,
|
78
77
|
onKeyDown: keyDownHandler,
|
79
78
|
onKeyUp: keyUpHandler,
|
@@ -128,16 +127,14 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
128
127
|
headerGroupClassName = _headerGroup$getHeade.className,
|
129
128
|
role = _headerGroup$getHeade.role,
|
130
129
|
headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded2);
|
131
|
-
return /*#__PURE__*/React.createElement(TableRow, _extends({}, headerGroupProps,
|
132
|
-
role: role
|
133
|
-
}, {
|
130
|
+
return /*#__PURE__*/React.createElement(TableRow, _extends({}, headerGroupProps, {
|
134
131
|
className: cx("".concat(blockClass, "__head"), headerGroupClassName),
|
135
132
|
ref: headRef
|
136
133
|
}), datagridState.headers.filter(function (_ref3) {
|
137
134
|
var isVisible = _ref3.isVisible;
|
138
135
|
return isVisible;
|
139
136
|
}).map(function (header, index) {
|
140
|
-
var _header$getResizerPro
|
137
|
+
var _header$getResizerPro;
|
141
138
|
if (header.id === selectionColumnId) {
|
142
139
|
// render directly without the wrapper TableHeader
|
143
140
|
return header.render('Header', {
|
@@ -160,12 +157,10 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
160
157
|
headerProps = _objectWithoutProperties(_header$getHeaderProp, _excluded3);
|
161
158
|
var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
|
162
159
|
return /*#__PURE__*/React.createElement(TableHeader, _extends({}, headerProps, {
|
163
|
-
className: cx(headerClassName, (
|
160
|
+
className: cx(headerClassName, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header.isSorted), "".concat(blockClass, "__header-actions-column"), header.isAction)),
|
164
161
|
key: header.id,
|
165
162
|
"aria-hidden": header.id === 'spacer' && 'true'
|
166
|
-
}, getAccessibilityProps(header),
|
167
|
-
role: role
|
168
|
-
}), header.render('Header'), resizerProps && !header.isAction && /*#__PURE__*/React.createElement(ResizeHeader, {
|
163
|
+
}, getAccessibilityProps(header)), header.render('Header'), resizerProps && !header.isAction && /*#__PURE__*/React.createElement(ResizeHeader, {
|
169
164
|
resizerProps: resizerProps,
|
170
165
|
header: header,
|
171
166
|
handleOnMouseDownResize: handleOnMouseDownResize,
|
@@ -29,14 +29,15 @@ var rowHeights = {
|
|
29
29
|
|
30
30
|
// eslint-disable-next-line react/prop-types
|
31
31
|
var DatagridRow = function DatagridRow(datagridState) {
|
32
|
-
var _cx;
|
33
32
|
var row = datagridState.row,
|
34
33
|
rowSize = datagridState.rowSize,
|
35
34
|
withNestedRows = datagridState.withNestedRows,
|
36
35
|
prepareRow = datagridState.prepareRow,
|
37
36
|
key = datagridState.key,
|
38
37
|
tableId = datagridState.tableId,
|
39
|
-
withExpandedRows = datagridState.withExpandedRows
|
38
|
+
withExpandedRows = datagridState.withExpandedRows,
|
39
|
+
withMouseHover = datagridState.withMouseHover,
|
40
|
+
setMouseOverRowIndex = datagridState.setMouseOverRowIndex;
|
40
41
|
var getVisibleNestedRowCount = function getVisibleNestedRowCount(_ref) {
|
41
42
|
var isExpanded = _ref.isExpanded,
|
42
43
|
subRows = _ref.subRows;
|
@@ -81,6 +82,9 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
81
82
|
return null;
|
82
83
|
};
|
83
84
|
var handleMouseLeave = function handleMouseLeave(event) {
|
85
|
+
if (withMouseHover) {
|
86
|
+
setMouseOverRowIndex(null);
|
87
|
+
}
|
84
88
|
var hoverRow = event.target.closest(".".concat(blockClass, "__carbon-row-expanded"));
|
85
89
|
hoverRow === null || hoverRow === void 0 || hoverRow.classList.remove("".concat(blockClass, "__carbon-row-expanded-hover-active"));
|
86
90
|
};
|
@@ -93,7 +97,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
93
97
|
hoverHandler(event);
|
94
98
|
}
|
95
99
|
};
|
96
|
-
var rowClassNames = cx("".concat(blockClass, "__carbon-row"), (
|
100
|
+
var rowClassNames = cx("".concat(blockClass, "__carbon-row"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), "".concat(blockClass, "__carbon-row-expandable"), row.canExpand), "".concat(carbon.prefix, "--data-table--selected"), row.isSelected));
|
97
101
|
var setAdditionalRowProps = function setAdditionalRowProps() {
|
98
102
|
if (withNestedRows || withExpandedRows) {
|
99
103
|
return {
|
@@ -102,6 +106,8 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
102
106
|
}
|
103
107
|
return {};
|
104
108
|
};
|
109
|
+
|
110
|
+
// eslint-disable-next-line no-unused-vars
|
105
111
|
var _row$getRowProps = row.getRowProps(),
|
106
112
|
role = _row$getRowProps.role,
|
107
113
|
rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
|
@@ -116,11 +122,10 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
116
122
|
onFocus: hoverHandler,
|
117
123
|
onBlur: focusRemover,
|
118
124
|
onKeyUp: handleOnKeyUp
|
119
|
-
}, setAdditionalRowProps(),
|
120
|
-
|
121
|
-
}), row.cells.map(function (cell, index) {
|
122
|
-
var _cell$column;
|
125
|
+
}, setAdditionalRowProps()), row.cells.map(function (cell, index) {
|
126
|
+
var _cell$column, _content$props;
|
123
127
|
var cellProps = cell.getCellProps();
|
128
|
+
// eslint-disable-next-line no-unused-vars
|
124
129
|
var children = cellProps.children,
|
125
130
|
role = cellProps.role,
|
126
131
|
restProps = _objectWithoutProperties(cellProps, _excluded2);
|
@@ -131,13 +136,12 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
131
136
|
key: cell.column.id
|
132
137
|
});
|
133
138
|
}
|
139
|
+
var title = content === null || content === void 0 || (_content$props = content.props) === null || _content$props === void 0 || (_content$props = _content$props.children[0]) === null || _content$props === void 0 || (_content$props = _content$props.props) === null || _content$props === void 0 ? void 0 : _content$props.value;
|
134
140
|
return /*#__PURE__*/React.createElement(TableCell, _extends({
|
135
141
|
className: cx("".concat(blockClass, "__cell"), _defineProperty({}, "".concat(blockClass, "__expandable-row-cell"), row.canExpand && index === 0))
|
136
142
|
}, restProps, {
|
137
|
-
key: cell.column.id
|
138
|
-
|
139
|
-
}, role === 'cell' && {
|
140
|
-
role: role
|
143
|
+
key: cell.column.id,
|
144
|
+
title: title
|
141
145
|
}), content);
|
142
146
|
})), renderExpandedRow());
|
143
147
|
};
|
@@ -17,7 +17,6 @@ import { CSS } from '@dnd-kit/utilities';
|
|
17
17
|
import { useSortable } from '@dnd-kit/sortable';
|
18
18
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
19
19
|
var DraggableElement = function DraggableElement(_ref) {
|
20
|
-
var _cx;
|
21
20
|
var id = _ref.id,
|
22
21
|
children = _ref.children,
|
23
22
|
classList = _ref.classList,
|
@@ -49,7 +48,7 @@ var DraggableElement = function DraggableElement(_ref) {
|
|
49
48
|
transition: transition
|
50
49
|
};
|
51
50
|
return /*#__PURE__*/React.createElement("li", _extends({
|
52
|
-
className: cx(classList, "".concat(blockClass, "__draggable-handleHolder"), (
|
51
|
+
className: cx(classList, "".concat(blockClass, "__draggable-handleHolder"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__draggable-handleHolder--selected"), selected), "".concat(blockClass, "__draggable-handleHolder--sticky"), isSticky), "".concat(blockClass, "__draggable-handleHolder--dragging"), isDragging)),
|
53
52
|
id: id,
|
54
53
|
ref: setNodeRef,
|
55
54
|
style: style
|
@@ -21,18 +21,22 @@ import { useSubscribeToEventEmitter, useFilters, useShouldDisableButtons } from
|
|
21
21
|
import { px, breakpoints } from '@carbon/layout';
|
22
22
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
23
23
|
var componentClass = "".concat(blockClass, "-filter-flyout");
|
24
|
+
var defaults = {
|
25
|
+
flyoutIconDescription: 'Open filters',
|
26
|
+
title: 'Filter',
|
27
|
+
primaryActionLabel: 'Apply',
|
28
|
+
secondaryActionLabel: 'Cancel'
|
29
|
+
};
|
24
30
|
var FilterFlyout = function FilterFlyout(_ref) {
|
25
|
-
var
|
26
|
-
var _ref$updateMethod = _ref.updateMethod,
|
27
|
-
updateMethod = _ref$updateMethod === void 0 ? BATCH : _ref$updateMethod,
|
31
|
+
var updateMethod = _ref.updateMethod,
|
28
32
|
_ref$flyoutIconDescri = _ref.flyoutIconDescription,
|
29
|
-
flyoutIconDescription = _ref$flyoutIconDescri === void 0 ?
|
33
|
+
flyoutIconDescription = _ref$flyoutIconDescri === void 0 ? defaults.flyoutIconDescription : _ref$flyoutIconDescri,
|
30
34
|
_ref$filters = _ref.filters,
|
31
35
|
filters = _ref$filters === void 0 ? [] : _ref$filters,
|
32
36
|
_ref$title = _ref.title,
|
33
|
-
title = _ref$title === void 0 ?
|
37
|
+
title = _ref$title === void 0 ? defaults.title : _ref$title,
|
34
38
|
_ref$primaryActionLab = _ref.primaryActionLabel,
|
35
|
-
primaryActionLabel = _ref$primaryActionLab === void 0 ?
|
39
|
+
primaryActionLabel = _ref$primaryActionLab === void 0 ? defaults.primaryActionLabel : _ref$primaryActionLab,
|
36
40
|
_ref$onFlyoutOpen = _ref.onFlyoutOpen,
|
37
41
|
onFlyoutOpen = _ref$onFlyoutOpen === void 0 ? function () {} : _ref$onFlyoutOpen,
|
38
42
|
_ref$onFlyoutClose = _ref.onFlyoutClose,
|
@@ -42,7 +46,7 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
42
46
|
_ref$onCancel = _ref.onCancel,
|
43
47
|
onCancel = _ref$onCancel === void 0 ? function () {} : _ref$onCancel,
|
44
48
|
_ref$secondaryActionL = _ref.secondaryActionLabel,
|
45
|
-
secondaryActionLabel = _ref$secondaryActionL === void 0 ?
|
49
|
+
secondaryActionLabel = _ref$secondaryActionL === void 0 ? defaults.secondaryActionLabel : _ref$secondaryActionL,
|
46
50
|
setAllFilters = _ref.setAllFilters,
|
47
51
|
_ref$data = _ref.data,
|
48
52
|
data = _ref$data === void 0 ? [] : _ref$data,
|
@@ -57,13 +61,17 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
57
61
|
_useState4 = _slicedToArray(_useState3, 2),
|
58
62
|
stackedLayout = _useState4[0],
|
59
63
|
setStackedLayout = _useState4[1];
|
64
|
+
var handleCancel = function handleCancel() {
|
65
|
+
setOpen(false);
|
66
|
+
onCancel();
|
67
|
+
};
|
60
68
|
var _useFilters = useFilters({
|
61
69
|
updateMethod: updateMethod,
|
62
70
|
filters: filters,
|
63
71
|
setAllFilters: setAllFilters,
|
64
72
|
variation: FLYOUT,
|
65
73
|
reactTableFiltersState: reactTableFiltersState,
|
66
|
-
onCancel:
|
74
|
+
onCancel: handleCancel
|
67
75
|
}),
|
68
76
|
filtersState = _useFilters.filtersState,
|
69
77
|
prevFiltersObjectArrayRef = _useFilters.prevFiltersObjectArrayRef,
|
@@ -90,6 +98,9 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
90
98
|
_useShouldDisableButt2 = _slicedToArray(_useShouldDisableButt, 2),
|
91
99
|
shouldDisableButtons = _useShouldDisableButt2[0],
|
92
100
|
setShouldDisableButtons = _useShouldDisableButt2[1];
|
101
|
+
|
102
|
+
// Skip resize testing
|
103
|
+
/* istanbul ignore next */
|
93
104
|
var handleResize = function handleResize(current) {
|
94
105
|
var filterFlyoutRefPosition = flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current.getBoundingClientRect();
|
95
106
|
var originalFlyoutWidth = parseInt(window.getComputedStyle(flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current).getPropertyValue('width'));
|
@@ -170,8 +181,7 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
170
181
|
kind: 'secondary',
|
171
182
|
label: secondaryActionLabel,
|
172
183
|
onClick: cancel,
|
173
|
-
isExpressive: false
|
174
|
-
disabled: shouldDisableButtons
|
184
|
+
isExpressive: false
|
175
185
|
}],
|
176
186
|
size: "md",
|
177
187
|
buttonSize: "md"
|
@@ -203,7 +213,7 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
203
213
|
className: cx("".concat(componentClass, "__trigger"), _defineProperty({}, "".concat(componentClass, "__trigger--open"), open)),
|
204
214
|
disabled: data.length === 0
|
205
215
|
}, /*#__PURE__*/React.createElement(Filter, null)), /*#__PURE__*/React.createElement("div", {
|
206
|
-
className: cx(componentClass, (
|
216
|
+
className: cx(componentClass, _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentClass, "--open"), open), "".concat(componentClass, "--batch"), showActionSet), "".concat(componentClass, "--instant"), !showActionSet)),
|
207
217
|
ref: flyoutInnerRef
|
208
218
|
}, /*#__PURE__*/React.createElement("div", {
|
209
219
|
className: "".concat(componentClass, "__inner-container")
|
@@ -26,14 +26,20 @@ import { rem } from '@carbon/layout';
|
|
26
26
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
27
27
|
export var componentClass = "".concat(blockClass, "-filter-panel");
|
28
28
|
var MotionActionSet = motion(ActionSet);
|
29
|
+
var defaults = {
|
30
|
+
title: 'Filter',
|
31
|
+
closeIconDescription: 'Close filter panel',
|
32
|
+
primaryActionLabel: 'Apply',
|
33
|
+
secondaryActionLabel: 'Cancel',
|
34
|
+
searchLabelText: 'Filter search',
|
35
|
+
searchPlaceholder: 'Find filters'
|
36
|
+
};
|
29
37
|
var FilterPanel = function FilterPanel(_ref) {
|
30
|
-
var _cx;
|
31
38
|
var _ref$title = _ref.title,
|
32
|
-
title = _ref$title === void 0 ?
|
39
|
+
title = _ref$title === void 0 ? defaults.title : _ref$title,
|
33
40
|
_ref$closeIconDescrip = _ref.closeIconDescription,
|
34
|
-
closeIconDescription = _ref$closeIconDescrip === void 0 ?
|
35
|
-
|
36
|
-
updateMethod = _ref$updateMethod === void 0 ? BATCH : _ref$updateMethod,
|
41
|
+
closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
|
42
|
+
updateMethod = _ref.updateMethod,
|
37
43
|
filterSections = _ref.filterSections,
|
38
44
|
setAllFilters = _ref.setAllFilters,
|
39
45
|
_ref$onApply = _ref.onApply,
|
@@ -49,13 +55,13 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
49
55
|
_ref$filterPanelMinHe = _ref.filterPanelMinHeight,
|
50
56
|
filterPanelMinHeight = _ref$filterPanelMinHe === void 0 ? 600 : _ref$filterPanelMinHe,
|
51
57
|
_ref$primaryActionLab = _ref.primaryActionLabel,
|
52
|
-
primaryActionLabel = _ref$primaryActionLab === void 0 ?
|
58
|
+
primaryActionLabel = _ref$primaryActionLab === void 0 ? defaults.primaryActionLabel : _ref$primaryActionLab,
|
53
59
|
_ref$secondaryActionL = _ref.secondaryActionLabel,
|
54
|
-
secondaryActionLabel = _ref$secondaryActionL === void 0 ?
|
60
|
+
secondaryActionLabel = _ref$secondaryActionL === void 0 ? defaults.secondaryActionLabel : _ref$secondaryActionL,
|
55
61
|
_ref$searchLabelText = _ref.searchLabelText,
|
56
|
-
searchLabelText = _ref$searchLabelText === void 0 ?
|
62
|
+
searchLabelText = _ref$searchLabelText === void 0 ? defaults.searchLabelText : _ref$searchLabelText,
|
57
63
|
_ref$searchPlaceholde = _ref.searchPlaceholder,
|
58
|
-
searchPlaceholder = _ref$searchPlaceholde === void 0 ?
|
64
|
+
searchPlaceholder = _ref$searchPlaceholde === void 0 ? defaults.searchPlaceholder : _ref$searchPlaceholde,
|
59
65
|
_ref$reactTableFilter = _ref.reactTableFiltersState,
|
60
66
|
reactTableFiltersState = _ref$reactTableFilter === void 0 ? [] : _ref$reactTableFilter,
|
61
67
|
_ref$autoHideFilters = _ref.autoHideFilters,
|
@@ -180,12 +186,13 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
180
186
|
var filterHeadingHeight = (_filterHeadingRef$cur = filterHeadingRef.current) === null || _filterHeadingRef$cur === void 0 ? void 0 : _filterHeadingRef$cur.getBoundingClientRect().height;
|
181
187
|
var filterSearchHeight = (_filterSearchRef$curr = filterSearchRef.current) === null || _filterSearchRef$curr === void 0 ? void 0 : _filterSearchRef$curr.getBoundingClientRect().height;
|
182
188
|
var actionSetHeight = (_actionSetRef$current = actionSetRef.current) === null || _actionSetRef$current === void 0 ? void 0 : _actionSetRef$current.getBoundingClientRect().height;
|
183
|
-
var height = "calc(100vh - ".concat(filterHeadingHeight, "px - ").concat(
|
189
|
+
var height = panelOpen ? "calc(100vh - ".concat(filterHeadingHeight, "px - ").concat( /* istanbul ignore next */
|
190
|
+
showFilterSearch ? filterSearchHeight : 0, "px - ").concat(updateMethod === BATCH ? actionSetHeight : 0, "px)") : 0;
|
184
191
|
return height;
|
185
192
|
};
|
186
193
|
return /*#__PURE__*/React.createElement(motion.div, {
|
187
194
|
ref: filterPanelRef,
|
188
|
-
className: cx(componentClass, "".concat(componentClass, "__container"), (
|
195
|
+
className: cx(componentClass, "".concat(componentClass, "__container"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentClass, "--open"), panelOpen), "".concat(componentClass, "--batch"), showActionSet), "".concat(componentClass, "--instant"), !showActionSet)),
|
189
196
|
initial: false,
|
190
197
|
animate: panelOpen ? 'visible' : 'hidden',
|
191
198
|
custom: shouldReduceMotion,
|
@@ -210,7 +217,10 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
210
217
|
tooltipPosition: "bottom",
|
211
218
|
tooltipAlignment: "end",
|
212
219
|
onClick: closePanel
|
213
|
-
}), showFilterSearch &&
|
220
|
+
}), showFilterSearch &&
|
221
|
+
/*#__PURE__*/
|
222
|
+
/* istanbul ignore next */
|
223
|
+
React.createElement("div", {
|
214
224
|
ref: filterSearchRef,
|
215
225
|
className: "".concat(componentClass, "__search")
|
216
226
|
}, /*#__PURE__*/React.createElement(Layer, null, /*#__PURE__*/React.createElement(Search, {
|
@@ -50,8 +50,7 @@ var useFilters = function useFilters(_ref2) {
|
|
50
50
|
setAllFilters = _ref2.setAllFilters,
|
51
51
|
variation = _ref2.variation,
|
52
52
|
reactTableFiltersState = _ref2.reactTableFiltersState,
|
53
|
-
|
54
|
-
onCancel = _ref2$onCancel === void 0 ? function () {} : _ref2$onCancel,
|
53
|
+
onCancel = _ref2.onCancel,
|
55
54
|
panelOpen = _ref2.panelOpen,
|
56
55
|
autoHideFilters = _ref2.autoHideFilters,
|
57
56
|
isFetching = _ref2.isFetching;
|
@@ -120,9 +119,9 @@ var useFilters = function useFilters(_ref2) {
|
|
120
119
|
if (type === DATE && value.length > 0 && !value[1]) {
|
121
120
|
return;
|
122
121
|
}
|
123
|
-
var
|
122
|
+
var filterCopy = _toConsumableArray(filtersObjectArray);
|
124
123
|
// // check if the filter already exists in the array
|
125
|
-
var filter =
|
124
|
+
var filter = filterCopy.find(function (item) {
|
126
125
|
return item.id === column;
|
127
126
|
});
|
128
127
|
|
@@ -130,81 +129,39 @@ var useFilters = function useFilters(_ref2) {
|
|
130
129
|
if (filter) {
|
131
130
|
filter.value = value;
|
132
131
|
} else {
|
133
|
-
|
132
|
+
filterCopy.push({
|
134
133
|
id: column,
|
135
134
|
value: value,
|
136
135
|
type: type
|
137
136
|
});
|
138
137
|
}
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
});
|
154
|
-
if (shouldRemoveFromArray) {
|
155
|
-
filtersObjectArrayCopy.splice(index, 1);
|
156
|
-
}
|
157
|
-
} else if (type === DATE) {
|
158
|
-
if (value.length === 0) {
|
159
|
-
/**
|
160
|
-
Checks to see if the date value is an empty array, if it is that means the user wants
|
161
|
-
to reset the date filter
|
162
|
-
*/
|
163
|
-
var _index = filtersObjectArrayCopy.findIndex(function (filter) {
|
164
|
-
return filter.id === column;
|
165
|
-
});
|
166
|
-
|
167
|
-
// Remove it from the filters array since there is nothing to filter
|
168
|
-
filtersObjectArrayCopy.splice(_index, 1);
|
169
|
-
}
|
170
|
-
} else if (type === DROPDOWN || type === RADIO) {
|
171
|
-
if (value === 'Any') {
|
172
|
-
/**
|
173
|
-
Checks to see if the selected value is 'Any', that means the user wants
|
174
|
-
to reset specific filter
|
175
|
-
*/
|
176
|
-
var _index2 = filtersObjectArrayCopy.findIndex(function (filter) {
|
177
|
-
return filter.id === column;
|
178
|
-
});
|
179
|
-
|
180
|
-
// Remove it from the filters array
|
181
|
-
filtersObjectArrayCopy.splice(_index2, 1);
|
182
|
-
}
|
183
|
-
} else if (type === NUMBER) {
|
184
|
-
// If the value is empty remove it from the filtersObjectArray
|
185
|
-
if (value === '') {
|
186
|
-
// Find the column that uses number and displays an empty string
|
187
|
-
var _index3 = filtersObjectArrayCopy.findIndex(function (filter) {
|
188
|
-
return filter.id === column;
|
189
|
-
});
|
190
|
-
|
191
|
-
// Remove it from the filters array
|
192
|
-
filtersObjectArrayCopy.splice(_index3, 1);
|
193
|
-
}
|
138
|
+
var index = filterCopy.findIndex(function (_ref4) {
|
139
|
+
var id = _ref4.id;
|
140
|
+
return id === column;
|
141
|
+
});
|
142
|
+
var clearCheckbox = type === CHECKBOX && filterCopy[index].value.every(function (_ref5) {
|
143
|
+
var selected = _ref5.selected;
|
144
|
+
return selected === false;
|
145
|
+
});
|
146
|
+
var clearDate = type === DATE && value.length === 0;
|
147
|
+
var clearAny = (type === DROPDOWN || type === RADIO) && value === 'Any';
|
148
|
+
var clearNum = type === NUMBER && value === '';
|
149
|
+
var shouldClear = clearCheckbox || clearDate || clearAny || clearNum;
|
150
|
+
if (shouldClear) {
|
151
|
+
filterCopy.splice(index, 1);
|
194
152
|
}
|
195
|
-
setFiltersObjectArray(
|
196
|
-
|
197
|
-
// // Automatically apply the filters if the updateMethod is instant
|
153
|
+
setFiltersObjectArray(filterCopy);
|
198
154
|
if (updateMethod === INSTANT) {
|
199
|
-
setAllFilters(
|
155
|
+
setAllFilters(filterCopy);
|
200
156
|
}
|
201
157
|
};
|
158
|
+
|
202
159
|
/** Render the individual filter component */
|
203
|
-
var renderFilter = function renderFilter(
|
160
|
+
var renderFilter = function renderFilter(_ref6) {
|
204
161
|
var _filtersState$column3, _filtersState$column4;
|
205
|
-
var type =
|
206
|
-
column =
|
207
|
-
components =
|
162
|
+
var type = _ref6.type,
|
163
|
+
column = _ref6.column,
|
164
|
+
components = _ref6.props;
|
208
165
|
var filter;
|
209
166
|
var isPanel = variation === PANEL;
|
210
167
|
if (!type) {
|
@@ -225,8 +182,8 @@ var useFilters = function useFilters(_ref2) {
|
|
225
182
|
return /*#__PURE__*/React.createElement(Checkbox, _extends({
|
226
183
|
key: option.id
|
227
184
|
}, option, {
|
228
|
-
onChange: function onChange(_,
|
229
|
-
var checked =
|
185
|
+
onChange: function onChange(_, _ref7) {
|
186
|
+
var checked = _ref7.checked;
|
230
187
|
handleCheckboxChange({
|
231
188
|
checked: checked,
|
232
189
|
filtersState: filtersState,
|
@@ -317,9 +274,9 @@ var useFilters = function useFilters(_ref2) {
|
|
317
274
|
labelText: (_components$DefaultRa5 = components === null || components === void 0 || (_components$DefaultRa6 = components.DefaultRadioButton) === null || _components$DefaultRa6 === void 0 ? void 0 : _components$DefaultRa6.labelText) !== null && _components$DefaultRa5 !== void 0 ? _components$DefaultRa5 : 'Any',
|
318
275
|
value: (_components$DefaultRa7 = components === null || components === void 0 || (_components$DefaultRa8 = components.DefaultRadioButton) === null || _components$DefaultRa8 === void 0 ? void 0 : _components$DefaultRa8.value) !== null && _components$DefaultRa7 !== void 0 ? _components$DefaultRa7 : 'Any'
|
319
276
|
}, components.DefaultRadioButton)), components.RadioButton.map(function (radio) {
|
320
|
-
var
|
277
|
+
var _ref8, _radio$id;
|
321
278
|
return /*#__PURE__*/React.createElement(RadioButton, _extends({
|
322
|
-
key: (
|
279
|
+
key: (_ref8 = (_radio$id = radio.id) !== null && _radio$id !== void 0 ? _radio$id : radio.labelText) !== null && _ref8 !== void 0 ? _ref8 : radio.value
|
323
280
|
}, radio));
|
324
281
|
})));
|
325
282
|
}
|
@@ -328,9 +285,9 @@ var useFilters = function useFilters(_ref2) {
|
|
328
285
|
filter = /*#__PURE__*/React.createElement(Dropdown, _extends({}, components.Dropdown, {
|
329
286
|
selectedItem: ((_filtersState$column3 = filtersState[column]) === null || _filtersState$column3 === void 0 ? void 0 : _filtersState$column3.value) === '' ? 'Any' : (_filtersState$column4 = filtersState[column]) === null || _filtersState$column4 === void 0 ? void 0 : _filtersState$column4.value,
|
330
287
|
items: ['Any'].concat(_toConsumableArray(components.Dropdown.items)),
|
331
|
-
onChange: function onChange(
|
288
|
+
onChange: function onChange(_ref9) {
|
332
289
|
var _components$Dropdown$, _components$Dropdown;
|
333
|
-
var selectedItem =
|
290
|
+
var selectedItem = _ref9.selectedItem;
|
334
291
|
setFiltersState(_objectSpread(_objectSpread({}, filtersState), {}, _defineProperty({}, column, {
|
335
292
|
value: selectedItem,
|
336
293
|
type: type
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
2
|
/**
|
3
|
-
* Copyright IBM Corp. 2023,
|
3
|
+
* Copyright IBM Corp. 2023, 2024
|
4
4
|
*
|
5
5
|
* This source code is licensed under the Apache-2.0 license found in the
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
@@ -18,8 +18,7 @@ import isEqual from 'lodash/isEqual';
|
|
18
18
|
* @returns {Array} returns a tuple of the state and setter function
|
19
19
|
*/
|
20
20
|
var useShouldDisableButtons = function useShouldDisableButtons(_ref) {
|
21
|
-
var
|
22
|
-
initialValue = _ref$initialValue === void 0 ? true : _ref$initialValue,
|
21
|
+
var initialValue = _ref.initialValue,
|
23
22
|
filtersState = _ref.filtersState,
|
24
23
|
prevFiltersRef = _ref.prevFiltersRef;
|
25
24
|
var _useState = useState(initialValue),
|
@@ -23,9 +23,7 @@ var applyInitialFilters = function applyInitialFilters(filterState, initialFilte
|
|
23
23
|
};
|
24
24
|
|
25
25
|
// This functions takes the filters passed in and makes an object to track it's state
|
26
|
-
export var getInitialStateFromFilters = function getInitialStateFromFilters(filters) {
|
27
|
-
var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FLYOUT;
|
28
|
-
var initialFilters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
26
|
+
export var getInitialStateFromFilters = function getInitialStateFromFilters(filters, variation, initialFilters) {
|
29
27
|
var initialFilterState = {};
|
30
28
|
var setInitialState = function setInitialState(_ref) {
|
31
29
|
var type = _ref.type,
|
@@ -80,8 +78,6 @@ export var getInitialStateFromFilters = function getInitialStateFromFilters(filt
|
|
80
78
|
return setInitialState(filter);
|
81
79
|
});
|
82
80
|
});
|
83
|
-
} else {
|
84
|
-
console.error('No variation passed into useInitialStateFromFilters');
|
85
81
|
}
|
86
82
|
if (initialFilters.length > 0) {
|
87
83
|
applyInitialFilters(initialFilterState, initialFilters);
|
package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js
CHANGED
@@ -12,7 +12,6 @@ import PropTypes from 'prop-types';
|
|
12
12
|
import { pkg } from '../../../../../../settings';
|
13
13
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
14
14
|
export var InlineEditButton = function InlineEditButton(_ref) {
|
15
|
-
var _cx, _cx2;
|
16
15
|
var label = _ref.label,
|
17
16
|
Icon = _ref.renderIcon,
|
18
17
|
disabled = _ref.disabled,
|
@@ -23,7 +22,7 @@ export var InlineEditButton = function InlineEditButton(_ref) {
|
|
23
22
|
columnConfig = _ref.columnConfig,
|
24
23
|
type = _ref.type;
|
25
24
|
return /*#__PURE__*/React.createElement("div", {
|
26
|
-
className: cx("".concat(blockClass, "__inline-edit-button"), (
|
25
|
+
className: cx("".concat(blockClass, "__inline-edit-button"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__inline-edit-button--disabled"), disabled || nonEditCell), "".concat(blockClass, "__inline-edit-button--with-label-icon"), LabelIcon), "".concat(blockClass, "__inline-edit-button--non-edit"), nonEditCell), "".concat(blockClass, "__inline-edit-button--active"), isActiveCell), "".concat(blockClass, "__inline-edit-button--").concat(type), type === 'date' || type === 'selection')),
|
27
26
|
tabIndex: isActiveCell ? 0 : -1,
|
28
27
|
"data-disabled": disabled || nonEditCell,
|
29
28
|
"aria-disabled": disabled || nonEditCell,
|
@@ -32,7 +31,7 @@ export var InlineEditButton = function InlineEditButton(_ref) {
|
|
32
31
|
}, LabelIcon && /*#__PURE__*/React.createElement("div", {
|
33
32
|
className: "".concat(blockClass, "__label-icon")
|
34
33
|
}, /*#__PURE__*/React.createElement(LabelIcon, null)), label !== '' ? /*#__PURE__*/React.createElement("span", {
|
35
|
-
className: cx("".concat(blockClass, "__inline-edit-button-label"), (
|
34
|
+
className: cx("".concat(blockClass, "__inline-edit-button-label"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__inline-edit-button-label-with-icon"), !nonEditCell), "".concat(blockClass, "__defaultStringRenderer--multiline"), columnConfig === null || columnConfig === void 0 ? void 0 : columnConfig.multiLineWrap))
|
36
35
|
}, label) : /*#__PURE__*/React.createElement("span", {
|
37
36
|
className: "".concat(blockClass, "__placeholder")
|
38
37
|
}, placeholder), !nonEditCell && Icon && /*#__PURE__*/React.createElement("div", {
|