@carbon/ibm-products 2.42.1-canary.23 → 2.42.1-canary.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +0 -5
- package/es/components/Datagrid/useFlexResize.d.ts +1 -1
- package/es/components/Datagrid/useFlexResize.js +11 -11
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +0 -5
- package/lib/components/Datagrid/useFlexResize.d.ts +1 -1
- package/lib/components/Datagrid/useFlexResize.js +11 -11
- package/package.json +2 -2
@@ -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);
|
@@ -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,
|
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
|
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
|
-
|
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,
|
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.
|
42
|
+
if (column.isFlexCol) {
|
43
43
|
return [props, {
|
44
44
|
style: {
|
45
45
|
flex: '1 1 0'
|
@@ -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);
|
@@ -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,
|
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
|
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
|
-
|
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,
|
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.
|
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.
|
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": "
|
124
|
+
"gitHead": "b6e52bd37c7d7595b31e90bdfc708c413e039816"
|
125
125
|
}
|