@carbon/ibm-products 1.31.0 → 1.32.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.
Files changed (58) hide show
  1. package/css/index-full-carbon.css +57 -5
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +57 -5
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +1 -1
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +57 -5
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +1 -1
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/DataSpreadsheet/DataSpreadsheet.js +1 -0
  14. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
  15. package/es/components/Datagrid/Datagrid/DatagridContent.js +26 -5
  16. package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
  17. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +12 -3
  18. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -4
  19. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +16 -8
  20. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +9 -1
  21. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +153 -87
  22. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +66 -0
  23. package/es/components/Datagrid/useActionsColumn.js +28 -12
  24. package/es/components/Datagrid/useExpandedRow.js +0 -1
  25. package/es/components/Datagrid/useNestedRowExpander.js +42 -0
  26. package/es/components/Datagrid/useNestedRows.js +2 -2
  27. package/es/components/Datagrid/useSelectAllToggle.js +17 -4
  28. package/es/components/Datagrid/utils/DatagridActions.js +121 -0
  29. package/es/components/Datagrid/utils/DatagridPagination.js +33 -0
  30. package/es/components/Datagrid/utils/Wrapper.js +21 -0
  31. package/es/components/Datagrid/utils/getArgTypes.js +85 -0
  32. package/es/global/js/utils/story-helper.js +5 -1
  33. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +1 -0
  34. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
  35. package/lib/components/Datagrid/Datagrid/DatagridContent.js +27 -5
  36. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
  37. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +14 -3
  38. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -4
  39. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +16 -8
  40. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +10 -7
  41. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +155 -87
  42. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +78 -0
  43. package/lib/components/Datagrid/useActionsColumn.js +28 -13
  44. package/lib/components/Datagrid/useExpandedRow.js +0 -1
  45. package/lib/components/Datagrid/useNestedRowExpander.js +57 -0
  46. package/lib/components/Datagrid/useNestedRows.js +3 -3
  47. package/lib/components/Datagrid/useSelectAllToggle.js +18 -4
  48. package/lib/components/Datagrid/utils/DatagridActions.js +139 -0
  49. package/lib/components/Datagrid/utils/DatagridPagination.js +46 -0
  50. package/lib/components/Datagrid/utils/Wrapper.js +33 -0
  51. package/lib/components/Datagrid/utils/getArgTypes.js +93 -0
  52. package/lib/global/js/utils/story-helper.js +5 -1
  53. package/package.json +2 -2
  54. package/scss/components/Datagrid/styles/_datagrid.scss +0 -4
  55. package/scss/components/Datagrid/styles/_useActionsColumn.scss +12 -0
  56. package/scss/components/Datagrid/styles/_useExpandedRow.scss +30 -0
  57. package/scss/components/Datagrid/styles/_useNestedRows.scss +15 -1
  58. package/scss/components/Datagrid/styles/_useStickyColumn.scss +6 -0
@@ -0,0 +1,42 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+
4
+ /* eslint-disable react/prop-types */
5
+
6
+ /*
7
+ * Licensed Materials - Property of IBM
8
+ * 5724-Q36
9
+ * (c) Copyright IBM Corp. 2020
10
+ * US Government Users Restricted Rights - Use, duplication or disclosure
11
+ * restricted by GSA ADP Schedule Contract with IBM Corp.
12
+ */
13
+ import React from 'react';
14
+ import { ChevronRight16 } from '@carbon/icons-react';
15
+ import cx from 'classnames';
16
+ import { pkg } from '../../settings';
17
+ var blockClass = "".concat(pkg.prefix, "--datagrid");
18
+
19
+ var useNestedRowExpander = function useNestedRowExpander(hooks) {
20
+ var visibleColumns = function visibleColumns(columns) {
21
+ var expanderColumn = {
22
+ id: 'expander',
23
+ Cell: function Cell(_ref) {
24
+ var _cx;
25
+
26
+ var row = _ref.row;
27
+ return row.canExpand && /*#__PURE__*/React.createElement("span", row.getToggleRowExpandedProps(), /*#__PURE__*/React.createElement(ChevronRight16, {
28
+ className: cx("".concat(blockClass, "__expander-icon"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__expander-icon--not-open"), !row.isExpanded), _defineProperty(_cx, "".concat(blockClass, "__expander-icon--open"), row.isExpanded), _cx))
29
+ }));
30
+ },
31
+ width: 48,
32
+ disableResizing: true,
33
+ disableSortBy: true,
34
+ Header: ''
35
+ };
36
+ return [expanderColumn].concat(_toConsumableArray(columns));
37
+ };
38
+
39
+ hooks.visibleColumns.push(visibleColumns);
40
+ };
41
+
42
+ export default useNestedRowExpander;
@@ -5,12 +5,12 @@
5
5
  * US Government Users Restricted Rights - Use, duplication or disclosure
6
6
  * restricted by GSA ADP Schedule Contract with IBM Corp.
7
7
  */
8
- import useRowExpander from './useRowExpander';
9
8
  import { pkg } from '../../settings';
9
+ import useNestedRowExpander from './useNestedRowExpander';
10
10
  var blockClass = "".concat(pkg.prefix, "--datagrid");
11
11
 
12
12
  var useNestedRows = function useNestedRows(hooks) {
13
- useRowExpander(hooks);
13
+ useNestedRowExpander(hooks);
14
14
  var marginLeft = 24;
15
15
 
16
16
  var getRowProps = function getRowProps(props, _ref) {
@@ -1,3 +1,5 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
1
3
  /*
2
4
  * Licensed Materials - Property of IBM
3
5
  * 5724-Q36
@@ -7,6 +9,7 @@
7
9
  */
8
10
  // @flow
9
11
  import React from 'react';
12
+ import cx from 'classnames';
10
13
  import { selectionColumnId } from './common-column-ids';
11
14
  import SelectAllWithToggle from './Datagrid/DatagridSelectAllWithToggle';
12
15
  import { pkg } from '../../settings';
@@ -40,12 +43,18 @@ var useSelectAllWithToggleComponent = function useSelectAllWithToggleComponent(h
40
43
 
41
44
  var useAddClassNameToSelectRow = function useAddClassNameToSelectRow(hooks) {
42
45
  hooks.getCellProps.push(function (props, data) {
46
+ var _columns$;
47
+
43
48
  var column = data.cell.column;
44
- var DatagridPagination = data.instance.DatagridPagination;
49
+ var _data$instance = data.instance,
50
+ DatagridPagination = _data$instance.DatagridPagination,
51
+ columns = _data$instance.columns,
52
+ withStickyColumn = _data$instance.withStickyColumn;
53
+ var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
45
54
 
46
55
  if (column.id === selectionColumnId && DatagridPagination) {
47
56
  return [props, {
48
- className: "".concat(blockClass, "__select-all-toggle-on")
57
+ className: cx("".concat(blockClass, "__select-all-toggle-on"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), isFirstColumnStickyLeft))
49
58
  }];
50
59
  }
51
60
 
@@ -59,14 +68,18 @@ var Header = function Header(gridState) {
59
68
  selectAllToggle = gridState.selectAllToggle,
60
69
  getToggleAllPageRowsSelectedProps = gridState.getToggleAllPageRowsSelectedProps,
61
70
  getToggleAllRowsSelectedProps = gridState.getToggleAllRowsSelectedProps,
62
- isAllRowsSelected = gridState.isAllRowsSelected;
71
+ isAllRowsSelected = gridState.isAllRowsSelected,
72
+ withStickyColumn = gridState.withStickyColumn,
73
+ columns = gridState.columns;
63
74
  var props = {
64
75
  tableId: tableId,
65
76
  isFetching: isFetching,
66
77
  selectAllToggle: selectAllToggle,
67
78
  getToggleAllPageRowsSelectedProps: getToggleAllPageRowsSelectedProps,
68
79
  getToggleAllRowsSelectedProps: getToggleAllRowsSelectedProps,
69
- isAllRowsSelected: isAllRowsSelected
80
+ isAllRowsSelected: isAllRowsSelected,
81
+ withStickyColumn: withStickyColumn,
82
+ columns: columns
70
83
  };
71
84
  return /*#__PURE__*/React.createElement(SelectAllWithToggle, props);
72
85
  };
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2022
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ import { DataTable, Button } from 'carbon-components-react';
9
+ import { Download16, Filter16, Add16, Restart16 } from '@carbon/icons-react';
10
+ import { action } from '@storybook/addon-actions';
11
+ import { pkg } from '../../../settings';
12
+ import { ButtonMenu, ButtonMenuItem } from '../../ButtonMenu';
13
+ var blockClass = "".concat(pkg.prefix, "--datagrid");
14
+ export var DatagridActions = function DatagridActions(datagridState) {
15
+ var selectedFlatRows = datagridState.selectedFlatRows,
16
+ setGlobalFilter = datagridState.setGlobalFilter,
17
+ CustomizeColumnsButton = datagridState.CustomizeColumnsButton,
18
+ RowSizeDropdown = datagridState.RowSizeDropdown,
19
+ rowSizeDropdownProps = datagridState.rowSizeDropdownProps,
20
+ useDenseHeader = datagridState.useDenseHeader;
21
+
22
+ var downloadCsv = function downloadCsv() {
23
+ alert('Downloading...');
24
+ };
25
+
26
+ var TableToolbarContent = DataTable.TableToolbarContent,
27
+ TableToolbarSearch = DataTable.TableToolbarSearch;
28
+
29
+ var refreshColumns = function refreshColumns() {
30
+ alert('refreshing...');
31
+ };
32
+
33
+ var leftPanelClick = function leftPanelClick() {
34
+ alert('open/close left panel...');
35
+ };
36
+
37
+ var searchForAColumn = 'Search';
38
+ var isNothingSelected = selectedFlatRows.length === 0;
39
+ var style = {
40
+ 'button:nth-child(1) > span:nth-child(1)': {
41
+ bottom: '-37px'
42
+ }
43
+ };
44
+ return isNothingSelected && (useDenseHeader && useDenseHeader ? /*#__PURE__*/React.createElement(TableToolbarContent, {
45
+ size: "sm"
46
+ }, /*#__PURE__*/React.createElement("div", {
47
+ style: style
48
+ }, /*#__PURE__*/React.createElement(Button, {
49
+ kind: "ghost",
50
+ hasIconOnly: true,
51
+ tooltipPosition: "bottom",
52
+ renderIcon: Download16,
53
+ iconDescription: 'Download CSV',
54
+ onClick: downloadCsv
55
+ })), /*#__PURE__*/React.createElement("div", {
56
+ style: style
57
+ }, /*#__PURE__*/React.createElement(Button, {
58
+ kind: "ghost",
59
+ hasIconOnly: true,
60
+ tooltipPosition: "bottom",
61
+ renderIcon: Filter16,
62
+ iconDescription: 'Left panel',
63
+ onClick: leftPanelClick
64
+ })), /*#__PURE__*/React.createElement(RowSizeDropdown, rowSizeDropdownProps), /*#__PURE__*/React.createElement("div", {
65
+ style: style,
66
+ className: "".concat(blockClass, "__toolbar-divider")
67
+ }, /*#__PURE__*/React.createElement(Button, {
68
+ kind: "ghost",
69
+ renderIcon: Add16,
70
+ iconDescription: 'Action'
71
+ }, "Ghost button")), CustomizeColumnsButton && /*#__PURE__*/React.createElement("div", {
72
+ style: style
73
+ }, /*#__PURE__*/React.createElement(CustomizeColumnsButton, null))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
74
+ kind: "ghost",
75
+ hasIconOnly: true,
76
+ tooltipPosition: "bottom",
77
+ renderIcon: Filter16,
78
+ iconDescription: 'Left panel',
79
+ onClick: leftPanelClick
80
+ }), /*#__PURE__*/React.createElement(TableToolbarContent, null, /*#__PURE__*/React.createElement(TableToolbarSearch, {
81
+ size: "xl",
82
+ id: "columnSearch",
83
+ persistent: true,
84
+ placeHolderText: searchForAColumn,
85
+ onChange: function onChange(e) {
86
+ return setGlobalFilter(e.target.value);
87
+ }
88
+ }), /*#__PURE__*/React.createElement(RowSizeDropdown, rowSizeDropdownProps), /*#__PURE__*/React.createElement("div", {
89
+ style: style
90
+ }, /*#__PURE__*/React.createElement(Button, {
91
+ kind: "ghost",
92
+ hasIconOnly: true,
93
+ tooltipPosition: "bottom",
94
+ renderIcon: Restart16,
95
+ iconDescription: 'Refresh',
96
+ onClick: refreshColumns
97
+ })), /*#__PURE__*/React.createElement("div", {
98
+ style: style
99
+ }, /*#__PURE__*/React.createElement(Button, {
100
+ kind: "ghost",
101
+ hasIconOnly: true,
102
+ tooltipPosition: "bottom",
103
+ renderIcon: Download16,
104
+ iconDescription: 'Download CSV',
105
+ onClick: downloadCsv
106
+ })), CustomizeColumnsButton && /*#__PURE__*/React.createElement("div", {
107
+ style: style
108
+ }, /*#__PURE__*/React.createElement(CustomizeColumnsButton, null)), /*#__PURE__*/React.createElement(ButtonMenu, {
109
+ label: "Primary button",
110
+ renderIcon: Add16
111
+ }, /*#__PURE__*/React.createElement(ButtonMenuItem, {
112
+ itemText: "Option 1",
113
+ onClick: action("Click on ButtonMenu Option 1")
114
+ }), /*#__PURE__*/React.createElement(ButtonMenuItem, {
115
+ itemText: "Option 2",
116
+ onClick: action("Click on ButtonMenu Option 2")
117
+ }), /*#__PURE__*/React.createElement(ButtonMenuItem, {
118
+ itemText: "Option 3",
119
+ onClick: action("Click on ButtonMenu Option 3")
120
+ })))));
121
+ };
@@ -0,0 +1,33 @@
1
+ /* eslint-disable react/prop-types */
2
+
3
+ /**
4
+ * Copyright IBM Corp. 2022, 2022
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ import React from 'react';
10
+ import { Pagination } from 'carbon-components-react';
11
+ export var DatagridPagination = function DatagridPagination(_ref) {
12
+ var state = _ref.state,
13
+ setPageSize = _ref.setPageSize,
14
+ gotoPage = _ref.gotoPage,
15
+ rows = _ref.rows;
16
+
17
+ var updatePagination = function updatePagination(_ref2) {
18
+ var page = _ref2.page,
19
+ pageSize = _ref2.pageSize;
20
+ console.log(state);
21
+ setPageSize(pageSize);
22
+ gotoPage(page - 1); // Carbon is non-zero-based
23
+ };
24
+
25
+ return /*#__PURE__*/React.createElement(Pagination, {
26
+ page: state.pageIndex + 1 // react-table is zero-based
27
+ ,
28
+ pageSize: state.pageSize,
29
+ pageSizes: state.pageSizes || [10, 20, 30, 40, 50],
30
+ totalItems: rows.length,
31
+ onChange: updatePagination
32
+ });
33
+ };
@@ -0,0 +1,21 @@
1
+ /* eslint-disable react/prop-types */
2
+
3
+ /**
4
+ * Copyright IBM Corp. 2020, 2022
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ import React from 'react';
10
+ export var Wrapper = function Wrapper(_ref) {
11
+ var children = _ref.children;
12
+ return /*#__PURE__*/React.createElement("div", {
13
+ style: {
14
+ height: '100vh',
15
+ width: '100%',
16
+ padding: '1rem',
17
+ margin: '0',
18
+ zIndex: '0'
19
+ }
20
+ }, children);
21
+ };
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2022
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ export var ARG_TYPES = {
8
+ gridTitle: {
9
+ name: 'gridTitle',
10
+ control: 'text',
11
+ description: 'This sets the title text for the Datagrid component. _This value is set/passed inside of the `datagridState` object._',
12
+ type: {
13
+ name: 'string',
14
+ required: false
15
+ }
16
+ },
17
+ gridDescription: {
18
+ name: 'gridDescription',
19
+ control: 'text',
20
+ description: 'This sets the description text for the Datagrid component. _This value is set/passed inside of the `datagridState` object._',
21
+ type: {
22
+ name: 'string',
23
+ required: false
24
+ }
25
+ },
26
+ emptyStateTitle: {
27
+ name: 'emptyStateTitle',
28
+ control: 'text',
29
+ description: 'This sets the empty state title text for the Datagrid component. _This value is set/passed inside of the `datagridState` object._',
30
+ type: {
31
+ name: 'string',
32
+ required: false
33
+ }
34
+ },
35
+ emptyStateDescription: {
36
+ name: 'emptyStateDescription',
37
+ control: 'text',
38
+ description: 'This sets the empty state description text for the Datagrid component. _This value is set/passed inside of the `datagridState` object._',
39
+ type: {
40
+ name: 'string',
41
+ required: false
42
+ }
43
+ },
44
+ emptyStateSize: {
45
+ control: 'select',
46
+ options: ['sm', 'lg']
47
+ },
48
+ useDenseHeader: {
49
+ control: {
50
+ type: 'radio'
51
+ },
52
+ options: [true, false],
53
+ description: 'This sets the dense header option for the Datagrid component. _This value is set/passed inside of the `datagridState` object._'
54
+ },
55
+ rowSize: {
56
+ control: 'select',
57
+ options: ['xs', 'sm', 'md', 'lg', 'xl'],
58
+ description: 'This sets the height for each row of the Datagrid component. _This value is set/passed inside of the `datagridState` object._'
59
+ },
60
+ rowSizes: {
61
+ control: 'object',
62
+ description: 'This array of objects specifies the different row size options that will render from the settings icon in the table actions. _This value is set/passed inside of the `datagridState` object._'
63
+ },
64
+ onRowSizeChange: {
65
+ description: 'Callback function that is called on row size changes. _This value is set/passed inside of the `datagridState` object._'
66
+ },
67
+ rowActions: {
68
+ control: 'object',
69
+ description: 'This array of objects renders the action buttons for each row in the Datagrid. _This value is set/passed inside of the `datagridState` object._',
70
+ action: 'Row action onClick'
71
+ },
72
+ batchActions: {
73
+ control: {
74
+ type: 'radio'
75
+ },
76
+ options: [true, false],
77
+ description: 'This will allow the Datagrid component to use batch actions. _This value is set/passed inside of the `datagridState` object._'
78
+ },
79
+ expandedContentHeight: {
80
+ control: {
81
+ type: 'number'
82
+ },
83
+ description: 'This value controls the height of the expanded content area. _This value is set/passed inside of the `datagridState` object._'
84
+ }
85
+ };
@@ -29,7 +29,11 @@ export var getStoryTitle = function getStoryTitle(componentName) {
29
29
  * @returns The story id.
30
30
  */
31
31
 
32
- export var getStoryId = function getStoryId(componentName, scenario) {
32
+ export var getStoryId = function getStoryId(componentName, scenario, subdirectory) {
33
+ if (subdirectory) {
34
+ return "".concat(sanitize(getStoryTitle(componentName)), "-").concat(sanitize(subdirectory), "--").concat(scenario);
35
+ }
36
+
33
37
  return "".concat(sanitize(getStoryTitle(componentName)), "--").concat(scenario);
34
38
  };
35
39
  /**
@@ -897,6 +897,7 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
897
897
  className: (0, _classnames.default)("".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__active-cell--highlight"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__active-cell--with-selection"), activeCellInsideSelectionArea)),
898
898
  type: "button"
899
899
  }, activeCellContent), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.TextArea, {
900
+ id: "".concat(blockClass, "__cell-editor-text-area"),
900
901
  value: cellEditorValue,
901
902
  onKeyDown: (0, _handleEditSubmit.handleEditSubmit)({
902
903
  activeCellCoordinates: activeCellCoordinates,
@@ -411,7 +411,8 @@ var DataSpreadsheetBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
411
411
  }), {
412
412
  className: (0, _classnames.default)("".concat(blockClass, "__tr")),
413
413
  "data-row-index": index,
414
- "aria-rowindex": index + 1
414
+ "aria-rowindex": index + 1,
415
+ "aria-owns": "".concat(blockClass, "__cell-editor-text-area")
415
416
  }), /*#__PURE__*/_react.default.createElement("div", {
416
417
  role: "rowheader",
417
418
  className: "".concat(blockClass, "__td-th--cell-container")
@@ -37,6 +37,8 @@ var _handleGridFocus = require("./addons/InlineEdit/handleGridFocus");
37
37
 
38
38
  var _hooks = require("../../../global/js/hooks");
39
39
 
40
+ var _hooks2 = require("../../DataSpreadsheet/hooks");
41
+
40
42
  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); }
41
43
 
42
44
  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; }
@@ -71,8 +73,10 @@ var DatagridContent = function DatagridContent(_ref) {
71
73
  useDenseHeader = datagridState.useDenseHeader,
72
74
  withInlineEdit = datagridState.withInlineEdit;
73
75
  var rows = DatagridPagination && datagridState.page || datagridState.rows;
74
- var gridActive = state.gridActive;
76
+ var gridActive = state.gridActive,
77
+ editId = state.editId;
75
78
  var gridAreaRef = (0, _react.useRef)();
79
+ var multiKeyTrackingRef = (0, _react.useRef)();
76
80
  (0, _hooks.useClickOutside)(gridAreaRef, function (target) {
77
81
  if (!withInlineEdit) {
78
82
  return;
@@ -90,6 +94,15 @@ var DatagridContent = function DatagridContent(_ref) {
90
94
  payload: activeCellId
91
95
  });
92
96
  });
97
+
98
+ var _useMultipleKeyTracki = (0, _hooks2.useMultipleKeyTracking)({
99
+ ref: multiKeyTrackingRef,
100
+ containerHasFocus: gridActive,
101
+ isEditing: !!editId
102
+ }),
103
+ keysPressedList = _useMultipleKeyTracki.keysPressedList,
104
+ usingMac = _useMultipleKeyTracki.usingMac;
105
+
93
106
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TableContainer, {
94
107
  className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : ''),
95
108
  title: gridTitle,
@@ -99,19 +112,28 @@ var DatagridContent = function DatagridContent(_ref) {
99
112
  ref: gridAreaRef
100
113
  }, leftPanel && leftPanel.isOpen && /*#__PURE__*/_react.default.createElement("div", {
101
114
  className: "".concat(blockClass, "__datagridLeftPanel")
102
- }, leftPanel.panelContent), /*#__PURE__*/_react.default.createElement(Table, (0, _extends2.default)({}, getTableProps(), {
115
+ }, leftPanel.panelContent), /*#__PURE__*/_react.default.createElement("div", {
116
+ ref: multiKeyTrackingRef
117
+ }, /*#__PURE__*/_react.default.createElement(Table, (0, _extends2.default)({}, getTableProps(), {
103
118
  className: (0, _classnames.default)(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-grid-active"), gridActive), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
104
119
  role: withInlineEdit && 'grid',
105
120
  tabIndex: withInlineEdit && 0,
106
121
  onKeyDown: withInlineEdit ? function (event) {
107
- return (0, _handleGridKeyPress.handleGridKeyPress)(event, dispatch, state, datagridState);
122
+ return (0, _handleGridKeyPress.handleGridKeyPress)({
123
+ event: event,
124
+ dispatch: dispatch,
125
+ state: state,
126
+ instance: datagridState,
127
+ keysPressedList: keysPressedList,
128
+ usingMac: usingMac
129
+ });
108
130
  } : null,
109
131
  onFocus: withInlineEdit ? function () {
110
132
  return (0, _handleGridFocus.handleGridFocus)(state, dispatch);
111
133
  } : null
112
134
  }), /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState), /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
113
135
  rows: rows
114
- }))))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/_react.default.createElement(CustomizeColumnsModal, {
136
+ })))))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/_react.default.createElement(CustomizeColumnsModal, {
115
137
  instance: datagridState
116
138
  }));
117
139
  };
@@ -121,7 +143,7 @@ DatagridContent.propTypes = {
121
143
  datagridState: _propTypes.default.shape({
122
144
  getTableProps: _propTypes.default.func,
123
145
  withVirtualScroll: _propTypes.default.bool,
124
- DatagridPagination: _propTypes.default.element,
146
+ DatagridPagination: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
125
147
  CustomizeColumnsModal: _propTypes.default.element,
126
148
  isFetching: _propTypes.default.bool,
127
149
  leftPanel: _propTypes.default.object,
@@ -24,13 +24,21 @@ var DatagridExpandedRow = function DatagridExpandedRow(PreviousRowRenderer, Expa
24
24
  return function (datagridState) {
25
25
  var row = datagridState.row;
26
26
 
27
+ var _ref = row || {},
28
+ expandedContentHeight = _ref.expandedContentHeight;
29
+
27
30
  if (!row.isExpanded) {
28
31
  return PreviousRowRenderer(datagridState);
29
32
  }
30
33
 
31
34
  return /*#__PURE__*/_react.default.createElement("div", {
32
35
  className: "".concat(blockClass, "__expanded-row")
33
- }, PreviousRowRenderer(datagridState), ExpandedRowContentComponent(datagridState));
36
+ }, PreviousRowRenderer(datagridState), /*#__PURE__*/_react.default.createElement("div", {
37
+ className: "".concat(blockClass, "__expanded-row-content"),
38
+ style: {
39
+ height: expandedContentHeight ? expandedContentHeight : null
40
+ }
41
+ }, ExpandedRowContentComponent(datagridState)));
34
42
  };
35
43
  };
36
44
 
@@ -11,6 +11,8 @@ exports.default = void 0;
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+
14
16
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
17
 
16
18
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -19,6 +21,8 @@ var _react = _interopRequireWildcard(require("react"));
19
21
 
20
22
  var _propTypes = _interopRequireDefault(require("prop-types"));
21
23
 
24
+ var _classnames = _interopRequireDefault(require("classnames"));
25
+
22
26
  var _carbonComponentsReact = require("carbon-components-react");
23
27
 
24
28
  var _iconsReact = require("@carbon/icons-react");
@@ -37,6 +41,8 @@ var SELECT_ALL_PAGE_ROWS = 'pageRows';
37
41
  var SELECT_ALL_ROWS = 'allRows';
38
42
 
39
43
  var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
44
+ var _columns$;
45
+
40
46
  var tableId = _ref.tableId,
41
47
  isFetching = _ref.isFetching,
42
48
  isAllRowsSelected = _ref.isAllRowsSelected,
@@ -46,7 +52,9 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
46
52
  _ref$allPageRowsLabel = _ref.allPageRowsLabel,
47
53
  allPageRowsLabel = _ref$allPageRowsLabel === void 0 ? 'Select all on page' : _ref$allPageRowsLabel,
48
54
  _ref$allRowsLabel = _ref.allRowsLabel,
49
- allRowsLabel = _ref$allRowsLabel === void 0 ? 'Select all' : _ref$allRowsLabel;
55
+ allRowsLabel = _ref$allRowsLabel === void 0 ? 'Select all' : _ref$allRowsLabel,
56
+ columns = _ref.columns,
57
+ withStickyColumn = _ref.withStickyColumn;
50
58
 
51
59
  var _useState = (0, _react.useState)(SELECT_ALL_PAGE_ROWS),
52
60
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -75,10 +83,11 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
75
83
  selectProps = (0, _objectWithoutProperties2.default)(_getProps, _excluded);
76
84
 
77
85
  var disabled = isFetching || selectProps.disabled;
86
+ var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
78
87
  return /*#__PURE__*/_react.default.createElement("th", {
79
88
  role: "columnheader",
80
89
  scope: "col",
81
- className: "".concat(blockClass, "__select-all-toggle-on")
90
+ className: (0, _classnames.default)("".concat(blockClass, "__select-all-toggle-on"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__select-all-sticky-left"), isFirstColumnStickyLeft))
82
91
  }, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, (0, _extends2.default)({}, selectProps, {
83
92
  name: "".concat(tableId, "-select-all-checkbox-name"),
84
93
  onClick: function onClick(e) {
@@ -126,12 +135,14 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
126
135
  SelectAllWithToggle.propTypes = {
127
136
  allPageRowsLabel: _propTypes.default.string,
128
137
  allRowsLabel: _propTypes.default.string,
138
+ columns: _propTypes.default.arrayOf(_propTypes.default.object),
129
139
  getToggleAllPageRowsSelectedProps: _propTypes.default.func.isRequired,
130
140
  getToggleAllRowsSelectedProps: _propTypes.default.func.isRequired,
131
141
  isAllRowsSelected: _propTypes.default.bool.isRequired,
132
142
  isFetching: _propTypes.default.bool,
133
143
  selectAllToggle: _propTypes.default.object,
134
- tableId: _propTypes.default.string.isRequired
144
+ tableId: _propTypes.default.string.isRequired,
145
+ withStickyColumn: _propTypes.default.bool
135
146
  };
136
147
  var _default = SelectAllWithToggle;
137
148
  exports.default = _default;
@@ -34,8 +34,6 @@ var InlineEditButton = function InlineEditButton(_ref) {
34
34
  disabled = _ref.disabled,
35
35
  LabelIcon = _ref.labelIcon,
36
36
  placeholder = _ref.placeholder,
37
- _ref$tabIndex = _ref.tabIndex,
38
- tabIndex = _ref$tabIndex === void 0 ? -1 : _ref$tabIndex,
39
37
  nonEditCell = _ref.nonEditCell,
40
38
  isActiveCell = _ref.isActiveCell,
41
39
  columnConfig = _ref.columnConfig,
@@ -45,7 +43,7 @@ var InlineEditButton = function InlineEditButton(_ref) {
45
43
  var inlineEditColsLessThanHalfOfTotal = totalInlineEditColumns < totalColumns / 2;
46
44
  return /*#__PURE__*/_react.default.createElement("div", {
47
45
  className: (0, _classnames.default)("".concat(blockClass, "__inline-edit-button"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--disabled"), disabled || nonEditCell), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--with-label-icon"), LabelIcon), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--non-edit"), nonEditCell), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--active"), isActiveCell), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--edit-less-than-half-of-total-cols"), inlineEditColsLessThanHalfOfTotal), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--").concat(type), type === 'date' || type === 'selection'), _cx)),
48
- tabIndex: tabIndex,
46
+ tabIndex: isActiveCell ? 0 : -1,
49
47
  "data-disabled": disabled || nonEditCell,
50
48
  "aria-disabled": disabled || nonEditCell,
51
49
  role: "button",
@@ -71,7 +69,6 @@ InlineEditButton.propTypes = {
71
69
  nonEditCell: _propTypes.default.bool,
72
70
  placeholder: _propTypes.default.string,
73
71
  renderIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
74
- tabIndex: _propTypes.default.number,
75
72
  totalColumns: _propTypes.default.number,
76
73
  totalInlineEditColumns: _propTypes.default.number,
77
74
  type: _propTypes.default.oneOf(['text', 'number', 'selection', 'date']),