@zat-design/sisyphus-react 3.8.2-beta.16 → 3.8.2-beta.17
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/ProTable/components/FormatColumn/index.d.ts +2 -1
- package/es/ProTable/components/FormatColumn/index.js +35 -9
- package/es/ProTable/index.js +3 -2
- package/lib/ProTable/components/FormatColumn/index.d.ts +2 -1
- package/lib/ProTable/components/FormatColumn/index.js +34 -8
- package/lib/ProTable/index.js +3 -2
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProTableColumn } from '../../propsType';
|
|
3
|
-
export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, }: {
|
|
3
|
+
export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, scroll, }: {
|
|
4
4
|
column: ProTableColumn;
|
|
5
5
|
originalObj: any;
|
|
6
6
|
dataSourceObj: any;
|
|
7
7
|
rowKey: any;
|
|
8
8
|
diffToolTip?: boolean;
|
|
9
9
|
wrapToolTipProps?: any;
|
|
10
|
+
scroll?: any;
|
|
10
11
|
}) => void;
|
|
11
12
|
/**
|
|
12
13
|
* 查找最近的父级className
|
|
@@ -5,20 +5,38 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
5
5
|
import { isValidElement } from 'react';
|
|
6
6
|
import moment from 'moment';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
|
-
import { isEqual, isFunction, isString } from 'lodash';
|
|
8
|
+
import { isEqual, isFunction, isString, isObject } from 'lodash';
|
|
9
9
|
import { tools } from '@zat-design/utils';
|
|
10
10
|
import TooltipTitle from '../TooltipTitle';
|
|
11
11
|
import RenderColumn from '../RenderColumn';
|
|
12
12
|
import { getDecimalDigits, getOriginalValue } from '../../utils';
|
|
13
13
|
import getEnumLabel from '../../../ProEnum/utils/getEnumLabel';
|
|
14
14
|
import ProForm from '../../../ProForm';
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
var calcMinWidth = function calcMinWidth(_ref) {
|
|
16
|
+
var minWidth = _ref.minWidth,
|
|
17
|
+
width = _ref.width,
|
|
18
|
+
title = _ref.title,
|
|
19
|
+
isMaxContentOverFlow = _ref.isMaxContentOverFlow;
|
|
20
|
+
var resultMinWidth = minWidth;
|
|
21
|
+
if (!minWidth && !width && isMaxContentOverFlow) {
|
|
22
|
+
var tempEl = document.createElement('div');
|
|
23
|
+
tempEl.innerHTML = title;
|
|
24
|
+
tempEl.style.display = 'inline-block'; // 确保元素有宽度
|
|
25
|
+
document.body.appendChild(tempEl); // 将元素添加到 DOM 中
|
|
26
|
+
var _width = tempEl.offsetWidth;
|
|
27
|
+
tempEl.remove();
|
|
28
|
+
resultMinWidth = _width;
|
|
29
|
+
}
|
|
30
|
+
return resultMinWidth;
|
|
31
|
+
};
|
|
32
|
+
export var formatColumn = function formatColumn(_ref2) {
|
|
33
|
+
var column = _ref2.column,
|
|
34
|
+
originalObj = _ref2.originalObj,
|
|
35
|
+
dataSourceObj = _ref2.dataSourceObj,
|
|
36
|
+
rowKey = _ref2.rowKey,
|
|
37
|
+
diffToolTip = _ref2.diffToolTip,
|
|
38
|
+
wrapToolTipProps = _ref2.wrapToolTipProps,
|
|
39
|
+
scroll = _ref2.scroll;
|
|
22
40
|
var title = column.title,
|
|
23
41
|
valueType = column.valueType,
|
|
24
42
|
_column$format = column.format,
|
|
@@ -38,7 +56,15 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
38
56
|
originalDiffTip = _column$originalDiffT === void 0 ? true : _column$originalDiffT,
|
|
39
57
|
_column$toolTipProps = column.toolTipProps,
|
|
40
58
|
toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps,
|
|
41
|
-
|
|
59
|
+
_minWidth = column.minWidth;
|
|
60
|
+
// 仅在 {x: 'max-content', y: 300 } 且 column无指定 width minWidth 情况下 才开启 minWidth的自动计算
|
|
61
|
+
var isMaxContentOverFlow = isObject(scroll) ? (scroll === null || scroll === void 0 ? void 0 : scroll.x) === 'max-content' && Reflect.ownKeys(scroll).includes('y') : false;
|
|
62
|
+
var minWidth = calcMinWidth({
|
|
63
|
+
minWidth: _minWidth,
|
|
64
|
+
width: width,
|
|
65
|
+
title: title,
|
|
66
|
+
isMaxContentOverFlow: isMaxContentOverFlow
|
|
67
|
+
});
|
|
42
68
|
var _toolTipProps = _objectSpread(_objectSpread({}, toolTipProps), wrapToolTipProps);
|
|
43
69
|
var _originalDiffTip = diffToolTip !== null && diffToolTip !== void 0 ? diffToolTip : originalDiffTip;
|
|
44
70
|
// 前缀处理
|
package/es/ProTable/index.js
CHANGED
|
@@ -211,11 +211,12 @@ function ProTable(props) {
|
|
|
211
211
|
dataSourceObj: dataSourceObj,
|
|
212
212
|
rowKey: 'rowKey',
|
|
213
213
|
diffToolTip: toolTip,
|
|
214
|
-
wrapToolTipProps: wrapToolTipProps
|
|
214
|
+
wrapToolTipProps: wrapToolTipProps,
|
|
215
|
+
scroll: _scroll
|
|
215
216
|
});
|
|
216
217
|
});
|
|
217
218
|
return newColumns;
|
|
218
|
-
}, [curColumns, handleResize]);
|
|
219
|
+
}, [curColumns, handleResize, _scroll]);
|
|
219
220
|
var _columns = useMemo(function () {
|
|
220
221
|
return columns === null || columns === void 0 ? void 0 : columns.filter(function (item, index) {
|
|
221
222
|
var show = item.show;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProTableColumn } from '../../propsType';
|
|
3
|
-
export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, }: {
|
|
3
|
+
export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, scroll, }: {
|
|
4
4
|
column: ProTableColumn;
|
|
5
5
|
originalObj: any;
|
|
6
6
|
dataSourceObj: any;
|
|
7
7
|
rowKey: any;
|
|
8
8
|
diffToolTip?: boolean;
|
|
9
9
|
wrapToolTipProps?: any;
|
|
10
|
+
scroll?: any;
|
|
10
11
|
}) => void;
|
|
11
12
|
/**
|
|
12
13
|
* 查找最近的父级className
|
|
@@ -18,13 +18,31 @@ var _RenderColumn = _interopRequireDefault(require("../RenderColumn"));
|
|
|
18
18
|
var _utils2 = require("../../utils");
|
|
19
19
|
var _getEnumLabel = _interopRequireDefault(require("../../../ProEnum/utils/getEnumLabel"));
|
|
20
20
|
var _ProForm = _interopRequireDefault(require("../../../ProForm"));
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
var calcMinWidth = function calcMinWidth(_ref) {
|
|
22
|
+
var minWidth = _ref.minWidth,
|
|
23
|
+
width = _ref.width,
|
|
24
|
+
title = _ref.title,
|
|
25
|
+
isMaxContentOverFlow = _ref.isMaxContentOverFlow;
|
|
26
|
+
var resultMinWidth = minWidth;
|
|
27
|
+
if (!minWidth && !width && isMaxContentOverFlow) {
|
|
28
|
+
var tempEl = document.createElement('div');
|
|
29
|
+
tempEl.innerHTML = title;
|
|
30
|
+
tempEl.style.display = 'inline-block'; // 确保元素有宽度
|
|
31
|
+
document.body.appendChild(tempEl); // 将元素添加到 DOM 中
|
|
32
|
+
var _width = tempEl.offsetWidth;
|
|
33
|
+
tempEl.remove();
|
|
34
|
+
resultMinWidth = _width;
|
|
35
|
+
}
|
|
36
|
+
return resultMinWidth;
|
|
37
|
+
};
|
|
38
|
+
var formatColumn = exports.formatColumn = function formatColumn(_ref2) {
|
|
39
|
+
var column = _ref2.column,
|
|
40
|
+
originalObj = _ref2.originalObj,
|
|
41
|
+
dataSourceObj = _ref2.dataSourceObj,
|
|
42
|
+
rowKey = _ref2.rowKey,
|
|
43
|
+
diffToolTip = _ref2.diffToolTip,
|
|
44
|
+
wrapToolTipProps = _ref2.wrapToolTipProps,
|
|
45
|
+
scroll = _ref2.scroll;
|
|
28
46
|
var title = column.title,
|
|
29
47
|
valueType = column.valueType,
|
|
30
48
|
_column$format = column.format,
|
|
@@ -44,7 +62,15 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
|
|
|
44
62
|
originalDiffTip = _column$originalDiffT === void 0 ? true : _column$originalDiffT,
|
|
45
63
|
_column$toolTipProps = column.toolTipProps,
|
|
46
64
|
toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps,
|
|
47
|
-
|
|
65
|
+
_minWidth = column.minWidth;
|
|
66
|
+
// 仅在 {x: 'max-content', y: 300 } 且 column无指定 width minWidth 情况下 才开启 minWidth的自动计算
|
|
67
|
+
var isMaxContentOverFlow = (0, _lodash.isObject)(scroll) ? (scroll === null || scroll === void 0 ? void 0 : scroll.x) === 'max-content' && Reflect.ownKeys(scroll).includes('y') : false;
|
|
68
|
+
var minWidth = calcMinWidth({
|
|
69
|
+
minWidth: _minWidth,
|
|
70
|
+
width: width,
|
|
71
|
+
title: title,
|
|
72
|
+
isMaxContentOverFlow: isMaxContentOverFlow
|
|
73
|
+
});
|
|
48
74
|
var _toolTipProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, toolTipProps), wrapToolTipProps);
|
|
49
75
|
var _originalDiffTip = diffToolTip !== null && diffToolTip !== void 0 ? diffToolTip : originalDiffTip;
|
|
50
76
|
// 前缀处理
|
package/lib/ProTable/index.js
CHANGED
|
@@ -218,11 +218,12 @@ function ProTable(props) {
|
|
|
218
218
|
dataSourceObj: dataSourceObj,
|
|
219
219
|
rowKey: 'rowKey',
|
|
220
220
|
diffToolTip: toolTip,
|
|
221
|
-
wrapToolTipProps: wrapToolTipProps
|
|
221
|
+
wrapToolTipProps: wrapToolTipProps,
|
|
222
|
+
scroll: _scroll
|
|
222
223
|
});
|
|
223
224
|
});
|
|
224
225
|
return newColumns;
|
|
225
|
-
}, [curColumns, handleResize]);
|
|
226
|
+
}, [curColumns, handleResize, _scroll]);
|
|
226
227
|
var _columns = (0, _react.useMemo)(function () {
|
|
227
228
|
return columns === null || columns === void 0 ? void 0 : columns.filter(function (item, index) {
|
|
228
229
|
var show = item.show;
|