@carbon/ibm-products 2.42.1-canary.22 → 2.42.1-canary.24

Sign up to get free protection for your applications and to get access to all the features.
@@ -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);
@@ -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'
@@ -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);
@@ -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'
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.22+bf7c0c878",
4
+ "version": "2.42.1-canary.24+b6e52bd37",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -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": "bf7c0c878d500b064d623355d607b75717f8a799"
124
+ "gitHead": "b6e52bd37c7d7595b31e90bdfc708c413e039816"
125
125
  }