@carbon/ibm-products 1.61.0 → 1.62.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +154 -79
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +1753 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +154 -79
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +154 -79
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- package/css/index.min.css.map +1 -1
- package/es/components/Coachmark/Coachmark.js +17 -5
- package/es/components/Coachmark/CoachmarkDragbar.js +12 -5
- package/es/components/Coachmark/CoachmarkHeader.js +2 -1
- package/es/components/Coachmark/CoachmarkOverlay.js +105 -9
- package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +5 -2
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +26 -6
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +28 -3
- package/es/components/CoachmarkStack/CoachmarkStack.js +19 -4
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +45 -11
- package/es/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +4 -4
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +45 -73
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +5 -2
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +12 -11
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +29 -23
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +18 -18
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +73 -24
- package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
- package/es/components/Datagrid/useActionsColumn.js +9 -9
- package/es/components/Datagrid/useColumnCenterAlign.js +6 -6
- package/es/components/Datagrid/useColumnRightAlign.js +6 -6
- package/es/components/Datagrid/useDatagrid.js +13 -1
- package/es/components/Datagrid/useFlexResize.js +19 -9
- package/es/components/Datagrid/useInfiniteScroll.js +10 -9
- package/es/components/Datagrid/useNestedRowExpander.js +10 -1
- package/es/components/Datagrid/useOnRowClick.js +6 -7
- package/es/components/Datagrid/useParentDimensions.js +6 -6
- package/es/components/Datagrid/useResizeTable.js +7 -7
- package/es/components/Datagrid/useRowExpander.js +11 -1
- package/es/components/Datagrid/useSelectAllToggle.js +2 -2
- package/es/components/Datagrid/useSelectRows.js +31 -21
- package/es/components/Datagrid/useSkeletonRows.js +6 -6
- package/es/components/Datagrid/useSortableColumns.js +5 -6
- package/es/components/Datagrid/useStickyColumn.js +13 -6
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -0
- package/es/components/EmptyStates/assets/ErrorIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NoDataIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +6 -4
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -4
- package/es/components/Guidebanner/Guidebanner.js +3 -3
- package/es/components/Guidebanner/GuidebannerElement.js +9 -3
- package/es/components/Guidebanner/GuidebannerElementButton.js +9 -4
- package/es/components/Guidebanner/GuidebannerElementLink.js +9 -3
- package/es/components/InlineTip/InlineTipButton.js +7 -0
- package/es/components/InlineTip/InlineTipLink.js +7 -0
- package/es/components/index.js +2 -2
- package/es/global/js/hooks/index.js +3 -2
- package/es/global/js/hooks/usePrefix.js +11 -0
- package/es/global/js/package-settings.js +6 -2
- package/lib/components/Coachmark/Coachmark.js +16 -4
- package/lib/components/Coachmark/CoachmarkDragbar.js +12 -5
- package/lib/components/Coachmark/CoachmarkHeader.js +2 -1
- package/lib/components/Coachmark/CoachmarkOverlay.js +105 -8
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +5 -2
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +25 -5
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +28 -3
- package/lib/components/CoachmarkStack/CoachmarkStack.js +18 -3
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +44 -10
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +4 -4
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +44 -80
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +5 -2
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +6 -4
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +29 -23
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +12 -12
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +75 -33
- package/lib/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
- package/lib/components/Datagrid/useActionsColumn.js +9 -12
- package/lib/components/Datagrid/useDatagrid.js +13 -1
- package/lib/components/Datagrid/useFlexResize.js +19 -9
- package/lib/components/Datagrid/useInfiniteScroll.js +9 -9
- package/lib/components/Datagrid/useNestedRowExpander.js +10 -9
- package/lib/components/Datagrid/useOnRowClick.js +6 -7
- package/lib/components/Datagrid/useParentDimensions.js +5 -6
- package/lib/components/Datagrid/useResizeTable.js +6 -7
- package/lib/components/Datagrid/useRowExpander.js +11 -9
- package/lib/components/Datagrid/useSelectAllToggle.js +2 -2
- package/lib/components/Datagrid/useSelectRows.js +31 -21
- package/lib/components/Datagrid/useSkeletonRows.js +6 -6
- package/lib/components/Datagrid/useSortableColumns.js +5 -6
- package/lib/components/Datagrid/useStickyColumn.js +8 -0
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -0
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -4
- package/lib/components/Guidebanner/Guidebanner.js +3 -3
- package/lib/components/Guidebanner/GuidebannerElement.js +8 -1
- package/lib/components/Guidebanner/GuidebannerElementButton.js +8 -1
- package/lib/components/Guidebanner/GuidebannerElementLink.js +8 -1
- package/lib/components/InlineTip/InlineTipButton.js +8 -1
- package/lib/components/InlineTip/InlineTipLink.js +8 -1
- package/lib/components/index.js +30 -0
- package/lib/global/js/hooks/index.js +8 -1
- package/lib/global/js/hooks/usePrefix.js +19 -0
- package/lib/global/js/package-settings.js +6 -2
- package/package.json +2 -2
- package/scss/components/Checklist/_checklist.scss +13 -25
- package/scss/components/Coachmark/styles/_coachmark-dragbar.scss +1 -45
- package/scss/components/Coachmark/styles/_coachmark-header.scss +0 -33
- package/scss/components/Coachmark/styles/_coachmark-overlay.scss +113 -5
- package/scss/components/Coachmark/styles/_coachmark-tagline.scss +18 -0
- package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +16 -13
- package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +2 -0
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -0
- package/scss/components/CoachmarkStack/_coachmark-stack.scss +3 -0
- package/scss/components/Datagrid/_storybook-styles.scss +15 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +31 -5
- package/scss/components/Datagrid/styles/_useNestedRows.scss +1 -1
- package/scss/components/_index-released-only.scss +1 -0
@@ -4,37 +4,26 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
5
5
|
value: true
|
6
6
|
});
|
7
|
-
exports.stateReducer = exports.
|
7
|
+
exports.stateReducer = exports.handleToggleRowSelected = exports.handleColumnResizingEvent = exports.handleColumnResizeEndEvent = void 0;
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
8
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
|
+
var _settings = require("../../../../settings");
|
10
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
11
13
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
12
|
-
/**
|
13
|
-
* Copyright IBM Corp. 2023, 2023
|
14
|
-
*
|
15
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
17
|
-
*/
|
18
|
-
|
19
14
|
var COLUMN_RESIZE_START = 'columnStartResizing';
|
20
15
|
var COLUMN_RESIZING = 'columnResizing';
|
21
16
|
var COLUMN_RESIZE_END = 'columnDoneResizing';
|
22
17
|
var INIT = 'init';
|
23
|
-
var
|
24
|
-
|
25
|
-
|
26
|
-
payload: {
|
27
|
-
headerId: headerId
|
28
|
-
}
|
29
|
-
});
|
30
|
-
};
|
31
|
-
exports.handleColumnResizeStartEvent = handleColumnResizeStartEvent;
|
32
|
-
var handleColumnResizeEndEvent = function handleColumnResizeEndEvent(dispatch, onColResizeEnd, headerId) {
|
18
|
+
var TOGGLE_ROW_SELECTED = 'toggleRowSelected';
|
19
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
20
|
+
var handleColumnResizeEndEvent = function handleColumnResizeEndEvent(dispatch, onColResizeEnd, headerId, isKeyEvent) {
|
33
21
|
dispatch({
|
34
22
|
type: COLUMN_RESIZE_END,
|
35
23
|
payload: {
|
36
24
|
onColResizeEnd: onColResizeEnd,
|
37
|
-
headerId: headerId
|
25
|
+
headerId: headerId,
|
26
|
+
isKeyEvent: isKeyEvent
|
38
27
|
}
|
39
28
|
});
|
40
29
|
};
|
@@ -60,8 +49,44 @@ var handleColumnResizingEvent = function handleColumnResizingEvent(dispatch, hea
|
|
60
49
|
});
|
61
50
|
};
|
62
51
|
exports.handleColumnResizingEvent = handleColumnResizingEvent;
|
52
|
+
var handleToggleRowSelected = function handleToggleRowSelected(dispatch, rowData, isChecked) {
|
53
|
+
return dispatch({
|
54
|
+
type: TOGGLE_ROW_SELECTED,
|
55
|
+
payload: {
|
56
|
+
rowData: rowData,
|
57
|
+
isChecked: isChecked
|
58
|
+
}
|
59
|
+
});
|
60
|
+
};
|
61
|
+
exports.handleToggleRowSelected = handleToggleRowSelected;
|
63
62
|
var stateReducer = function stateReducer(newState, action) {
|
64
63
|
switch (action.type) {
|
64
|
+
case TOGGLE_ROW_SELECTED:
|
65
|
+
{
|
66
|
+
var _ref = action.payload || {},
|
67
|
+
rowData = _ref.rowData,
|
68
|
+
isChecked = _ref.isChecked;
|
69
|
+
if (!rowData) {
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
if (isChecked) {
|
73
|
+
return _objectSpread(_objectSpread({}, newState), {}, {
|
74
|
+
selectedRowData: _objectSpread(_objectSpread({}, newState.selectedRowData), {}, (0, _defineProperty2.default)({}, rowData.index, rowData))
|
75
|
+
});
|
76
|
+
}
|
77
|
+
if (rowData && !isChecked) {
|
78
|
+
var newData = _objectSpread({}, newState.selectedRowData);
|
79
|
+
var dataWithRemovedRow = Object.fromEntries(Object.entries(newData).filter(function (_ref2) {
|
80
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 1),
|
81
|
+
key = _ref3[0];
|
82
|
+
return parseInt(key) !== parseInt(rowData.index);
|
83
|
+
}));
|
84
|
+
return _objectSpread(_objectSpread({}, newState), {}, {
|
85
|
+
selectedRowData: dataWithRemovedRow
|
86
|
+
});
|
87
|
+
}
|
88
|
+
return _objectSpread({}, newState);
|
89
|
+
}
|
65
90
|
case INIT:
|
66
91
|
{
|
67
92
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
@@ -70,42 +95,45 @@ var stateReducer = function stateReducer(newState, action) {
|
|
70
95
|
}
|
71
96
|
case COLUMN_RESIZE_START:
|
72
97
|
{
|
73
|
-
var
|
98
|
+
var _ref4 = action.payload || {},
|
99
|
+
headerId = _ref4.headerId;
|
74
100
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
75
101
|
isResizing: headerId
|
76
102
|
});
|
77
103
|
}
|
78
104
|
case COLUMN_RESIZING:
|
79
105
|
{
|
80
|
-
var
|
81
|
-
_headerId =
|
82
|
-
newWidth =
|
83
|
-
defaultWidth =
|
106
|
+
var _ref5 = action.payload || {},
|
107
|
+
_headerId = _ref5.headerId,
|
108
|
+
newWidth = _ref5.newWidth,
|
109
|
+
defaultWidth = _ref5.defaultWidth;
|
84
110
|
var newColumnWidth = {};
|
85
111
|
if (typeof _headerId === 'undefined') {
|
86
112
|
return _objectSpread({}, newState);
|
87
113
|
}
|
88
114
|
newColumnWidth[_headerId] = newWidth;
|
89
|
-
var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (
|
90
|
-
var
|
91
|
-
_ =
|
92
|
-
value =
|
115
|
+
var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (_ref6) {
|
116
|
+
var _ref7 = (0, _slicedToArray2.default)(_ref6, 2),
|
117
|
+
_ = _ref7[0],
|
118
|
+
value = _ref7[1];
|
93
119
|
return !isNaN(value);
|
94
120
|
}));
|
121
|
+
var headerIdArray = newState.columnResizing.headerIdWidths || [];
|
95
122
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
96
123
|
isResizing: _headerId,
|
97
124
|
columnResizing: _objectSpread(_objectSpread({}, newState.columnResizing), {}, {
|
98
125
|
columnWidth: defaultWidth,
|
99
126
|
columnWidths: _objectSpread(_objectSpread({}, cleanedWidths), newColumnWidth),
|
100
|
-
headerIdWidths: [_headerId, newWidth]
|
127
|
+
headerIdWidths: [].concat((0, _toConsumableArray2.default)(headerIdArray), [[_headerId, newWidth]])
|
101
128
|
})
|
102
129
|
});
|
103
130
|
}
|
104
131
|
case COLUMN_RESIZE_END:
|
105
132
|
{
|
106
|
-
var
|
107
|
-
onColResizeEnd =
|
108
|
-
_headerId2 =
|
133
|
+
var _ref8 = action.payload || {},
|
134
|
+
onColResizeEnd = _ref8.onColResizeEnd,
|
135
|
+
_headerId2 = _ref8.headerId,
|
136
|
+
isKeyEvent = _ref8.isKeyEvent;
|
109
137
|
var currentColumn = {};
|
110
138
|
currentColumn[_headerId2] = newState.columnResizing.columnWidths[_headerId2];
|
111
139
|
var allChangedColumns = newState.columnResizing.columnWidths;
|
@@ -113,8 +141,22 @@ var stateReducer = function stateReducer(newState, action) {
|
|
113
141
|
if (isResizing) {
|
114
142
|
onColResizeEnd === null || onColResizeEnd === void 0 ? void 0 : onColResizeEnd(currentColumn, allChangedColumns);
|
115
143
|
}
|
144
|
+
if (!isKeyEvent) {
|
145
|
+
if (typeof isKeyEvent === 'undefined') {
|
146
|
+
// Blur resizer input if it has focus and is not from a key event resize
|
147
|
+
if (document.activeElement.classList.contains("".concat(blockClass, "__col-resizer-range"))) {
|
148
|
+
var _document, _document$activeEleme;
|
149
|
+
(_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.blur();
|
150
|
+
}
|
151
|
+
return;
|
152
|
+
}
|
153
|
+
}
|
116
154
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
117
|
-
isResizing: false
|
155
|
+
isResizing: false,
|
156
|
+
columnResizing: _objectSpread(_objectSpread({}, newState.columnResizing), {}, {
|
157
|
+
isResizingColumn: false,
|
158
|
+
startX: null
|
159
|
+
})
|
118
160
|
});
|
119
161
|
}
|
120
162
|
}
|
@@ -45,7 +45,7 @@
|
|
45
45
|
|
46
46
|
// ## Sample usage:
|
47
47
|
// 1. include \`useActionsColumn\` hook
|
48
|
-
// 2. add \`isAction = true\` to the column object in which you
|
48
|
+
// 2. add \`isAction = true\` to the column object in which you wish to add the overflow menu actions
|
49
49
|
// 3. add \`rowActions = []\` array to the props
|
50
50
|
// - \`rowActions[].id\` for callback to identify the action is called
|
51
51
|
// - \`rowActions[].onClick(actionId: string, row: Row, event: ClickEvent)\` callback on menuitem clicked. [Row properties](https://react-table.tanstack.com/docs/api/useTable#row-properties)
|
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
@@ -9,21 +8,16 @@ exports.default = void 0;
|
|
9
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
12
|
-
var _react =
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
13
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
14
13
|
var _carbonComponentsReact = require("carbon-components-react");
|
15
14
|
var _settings = require("../../settings");
|
16
15
|
var _excluded = ["id", "itemText", "onClick", "icon", "shouldHideMenuItem"],
|
17
16
|
_excluded2 = ["id", "onClick", "shouldHideMenuItem", "shouldDisableMenuItem", "disabled"];
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
19
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
20
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
21
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
22
19
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
23
20
|
var useActionsColumn = function useActionsColumn(hooks) {
|
24
|
-
(0, _react.useEffect)(function () {
|
25
|
-
_settings.pkg.checkReportFeatureEnabled('Datagrid.useActionsColumn');
|
26
|
-
}, []);
|
27
21
|
var useAttachActionsOnInstance = function useAttachActionsOnInstance(instance) {
|
28
22
|
var rowActions = instance.rowActions,
|
29
23
|
isFetching = instance.isFetching,
|
@@ -44,12 +38,13 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
44
38
|
column = cell.column;
|
45
39
|
if (column.isAction) {
|
46
40
|
var _cx3;
|
41
|
+
var isColumnSticky = !!column.sticky;
|
47
42
|
return [props, {
|
48
43
|
children: /*#__PURE__*/_react.default.createElement("div", {
|
49
44
|
className: "".concat(blockClass, "__actions-column-contents")
|
50
45
|
}, isFetching && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.IconSkeleton, {
|
51
46
|
className: "".concat(blockClass, "__actions-column-loading")
|
52
|
-
}), !isFetching && rowActions.length <= 2 && /*#__PURE__*/_react.default.createElement("div", {
|
47
|
+
}), !isFetching && rowActions.length <= 2 && !isColumnSticky && /*#__PURE__*/_react.default.createElement("div", {
|
53
48
|
className: "".concat(blockClass, "_actions-column"),
|
54
49
|
style: {
|
55
50
|
display: 'flex'
|
@@ -73,6 +68,7 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
73
68
|
hasIconOnly: true,
|
74
69
|
light: true,
|
75
70
|
iconDescription: itemText,
|
71
|
+
ariaLabel: itemText,
|
76
72
|
kind: "ghost",
|
77
73
|
className: (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(blockClass, "__disabled-row-action"), getDisabledState(row.index))),
|
78
74
|
onClick: function onClick(e) {
|
@@ -84,7 +80,7 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
84
80
|
_onClick(id, row, e);
|
85
81
|
}
|
86
82
|
})));
|
87
|
-
})), !isFetching && rowActions.length > 2 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.OverflowMenu, {
|
83
|
+
})), !isFetching && (rowActions.length > 2 || isColumnSticky) && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.OverflowMenu, {
|
88
84
|
size: "sm",
|
89
85
|
light: true,
|
90
86
|
flipped: true,
|
@@ -114,9 +110,9 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
114
110
|
key: id
|
115
111
|
}));
|
116
112
|
})))),
|
117
|
-
className: (0, _classnames.default)((_cx3 = {}, (0, _defineProperty2.default)(_cx3, "".concat(blockClass, "__actions-column-cell"), true), (0, _defineProperty2.default)(_cx3, "".concat(blockClass, "__cell"), true), _cx3)),
|
113
|
+
className: (0, _classnames.default)((_cx3 = {}, (0, _defineProperty2.default)(_cx3, "".concat(blockClass, "__actions-column-cell"), true), (0, _defineProperty2.default)(_cx3, "".concat(blockClass, "__cell"), true), (0, _defineProperty2.default)(_cx3, "".concat(blockClass, "__actions-column-cell-non-sticky"), !isColumnSticky), _cx3)),
|
118
114
|
style: {
|
119
|
-
width: rowActions.length > 2 ? 48 : 96
|
115
|
+
width: rowActions.length > 2 || isColumnSticky ? 48 : 96
|
120
116
|
}
|
121
117
|
}];
|
122
118
|
}
|
@@ -131,9 +127,10 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
131
127
|
var addHeaderWidth = function addHeaderWidth(props, cellData) {
|
132
128
|
var column = cellData.column;
|
133
129
|
if (column.isAction) {
|
130
|
+
var isColumnSticky = !!column.sticky;
|
134
131
|
return [props, {
|
135
132
|
style: _objectSpread(_objectSpread({}, props.style), {}, {
|
136
|
-
width: rowActions.length > 2 ? 48 : 96 // set header width based on action length
|
133
|
+
width: rowActions.length > 2 || isColumnSticky ? 48 : 96 // set header width based on action length
|
137
134
|
})
|
138
135
|
}];
|
139
136
|
}
|
@@ -22,8 +22,19 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
22
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
23
23
|
var useDatagrid = function useDatagrid(params) {
|
24
24
|
var defaultPlugins = [_reactTable.useFlexLayout, _DatagridHeaderRow.default, _useSkeletonRows.default, _reactTable.useResizeColumns, _useRowRenderer.default, _useDefaultStringRenderer.default, _useRowSize.default, _reactTable.useFilters, _reactTable.useGlobalFilter, _reactTable.useSortBy, _reactTable.useExpanded];
|
25
|
+
|
26
|
+
// Disable resizing
|
27
|
+
if (params.disableResizing) {
|
28
|
+
var resizeIndex = defaultPlugins.findIndex(function (p) {
|
29
|
+
return p.pluginName === 'useResizeColumns';
|
30
|
+
});
|
31
|
+
defaultPlugins.splice(resizeIndex, 1);
|
32
|
+
}
|
25
33
|
var defaultEndPlugins = [_reactTable.usePagination, _reactTable.useRowSelect, _useFlexResize.default, _useFloatingScroll.default];
|
26
34
|
var clientEndPlugins = params.endPlugins || [];
|
35
|
+
var defaultColumn = {
|
36
|
+
minWidth: 50
|
37
|
+
};
|
27
38
|
var tableId = (0, _react.useMemo)(function () {
|
28
39
|
return (0, _uniqueId.default)('datagrid-table-id');
|
29
40
|
}, []);
|
@@ -33,7 +44,8 @@ var useDatagrid = function useDatagrid(params) {
|
|
33
44
|
var tableState = _reactTable.useTable.apply(void 0, [_objectSpread(_objectSpread({
|
34
45
|
tableId: tableId
|
35
46
|
}, params), {}, {
|
36
|
-
stateReducer: _stateReducer.stateReducer
|
47
|
+
stateReducer: _stateReducer.stateReducer,
|
48
|
+
defaultColumn: defaultColumn
|
37
49
|
})].concat(defaultPlugins, plugins, defaultEndPlugins, (0, _toConsumableArray2.default)(clientEndPlugins)));
|
38
50
|
return tableState;
|
39
51
|
};
|
@@ -6,29 +6,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.default = void 0;
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
9
|
-
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
9
|
+
/**
|
10
|
+
* Copyright IBM Corp. 2020, 2023
|
11
|
+
*
|
12
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
15
14
|
*/
|
15
|
+
|
16
16
|
var useFlexResize = function useFlexResize(hooks) {
|
17
|
-
var
|
17
|
+
var spacer = {
|
18
18
|
id: 'spacer',
|
19
19
|
width: 0,
|
20
20
|
disableSortBy: true,
|
21
21
|
disableResizing: true
|
22
22
|
};
|
23
23
|
hooks.visibleColumns.push(function (columns) {
|
24
|
-
|
24
|
+
// always move actions and spacer to the end
|
25
|
+
var actionsIdx = columns.findIndex(function (col) {
|
26
|
+
return col.isAction;
|
27
|
+
});
|
28
|
+
if (actionsIdx === -1) {
|
29
|
+
return [].concat((0, _toConsumableArray2.default)(columns), [spacer]);
|
30
|
+
}
|
31
|
+
var cols = (0, _toConsumableArray2.default)(columns);
|
32
|
+
var actions = cols.splice(actionsIdx, 1)[0];
|
33
|
+
cols.splice(columns.length, 0, spacer, actions);
|
34
|
+
return cols;
|
25
35
|
});
|
26
36
|
var changeProps = function changeProps(props, data) {
|
27
37
|
var column = data.column;
|
28
38
|
if (!column && data.cell) {
|
29
39
|
column = data.cell.column;
|
30
40
|
}
|
31
|
-
if (column.id ===
|
41
|
+
if (column.id === spacer.id) {
|
32
42
|
return [props, {
|
33
43
|
style: {
|
34
44
|
flex: '1 1 0'
|
@@ -9,12 +9,11 @@ var _react = require("react");
|
|
9
9
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
10
10
|
var _useParentDimensions = _interopRequireDefault(require("./useParentDimensions"));
|
11
11
|
var _useResizeTable = _interopRequireDefault(require("./useResizeTable"));
|
12
|
-
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
17
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
12
|
+
/**
|
13
|
+
* Copyright IBM Corp. 2020, 2023
|
14
|
+
*
|
15
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
18
17
|
*/
|
19
18
|
|
20
19
|
var useInfiniteScroll = function useInfiniteScroll(hooks) {
|
@@ -25,10 +24,11 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
|
|
25
24
|
tableHeight = instance.tableHeight,
|
26
25
|
innerListRef = instance.innerListRef,
|
27
26
|
fetchMoreData = instance.fetchMoreData,
|
28
|
-
tableId = instance.tableId
|
27
|
+
tableId = instance.tableId,
|
28
|
+
loadMoreThreshold = instance.loadMoreThreshold;
|
29
29
|
var tableElement = document.querySelector("#".concat(tableId));
|
30
30
|
var totalTableHeight = tableHeight || (tableElement === null || tableElement === void 0 ? void 0 : tableElement.clientHeight);
|
31
|
-
var
|
31
|
+
var loadMoreThresholdValue = typeof loadMoreThreshold === 'number' ? loadMoreThreshold : 200;
|
32
32
|
var emptyFetchData = function emptyFetchData() {};
|
33
33
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
34
34
|
var fetchMore = (0, _react.useCallback)((0, _debounce.default)(fetchMoreData || emptyFetchData, 3000, {
|
@@ -39,7 +39,7 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
|
|
39
39
|
var scrollDirection = _ref.scrollDirection,
|
40
40
|
scrollOffset = _ref.scrollOffset;
|
41
41
|
if (innerListRef && innerListRef.current) {
|
42
|
-
if (!isFetching && scrollDirection === 'forward' && scrollOffset + totalTableHeight >= innerListRef.current.clientHeight -
|
42
|
+
if (!isFetching && scrollDirection === 'forward' && scrollOffset + totalTableHeight >= innerListRef.current.clientHeight - loadMoreThresholdValue) {
|
43
43
|
if (fetchMoreData) {
|
44
44
|
fetchMore();
|
45
45
|
}
|
@@ -15,14 +15,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
var _settings = require("../../settings");
|
16
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
17
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
18
|
-
|
19
|
-
|
20
|
-
* Copyright IBM Corp. 2020, 2023
|
21
|
-
*
|
22
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
23
|
-
* LICENSE file in the root directory of this source tree.
|
24
|
-
*/
|
25
|
-
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
19
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
26
20
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
27
21
|
var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
28
22
|
var tempState = (0, _react.useRef)();
|
@@ -35,6 +29,13 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
35
29
|
Cell: function Cell(_ref) {
|
36
30
|
var _cx;
|
37
31
|
var row = _ref.row;
|
32
|
+
var expanderButtonProps = _objectSpread(_objectSpread({}, row.getToggleRowExpandedProps()), {}, {
|
33
|
+
onClick: function onClick(event) {
|
34
|
+
// Prevents `onRowClick` from being called if `useOnRowClick` is included
|
35
|
+
event.stopPropagation();
|
36
|
+
row.toggleRowExpanded();
|
37
|
+
}
|
38
|
+
});
|
38
39
|
var _ref2 = (tempState === null || tempState === void 0 ? void 0 : tempState.current) || {},
|
39
40
|
_ref2$expanderButtonT = _ref2.expanderButtonTitleExpanded,
|
40
41
|
expanderButtonTitleExpanded = _ref2$expanderButtonT === void 0 ? 'Collapse row' : _ref2$expanderButtonT,
|
@@ -45,7 +46,7 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
45
46
|
type: "button",
|
46
47
|
"aria-label": expanderTitle,
|
47
48
|
className: (0, _classnames.default)("".concat(blockClass, "__row-expander"), "".concat(_settings.carbon.prefix, "--btn"), "".concat(_settings.carbon.prefix, "--btn--ghost"))
|
48
|
-
},
|
49
|
+
}, expanderButtonProps, {
|
49
50
|
title: expanderTitle
|
50
51
|
}), /*#__PURE__*/_react.default.createElement(_iconsReact.ChevronRight16, {
|
51
52
|
className: (0, _classnames.default)("".concat(blockClass, "__expander-icon"), "".concat(blockClass, "__row-expander--icon"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__expander-icon--not-open"), !row.isExpanded), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__expander-icon--open"), row.isExpanded), _cx))
|
@@ -5,12 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
var _settings = require("../../settings");
|
8
|
-
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
8
|
+
/**
|
9
|
+
* Copyright IBM Corp. 2020, 2023
|
10
|
+
*
|
11
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
14
13
|
*/
|
15
14
|
|
16
15
|
var useOnRowClick = function useOnRowClick(hooks) {
|
@@ -49,7 +48,7 @@ var useOnRowClick = function useOnRowClick(hooks) {
|
|
49
48
|
var onKeyDown = function onKeyDown(event) {
|
50
49
|
var key = event.key;
|
51
50
|
if (key === 'Enter') {
|
52
|
-
onClick();
|
51
|
+
onClick(event);
|
53
52
|
}
|
54
53
|
};
|
55
54
|
return [props, {
|
@@ -7,12 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.default = void 0;
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
9
|
var _react = require("react");
|
10
|
-
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
10
|
+
/**
|
11
|
+
* Copyright IBM Corp. 2020, 2023
|
12
|
+
*
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
16
15
|
*/
|
17
16
|
|
18
17
|
var useParentDimensions = function useParentDimensions(hooks) {
|
@@ -5,12 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
var _react = require("react");
|
8
|
-
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
8
|
+
/**
|
9
|
+
* Copyright IBM Corp. 2020, 2023
|
10
|
+
*
|
11
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
14
13
|
*/
|
15
14
|
|
16
15
|
var useResizeTable = function useResizeTable(hooks) {
|
@@ -33,7 +32,7 @@ var useResizeTable = function useResizeTable(hooks) {
|
|
33
32
|
resizeObserver = null;
|
34
33
|
};
|
35
34
|
}
|
36
|
-
return console.error('
|
35
|
+
return console.error('Could not resize table, no support for ResizeObserver');
|
37
36
|
}, [handleResize, parent]);
|
38
37
|
};
|
39
38
|
hooks.useInstanceBeforeDimensions.push(useInstanceBeforeDimensions);
|
@@ -8,20 +8,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
exports.default = void 0;
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
12
13
|
var _iconsReact = require("@carbon/icons-react");
|
13
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
14
15
|
var _settings = require("../../settings");
|
15
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
16
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
17
|
-
|
18
|
-
|
19
|
-
* Copyright IBM Corp. 2020, 2023
|
20
|
-
*
|
21
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
22
|
-
* LICENSE file in the root directory of this source tree.
|
23
|
-
*/
|
24
|
-
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
19
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
25
20
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
26
21
|
var useRowExpander = function useRowExpander(hooks) {
|
27
22
|
var tempState = (0, _react.useRef)();
|
@@ -33,6 +28,13 @@ var useRowExpander = function useRowExpander(hooks) {
|
|
33
28
|
id: 'expander',
|
34
29
|
Cell: function Cell(_ref) {
|
35
30
|
var row = _ref.row;
|
31
|
+
var expanderButtonProps = _objectSpread(_objectSpread({}, row.getToggleRowExpandedProps()), {}, {
|
32
|
+
onClick: function onClick(event) {
|
33
|
+
// Prevents `onRowClick` from being called if `useOnRowClick` is included
|
34
|
+
event.stopPropagation();
|
35
|
+
row.toggleRowExpanded();
|
36
|
+
}
|
37
|
+
});
|
36
38
|
var _ref2 = (tempState === null || tempState === void 0 ? void 0 : tempState.current) || {},
|
37
39
|
_ref2$expanderButtonT = _ref2.expanderButtonTitleExpanded,
|
38
40
|
expanderButtonTitleExpanded = _ref2$expanderButtonT === void 0 ? 'Collapse row' : _ref2$expanderButtonT,
|
@@ -43,7 +45,7 @@ var useRowExpander = function useRowExpander(hooks) {
|
|
43
45
|
type: "button",
|
44
46
|
"aria-label": expanderTitle,
|
45
47
|
className: (0, _classnames.default)("".concat(blockClass, "__row-expander"), "".concat(_settings.carbon.prefix, "--btn"), "".concat(_settings.carbon.prefix, "--btn--ghost"))
|
46
|
-
},
|
48
|
+
}, expanderButtonProps, {
|
47
49
|
title: expanderTitle
|
48
50
|
}), row.isExpanded ? /*#__PURE__*/_react.default.createElement(_iconsReact.ChevronUp16, {
|
49
51
|
className: "".concat(blockClass, "__row-expander--icon")
|
@@ -24,7 +24,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
24
24
|
*/
|
25
25
|
// @flow
|
26
26
|
|
27
|
-
var blockClass = "".concat(_settings.pkg.prefix, "--
|
27
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid__select-all");
|
28
28
|
var useSelectAllToggle = function useSelectAllToggle(hooks) {
|
29
29
|
useSelectAllWithToggleComponent(hooks);
|
30
30
|
useAddClassNameToSelectRow(hooks);
|
@@ -71,7 +71,7 @@ var useAddClassNameToSelectRow = function useAddClassNameToSelectRow(hooks) {
|
|
71
71
|
var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
|
72
72
|
if (column.id === _commonColumnIds.selectionColumnId && DatagridPagination) {
|
73
73
|
return [props, {
|
74
|
-
className: (0, _classnames.default)("".concat(blockClass, "
|
74
|
+
className: (0, _classnames.default)(["".concat(blockClass, "-toggle-on"), (0, _defineProperty2.default)({}, "".concat(blockClass, "-sticky-left"), isFirstColumnStickyLeft && windowSize > 671)])
|
75
75
|
}];
|
76
76
|
}
|
77
77
|
return [props];
|