@carbon/ibm-products 2.20.0 → 2.21.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +19 -4
- 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 +11 -2
- 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 +12 -3
- 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 +2 -7
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -11
- package/es/components/Datagrid/Datagrid/DatagridRow.js +9 -10
- package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +15 -8
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +22 -12
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +1 -2
- 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/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/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 +6 -6
- package/es/components/TagSet/TagSetOverflow.js +1 -2
- 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/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 +2 -7
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -11
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +9 -10
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +15 -8
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +22 -12
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +1 -2
- 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/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/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 +6 -6
- package/lib/components/TagSet/TagSetOverflow.js +1 -2
- 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/package.json +4 -4
- package/scss/components/Saving/_saving.scss +6 -0
- package/scss/components/SidePanel/_side-panel.scss +5 -1
- package/scss/components/TagSet/_tag-set.scss +4 -1
@@ -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),
|
@@ -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"),
|
@@ -146,15 +143,13 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
146
143
|
});
|
147
144
|
};
|
148
145
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableContainer, {
|
149
|
-
className: cx("".concat(gcClass), (
|
146
|
+
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
147
|
title: gridTitle,
|
151
148
|
description: gridDescription
|
152
149
|
}, /*#__PURE__*/React.createElement(DatagridToolbar, datagridState), /*#__PURE__*/React.createElement("div", {
|
153
150
|
className: cx("".concat(blockClass, "__table-container"), _defineProperty({}, "".concat(blockClass, "__table-container--filter-open"), panelOpen)),
|
154
151
|
ref: gridAreaRef
|
155
|
-
}, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/React.createElement(FilterPanel, _extends({
|
156
|
-
updateMethod: "batch"
|
157
|
-
}, getFilterFlyoutProps(), {
|
152
|
+
}, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/React.createElement(FilterPanel, _extends({}, getFilterFlyoutProps(), {
|
158
153
|
title: filterProps.panelTitle,
|
159
154
|
filterSections: filterProps.sections,
|
160
155
|
autoHideFilters: filterProps.autoHideFilters,
|
@@ -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,7 +29,6 @@ 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,
|
@@ -93,7 +92,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
93
92
|
hoverHandler(event);
|
94
93
|
}
|
95
94
|
};
|
96
|
-
var rowClassNames = cx("".concat(blockClass, "__carbon-row"), (
|
95
|
+
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
96
|
var setAdditionalRowProps = function setAdditionalRowProps() {
|
98
97
|
if (withNestedRows || withExpandedRows) {
|
99
98
|
return {
|
@@ -102,6 +101,8 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
102
101
|
}
|
103
102
|
return {};
|
104
103
|
};
|
104
|
+
|
105
|
+
// eslint-disable-next-line no-unused-vars
|
105
106
|
var _row$getRowProps = row.getRowProps(),
|
106
107
|
role = _row$getRowProps.role,
|
107
108
|
rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
|
@@ -116,11 +117,10 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
116
117
|
onFocus: hoverHandler,
|
117
118
|
onBlur: focusRemover,
|
118
119
|
onKeyUp: handleOnKeyUp
|
119
|
-
}, setAdditionalRowProps(),
|
120
|
-
|
121
|
-
}), row.cells.map(function (cell, index) {
|
122
|
-
var _cell$column;
|
120
|
+
}, setAdditionalRowProps()), row.cells.map(function (cell, index) {
|
121
|
+
var _cell$column, _content$props;
|
123
122
|
var cellProps = cell.getCellProps();
|
123
|
+
// eslint-disable-next-line no-unused-vars
|
124
124
|
var children = cellProps.children,
|
125
125
|
role = cellProps.role,
|
126
126
|
restProps = _objectWithoutProperties(cellProps, _excluded2);
|
@@ -131,13 +131,12 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
131
131
|
key: cell.column.id
|
132
132
|
});
|
133
133
|
}
|
134
|
+
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
135
|
return /*#__PURE__*/React.createElement(TableCell, _extends({
|
135
136
|
className: cx("".concat(blockClass, "__cell"), _defineProperty({}, "".concat(blockClass, "__expandable-row-cell"), row.canExpand && index === 0))
|
136
137
|
}, restProps, {
|
137
|
-
key: cell.column.id
|
138
|
-
|
139
|
-
}, role === 'cell' && {
|
140
|
-
role: role
|
138
|
+
key: cell.column.id,
|
139
|
+
title: title
|
141
140
|
}), content);
|
142
141
|
})), renderExpandedRow());
|
143
142
|
};
|
@@ -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,
|
@@ -90,6 +94,9 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
90
94
|
_useShouldDisableButt2 = _slicedToArray(_useShouldDisableButt, 2),
|
91
95
|
shouldDisableButtons = _useShouldDisableButt2[0],
|
92
96
|
setShouldDisableButtons = _useShouldDisableButt2[1];
|
97
|
+
|
98
|
+
// Skip resize testing
|
99
|
+
/* istanbul ignore next */
|
93
100
|
var handleResize = function handleResize(current) {
|
94
101
|
var filterFlyoutRefPosition = flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current.getBoundingClientRect();
|
95
102
|
var originalFlyoutWidth = parseInt(window.getComputedStyle(flyoutInnerRef === null || flyoutInnerRef === void 0 ? void 0 : flyoutInnerRef.current).getPropertyValue('width'));
|
@@ -203,7 +210,7 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
203
210
|
className: cx("".concat(componentClass, "__trigger"), _defineProperty({}, "".concat(componentClass, "__trigger--open"), open)),
|
204
211
|
disabled: data.length === 0
|
205
212
|
}, /*#__PURE__*/React.createElement(Filter, null)), /*#__PURE__*/React.createElement("div", {
|
206
|
-
className: cx(componentClass, (
|
213
|
+
className: cx(componentClass, _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentClass, "--open"), open), "".concat(componentClass, "--batch"), showActionSet), "".concat(componentClass, "--instant"), !showActionSet)),
|
207
214
|
ref: flyoutInnerRef
|
208
215
|
}, /*#__PURE__*/React.createElement("div", {
|
209
216
|
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 = "calc(100vh - ".concat(filterHeadingHeight, "px - ").concat( /* istanbul ignore next */
|
190
|
+
showFilterSearch ? filterSearchHeight : 0, "px - ").concat(updateMethod === BATCH ? actionSetHeight : 0, "px)");
|
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;
|
@@ -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", {
|
@@ -23,7 +23,7 @@ import { usePreviousValue } from '../../../../../../global/js/hooks';
|
|
23
23
|
import { prepareProps } from '../../../../../../global/js/utils/props-helper';
|
24
24
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
25
25
|
export var InlineEditCell = function InlineEditCell(_ref) {
|
26
|
-
var _config$validator,
|
26
|
+
var _config$validator, _value$text;
|
27
27
|
var cell = _ref.cell,
|
28
28
|
config = _ref.config,
|
29
29
|
instance = _ref.instance,
|
@@ -438,7 +438,7 @@ export var InlineEditCell = function InlineEditCell(_ref) {
|
|
438
438
|
"data-inline-type": type,
|
439
439
|
onClick: !nonEditCell ? handleInlineCellClick : addActiveState,
|
440
440
|
onKeyDown: !nonEditCell ? handleKeyDown : null,
|
441
|
-
className: cx("".concat(blockClass, "__inline-edit--outer-cell-button"), (
|
441
|
+
className: cx("".concat(blockClass, "__inline-edit--outer-cell-button"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"), config === null || config === void 0 || (_config$validator = config.validator) === null || _config$validator === void 0 ? void 0 : _config$validator.call(config, cellValue)))
|
442
442
|
}, !inEditMode && /*#__PURE__*/React.createElement(InlineEditButton, {
|
443
443
|
isActiveCell: cellId === activeCellId,
|
444
444
|
renderIcon: setRenderIcon(),
|
@@ -37,7 +37,6 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
37
37
|
var row = cell.row,
|
38
38
|
column = cell.column;
|
39
39
|
if (column.isAction) {
|
40
|
-
var _cx3;
|
41
40
|
var isColumnSticky = !!column.sticky;
|
42
41
|
return [props, {
|
43
42
|
children: /*#__PURE__*/React.createElement("div", {
|
@@ -109,7 +108,7 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
109
108
|
key: id
|
110
109
|
}));
|
111
110
|
})))),
|
112
|
-
className: cx((
|
111
|
+
className: cx(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__actions-column-cell"), true), "".concat(blockClass, "__cell"), true), "".concat(blockClass, "__actions-column-cell-non-sticky"), !isColumnSticky)),
|
113
112
|
style: {
|
114
113
|
width: rowActions.length > 2 || isColumnSticky ? 48 : 96
|
115
114
|
}
|
@@ -17,8 +17,7 @@ var useDefaultStringRenderer = function useDefaultStringRenderer(hooks) {
|
|
17
17
|
var StringRenderer = function StringRenderer(tableProps) {
|
18
18
|
var _tableProps$column;
|
19
19
|
return /*#__PURE__*/React.createElement("div", {
|
20
|
-
className: cx("".concat(blockClass, "__defaultStringRenderer"), _defineProperty({}, "".concat(blockClass, "__defaultStringRenderer--multiline"), ((_tableProps$column = tableProps.column) === null || _tableProps$column === void 0 ? void 0 : _tableProps$column.multiLineWrap) || (tableProps === null || tableProps === void 0 ? void 0 : tableProps.multiLineWrapAll)))
|
21
|
-
title: tableProps.value
|
20
|
+
className: cx("".concat(blockClass, "__defaultStringRenderer"), _defineProperty({}, "".concat(blockClass, "__defaultStringRenderer--multiline"), ((_tableProps$column = tableProps.column) === null || _tableProps$column === void 0 ? void 0 : _tableProps$column.multiLineWrap) || (tableProps === null || tableProps === void 0 ? void 0 : tableProps.multiLineWrapAll)))
|
22
21
|
}, tableProps.value);
|
23
22
|
};
|
24
23
|
var HeaderRenderer = function HeaderRenderer(header) {
|
@@ -18,6 +18,7 @@ var useFiltering = function useFiltering(hooks) {
|
|
18
18
|
useEffect(function () {
|
19
19
|
pkg.checkReportFeatureEnabled('Datagrid.useFiltering');
|
20
20
|
}, []);
|
21
|
+
/* istanbul ignore next */
|
21
22
|
var filterTypes = useMemo(function () {
|
22
23
|
return {
|
23
24
|
date: function date(rows, id, _ref) {
|
@@ -33,7 +33,6 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
33
33
|
var expanderColumn = {
|
34
34
|
id: 'expander',
|
35
35
|
Cell: function Cell(_ref) {
|
36
|
-
var _cx;
|
37
36
|
var row = _ref.row;
|
38
37
|
var expanderButtonProps = _objectSpread(_objectSpread({}, row.getToggleRowExpandedProps()), {}, {
|
39
38
|
onClick: function onClick(event) {
|
@@ -56,7 +55,7 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
56
55
|
}, expanderButtonProps, {
|
57
56
|
title: expanderTitle
|
58
57
|
}), /*#__PURE__*/React.createElement(ChevronRight, {
|
59
|
-
className: cx("".concat(blockClass, "__expander-icon"), (
|
58
|
+
className: cx("".concat(blockClass, "__expander-icon"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__expander-icon--not-open"), !row.isExpanded), "".concat(blockClass, "__expander-icon--open"), row.isExpanded))
|
60
59
|
}));
|
61
60
|
},
|
62
61
|
width: 48,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
2
|
/**
|
3
|
-
* Copyright IBM Corp. 2020,
|
3
|
+
* Copyright IBM Corp. 2020, 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.
|
@@ -9,46 +9,62 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
9
|
import cx from 'classnames';
|
10
10
|
import { pkg } from '../../settings';
|
11
11
|
import useNestedRowExpander from './useNestedRowExpander';
|
12
|
+
import { useEffect } from 'react';
|
12
13
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
13
14
|
var useNestedRows = function useNestedRows(hooks) {
|
14
15
|
useNestedRowExpander(hooks);
|
15
|
-
var marginLeft = 24;
|
16
|
-
var getRowProps = function getRowProps(props, _ref) {
|
17
|
-
var _cx;
|
18
|
-
var row = _ref.row;
|
19
|
-
return [props, {
|
20
|
-
className: cx((_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__carbon-nested-row"), row.depth > 0), _defineProperty(_cx, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), _cx))
|
21
|
-
}];
|
22
|
-
};
|
23
|
-
var getRowStyles = function getRowStyles(props, _ref2) {
|
24
|
-
var row = _ref2.row;
|
25
|
-
return [props, {
|
26
|
-
style: {
|
27
|
-
paddingLeft: "".concat(row.depth > 1 ? marginLeft * 2 + (row.depth - 1) * (marginLeft + marginLeft / 3) : row.depth === 1 ? marginLeft * 2 : 0, "px")
|
28
|
-
}
|
29
|
-
}];
|
30
|
-
};
|
31
|
-
var getCellProps = function getCellProps(props, _ref3) {
|
32
|
-
var cell = _ref3.cell,
|
33
|
-
instance = _ref3.instance;
|
34
|
-
// reduce the "first cell"s width to compensate added (left) margin
|
35
|
-
var isFirstCell = instance.columns.findIndex(function (c) {
|
36
|
-
return c.id === cell.column.id;
|
37
|
-
}) === 0;
|
38
|
-
return [props, {
|
39
|
-
style: {
|
40
|
-
marginRight: "".concat(isFirstCell && cell.row.depth > 0 ? "".concat(-32 * cell.row.depth - 18, "px") : '')
|
41
|
-
}
|
42
|
-
}];
|
43
|
-
};
|
44
16
|
var useInstance = function useInstance(instance) {
|
17
|
+
// This useEffect will expand rows if they exist in the initialState obj
|
18
|
+
useEffect(function () {
|
19
|
+
var rows = instance.rows,
|
20
|
+
initialState = instance.initialState;
|
21
|
+
var expandedRowIds = initialState.expandedRowIds;
|
22
|
+
if (expandedRowIds) {
|
23
|
+
Object.keys(expandedRowIds).forEach(function (key) {
|
24
|
+
var row = rows.filter(function (r) {
|
25
|
+
return r.id.toString() === key.toString();
|
26
|
+
});
|
27
|
+
if (row.length && key.toString() === row[0].id.toString()) {
|
28
|
+
row[0].toggleRowExpanded();
|
29
|
+
}
|
30
|
+
});
|
31
|
+
}
|
32
|
+
}, [instance]);
|
33
|
+
var marginLeft = 24;
|
34
|
+
var getRowProps = function getRowProps(props, _ref) {
|
35
|
+
var row = _ref.row;
|
36
|
+
return [props, {
|
37
|
+
className: cx(_defineProperty(_defineProperty({}, "".concat(blockClass, "__carbon-nested-row"), row.depth > 0), "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded))
|
38
|
+
}];
|
39
|
+
};
|
40
|
+
var getRowStyles = function getRowStyles(props, _ref2) {
|
41
|
+
var row = _ref2.row;
|
42
|
+
return [props, {
|
43
|
+
style: {
|
44
|
+
paddingLeft: "".concat(row.depth > 1 ? marginLeft * 2 + (row.depth - 1) * (marginLeft + marginLeft / 3) : row.depth === 1 ? marginLeft * 2 : 0, "px")
|
45
|
+
}
|
46
|
+
}];
|
47
|
+
};
|
48
|
+
var getCellProps = function getCellProps(props, _ref3) {
|
49
|
+
var cell = _ref3.cell,
|
50
|
+
instance = _ref3.instance;
|
51
|
+
// reduce the "first cell"s width to compensate added (left) margin
|
52
|
+
var isFirstCell = instance.columns.findIndex(function (c) {
|
53
|
+
return c.id === cell.column.id;
|
54
|
+
}) === 0;
|
55
|
+
return [props, {
|
56
|
+
style: {
|
57
|
+
marginRight: "".concat(isFirstCell && cell.row.depth > 0 ? "".concat(-32 * cell.row.depth - 18, "px") : '')
|
58
|
+
}
|
59
|
+
}];
|
60
|
+
};
|
45
61
|
Object.assign(instance, {
|
46
62
|
withNestedRows: true
|
47
63
|
});
|
64
|
+
hooks.getRowProps.push(getRowProps);
|
65
|
+
hooks.getRowProps.push(getRowStyles);
|
66
|
+
hooks.getCellProps.push(getCellProps);
|
48
67
|
};
|
49
|
-
hooks.getRowProps.push(getRowProps);
|
50
|
-
hooks.getRowProps.push(getRowStyles);
|
51
|
-
hooks.getCellProps.push(getCellProps);
|
52
68
|
hooks.useInstance.push(useInstance);
|
53
69
|
};
|
54
70
|
export default useNestedRows;
|
@@ -29,7 +29,7 @@ var useOnRowClick = function useOnRowClick(hooks) {
|
|
29
29
|
row.classList.remove("".concat(carbon.prefix, "--data-table--selected"));
|
30
30
|
});
|
31
31
|
}
|
32
|
-
var closestRow = event.
|
32
|
+
var closestRow = event.currentTarget.closest('tr');
|
33
33
|
closestRow.classList.add("".concat(carbon.prefix, "--data-table--selected"));
|
34
34
|
if (!withSelectRows) {
|
35
35
|
instance.selectedFlatRows && instance.selectedFlatRows.map(function (toggleRow) {
|
@@ -62,12 +62,11 @@ var useSelectRows = function useSelectRows(hooks) {
|
|
62
62
|
};
|
63
63
|
var useHighlightSelection = function useHighlightSelection(hooks) {
|
64
64
|
var getRowProps = function getRowProps(props, _ref) {
|
65
|
-
var _ref2;
|
66
65
|
var row = _ref.row;
|
67
66
|
var _row$getToggleRowSele = row.getToggleRowSelectedProps(),
|
68
67
|
checked = _row$getToggleRowSele.checked;
|
69
68
|
return [props, {
|
70
|
-
className: cx(["".concat(blockClass, "__carbon-row"), (
|
69
|
+
className: cx(["".concat(blockClass, "__carbon-row"), _defineProperty(_defineProperty({}, "".concat(carbon.prefix, "--data-table--selected"), checked), "".concat(blockClass, "__active-row"), checked)])
|
71
70
|
}];
|
72
71
|
};
|
73
72
|
hooks.getRowProps.push(getRowProps);
|
@@ -89,7 +89,6 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
89
89
|
return /*#__PURE__*/React.createElement(ArrowsVertical, iconProps);
|
90
90
|
};
|
91
91
|
var Header = function Header(headerProp) {
|
92
|
-
var _cx;
|
93
92
|
return column.disableSortBy === true || column.id === 'datagridSelection' ? column.disableSortBy ? column.Header : /*#__PURE__*/React.createElement(SelectAll, instance) : /*#__PURE__*/React.createElement(Button, {
|
94
93
|
"aria-sort": getAriaSortValue(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column, {
|
95
94
|
ascendingSortableLabelText: ascendingSortableLabelText,
|
@@ -104,7 +103,7 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
104
103
|
renderIcon: function renderIcon(props) {
|
105
104
|
return icon(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column, props);
|
106
105
|
},
|
107
|
-
className: cx("".concat(carbon.prefix, "--table-sort ").concat(blockClass, "--table-sort"), (
|
106
|
+
className: cx("".concat(carbon.prefix, "--table-sort ").concat(blockClass, "--table-sort"), _defineProperty(_defineProperty({}, "".concat(blockClass, "--table-sort--desc"), headerProp === null || headerProp === void 0 ? void 0 : headerProp.column.isSortedDesc), "".concat(blockClass, "--table-sort--asc"), (headerProp === null || headerProp === void 0 ? void 0 : headerProp.column.isSortedDesc) === false))
|
108
107
|
}, column.Header);
|
109
108
|
};
|
110
109
|
return _objectSpread(_objectSpread({}, column), {}, {
|