@carbon/ibm-products 2.41.1-canary.9 → 2.42.0
Sign up to get free protection for your applications and to get access to all the features.
- package/es/components/CreateFullPage/CreateFullPage.d.ts +2 -1
- package/es/components/CreateFullPage/CreateFullPageStep.d.ts +71 -2
- package/es/components/CreateFullPage/CreateFullPageStep.js +3 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +3 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +28 -28
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +7 -8
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +4 -3
- package/es/components/DataSpreadsheet/types/index.d.ts +1 -4
- package/es/components/Datagrid/Datagrid/Datagrid.d.ts +24 -2
- package/es/components/Datagrid/Datagrid/Datagrid.js +4 -4
- package/es/components/Datagrid/Datagrid/DatagridBody.d.ts +2 -1
- package/es/components/Datagrid/Datagrid/DatagridBody.js +1 -2
- package/es/components/Datagrid/Datagrid/DatagridContent.d.ts +16 -13
- package/es/components/Datagrid/Datagrid/DatagridContent.js +12 -13
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.d.ts +8 -1
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -4
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.d.ts +9 -1
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +10 -5
- package/es/components/Datagrid/Datagrid/DatagridHead.d.ts +8 -1
- package/es/components/Datagrid/Datagrid/DatagridHead.js +3 -5
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.d.ts +8 -1
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +41 -36
- package/es/components/Datagrid/Datagrid/DatagridRefBody.d.ts +2 -1
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +4 -4
- package/es/components/Datagrid/Datagrid/DatagridRow.d.ts +8 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +12 -16
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.d.ts +9 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -8
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.d.ts +23 -27
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +9 -9
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.d.ts +2 -1
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +3 -3
- package/es/components/Datagrid/Datagrid/DatagridToolbar.d.ts +17 -10
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +15 -11
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +8 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +29 -17
- package/es/components/Datagrid/Datagrid/DraggableElement.d.ts +23 -21
- package/es/components/Datagrid/Datagrid/DraggableElement.js +2 -4
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +12 -2
- package/es/components/Datagrid/Datagrid/index.d.ts +7 -1
- package/es/components/Datagrid/types/index.d.ts +210 -0
- package/es/components/Datagrid/useColumnOrder.d.ts +1 -0
- package/es/components/Datagrid/useDatagrid.d.ts +1 -1
- package/es/components/Datagrid/useFocusRowExpander.js +1 -1
- package/es/components/Datagrid/useInfiniteScroll.d.ts +8 -1
- package/es/components/Datagrid/useInfiniteScroll.js +10 -9
- package/es/components/Datagrid/useSelectRows.js +5 -1
- package/es/components/FilterSummary/FilterSummary.d.ts +21 -2
- package/es/components/FilterSummary/FilterSummary.js +10 -11
- package/es/components/Guidebanner/Guidebanner.js +7 -2
- package/es/components/WebTerminal/WebTerminal.js +1 -1
- package/es/global/js/hooks/usePreviousValue.d.ts +1 -1
- package/es/global/js/hooks/usePreviousValue.js +3 -2
- package/es/global/js/hooks/useRetrieveStepData.d.ts +5 -5
- package/es/global/js/hooks/useRetrieveStepData.js +5 -5
- package/lib/components/CreateFullPage/CreateFullPage.d.ts +2 -1
- package/lib/components/CreateFullPage/CreateFullPageStep.d.ts +71 -2
- package/lib/components/CreateFullPage/CreateFullPageStep.js +3 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +3 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +28 -28
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +7 -8
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +4 -3
- package/lib/components/DataSpreadsheet/types/index.d.ts +1 -4
- package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +24 -2
- package/lib/components/Datagrid/Datagrid/Datagrid.js +4 -4
- package/lib/components/Datagrid/Datagrid/DatagridBody.d.ts +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridBody.js +1 -2
- package/lib/components/Datagrid/Datagrid/DatagridContent.d.ts +16 -13
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +44 -45
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.d.ts +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -4
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.d.ts +9 -1
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -4
- package/lib/components/Datagrid/Datagrid/DatagridHead.d.ts +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridHead.js +3 -5
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.d.ts +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +40 -35
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.d.ts +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -4
- package/lib/components/Datagrid/Datagrid/DatagridRow.d.ts +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +12 -16
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.d.ts +9 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -8
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.d.ts +23 -27
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +9 -9
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.d.ts +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +3 -3
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.d.ts +17 -10
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +15 -11
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +29 -17
- package/lib/components/Datagrid/Datagrid/DraggableElement.d.ts +23 -21
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +2 -4
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +12 -2
- package/lib/components/Datagrid/Datagrid/index.d.ts +7 -1
- package/lib/components/Datagrid/types/index.d.ts +210 -0
- package/lib/components/Datagrid/useColumnOrder.d.ts +1 -0
- package/lib/components/Datagrid/useDatagrid.d.ts +1 -1
- package/lib/components/Datagrid/useFocusRowExpander.js +1 -1
- package/lib/components/Datagrid/useInfiniteScroll.d.ts +8 -1
- package/lib/components/Datagrid/useInfiniteScroll.js +10 -9
- package/lib/components/Datagrid/useSelectRows.js +5 -1
- package/lib/components/FilterSummary/FilterSummary.d.ts +21 -2
- package/lib/components/FilterSummary/FilterSummary.js +10 -11
- package/lib/components/Guidebanner/Guidebanner.js +7 -2
- package/lib/components/WebTerminal/WebTerminal.js +1 -1
- package/lib/global/js/hooks/usePreviousValue.d.ts +1 -1
- package/lib/global/js/hooks/usePreviousValue.js +3 -2
- package/lib/global/js/hooks/useRetrieveStepData.d.ts +5 -5
- package/lib/global/js/hooks/useRetrieveStepData.js +5 -5
- package/package.json +5 -4
- package/telemetry.yml +67 -6
@@ -1,2 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2022
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { DataGridState } from '../types';
|
8
|
+
declare const DatagridHead: (datagridState: DataGridState) => import("react/jsx-runtime").JSX.Element;
|
1
9
|
export default DatagridHead;
|
2
|
-
declare function DatagridHead(datagridState: any): import("react/jsx-runtime").JSX.Element;
|
@@ -14,12 +14,10 @@ var DatagridHead = function DatagridHead(datagridState) {
|
|
14
14
|
headRef = datagridState.headRef,
|
15
15
|
HeaderRow = datagridState.HeaderRow;
|
16
16
|
return /*#__PURE__*/React__default.createElement(TableHead, null, headerGroups.map(function (headerGroup) {
|
17
|
-
return (
|
18
|
-
|
19
|
-
HeaderRow(datagridState, headRef, headerGroup)
|
17
|
+
return (// doesn't support header grouping.
|
18
|
+
HeaderRow === null || HeaderRow === void 0 ? void 0 : HeaderRow(datagridState, headRef, headerGroup)
|
20
19
|
);
|
21
20
|
}));
|
22
21
|
};
|
23
|
-
var DatagridHead$1 = DatagridHead;
|
24
22
|
|
25
|
-
export { DatagridHead
|
23
|
+
export { DatagridHead as default };
|
@@ -1,2 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { DatagridTableHooks } from '../types';
|
8
|
+
declare const useHeaderRow: (hooks: DatagridTableHooks) => void;
|
1
9
|
export default useHeaderRow;
|
2
|
-
declare function useHeaderRow(hooks: any): void;
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { slicedToArray as _slicedToArray, objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
8
|
+
import { slicedToArray as _slicedToArray, objectWithoutProperties as _objectWithoutProperties, extends as _extends, objectDestructuringEmpty as _objectDestructuringEmpty, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { useEffect, useState, isValidElement } from 'react';
|
10
10
|
import cx from 'classnames';
|
11
11
|
import { TableRow, TableHeader } from '@carbon/react';
|
@@ -18,9 +18,8 @@ import { DatagridSlug } from './addons/Slug/DatagridSlug.js';
|
|
18
18
|
import { useInitialColumnSort } from '../useInitialColumnSort.js';
|
19
19
|
|
20
20
|
var _th;
|
21
|
-
var _excluded = ["
|
22
|
-
_excluded2 = ["
|
23
|
-
_excluded3 = ["role"];
|
21
|
+
var _excluded = ["className"],
|
22
|
+
_excluded2 = ["key"];
|
24
23
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
25
24
|
var getAccessibilityProps = function getAccessibilityProps(header) {
|
26
25
|
var props = {};
|
@@ -45,22 +44,20 @@ var ResizeHeader = function ResizeHeader(_ref) {
|
|
45
44
|
onColResizeEnd = _ref.onColResizeEnd,
|
46
45
|
resizerAriaLabel = _ref.resizerAriaLabel,
|
47
46
|
isFetching = _ref.isFetching;
|
48
|
-
|
49
|
-
resizerProps.role;
|
50
|
-
var headerProps = _objectWithoutProperties(resizerProps, _excluded);
|
47
|
+
var headerProps = _extends({}, (_objectDestructuringEmpty(resizerProps), resizerProps));
|
51
48
|
var mouseDownHandler = function mouseDownHandler(evt) {
|
52
|
-
handleOnMouseDownResize(evt, resizerProps);
|
49
|
+
handleOnMouseDownResize === null || handleOnMouseDownResize === void 0 || handleOnMouseDownResize(evt, resizerProps);
|
53
50
|
};
|
54
51
|
var mouseUpHandler = function mouseUpHandler() {
|
55
|
-
handleColumnResizeEndEvent(dispatch, onColResizeEnd, header.id, true);
|
52
|
+
handleColumnResizeEndEvent(dispatch, onColResizeEnd, header === null || header === void 0 ? void 0 : header.id, true);
|
56
53
|
};
|
57
54
|
var keyDownHandler = function keyDownHandler(evt) {
|
58
55
|
var key = evt.key;
|
59
56
|
if (key === 'ArrowLeft' || key === 'ArrowRight') {
|
60
|
-
var originalColMinWidth = originalCol.minWidth || 90;
|
61
|
-
var currentColumnWidth = columnWidths[header.id] || (datagridState.isTableSortable && originalCol.width < originalColMinWidth ? originalColMinWidth : originalCol.width);
|
57
|
+
var originalColMinWidth = (originalCol === null || originalCol === void 0 ? void 0 : originalCol.minWidth) || 90;
|
58
|
+
var currentColumnWidth = (header === null || header === void 0 ? void 0 : header.id) && (columnWidths === null || columnWidths === void 0 ? void 0 : columnWidths[header === null || header === void 0 ? void 0 : header.id]) || (datagridState !== null && datagridState !== void 0 && datagridState.isTableSortable && Number(originalCol === null || originalCol === void 0 ? void 0 : originalCol.width) < originalColMinWidth ? originalColMinWidth : originalCol === null || originalCol === void 0 ? void 0 : originalCol.width);
|
62
59
|
if (key === 'ArrowLeft') {
|
63
|
-
if (currentColumnWidth - incrementAmount > Math.max(minWidth, 50)) {
|
60
|
+
if (currentColumnWidth - incrementAmount > Math.max(Number(minWidth), 50)) {
|
64
61
|
var newWidth = currentColumnWidth - incrementAmount;
|
65
62
|
handleColumnResizingEvent(dispatch, header, newWidth, true);
|
66
63
|
}
|
@@ -72,7 +69,7 @@ var ResizeHeader = function ResizeHeader(_ref) {
|
|
72
69
|
}
|
73
70
|
};
|
74
71
|
var keyUpHandler = function keyUpHandler() {
|
75
|
-
handleColumnResizeEndEvent(dispatch, onColResizeEnd, header.id, true);
|
72
|
+
handleColumnResizeEndEvent(dispatch, onColResizeEnd, header === null || header === void 0 ? void 0 : header.id, true);
|
76
73
|
};
|
77
74
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("input", _extends({}, headerProps, {
|
78
75
|
onMouseDown: mouseDownHandler,
|
@@ -81,7 +78,7 @@ var ResizeHeader = function ResizeHeader(_ref) {
|
|
81
78
|
onKeyUp: keyUpHandler,
|
82
79
|
className: "".concat(blockClass, "__col-resizer-range"),
|
83
80
|
type: "range",
|
84
|
-
defaultValue: originalCol.width,
|
81
|
+
defaultValue: originalCol === null || originalCol === void 0 ? void 0 : originalCol.width,
|
85
82
|
"aria-label": resizerAriaLabel || 'Resize column',
|
86
83
|
disabled: isFetching
|
87
84
|
})), /*#__PURE__*/React__default.createElement("span", {
|
@@ -89,6 +86,7 @@ var ResizeHeader = function ResizeHeader(_ref) {
|
|
89
86
|
}));
|
90
87
|
};
|
91
88
|
var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
89
|
+
var _datagridState$header;
|
92
90
|
var resizerAriaLabel = datagridState.resizerAriaLabel,
|
93
91
|
isTableSortable = datagridState.isTableSortable,
|
94
92
|
rows = datagridState.rows,
|
@@ -99,22 +97,27 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
99
97
|
useEffect(function () {
|
100
98
|
var tableId = datagridState.tableId;
|
101
99
|
var gridElement = document.querySelector("#".concat(tableId));
|
102
|
-
var tableElement = gridElement.querySelector('table');
|
100
|
+
var tableElement = gridElement === null || gridElement === void 0 ? void 0 : gridElement.querySelector('table');
|
103
101
|
var headerRowElement = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head"));
|
104
|
-
var
|
105
|
-
|
106
|
-
|
102
|
+
var scrollBuffer = 2;
|
103
|
+
if (tableElement) {
|
104
|
+
var hasHorizontalScrollbar = (tableElement === null || tableElement === void 0 ? void 0 : tableElement.scrollWidth) > (tableElement === null || tableElement === void 0 ? void 0 : tableElement.clientWidth);
|
105
|
+
if (hasHorizontalScrollbar) {
|
106
|
+
scrollBuffer = 18;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
var tableToolbar = (gridElement === null || gridElement === void 0 ? void 0 : gridElement.querySelector(".".concat(blockClass, "__table-toolbar"))) || null;
|
107
110
|
var tableToolbarHeight = (tableToolbar === null || tableToolbar === void 0 ? void 0 : tableToolbar.offsetHeight) || 0;
|
108
111
|
var setCustomValues = function setCustomValues(_ref2) {
|
109
112
|
var rowHeight = _ref2.rowHeight,
|
110
113
|
gridHeight = _ref2.gridHeight;
|
111
|
-
headerRowElement.style.setProperty("--".concat(blockClass, "--row-height"), px(rowHeight));
|
112
|
-
headerRowElement.style.setProperty("--".concat(blockClass, "--grid-height"), px(gridHeight - scrollBuffer - tableToolbarHeight));
|
113
|
-
headerRowElement.style.setProperty("--".concat(blockClass, "--header-height"), px(headerRowElement.offsetHeight));
|
114
|
+
headerRowElement === null || headerRowElement === void 0 || headerRowElement.style.setProperty("--".concat(blockClass, "--row-height"), px(rowHeight));
|
115
|
+
headerRowElement === null || headerRowElement === void 0 || headerRowElement.style.setProperty("--".concat(blockClass, "--grid-height"), px(gridHeight - scrollBuffer - tableToolbarHeight));
|
116
|
+
headerRowElement === null || headerRowElement === void 0 || headerRowElement.style.setProperty("--".concat(blockClass, "--header-height"), px(headerRowElement.offsetHeight));
|
114
117
|
};
|
115
118
|
setCustomValues({
|
116
|
-
gridHeight: gridElement.offsetHeight,
|
117
|
-
rowHeight: headerRowElement.clientHeight
|
119
|
+
gridHeight: gridElement === null || gridElement === void 0 ? void 0 : gridElement.offsetHeight,
|
120
|
+
rowHeight: headerRowElement === null || headerRowElement === void 0 ? void 0 : headerRowElement.clientHeight
|
118
121
|
});
|
119
122
|
}, [datagridState.rowSize, datagridState.tableId, datagridState]);
|
120
123
|
var _useState = useState(2),
|
@@ -122,7 +125,8 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
122
125
|
incrementAmount = _useState2[0];
|
123
126
|
var handleOnMouseDownResize = function handleOnMouseDownResize(event, resizeProps) {
|
124
127
|
var _resizeProps = _objectSpread2({}, resizeProps),
|
125
|
-
|
128
|
+
_resizeProps$onMouseD = _resizeProps.onMouseDown,
|
129
|
+
onMouseDown = _resizeProps$onMouseD === void 0 ? function () {} : _resizeProps$onMouseD;
|
126
130
|
// When event.button is 2, that is a right click
|
127
131
|
// and we do not want to resize
|
128
132
|
if (event.button === 2 || event.ctrlKey) {
|
@@ -132,9 +136,8 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
132
136
|
onMouseDown === null || onMouseDown === void 0 || onMouseDown(event);
|
133
137
|
};
|
134
138
|
var _headerGroup$getHeade = headerGroup.getHeaderGroupProps(),
|
135
|
-
headerGroupClassName = _headerGroup$getHeade.className
|
136
|
-
_headerGroup$getHeade
|
137
|
-
var headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded2);
|
139
|
+
headerGroupClassName = _headerGroup$getHeade.className,
|
140
|
+
headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded);
|
138
141
|
var renderSlug = function renderSlug(slug) {
|
139
142
|
if (isTableSortable) {
|
140
143
|
return;
|
@@ -147,16 +150,20 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
147
150
|
var _r$original;
|
148
151
|
return /*#__PURE__*/isValidElement(r === null || r === void 0 || (_r$original = r.original) === null || _r$original === void 0 ? void 0 : _r$original.slug);
|
149
152
|
});
|
150
|
-
|
153
|
+
var key = headerGroupProps.key,
|
154
|
+
rowProps = _objectWithoutProperties(headerGroupProps, _excluded2);
|
155
|
+
return /*#__PURE__*/React__default.createElement(TableRow, _extends({
|
156
|
+
key: key
|
157
|
+
}, rowProps, {
|
151
158
|
className: cx("".concat(blockClass, "__head"), headerGroupClassName),
|
152
159
|
ref: headRef
|
153
160
|
}), foundAIRow ? _th || (_th = /*#__PURE__*/React__default.createElement("th", {
|
154
161
|
scope: "col",
|
155
162
|
"aria-hidden": "false"
|
156
|
-
})) : null, datagridState.headers.filter(function (_ref3) {
|
163
|
+
})) : null, datagridState === null || datagridState === void 0 || (_datagridState$header = datagridState.headers) === null || _datagridState$header === void 0 || (_datagridState$header = _datagridState$header.filter(function (_ref3) {
|
157
164
|
var isVisible = _ref3.isVisible;
|
158
165
|
return isVisible;
|
159
|
-
}).map(function (header, index) {
|
166
|
+
})) === null || _datagridState$header === void 0 ? void 0 : _datagridState$header.map(function (header, index) {
|
160
167
|
var _header$getResizerPro;
|
161
168
|
if (header.id === selectionColumnId) {
|
162
169
|
// render directly without the wrapper TableHeader
|
@@ -174,12 +181,11 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
174
181
|
var _ref5 = columnResizing || {},
|
175
182
|
columnWidths = _ref5.columnWidths;
|
176
183
|
var originalCol = visibleColumns[index];
|
177
|
-
var _header$getHeaderProp = header.getHeaderProps()
|
178
|
-
_header$getHeaderProp
|
179
|
-
var headerProps = _objectWithoutProperties(_header$getHeaderProp, _excluded3);
|
184
|
+
var _header$getHeaderProp = header.getHeaderProps(),
|
185
|
+
headerProps = _extends({}, (_objectDestructuringEmpty(_header$getHeaderProp), _header$getHeaderProp));
|
180
186
|
var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
|
181
187
|
return /*#__PURE__*/React__default.createElement(TableHeader, _extends({}, headerProps, {
|
182
|
-
className: cx(header.className, _defineProperty(_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), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default.isValidElement(header.slug))),
|
188
|
+
className: cx(header === null || header === void 0 ? void 0 : header.className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default.isValidElement(header === null || header === void 0 ? void 0 : header.slug))),
|
183
189
|
key: header.id,
|
184
190
|
"aria-hidden": header.id === 'spacer' && 'true'
|
185
191
|
}, getAccessibilityProps(header)), header.render('Header'), renderSlug(header.slug), resizerProps && !header.isAction && /*#__PURE__*/React__default.createElement(ResizeHeader, {
|
@@ -206,6 +212,5 @@ var useHeaderRow = function useHeaderRow(hooks) {
|
|
206
212
|
};
|
207
213
|
hooks.useInstance.push(useInstance);
|
208
214
|
};
|
209
|
-
var useHeaderRow$1 = useHeaderRow;
|
210
215
|
|
211
|
-
export { useHeaderRow
|
216
|
+
export { useHeaderRow as default };
|
@@ -1,2 +1,3 @@
|
|
1
|
+
import { DataGridState } from '../types';
|
2
|
+
declare const DatagridRefBody: (datagridState: DataGridState) => import("react/jsx-runtime").JSX.Element;
|
1
3
|
export default DatagridRefBody;
|
2
|
-
declare function DatagridRefBody(datagridState: any): import("react/jsx-runtime").JSX.Element;
|
@@ -24,16 +24,16 @@ var DatagridRefBody = function DatagridRefBody(datagridState) {
|
|
24
24
|
role: undefined
|
25
25
|
}), {
|
26
26
|
className: cx("".concat(blockClass, "__simple-body"), getTableBodyProps().className)
|
27
|
-
}), rows.map(function (row) {
|
27
|
+
}), rows === null || rows === void 0 ? void 0 : rows.map(function (row) {
|
28
|
+
var _row$RowRenderer;
|
28
29
|
prepareRow(row);
|
29
30
|
var _row$getRowProps = row.getRowProps(),
|
30
31
|
key = _row$getRowProps.key;
|
31
|
-
return row.RowRenderer(_objectSpread2(_objectSpread2({}, datagridState), {}, {
|
32
|
+
return row === null || row === void 0 || (_row$RowRenderer = row.RowRenderer) === null || _row$RowRenderer === void 0 ? void 0 : _row$RowRenderer.call(row, _objectSpread2(_objectSpread2({}, datagridState), {}, {
|
32
33
|
row: row,
|
33
34
|
key: key
|
34
35
|
}));
|
35
36
|
}));
|
36
37
|
};
|
37
|
-
var DatagridRefBody$1 = DatagridRefBody;
|
38
38
|
|
39
|
-
export { DatagridRefBody
|
39
|
+
export { DatagridRefBody as default };
|
@@ -1,2 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { DataGridState } from '../types';
|
8
|
+
declare const DatagridRow: (datagridState: DataGridState) => import("react/jsx-runtime").JSX.Element;
|
1
9
|
export default DatagridRow;
|
2
|
-
declare function DatagridRow(datagridState: any): import("react/jsx-runtime").JSX.Element;
|
@@ -15,8 +15,8 @@ import { pkg, carbon } from '../../../settings.js';
|
|
15
15
|
import { DatagridSlug } from './addons/Slug/DatagridSlug.js';
|
16
16
|
|
17
17
|
var _SkeletonText;
|
18
|
-
var _excluded = ["
|
19
|
-
_excluded2 = ["children"
|
18
|
+
var _excluded = ["className"],
|
19
|
+
_excluded2 = ["children"];
|
20
20
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
21
21
|
var rowHeights = {
|
22
22
|
xs: 24,
|
@@ -58,7 +58,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
58
58
|
return;
|
59
59
|
}
|
60
60
|
var subRowCount = getVisibleNestedRowCount(row);
|
61
|
-
var totalNestedRowIndicatorHeight = px(subRowCount * rowHeights[rowSize]);
|
61
|
+
var totalNestedRowIndicatorHeight = px(subRowCount * rowHeights[Number(rowSize)]);
|
62
62
|
var hoverRow = event.target.closest(".".concat(blockClass, "__carbon-row-expanded"));
|
63
63
|
hoverRow === null || hoverRow === void 0 || hoverRow.classList.add("".concat(blockClass, "__carbon-row-expanded-hover-active"));
|
64
64
|
var rowExpanderButton = hoverRow === null || hoverRow === void 0 ? void 0 : hoverRow.querySelector(".".concat(blockClass, "__row-expander"));
|
@@ -85,7 +85,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
85
85
|
};
|
86
86
|
var handleMouseLeave = function handleMouseLeave(event) {
|
87
87
|
if (withMouseHover) {
|
88
|
-
setMouseOverRowIndex(null);
|
88
|
+
setMouseOverRowIndex === null || setMouseOverRowIndex === void 0 || setMouseOverRowIndex(null);
|
89
89
|
}
|
90
90
|
var hoverRow = event.target.closest(".".concat(blockClass, "__carbon-row-expanded"));
|
91
91
|
hoverRow === null || hoverRow === void 0 || hoverRow.classList.remove("".concat(blockClass, "__carbon-row-expanded-hover-active"));
|
@@ -107,11 +107,8 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
107
107
|
}
|
108
108
|
return {};
|
109
109
|
};
|
110
|
-
|
111
|
-
|
112
|
-
var _row$getRowProps = row.getRowProps();
|
113
|
-
_row$getRowProps.role;
|
114
|
-
var className = _row$getRowProps.className,
|
110
|
+
var _row$getRowProps = row.getRowProps(),
|
111
|
+
className = _row$getRowProps.className,
|
115
112
|
rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
|
116
113
|
var foundAIRow = rows.some(function (r) {
|
117
114
|
var _r$original;
|
@@ -138,9 +135,9 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
138
135
|
var _cell$column, _cell$column2, _content$props, _associatedHeader$;
|
139
136
|
var cellProps = cell.getCellProps();
|
140
137
|
// eslint-disable-next-line no-unused-vars
|
141
|
-
var
|
142
|
-
|
143
|
-
|
138
|
+
var _ref2 = cellProps,
|
139
|
+
children = _ref2.children,
|
140
|
+
restProps = _objectWithoutProperties(_ref2, _excluded2);
|
144
141
|
var columnClassname = cell === null || cell === void 0 || (_cell$column = cell.column) === null || _cell$column === void 0 ? void 0 : _cell$column.className;
|
145
142
|
var content = children || /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !row.isSkeleton && cell.render('Cell'), row.isSkeleton && (_SkeletonText || (_SkeletonText = /*#__PURE__*/React__default.createElement(SkeletonText, null))));
|
146
143
|
if ((cell === null || cell === void 0 || (_cell$column2 = cell.column) === null || _cell$column2 === void 0 ? void 0 : _cell$column2.id) === selectionColumnId) {
|
@@ -150,7 +147,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
150
147
|
});
|
151
148
|
}
|
152
149
|
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;
|
153
|
-
var associatedHeader = headers.filter(function (h) {
|
150
|
+
var associatedHeader = headers === null || headers === void 0 ? void 0 : headers.filter(function (h) {
|
154
151
|
return h.id === cell.column.id;
|
155
152
|
});
|
156
153
|
return /*#__PURE__*/React__default.createElement(TableCell, _extends({
|
@@ -159,8 +156,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
159
156
|
key: cell.column.id,
|
160
157
|
title: title
|
161
158
|
}), content);
|
162
|
-
})), renderExpandedRow());
|
159
|
+
})), (renderExpandedRow === null || renderExpandedRow === void 0 ? void 0 : renderExpandedRow()) || undefined);
|
163
160
|
};
|
164
|
-
var DatagridRow$1 = DatagridRow;
|
165
161
|
|
166
|
-
export { DatagridRow
|
162
|
+
export { DatagridRow as default };
|
@@ -1 +1,9 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { DataGridState } from '../types';
|
8
|
+
declare const SelectAll: (datagridState: DataGridState) => import("react/jsx-runtime").JSX.Element;
|
9
|
+
export { SelectAll };
|
@@ -50,13 +50,13 @@ var SelectAll = function SelectAll(datagridState) {
|
|
50
50
|
if (hideSelectAll || radio) {
|
51
51
|
return /*#__PURE__*/React__default.createElement("div", {
|
52
52
|
className: cx("".concat(blockClass, "__head-hidden-select-all"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), /* istanbul ignore next */
|
53
|
-
isFirstColumnStickyLeft && windowSize > 671))
|
53
|
+
isFirstColumnStickyLeft && Number(windowSize) > 671))
|
54
54
|
});
|
55
55
|
}
|
56
56
|
var getProps = DatagridPagination ? getToggleAllPageRowsSelectedProps : getToggleAllRowsSelectedProps;
|
57
|
-
var
|
58
|
-
onChange =
|
59
|
-
selectProps = _objectWithoutProperties(
|
57
|
+
var _ref = getProps(),
|
58
|
+
onChange = _ref.onChange,
|
59
|
+
selectProps = _objectWithoutProperties(_ref, _excluded);
|
60
60
|
var indeterminate = selectProps.indeterminate;
|
61
61
|
var handleSelectAllChange = function handleSelectAllChange(event) {
|
62
62
|
if (indeterminate) {
|
@@ -64,7 +64,8 @@ var SelectAll = function SelectAll(datagridState) {
|
|
64
64
|
dispatch: dispatch,
|
65
65
|
rows: rows,
|
66
66
|
getRowId: getRowId,
|
67
|
-
indeterminate: true
|
67
|
+
indeterminate: true,
|
68
|
+
isChecked: undefined
|
68
69
|
});
|
69
70
|
toggleAllRowsSelected(false);
|
70
71
|
onAllRowSelect === null || onAllRowSelect === void 0 || onAllRowSelect(rows, event);
|
@@ -78,18 +79,19 @@ var SelectAll = function SelectAll(datagridState) {
|
|
78
79
|
dispatch: dispatch,
|
79
80
|
rows: rows,
|
80
81
|
getRowId: getRowId,
|
81
|
-
isChecked: event.target.checked
|
82
|
+
isChecked: event.target.checked,
|
83
|
+
indeterminate: indeterminate
|
82
84
|
});
|
83
85
|
onAllRowSelect === null || onAllRowSelect === void 0 || onAllRowSelect(rows, event);
|
84
86
|
return onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
85
87
|
};
|
86
88
|
return /*#__PURE__*/React__default.createElement("div", {
|
87
89
|
className: cx("".concat(blockClass, "__head-select-all"), "".concat(blockClass, "__checkbox-cell"), _defineProperty({}, "".concat(blockClass, "__checkbox-cell-sticky-left"), /* istanbul ignore next */
|
88
|
-
isFirstColumnStickyLeft && windowSize > 671))
|
90
|
+
isFirstColumnStickyLeft && Number(windowSize) > 671))
|
89
91
|
}, /*#__PURE__*/React__default.createElement(TableSelectAll, _extends({}, selectProps, {
|
90
92
|
name: "".concat(tableId, "-select-all-checkbox-name"),
|
91
93
|
onSelect: handleSelectAllChange,
|
92
|
-
disabled: isFetching || selectProps.disabled,
|
94
|
+
disabled: isFetching || (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled),
|
93
95
|
id: "".concat(tableId, "-select-all-checkbox-id")
|
94
96
|
})));
|
95
97
|
};
|
@@ -1,28 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
getToggleAllPageRowsSelectedProps: any;
|
8
|
-
getToggleAllRowsSelectedProps: any;
|
9
|
-
allPageRowsLabel?: string | undefined;
|
10
|
-
allRowsLabel?: string | undefined;
|
11
|
-
columns: any;
|
12
|
-
withStickyColumn: any;
|
13
|
-
}): import("react/jsx-runtime").JSX.Element;
|
14
|
-
declare namespace SelectAllWithToggle {
|
15
|
-
namespace propTypes {
|
16
|
-
let allPageRowsLabel: PropTypes.Requireable<string>;
|
17
|
-
let allRowsLabel: PropTypes.Requireable<string>;
|
18
|
-
let columns: PropTypes.Requireable<(object | null | undefined)[]>;
|
19
|
-
let getToggleAllPageRowsSelectedProps: PropTypes.Validator<(...args: any[]) => any>;
|
20
|
-
let getToggleAllRowsSelectedProps: PropTypes.Validator<(...args: any[]) => any>;
|
21
|
-
let isAllRowsSelected: PropTypes.Validator<boolean>;
|
22
|
-
let isFetching: PropTypes.Requireable<boolean>;
|
23
|
-
let selectAllToggle: PropTypes.Requireable<object>;
|
24
|
-
let tableId: PropTypes.Validator<string>;
|
25
|
-
let withStickyColumn: PropTypes.Requireable<boolean>;
|
26
|
-
}
|
27
|
-
}
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
28
7
|
import PropTypes from 'prop-types';
|
8
|
+
import { DataGridState } from '../types';
|
9
|
+
declare const SelectAllWithToggle: {
|
10
|
+
({ tableId, isFetching, isAllRowsSelected, selectAllToggle, getToggleAllPageRowsSelectedProps, getToggleAllRowsSelectedProps, allPageRowsLabel, allRowsLabel, columns, withStickyColumn, }: DataGridState): import("react/jsx-runtime").JSX.Element;
|
11
|
+
propTypes: {
|
12
|
+
allPageRowsLabel: PropTypes.Requireable<string>;
|
13
|
+
allRowsLabel: PropTypes.Requireable<string>;
|
14
|
+
columns: PropTypes.Requireable<(object | null | undefined)[]>;
|
15
|
+
getToggleAllPageRowsSelectedProps: PropTypes.Validator<(...args: any[]) => any>;
|
16
|
+
getToggleAllRowsSelectedProps: PropTypes.Validator<(...args: any[]) => any>;
|
17
|
+
isAllRowsSelected: PropTypes.Validator<boolean>;
|
18
|
+
isFetching: PropTypes.Requireable<boolean>;
|
19
|
+
selectAllToggle: PropTypes.Requireable<object>;
|
20
|
+
tableId: PropTypes.Validator<string>;
|
21
|
+
withStickyColumn: PropTypes.Requireable<boolean>;
|
22
|
+
};
|
23
|
+
};
|
24
|
+
export default SelectAllWithToggle;
|
@@ -57,22 +57,22 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
|
|
57
57
|
};
|
58
58
|
}, []);
|
59
59
|
if (labels) {
|
60
|
-
allPageRowsLabel = labels.allPageRows || allPageRowsLabel;
|
60
|
+
allPageRowsLabel = (labels === null || labels === void 0 ? void 0 : labels.allPageRows) || allPageRowsLabel;
|
61
61
|
allRowsLabel = labels.allRows || allRowsLabel;
|
62
62
|
}
|
63
63
|
var getProps = selectAllMode === SELECT_ALL_PAGE_ROWS ? getToggleAllPageRowsSelectedProps : getToggleAllRowsSelectedProps;
|
64
|
-
var
|
65
|
-
onChange =
|
66
|
-
selectProps = _objectWithoutProperties(
|
64
|
+
var _ref3 = getProps(),
|
65
|
+
onChange = _ref3.onChange,
|
66
|
+
selectProps = _objectWithoutProperties(_ref3, _excluded);
|
67
67
|
var disabled = isFetching || selectProps.disabled;
|
68
|
-
var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
|
68
|
+
var isFirstColumnStickyLeft = (columns === null || columns === void 0 || (_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
|
69
69
|
return /*#__PURE__*/React__default.createElement("th", {
|
70
70
|
scope: "col",
|
71
71
|
className: cx("".concat(blockClass, "__select-all-toggle-on"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), isFirstColumnStickyLeft && windowSize > 671))
|
72
72
|
}, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(Checkbox, _extends({}, selectProps, {
|
73
73
|
name: "".concat(tableId, "-select-all-checkbox-name"),
|
74
74
|
onClick: function onClick(e) {
|
75
|
-
onChange(e);
|
75
|
+
onChange === null || onChange === void 0 || onChange(e);
|
76
76
|
},
|
77
77
|
disabled: disabled,
|
78
78
|
id: "".concat(tableId, "-select-all-checkbox-id"),
|
@@ -92,9 +92,10 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
|
|
92
92
|
requireTitle: true,
|
93
93
|
disabled: disabled,
|
94
94
|
onClick: function onClick() {
|
95
|
+
var _ref4;
|
95
96
|
setSelectAllMode(SELECT_ALL_PAGE_ROWS);
|
96
97
|
// deselect all rows first
|
97
|
-
getToggleAllRowsSelectedProps().onChange({
|
98
|
+
getToggleAllRowsSelectedProps === null || getToggleAllRowsSelectedProps === void 0 || (_ref4 = getToggleAllRowsSelectedProps()) === null || _ref4 === void 0 || _ref4.onChange({
|
98
99
|
target: {
|
99
100
|
checked: false
|
100
101
|
}
|
@@ -132,6 +133,5 @@ SelectAllWithToggle.propTypes = {
|
|
132
133
|
tableId: PropTypes.string.isRequired,
|
133
134
|
withStickyColumn: PropTypes.bool
|
134
135
|
};
|
135
|
-
var SelectAllWithToggle$1 = SelectAllWithToggle;
|
136
136
|
|
137
|
-
export { SelectAllWithToggle
|
137
|
+
export { SelectAllWithToggle as default };
|
@@ -1,2 +1,3 @@
|
|
1
|
+
import { DataGridState } from '../types';
|
2
|
+
declare const DatagridSimpleBody: (datagridState: DataGridState) => import("react/jsx-runtime").JSX.Element;
|
1
3
|
export default DatagridSimpleBody;
|
2
|
-
declare function DatagridSimpleBody(datagridState: any): import("react/jsx-runtime").JSX.Element;
|
@@ -22,15 +22,15 @@ var DatagridSimpleBody = function DatagridSimpleBody(datagridState) {
|
|
22
22
|
"aria-live": null,
|
23
23
|
className: cx("".concat(blockClass, "__simple-body"), getTableBodyProps().className)
|
24
24
|
}), rows.map(function (row) {
|
25
|
+
var _row$RowRenderer;
|
25
26
|
prepareRow(row);
|
26
27
|
var _row$getRowProps = row.getRowProps(),
|
27
28
|
key = _row$getRowProps.key;
|
28
|
-
return row.RowRenderer(_objectSpread2(_objectSpread2({}, datagridState), {}, {
|
29
|
+
return row === null || row === void 0 || (_row$RowRenderer = row.RowRenderer) === null || _row$RowRenderer === void 0 ? void 0 : _row$RowRenderer.call(row, _objectSpread2(_objectSpread2({}, datagridState), {}, {
|
29
30
|
row: row,
|
30
31
|
key: key
|
31
32
|
}));
|
32
33
|
}));
|
33
34
|
};
|
34
|
-
var DatagridSimpleBody$1 = DatagridSimpleBody;
|
35
35
|
|
36
|
-
export { DatagridSimpleBody
|
36
|
+
export { DatagridSimpleBody as default };
|
@@ -1,11 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
namespace propTypes {
|
8
|
-
let ariaToolbarLabel: PropTypes.Requireable<string>;
|
9
|
-
}
|
10
|
-
}
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2021, 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
11
7
|
import PropTypes from 'prop-types';
|
8
|
+
import { DataGridState } from '../types';
|
9
|
+
interface DatagridToolbarProps {
|
10
|
+
ariaToolbarLabel?: string;
|
11
|
+
}
|
12
|
+
declare const DatagridToolbar: {
|
13
|
+
({ ariaToolbarLabel, ...datagridState }: DatagridToolbarProps & DataGridState): import("react/jsx-runtime").JSX.Element | null;
|
14
|
+
propTypes: {
|
15
|
+
ariaToolbarLabel: PropTypes.Requireable<string>;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
export default DatagridToolbar;
|
@@ -48,13 +48,14 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
48
48
|
// the ButtonMenu
|
49
49
|
useEffect(function () {
|
50
50
|
if (totalSelected === 1 && !receivedInitialWidth) {
|
51
|
-
var
|
51
|
+
var _ref$current;
|
52
|
+
var batchActionListWidth = ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector(".".concat(carbon.prefix, "--action-list")).offsetWidth;
|
52
53
|
setInitialListWidth(batchActionListWidth);
|
53
54
|
setReceivedInitialWidth(true);
|
54
55
|
}
|
55
56
|
}, [totalSelected, receivedInitialWidth, ref]);
|
56
57
|
useEffect(function () {
|
57
|
-
var summaryWidth = ref.current.querySelector(".".concat(carbon.prefix, "--batch-summary")).offsetWidth;
|
58
|
+
var summaryWidth = ref === null || ref === void 0 ? void 0 : ref.current.querySelector(".".concat(carbon.prefix, "--batch-summary")).offsetWidth;
|
58
59
|
if (width < summaryWidth + initialListWidth + 32) {
|
59
60
|
setDisplayAllInMenu(true);
|
60
61
|
} else {
|
@@ -79,7 +80,7 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
79
80
|
var minWidthBeforeOverflowIcon = 380;
|
80
81
|
// Do not render ButtonMenu when there are 3 or less items
|
81
82
|
// and if there is enough available space to render all the items
|
82
|
-
if ((toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.length) <= 3 && !displayAllInMenu) {
|
83
|
+
if (toolbarBatchActions && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.length) <= 3 && !displayAllInMenu) {
|
83
84
|
return;
|
84
85
|
}
|
85
86
|
var renderItem = function renderItem(batchAction, index) {
|
@@ -94,7 +95,8 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
94
95
|
return /*#__PURE__*/React__default.createElement(MenuButton, {
|
95
96
|
label: batchActionMenuButtonLabelText,
|
96
97
|
className: cx([menuClass, _defineProperty({}, "".concat(menuClass, "-icon-only"), width <= minWidthBeforeOverflowIcon)]),
|
97
|
-
tabIndex: totalSelected > 0 ? 0 : -1
|
98
|
+
tabIndex: totalSelected > 0 ? 0 : -1,
|
99
|
+
menuAlignment: "bottom"
|
98
100
|
}, toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
99
101
|
var hidden = index < 2 && !displayAllInMenu;
|
100
102
|
if (!hidden) {
|
@@ -113,10 +115,11 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
113
115
|
dispatch: dispatch,
|
114
116
|
rows: [],
|
115
117
|
getRowId: getRowId,
|
116
|
-
isChecked: false
|
118
|
+
isChecked: false,
|
119
|
+
indeterminate: undefined
|
117
120
|
});
|
118
121
|
toggleAllRowsSelected(false);
|
119
|
-
setGlobalFilter(null);
|
122
|
+
setGlobalFilter === null || setGlobalFilter === void 0 || setGlobalFilter(null);
|
120
123
|
};
|
121
124
|
var onSelectAllHandler = function onSelectAllHandler() {
|
122
125
|
toggleAllRowsSelected(true);
|
@@ -124,7 +127,9 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
124
127
|
handleSelectAllRowData({
|
125
128
|
dispatch: dispatch,
|
126
129
|
rows: rows,
|
127
|
-
getRowId: getRowId
|
130
|
+
getRowId: getRowId,
|
131
|
+
indeterminate: undefined,
|
132
|
+
isChecked: undefined
|
128
133
|
});
|
129
134
|
};
|
130
135
|
|
@@ -168,15 +173,14 @@ var DatagridToolbar = function DatagridToolbar(_ref2) {
|
|
168
173
|
className: cx([blockClass, "".concat(blockClass, "--").concat(getRowHeight)])
|
169
174
|
}, /*#__PURE__*/React__default.createElement(TableToolbar, {
|
170
175
|
"aria-label": ariaToolbarLabel
|
171
|
-
}, DatagridActions && /*#__PURE__*/React__default.createElement(DatagridActions, datagridState), DatagridBatchActionsToolbar
|
176
|
+
}, DatagridActions && /*#__PURE__*/React__default.createElement(DatagridActions, datagridState), DatagridBatchActionsToolbar === null || DatagridBatchActionsToolbar === void 0 ? void 0 : DatagridBatchActionsToolbar(datagridState, width, ref))) : DatagridActions ? /*#__PURE__*/React__default.createElement("div", {
|
172
177
|
className: blockClass
|
173
178
|
}, /*#__PURE__*/React__default.createElement(TableToolbar, {
|
174
179
|
"aria-label": ariaToolbarLabel
|
175
|
-
}, DatagridActions && /*#__PURE__*/React__default.createElement(DatagridActions, datagridState), DatagridBatchActions
|
180
|
+
}, DatagridActions && /*#__PURE__*/React__default.createElement(DatagridActions, datagridState), DatagridBatchActions === null || DatagridBatchActions === void 0 ? void 0 : DatagridBatchActions(datagridState))) : null;
|
176
181
|
};
|
177
182
|
DatagridToolbar.propTypes = {
|
178
183
|
ariaToolbarLabel: PropTypes.string
|
179
184
|
};
|
180
|
-
var DatagridToolbar$1 = DatagridToolbar;
|
181
185
|
|
182
|
-
export { DatagridToolbar
|
186
|
+
export { DatagridToolbar as default };
|