@carbon/ibm-products 1.39.0 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/index-full-carbon.css +19 -0
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -2
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon.css +19 -0
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +19 -0
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/css/index.min.css.map +1 -1
- package/es/components/ButtonMenu/ButtonMenu.js +1 -1
- package/es/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +1 -1
- package/es/components/Card/Card.js +1 -1
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +1 -3
- package/es/components/DataSpreadsheet/utils/handleCellDeletion.js +5 -4
- package/es/components/Datagrid/Datagrid/DatagridContent.js +8 -3
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +17 -4
- package/es/components/Datagrid/Datagrid/DatagridRow.js +2 -8
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +27 -8
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +31 -44
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +10 -8
- package/es/components/Datagrid/Datagrid.stories/index.js +1 -1
- package/es/components/Datagrid/useFiltering.js +0 -2
- package/es/components/Datagrid/useParentDimensions.js +3 -1
- package/es/components/Datagrid/utils/getArgTypes.js +9 -0
- package/es/components/Datagrid/utils/getInlineEditColumns.js +6 -1
- package/es/components/InlineEditV1/InlineEditV1.js +2 -1
- package/es/components/PageHeader/PageHeader.js +1 -1
- package/es/components/RemoveModal/RemoveModal.js +17 -3
- package/es/global/js/package-settings.js +2 -1
- package/lib/components/ButtonMenu/ButtonMenu.js +1 -1
- package/lib/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +1 -1
- package/lib/components/Card/Card.js +1 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +1 -3
- package/lib/components/DataSpreadsheet/utils/handleCellDeletion.js +5 -4
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +8 -3
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +17 -4
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +2 -11
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +27 -8
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +31 -44
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -10
- package/lib/components/Datagrid/Datagrid.stories/index.js +1 -1
- package/lib/components/Datagrid/useFiltering.js +0 -2
- package/lib/components/Datagrid/useParentDimensions.js +3 -1
- package/lib/components/Datagrid/utils/getArgTypes.js +9 -0
- package/lib/components/Datagrid/utils/getInlineEditColumns.js +6 -1
- package/lib/components/InlineEditV1/InlineEditV1.js +2 -1
- package/lib/components/PageHeader/PageHeader.js +1 -1
- package/lib/components/RemoveModal/RemoveModal.js +17 -3
- package/lib/global/js/package-settings.js +2 -1
- package/package.json +2 -2
- package/scss/components/Datagrid/_storybook-styles.scss +7 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +18 -0
- package/scss/components/FilterSummary/_filter-summary.scss +1 -0
@@ -41,7 +41,8 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
41
41
|
withInlineEdit = datagridState.withInlineEdit,
|
42
42
|
tableId = datagridState.tableId,
|
43
43
|
DatagridActions = datagridState.DatagridActions,
|
44
|
-
totalColumnsWidth = datagridState.totalColumnsWidth
|
44
|
+
totalColumnsWidth = datagridState.totalColumnsWidth,
|
45
|
+
gridRef = datagridState.gridRef;
|
45
46
|
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
46
47
|
var gridActive = state.gridActive,
|
47
48
|
editId = state.editId;
|
@@ -81,7 +82,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
81
82
|
onFocus: withInlineEdit ? function () {
|
82
83
|
return handleGridFocus(state, dispatch);
|
83
84
|
} : null
|
84
|
-
}), /*#__PURE__*/React.createElement(DatagridHead, datagridState), /*#__PURE__*/React.createElement(DatagridBody, _extends({}, datagridState, {
|
85
|
+
}), !withVirtualScroll ? /*#__PURE__*/React.createElement(DatagridHead, datagridState) : null, /*#__PURE__*/React.createElement(DatagridBody, _extends({}, datagridState, {
|
85
86
|
rows: rows
|
86
87
|
})));
|
87
88
|
};
|
@@ -116,6 +117,9 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
116
117
|
className: "".concat(blockClass, "__datagridLeftPanel")
|
117
118
|
}, leftPanel.panelContent), withInlineEdit ? /*#__PURE__*/React.createElement("div", {
|
118
119
|
ref: multiKeyTrackingRef
|
120
|
+
}, renderTable()) : withVirtualScroll ? /*#__PURE__*/React.createElement("div", {
|
121
|
+
className: "".concat(blockClass, "__virtualScrollContainer"),
|
122
|
+
ref: gridRef
|
119
123
|
}, renderTable()) : renderTable())), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && /*#__PURE__*/React.createElement(DatagridPagination, datagridState), CustomizeColumnsModal && /*#__PURE__*/React.createElement(CustomizeColumnsModal, {
|
120
124
|
instance: datagridState
|
121
125
|
}));
|
@@ -139,6 +143,7 @@ DatagridContent.propTypes = {
|
|
139
143
|
page: PropTypes.arrayOf(PropTypes.object),
|
140
144
|
rows: PropTypes.arrayOf(PropTypes.object),
|
141
145
|
tableId: PropTypes.string,
|
142
|
-
totalColumnsWidth: PropTypes.number
|
146
|
+
totalColumnsWidth: PropTypes.number,
|
147
|
+
gridRef: PropTypes.object
|
143
148
|
})
|
144
149
|
};
|
@@ -9,7 +9,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
9
9
|
import React from 'react';
|
10
10
|
import { pkg } from '../../../settings';
|
11
11
|
import { DataTable } from 'carbon-components-react';
|
12
|
-
import { NoDataEmptyState } from '../../EmptyStates
|
12
|
+
import { NoDataEmptyState, ErrorEmptyState } from '../../EmptyStates';
|
13
13
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
14
14
|
var TableBody = DataTable.TableBody,
|
15
15
|
TableRow = DataTable.TableRow,
|
@@ -20,16 +20,29 @@ var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
|
|
20
20
|
emptyStateTitle = datagridState.emptyStateTitle,
|
21
21
|
emptyStateDescription = datagridState.emptyStateDescription,
|
22
22
|
emptyStateSize = datagridState.emptyStateSize,
|
23
|
-
|
23
|
+
_datagridState$emptyS = datagridState.emptyStateType,
|
24
|
+
emptyStateType = _datagridState$emptyS === void 0 ? 'noData' : _datagridState$emptyS,
|
25
|
+
illustrationTheme = datagridState.illustrationTheme,
|
26
|
+
emptyStateAction = datagridState.emptyStateAction,
|
27
|
+
emptyStateLink = datagridState.emptyStateLink;
|
24
28
|
return /*#__PURE__*/React.createElement(TableBody, _extends({}, getTableBodyProps(), {
|
25
29
|
className: "".concat(blockClass, "__empty-state-body")
|
26
30
|
}), /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, {
|
27
31
|
colSpan: headers.length
|
28
|
-
}, /*#__PURE__*/React.createElement(
|
32
|
+
}, emptyStateType === 'error' && /*#__PURE__*/React.createElement(ErrorEmptyState, {
|
29
33
|
illustrationTheme: illustrationTheme,
|
30
34
|
size: emptyStateSize,
|
31
35
|
title: emptyStateTitle,
|
32
|
-
subtitle: emptyStateDescription
|
36
|
+
subtitle: emptyStateDescription,
|
37
|
+
action: emptyStateAction,
|
38
|
+
link: emptyStateLink
|
39
|
+
}), emptyStateType === 'noData' && /*#__PURE__*/React.createElement(NoDataEmptyState, {
|
40
|
+
illustrationTheme: illustrationTheme,
|
41
|
+
size: emptyStateSize,
|
42
|
+
title: emptyStateTitle,
|
43
|
+
subtitle: emptyStateDescription,
|
44
|
+
action: emptyStateAction,
|
45
|
+
link: emptyStateLink
|
33
46
|
}))));
|
34
47
|
};
|
35
48
|
export default DatagridEmptyBody;
|
@@ -10,14 +10,12 @@ var _excluded = ["children"];
|
|
10
10
|
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
11
11
|
*/
|
12
12
|
// @flow
|
13
|
-
import React
|
13
|
+
import React from 'react';
|
14
14
|
import { DataTable, SkeletonText } from 'carbon-components-react';
|
15
15
|
import { px } from '@carbon/layout';
|
16
16
|
import cx from 'classnames';
|
17
17
|
import { selectionColumnId } from '../common-column-ids';
|
18
18
|
import { pkg, carbon } from '../../../settings';
|
19
|
-
import { InlineEditContext } from './addons/InlineEdit/InlineEditContext/InlineEditContext';
|
20
|
-
import { getCellIdAsObject } from './addons/InlineEdit/InlineEditContext/getCellIdAsObject';
|
21
19
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
22
20
|
var TableRow = DataTable.TableRow,
|
23
21
|
TableCell = DataTable.TableCell;
|
@@ -35,10 +33,6 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
35
33
|
var row = datagridState.row,
|
36
34
|
rowSize = datagridState.rowSize,
|
37
35
|
withNestedRows = datagridState.withNestedRows;
|
38
|
-
var _useContext = useContext(InlineEditContext),
|
39
|
-
state = _useContext.state;
|
40
|
-
var activeCellId = state.activeCellId;
|
41
|
-
var activeCellObject = activeCellId && getCellIdAsObject(activeCellId);
|
42
36
|
var getVisibleNestedRowCount = function getVisibleNestedRowCount(_ref) {
|
43
37
|
var isExpanded = _ref.isExpanded,
|
44
38
|
subRows = _ref.subRows;
|
@@ -52,7 +46,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
52
46
|
return size;
|
53
47
|
};
|
54
48
|
return /*#__PURE__*/React.createElement(TableRow, _extends({
|
55
|
-
className: cx("".concat(blockClass, "__carbon-row"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), _defineProperty(_cx, "".concat(blockClass, "__carbon-row-expandable"), row.canExpand), _defineProperty(_cx, "".concat(carbon.prefix, "--data-table--selected"), row.isSelected),
|
49
|
+
className: cx("".concat(blockClass, "__carbon-row"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), _defineProperty(_cx, "".concat(blockClass, "__carbon-row-expandable"), row.canExpand), _defineProperty(_cx, "".concat(carbon.prefix, "--data-table--selected"), row.isSelected), _cx))
|
56
50
|
}, row.getRowProps(), {
|
57
51
|
key: row.id,
|
58
52
|
onMouseEnter: function onMouseEnter(event) {
|
@@ -13,6 +13,8 @@ import React, { useEffect } from 'react';
|
|
13
13
|
import { VariableSizeList } from 'react-window';
|
14
14
|
import { DataTable } from 'carbon-components-react';
|
15
15
|
import { pkg } from '../../../settings';
|
16
|
+
import DatagridHead from './DatagridHead';
|
17
|
+
import { px } from '@carbon/layout';
|
16
18
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
17
19
|
var TableBody = DataTable.TableBody;
|
18
20
|
var rowSizeMap = {
|
@@ -29,6 +31,7 @@ var rowSizeMap = {
|
|
29
31
|
};
|
30
32
|
var defaultRowHeight = rowSizeMap.lg;
|
31
33
|
var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
34
|
+
var _gridRef$current, _gridRef$current2;
|
32
35
|
var getTableBodyProps = datagridState.getTableBodyProps,
|
33
36
|
rows = datagridState.rows,
|
34
37
|
prepareRow = datagridState.prepareRow,
|
@@ -42,7 +45,14 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
42
45
|
DatagridPagination = datagridState.DatagridPagination,
|
43
46
|
page = datagridState.page,
|
44
47
|
handleResize = datagridState.handleResize,
|
45
|
-
|
48
|
+
gridRef = datagridState.gridRef;
|
49
|
+
var syncScroll = function syncScroll(e) {
|
50
|
+
var virtualBody = e.target;
|
51
|
+
document.querySelector(".".concat(blockClass, "__head-warp")).scrollLeft = virtualBody.scrollLeft;
|
52
|
+
var spacerColumn = document.querySelector(".".concat(blockClass, "__head-warp 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
|
+
|
46
56
|
useEffect(function () {
|
47
57
|
handleResize();
|
48
58
|
}, [handleResize]);
|
@@ -51,8 +61,16 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
51
61
|
listRef.current.resetAfterIndex(0);
|
52
62
|
}
|
53
63
|
var visibleRows = DatagridPagination && page || rows;
|
54
|
-
return /*#__PURE__*/React.createElement(
|
55
|
-
|
64
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
65
|
+
className: "".concat(blockClass, "__head-warp"),
|
66
|
+
style: {
|
67
|
+
width: (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
|
68
|
+
overflow: 'hidden'
|
69
|
+
}
|
70
|
+
}, /*#__PURE__*/React.createElement(DatagridHead, datagridState)), /*#__PURE__*/React.createElement(TableBody, _extends({}, getTableBodyProps(), {
|
71
|
+
onScroll: function onScroll(e) {
|
72
|
+
return syncScroll(e);
|
73
|
+
}
|
56
74
|
}), /*#__PURE__*/React.createElement(VariableSizeList, {
|
57
75
|
height: virtualHeight || tableHeight,
|
58
76
|
itemCount: visibleRows.length,
|
@@ -63,19 +81,20 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
63
81
|
onScroll: onScroll,
|
64
82
|
innerRef: innerListRef,
|
65
83
|
ref: listRef,
|
66
|
-
className: "".concat(blockClass, "__virtual-scrollbar")
|
84
|
+
className: "".concat(blockClass, "__virtual-scrollbar"),
|
85
|
+
style: {
|
86
|
+
width: (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.clientWidth
|
87
|
+
}
|
67
88
|
}, function (_ref) {
|
68
89
|
var index = _ref.index,
|
69
90
|
style = _ref.style;
|
70
91
|
var row = visibleRows[index];
|
71
92
|
prepareRow(row);
|
72
93
|
return /*#__PURE__*/React.createElement("div", {
|
73
|
-
style: _objectSpread(
|
74
|
-
overflow: withOverflowRow ? 'visible' : 'hidden'
|
75
|
-
})
|
94
|
+
style: _objectSpread({}, style)
|
76
95
|
}, row.RowRenderer(_objectSpread(_objectSpread({}, datagridState), {}, {
|
77
96
|
row: row
|
78
97
|
})));
|
79
|
-
}));
|
98
|
+
})));
|
80
99
|
};
|
81
100
|
export default DatagridVirtualBody;
|
@@ -48,12 +48,9 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
48
48
|
onApply = _ref$onApply === void 0 ? function () {} : _ref$onApply,
|
49
49
|
_ref$onCancel = _ref.onCancel,
|
50
50
|
onCancel = _ref$onCancel === void 0 ? function () {} : _ref$onCancel,
|
51
|
-
_ref$shouldClickOutsi = _ref.shouldClickOutsideToClose,
|
52
|
-
shouldClickOutsideToClose = _ref$shouldClickOutsi === void 0 ? false : _ref$shouldClickOutsi,
|
53
51
|
_ref$secondaryActionL = _ref.secondaryActionLabel,
|
54
52
|
secondaryActionLabel = _ref$secondaryActionL === void 0 ? 'Cancel' : _ref$secondaryActionL,
|
55
|
-
setAllFilters = _ref.setAllFilters
|
56
|
-
setFilter = _ref.setFilter;
|
53
|
+
setAllFilters = _ref.setAllFilters;
|
57
54
|
/** Context state and methods */
|
58
55
|
var _useContext = useContext(FilterContext),
|
59
56
|
EventEmitter = _useContext.EventEmitter;
|
@@ -100,8 +97,11 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
100
97
|
prevFiltersObjectArrayRef.current = JSON.stringify(filtersObjectArray);
|
101
98
|
};
|
102
99
|
var cancel = function cancel() {
|
103
|
-
|
104
|
-
|
100
|
+
// Reverting to previous filters only applies when using batch actions
|
101
|
+
if (updateMethod === BATCH) {
|
102
|
+
revertToPreviousFilters();
|
103
|
+
onCancel();
|
104
|
+
}
|
105
105
|
closeFlyout();
|
106
106
|
};
|
107
107
|
var reset = function reset() {
|
@@ -133,34 +133,32 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
133
133
|
if (type === DATE && !value[1]) {
|
134
134
|
return;
|
135
135
|
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
136
|
+
var filtersObjectArrayCopy = _toConsumableArray(filtersObjectArray);
|
137
|
+
// check if the filter already exists in the array
|
138
|
+
var filter = filtersObjectArrayCopy.find(function (item) {
|
139
|
+
return item.id === column;
|
140
|
+
});
|
141
|
+
|
142
|
+
// if filter exists in array then update the filter's new value
|
143
|
+
if (filter) {
|
144
|
+
filter.value = value;
|
145
|
+
} else {
|
146
|
+
filtersObjectArrayCopy.push({
|
147
|
+
id: column,
|
148
|
+
value: value,
|
149
|
+
type: type
|
141
150
|
});
|
151
|
+
}
|
152
|
+
setFiltersObjectArray(filtersObjectArrayCopy);
|
142
153
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
} else {
|
147
|
-
filtersObjectArrayCopy.push({
|
148
|
-
id: column,
|
149
|
-
value: value,
|
150
|
-
type: type
|
151
|
-
});
|
152
|
-
}
|
153
|
-
setFiltersObjectArray(filtersObjectArrayCopy);
|
154
|
-
} else if (updateMethod === INSTANT) {
|
155
|
-
setFilter(column, value);
|
154
|
+
// Automatically apply the filters if the updateMethod is instant
|
155
|
+
if (updateMethod === INSTANT) {
|
156
|
+
setAllFilters(filtersObjectArrayCopy);
|
156
157
|
}
|
157
|
-
}, [
|
158
|
+
}, [setAllFilters, updateMethod, filtersObjectArray]);
|
158
159
|
|
159
160
|
/** Effects */
|
160
161
|
useClickOutside(filterFlyoutRef, function (target) {
|
161
|
-
if (shouldClickOutsideToClose === false) {
|
162
|
-
return;
|
163
|
-
}
|
164
162
|
var hasClickedOnDatePicker = target.closest('.flatpickr-calendar');
|
165
163
|
if (!open || hasClickedOnDatePicker) {
|
166
164
|
return;
|
@@ -222,7 +220,7 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
222
220
|
key: option.labelText
|
223
221
|
}, option, {
|
224
222
|
onChange: function onChange(isSelected) {
|
225
|
-
var
|
223
|
+
var _option$onChange;
|
226
224
|
var checkboxCopy = filtersState[column];
|
227
225
|
var foundCheckbox = checkboxCopy.find(function (checkbox) {
|
228
226
|
return checkbox.value === option.value;
|
@@ -234,7 +232,7 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
234
232
|
value: _toConsumableArray(filtersState[column]),
|
235
233
|
type: type
|
236
234
|
});
|
237
|
-
(
|
235
|
+
(_option$onChange = option.onChange) === null || _option$onChange === void 0 ? void 0 : _option$onChange.call(option, isSelected);
|
238
236
|
},
|
239
237
|
checked: option.selected
|
240
238
|
}));
|
@@ -260,10 +258,11 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
260
258
|
})));
|
261
259
|
} else if (type === DROPDOWN) {
|
262
260
|
return /*#__PURE__*/React.createElement(Dropdown, _extends({}, components.Dropdown, {
|
261
|
+
selectedItem: filtersState[column],
|
263
262
|
onChange: function onChange(_ref5) {
|
264
|
-
var
|
263
|
+
var _components$Dropdown$, _components$Dropdown;
|
265
264
|
var selectedItem = _ref5.selectedItem;
|
266
|
-
setFiltersState(_objectSpread(_objectSpread({}, filtersState), {}, (
|
265
|
+
setFiltersState(_objectSpread(_objectSpread({}, filtersState), {}, _defineProperty({}, column, selectedItem)));
|
267
266
|
applyFilters({
|
268
267
|
column: column,
|
269
268
|
value: selectedItem,
|
@@ -320,10 +319,6 @@ var FilterFlyout = function FilterFlyout(_ref) {
|
|
320
319
|
}, renderFilters())), renderActionSet()));
|
321
320
|
};
|
322
321
|
FilterFlyout.propTypes = {
|
323
|
-
/**
|
324
|
-
* React children of carbon filters
|
325
|
-
*/
|
326
|
-
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
327
322
|
/**
|
328
323
|
* Array of filters to render
|
329
324
|
*/
|
@@ -364,14 +359,6 @@ FilterFlyout.propTypes = {
|
|
364
359
|
* Function that sets all the filters, this comes from the datagridState
|
365
360
|
*/
|
366
361
|
setAllFilters: PropTypes.func.isRequired,
|
367
|
-
/**
|
368
|
-
* Function that sets an individual filter, this comes from the datagridState
|
369
|
-
*/
|
370
|
-
setFilter: PropTypes.func.isRequired,
|
371
|
-
/**
|
372
|
-
* Boolean if you want the flyout to close when clicked outside of the parent
|
373
|
-
*/
|
374
|
-
shouldClickOutsideToClose: PropTypes.bool,
|
375
362
|
/**
|
376
363
|
* Title of the filter flyout
|
377
364
|
*/
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
5
|
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; }
|
@@ -22,7 +23,7 @@ import { usePreviousValue } from '../../../../../../global/js/hooks';
|
|
22
23
|
import { prepareProps } from '../../../../../../global/js/utils/props-helper';
|
23
24
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
24
25
|
export var InlineEditCell = function InlineEditCell(_ref) {
|
25
|
-
var _config$validator, _cx3;
|
26
|
+
var _config$validator, _cx3, _value$text;
|
26
27
|
var cell = _ref.cell,
|
27
28
|
config = _ref.config,
|
28
29
|
instance = _ref.instance,
|
@@ -248,6 +249,11 @@ export var InlineEditCell = function InlineEditCell(_ref) {
|
|
248
249
|
className: cx("".concat(blockClass, "__inline-edit--select-item"))
|
249
250
|
}, item === null || item === void 0 ? void 0 : item.text)) : item === null || item === void 0 ? void 0 : item.text;
|
250
251
|
};
|
252
|
+
var handleTransformedItem = function handleTransformedItem(items) {
|
253
|
+
return items !== null && items !== void 0 && items.length && _typeof(items[0]) === 'object' ? function (item) {
|
254
|
+
return renderDropdownItem(item);
|
255
|
+
} : null;
|
256
|
+
};
|
251
257
|
var renderSelectCell = function renderSelectCell() {
|
252
258
|
var _ref5 = config || {},
|
253
259
|
inputProps = _ref5.inputProps;
|
@@ -263,12 +269,8 @@ export var InlineEditCell = function InlineEditCell(_ref) {
|
|
263
269
|
className: cx("".concat(blockClass, "__inline-edit--select"), _defineProperty({}, "".concat(blockClass, "__inline-edit--select-").concat(rowSize), rowSize)),
|
264
270
|
items: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.items) || [],
|
265
271
|
initialSelectedItem: cell.value,
|
266
|
-
itemToElement:
|
267
|
-
|
268
|
-
},
|
269
|
-
renderSelectedItem: function renderSelectedItem(item) {
|
270
|
-
return renderDropdownItem(item);
|
271
|
-
},
|
272
|
+
itemToElement: handleTransformedItem(inputProps === null || inputProps === void 0 ? void 0 : inputProps.items),
|
273
|
+
renderSelectedItem: handleTransformedItem(inputProps === null || inputProps === void 0 ? void 0 : inputProps.items),
|
272
274
|
onChange: function onChange(item) {
|
273
275
|
var _inputProps$onChange;
|
274
276
|
var newCellId = getNewCellId('Enter');
|
@@ -432,7 +434,7 @@ export var InlineEditCell = function InlineEditCell(_ref) {
|
|
432
434
|
}, !inEditMode && /*#__PURE__*/React.createElement(InlineEditButton, {
|
433
435
|
isActiveCell: cellId === activeCellId,
|
434
436
|
renderIcon: setRenderIcon(),
|
435
|
-
label: type === 'selection' ? value.text : type === 'date' ? buildDate(value) : value,
|
437
|
+
label: type === 'selection' ? (_value$text = value === null || value === void 0 ? void 0 : value.text) !== null && _value$text !== void 0 ? _value$text : value : type === 'date' ? buildDate(value) : value,
|
436
438
|
labelIcon: (value === null || value === void 0 ? void 0 : value.icon) || null,
|
437
439
|
placeholder: placeholder,
|
438
440
|
tabIndex: tabIndex,
|
@@ -2,4 +2,4 @@ export { story as CustomizeColumnStory } from './CustomizeColumnStory';
|
|
2
2
|
export { default as StickyActionsColumn } from './StickyActionsColumnStory';
|
3
3
|
export { story as RowSizeDropdownStory } from './RowSizeDropdownStory';
|
4
4
|
export { story as LeftPanelStory } from './LeftPanelStory';
|
5
|
-
export { story as
|
5
|
+
export { story as SelectAllWithToggle } from './SelectAllWithToggleStory';
|
@@ -61,7 +61,6 @@ var useFiltering = function useFiltering(hooks) {
|
|
61
61
|
hooks.useInstance.push(function (instance) {
|
62
62
|
var filterProps = instance.filterProps,
|
63
63
|
setAllFilters = instance.setAllFilters,
|
64
|
-
setFilter = instance.setFilter,
|
65
64
|
headers = instance.headers;
|
66
65
|
var defaultProps = {
|
67
66
|
variation: 'flyout'
|
@@ -69,7 +68,6 @@ var useFiltering = function useFiltering(hooks) {
|
|
69
68
|
var getFilterFlyoutProps = function getFilterFlyoutProps() {
|
70
69
|
return _objectSpread(_objectSpread(_objectSpread({}, defaultProps), filterProps), {}, {
|
71
70
|
setAllFilters: setAllFilters,
|
72
|
-
setFilter: setFilter,
|
73
71
|
headers: headers
|
74
72
|
});
|
75
73
|
};
|
@@ -12,6 +12,7 @@ var useParentDimensions = function useParentDimensions(hooks) {
|
|
12
12
|
var headRef = useRef();
|
13
13
|
var innerListRef = useRef();
|
14
14
|
var listRef = useRef();
|
15
|
+
var gridRef = useRef();
|
15
16
|
var _useState = useState(),
|
16
17
|
_useState2 = _slicedToArray(_useState, 2),
|
17
18
|
tableHeight = _useState2[0],
|
@@ -47,7 +48,8 @@ var useParentDimensions = function useParentDimensions(hooks) {
|
|
47
48
|
headRef: headRef,
|
48
49
|
innerListRef: innerListRef,
|
49
50
|
handleResize: handleResize,
|
50
|
-
listRef: listRef
|
51
|
+
listRef: listRef,
|
52
|
+
gridRef: gridRef
|
51
53
|
});
|
52
54
|
};
|
53
55
|
hooks.useInstance.push(useInstance);
|
@@ -46,6 +46,10 @@ export var ARG_TYPES = {
|
|
46
46
|
control: 'select',
|
47
47
|
options: ['sm', 'lg']
|
48
48
|
},
|
49
|
+
emptyStateType: {
|
50
|
+
control: 'select',
|
51
|
+
options: ['error', 'noData']
|
52
|
+
},
|
49
53
|
useDenseHeader: {
|
50
54
|
control: {
|
51
55
|
type: 'radio'
|
@@ -86,5 +90,10 @@ export var ARG_TYPES = {
|
|
86
90
|
customizeColumnsProps: {
|
87
91
|
control: 'object',
|
88
92
|
description: 'This is an object containing all of the props used with the column customization extension. _This value is set/passed inside of the `datagridState` object._'
|
93
|
+
},
|
94
|
+
filterProps: {
|
95
|
+
name: 'Filter props',
|
96
|
+
control: 'object',
|
97
|
+
description: 'This is an object for all the props passed into the filter flyout and filter panel'
|
89
98
|
}
|
90
99
|
};
|
@@ -74,8 +74,13 @@ export var getInlineEditColumns = function getInlineEditColumns() {
|
|
74
74
|
accessor: 'visits',
|
75
75
|
width: 120,
|
76
76
|
inlineEdit: {
|
77
|
+
validator: function validator(n) {
|
78
|
+
return n && n < 10;
|
79
|
+
},
|
77
80
|
type: 'number',
|
78
|
-
inputProps: {
|
81
|
+
inputProps: {
|
82
|
+
invalidText: 'Invalid number, must be 10 or greater'
|
83
|
+
} // These props are passed to the Carbon component used for inline editing
|
79
84
|
}
|
80
85
|
}, {
|
81
86
|
Header: 'Active since',
|
@@ -18,6 +18,7 @@ import React, { useRef, useState } from 'react';
|
|
18
18
|
import PropTypes from 'prop-types';
|
19
19
|
import cx from 'classnames';
|
20
20
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
21
|
+
import pconsole from '../../global/js/utils/pconsole';
|
21
22
|
import { pkg, carbon } from '../../settings';
|
22
23
|
|
23
24
|
// Carbon and package components we use.
|
@@ -38,7 +39,6 @@ var defaults = {
|
|
38
39
|
size: 'md'
|
39
40
|
};
|
40
41
|
var buttons = ['cancel', 'edit', 'save'];
|
41
|
-
console.warn('the v1 version of this component is being deprecated. please switch to the v2 component as soon as possible.');
|
42
42
|
|
43
43
|
/**
|
44
44
|
* TODO: A description of the component.
|
@@ -83,6 +83,7 @@ export var InlineEditV1 = /*#__PURE__*/React.forwardRef(function (_ref, refIn) {
|
|
83
83
|
var showValidation = invalid; // || warn;
|
84
84
|
var validationText = invalidText; // || warnText;
|
85
85
|
var validationIcon = showValidation ? /*#__PURE__*/React.createElement(WarningFilled16, null) : null;
|
86
|
+
pconsole.warn("".concat(componentName, ": the v1 version of this component is being deprecated. please switch to the v2 component as soon as possible."));
|
86
87
|
|
87
88
|
// sanitize the tooltip values
|
88
89
|
var alignIsObject = _typeof(buttonTooltipAlignment) === 'object';
|
@@ -421,7 +421,7 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
421
421
|
kind: "ghost",
|
422
422
|
onClick: handleCollapseToggle,
|
423
423
|
renderIcon: ChevronUp16,
|
424
|
-
size: "
|
424
|
+
size: "md",
|
425
425
|
tooltipPosition: "bottom",
|
426
426
|
tooltipAlignment: "end",
|
427
427
|
type: "button"
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
-
var _excluded = ["body", "className", "iconDescription", "inputInvalidText", "inputLabelText", "inputPlaceholderText", "label", "onClose", "onRequestSubmit", "open", "preventCloseOnClickOutside", "primaryButtonText", "resourceName", "secondaryButtonText", "textConfirmation", "title"];
|
5
|
+
var _excluded = ["body", "className", "iconDescription", "inputInvalidText", "inputLabelText", "inputPlaceholderText", "label", "onClose", "onRequestSubmit", "open", "preventCloseOnClickOutside", "primaryButtonDisabled", "primaryButtonText", "resourceName", "secondaryButtonText", "textConfirmation", "title"];
|
6
6
|
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; }
|
7
7
|
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) { _defineProperty(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; }
|
8
8
|
//
|
@@ -33,6 +33,7 @@ export var RemoveModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
33
33
|
onRequestSubmit = _ref.onRequestSubmit,
|
34
34
|
open = _ref.open,
|
35
35
|
preventCloseOnClickOutside = _ref.preventCloseOnClickOutside,
|
36
|
+
primaryButtonDisabled = _ref.primaryButtonDisabled,
|
36
37
|
primaryButtonText = _ref.primaryButtonText,
|
37
38
|
resourceName = _ref.resourceName,
|
38
39
|
secondaryButtonText = _ref.secondaryButtonText,
|
@@ -50,7 +51,16 @@ export var RemoveModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
50
51
|
var onChangeHandler = function onChangeHandler(e) {
|
51
52
|
setUserInput(e.target.value);
|
52
53
|
};
|
53
|
-
var
|
54
|
+
var checkPrimaryButtonDisabled = function checkPrimaryButtonDisabled() {
|
55
|
+
// user control should be used primarily
|
56
|
+
if (primaryButtonDisabled) {
|
57
|
+
return true;
|
58
|
+
} else if (textConfirmation && userInput !== resourceName) {
|
59
|
+
return true;
|
60
|
+
}
|
61
|
+
return false;
|
62
|
+
};
|
63
|
+
var primaryButtonStatus = checkPrimaryButtonDisabled();
|
54
64
|
var blockClass = "".concat(pkg.prefix, "--remove-modal");
|
55
65
|
|
56
66
|
// Clear the user input this way so that if the onRequestSubmit handler fails for some reason
|
@@ -93,7 +103,7 @@ export var RemoveModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
93
103
|
type: "submit",
|
94
104
|
kind: "danger",
|
95
105
|
onClick: onRequestSubmit,
|
96
|
-
disabled:
|
106
|
+
disabled: primaryButtonStatus
|
97
107
|
}, primaryButtonText)));
|
98
108
|
});
|
99
109
|
|
@@ -144,6 +154,10 @@ RemoveModal.propTypes = {
|
|
144
154
|
* Prevent closing on click outside of modal
|
145
155
|
*/
|
146
156
|
preventCloseOnClickOutside: PropTypes.bool,
|
157
|
+
/**
|
158
|
+
* Specify whether the primary button should be disabled. This value will override textConfirmation
|
159
|
+
*/
|
160
|
+
primaryButtonDisabled: PropTypes.bool,
|
147
161
|
/**
|
148
162
|
* Specify the text for the primary button
|
149
163
|
*/
|
@@ -111,5 +111,5 @@ ButtonMenu.propTypes = {
|
|
111
111
|
* The size of the button for the menu trigger. The values can be any valid
|
112
112
|
* value for the carbon Button component 'size' prop.
|
113
113
|
*/
|
114
|
-
size:
|
114
|
+
size: _propTypes.default.oneOf(['sm', 'md', 'lg'])
|
115
115
|
};
|
@@ -31,7 +31,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
31
31
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
32
32
|
var blockClass = "".concat(_settings.pkg.prefix, "--button-set-with-overflow");
|
33
33
|
var componentName = 'ButtonSetWithOverflow';
|
34
|
-
var buttonSize = '
|
34
|
+
var buttonSize = 'md';
|
35
35
|
var ButtonSetWithOverflow = function ButtonSetWithOverflow(_ref) {
|
36
36
|
var buttons = _ref.buttons,
|
37
37
|
className = _ref.className,
|
@@ -78,7 +78,7 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
78
78
|
titleSize = _ref$titleSize === void 0 ? defaults.titleSize : _ref$titleSize,
|
79
79
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
80
80
|
var blockClass = "".concat(_settings.pkg.prefix, "--card");
|
81
|
-
var hasActions = actionIcons.length > 0 || overflowActions.length > 0 || primaryButtonText && primaryButtonPlacement === 'top';
|
81
|
+
var hasActions = actionIcons.length > 0 || overflowActions.length > 0 || !!primaryButtonText && primaryButtonPlacement === 'top';
|
82
82
|
var hasFooterActions = hasActions && actionsPlacement === 'bottom';
|
83
83
|
var hasFooterButton = !!secondaryButtonText || !!primaryButtonText && primaryButtonPlacement === 'bottom';
|
84
84
|
var hasBottomBar = hasFooterActions || hasFooterButton;
|
@@ -186,9 +186,7 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
186
186
|
// Removes the active cell element
|
187
187
|
var removeActiveCell = (0, _react.useCallback)(function () {
|
188
188
|
var activeCellHighlight = spreadsheetRef.current.querySelector(".".concat(blockClass, "__active-cell--highlight"));
|
189
|
-
|
190
|
-
activeCellHighlight.style.display = 'none';
|
191
|
-
}
|
189
|
+
activeCellHighlight.style.display = 'none';
|
192
190
|
}, [spreadsheetRef]);
|
193
191
|
var removeCellEditor = (0, _react.useCallback)(function () {
|
194
192
|
setCellEditorValue('');
|
@@ -14,6 +14,7 @@ var _rangeWithCallback = require("../../../global/js/utils/rangeWithCallback");
|
|
14
14
|
*/
|
15
15
|
|
16
16
|
var handleCellDeletion = function handleCellDeletion(_ref) {
|
17
|
+
var _selectionAreaToEmpty, _selectionAreaToEmpty2, _selectionAreaToEmpty3, _selectionAreaToEmpty4, _selectionAreaToEmpty5, _selectionAreaToEmpty6, _selectionAreaToEmpty7, _selectionAreaToEmpty8;
|
17
18
|
var activeCellCoordinates = _ref.activeCellCoordinates,
|
18
19
|
selectionAreas = _ref.selectionAreas,
|
19
20
|
currentMatcher = _ref.currentMatcher,
|
@@ -31,10 +32,10 @@ var handleCellDeletion = function handleCellDeletion(_ref) {
|
|
31
32
|
return item.matcher === currentMatcher;
|
32
33
|
});
|
33
34
|
var selectionAreaToEmptyContents = selectionAreaClone[indexOfCurrentSelectionArea];
|
34
|
-
var lowestColumnIndex = Math.min(selectionAreaToEmptyContents.point1.column, selectionAreaToEmptyContents.point2.column);
|
35
|
-
var greatestColumnIndex = Math.max(selectionAreaToEmptyContents.point1.column, selectionAreaToEmptyContents.point2.column);
|
36
|
-
var lowestRowIndex = Math.min(selectionAreaToEmptyContents.point1.row, selectionAreaToEmptyContents.point2.row);
|
37
|
-
var greatestRowIndex = Math.max(selectionAreaToEmptyContents.point1.row, selectionAreaToEmptyContents.point2.row);
|
35
|
+
var lowestColumnIndex = Math.min(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty === void 0 ? void 0 : _selectionAreaToEmpty.column, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty2 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty2 === void 0 ? void 0 : _selectionAreaToEmpty2.column);
|
36
|
+
var greatestColumnIndex = Math.max(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty3 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty3 === void 0 ? void 0 : _selectionAreaToEmpty3.column, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty4 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty4 === void 0 ? void 0 : _selectionAreaToEmpty4.column);
|
37
|
+
var lowestRowIndex = Math.min(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty5 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty5 === void 0 ? void 0 : _selectionAreaToEmpty5.row, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty6 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty6 === void 0 ? void 0 : _selectionAreaToEmpty6.row);
|
38
|
+
var greatestRowIndex = Math.max(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty7 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty7 === void 0 ? void 0 : _selectionAreaToEmpty7.row, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty8 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty8 === void 0 ? void 0 : _selectionAreaToEmpty8.row);
|
38
39
|
(0, _rangeWithCallback.rangeWithCallback)(lowestColumnIndex, greatestColumnIndex, function (columnIndex) {
|
39
40
|
(0, _rangeWithCallback.rangeWithCallback)(lowestRowIndex, greatestRowIndex, function (rowIndex) {
|
40
41
|
var cellProps = rows[rowIndex].cells[columnIndex];
|