@carbon/ibm-products 2.15.2 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +195 -1
- 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 +1 -1
- 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 +195 -1
- 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 +5 -1
- 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/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +3 -3
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +36 -22
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +12 -11
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +24 -13
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +2 -2
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +50 -14
- package/es/components/Datagrid/Datagrid.docs-page.js +3 -3
- package/es/components/Datagrid/useDatagrid.js +5 -1
- package/es/components/Datagrid/useOnRowClick.js +6 -7
- package/es/components/Datagrid/useSelectRows.js +8 -5
- package/es/components/Datagrid/useSortableColumns.js +5 -7
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +2 -1
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +2 -1
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +2 -1
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +2 -1
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +2 -1
- package/es/components/EmptyStates/assets/ErrorIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NoDataIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +5 -3
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -3
- package/es/components/InlineTip/InlineTip.docs-page.js +13 -0
- package/es/components/InlineTip/InlineTip.js +217 -0
- package/es/components/InlineTip/InlineTipButton.js +53 -0
- package/es/components/InlineTip/InlineTipLink.js +57 -0
- package/es/components/InlineTip/index.js +10 -0
- package/es/components/InlineTip/utils.js +36 -0
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.docs-page.js +11 -0
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +140 -0
- package/es/components/SteppedAnimatedMedia/assets/index.js +4 -0
- package/es/components/SteppedAnimatedMedia/index.js +8 -0
- package/es/global/js/package-settings.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +3 -3
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +41 -29
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +11 -11
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +23 -12
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +2 -2
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +51 -15
- package/lib/components/Datagrid/Datagrid.docs-page.js +3 -3
- package/lib/components/Datagrid/useDatagrid.js +5 -1
- package/lib/components/Datagrid/useOnRowClick.js +6 -7
- package/lib/components/Datagrid/useSelectRows.js +8 -5
- package/lib/components/Datagrid/useSortableColumns.js +5 -7
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +2 -1
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +2 -1
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +2 -1
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +2 -1
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +2 -1
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -3
- package/lib/components/InlineTip/InlineTip.docs-page.js +23 -0
- package/lib/components/InlineTip/InlineTip.js +224 -0
- package/lib/components/InlineTip/InlineTipButton.js +57 -0
- package/lib/components/InlineTip/InlineTipLink.js +61 -0
- package/lib/components/InlineTip/index.js +26 -0
- package/lib/components/InlineTip/utils.js +43 -0
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.docs-page.js +21 -0
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +148 -0
- package/lib/components/SteppedAnimatedMedia/assets/index.js +9 -0
- package/lib/components/SteppedAnimatedMedia/index.js +12 -0
- package/lib/global/js/package-settings.js +2 -1
- package/package.json +2 -2
- package/scss/components/Datagrid/styles/_datagrid.scss +5 -0
- package/scss/components/InlineTip/_index.scss +8 -0
- package/scss/components/InlineTip/_inline-tip.scss +229 -0
- package/scss/components/InlineTip/_storybook-styles.scss +20 -0
- package/scss/components/SidePanel/_side-panel.scss +1 -4
- package/scss/components/SteppedAnimatedMedia/_index.scss +8 -0
- package/scss/components/SteppedAnimatedMedia/_stepped-animated-media.scss +6 -0
- package/scss/components/SteppedAnimatedMedia/_storybook-styles.scss +13 -0
- package/scss/components/_index.scss +1 -0
@@ -3,14 +3,13 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
5
5
|
var _excluded = ["onChange"];
|
6
|
-
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
6
|
+
/**
|
7
|
+
* Copyright IBM Corp. 2020, 2023
|
8
|
+
*
|
9
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
12
11
|
*/
|
13
|
-
|
12
|
+
|
14
13
|
import React, { useLayoutEffect, useState } from 'react';
|
15
14
|
import { TableSelectAll } from '@carbon/react';
|
16
15
|
import cx from 'classnames';
|
@@ -23,6 +22,7 @@ var SelectAll = function SelectAll(datagridState) {
|
|
23
22
|
windowSize = _useState2[0],
|
24
23
|
setWindowSize = _useState2[1];
|
25
24
|
useLayoutEffect(function () {
|
25
|
+
/* istanbul ignore next */
|
26
26
|
function updateSize() {
|
27
27
|
setWindowSize(window.innerWidth);
|
28
28
|
}
|
@@ -43,15 +43,15 @@ var SelectAll = function SelectAll(datagridState) {
|
|
43
43
|
var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
|
44
44
|
if (hideSelectAll || radio) {
|
45
45
|
return /*#__PURE__*/React.createElement("div", {
|
46
|
-
className: cx("".concat(blockClass, "__head-hidden-select-all"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"),
|
46
|
+
className: cx("".concat(blockClass, "__head-hidden-select-all"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), /* istanbul ignore next */
|
47
|
+
isFirstColumnStickyLeft && windowSize > 671))
|
47
48
|
});
|
48
49
|
}
|
49
50
|
var getProps = DatagridPagination ? getToggleAllPageRowsSelectedProps : getToggleAllRowsSelectedProps;
|
50
51
|
var _getProps = getProps(),
|
51
52
|
onChange = _getProps.onChange,
|
52
53
|
selectProps = _objectWithoutProperties(_getProps, _excluded);
|
53
|
-
var
|
54
|
-
indeterminate = _ref.indeterminate;
|
54
|
+
var indeterminate = selectProps.indeterminate;
|
55
55
|
var handleSelectAllChange = function handleSelectAllChange(event) {
|
56
56
|
if (indeterminate) {
|
57
57
|
return onChange === null || onChange === void 0 ? void 0 : onChange({
|
@@ -63,7 +63,8 @@ var SelectAll = function SelectAll(datagridState) {
|
|
63
63
|
return onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
64
64
|
};
|
65
65
|
return /*#__PURE__*/React.createElement("div", {
|
66
|
-
className: cx("".concat(blockClass, "__head-select-all"), "".concat(blockClass, "__checkbox-cell"), _defineProperty({}, "".concat(blockClass, "__checkbox-cell-sticky-left"),
|
66
|
+
className: cx("".concat(blockClass, "__head-select-all"), "".concat(blockClass, "__checkbox-cell"), _defineProperty({}, "".concat(blockClass, "__checkbox-cell-sticky-left"), /* istanbul ignore next */
|
67
|
+
isFirstColumnStickyLeft && windowSize > 671))
|
67
68
|
}, /*#__PURE__*/React.createElement(TableSelectAll, _extends({}, selectProps, {
|
68
69
|
name: "".concat(tableId, "-select-all-checkbox-name"),
|
69
70
|
onSelect: handleSelectAllChange,
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
4
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
@@ -9,7 +8,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
9
8
|
* LICENSE file in the root directory of this source tree.
|
10
9
|
*/
|
11
10
|
|
12
|
-
import React, { useEffect } from 'react';
|
11
|
+
import React, { useEffect, useRef } from 'react';
|
13
12
|
import { VariableSizeList } from 'react-window';
|
14
13
|
import { TableBody } from '@carbon/react';
|
15
14
|
import { pkg } from '../../../settings';
|
@@ -40,19 +39,15 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
40
39
|
DatagridPagination = datagridState.DatagridPagination,
|
41
40
|
page = datagridState.page,
|
42
41
|
handleResize = datagridState.handleResize,
|
43
|
-
gridRef = datagridState.gridRef
|
42
|
+
gridRef = datagridState.gridRef,
|
43
|
+
tableId = datagridState.tableId;
|
44
|
+
|
45
|
+
/* istanbul ignore next */
|
44
46
|
var handleVirtualGridResize = function handleVirtualGridResize() {
|
45
47
|
var gridRefElement = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current;
|
46
48
|
gridRefElement.style.width = gridRefElement === null || gridRefElement === void 0 ? void 0 : gridRefElement.clientWidth;
|
47
49
|
};
|
48
50
|
useResizeObserver(gridRef, handleVirtualGridResize);
|
49
|
-
var syncScroll = function syncScroll(event) {
|
50
|
-
var virtualBody = event.target;
|
51
|
-
document.querySelector(".".concat(blockClass, "__head-wrap")).scrollLeft = virtualBody.scrollLeft;
|
52
|
-
var spacerColumn = document.querySelector(".".concat(blockClass, "__head-wrap thead th:last-child"));
|
53
|
-
spacerColumn.style.width = px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
|
54
|
-
};
|
55
|
-
|
56
51
|
useEffect(function () {
|
57
52
|
handleResize();
|
58
53
|
}, [handleResize]);
|
@@ -61,15 +56,30 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
61
56
|
listRef.current.resetAfterIndex(0);
|
62
57
|
}
|
63
58
|
var visibleRows = DatagridPagination && page || rows;
|
59
|
+
var testRef = useRef();
|
60
|
+
|
61
|
+
// Sync the scrollLeft position of the virtual body to the table header
|
62
|
+
useEffect(function () {
|
63
|
+
function handleScroll(event) {
|
64
|
+
var virtualBody = event.target;
|
65
|
+
document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap")).scrollLeft = virtualBody.scrollLeft;
|
66
|
+
var spacerColumn = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap thead th:last-child"));
|
67
|
+
spacerColumn.style.width = px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
|
68
|
+
}
|
69
|
+
|
70
|
+
var testRefValue = testRef.current;
|
71
|
+
testRefValue.addEventListener('scroll', handleScroll);
|
72
|
+
return function () {
|
73
|
+
testRefValue.removeEventListener('scroll', handleScroll);
|
74
|
+
};
|
75
|
+
});
|
64
76
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
65
77
|
className: "".concat(blockClass, "__head-wrap"),
|
66
78
|
style: {
|
67
79
|
width: (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
|
68
80
|
overflow: 'hidden'
|
69
81
|
}
|
70
|
-
}, /*#__PURE__*/React.createElement(DatagridHead, datagridState)), /*#__PURE__*/React.createElement(TableBody,
|
71
|
-
onScroll: syncScroll
|
72
|
-
}), /*#__PURE__*/React.createElement(VariableSizeList, {
|
82
|
+
}, /*#__PURE__*/React.createElement(DatagridHead, datagridState)), /*#__PURE__*/React.createElement(TableBody, getTableBodyProps(), /*#__PURE__*/React.createElement(VariableSizeList, {
|
73
83
|
height: virtualHeight || tableHeight,
|
74
84
|
itemCount: visibleRows.length,
|
75
85
|
itemSize: function itemSize(index) {
|
@@ -78,6 +88,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
78
88
|
estimatedItemSize: rowHeight,
|
79
89
|
onScroll: onScroll,
|
80
90
|
innerRef: innerListRef,
|
91
|
+
outerRef: testRef,
|
81
92
|
ref: listRef,
|
82
93
|
className: "".concat(blockClass, "__virtual-scrollbar"),
|
83
94
|
style: {
|
@@ -66,10 +66,10 @@ export var DraggableItemsList = function DraggableItemsList(_ref) {
|
|
66
66
|
if (destOverCol !== null && destOverCol !== void 0 && destOverCol.length && (_destOverCol$ = destOverCol[0]) !== null && _destOverCol$ !== void 0 && _destOverCol$.disabled) {
|
67
67
|
return;
|
68
68
|
}
|
69
|
-
var fromVisibleIndex =
|
69
|
+
var fromVisibleIndex = updatedDragCols.findIndex(function (col) {
|
70
70
|
return matchedColsById(col, active);
|
71
71
|
});
|
72
|
-
var toVisibleIndex =
|
72
|
+
var toVisibleIndex = updatedDragCols.findIndex(function (col) {
|
73
73
|
return matchedColsById(col, over);
|
74
74
|
});
|
75
75
|
var colTitle = getNodeTextContent(updatedDragCols[fromVisibleIndex].Header);
|
@@ -15,6 +15,7 @@ var COLUMN_RESIZE_START = 'columnStartResizing';
|
|
15
15
|
var COLUMN_RESIZING = 'columnResizing';
|
16
16
|
var COLUMN_RESIZE_END = 'columnDoneResizing';
|
17
17
|
var INIT = 'init';
|
18
|
+
var TOGGLE_ROW_SELECTED = 'toggleRowSelected';
|
18
19
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
19
20
|
export var handleColumnResizeEndEvent = function handleColumnResizeEndEvent(dispatch, onColResizeEnd, headerId, isKeyEvent) {
|
20
21
|
dispatch({
|
@@ -46,8 +47,43 @@ export var handleColumnResizingEvent = function handleColumnResizingEvent(dispat
|
|
46
47
|
}
|
47
48
|
});
|
48
49
|
};
|
50
|
+
export var handleToggleRowSelected = function handleToggleRowSelected(dispatch, rowData, isChecked) {
|
51
|
+
return dispatch({
|
52
|
+
type: TOGGLE_ROW_SELECTED,
|
53
|
+
payload: {
|
54
|
+
rowData: rowData,
|
55
|
+
isChecked: isChecked
|
56
|
+
}
|
57
|
+
});
|
58
|
+
};
|
49
59
|
export var stateReducer = function stateReducer(newState, action) {
|
50
60
|
switch (action.type) {
|
61
|
+
case TOGGLE_ROW_SELECTED:
|
62
|
+
{
|
63
|
+
var _ref = action.payload || {},
|
64
|
+
rowData = _ref.rowData,
|
65
|
+
isChecked = _ref.isChecked;
|
66
|
+
if (!rowData) {
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
if (isChecked) {
|
70
|
+
return _objectSpread(_objectSpread({}, newState), {}, {
|
71
|
+
selectedRowData: _objectSpread(_objectSpread({}, newState.selectedRowData), {}, _defineProperty({}, rowData.index, rowData))
|
72
|
+
});
|
73
|
+
}
|
74
|
+
if (rowData && !isChecked) {
|
75
|
+
var newData = _objectSpread({}, newState.selectedRowData);
|
76
|
+
var dataWithRemovedRow = Object.fromEntries(Object.entries(newData).filter(function (_ref2) {
|
77
|
+
var _ref3 = _slicedToArray(_ref2, 1),
|
78
|
+
key = _ref3[0];
|
79
|
+
return parseInt(key) !== parseInt(rowData.index);
|
80
|
+
}));
|
81
|
+
return _objectSpread(_objectSpread({}, newState), {}, {
|
82
|
+
selectedRowData: dataWithRemovedRow
|
83
|
+
});
|
84
|
+
}
|
85
|
+
return _objectSpread({}, newState);
|
86
|
+
}
|
51
87
|
case INIT:
|
52
88
|
{
|
53
89
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
@@ -56,27 +92,27 @@ export var stateReducer = function stateReducer(newState, action) {
|
|
56
92
|
}
|
57
93
|
case COLUMN_RESIZE_START:
|
58
94
|
{
|
59
|
-
var
|
60
|
-
headerId =
|
95
|
+
var _ref4 = action.payload || {},
|
96
|
+
headerId = _ref4.headerId;
|
61
97
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
62
98
|
isResizing: headerId
|
63
99
|
});
|
64
100
|
}
|
65
101
|
case COLUMN_RESIZING:
|
66
102
|
{
|
67
|
-
var
|
68
|
-
_headerId =
|
69
|
-
newWidth =
|
70
|
-
defaultWidth =
|
103
|
+
var _ref5 = action.payload || {},
|
104
|
+
_headerId = _ref5.headerId,
|
105
|
+
newWidth = _ref5.newWidth,
|
106
|
+
defaultWidth = _ref5.defaultWidth;
|
71
107
|
var newColumnWidth = {};
|
72
108
|
if (typeof _headerId === 'undefined') {
|
73
109
|
return _objectSpread({}, newState);
|
74
110
|
}
|
75
111
|
newColumnWidth[_headerId] = newWidth;
|
76
|
-
var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (
|
77
|
-
var
|
78
|
-
_ =
|
79
|
-
value =
|
112
|
+
var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (_ref6) {
|
113
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
114
|
+
_ = _ref7[0],
|
115
|
+
value = _ref7[1];
|
80
116
|
return !isNaN(value);
|
81
117
|
}));
|
82
118
|
var headerIdArray = newState.columnResizing.headerIdWidths || [];
|
@@ -91,10 +127,10 @@ export var stateReducer = function stateReducer(newState, action) {
|
|
91
127
|
}
|
92
128
|
case COLUMN_RESIZE_END:
|
93
129
|
{
|
94
|
-
var
|
95
|
-
onColResizeEnd =
|
96
|
-
_headerId2 =
|
97
|
-
isKeyEvent =
|
130
|
+
var _ref8 = action.payload || {},
|
131
|
+
onColResizeEnd = _ref8.onColResizeEnd,
|
132
|
+
_headerId2 = _ref8.headerId,
|
133
|
+
isKeyEvent = _ref8.isKeyEvent;
|
98
134
|
var currentColumn = {};
|
99
135
|
currentColumn[_headerId2] = newState.columnResizing.columnWidths[_headerId2];
|
100
136
|
var allChangedColumns = newState.columnResizing.columnWidths;
|
@@ -45,13 +45,13 @@ export var DocsPage = function DocsPage() {
|
|
45
45
|
description: "There is also an optional resize callback when resizing columns, allowing you to save the widths of columns that have been resized. The resize callback returns the column that was just resized and it's width, in addition to all of the columns that have been resized and their widths.",
|
46
46
|
source: {
|
47
47
|
language: 'jsx',
|
48
|
-
code: "\nuseDatagrid({\n columns,\n data,\n onColResizeEnd: (currentColumn, allColumns) =>\n console.log(currentColumn, allColumns),\n});\n "
|
48
|
+
code: "\nuseDatagrid({\n columns,\n data,\n onColResizeEnd: (currentColumn, allColumns) =>\n console.log(currentColumn, allColumns),\n resizerAriaLabel: 'Resize column',\n});\n "
|
49
49
|
}
|
50
50
|
}, {
|
51
|
-
description: 'Disabling the resizable columns is possible by specifying `disableResizing: true` within the `useDatagrid` hook.',
|
51
|
+
description: 'Disabling the resizable columns is possible by specifying `disableResizing: true` within the `useDatagrid` hook. To pass in your own translated label for the column resizer, add the `resizerAriaLabel` property',
|
52
52
|
source: {
|
53
53
|
language: 'jsx',
|
54
|
-
code: "\nuseDatagrid({\n columns,\n data,\n disableResizing: true,\n});\n "
|
54
|
+
code: "\nuseDatagrid({\n columns,\n data,\n disableResizing: true,\n resizerAriaLabel: 'Resize column',\n});\n "
|
55
55
|
}
|
56
56
|
}, {
|
57
57
|
title: 'Rendering the table toolbar',
|
@@ -32,6 +32,9 @@ var useDatagrid = function useDatagrid(params) {
|
|
32
32
|
}
|
33
33
|
var defaultEndPlugins = [usePagination, useRowSelect, useFlexResize, useFloatingScroll];
|
34
34
|
var clientEndPlugins = params.endPlugins || [];
|
35
|
+
var defaultColumn = {
|
36
|
+
minWidth: 50
|
37
|
+
};
|
35
38
|
var tableId = useMemo(function () {
|
36
39
|
return uniqueId('datagrid-table-id');
|
37
40
|
}, []);
|
@@ -41,7 +44,8 @@ var useDatagrid = function useDatagrid(params) {
|
|
41
44
|
var tableState = useTable.apply(void 0, [_objectSpread(_objectSpread({
|
42
45
|
tableId: tableId
|
43
46
|
}, params), {}, {
|
44
|
-
stateReducer: stateReducer
|
47
|
+
stateReducer: stateReducer,
|
48
|
+
defaultColumn: defaultColumn
|
45
49
|
})].concat(defaultPlugins, plugins, defaultEndPlugins, _toConsumableArray(clientEndPlugins)));
|
46
50
|
return tableState;
|
47
51
|
};
|
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
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.
|
7
6
|
*/
|
8
7
|
|
9
8
|
import { pkg, carbon } from '../../settings';
|
@@ -43,7 +42,7 @@ var useOnRowClick = function useOnRowClick(hooks) {
|
|
43
42
|
var onKeyDown = function onKeyDown(event) {
|
44
43
|
var key = event.key;
|
45
44
|
if (key === 'Enter') {
|
46
|
-
onClick();
|
45
|
+
onClick(event);
|
47
46
|
}
|
48
47
|
};
|
49
48
|
return [props, {
|
@@ -20,6 +20,7 @@ import { TableSelectRow } from '@carbon/react';
|
|
20
20
|
import { SelectAll } from './Datagrid/DatagridSelectAll';
|
21
21
|
import { selectionColumnId } from './common-column-ids';
|
22
22
|
import { pkg, carbon } from '../../settings';
|
23
|
+
import { handleToggleRowSelected } from './Datagrid/addons/stateReducer';
|
23
24
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
24
25
|
var checkboxClass = "".concat(pkg.prefix, "--datagrid__checkbox-cell");
|
25
26
|
var useSelectRows = function useSelectRows(hooks) {
|
@@ -77,7 +78,8 @@ var SelectRow = function SelectRow(datagridState) {
|
|
77
78
|
onRadioSelect = datagridState.onRadioSelect,
|
78
79
|
onRowSelect = datagridState.onRowSelect,
|
79
80
|
columns = datagridState.columns,
|
80
|
-
withStickyColumn = datagridState.withStickyColumn
|
81
|
+
withStickyColumn = datagridState.withStickyColumn,
|
82
|
+
dispatch = datagridState.dispatch;
|
81
83
|
var _useState = useState(window.innerWidth),
|
82
84
|
_useState2 = _slicedToArray(_useState, 2),
|
83
85
|
windowSize = _useState2[0],
|
@@ -91,16 +93,17 @@ var SelectRow = function SelectRow(datagridState) {
|
|
91
93
|
return window.removeEventListener('resize', updateSize);
|
92
94
|
};
|
93
95
|
}, []);
|
94
|
-
var onSelectHandler = function onSelectHandler(
|
95
|
-
|
96
|
+
var onSelectHandler = function onSelectHandler(event) {
|
97
|
+
event.stopPropagation(); // avoid triggering onRowClick
|
96
98
|
if (radio) {
|
97
99
|
toggleAllRowsSelected(false);
|
98
100
|
if (onRadioSelect) {
|
99
101
|
onRadioSelect(row);
|
100
102
|
}
|
101
103
|
}
|
102
|
-
onChange(
|
103
|
-
onRowSelect === null || onRowSelect === void 0 || onRowSelect(row,
|
104
|
+
onChange(event);
|
105
|
+
onRowSelect === null || onRowSelect === void 0 || onRowSelect(row, event);
|
106
|
+
handleToggleRowSelected(dispatch, row, event.target.checked);
|
104
107
|
};
|
105
108
|
var selectDisabled = isFetching || row.getRowProps().disabled;
|
106
109
|
var _row$getToggleRowSele2 = row.getToggleRowSelectedProps(),
|
@@ -28,9 +28,8 @@ var getAriaSortValue = function getAriaSortValue(col, _ref) {
|
|
28
28
|
if (!col) {
|
29
29
|
return;
|
30
30
|
}
|
31
|
-
var
|
32
|
-
|
33
|
-
isSortedDesc = _ref2.isSortedDesc;
|
31
|
+
var isSorted = col.isSorted,
|
32
|
+
isSortedDesc = col.isSortedDesc;
|
34
33
|
if (!isSorted) {
|
35
34
|
return defaultSortableLabelText;
|
36
35
|
}
|
@@ -45,17 +44,16 @@ var getAriaPressedValue = function getAriaPressedValue(col) {
|
|
45
44
|
if (!col) {
|
46
45
|
return;
|
47
46
|
}
|
48
|
-
var
|
49
|
-
isSorted = _ref3.isSorted;
|
47
|
+
var isSorted = col.isSorted;
|
50
48
|
if (isSorted) {
|
51
49
|
return 'true';
|
52
50
|
}
|
53
51
|
return 'false';
|
54
52
|
};
|
55
53
|
var useSortableColumns = function useSortableColumns(hooks) {
|
56
|
-
var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns,
|
54
|
+
var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref2) {
|
57
55
|
var _instance$customizeCo;
|
58
|
-
var instance =
|
56
|
+
var instance = _ref2.instance;
|
59
57
|
var onSort = instance.onSort,
|
60
58
|
ascendingSortableLabelText = instance.ascendingSortableLabelText,
|
61
59
|
descendingSortableLabelText = instance.descendingSortableLabelText,
|
@@ -48,7 +48,8 @@ export var ErrorEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
48
48
|
ref: ref
|
49
49
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(ErrorIllustration, {
|
50
50
|
theme: illustrationTheme,
|
51
|
-
size: size
|
51
|
+
size: size,
|
52
|
+
title: title
|
52
53
|
}), /*#__PURE__*/React.createElement(EmptyStateContent, {
|
53
54
|
action: action,
|
54
55
|
link: link,
|
@@ -48,7 +48,8 @@ export var NoTagsEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
48
48
|
ref: ref
|
49
49
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NoTagsIllustration, {
|
50
50
|
theme: illustrationTheme,
|
51
|
-
size: size
|
51
|
+
size: size,
|
52
|
+
title: title
|
52
53
|
}), /*#__PURE__*/React.createElement(EmptyStateContent, {
|
53
54
|
action: action,
|
54
55
|
link: link,
|
@@ -48,7 +48,8 @@ export var NotFoundEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, re
|
|
48
48
|
ref: ref
|
49
49
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NotFoundIllustration, {
|
50
50
|
theme: illustrationTheme,
|
51
|
-
size: size
|
51
|
+
size: size,
|
52
|
+
title: title
|
52
53
|
}), /*#__PURE__*/React.createElement(EmptyStateContent, {
|
53
54
|
action: action,
|
54
55
|
link: link,
|
@@ -48,7 +48,8 @@ export var NotificationsEmptyState = /*#__PURE__*/React.forwardRef(function (_re
|
|
48
48
|
ref: ref
|
49
49
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NotificationsIllustration, {
|
50
50
|
size: size,
|
51
|
-
theme: illustrationTheme
|
51
|
+
theme: illustrationTheme,
|
52
|
+
title: title
|
52
53
|
}), /*#__PURE__*/React.createElement(EmptyStateContent, {
|
53
54
|
action: action,
|
54
55
|
link: link,
|
@@ -48,7 +48,8 @@ export var UnauthorizedEmptyState = /*#__PURE__*/React.forwardRef(function (_ref
|
|
48
48
|
ref: ref
|
49
49
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(UnauthorizedIllustration, {
|
50
50
|
size: size,
|
51
|
-
theme: illustrationTheme
|
51
|
+
theme: illustrationTheme,
|
52
|
+
title: title
|
52
53
|
}), /*#__PURE__*/React.createElement(EmptyStateContent, {
|
53
54
|
action: action,
|
54
55
|
link: link,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["theme", "size"];
|
3
|
+
var _excluded = ["theme", "title", "size"];
|
4
4
|
/**
|
5
5
|
* Copyright IBM Corp. 2020, 2021
|
6
6
|
*
|
@@ -21,6 +21,7 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
|
|
21
21
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
22
22
|
export var ErrorIllustration = function ErrorIllustration(_ref) {
|
23
23
|
var theme = _ref.theme,
|
24
|
+
title = _ref.title,
|
24
25
|
size = _ref.size,
|
25
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
26
27
|
var svgId = uuidv4();
|
@@ -31,7 +32,7 @@ export var ErrorIllustration = function ErrorIllustration(_ref) {
|
|
31
32
|
viewBox: "0 0 80 80",
|
32
33
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-error"), "".concat(blockClass, "__illustration--").concat(size)]),
|
33
34
|
role: "img"
|
34
|
-
}), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
35
|
+
}), /*#__PURE__*/React.createElement("title", null, title), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
35
36
|
id: "prefix__a_dark_".concat(svgId),
|
36
37
|
x1: 38.9,
|
37
38
|
y1: 77.08,
|
@@ -209,5 +210,6 @@ export var ErrorIllustration = function ErrorIllustration(_ref) {
|
|
209
210
|
};
|
210
211
|
ErrorIllustration.propTypes = {
|
211
212
|
size: PropTypes.oneOf(['lg', 'sm']),
|
212
|
-
theme: PropTypes.oneOf(['light', 'dark'])
|
213
|
+
theme: PropTypes.oneOf(['light', 'dark']),
|
214
|
+
title: PropTypes.string
|
213
215
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["theme", "size"];
|
3
|
+
var _excluded = ["theme", "title", "size"];
|
4
4
|
/**
|
5
5
|
* Copyright IBM Corp. 2020, 2021
|
6
6
|
*
|
@@ -21,6 +21,7 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
|
|
21
21
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
22
22
|
export var NoDataIllustration = function NoDataIllustration(_ref) {
|
23
23
|
var theme = _ref.theme,
|
24
|
+
title = _ref.title,
|
24
25
|
size = _ref.size,
|
25
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
26
27
|
var svgId = uuidv4();
|
@@ -31,7 +32,7 @@ export var NoDataIllustration = function NoDataIllustration(_ref) {
|
|
31
32
|
viewBox: "0 0 80 80",
|
32
33
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-noData"), "".concat(blockClass, "__illustration--").concat(size)]),
|
33
34
|
role: "img"
|
34
|
-
}), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
35
|
+
}), /*#__PURE__*/React.createElement("title", null, title), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
35
36
|
id: "prefix__a_dark_".concat(svgId),
|
36
37
|
x1: 11.12,
|
37
38
|
y1: 43.34,
|
@@ -172,5 +173,6 @@ export var NoDataIllustration = function NoDataIllustration(_ref) {
|
|
172
173
|
};
|
173
174
|
NoDataIllustration.propTypes = {
|
174
175
|
size: PropTypes.oneOf(['lg', 'sm']),
|
175
|
-
theme: PropTypes.oneOf(['light', 'dark'])
|
176
|
+
theme: PropTypes.oneOf(['light', 'dark']),
|
177
|
+
title: PropTypes.string
|
176
178
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["theme", "size"];
|
3
|
+
var _excluded = ["theme", "title", "size"];
|
4
4
|
/**
|
5
5
|
* Copyright IBM Corp. 2020, 2021
|
6
6
|
*
|
@@ -21,6 +21,7 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
|
|
21
21
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
22
22
|
export var NoTagsIllustration = function NoTagsIllustration(_ref) {
|
23
23
|
var theme = _ref.theme,
|
24
|
+
title = _ref.title,
|
24
25
|
size = _ref.size,
|
25
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
26
27
|
var svgId = uuidv4();
|
@@ -32,7 +33,7 @@ export var NoTagsIllustration = function NoTagsIllustration(_ref) {
|
|
32
33
|
viewBox: "0 0 80 80",
|
33
34
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-noTags"), "".concat(blockClass, "__illustration--").concat(size)]),
|
34
35
|
role: "img"
|
35
|
-
}), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
36
|
+
}), /*#__PURE__*/React.createElement("title", null, title), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
36
37
|
id: "prefix__c_dark_".concat(svgId),
|
37
38
|
x1: 34.96,
|
38
39
|
y1: 5.37,
|
@@ -479,5 +480,6 @@ export var NoTagsIllustration = function NoTagsIllustration(_ref) {
|
|
479
480
|
};
|
480
481
|
NoTagsIllustration.propTypes = {
|
481
482
|
size: PropTypes.oneOf(['lg', 'sm']),
|
482
|
-
theme: PropTypes.oneOf(['light', 'dark'])
|
483
|
+
theme: PropTypes.oneOf(['light', 'dark']),
|
484
|
+
title: PropTypes.string
|
483
485
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["theme", "size"];
|
3
|
+
var _excluded = ["theme", "title", "size"];
|
4
4
|
/**
|
5
5
|
* Copyright IBM Corp. 2020, 2021
|
6
6
|
*
|
@@ -21,6 +21,7 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
|
|
21
21
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
22
22
|
export var NotFoundIllustration = function NotFoundIllustration(_ref) {
|
23
23
|
var theme = _ref.theme,
|
24
|
+
title = _ref.title,
|
24
25
|
size = _ref.size,
|
25
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
26
27
|
var svgId = uuidv4();
|
@@ -31,7 +32,7 @@ export var NotFoundIllustration = function NotFoundIllustration(_ref) {
|
|
31
32
|
viewBox: "0 0 80 80",
|
32
33
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-notFound"), "".concat(blockClass, "__illustration--").concat(size)]),
|
33
34
|
role: "img"
|
34
|
-
}), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
35
|
+
}), /*#__PURE__*/React.createElement("title", null, title), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
35
36
|
id: "prefix__a_dark_".concat(svgId),
|
36
37
|
x1: 2.6,
|
37
38
|
y1: -12.81,
|
@@ -356,5 +357,6 @@ export var NotFoundIllustration = function NotFoundIllustration(_ref) {
|
|
356
357
|
};
|
357
358
|
NotFoundIllustration.propTypes = {
|
358
359
|
size: PropTypes.oneOf(['lg', 'sm']),
|
359
|
-
theme: PropTypes.oneOf(['light', 'dark'])
|
360
|
+
theme: PropTypes.oneOf(['light', 'dark']),
|
361
|
+
title: PropTypes.string
|
360
362
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["theme", "size"];
|
3
|
+
var _excluded = ["theme", "title", "size"];
|
4
4
|
/**
|
5
5
|
* Copyright IBM Corp. 2020, 2021
|
6
6
|
*
|
@@ -21,6 +21,7 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
|
|
21
21
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
22
22
|
export var NotificationsIllustration = function NotificationsIllustration(_ref) {
|
23
23
|
var theme = _ref.theme,
|
24
|
+
title = _ref.title,
|
24
25
|
size = _ref.size,
|
25
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
26
27
|
var svgId = uuidv4();
|
@@ -31,7 +32,7 @@ export var NotificationsIllustration = function NotificationsIllustration(_ref)
|
|
31
32
|
viewBox: "0 0 80 80",
|
32
33
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-notification"), "".concat(blockClass, "__illustration--").concat(size)]),
|
33
34
|
role: "img"
|
34
|
-
}), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
35
|
+
}), /*#__PURE__*/React.createElement("title", null, title), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
35
36
|
id: "prefix__a_dark_".concat(svgId),
|
36
37
|
x1: 30.05,
|
37
38
|
y1: 54.31,
|
@@ -327,5 +328,6 @@ export var NotificationsIllustration = function NotificationsIllustration(_ref)
|
|
327
328
|
};
|
328
329
|
NotificationsIllustration.propTypes = {
|
329
330
|
size: PropTypes.oneOf(['lg', 'sm']),
|
330
|
-
theme: PropTypes.oneOf(['light', 'dark'])
|
331
|
+
theme: PropTypes.oneOf(['light', 'dark']),
|
332
|
+
title: PropTypes.string
|
331
333
|
};
|