@carbon/ibm-products 1.35.1 → 1.36.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 +278 -240
- 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 +6 -3
- 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 +278 -240
- 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 +278 -240
- 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/ActionSet/ActionSet.js +6 -3
- package/es/components/AddSelect/add-select-utils.js +2 -2
- package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +3 -3
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +4 -2
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +4 -3
- package/es/components/Datagrid/useNestedRowExpander.js +8 -3
- package/es/components/Datagrid/useRowExpander.js +13 -1
- package/es/components/InlineEdit/InlineEdit.js +22 -385
- package/es/components/InlineEditV1/InlineEditV1.js +406 -0
- package/es/components/InlineEditV1/index.js +8 -0
- package/es/components/InlineEditV2/InlineEditV2.js +48 -21
- package/es/components/InlineEditV2/index.js +7 -0
- package/es/components/OptionsTile/OptionsTile.js +25 -10
- package/es/components/index.js +1 -1
- package/es/global/js/hooks/index.js +2 -1
- package/es/global/js/hooks/useControllableState.js +74 -0
- package/es/global/js/package-settings.js +1 -0
- package/lib/components/ActionSet/ActionSet.js +6 -3
- package/lib/components/AddSelect/add-select-utils.js +2 -2
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +3 -3
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +4 -2
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +4 -3
- package/lib/components/Datagrid/useColumnOrder.js +2 -1
- package/lib/components/Datagrid/useNestedRowExpander.js +7 -2
- package/lib/components/Datagrid/useRowExpander.js +13 -1
- package/lib/components/InlineEdit/InlineEdit.js +22 -379
- package/lib/components/InlineEditV1/InlineEditV1.js +403 -0
- package/lib/components/InlineEditV1/index.js +12 -0
- package/lib/components/InlineEditV2/InlineEditV2.js +38 -20
- package/lib/components/OptionsTile/OptionsTile.js +25 -10
- package/lib/components/index.js +1 -1
- package/lib/global/js/hooks/index.js +8 -1
- package/lib/global/js/hooks/useControllableState.js +80 -0
- package/lib/global/js/package-settings.js +1 -0
- package/package.json +10 -10
- package/scss/components/ActionSet/_action-set.scss +9 -4
- package/scss/components/Datagrid/styles/_useExpandedRow.scss +18 -0
- package/scss/components/Datagrid/styles/_useNestedRows.scss +17 -0
- package/scss/components/{InlineEdit → InlineEditV1}/_index.scss +1 -1
- package/scss/components/{InlineEdit/_inline-edit.scss → InlineEditV1/_inline-edit-v1.scss} +0 -0
- package/scss/components/{InlineEdit → InlineEditV1}/_storybook-styles.scss +0 -0
- package/scss/components/InlineEditV2/_index.scss +1 -1
- package/scss/components/InlineEditV2/_inline-edit-v2.scss +5 -1
- package/scss/components/InlineEditV2/_storybook-styles.scss +6 -0
- package/scss/components/_index-released-only.scss +1 -1
- package/scss/components/_index.scss +2 -1
@@ -0,0 +1,74 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
+
/**
|
3
|
+
* Copyright IBM Corp. 2016, 2022
|
4
|
+
*
|
5
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
7
|
+
*/
|
8
|
+
|
9
|
+
import { useEffect, useRef, useState } from 'react';
|
10
|
+
import pconsole from '../utils/pconsole';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* This custom hook simplifies the behavior of a component if it has state that
|
14
|
+
* can be both controlled and uncontrolled. It functions identical to a
|
15
|
+
* useState() hook and provides [state, setState] for you to use. You can use
|
16
|
+
* the `onChange` argument to allow updates to the `state` to be communicated to
|
17
|
+
* owners of controlled components.
|
18
|
+
*
|
19
|
+
* Note: this hook will warn if a component is switching from controlled to
|
20
|
+
* uncontrolled, or vice-versa.
|
21
|
+
*
|
22
|
+
* @param {object} config
|
23
|
+
* @param {string} config.name - the name of the custom component
|
24
|
+
* @param {any} config.defaultValue - the default value used for the state. This will be
|
25
|
+
* the fallback value used if `value` is not defined.
|
26
|
+
* @param {Function} config.onChange - an optional function that is called when
|
27
|
+
* the value of the state changes. This is useful for communicating to parents of
|
28
|
+
* controlled components that the value is requesting to be changed.
|
29
|
+
* @param {any} config.value - a controlled value. Omitting this means that the state is
|
30
|
+
* uncontrolled
|
31
|
+
* @returns {[any, Function]}
|
32
|
+
*/
|
33
|
+
export function useControllableState(_ref) {
|
34
|
+
var defaultValue = _ref.defaultValue,
|
35
|
+
_ref$name = _ref.name,
|
36
|
+
name = _ref$name === void 0 ? 'custom' : _ref$name,
|
37
|
+
onChange = _ref.onChange,
|
38
|
+
value = _ref.value;
|
39
|
+
var _useState = useState(value !== null && value !== void 0 ? value : defaultValue),
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
41
|
+
state = _useState2[0],
|
42
|
+
internalSetState = _useState2[1];
|
43
|
+
var controlled = useRef(null);
|
44
|
+
if (controlled.current === null) {
|
45
|
+
controlled.current = value !== undefined;
|
46
|
+
}
|
47
|
+
function setState(stateOrUpdater) {
|
48
|
+
var value = typeof stateOrUpdater === 'function' ? stateOrUpdater(state) : stateOrUpdater;
|
49
|
+
if (controlled.current === false) {
|
50
|
+
internalSetState(value);
|
51
|
+
}
|
52
|
+
if (onChange) {
|
53
|
+
onChange(value);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
useEffect(function () {
|
57
|
+
var controlledValue = value !== undefined;
|
58
|
+
// Uncontrolled -> Controlled
|
59
|
+
// If the component prop is uncontrolled, the prop value should be undefined
|
60
|
+
if (controlled.current === false && controlledValue) {
|
61
|
+
pconsole.warn("A component is changing an uncontrolled %s component to be controlled.\n This is likely caused by the value changing to a defined value\n from undefined. Decide between using a controlled or uncontrolled\n value for the lifetime of the component.\n More info: https://reactjs.org/link/controlled-components");
|
62
|
+
}
|
63
|
+
|
64
|
+
// Controlled -> Uncontrolled
|
65
|
+
// If the component prop is controlled, the prop value should be defined
|
66
|
+
if (controlled.current === true && !controlledValue) {
|
67
|
+
pconsole.warn("A component is changing a controlled %s component to be uncontrolled.\n 'This is likely caused by the value changing to an undefined value\n 'from a defined one. Decide between using a controlled or\n 'uncontrolled value for the lifetime of the component.\n 'More info: https://reactjs.org/link/controlled-components");
|
68
|
+
}
|
69
|
+
}, [name, value]);
|
70
|
+
if (controlled.current === true) {
|
71
|
+
return [value, setState];
|
72
|
+
}
|
73
|
+
return [state, setState];
|
74
|
+
}
|
@@ -14,7 +14,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
14
|
var _settings = require("../../settings");
|
15
15
|
var _propsHelper = require("../../global/js/utils/props-helper");
|
16
16
|
var _carbonComponentsReact = require("carbon-components-react");
|
17
|
-
var _excluded = ["className", "disabled", "kind", "label", "loading"],
|
17
|
+
var _excluded = ["className", "disabled", "kind", "label", "loading", "isExpressive"],
|
18
18
|
_excluded2 = ["actions", "buttonSize", "className", "size"];
|
19
19
|
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; }
|
20
20
|
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; }
|
@@ -24,15 +24,18 @@ var componentName = 'ActionSet';
|
|
24
24
|
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
25
25
|
|
26
26
|
var ActionSetButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
27
|
+
var _ref2;
|
27
28
|
var className = _ref.className,
|
28
29
|
disabled = _ref.disabled,
|
29
30
|
kind = _ref.kind,
|
30
31
|
label = _ref.label,
|
31
32
|
loading = _ref.loading,
|
33
|
+
_ref$isExpressive = _ref.isExpressive,
|
34
|
+
isExpressive = _ref$isExpressive === void 0 ? true : _ref$isExpressive,
|
32
35
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
33
36
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, (0, _extends2.default)({}, rest, {
|
34
|
-
isExpressive:
|
35
|
-
className: (0, _classnames.default)(className, ["".concat(blockClass, "__action-button"), (0, _defineProperty2.default)(
|
37
|
+
isExpressive: isExpressive,
|
38
|
+
className: (0, _classnames.default)(className, ["".concat(blockClass, "__action-button"), (_ref2 = {}, (0, _defineProperty2.default)(_ref2, "".concat(blockClass, "__action-button--ghost"), kind === 'ghost' || kind === 'danger--ghost'), (0, _defineProperty2.default)(_ref2, "".concat(blockClass, "__action-button--expressive"), isExpressive), _ref2)]),
|
36
39
|
disabled: disabled || loading || false,
|
37
40
|
kind: kind,
|
38
41
|
ref: ref
|
@@ -83,7 +83,7 @@ var getFilteredItems = function getFilteredItems(useNormalizedItems, normalizedI
|
|
83
83
|
var itemIds = Object.keys(normalizedItems);
|
84
84
|
if (searchTerm || globalFiltersApplied) {
|
85
85
|
var results = itemIds.reduce(function (prev, cur) {
|
86
|
-
if (normalizedItems[cur].title.toLowerCase().includes(searchTerm)) {
|
86
|
+
if (normalizedItems[cur].title.toLowerCase().includes(searchTerm.toLowerCase())) {
|
87
87
|
prev.push(normalizedItems[cur]);
|
88
88
|
}
|
89
89
|
return prev;
|
@@ -122,7 +122,7 @@ var getFilteredItems = function getFilteredItems(useNormalizedItems, normalizedI
|
|
122
122
|
} else {
|
123
123
|
if (searchTerm) {
|
124
124
|
return items.entries.filter(function (item) {
|
125
|
-
return item.title.toLowerCase().includes(searchTerm);
|
125
|
+
return item.title.toLowerCase().includes(searchTerm.toLowerCase());
|
126
126
|
});
|
127
127
|
}
|
128
128
|
return items.entries;
|
@@ -109,7 +109,7 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
109
109
|
return;
|
110
110
|
}
|
111
111
|
var gridElement = document.querySelector("#".concat(tableId));
|
112
|
-
var tableHeader =
|
112
|
+
var tableHeader = gridElement === null || gridElement === void 0 ? void 0 : gridElement.querySelector(".".concat(_settings.carbon.prefix, "--data-table-header"));
|
113
113
|
gridElement.style.setProperty("--".concat(blockClass, "--grid-width"), (0, _layout.px)(totalColumnsWidth + 32));
|
114
114
|
if (gridActive) {
|
115
115
|
gridElement.style.setProperty("--".concat(blockClass, "--grid-header-height"), (0, _layout.px)((tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.clientHeight) || 0));
|
@@ -32,7 +32,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
32
32
|
var activeCellId = state.activeCellId;
|
33
33
|
var activeCellObject = activeCellId && (0, _getCellIdAsObject.getCellIdAsObject)(activeCellId);
|
34
34
|
return /*#__PURE__*/_react.default.createElement(TableRow, (0, _extends2.default)({
|
35
|
-
className: (0, _classnames.default)("".concat(blockClass, "__carbon-row"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), (0, _defineProperty2.default)(_cx, "".concat(_settings.carbon.prefix, "--data-table--selected"), row.isSelected), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__carbon-row-hover-active"), activeCellObject && row.index === activeCellObject.row), _cx))
|
35
|
+
className: (0, _classnames.default)("".concat(blockClass, "__carbon-row"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__carbon-row-expandable"), row.canExpand), (0, _defineProperty2.default)(_cx, "".concat(_settings.carbon.prefix, "--data-table--selected"), row.isSelected), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__carbon-row-hover-active"), activeCellObject && row.index === activeCellObject.row), _cx))
|
36
36
|
}, row.getRowProps(), {
|
37
37
|
key: row.id,
|
38
38
|
onMouseEnter: function onMouseEnter(event) {
|
@@ -43,7 +43,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
43
43
|
var hoverRow = event.target.closest(".".concat(blockClass, "__carbon-row-expanded"));
|
44
44
|
hoverRow === null || hoverRow === void 0 ? void 0 : hoverRow.classList.remove("".concat(blockClass, "__carbon-row-expanded-hover-active"));
|
45
45
|
}
|
46
|
-
}), row.cells.map(function (cell) {
|
46
|
+
}), row.cells.map(function (cell, index) {
|
47
47
|
var cellProps = cell.getCellProps();
|
48
48
|
var children = cellProps.children,
|
49
49
|
restProps = (0, _objectWithoutProperties2.default)(cellProps, _excluded);
|
@@ -55,7 +55,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
55
55
|
});
|
56
56
|
}
|
57
57
|
return /*#__PURE__*/_react.default.createElement(TableCell, (0, _extends2.default)({
|
58
|
-
className: "".concat(blockClass, "__cell")
|
58
|
+
className: (0, _classnames.default)("".concat(blockClass, "__cell"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__expandable-row-cell"), row.canExpand && index === 0))
|
59
59
|
}, restProps, {
|
60
60
|
key: cell.column.id
|
61
61
|
}), content);
|
@@ -41,7 +41,8 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
41
41
|
setReceivedInitialWidth = _useState6[1];
|
42
42
|
var selectedFlatRows = datagridState.selectedFlatRows,
|
43
43
|
toggleAllRowsSelected = datagridState.toggleAllRowsSelected,
|
44
|
-
toolbarBatchActions = datagridState.toolbarBatchActions
|
44
|
+
toolbarBatchActions = datagridState.toolbarBatchActions,
|
45
|
+
setGlobalFilter = datagridState.setGlobalFilter;
|
45
46
|
var totalSelected = selectedFlatRows && selectedFlatRows.length;
|
46
47
|
|
47
48
|
// Get initial width of batch actions container,
|
@@ -113,7 +114,8 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
113
114
|
shouldShowBatchActions: totalSelected > 0,
|
114
115
|
totalSelected: totalSelected,
|
115
116
|
onCancel: function onCancel() {
|
116
|
-
|
117
|
+
toggleAllRowsSelected(false);
|
118
|
+
setGlobalFilter(null);
|
117
119
|
}
|
118
120
|
}, !displayAllInMenu && toolbarBatchActions && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
119
121
|
if (index < 2 && toolbarBatchActions.length > 3 || index < 3 && toolbarBatchActions.length === 3) {
|
@@ -34,7 +34,7 @@ var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
|
34
34
|
hasIconOnly: true,
|
35
35
|
ref: buttonRef,
|
36
36
|
kind: "ghost",
|
37
|
-
tooltipPosition: "
|
37
|
+
tooltipPosition: "bottom",
|
38
38
|
renderIcon: _iconsReact.Settings16,
|
39
39
|
onClick: function onClick() {
|
40
40
|
return setIsOpen(!isOpen);
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
exports.default = void 0;
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
11
|
+
var _layout = require("@carbon/layout");
|
11
12
|
var _carbonComponentsReact = require("carbon-components-react");
|
12
13
|
var _isArray = _interopRequireDefault(require("lodash/isArray"));
|
13
14
|
var _settings = require("../../../../../settings");
|
@@ -52,8 +53,8 @@ var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
|
|
52
53
|
return /*#__PURE__*/_react.default.createElement("div", {
|
53
54
|
className: "".concat(blockClass, "__row-size-dropdown"),
|
54
55
|
style: {
|
55
|
-
top: top,
|
56
|
-
right: right
|
56
|
+
top: (0, _layout.rem)(top),
|
57
|
+
right: (0, _layout.rem)(right)
|
57
58
|
},
|
58
59
|
role: "presentation",
|
59
60
|
onClick: function onClick(e) {
|
@@ -96,7 +97,7 @@ var getDropdownPosition = function getDropdownPosition(buttonEle) {
|
|
96
97
|
var parent = buttonEle.parentElement;
|
97
98
|
if (parent instanceof HTMLElement) {
|
98
99
|
var top = buttonEle.offsetTop + buttonEle.offsetHeight;
|
99
|
-
var right = parent.offsetWidth -
|
100
|
+
var right = parent.offsetWidth - (buttonEle.offsetLeft + buttonEle.offsetWidth);
|
100
101
|
return {
|
101
102
|
top: top,
|
102
103
|
right: right
|
@@ -10,5 +10,6 @@ var _reactTable = require("react-table");
|
|
10
10
|
*
|
11
11
|
* This source code is licensed under the Apache-2.0 license found in the
|
12
12
|
* LICENSE file in the root directory of this source tree.
|
13
|
-
*/
|
13
|
+
*/
|
14
|
+
var _default = _reactTable.useColumnOrder;
|
14
15
|
exports.default = _default;
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.default = void 0;
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
11
12
|
var _iconsReact = require("@carbon/icons-react");
|
@@ -28,8 +29,12 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
28
29
|
Cell: function Cell(_ref) {
|
29
30
|
var _cx;
|
30
31
|
var row = _ref.row;
|
31
|
-
return row.canExpand && /*#__PURE__*/_react.default.createElement("
|
32
|
-
|
32
|
+
return row.canExpand && /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({
|
33
|
+
type: "button",
|
34
|
+
"aria-label": "Expand current row",
|
35
|
+
className: (0, _classnames.default)("".concat(blockClass, "__row-expander"), "".concat(_settings.carbon.prefix, "--btn"), "".concat(_settings.carbon.prefix, "--btn--ghost"))
|
36
|
+
}, row.getToggleRowExpandedProps()), /*#__PURE__*/_react.default.createElement(_iconsReact.ChevronRight16, {
|
37
|
+
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))
|
33
38
|
}));
|
34
39
|
},
|
35
40
|
width: 48,
|
@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.default = void 0;
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
10
|
var _react = _interopRequireDefault(require("react"));
|
10
11
|
var _iconsReact = require("@carbon/icons-react");
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
13
|
+
var _settings = require("../../settings");
|
11
14
|
/* eslint-disable react/prop-types */
|
12
15
|
/*
|
13
16
|
* Licensed Materials - Property of IBM
|
@@ -17,13 +20,22 @@ var _iconsReact = require("@carbon/icons-react");
|
|
17
20
|
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
18
21
|
*/
|
19
22
|
|
23
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
20
24
|
var useRowExpander = function useRowExpander(hooks) {
|
21
25
|
var visibleColumns = function visibleColumns(columns) {
|
22
26
|
var expanderColumn = {
|
23
27
|
id: 'expander',
|
24
28
|
Cell: function Cell(_ref) {
|
25
29
|
var row = _ref.row;
|
26
|
-
return row.canExpand && /*#__PURE__*/_react.default.createElement("
|
30
|
+
return row.canExpand && /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({
|
31
|
+
type: "button",
|
32
|
+
"aria-label": "Expand current row",
|
33
|
+
className: (0, _classnames.default)("".concat(blockClass, "__row-expander"), "".concat(_settings.carbon.prefix, "--btn"), "".concat(_settings.carbon.prefix, "--btn--ghost"))
|
34
|
+
}, row.getToggleRowExpandedProps()), row.isExpanded ? /*#__PURE__*/_react.default.createElement(_iconsReact.ChevronUp16, {
|
35
|
+
className: "".concat(blockClass, "__row-expander--icon")
|
36
|
+
}) : /*#__PURE__*/_react.default.createElement(_iconsReact.ChevronDown16, {
|
37
|
+
className: "".concat(blockClass, "__row-expander--icon")
|
38
|
+
}));
|
27
39
|
},
|
28
40
|
width: 48,
|
29
41
|
disableResizing: true,
|