@datarobot/design-system 28.9.2 → 28.9.3
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.
|
@@ -14,14 +14,21 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
14
14
|
function calculateDelta(columns, maxWidth, padding = 0, columnSizing = {}, visibility = {}) {
|
|
15
15
|
// we are interested only in visible columns
|
|
16
16
|
const visibleColumns = columns.filter(({
|
|
17
|
-
accessorKey
|
|
18
|
-
|
|
17
|
+
accessorKey,
|
|
18
|
+
id
|
|
19
|
+
}) => {
|
|
20
|
+
// visibility state uses column ids for setting visibility, and for most cases it's the same as accessorKey
|
|
21
|
+
// but for the case when either 1) user provided an explicit id to the columnDef or 2) accessorKey is a complex get object path like `<object_name>.<object_property_name>`
|
|
22
|
+
// accessorKey would be different from id. Thus we should add a check on columnDef.id here
|
|
23
|
+
const visibilityValue = visibility[id] ?? visibility[accessorKey];
|
|
24
|
+
return visibilityValue !== false;
|
|
25
|
+
});
|
|
19
26
|
// we need to know columns that do have maxSize set, as it will influence how free space is distributed
|
|
20
27
|
const columnsWithMaxSize = visibleColumns.filter(column => !!column.maxSize);
|
|
21
28
|
|
|
22
29
|
// calculation of all current columns width
|
|
23
30
|
const currentWidth = visibleColumns.reduce((acc, current) => {
|
|
24
|
-
const resizeValue = columnSizing[current.accessorKey];
|
|
31
|
+
const resizeValue = columnSizing[current.id] || columnSizing[current.accessorKey];
|
|
25
32
|
const minWidth = current.minSize || _types.COLUMN_SIZE.MIN_WIDTH;
|
|
26
33
|
const resizeWidth = resizeValue ? Math.max(resizeValue, minWidth) : 0;
|
|
27
34
|
const columnSize = Math.max(current.size || _types.COLUMN_SIZE.WIDTH, minWidth);
|
|
@@ -39,8 +46,9 @@ function calculateDelta(columns, maxWidth, padding = 0, columnSizing = {}, visib
|
|
|
39
46
|
// whose size was altered manually by drag-n-drop in UI)
|
|
40
47
|
const notSettedColumns = visibleColumns.filter(({
|
|
41
48
|
size,
|
|
42
|
-
accessorKey
|
|
43
|
-
|
|
49
|
+
accessorKey,
|
|
50
|
+
id
|
|
51
|
+
}) => !size && !(columnSizing[id] || columnSizing[accessorKey]));
|
|
44
52
|
const evenDistribution = delta / notSettedColumns.length;
|
|
45
53
|
|
|
46
54
|
// if there is no max size on any columns - distribute free space evenly across columns
|
|
@@ -7,14 +7,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
7
|
function calculateDelta(columns, maxWidth, padding = 0, columnSizing = {}, visibility = {}) {
|
|
8
8
|
// we are interested only in visible columns
|
|
9
9
|
const visibleColumns = columns.filter(({
|
|
10
|
-
accessorKey
|
|
11
|
-
|
|
10
|
+
accessorKey,
|
|
11
|
+
id
|
|
12
|
+
}) => {
|
|
13
|
+
// visibility state uses column ids for setting visibility, and for most cases it's the same as accessorKey
|
|
14
|
+
// but for the case when either 1) user provided an explicit id to the columnDef or 2) accessorKey is a complex get object path like `<object_name>.<object_property_name>`
|
|
15
|
+
// accessorKey would be different from id. Thus we should add a check on columnDef.id here
|
|
16
|
+
const visibilityValue = visibility[id] ?? visibility[accessorKey];
|
|
17
|
+
return visibilityValue !== false;
|
|
18
|
+
});
|
|
12
19
|
// we need to know columns that do have maxSize set, as it will influence how free space is distributed
|
|
13
20
|
const columnsWithMaxSize = visibleColumns.filter(column => !!column.maxSize);
|
|
14
21
|
|
|
15
22
|
// calculation of all current columns width
|
|
16
23
|
const currentWidth = visibleColumns.reduce((acc, current) => {
|
|
17
|
-
const resizeValue = columnSizing[current.accessorKey];
|
|
24
|
+
const resizeValue = columnSizing[current.id] || columnSizing[current.accessorKey];
|
|
18
25
|
const minWidth = current.minSize || COLUMN_SIZE.MIN_WIDTH;
|
|
19
26
|
const resizeWidth = resizeValue ? Math.max(resizeValue, minWidth) : 0;
|
|
20
27
|
const columnSize = Math.max(current.size || COLUMN_SIZE.WIDTH, minWidth);
|
|
@@ -32,8 +39,9 @@ function calculateDelta(columns, maxWidth, padding = 0, columnSizing = {}, visib
|
|
|
32
39
|
// whose size was altered manually by drag-n-drop in UI)
|
|
33
40
|
const notSettedColumns = visibleColumns.filter(({
|
|
34
41
|
size,
|
|
35
|
-
accessorKey
|
|
36
|
-
|
|
42
|
+
accessorKey,
|
|
43
|
+
id
|
|
44
|
+
}) => !size && !(columnSizing[id] || columnSizing[accessorKey]));
|
|
37
45
|
const evenDistribution = delta / notSettedColumns.length;
|
|
38
46
|
|
|
39
47
|
// if there is no max size on any columns - distribute free space evenly across columns
|
package/js/bundle/bundle.js
CHANGED
|
@@ -76937,8 +76937,14 @@ function calculateDelta(columns, maxWidth) {
|
|
|
76937
76937
|
var visibility = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
76938
76938
|
// we are interested only in visible columns
|
|
76939
76939
|
var visibleColumns = columns.filter(function (_ref) {
|
|
76940
|
-
var
|
|
76941
|
-
|
|
76940
|
+
var _visibility;
|
|
76941
|
+
var accessorKey = _ref.accessorKey,
|
|
76942
|
+
id = _ref.id;
|
|
76943
|
+
// visibility state uses column ids for setting visibility, and for most cases it's the same as accessorKey
|
|
76944
|
+
// but for the case when either 1) user provided an explicit id to the columnDef or 2) accessorKey is a complex get object path like `<object_name>.<object_property_name>`
|
|
76945
|
+
// accessorKey would be different from id. Thus we should add a check on columnDef.id here
|
|
76946
|
+
var visibilityValue = (_visibility = visibility[id]) !== null && _visibility !== void 0 ? _visibility : visibility[accessorKey];
|
|
76947
|
+
return visibilityValue !== false;
|
|
76942
76948
|
});
|
|
76943
76949
|
// we need to know columns that do have maxSize set, as it will influence how free space is distributed
|
|
76944
76950
|
var columnsWithMaxSize = visibleColumns.filter(function (column) {
|
|
@@ -76947,7 +76953,7 @@ function calculateDelta(columns, maxWidth) {
|
|
|
76947
76953
|
|
|
76948
76954
|
// calculation of all current columns width
|
|
76949
76955
|
var currentWidth = visibleColumns.reduce(function (acc, current) {
|
|
76950
|
-
var resizeValue = columnSizing[current.accessorKey];
|
|
76956
|
+
var resizeValue = columnSizing[current.id] || columnSizing[current.accessorKey];
|
|
76951
76957
|
var minWidth = current.minSize || _types__WEBPACK_IMPORTED_MODULE_1__.COLUMN_SIZE.MIN_WIDTH;
|
|
76952
76958
|
var resizeWidth = resizeValue ? Math.max(resizeValue, minWidth) : 0;
|
|
76953
76959
|
var columnSize = Math.max(current.size || _types__WEBPACK_IMPORTED_MODULE_1__.COLUMN_SIZE.WIDTH, minWidth);
|
|
@@ -76965,8 +76971,9 @@ function calculateDelta(columns, maxWidth) {
|
|
|
76965
76971
|
// whose size was altered manually by drag-n-drop in UI)
|
|
76966
76972
|
var notSettedColumns = visibleColumns.filter(function (_ref2) {
|
|
76967
76973
|
var size = _ref2.size,
|
|
76968
|
-
accessorKey = _ref2.accessorKey
|
|
76969
|
-
|
|
76974
|
+
accessorKey = _ref2.accessorKey,
|
|
76975
|
+
id = _ref2.id;
|
|
76976
|
+
return !size && !(columnSizing[id] || columnSizing[accessorKey]);
|
|
76970
76977
|
});
|
|
76971
76978
|
var evenDistribution = delta / notSettedColumns.length;
|
|
76972
76979
|
|