@carbon/ibm-products 2.42.1-canary.8 → 2.43.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  2. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +1 -1
  3. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +0 -5
  4. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -4
  5. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +7 -1
  6. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +1 -0
  7. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -2
  8. package/es/components/Datagrid/types/index.d.ts +2 -0
  9. package/es/components/Datagrid/useColumnOrder.d.ts +7 -1
  10. package/es/components/Datagrid/useFiltering.d.ts +8 -1
  11. package/es/components/Datagrid/useFiltering.js +8 -7
  12. package/es/components/Datagrid/useFlexResize.d.ts +1 -1
  13. package/es/components/Datagrid/useFlexResize.js +11 -11
  14. package/es/components/Datagrid/useNestedRows.js +24 -2
  15. package/es/components/Datagrid/useOnRowClick.d.ts +8 -1
  16. package/es/components/Datagrid/useOnRowClick.js +2 -1
  17. package/es/components/Datagrid/useRowIsMouseOver.d.ts +2 -1
  18. package/es/components/Datagrid/useRowIsMouseOver.js +1 -1
  19. package/es/components/Datagrid/useSelectRows.d.ts +8 -1
  20. package/es/components/Datagrid/useSelectRows.js +3 -2
  21. package/es/components/Datagrid/useSortableColumns.d.ts +10 -3
  22. package/es/components/Datagrid/useSortableColumns.js +3 -2
  23. package/es/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +8 -1
  24. package/es/components/Datagrid/utils/getAutoSizedColumnWidth.js +0 -7
  25. package/es/components/SidePanel/SidePanel.js +4 -2
  26. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  27. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +1 -1
  28. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +0 -5
  29. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -4
  30. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.d.ts +7 -1
  31. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.d.ts +1 -0
  32. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -2
  33. package/lib/components/Datagrid/types/index.d.ts +2 -0
  34. package/lib/components/Datagrid/useColumnOrder.d.ts +7 -1
  35. package/lib/components/Datagrid/useFiltering.d.ts +8 -1
  36. package/lib/components/Datagrid/useFiltering.js +8 -7
  37. package/lib/components/Datagrid/useFlexResize.d.ts +1 -1
  38. package/lib/components/Datagrid/useFlexResize.js +11 -11
  39. package/lib/components/Datagrid/useNestedRows.js +24 -2
  40. package/lib/components/Datagrid/useOnRowClick.d.ts +8 -1
  41. package/lib/components/Datagrid/useOnRowClick.js +2 -1
  42. package/lib/components/Datagrid/useRowIsMouseOver.d.ts +2 -1
  43. package/lib/components/Datagrid/useRowIsMouseOver.js +1 -1
  44. package/lib/components/Datagrid/useSelectRows.d.ts +8 -1
  45. package/lib/components/Datagrid/useSelectRows.js +3 -2
  46. package/lib/components/Datagrid/useSortableColumns.d.ts +10 -3
  47. package/lib/components/Datagrid/useSortableColumns.js +3 -2
  48. package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.d.ts +8 -1
  49. package/lib/components/Datagrid/utils/getAutoSizedColumnWidth.js +0 -7
  50. package/lib/components/SidePanel/SidePanel.js +4 -2
  51. package/package.json +3 -3
  52. package/telemetry.yml +23 -0
@@ -185,7 +185,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
185
185
  headerProps = _extends({}, (_objectDestructuringEmpty(_header$getHeaderProp), _header$getHeaderProp));
186
186
  var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
187
187
  return /*#__PURE__*/React__default.createElement(TableHeader, _extends({}, headerProps, {
188
- className: cx(header === null || header === void 0 ? void 0 : header.className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default.isValidElement(header === null || header === void 0 ? void 0 : header.slug))),
188
+ className: cx(header === null || header === void 0 ? void 0 : header.className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default.isValidElement(header === null || header === void 0 ? void 0 : header.slug)), headerProps.className),
189
189
  key: header.id,
190
190
  "aria-hidden": header.id === 'spacer' && 'true'
191
191
  }, getAccessibilityProps(header)), header.render('Header'), renderSlug(header.slug), resizerProps && !header.isAction && /*#__PURE__*/React__default.createElement(ResizeHeader, {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2020, 2023
2
+ * Copyright IBM Corp. 2020, 2024
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -11,7 +11,6 @@ import { VariableSizeList } from 'react-window';
11
11
  import { TableBody } from '@carbon/react';
12
12
  import { pkg } from '../../../settings.js';
13
13
  import DatagridHead from './DatagridHead.js';
14
- import { px } from '@carbon/layout';
15
14
  import { useResizeObserver } from '../../../global/js/hooks/useResizeObserver.js';
16
15
 
17
16
  var blockClass = "".concat(pkg.prefix, "--datagrid");
@@ -72,10 +71,6 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
72
71
  if (headWrapEl) {
73
72
  headWrapEl.scrollLeft = virtualBody === null || virtualBody === void 0 ? void 0 : virtualBody.scrollLeft;
74
73
  }
75
- var spacerColumn = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap thead th:last-child"));
76
- if (spacerColumn) {
77
- spacerColumn.style.width = px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
78
- }
79
74
  }
80
75
  var testRefValue = testRef === null || testRef === void 0 ? void 0 : testRef.current;
81
76
  testRefValue === null || testRefValue === void 0 || testRefValue.addEventListener('scroll', handleScroll);
@@ -74,7 +74,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
74
74
  };
75
75
  var onCheckboxCheck = function onCheckboxCheck(col, value) {
76
76
  var changedDefinitions = columnObjects.map(function (definition) {
77
- if (Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) {
77
+ if ((Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) && definition.canFilter && !definition.disabled) {
78
78
  return _objectSpread2(_objectSpread2({}, definition), {}, {
79
79
  isVisible: value
80
80
  });
@@ -98,9 +98,12 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
98
98
  useEffect(function () {
99
99
  var notFilterableCount = columnObjects.filter(function (col) {
100
100
  return !col.canFilter;
101
- });
102
- setVisibleColumnsCount(getVisibleColumnsCount() - notFilterableCount.length);
103
- setTotalColumns(columnObjects.length - notFilterableCount.length);
101
+ }).length;
102
+ var actionCount = columnObjects.filter(function (col) {
103
+ return col.id === 'actions';
104
+ }).length;
105
+ setVisibleColumnsCount(getVisibleColumnsCount() - notFilterableCount - actionCount);
106
+ setTotalColumns(columnObjects.length - notFilterableCount - actionCount);
104
107
  }, [getVisibleColumnsCount, columnObjects]);
105
108
  return /*#__PURE__*/React__default.createElement(TearsheetNarrow, {
106
109
  className: "".concat(blockClass, "__customize-columns-tearsheet"),
@@ -1,2 +1,8 @@
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2024
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
+ declare const useFilterContext: () => any;
1
8
  export default useFilterContext;
2
- declare function useFilterContext(): any;
@@ -20,6 +20,7 @@ export namespace InlineEditCell {
20
20
  rows: PropTypes.Requireable<(object | null | undefined)[]>;
21
21
  rowSize: PropTypes.Requireable<string>;
22
22
  tableId: PropTypes.Requireable<string>;
23
+ cellEditing: PropTypes.Requireable<object>;
23
24
  }>>;
24
25
  let nonEditCell: PropTypes.Requireable<boolean>;
25
26
  let placeholder: PropTypes.Requireable<string>;
@@ -36,7 +36,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
36
36
  var columnIndex = instance.columns.findIndex(function (col) {
37
37
  return col.id === columnId;
38
38
  });
39
- var cellId = "column-".concat(columnIndex, "-row-").concat(cell.row.index);
39
+ var rowIndex = cell.row.index;
40
+ var cellId = "column-".concat(columnIndex, "-row-").concat(rowIndex);
40
41
  var _useContext = useContext(InlineEditContext),
41
42
  state = _useContext.state,
42
43
  dispatch = _useContext.dispatch;
@@ -72,6 +73,14 @@ var InlineEditCell = function InlineEditCell(_ref) {
72
73
  var rowSize = instance.rowSize,
73
74
  onDataUpdate = instance.onDataUpdate;
74
75
  var saveCellData;
76
+ if (inEditMode) {
77
+ instance.cellEditing = {
78
+ cellId: cellId,
79
+ columnIndex: columnIndex,
80
+ rowIndex: rowIndex,
81
+ curCellValue: cellValue
82
+ };
83
+ }
75
84
  useEffect(function () {
76
85
  setInitialValue(value);
77
86
  var columnId = cell.column.id;
@@ -469,7 +478,8 @@ InlineEditCell.propTypes = {
469
478
  onDataUpdate: PropTypes.func,
470
479
  rows: PropTypes.arrayOf(PropTypes.object),
471
480
  rowSize: PropTypes.string,
472
- tableId: PropTypes.string
481
+ tableId: PropTypes.string,
482
+ cellEditing: PropTypes.object
473
483
  }),
474
484
  nonEditCell: PropTypes.bool,
475
485
  placeholder: PropTypes.string,
@@ -192,6 +192,8 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
192
192
  onVirtualScroll?: (evt?: boolean) => void;
193
193
  fetchMoreData?: () => void;
194
194
  loadMoreThreshold?: number;
195
+ onRowClick?: (row: any, event: any) => void;
196
+ onSort?: boolean;
195
197
  }
196
198
  export interface ResizeHeaderProps {
197
199
  resizerProps?: ResizerProps;
@@ -1,2 +1,8 @@
1
- export default useColumnOrder;
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
+ */
2
7
  import { useColumnOrder } from 'react-table';
8
+ export default useColumnOrder;
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2024
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 { Hooks } from 'react-table';
8
+ declare const useFiltering: (hooks: Hooks) => void;
1
9
  export default useFiltering;
2
- declare function useFiltering(hooks: any): void;
@@ -63,12 +63,13 @@ var useFiltering = function useFiltering(hooks) {
63
63
  });
64
64
  }, []);
65
65
  hooks.useInstance.push(function (instance) {
66
- var filterProps = instance.filterProps,
67
- setAllFilters = instance.setAllFilters,
68
- setFilter = instance.setFilter,
69
- headers = instance.headers,
70
- data = instance.data,
71
- state = instance.state;
66
+ var _ref4 = instance,
67
+ filterProps = _ref4.filterProps,
68
+ setAllFilters = _ref4.setAllFilters,
69
+ setFilter = _ref4.setFilter,
70
+ headers = _ref4.headers,
71
+ data = _ref4.data,
72
+ state = _ref4.state;
72
73
  var defaultProps = {
73
74
  variation: 'flyout',
74
75
  updateMethod: BATCH,
@@ -84,7 +85,7 @@ var useFiltering = function useFiltering(hooks) {
84
85
  });
85
86
  };
86
87
  Object.assign(instance, {
87
- filterProps: _objectSpread2(_objectSpread2({}, defaultProps), instance.filterProps),
88
+ filterProps: _objectSpread2(_objectSpread2({}, defaultProps), instance === null || instance === void 0 ? void 0 : instance.filterProps),
88
89
  filterTypes: filterTypes,
89
90
  getFilterFlyoutProps: getFilterFlyoutProps,
90
91
  FilterFlyout: FilterFlyout
@@ -1,6 +1,6 @@
1
1
  export default useFlexResize;
2
2
  /**
3
- * Copyright IBM Corp. 2020, 2023
3
+ * Copyright IBM Corp. 2020, 2024
4
4
  *
5
5
  * This source code is licensed under the Apache-2.0 license found in the
6
6
  * LICENSE file in the root directory of this source tree.
@@ -7,31 +7,31 @@
7
7
 
8
8
  import { toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
 
10
+ /* eslint-disable no-unreachable */
10
11
  /**
11
- * Copyright IBM Corp. 2020, 2023
12
+ * Copyright IBM Corp. 2020, 2024
12
13
  *
13
14
  * This source code is licensed under the Apache-2.0 license found in the
14
15
  * LICENSE file in the root directory of this source tree.
15
16
  */
16
17
 
17
18
  var useFlexResize = function useFlexResize(hooks) {
18
- var spacer = {
19
- id: 'spacer',
20
- width: 0,
21
- disableSortBy: true,
22
- disableResizing: true
23
- };
24
19
  hooks.visibleColumns.push(function (columns) {
25
- // always move actions and spacer to the end
20
+ // always move actions to the end
26
21
  var actionsIdx = columns.findIndex(function (col) {
27
22
  return col.isAction;
28
23
  });
29
24
  if (actionsIdx === -1) {
30
- return [].concat(_toConsumableArray(columns), [spacer]);
25
+ var _lastCol = columns.at(-1);
26
+ _lastCol.isFlexCol = true;
27
+ return _toConsumableArray(columns);
31
28
  }
32
29
  var cols = _toConsumableArray(columns);
33
30
  var actions = cols.splice(actionsIdx, 1)[0];
34
- cols.splice(columns.length, 0, spacer, actions);
31
+ cols.splice(columns.length, 0, actions);
32
+ // the last non-action action column should flex remaining space
33
+ var lastCol = columns.at(-2);
34
+ lastCol.isFlexCol = true;
35
35
  return cols;
36
36
  });
37
37
  var changeProps = function changeProps(props, data) {
@@ -39,7 +39,7 @@ var useFlexResize = function useFlexResize(hooks) {
39
39
  if (!column && data.cell) {
40
40
  column = data.cell.column;
41
41
  }
42
- if (column.id === spacer.id) {
42
+ if (column.isFlexCol) {
43
43
  return [props, {
44
44
  style: {
45
45
  flex: '1 1 0'
@@ -15,6 +15,23 @@ var blockClass = "".concat(pkg.prefix, "--datagrid");
15
15
  var useNestedRows = function useNestedRows(hooks) {
16
16
  useNestedRowExpander(hooks);
17
17
  var useInstance = function useInstance(instance) {
18
+ useEffect(function () {
19
+ var rows = instance.rows;
20
+ var defaultExpandedRows = rows.filter(function (row) {
21
+ var _row$original;
22
+ return row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.defaultExpanded;
23
+ });
24
+ if (defaultExpandedRows !== null && defaultExpandedRows !== void 0 && defaultExpandedRows.length) {
25
+ defaultExpandedRows.map(function (defaultExpandedRow) {
26
+ if (!defaultExpandedRow.isExpanded && !defaultExpandedRow.hasExpanded) {
27
+ var _defaultExpandedRow$t;
28
+ defaultExpandedRow === null || defaultExpandedRow === void 0 || (_defaultExpandedRow$t = defaultExpandedRow.toggleRowExpanded) === null || _defaultExpandedRow$t === void 0 || _defaultExpandedRow$t.call(defaultExpandedRow);
29
+ defaultExpandedRow.hasExpanded = true;
30
+ return;
31
+ }
32
+ });
33
+ }
34
+ }, [instance, instance.rows]);
18
35
  // This useEffect will expand rows if they exist in the initialState obj
19
36
  useEffect(function () {
20
37
  var rows = instance.rows,
@@ -46,16 +63,21 @@ var useNestedRows = function useNestedRows(hooks) {
46
63
  }
47
64
  }];
48
65
  };
66
+ var getIndentation = function getIndentation(depth) {
67
+ return 32 * depth + 16;
68
+ }; // row indentation padding
49
69
  var getCellProps = function getCellProps(props, _ref3) {
50
70
  var cell = _ref3.cell,
51
71
  instance = _ref3.instance;
52
- // reduce the "first cell"s width to compensate added (left) margin
72
+ // we add a dynamic -ve margin right only if the cell is resized below minimum width i.e 50px, else we set the width based on indentation at different levels
53
73
  var isFirstCell = instance.columns.findIndex(function (c) {
54
74
  return c.id === cell.column.id;
55
75
  }) === 0;
56
76
  return [props, {
57
77
  style: {
58
- marginRight: "".concat(isFirstCell && cell.row.depth > 0 ? "".concat(-32 * cell.row.depth - 18, "px") : '')
78
+ marginRight: isFirstCell && cell.row.depth > 0 && parseInt(props.style.width, 10) <= getIndentation(cell.row.depth) + 50 // indentation padding + expander cell or empty cell width
79
+ ? "".concat(parseInt(props.style.width, 10) - (getIndentation(cell.row.depth) + 50), "px") : '',
80
+ width: isFirstCell && cell.row.depth > 0 ? parseInt(props.style.width, 10) - getIndentation(cell.row.depth) : props.style.width
59
81
  }
60
82
  }];
61
83
  };
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2023
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 { Hooks } from 'react-table';
8
+ declare const useOnRowClick: (hooks: Hooks) => void;
1
9
  export default useOnRowClick;
2
- declare function useOnRowClick(hooks: any): void;
@@ -9,7 +9,8 @@ import { pkg, carbon } from '../../settings.js';
9
9
 
10
10
  var useOnRowClick = function useOnRowClick(hooks) {
11
11
  var useInstance = function useInstance(rowInstance) {
12
- var onRowClick = rowInstance.onRowClick;
12
+ var _ref = rowInstance,
13
+ onRowClick = _ref.onRowClick;
13
14
  var getRowProps = function getRowProps(props, datagridState) {
14
15
  var isFetching = datagridState.isFetching,
15
16
  row = datagridState.row,
@@ -1,2 +1,3 @@
1
+ import { Hooks } from 'react-table';
2
+ declare const useRowIsMouseOver: (hooks: Hooks) => void;
1
3
  export default useRowIsMouseOver;
2
- declare function useRowIsMouseOver(hooks: any): void;
@@ -17,7 +17,7 @@ var useRowIsMouseOver = function useRowIsMouseOver(hooks) {
17
17
  setMouseOverRowIndex = _useState2[1];
18
18
  var onMouseChange = useDebounce(function (datagridState) {
19
19
  var row = datagridState.row;
20
- setMouseOverRowIndex(row.index);
20
+ setMouseOverRowIndex(row === null || row === void 0 ? void 0 : row.index);
21
21
  }, 100);
22
22
  var getRowProps = function getRowProps(props, datagridState) {
23
23
  var onMouseOver = function onMouseOver() {
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2023
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 { Hooks } from 'react-table';
8
+ declare const useSelectRows: (hooks: Hooks) => void;
1
9
  export default useSelectRows;
2
- declare function useSelectRows(hooks: any): void;
@@ -108,7 +108,8 @@ var SelectRow = function SelectRow(datagridState) {
108
108
  dispatch: dispatch,
109
109
  rowData: row,
110
110
  isChecked: event.target.checked,
111
- getRowId: getRowId
111
+ getRowId: getRowId,
112
+ selectAll: null
112
113
  });
113
114
  };
114
115
  var selectDisabled = isFetching || row.getRowProps().disabled;
@@ -128,7 +129,7 @@ var SelectRow = function SelectRow(datagridState) {
128
129
  onSelect: onSelectHandler,
129
130
  id: rowId,
130
131
  name: "".concat(rowId, "-name"),
131
- className: cx([checkboxClass, cellProps.className, _defineProperty({}, "".concat(checkboxClass, "-sticky-left"), isFirstColumnStickyLeft && windowSize > 671)]),
132
+ className: cx([checkboxClass, cellProps.className, _defineProperty({}, "".concat(checkboxClass, "-sticky-left"), isFirstColumnStickyLeft && Number(windowSize) > 671)]),
132
133
  ariaLabel: title,
133
134
  disabled: selectDisabled
134
135
  }));
@@ -1,6 +1,13 @@
1
- export function getNewSortOrder(sortOrder: any): {
2
- newSortDesc: undefined;
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
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 { Hooks } from 'react-table';
8
+ export declare const getNewSortOrder: (sortOrder?: boolean | string) => {
9
+ newSortDesc: boolean;
3
10
  newOrder: string;
4
11
  };
12
+ declare const useSortableColumns: (hooks: Hooks) => void;
5
13
  export default useSortableColumns;
6
- declare function useSortableColumns(hooks: any): void;
@@ -22,7 +22,7 @@ var ordering = {
22
22
  };
23
23
  var getNewSortOrder = function getNewSortOrder(sortOrder) {
24
24
  var order = {
25
- newSortDesc: undefined,
25
+ newSortDesc: false,
26
26
  newOrder: ordering.NONE
27
27
  };
28
28
  if (sortOrder === false || sortOrder === ordering.DESC) {
@@ -137,7 +137,8 @@ var useSortableColumns = function useSortableColumns(hooks) {
137
137
  return (_instance$customizeCo = instance.customizeColumnsProps) !== null && _instance$customizeCo !== void 0 && _instance$customizeCo.isTearsheetOpen ? visibleColumns : _toConsumableArray(sortableColumns);
138
138
  };
139
139
  var sortInstanceProps = function sortInstanceProps(instance) {
140
- var onSort = instance.onSort;
140
+ var _ref3 = instance,
141
+ onSort = _ref3.onSort;
141
142
  Object.assign(instance, {
142
143
  manualSortBy: !!onSort,
143
144
  isTableSortable: true
@@ -1 +1,8 @@
1
- export function getAutoSizedColumnWidth(rows: Array<object>, accessor: string, headerText: string): number;
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2023
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 { Row } from 'react-table';
8
+ export declare const getAutoSizedColumnWidth: (rows: Array<Row<object>>, accessor: string, headerText: string) => number;
@@ -14,13 +14,6 @@ import { toConsumableArray as _toConsumableArray } from '../../../_virtual/_roll
14
14
  * LICENSE file in the root directory of this source tree.
15
15
  */
16
16
 
17
- /**
18
- * Calculates the auto sized width of a column
19
- * @param {Array<object>} rows - The datagrid rows
20
- * @param {string} accessor - The accessor for the column
21
- * @param {string} headerText - The header text for the column
22
- */
23
-
24
17
  var getAutoSizedColumnWidth = function getAutoSizedColumnWidth(rows, accessor, headerText) {
25
18
  var maxWidth = 400;
26
19
  var minWidth = 58;
@@ -95,7 +95,8 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
95
95
  var subtitleRef = useRef(null);
96
96
  var previousState = usePreviousValue({
97
97
  size: size,
98
- open: open
98
+ open: open,
99
+ currentStep: currentStep
99
100
  });
100
101
  var _useState3 = useState(-1),
101
102
  _useState4 = _slicedToArray(_useState3, 2),
@@ -162,9 +163,10 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
162
163
  if (sidePanelRef && panelRefValue) {
163
164
  var _animatedScrollRef$cu;
164
165
  var scrollableSection = (_animatedScrollRef$cu = animatedScrollRef.current) !== null && _animatedScrollRef$cu !== void 0 ? _animatedScrollRef$cu : innerContentRef.current;
165
- if (scrollableSection) {
166
+ if (previousState && previousState['currentStep'] !== currentStep && scrollableSection) {
166
167
  scrollableSection.scrollTop = 0;
167
168
  }
169
+
168
170
  // The size of the panel has changed while it is still opened
169
171
  // so we need to scroll it to the top and reset the header
170
172
  // height css custom property
@@ -194,7 +194,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
194
194
  headerProps = _rollupPluginBabelHelpers["extends"]({}, (_rollupPluginBabelHelpers.objectDestructuringEmpty(_header$getHeaderProp), _header$getHeaderProp));
195
195
  var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
196
196
  return /*#__PURE__*/React__default["default"].createElement(react.TableHeader, _rollupPluginBabelHelpers["extends"]({}, headerProps, {
197
- className: cx__default["default"](header === null || header === void 0 ? void 0 : header.className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default["default"].isValidElement(header === null || header === void 0 ? void 0 : header.slug))),
197
+ className: cx__default["default"](header === null || header === void 0 ? void 0 : header.className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default["default"].isValidElement(header === null || header === void 0 ? void 0 : header.slug)), headerProps.className),
198
198
  key: header.id,
199
199
  "aria-hidden": header.id === 'spacer' && 'true'
200
200
  }, getAccessibilityProps(header)), header.render('Header'), renderSlug(header.slug), resizerProps && !header.isAction && /*#__PURE__*/React__default["default"].createElement(ResizeHeader, {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2020, 2023
2
+ * Copyright IBM Corp. 2020, 2024
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -15,7 +15,6 @@ var reactWindow = require('react-window');
15
15
  var react = require('@carbon/react');
16
16
  var settings = require('../../../settings.js');
17
17
  var DatagridHead = require('./DatagridHead.js');
18
- var layout = require('@carbon/layout');
19
18
  var useResizeObserver = require('../../../global/js/hooks/useResizeObserver.js');
20
19
 
21
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -80,10 +79,6 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
80
79
  if (headWrapEl) {
81
80
  headWrapEl.scrollLeft = virtualBody === null || virtualBody === void 0 ? void 0 : virtualBody.scrollLeft;
82
81
  }
83
- var spacerColumn = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap thead th:last-child"));
84
- if (spacerColumn) {
85
- spacerColumn.style.width = layout.px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
86
- }
87
82
  }
88
83
  var testRefValue = testRef === null || testRef === void 0 ? void 0 : testRef.current;
89
84
  testRefValue === null || testRefValue === void 0 || testRefValue.addEventListener('scroll', handleScroll);
@@ -82,7 +82,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
82
82
  };
83
83
  var onCheckboxCheck = function onCheckboxCheck(col, value) {
84
84
  var changedDefinitions = columnObjects.map(function (definition) {
85
- if (Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) {
85
+ if ((Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) && definition.canFilter && !definition.disabled) {
86
86
  return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, definition), {}, {
87
87
  isVisible: value
88
88
  });
@@ -106,9 +106,12 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
106
106
  React.useEffect(function () {
107
107
  var notFilterableCount = columnObjects.filter(function (col) {
108
108
  return !col.canFilter;
109
- });
110
- setVisibleColumnsCount(getVisibleColumnsCount() - notFilterableCount.length);
111
- setTotalColumns(columnObjects.length - notFilterableCount.length);
109
+ }).length;
110
+ var actionCount = columnObjects.filter(function (col) {
111
+ return col.id === 'actions';
112
+ }).length;
113
+ setVisibleColumnsCount(getVisibleColumnsCount() - notFilterableCount - actionCount);
114
+ setTotalColumns(columnObjects.length - notFilterableCount - actionCount);
112
115
  }, [getVisibleColumnsCount, columnObjects]);
113
116
  return /*#__PURE__*/React__default["default"].createElement(TearsheetNarrow.TearsheetNarrow, {
114
117
  className: "".concat(blockClass, "__customize-columns-tearsheet"),
@@ -1,2 +1,8 @@
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2024
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
+ declare const useFilterContext: () => any;
1
8
  export default useFilterContext;
2
- declare function useFilterContext(): any;
@@ -20,6 +20,7 @@ export namespace InlineEditCell {
20
20
  rows: PropTypes.Requireable<(object | null | undefined)[]>;
21
21
  rowSize: PropTypes.Requireable<string>;
22
22
  tableId: PropTypes.Requireable<string>;
23
+ cellEditing: PropTypes.Requireable<object>;
23
24
  }>>;
24
25
  let nonEditCell: PropTypes.Requireable<boolean>;
25
26
  let placeholder: PropTypes.Requireable<string>;
@@ -45,7 +45,8 @@ var InlineEditCell = function InlineEditCell(_ref) {
45
45
  var columnIndex = instance.columns.findIndex(function (col) {
46
46
  return col.id === columnId;
47
47
  });
48
- var cellId = "column-".concat(columnIndex, "-row-").concat(cell.row.index);
48
+ var rowIndex = cell.row.index;
49
+ var cellId = "column-".concat(columnIndex, "-row-").concat(rowIndex);
49
50
  var _useContext = React.useContext(InlineEditContext.InlineEditContext),
50
51
  state = _useContext.state,
51
52
  dispatch = _useContext.dispatch;
@@ -81,6 +82,14 @@ var InlineEditCell = function InlineEditCell(_ref) {
81
82
  var rowSize = instance.rowSize,
82
83
  onDataUpdate = instance.onDataUpdate;
83
84
  var saveCellData;
85
+ if (inEditMode) {
86
+ instance.cellEditing = {
87
+ cellId: cellId,
88
+ columnIndex: columnIndex,
89
+ rowIndex: rowIndex,
90
+ curCellValue: cellValue
91
+ };
92
+ }
84
93
  React.useEffect(function () {
85
94
  setInitialValue(value);
86
95
  var columnId = cell.column.id;
@@ -478,7 +487,8 @@ InlineEditCell.propTypes = {
478
487
  onDataUpdate: index["default"].func,
479
488
  rows: index["default"].arrayOf(index["default"].object),
480
489
  rowSize: index["default"].string,
481
- tableId: index["default"].string
490
+ tableId: index["default"].string,
491
+ cellEditing: index["default"].object
482
492
  }),
483
493
  nonEditCell: index["default"].bool,
484
494
  placeholder: index["default"].string,
@@ -192,6 +192,8 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
192
192
  onVirtualScroll?: (evt?: boolean) => void;
193
193
  fetchMoreData?: () => void;
194
194
  loadMoreThreshold?: number;
195
+ onRowClick?: (row: any, event: any) => void;
196
+ onSort?: boolean;
195
197
  }
196
198
  export interface ResizeHeaderProps {
197
199
  resizerProps?: ResizerProps;
@@ -1,2 +1,8 @@
1
- export default useColumnOrder;
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
+ */
2
7
  import { useColumnOrder } from 'react-table';
8
+ export default useColumnOrder;
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2024
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 { Hooks } from 'react-table';
8
+ declare const useFiltering: (hooks: Hooks) => void;
1
9
  export default useFiltering;
2
- declare function useFiltering(hooks: any): void;
@@ -67,12 +67,13 @@ var useFiltering = function useFiltering(hooks) {
67
67
  });
68
68
  }, []);
69
69
  hooks.useInstance.push(function (instance) {
70
- var filterProps = instance.filterProps,
71
- setAllFilters = instance.setAllFilters,
72
- setFilter = instance.setFilter,
73
- headers = instance.headers,
74
- data = instance.data,
75
- state = instance.state;
70
+ var _ref4 = instance,
71
+ filterProps = _ref4.filterProps,
72
+ setAllFilters = _ref4.setAllFilters,
73
+ setFilter = _ref4.setFilter,
74
+ headers = _ref4.headers,
75
+ data = _ref4.data,
76
+ state = _ref4.state;
76
77
  var defaultProps = {
77
78
  variation: 'flyout',
78
79
  updateMethod: constants.BATCH,
@@ -88,7 +89,7 @@ var useFiltering = function useFiltering(hooks) {
88
89
  });
89
90
  };
90
91
  Object.assign(instance, {
91
- filterProps: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, defaultProps), instance.filterProps),
92
+ filterProps: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, defaultProps), instance === null || instance === void 0 ? void 0 : instance.filterProps),
92
93
  filterTypes: filterTypes,
93
94
  getFilterFlyoutProps: getFilterFlyoutProps,
94
95
  FilterFlyout: FilterFlyout["default"]
@@ -1,6 +1,6 @@
1
1
  export default useFlexResize;
2
2
  /**
3
- * Copyright IBM Corp. 2020, 2023
3
+ * Copyright IBM Corp. 2020, 2024
4
4
  *
5
5
  * This source code is licensed under the Apache-2.0 license found in the
6
6
  * LICENSE file in the root directory of this source tree.
@@ -11,31 +11,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
13
 
14
+ /* eslint-disable no-unreachable */
14
15
  /**
15
- * Copyright IBM Corp. 2020, 2023
16
+ * Copyright IBM Corp. 2020, 2024
16
17
  *
17
18
  * This source code is licensed under the Apache-2.0 license found in the
18
19
  * LICENSE file in the root directory of this source tree.
19
20
  */
20
21
 
21
22
  var useFlexResize = function useFlexResize(hooks) {
22
- var spacer = {
23
- id: 'spacer',
24
- width: 0,
25
- disableSortBy: true,
26
- disableResizing: true
27
- };
28
23
  hooks.visibleColumns.push(function (columns) {
29
- // always move actions and spacer to the end
24
+ // always move actions to the end
30
25
  var actionsIdx = columns.findIndex(function (col) {
31
26
  return col.isAction;
32
27
  });
33
28
  if (actionsIdx === -1) {
34
- return [].concat(_rollupPluginBabelHelpers.toConsumableArray(columns), [spacer]);
29
+ var _lastCol = columns.at(-1);
30
+ _lastCol.isFlexCol = true;
31
+ return _rollupPluginBabelHelpers.toConsumableArray(columns);
35
32
  }
36
33
  var cols = _rollupPluginBabelHelpers.toConsumableArray(columns);
37
34
  var actions = cols.splice(actionsIdx, 1)[0];
38
- cols.splice(columns.length, 0, spacer, actions);
35
+ cols.splice(columns.length, 0, actions);
36
+ // the last non-action action column should flex remaining space
37
+ var lastCol = columns.at(-2);
38
+ lastCol.isFlexCol = true;
39
39
  return cols;
40
40
  });
41
41
  var changeProps = function changeProps(props, data) {
@@ -43,7 +43,7 @@ var useFlexResize = function useFlexResize(hooks) {
43
43
  if (!column && data.cell) {
44
44
  column = data.cell.column;
45
45
  }
46
- if (column.id === spacer.id) {
46
+ if (column.isFlexCol) {
47
47
  return [props, {
48
48
  style: {
49
49
  flex: '1 1 0'
@@ -23,6 +23,23 @@ var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
23
23
  var useNestedRows = function useNestedRows(hooks) {
24
24
  useNestedRowExpander["default"](hooks);
25
25
  var useInstance = function useInstance(instance) {
26
+ React.useEffect(function () {
27
+ var rows = instance.rows;
28
+ var defaultExpandedRows = rows.filter(function (row) {
29
+ var _row$original;
30
+ return row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.defaultExpanded;
31
+ });
32
+ if (defaultExpandedRows !== null && defaultExpandedRows !== void 0 && defaultExpandedRows.length) {
33
+ defaultExpandedRows.map(function (defaultExpandedRow) {
34
+ if (!defaultExpandedRow.isExpanded && !defaultExpandedRow.hasExpanded) {
35
+ var _defaultExpandedRow$t;
36
+ defaultExpandedRow === null || defaultExpandedRow === void 0 || (_defaultExpandedRow$t = defaultExpandedRow.toggleRowExpanded) === null || _defaultExpandedRow$t === void 0 || _defaultExpandedRow$t.call(defaultExpandedRow);
37
+ defaultExpandedRow.hasExpanded = true;
38
+ return;
39
+ }
40
+ });
41
+ }
42
+ }, [instance, instance.rows]);
26
43
  // This useEffect will expand rows if they exist in the initialState obj
27
44
  React.useEffect(function () {
28
45
  var rows = instance.rows,
@@ -54,16 +71,21 @@ var useNestedRows = function useNestedRows(hooks) {
54
71
  }
55
72
  }];
56
73
  };
74
+ var getIndentation = function getIndentation(depth) {
75
+ return 32 * depth + 16;
76
+ }; // row indentation padding
57
77
  var getCellProps = function getCellProps(props, _ref3) {
58
78
  var cell = _ref3.cell,
59
79
  instance = _ref3.instance;
60
- // reduce the "first cell"s width to compensate added (left) margin
80
+ // we add a dynamic -ve margin right only if the cell is resized below minimum width i.e 50px, else we set the width based on indentation at different levels
61
81
  var isFirstCell = instance.columns.findIndex(function (c) {
62
82
  return c.id === cell.column.id;
63
83
  }) === 0;
64
84
  return [props, {
65
85
  style: {
66
- marginRight: "".concat(isFirstCell && cell.row.depth > 0 ? "".concat(-32 * cell.row.depth - 18, "px") : '')
86
+ marginRight: isFirstCell && cell.row.depth > 0 && parseInt(props.style.width, 10) <= getIndentation(cell.row.depth) + 50 // indentation padding + expander cell or empty cell width
87
+ ? "".concat(parseInt(props.style.width, 10) - (getIndentation(cell.row.depth) + 50), "px") : '',
88
+ width: isFirstCell && cell.row.depth > 0 ? parseInt(props.style.width, 10) - getIndentation(cell.row.depth) : props.style.width
67
89
  }
68
90
  }];
69
91
  };
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2023
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 { Hooks } from 'react-table';
8
+ declare const useOnRowClick: (hooks: Hooks) => void;
1
9
  export default useOnRowClick;
2
- declare function useOnRowClick(hooks: any): void;
@@ -13,7 +13,8 @@ var settings = require('../../settings.js');
13
13
 
14
14
  var useOnRowClick = function useOnRowClick(hooks) {
15
15
  var useInstance = function useInstance(rowInstance) {
16
- var onRowClick = rowInstance.onRowClick;
16
+ var _ref = rowInstance,
17
+ onRowClick = _ref.onRowClick;
17
18
  var getRowProps = function getRowProps(props, datagridState) {
18
19
  var isFetching = datagridState.isFetching,
19
20
  row = datagridState.row,
@@ -1,2 +1,3 @@
1
+ import { Hooks } from 'react-table';
2
+ declare const useRowIsMouseOver: (hooks: Hooks) => void;
1
3
  export default useRowIsMouseOver;
2
- declare function useRowIsMouseOver(hooks: any): void;
@@ -25,7 +25,7 @@ var useRowIsMouseOver = function useRowIsMouseOver(hooks) {
25
25
  setMouseOverRowIndex = _useState2[1];
26
26
  var onMouseChange = useDebounce(function (datagridState) {
27
27
  var row = datagridState.row;
28
- setMouseOverRowIndex(row.index);
28
+ setMouseOverRowIndex(row === null || row === void 0 ? void 0 : row.index);
29
29
  }, 100);
30
30
  var getRowProps = function getRowProps(props, datagridState) {
31
31
  var onMouseOver = function onMouseOver() {
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2023
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 { Hooks } from 'react-table';
8
+ declare const useSelectRows: (hooks: Hooks) => void;
1
9
  export default useSelectRows;
2
- declare function useSelectRows(hooks: any): void;
@@ -117,7 +117,8 @@ var SelectRow = function SelectRow(datagridState) {
117
117
  dispatch: dispatch,
118
118
  rowData: row,
119
119
  isChecked: event.target.checked,
120
- getRowId: getRowId
120
+ getRowId: getRowId,
121
+ selectAll: null
121
122
  });
122
123
  };
123
124
  var selectDisabled = isFetching || row.getRowProps().disabled;
@@ -137,7 +138,7 @@ var SelectRow = function SelectRow(datagridState) {
137
138
  onSelect: onSelectHandler,
138
139
  id: rowId,
139
140
  name: "".concat(rowId, "-name"),
140
- className: cx__default["default"]([checkboxClass, cellProps.className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(checkboxClass, "-sticky-left"), isFirstColumnStickyLeft && windowSize > 671)]),
141
+ className: cx__default["default"]([checkboxClass, cellProps.className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(checkboxClass, "-sticky-left"), isFirstColumnStickyLeft && Number(windowSize) > 671)]),
141
142
  ariaLabel: title,
142
143
  disabled: selectDisabled
143
144
  }));
@@ -1,6 +1,13 @@
1
- export function getNewSortOrder(sortOrder: any): {
2
- newSortDesc: undefined;
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
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 { Hooks } from 'react-table';
8
+ export declare const getNewSortOrder: (sortOrder?: boolean | string) => {
9
+ newSortDesc: boolean;
3
10
  newOrder: string;
4
11
  };
12
+ declare const useSortableColumns: (hooks: Hooks) => void;
5
13
  export default useSortableColumns;
6
- declare function useSortableColumns(hooks: any): void;
@@ -31,7 +31,7 @@ var ordering = {
31
31
  };
32
32
  var getNewSortOrder = function getNewSortOrder(sortOrder) {
33
33
  var order = {
34
- newSortDesc: undefined,
34
+ newSortDesc: false,
35
35
  newOrder: ordering.NONE
36
36
  };
37
37
  if (sortOrder === false || sortOrder === ordering.DESC) {
@@ -146,7 +146,8 @@ var useSortableColumns = function useSortableColumns(hooks) {
146
146
  return (_instance$customizeCo = instance.customizeColumnsProps) !== null && _instance$customizeCo !== void 0 && _instance$customizeCo.isTearsheetOpen ? visibleColumns : _rollupPluginBabelHelpers.toConsumableArray(sortableColumns);
147
147
  };
148
148
  var sortInstanceProps = function sortInstanceProps(instance) {
149
- var onSort = instance.onSort;
149
+ var _ref3 = instance,
150
+ onSort = _ref3.onSort;
150
151
  Object.assign(instance, {
151
152
  manualSortBy: !!onSort,
152
153
  isTableSortable: true
@@ -1 +1,8 @@
1
- export function getAutoSizedColumnWidth(rows: Array<object>, accessor: string, headerText: string): number;
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2023
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 { Row } from 'react-table';
8
+ export declare const getAutoSizedColumnWidth: (rows: Array<Row<object>>, accessor: string, headerText: string) => number;
@@ -18,13 +18,6 @@ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHel
18
18
  * LICENSE file in the root directory of this source tree.
19
19
  */
20
20
 
21
- /**
22
- * Calculates the auto sized width of a column
23
- * @param {Array<object>} rows - The datagrid rows
24
- * @param {string} accessor - The accessor for the column
25
- * @param {string} headerText - The header text for the column
26
- */
27
-
28
21
  var getAutoSizedColumnWidth = function getAutoSizedColumnWidth(rows, accessor, headerText) {
29
22
  var maxWidth = 400;
30
23
  var minWidth = 58;
@@ -104,7 +104,8 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
104
104
  var subtitleRef = React.useRef(null);
105
105
  var previousState = usePreviousValue.usePreviousValue({
106
106
  size: size,
107
- open: open
107
+ open: open,
108
+ currentStep: currentStep
108
109
  });
109
110
  var _useState3 = React.useState(-1),
110
111
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
@@ -171,9 +172,10 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
171
172
  if (sidePanelRef && panelRefValue) {
172
173
  var _animatedScrollRef$cu;
173
174
  var scrollableSection = (_animatedScrollRef$cu = animatedScrollRef.current) !== null && _animatedScrollRef$cu !== void 0 ? _animatedScrollRef$cu : innerContentRef.current;
174
- if (scrollableSection) {
175
+ if (previousState && previousState['currentStep'] !== currentStep && scrollableSection) {
175
176
  scrollableSection.scrollTop = 0;
176
177
  }
178
+
177
179
  // The size of the panel has changed while it is still opened
178
180
  // so we need to scroll it to the top and reset the header
179
181
  // height css custom property
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.42.1-canary.8+553f2c7e1",
4
+ "version": "2.43.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -97,7 +97,7 @@
97
97
  "dependencies": {
98
98
  "@babel/runtime": "^7.23.9",
99
99
  "@carbon/feature-flags": "^0.20.0",
100
- "@carbon/ibm-products-styles": "^2.38.2-canary.8+553f2c7e1",
100
+ "@carbon/ibm-products-styles": "^2.39.0",
101
101
  "@carbon/telemetry": "^0.1.0",
102
102
  "@dnd-kit/core": "^6.0.8",
103
103
  "@dnd-kit/modifiers": "^7.0.0",
@@ -121,5 +121,5 @@
121
121
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
122
122
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
123
123
  },
124
- "gitHead": "553f2c7e1c6848e853abd71d493b3bca77968252"
124
+ "gitHead": "4deacf2fbc44a543db6141a63a0f4d988900a0c5"
125
125
  }
package/telemetry.yml CHANGED
@@ -14,6 +14,7 @@ collect:
14
14
  - actionsPlacement
15
15
  - activeCellCoordinates
16
16
  - activeHref
17
+ - addConditionSubGroupHandler
17
18
  - align
18
19
  - allPageRowsLabel
19
20
  - allRowsLabel
@@ -122,6 +123,8 @@ collect:
122
123
  - HeaderRow
123
124
  - headers
124
125
  - headRef
126
+ - hideConditionPreviewHandler
127
+ - hideConditionSubGroupPreviewHandler
125
128
  - hideIcon
126
129
  - hideSelectAll
127
130
  - href
@@ -213,12 +216,14 @@ collect:
213
216
  - onRemove
214
217
  - onRequestClose
215
218
  - onRequestSubmit
219
+ - onRowClick
216
220
  - onScroll
217
221
  - onSecondaryButtonClick
218
222
  - onSelectAllRows
219
223
  - onSelectColumn
220
224
  - onSelectionAreaChange
221
225
  - onShowAllClick
226
+ - onSort
222
227
  - onSubmit
223
228
  - onSubmitButtonText
224
229
  - onToggle
@@ -296,6 +301,8 @@ collect:
296
301
  - setSelectionAreas
297
302
  - showAllTagsLabel
298
303
  - showCloseButton
304
+ - showConditionPreviewHandler
305
+ - showConditionSubGroupPreviewHandler
299
306
  - showToolTip
300
307
  - sideNavAriaLabel
301
308
  - size
@@ -504,13 +511,25 @@ collect:
504
511
  - isStatement
505
512
  - onConnectorOperatorChange
506
513
  - onStatementChange
514
+ # ConditionBuilderAdd
515
+ - buttonLabel
516
+ - enableSubGroup
507
517
  # ConditionBuilderButton
508
518
  - hideLabel
519
+ - onBlur
520
+ - onFocus
521
+ - onMouseEnter
522
+ - onMouseLeave
509
523
  - tooltipAlign
524
+ - wrapperProps
525
+ # ConditionBuilderContent
526
+ - getActionsState
510
527
  # ConditionBuilderItem
511
528
  - popOverClassName
512
529
  # ConditionConnector
513
530
  - operator
531
+ # ConditionPreview
532
+ - previewType
514
533
  # CreateFullPage
515
534
  - breadcrumbsOverflowAriaLabel
516
535
  - maxVisibleBreadcrumbs
@@ -1078,6 +1097,10 @@ collect:
1078
1097
  - floating
1079
1098
  - stacked
1080
1099
  - tooltip
1100
+ # ConditionPreview - previewType
1101
+ - condition
1102
+ - newGroup
1103
+ - subGroup
1081
1104
  # DecoratorIcon - magnitude
1082
1105
  - benign
1083
1106
  - critical