@carbon/ibm-products 1.47.0 → 1.49.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 +1424 -29
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +5 -5
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +37 -15
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +2 -2
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +1424 -29
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +5 -5
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +1424 -29
- package/css/index.css.map +1 -1
- package/css/index.min.css +5 -5
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +6 -4
- package/es/components/AddSelect/AddSelectList.js +15 -26
- package/es/components/CreateFullPage/CreateFullPage.js +3 -2
- package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +1 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +14 -5
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +6 -3
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +15 -56
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +5 -8
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +105 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +17 -5
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +11 -0
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +8 -8
- package/es/components/Datagrid/index.js +8 -7
- package/es/components/Datagrid/useOnRowClick.js +3 -3
- package/es/components/Datagrid/useSortableColumns.js +26 -9
- package/es/components/Datagrid/utils/getAutoSizedColumnWidth.js +27 -0
- package/es/components/InlineEditV2/InlineEditV2.js +6 -3
- package/es/components/NonLinearReading/NonLinearReading.js +87 -0
- package/es/components/NonLinearReading/index.js +8 -0
- package/es/components/SidePanel/SidePanel.js +3 -4
- package/es/components/index.js +3 -2
- package/es/global/js/package-settings.js +3 -1
- package/es/global/js/utils/story-helper.js +9 -0
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +6 -4
- package/lib/components/AddSelect/AddSelectList.js +14 -25
- package/lib/components/CreateFullPage/CreateFullPage.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +13 -4
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +6 -3
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +15 -56
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +5 -8
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +113 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +1 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +17 -5
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +11 -0
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +3 -1
- package/lib/components/Datagrid/index.js +8 -1
- package/lib/components/Datagrid/useOnRowClick.js +3 -3
- package/lib/components/Datagrid/useSortableColumns.js +26 -9
- package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.js +35 -0
- package/lib/components/InlineEditV2/InlineEditV2.js +6 -3
- package/lib/components/NonLinearReading/NonLinearReading.js +90 -0
- package/lib/components/NonLinearReading/index.js +12 -0
- package/lib/components/SidePanel/SidePanel.js +2 -3
- package/lib/components/index.js +14 -1
- package/lib/global/js/package-settings.js +3 -1
- package/lib/global/js/utils/story-helper.js +12 -2
- package/package.json +2 -2
- package/scss/components/AddSelect/_add-select.scss +0 -10
- package/scss/components/Datagrid/styles/_datagrid.scss +5 -1
- package/scss/components/Datagrid/styles/_useSortableColumns.scss +8 -4
- package/scss/components/InlineEditV1/_inline-edit-v1.scss +1 -5
- package/scss/components/InlineEditV2/_inline-edit-v2.scss +41 -3
- package/scss/components/NonLinearReading/_index.scss +8 -0
- package/scss/components/NonLinearReading/_non-linear-reading.scss +157 -0
- package/scss/components/NonLinearReading/_storybook-styles.scss +13 -0
- package/scss/components/SidePanel/_side-panel.scss +7 -15
- package/scss/components/_index.scss +1 -0
|
@@ -22,6 +22,7 @@ var ordering = {
|
|
|
22
22
|
};
|
|
23
23
|
var useSortableColumns = function useSortableColumns(hooks) {
|
|
24
24
|
var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref) {
|
|
25
|
+
var _instance$customizeCo;
|
|
25
26
|
var instance = _ref.instance;
|
|
26
27
|
var onSort = instance.onSort;
|
|
27
28
|
var onSortClick = function onSortClick(column) {
|
|
@@ -37,27 +38,43 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
|
37
38
|
};
|
|
38
39
|
var sortableColumns = visibleColumns.map(function (column) {
|
|
39
40
|
var icon = function icon(col) {
|
|
40
|
-
if (col.isSorted) {
|
|
41
|
+
if (col !== null && col !== void 0 && col.isSorted) {
|
|
41
42
|
switch (col.isSortedDesc) {
|
|
42
43
|
case false:
|
|
43
|
-
return
|
|
44
|
+
return function () {
|
|
45
|
+
return /*#__PURE__*/React.createElement(ArrowUp16, {
|
|
46
|
+
className: "".concat(blockClass, "__sortable-icon ").concat(carbon.prefix, "--btn__icon")
|
|
47
|
+
});
|
|
48
|
+
};
|
|
44
49
|
case true:
|
|
45
|
-
return
|
|
50
|
+
return function () {
|
|
51
|
+
return /*#__PURE__*/React.createElement(ArrowUp16, {
|
|
52
|
+
className: "".concat(blockClass, "__sortable-icon ").concat(carbon.prefix, "--btn__icon")
|
|
53
|
+
});
|
|
54
|
+
};
|
|
46
55
|
default:
|
|
47
|
-
return
|
|
56
|
+
return function () {
|
|
57
|
+
return /*#__PURE__*/React.createElement(Arrows16, {
|
|
58
|
+
className: "".concat(blockClass, "__sortable-icon ").concat(carbon.prefix, "--btn__icon")
|
|
59
|
+
});
|
|
60
|
+
};
|
|
48
61
|
}
|
|
49
62
|
}
|
|
50
|
-
return
|
|
63
|
+
return function () {
|
|
64
|
+
return /*#__PURE__*/React.createElement(Arrows16, {
|
|
65
|
+
className: "".concat(blockClass, "__sortable-icon ").concat(carbon.prefix, "--btn__icon")
|
|
66
|
+
});
|
|
67
|
+
};
|
|
51
68
|
};
|
|
52
69
|
var Header = function Header(headerProp) {
|
|
53
70
|
var _cx;
|
|
54
71
|
return column.disableSortBy === true ? column.Header : /*#__PURE__*/React.createElement(Button, {
|
|
55
72
|
onClick: function onClick() {
|
|
56
|
-
return onSortClick(headerProp.column);
|
|
73
|
+
return onSortClick(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column);
|
|
57
74
|
},
|
|
58
75
|
kind: "ghost",
|
|
59
|
-
renderIcon: icon(headerProp.column),
|
|
60
|
-
className: cx("".concat(carbon.prefix, "--table-sort ").concat(blockClass, "--table-sort"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "--table-sort--desc"), headerProp.column.isSortedDesc), _defineProperty(_cx, "".concat(blockClass, "--table-sort--asc"), headerProp.column.isSortedDesc === false), _cx))
|
|
76
|
+
renderIcon: icon(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column),
|
|
77
|
+
className: cx("".concat(carbon.prefix, "--table-sort ").concat(blockClass, "--table-sort"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "--table-sort--desc"), headerProp === null || headerProp === void 0 ? void 0 : headerProp.column.isSortedDesc), _defineProperty(_cx, "".concat(blockClass, "--table-sort--asc"), (headerProp === null || headerProp === void 0 ? void 0 : headerProp.column.isSortedDesc) === false), _cx))
|
|
61
78
|
}, column.Header);
|
|
62
79
|
};
|
|
63
80
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
@@ -65,7 +82,7 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
|
65
82
|
minWidth: column.disableSortBy === true ? 0 : 90
|
|
66
83
|
});
|
|
67
84
|
});
|
|
68
|
-
return _toConsumableArray(sortableColumns);
|
|
85
|
+
return (_instance$customizeCo = instance.customizeColumnsProps) !== null && _instance$customizeCo !== void 0 && _instance$customizeCo.isTearsheetOpen ? visibleColumns : _toConsumableArray(sortableColumns);
|
|
69
86
|
};
|
|
70
87
|
var sortInstanceProps = function sortInstanceProps(instance) {
|
|
71
88
|
var onSort = instance.onSort;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright IBM Corp. 2023, 2023
|
|
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
|
+
/**
|
|
10
|
+
* Calculates the auto sized width of a column
|
|
11
|
+
* @param {Array<object>} rows - The datagrid rows
|
|
12
|
+
* @param {string} accessor - The accessor for the column
|
|
13
|
+
* @param {string} headerText - The header text for the column
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export var getAutoSizedColumnWidth = function getAutoSizedColumnWidth(rows, accessor, headerText) {
|
|
17
|
+
var maxWidth = 400;
|
|
18
|
+
var minWidth = 58;
|
|
19
|
+
var letterSpacing = 10;
|
|
20
|
+
var cellLength = Math.max.apply(Math, _toConsumableArray(rows.map(function (row) {
|
|
21
|
+
return ("".concat(row[accessor]) || '').length;
|
|
22
|
+
})).concat([headerText.length]));
|
|
23
|
+
if (cellLength <= 3) {
|
|
24
|
+
return minWidth;
|
|
25
|
+
}
|
|
26
|
+
return Math.min(maxWidth, cellLength * letterSpacing + 16);
|
|
27
|
+
};
|
|
@@ -22,6 +22,7 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
|
|
22
22
|
var componentName = 'InlineEditV2';
|
|
23
23
|
var blockClass = "".concat(pkg.prefix, "--inline-edit-v2");
|
|
24
24
|
export var InlineEditV2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
25
|
+
var _cx;
|
|
25
26
|
var cancelLabel = _ref.cancelLabel,
|
|
26
27
|
editLabel = _ref.editLabel,
|
|
27
28
|
id = _ref.id,
|
|
@@ -128,7 +129,7 @@ export var InlineEditV2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
128
129
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
129
130
|
ref: ref
|
|
130
131
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement("div", {
|
|
131
|
-
className: cx(blockClass,
|
|
132
|
+
className: cx(blockClass, (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "--focused"), focused), _defineProperty(_cx, "".concat(blockClass, "--invalid"), invalid), _cx)),
|
|
132
133
|
onFocus: onFocusHandler,
|
|
133
134
|
onBlur: onBlurHandler
|
|
134
135
|
}, /*#__PURE__*/React.createElement("label", {
|
|
@@ -144,7 +145,9 @@ export var InlineEditV2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
144
145
|
// readOnly={readOnly}
|
|
145
146
|
,
|
|
146
147
|
onKeyDown: onKeyHandler
|
|
147
|
-
}),
|
|
148
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
149
|
+
className: "".concat(blockClass, "__toolbar")
|
|
150
|
+
}, focused ? /*#__PURE__*/React.createElement(React.Fragment, null, invalid && /*#__PURE__*/React.createElement(WarningFilled16, {
|
|
148
151
|
className: "".concat(blockClass, "__warning-icon")
|
|
149
152
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
150
153
|
hasIconOnly: true,
|
|
@@ -181,7 +184,7 @@ export var InlineEditV2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
181
184
|
kind: "ghost",
|
|
182
185
|
tabIndex: 0,
|
|
183
186
|
key: "edit"
|
|
184
|
-
})), focused && invalid && /*#__PURE__*/React.createElement("p", {
|
|
187
|
+
}))), focused && invalid && /*#__PURE__*/React.createElement("p", {
|
|
185
188
|
className: "".concat(blockClass, "__warning-text")
|
|
186
189
|
}, invalidLabel));
|
|
187
190
|
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["children", "className", "definition", "theme"];
|
|
5
|
+
/**
|
|
6
|
+
* Copyright IBM Corp. 2023, 2023
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import React, { useState } from 'react';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import cx from 'classnames';
|
|
15
|
+
import { ChevronUp16 } from '@carbon/icons-react';
|
|
16
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
|
17
|
+
import { pkg } from '../../settings';
|
|
18
|
+
|
|
19
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
20
|
+
var blockClass = "".concat(pkg.prefix, "--non-linear-reading");
|
|
21
|
+
var componentName = 'NonLinearReading';
|
|
22
|
+
|
|
23
|
+
// Default values for props
|
|
24
|
+
var defaults = {
|
|
25
|
+
theme: 'light'
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Use non-linear reading when space is limited to share a
|
|
30
|
+
* brief, at-a-glance, summary of a concept that may require
|
|
31
|
+
* more explanation for some users.
|
|
32
|
+
*/
|
|
33
|
+
export var NonLinearReading = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
34
|
+
var children = _ref.children,
|
|
35
|
+
className = _ref.className,
|
|
36
|
+
definition = _ref.definition,
|
|
37
|
+
_ref$theme = _ref.theme,
|
|
38
|
+
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
|
39
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
+
var _useState = useState(false),
|
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
+
isOpen = _useState2[0],
|
|
43
|
+
setOpen = _useState2[1];
|
|
44
|
+
var handleToggle = function handleToggle() {
|
|
45
|
+
setOpen(function (prevState) {
|
|
46
|
+
return !prevState;
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
50
|
+
className: cx(blockClass, className),
|
|
51
|
+
ref: ref,
|
|
52
|
+
role: "main"
|
|
53
|
+
}, getDevtoolsProps(componentName)), ' ', /*#__PURE__*/React.createElement("button", {
|
|
54
|
+
type: "button",
|
|
55
|
+
"aria-expanded": isOpen,
|
|
56
|
+
className: cx("".concat(blockClass, "__term-").concat(theme), [isOpen ? ["".concat(blockClass, "__term-").concat(theme, "--open")] : ["".concat(blockClass, "__term-").concat(theme, "--closed")]]),
|
|
57
|
+
onClick: handleToggle
|
|
58
|
+
}, children, isOpen && /*#__PURE__*/React.createElement(ChevronUp16, null)), ' ', isOpen && /*#__PURE__*/React.createElement("span", {
|
|
59
|
+
className: "".concat(blockClass, "--body-").concat(theme)
|
|
60
|
+
}, definition), ' ');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Return a placeholder if not released and not enabled by feature flag
|
|
64
|
+
NonLinearReading = pkg.checkComponentEnabled(NonLinearReading, componentName);
|
|
65
|
+
NonLinearReading.displayName = componentName;
|
|
66
|
+
|
|
67
|
+
// The types and DocGen commentary for the component props,
|
|
68
|
+
// in alphabetical order (for consistency).
|
|
69
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
|
70
|
+
NonLinearReading.propTypes = {
|
|
71
|
+
/**
|
|
72
|
+
* The term of the component appears as a pill.
|
|
73
|
+
*/
|
|
74
|
+
children: PropTypes.node.isRequired,
|
|
75
|
+
/**
|
|
76
|
+
* Provide an optional class to be applied to the containing node.
|
|
77
|
+
*/
|
|
78
|
+
className: PropTypes.string,
|
|
79
|
+
/**
|
|
80
|
+
* The content that appears when the term is toggled open.
|
|
81
|
+
*/
|
|
82
|
+
definition: PropTypes.node.isRequired,
|
|
83
|
+
/**
|
|
84
|
+
* Determines the theme of the component.
|
|
85
|
+
*/
|
|
86
|
+
theme: PropTypes.oneOf(['light', 'dark'])
|
|
87
|
+
};
|
|
@@ -7,7 +7,7 @@ var _excluded = ["actionToolbarButtons", "actions", "animateTitle", "children",
|
|
|
7
7
|
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; }
|
|
8
8
|
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; }
|
|
9
9
|
/**
|
|
10
|
-
* Copyright IBM Corp. 2020,
|
|
10
|
+
* Copyright IBM Corp. 2020, 2023
|
|
11
11
|
*
|
|
12
12
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -398,7 +398,6 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
398
398
|
}, subtitle), actionToolbarButtons && actionToolbarButtons.length && /*#__PURE__*/React.createElement("div", {
|
|
399
399
|
className: cx("".concat(blockClass, "__action-toolbar"), _defineProperty({}, "".concat(blockClass, "__action-toolbar-no-animation"), !animateTitle))
|
|
400
400
|
}, actionToolbarButtons.map(function (_ref5) {
|
|
401
|
-
var _ref6;
|
|
402
401
|
var label = _ref5.label,
|
|
403
402
|
kind = _ref5.kind,
|
|
404
403
|
icon = _ref5.icon,
|
|
@@ -416,10 +415,10 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
416
415
|
renderIcon: icon,
|
|
417
416
|
iconDescription: label,
|
|
418
417
|
tooltipPosition: tooltipPosition || 'bottom',
|
|
419
|
-
tooltipAlignment: tooltipAlignment || '
|
|
418
|
+
tooltipAlignment: tooltipAlignment || 'start',
|
|
420
419
|
hasIconOnly: !leading,
|
|
421
420
|
disabled: disabled,
|
|
422
|
-
className: cx(["".concat(blockClass, "__action-toolbar-button"), className, (
|
|
421
|
+
className: cx(["".concat(blockClass, "__action-toolbar-button"), className, _defineProperty({}, "".concat(blockClass, "__action-toolbar-leading-button"), leading)]),
|
|
423
422
|
onClick: onClick
|
|
424
423
|
}), leading && label);
|
|
425
424
|
})));
|
package/es/components/index.js
CHANGED
|
@@ -37,9 +37,10 @@ export { WebTerminal, WebTerminalContentWrapper, useWebTerminal, WebTerminalProv
|
|
|
37
37
|
export { EditSidePanel } from './EditSidePanel';
|
|
38
38
|
export { OptionsTile } from './OptionsTile';
|
|
39
39
|
export { DataSpreadsheet } from './DataSpreadsheet';
|
|
40
|
-
export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnCenterAlign, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle, useColumnOrder, useInlineEdit, useFiltering } from './Datagrid';
|
|
40
|
+
export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnCenterAlign, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle, useColumnOrder, useInlineEdit, useFiltering, getAutoSizedColumnWidth } from './Datagrid';
|
|
41
41
|
export { EditTearsheet } from './EditTearsheet';
|
|
42
42
|
export { EditTearsheetNarrow } from './EditTearsheetNarrow';
|
|
43
43
|
export { EditFullPage } from './EditFullPage';
|
|
44
44
|
export { EditUpdateCards } from './EditUpdateCards';
|
|
45
|
-
export { InlineEdit } from './InlineEdit';
|
|
45
|
+
export { InlineEdit } from './InlineEdit';
|
|
46
|
+
export { NonLinearReading } from './NonLinearReading';
|
|
@@ -69,7 +69,9 @@ var defaults = {
|
|
|
69
69
|
EditTearsheetNarrow: false,
|
|
70
70
|
EditFullPage: false,
|
|
71
71
|
EditUpdateCards: false,
|
|
72
|
-
ButtonMenu: false
|
|
72
|
+
ButtonMenu: false,
|
|
73
|
+
// Novice to pro components not yet reviewed and released:
|
|
74
|
+
NonLinearReading: false
|
|
73
75
|
/* new component flags here - comment used by generate CLI */
|
|
74
76
|
},
|
|
75
77
|
|
|
@@ -77,4 +77,13 @@ CodesandboxLink.propTypes = {
|
|
|
77
77
|
* directory withing examples codesandbox will be found
|
|
78
78
|
*/
|
|
79
79
|
exampleDirectory: PropTypes.string
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A helper function that finds the designated theme on the Storybook canvas.
|
|
84
|
+
* @returns "dark" or "light"
|
|
85
|
+
*/
|
|
86
|
+
export var getSelectedCarbonTheme = function getSelectedCarbonTheme() {
|
|
87
|
+
var themeId = document.querySelector('html').getAttribute('storybook-carbon-theme');
|
|
88
|
+
return themeId === 'g90' || themeId === 'g100' ? 'dark' : 'light';
|
|
80
89
|
};
|
|
@@ -24,7 +24,8 @@ var AddSelectBreadcrumbs = function AddSelectBreadcrumbs(_ref) {
|
|
|
24
24
|
var multi = _ref.multi,
|
|
25
25
|
onClick = _ref.onClick,
|
|
26
26
|
path = _ref.path;
|
|
27
|
-
var clickHandler = function clickHandler(idx) {
|
|
27
|
+
var clickHandler = function clickHandler(e, idx) {
|
|
28
|
+
e.preventDefault();
|
|
28
29
|
onClick(idx);
|
|
29
30
|
};
|
|
30
31
|
var classNames = (0, _classnames.default)(blockClass, (0, _defineProperty2.default)({}, "".concat(blockClass, "-multi"), multi));
|
|
@@ -36,9 +37,10 @@ var AddSelectBreadcrumbs = function AddSelectBreadcrumbs(_ref) {
|
|
|
36
37
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.BreadcrumbItem, {
|
|
37
38
|
key: entry.id,
|
|
38
39
|
isCurrentPage: isCurrentPage,
|
|
39
|
-
onClick: function onClick() {
|
|
40
|
-
return clickHandler(idx);
|
|
41
|
-
}
|
|
40
|
+
onClick: function onClick(e) {
|
|
41
|
+
return clickHandler(e, idx);
|
|
42
|
+
},
|
|
43
|
+
href: "#"
|
|
42
44
|
}, entry.title);
|
|
43
45
|
}));
|
|
44
46
|
};
|
|
@@ -106,33 +106,22 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
106
106
|
};
|
|
107
107
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
108
108
|
className: (0, _classnames.default)("".concat(blockClass, "-wrapper"), (0, _defineProperty2.default)({}, "".concat(blockClass, "-wrapper-multi"), multi))
|
|
109
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
110
|
-
selection: true,
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
111
110
|
className: "".concat(blockClass)
|
|
112
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
111
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
+
className: "".concat(blockClass, "-body")
|
|
113
|
+
}, filteredItems.map(function (item) {
|
|
113
114
|
var _cx2;
|
|
114
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
115
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
115
116
|
key: item.id,
|
|
116
|
-
className: (0, _classnames.default)("".concat(blockClass, "-row"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "-row--selected"), isSelected(item.id)), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "-row-meta--selected"), isInMetaPanel(item.id)), _cx2))
|
|
117
|
-
onClick: function onClick(evt) {
|
|
118
|
-
return metaPanelHandler(item, evt);
|
|
119
|
-
},
|
|
120
|
-
label: true
|
|
117
|
+
className: (0, _classnames.default)("".concat(blockClass, "-row"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "-row--selected"), isSelected(item.id)), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "-row-meta--selected"), isInMetaPanel(item.id)), _cx2))
|
|
121
118
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
122
119
|
className: "".concat(blockClass, "-cell")
|
|
123
120
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
124
121
|
className: "".concat(blockClass, "-cell-wrapper")
|
|
125
122
|
}, multi ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
126
123
|
className: "".concat(blockClass, "-checkbox")
|
|
127
|
-
},
|
|
128
|
-
/*#__PURE__*/
|
|
129
|
-
// hacky way to prevent checkbox from triggering the meta onclick handler
|
|
130
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
131
|
-
_react.default.createElement("div", {
|
|
132
|
-
onClick: function onClick(event) {
|
|
133
|
-
return event.stopPropagation();
|
|
134
|
-
}
|
|
135
|
-
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, {
|
|
124
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, {
|
|
136
125
|
onChange: function onChange(value, id) {
|
|
137
126
|
return handleMultiSelection(value, id);
|
|
138
127
|
},
|
|
@@ -154,10 +143,9 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
154
143
|
id: "add-select-modifier-".concat(item.id),
|
|
155
144
|
type: "inline",
|
|
156
145
|
items: modifiers.options,
|
|
157
|
-
light: true,
|
|
158
146
|
label: modifiers.label,
|
|
159
147
|
disabled: !isSelected(item.id),
|
|
160
|
-
className: "".concat(blockClass, "-dropdown
|
|
148
|
+
className: "".concat(blockClass, "-dropdown"),
|
|
161
149
|
initialSelectedItem: item[modifiers.id],
|
|
162
150
|
onChange: function onChange(_ref5) {
|
|
163
151
|
var selectedItem = _ref5.selectedItem;
|
|
@@ -185,9 +173,7 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
185
173
|
},
|
|
186
174
|
kind: "ghost",
|
|
187
175
|
size: "sm"
|
|
188
|
-
}), item.meta && /*#__PURE__*/_react.default.createElement(
|
|
189
|
-
className: "".concat(blockClass, "-hidden-hover")
|
|
190
|
-
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
176
|
+
}), item.meta && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
191
177
|
className: "".concat(blockClass, "-view-meta"),
|
|
192
178
|
renderIcon: _iconsReact.View16,
|
|
193
179
|
iconDescription: metaIconDescription,
|
|
@@ -195,8 +181,11 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
|
195
181
|
tooltipAlignment: "center",
|
|
196
182
|
hasIconOnly: true,
|
|
197
183
|
kind: "ghost",
|
|
198
|
-
size: "sm"
|
|
199
|
-
|
|
184
|
+
size: "sm",
|
|
185
|
+
onClick: function onClick() {
|
|
186
|
+
return metaPanelHandler(item);
|
|
187
|
+
}
|
|
188
|
+
}))));
|
|
200
189
|
}))));
|
|
201
190
|
};
|
|
202
191
|
exports.AddSelectList = AddSelectList;
|
|
@@ -200,7 +200,8 @@ var CreateFullPage = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
|
200
200
|
kind: "secondary",
|
|
201
201
|
onClick: function onClick() {
|
|
202
202
|
setModalIsOpen(!modalIsOpen);
|
|
203
|
-
}
|
|
203
|
+
},
|
|
204
|
+
"data-modal-primary-focus": true
|
|
204
205
|
}, modalSecondaryButtonText), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
205
206
|
type: "button",
|
|
206
207
|
kind: "danger",
|
|
@@ -100,9 +100,9 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
|
100
100
|
return (0, _handleGridKeyPress.handleGridKeyPress)({
|
|
101
101
|
event: event,
|
|
102
102
|
dispatch: dispatch,
|
|
103
|
-
inlineEditState: inlineEditState,
|
|
104
103
|
instance: datagridState,
|
|
105
104
|
keysPressedList: keysPressedList,
|
|
105
|
+
state: inlineEditState,
|
|
106
106
|
usingMac: usingMac
|
|
107
107
|
});
|
|
108
108
|
} : null,
|
|
@@ -118,7 +118,7 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
|
118
118
|
setGlobalFilter(null);
|
|
119
119
|
}
|
|
120
120
|
}, !displayAllInMenu && toolbarBatchActions && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
|
|
121
|
-
if (index < 2 && toolbarBatchActions.length > 3 || index < 3 && toolbarBatchActions.length
|
|
121
|
+
if (index < 2 && toolbarBatchActions.length > 3 || index < 3 && toolbarBatchActions.length <= 3) {
|
|
122
122
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.TableBatchAction, {
|
|
123
123
|
key: "".concat(batchAction.label, "-").concat(index),
|
|
124
124
|
renderIcon: batchAction.renderIcon,
|
|
@@ -11,9 +11,10 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _reactWindow = require("react-window");
|
|
13
13
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
14
|
+
var _layout = require("@carbon/layout");
|
|
15
|
+
var _reactResizeDetector = require("react-resize-detector");
|
|
14
16
|
var _settings = require("../../../settings");
|
|
15
17
|
var _DatagridHead = _interopRequireDefault(require("./DatagridHead"));
|
|
16
|
-
var _layout = require("@carbon/layout");
|
|
17
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); }
|
|
18
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; }
|
|
19
20
|
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; }
|
|
@@ -49,10 +50,18 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
|
49
50
|
page = datagridState.page,
|
|
50
51
|
handleResize = datagridState.handleResize,
|
|
51
52
|
gridRef = datagridState.gridRef;
|
|
53
|
+
var handleVirtualGridResize = function handleVirtualGridResize() {
|
|
54
|
+
var gridRefElement = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current;
|
|
55
|
+
gridRefElement.style.width = gridRefElement === null || gridRefElement === void 0 ? void 0 : gridRefElement.clientWidth;
|
|
56
|
+
};
|
|
57
|
+
(0, _reactResizeDetector.useResizeDetector)({
|
|
58
|
+
onResize: handleVirtualGridResize,
|
|
59
|
+
targetRef: gridRef
|
|
60
|
+
});
|
|
52
61
|
var syncScroll = function syncScroll(e) {
|
|
53
62
|
var virtualBody = e.target;
|
|
54
|
-
document.querySelector(".".concat(blockClass, "__head-
|
|
55
|
-
var spacerColumn = document.querySelector(".".concat(blockClass, "__head-
|
|
63
|
+
document.querySelector(".".concat(blockClass, "__head-wrap")).scrollLeft = virtualBody.scrollLeft;
|
|
64
|
+
var spacerColumn = document.querySelector(".".concat(blockClass, "__head-wrap thead th:last-child"));
|
|
56
65
|
spacerColumn.style.width = (0, _layout.px)(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
|
|
57
66
|
};
|
|
58
67
|
|
|
@@ -65,7 +74,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
|
65
74
|
}
|
|
66
75
|
var visibleRows = DatagridPagination && page || rows;
|
|
67
76
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
-
className: "".concat(blockClass, "__head-
|
|
77
|
+
className: "".concat(blockClass, "__head-wrap"),
|
|
69
78
|
style: {
|
|
70
79
|
width: (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
|
|
71
80
|
overflow: 'hidden'
|
|
@@ -13,7 +13,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var _iconsReact = require("@carbon/icons-react");
|
|
14
14
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
15
15
|
var _settings = require("../../../../../settings");
|
|
16
|
-
var _excluded = ["onClick", "setIsTearsheetOpen", "isTearsheetOpen", "iconTooltipLabel"];
|
|
16
|
+
var _excluded = ["onClick", "setIsTearsheetOpen", "isTearsheetOpen", "iconTooltipLabel", "tooltipPosition"];
|
|
17
17
|
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); }
|
|
18
18
|
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; }
|
|
19
19
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
@@ -23,11 +23,13 @@ var ButtonWrapper = function ButtonWrapper(_ref) {
|
|
|
23
23
|
isTearsheetOpen = _ref.isTearsheetOpen,
|
|
24
24
|
_ref$iconTooltipLabel = _ref.iconTooltipLabel,
|
|
25
25
|
iconTooltipLabel = _ref$iconTooltipLabel === void 0 ? 'Customize columns' : _ref$iconTooltipLabel,
|
|
26
|
+
_ref$tooltipPosition = _ref.tooltipPosition,
|
|
27
|
+
tooltipPosition = _ref$tooltipPosition === void 0 ? 'bottom' : _ref$tooltipPosition,
|
|
26
28
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
27
29
|
return /*#__PURE__*/React.createElement(_carbonComponentsReact.Button, (0, _extends2.default)({}, rest, {
|
|
28
30
|
renderIcon: _iconsReact.Column16,
|
|
29
31
|
iconDescription: iconTooltipLabel,
|
|
30
|
-
tooltipPosition:
|
|
32
|
+
tooltipPosition: tooltipPosition,
|
|
31
33
|
kind: "ghost",
|
|
32
34
|
hasIconOnly: true,
|
|
33
35
|
"test-id": "".concat(blockClass, "__customize-columns-trigger"),
|
|
@@ -43,7 +45,8 @@ ButtonWrapper.propTypes = {
|
|
|
43
45
|
iconTooltipLabel: _propTypes.default.string,
|
|
44
46
|
isTearsheetOpen: _propTypes.default.bool.isRequired,
|
|
45
47
|
onClick: _propTypes.default.func.isRequired,
|
|
46
|
-
setIsTearsheetOpen: _propTypes.default.func.isRequired
|
|
48
|
+
setIsTearsheetOpen: _propTypes.default.func.isRequired,
|
|
49
|
+
tooltipPosition: _carbonComponentsReact.Button.propTypes.tooltipPosition
|
|
47
50
|
};
|
|
48
51
|
var _default = ButtonWrapper;
|
|
49
52
|
exports.default = _default;
|
|
@@ -14,9 +14,8 @@ var _reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
|
14
14
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
15
15
|
var _immutabilityHelper = _interopRequireDefault(require("immutability-helper"));
|
|
16
16
|
var _settings = require("../../../../../settings");
|
|
17
|
-
var _DraggableElement = _interopRequireDefault(require("../../DraggableElement"));
|
|
18
|
-
var _common = require("./common");
|
|
19
17
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
18
|
+
var _DraggableItemsList = require("./DraggableItemsList");
|
|
20
19
|
/**
|
|
21
20
|
* Copyright IBM Corp. 2022, 2022
|
|
22
21
|
*
|
|
@@ -43,7 +42,8 @@ var Columns = function Columns(_ref) {
|
|
|
43
42
|
onSelectColumn = _ref.onSelectColumn,
|
|
44
43
|
assistiveTextInstructionsLabel = _ref.assistiveTextInstructionsLabel,
|
|
45
44
|
assistiveTextDisabledInstructionsLabel = _ref.assistiveTextDisabledInstructionsLabel,
|
|
46
|
-
selectAllLabel = _ref.selectAllLabel
|
|
45
|
+
selectAllLabel = _ref.selectAllLabel,
|
|
46
|
+
isTableSortable = _ref.isTableSortable;
|
|
47
47
|
var _React$useState = _react.default.useState(''),
|
|
48
48
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
49
49
|
ariaRegionText = _React$useState2[0],
|
|
@@ -94,59 +94,17 @@ var Columns = function Columns(_ref) {
|
|
|
94
94
|
},
|
|
95
95
|
id: "".concat(blockClass, "__customization-column-select-all"),
|
|
96
96
|
labelText: selectAllLabel
|
|
97
|
-
})),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
disabled: isFrozenColumn,
|
|
109
|
-
onChange: onSelectColumn.bind(null, colDef),
|
|
110
|
-
id: "".concat(blockClass, "__customization-column-").concat(colDef.id),
|
|
111
|
-
labelText: colDef.Header.props.title,
|
|
112
|
-
title: colDef.Header.props.title,
|
|
113
|
-
className: "".concat(blockClass, "__customize-columns-checkbox"),
|
|
114
|
-
hideLabel: true
|
|
115
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
116
|
-
dangerouslySetInnerHTML: {
|
|
117
|
-
__html: highlightedText
|
|
118
|
-
}
|
|
119
|
-
}));
|
|
120
|
-
return /*#__PURE__*/_react.default.createElement(_DraggableElement.default, {
|
|
121
|
-
key: colDef.id,
|
|
122
|
-
index: i,
|
|
123
|
-
listData: columns,
|
|
124
|
-
setListData: setColumnsObject,
|
|
125
|
-
id: "dnd-datagrid-columns-".concat(colDef.id),
|
|
126
|
-
type: "column-customization",
|
|
127
|
-
disabled: filterString.length > 0 || isFrozenColumn,
|
|
128
|
-
ariaLabel: colDef.Header.props.title,
|
|
129
|
-
onGrab: setAriaRegionText,
|
|
130
|
-
isFocused: focusIndex === i,
|
|
131
|
-
moveElement: moveElement,
|
|
132
|
-
onArrowKeyDown: function onArrowKeyDown(e, isGrabbed, currentIndex) {
|
|
133
|
-
if (isGrabbed) {
|
|
134
|
-
var _columns$nextIndex;
|
|
135
|
-
var nextIndex = getNextIndex(columns, currentIndex, e.key);
|
|
136
|
-
e.preventDefault();
|
|
137
|
-
e.stopPropagation();
|
|
138
|
-
if (nextIndex >= 0 && !((_columns$nextIndex = columns[nextIndex]) !== null && _columns$nextIndex !== void 0 && _columns$nextIndex.sticky)) {
|
|
139
|
-
setFocusIndex(nextIndex);
|
|
140
|
-
moveElement(currentIndex, nextIndex);
|
|
141
|
-
e.target.scrollIntoView({
|
|
142
|
-
block: 'center'
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
isSticky: isFrozenColumn,
|
|
148
|
-
selected: (0, _common.isColumnVisible)(colDef)
|
|
149
|
-
}, listContents);
|
|
97
|
+
})), /*#__PURE__*/_react.default.createElement(_DraggableItemsList.DraggableItemsList, {
|
|
98
|
+
columns: columns,
|
|
99
|
+
filterString: filterString,
|
|
100
|
+
focusIndex: focusIndex,
|
|
101
|
+
getNextIndex: getNextIndex,
|
|
102
|
+
isTableSortable: isTableSortable,
|
|
103
|
+
moveElement: moveElement,
|
|
104
|
+
onSelectColumn: onSelectColumn,
|
|
105
|
+
setAriaRegionText: setAriaRegionText,
|
|
106
|
+
setColumnsObject: setColumnsObject,
|
|
107
|
+
setFocusIndex: setFocusIndex
|
|
150
108
|
}))));
|
|
151
109
|
};
|
|
152
110
|
Columns.propTypes = {
|
|
@@ -157,6 +115,7 @@ Columns.propTypes = {
|
|
|
157
115
|
filterString: _propTypes.default.string.isRequired,
|
|
158
116
|
getVisibleColumnsCount: _propTypes.default.func.isRequired,
|
|
159
117
|
instructionsLabel: _propTypes.default.string,
|
|
118
|
+
isTableSortable: _propTypes.default.bool.isRequired,
|
|
160
119
|
onSelectColumn: _propTypes.default.func.isRequired,
|
|
161
120
|
selectAllLabel: _propTypes.default.string,
|
|
162
121
|
setColumnStatus: _propTypes.default.func,
|