@zat-design/sisyphus-react 3.8.2 → 3.8.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.
- package/dist/index.esm.css +16 -8
- package/dist/less.esm.css +16 -8
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +7 -6
- package/es/ProEditTable/components/RenderField/index.js +1 -0
- package/es/ProEnum/hooks/useEnumRequest.js +1 -1
- package/es/ProEnum/index.js +2 -2
- package/es/ProForm/components/base/InputNumber/index.js +1 -1
- package/es/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
- package/es/ProForm/components/combination/Group/component/ComRender.js +4 -2
- package/es/ProForm/components/combination/Group/index.js +6 -3
- package/es/ProForm/components/render/ChangedWrapper.js +8 -2
- package/es/ProForm/components/render/Render.js +3 -2
- package/es/ProForm/components/render/propsType.d.ts +4 -0
- package/es/ProForm/style/index.less +15 -2
- package/es/ProForm/utils/useShouldUpdate.js +21 -6
- package/es/ProTable/components/FormatColumn/index.d.ts +3 -1
- package/es/ProTable/components/FormatColumn/index.js +92 -17
- package/es/ProTable/components/RenderColumn/index.d.ts +1 -0
- package/es/ProTable/components/RenderColumn/index.js +22 -7
- package/es/ProTable/index.js +20 -5
- package/es/ProTable/style/index.less +8 -6
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +10 -9
- package/lib/ProEditTable/components/RenderField/index.js +1 -0
- package/lib/ProEnum/hooks/useEnumRequest.js +1 -1
- package/lib/ProEnum/index.js +2 -2
- package/lib/ProForm/components/base/InputNumber/index.js +1 -1
- package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
- package/lib/ProForm/components/combination/Group/component/ComRender.js +4 -2
- package/lib/ProForm/components/combination/Group/index.js +6 -3
- package/lib/ProForm/components/render/ChangedWrapper.js +8 -2
- package/lib/ProForm/components/render/Render.js +3 -2
- package/lib/ProForm/components/render/propsType.d.ts +4 -0
- package/lib/ProForm/style/index.less +15 -2
- package/lib/ProForm/utils/useShouldUpdate.js +19 -4
- package/lib/ProTable/components/FormatColumn/index.d.ts +3 -1
- package/lib/ProTable/components/FormatColumn/index.js +91 -16
- package/lib/ProTable/components/RenderColumn/index.d.ts +1 -0
- package/lib/ProTable/components/RenderColumn/index.js +22 -7
- package/lib/ProTable/index.js +20 -5
- package/lib/ProTable/style/index.less +8 -6
- package/package.json +4 -3
- package/.vscode/extensions.json +0 -5
|
@@ -27,7 +27,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
27
27
|
index = formItemProps.index,
|
|
28
28
|
namePath = formItemProps.namePath,
|
|
29
29
|
names = formItemProps.names,
|
|
30
|
-
|
|
30
|
+
dependNames = formItemProps.dependNames;
|
|
31
31
|
var timerRef = (0, _react.useRef)();
|
|
32
32
|
var needClear = (0, _react.useRef)(); // 是否需要执行清值操作
|
|
33
33
|
var showRef = (0, _react.useRef)();
|
|
@@ -36,13 +36,14 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
36
36
|
var rulesRef = (0, _react.useRef)();
|
|
37
37
|
var fieldPropsRef = (0, _react.useRef)();
|
|
38
38
|
var originComponentRef = (0, _react.useRef)();
|
|
39
|
+
var dependNamesRef = (0, _react.useRef)();
|
|
39
40
|
var newComponent = originComponent || component; // 解决component默认赋值污染问题,需要使用originComponent
|
|
40
41
|
var _useState = (0, _react.useState)({}),
|
|
41
42
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
42
43
|
reRender = _useState2[1];
|
|
43
44
|
var values = {};
|
|
44
45
|
// 不是动态函数直接返回
|
|
45
|
-
if (!(0, _lodash.isFunction)(show) && !(0, _lodash.isFunction)(disabled) && !(0, _lodash.isFunction)(required) && !(0, _lodash.isFunction)(rules) && !(0, _lodash.isFunction)(fieldProps) && !(0, _lodash.isFunction)(originComponent)) {
|
|
46
|
+
if (!(dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) && !(0, _lodash.isFunction)(show) && !(0, _lodash.isFunction)(disabled) && !(0, _lodash.isFunction)(required) && !(0, _lodash.isFunction)(rules) && !(0, _lodash.isFunction)(fieldProps) && !(0, _lodash.isFunction)(originComponent)) {
|
|
46
47
|
return {
|
|
47
48
|
shouldUpdate: _shouldUpdate,
|
|
48
49
|
show: show,
|
|
@@ -126,9 +127,22 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
126
127
|
} else {
|
|
127
128
|
fieldPropsRef.current = fieldProps;
|
|
128
129
|
}
|
|
130
|
+
if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
|
|
131
|
+
dependNamesRef.current = dependNames.map(function (name) {
|
|
132
|
+
return (0, _lodash.get)(values, name);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
129
135
|
return {
|
|
130
136
|
shouldUpdate: function shouldUpdate(prevValues, currentValues) {
|
|
131
137
|
// @ts-ignore formList场景取当前行数据,不取shouldUpdate变更后值
|
|
138
|
+
if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
|
|
139
|
+
var curDependNamesValue = dependNames.map(function (name) {
|
|
140
|
+
return (0, _lodash.get)(currentValues, name);
|
|
141
|
+
});
|
|
142
|
+
var dependNamesChanged = !(0, _lodash.isEqualWith)(dependNamesRef.current, curDependNamesValue, _index.customEqualForFun);
|
|
143
|
+
dependNamesRef.current = curDependNamesValue;
|
|
144
|
+
if (!dependNamesChanged) return false;
|
|
145
|
+
}
|
|
132
146
|
var _currentValues;
|
|
133
147
|
if (namePath) {
|
|
134
148
|
// formList场景values取当前行数据
|
|
@@ -189,11 +203,12 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
189
203
|
}
|
|
190
204
|
var equalRes = (0, _lodash.isEqualWith)(rulesRef.current, _rules, _index.customEqualForFun);
|
|
191
205
|
var proEqualRes = (0, _lodash.isEqualWith)(fieldPropsRef.current, _fieldProps, _index.customEqualForFun);
|
|
192
|
-
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes
|
|
206
|
+
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes
|
|
193
207
|
// 值变更,需要同步更新函数式的fieldProps
|
|
194
208
|
// (isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues)) ||
|
|
195
209
|
// !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
|
|
196
|
-
|
|
210
|
+
// equalDependencies(dependencies, prevValues, _currentValues)
|
|
211
|
+
) {
|
|
197
212
|
showRef.current = _show;
|
|
198
213
|
disabledRef.current = _disabled;
|
|
199
214
|
requiredRef.current = _required;
|
|
@@ -1,12 +1,14 @@
|
|
|
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, onUpdateMinWidth, }: {
|
|
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;
|
|
11
|
+
onUpdateMinWidth?: any;
|
|
10
12
|
}) => void;
|
|
11
13
|
/**
|
|
12
14
|
* 查找最近的父级className
|
|
@@ -10,6 +10,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _moment15 = _interopRequireDefault(require("moment"));
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
14
|
var _antd = require("antd");
|
|
14
15
|
var _lodash = require("lodash");
|
|
15
16
|
var _utils = require("@zat-design/utils");
|
|
@@ -18,13 +19,45 @@ var _RenderColumn = _interopRequireDefault(require("../RenderColumn"));
|
|
|
18
19
|
var _utils2 = require("../../utils");
|
|
19
20
|
var _getEnumLabel = _interopRequireDefault(require("../../../ProEnum/utils/getEnumLabel"));
|
|
20
21
|
var _ProForm = _interopRequireDefault(require("../../../ProForm"));
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
var isReactElement = function isReactElement(element) {
|
|
23
|
+
return /*#__PURE__*/(0, _react.isValidElement)(element);
|
|
24
|
+
};
|
|
25
|
+
var calcMinWidth = function calcMinWidth(_ref) {
|
|
26
|
+
var minWidth = _ref.minWidth,
|
|
27
|
+
width = _ref.width,
|
|
28
|
+
title = _ref.title,
|
|
29
|
+
isMaxContentOverFlow = _ref.isMaxContentOverFlow,
|
|
30
|
+
callback = _ref.callback;
|
|
31
|
+
if (!minWidth && !width && isMaxContentOverFlow) {
|
|
32
|
+
var tempEl = document.createElement('div');
|
|
33
|
+
tempEl.style.display = 'inline-block';
|
|
34
|
+
document.body.appendChild(tempEl);
|
|
35
|
+
if ((0, _lodash.isFunction)(title)) {
|
|
36
|
+
var component = title();
|
|
37
|
+
_reactDom.default.render(component, tempEl);
|
|
38
|
+
} else if (isReactElement(title)) {
|
|
39
|
+
_reactDom.default.render(title, tempEl);
|
|
40
|
+
} else {
|
|
41
|
+
tempEl.innerHTML = title;
|
|
42
|
+
}
|
|
43
|
+
// 使用 requestAnimationFrame 确保在下一个浏览器重绘周期中获取宽度
|
|
44
|
+
requestAnimationFrame(function () {
|
|
45
|
+
var _width = tempEl.offsetWidth;
|
|
46
|
+
_reactDom.default.unmountComponentAtNode(tempEl);
|
|
47
|
+
tempEl.remove();
|
|
48
|
+
callback(_width);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var formatColumn = exports.formatColumn = function formatColumn(_ref2) {
|
|
53
|
+
var column = _ref2.column,
|
|
54
|
+
originalObj = _ref2.originalObj,
|
|
55
|
+
dataSourceObj = _ref2.dataSourceObj,
|
|
56
|
+
rowKey = _ref2.rowKey,
|
|
57
|
+
diffToolTip = _ref2.diffToolTip,
|
|
58
|
+
wrapToolTipProps = _ref2.wrapToolTipProps,
|
|
59
|
+
scroll = _ref2.scroll,
|
|
60
|
+
onUpdateMinWidth = _ref2.onUpdateMinWidth;
|
|
28
61
|
var title = column.title,
|
|
29
62
|
valueType = column.valueType,
|
|
30
63
|
_column$format = column.format,
|
|
@@ -43,7 +76,17 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
|
|
|
43
76
|
_column$originalDiffT = column.originalDiffTip,
|
|
44
77
|
originalDiffTip = _column$originalDiffT === void 0 ? true : _column$originalDiffT,
|
|
45
78
|
_column$toolTipProps = column.toolTipProps,
|
|
46
|
-
toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps
|
|
79
|
+
toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps,
|
|
80
|
+
minWidth = column.minWidth;
|
|
81
|
+
// 仅在 {x: 'max-content', y: 300 } 且 column无指定 width minWidth 情况下 才开启 minWidth的自动计算
|
|
82
|
+
var isMaxContentOverFlow = (0, _lodash.isObject)(scroll) ? (scroll === null || scroll === void 0 ? void 0 : scroll.x) === 'max-content' && Reflect.ownKeys(scroll).includes('y') : false;
|
|
83
|
+
calcMinWidth({
|
|
84
|
+
minWidth: minWidth,
|
|
85
|
+
width: width,
|
|
86
|
+
title: title,
|
|
87
|
+
isMaxContentOverFlow: isMaxContentOverFlow,
|
|
88
|
+
callback: onUpdateMinWidth
|
|
89
|
+
});
|
|
47
90
|
var _toolTipProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, toolTipProps), wrapToolTipProps);
|
|
48
91
|
var _originalDiffTip = diffToolTip !== null && diffToolTip !== void 0 ? diffToolTip : originalDiffTip;
|
|
49
92
|
// 前缀处理
|
|
@@ -71,6 +114,30 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
|
|
|
71
114
|
}
|
|
72
115
|
};
|
|
73
116
|
if (column === null || column === void 0 ? void 0 : column.render) {
|
|
117
|
+
if (!originalObj && Object.keys(originalObj !== null && originalObj !== void 0 ? originalObj : {}).length === 0) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
var originalRender = column.render; // 保存原始的 render 方法
|
|
121
|
+
// 自定义render 手动重载下
|
|
122
|
+
column.render = function (value, record, index) {
|
|
123
|
+
var _originalObj$record$r;
|
|
124
|
+
var isFn = (0, _lodash.isFunction)(originalRender);
|
|
125
|
+
var _value = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(value, record !== null && record !== void 0 ? record : {}, index) : undefined;
|
|
126
|
+
var originalValue = (0, _utils2.getOriginalValue)(value, record !== null && record !== void 0 ? record : {}, originalObj, rowKey, dataIndex);
|
|
127
|
+
var originalRenderValue = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(originalValue, (_originalObj$record$r = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r !== void 0 ? _originalObj$record$r : {}, index) : undefined;
|
|
128
|
+
return (0, _jsxRuntime.jsx)(_RenderColumn.default, {
|
|
129
|
+
valueType: valueType,
|
|
130
|
+
originalValue: originalValue === undefined ? undefined : originalRenderValue,
|
|
131
|
+
ellipsis: ellipsis,
|
|
132
|
+
width: width,
|
|
133
|
+
value: _value,
|
|
134
|
+
node: _value,
|
|
135
|
+
currentValue: _value,
|
|
136
|
+
originalDiffTip: _originalDiffTip,
|
|
137
|
+
toolTipProps: _toolTipProps,
|
|
138
|
+
minWidth: minWidth
|
|
139
|
+
});
|
|
140
|
+
};
|
|
74
141
|
return;
|
|
75
142
|
}
|
|
76
143
|
if (tooltip) {
|
|
@@ -114,7 +181,8 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
|
|
|
114
181
|
value: value,
|
|
115
182
|
currentValue: renderValue,
|
|
116
183
|
originalDiffTip: _originalDiffTip,
|
|
117
|
-
toolTipProps: _toolTipProps
|
|
184
|
+
toolTipProps: _toolTipProps,
|
|
185
|
+
minWidth: minWidth
|
|
118
186
|
});
|
|
119
187
|
};
|
|
120
188
|
// 千分位, 千分位带CNY前缀
|
|
@@ -144,7 +212,8 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
|
|
|
144
212
|
value: value,
|
|
145
213
|
currentValue: renderValue,
|
|
146
214
|
originalDiffTip: _originalDiffTip,
|
|
147
|
-
toolTipProps: _toolTipProps
|
|
215
|
+
toolTipProps: _toolTipProps,
|
|
216
|
+
minWidth: minWidth
|
|
148
217
|
});
|
|
149
218
|
};
|
|
150
219
|
} else if (['datePicker', 'date', 'dateTime', 'dateStartTime', 'dateEndTime', 'dateStartEndTime'].includes(valueType)) {
|
|
@@ -197,7 +266,8 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
|
|
|
197
266
|
value: value,
|
|
198
267
|
currentValue: renderValue,
|
|
199
268
|
originalDiffTip: _originalDiffTip,
|
|
200
|
-
toolTipProps: _toolTipProps
|
|
269
|
+
toolTipProps: _toolTipProps,
|
|
270
|
+
minWidth: minWidth
|
|
201
271
|
});
|
|
202
272
|
};
|
|
203
273
|
} else if (['enumName', 'enumCodeName'].includes(valueType)) {
|
|
@@ -235,7 +305,8 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
|
|
|
235
305
|
value: value,
|
|
236
306
|
currentValue: renderValue,
|
|
237
307
|
originalDiffTip: _originalDiffTip,
|
|
238
|
-
toolTipProps: _toolTipProps
|
|
308
|
+
toolTipProps: _toolTipProps,
|
|
309
|
+
minWidth: minWidth
|
|
239
310
|
});
|
|
240
311
|
};
|
|
241
312
|
} else if (precision || prefix || suffix) {
|
|
@@ -262,7 +333,8 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
|
|
|
262
333
|
value: value,
|
|
263
334
|
currentValue: renderValue,
|
|
264
335
|
originalDiffTip: _originalDiffTip,
|
|
265
|
-
toolTipProps: _toolTipProps
|
|
336
|
+
toolTipProps: _toolTipProps,
|
|
337
|
+
minWidth: minWidth
|
|
266
338
|
});
|
|
267
339
|
};
|
|
268
340
|
} else if (valueType === 'address') {
|
|
@@ -318,7 +390,8 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
|
|
|
318
390
|
node: value,
|
|
319
391
|
value: value,
|
|
320
392
|
currentValue: value,
|
|
321
|
-
toolTipProps: _toolTipProps
|
|
393
|
+
toolTipProps: _toolTipProps,
|
|
394
|
+
minWidth: minWidth
|
|
322
395
|
}), suffixNode(value, record, index)]
|
|
323
396
|
});
|
|
324
397
|
};
|
|
@@ -339,7 +412,8 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
|
|
|
339
412
|
value: value,
|
|
340
413
|
currentValue: value || '-',
|
|
341
414
|
originalDiffTip: _originalDiffTip,
|
|
342
|
-
toolTipProps: _toolTipProps
|
|
415
|
+
toolTipProps: _toolTipProps,
|
|
416
|
+
minWidth: minWidth
|
|
343
417
|
}), suffixNode(value, record, index)]
|
|
344
418
|
});
|
|
345
419
|
};
|
|
@@ -362,7 +436,8 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
|
|
|
362
436
|
value: value,
|
|
363
437
|
currentValue: value || '-',
|
|
364
438
|
originalDiffTip: _originalDiffTip,
|
|
365
|
-
toolTipProps: _toolTipProps
|
|
439
|
+
toolTipProps: _toolTipProps,
|
|
440
|
+
minWidth: minWidth
|
|
366
441
|
});
|
|
367
442
|
};
|
|
368
443
|
}
|
|
@@ -27,7 +27,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
27
27
|
originalValue = props.originalValue,
|
|
28
28
|
originalDiffTip = props.originalDiffTip,
|
|
29
29
|
_props$toolTipProps = props.toolTipProps,
|
|
30
|
-
toolTipProps = _props$toolTipProps === void 0 ? {} : _props$toolTipProps
|
|
30
|
+
toolTipProps = _props$toolTipProps === void 0 ? {} : _props$toolTipProps,
|
|
31
|
+
minWidth = props.minWidth;
|
|
31
32
|
var _useSetState = (0, _ahooks.useSetState)({
|
|
32
33
|
tooltip: false
|
|
33
34
|
}),
|
|
@@ -40,7 +41,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
40
41
|
if (ellipsis) {
|
|
41
42
|
renderNode = (0, _jsxRuntime.jsx)(Text, {
|
|
42
43
|
style: {
|
|
43
|
-
width: currentValue === '-' ? 32.5 : width
|
|
44
|
+
width: currentValue === '-' ? 32.5 : width,
|
|
45
|
+
minWidth: minWidth
|
|
44
46
|
},
|
|
45
47
|
ellipsis: {
|
|
46
48
|
tooltip: false
|
|
@@ -51,7 +53,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
51
53
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
52
54
|
className: "varied-cell",
|
|
53
55
|
style: {
|
|
54
|
-
width: width
|
|
56
|
+
width: width,
|
|
57
|
+
minWidth: minWidth
|
|
55
58
|
},
|
|
56
59
|
title: originalDiffTip ? (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
57
60
|
children: ["\u521D\u59CB\u503C\uFF1A", originalValue, (0, _jsxRuntime.jsx)("br", {}), ellipsis ? "\u5F53\u524D\u503C\uFF1A".concat(currentValue) : undefined]
|
|
@@ -66,7 +69,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
66
69
|
return (0, _jsxRuntime.jsx)("span", {
|
|
67
70
|
className: "varied-cell",
|
|
68
71
|
style: {
|
|
69
|
-
width: width
|
|
72
|
+
width: width,
|
|
73
|
+
minWidth: minWidth
|
|
70
74
|
},
|
|
71
75
|
children: renderNode
|
|
72
76
|
});
|
|
@@ -137,7 +141,12 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
137
141
|
}
|
|
138
142
|
}, toolTipProps);
|
|
139
143
|
if (!value) {
|
|
140
|
-
return
|
|
144
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
145
|
+
style: {
|
|
146
|
+
minWidth: minWidth
|
|
147
|
+
},
|
|
148
|
+
children: "-"
|
|
149
|
+
});
|
|
141
150
|
}
|
|
142
151
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
143
152
|
title: value,
|
|
@@ -150,7 +159,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
150
159
|
}, tooltipProps), {}, {
|
|
151
160
|
children: (0, _jsxRuntime.jsx)(Text, {
|
|
152
161
|
style: {
|
|
153
|
-
width: width
|
|
162
|
+
width: width,
|
|
163
|
+
minWidth: minWidth
|
|
154
164
|
},
|
|
155
165
|
ellipsis: true,
|
|
156
166
|
onMouseOver: handleMouseOver,
|
|
@@ -159,6 +169,11 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
159
169
|
})
|
|
160
170
|
}));
|
|
161
171
|
}
|
|
162
|
-
return
|
|
172
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
173
|
+
style: {
|
|
174
|
+
minWidth: minWidth
|
|
175
|
+
},
|
|
176
|
+
children: value || value === 0 ? node : '-'
|
|
177
|
+
});
|
|
163
178
|
};
|
|
164
179
|
var _default = exports.default = RenderColumn;
|
package/lib/ProTable/index.js
CHANGED
|
@@ -37,7 +37,7 @@ var defaultPage = exports.defaultPage = {
|
|
|
37
37
|
pageSize: 10
|
|
38
38
|
};
|
|
39
39
|
function ProTable(props) {
|
|
40
|
-
var _locale$ProTable, _curTableConfig$pathK;
|
|
40
|
+
var _locale$ProTable, _props$scroll, _curTableConfig$pathK;
|
|
41
41
|
var _ref = (0, _index.useProConfig)('globalConfig') || {},
|
|
42
42
|
configStorage = _ref.storage; // 获取全局缓存位置配置
|
|
43
43
|
var _ref2 = (0, _index.useProConfig)('ProTable') || {},
|
|
@@ -65,6 +65,9 @@ function ProTable(props) {
|
|
|
65
65
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
66
66
|
var _props$scrollFollowPa = props.scrollFollowParent,
|
|
67
67
|
scrollFollowParent = _props$scrollFollowPa === void 0 ? true : _props$scrollFollowPa;
|
|
68
|
+
var _scroll = (_props$scroll = props === null || props === void 0 ? void 0 : props.scroll) !== null && _props$scroll !== void 0 ? _props$scroll : {
|
|
69
|
+
x: 'max-content'
|
|
70
|
+
};
|
|
68
71
|
var wrapToolTipProps = {
|
|
69
72
|
getPopupContainer: scrollFollowParent ? function (triggerNode) {
|
|
70
73
|
return triggerNode.parentNode;
|
|
@@ -208,18 +211,22 @@ function ProTable(props) {
|
|
|
208
211
|
}).filter(function (item) {
|
|
209
212
|
return !(item === null || item === void 0 ? void 0 : item.delete);
|
|
210
213
|
});
|
|
211
|
-
newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item) {
|
|
214
|
+
newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item, index) {
|
|
212
215
|
(0, _FormatColumn.formatColumn)({
|
|
213
216
|
column: item,
|
|
214
217
|
originalObj: originalObj,
|
|
215
218
|
dataSourceObj: dataSourceObj,
|
|
216
219
|
rowKey: 'rowKey',
|
|
217
220
|
diffToolTip: toolTip,
|
|
218
|
-
wrapToolTipProps: wrapToolTipProps
|
|
221
|
+
wrapToolTipProps: wrapToolTipProps,
|
|
222
|
+
scroll: _scroll,
|
|
223
|
+
onUpdateMinWidth: function onUpdateMinWidth(w) {
|
|
224
|
+
curColumns[index].minWidth = w;
|
|
225
|
+
}
|
|
219
226
|
});
|
|
220
227
|
});
|
|
221
228
|
return newColumns;
|
|
222
|
-
}, [curColumns, handleResize]);
|
|
229
|
+
}, [curColumns, handleResize, _scroll]);
|
|
223
230
|
var _columns = (0, _react.useMemo)(function () {
|
|
224
231
|
return columns === null || columns === void 0 ? void 0 : columns.filter(function (item, index) {
|
|
225
232
|
var show = item.show;
|
|
@@ -232,6 +239,13 @@ function ProTable(props) {
|
|
|
232
239
|
return true;
|
|
233
240
|
});
|
|
234
241
|
}, [columns]);
|
|
242
|
+
var isExistPercentWidth = !!(_columns === null || _columns === void 0 ? void 0 : _columns.find(function (item) {
|
|
243
|
+
var _item$width;
|
|
244
|
+
return (item === null || item === void 0 ? void 0 : item.width) && typeof (item === null || item === void 0 ? void 0 : item.width) === 'string' && (item === null || item === void 0 ? void 0 : (_item$width = item.width) === null || _item$width === void 0 ? void 0 : _item$width.endsWith('%'));
|
|
245
|
+
}));
|
|
246
|
+
if (isExistPercentWidth) {
|
|
247
|
+
_scroll = props === null || props === void 0 ? void 0 : props.scroll;
|
|
248
|
+
}
|
|
235
249
|
var handleColumnConfig = /*#__PURE__*/function () {
|
|
236
250
|
var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(checkList) {
|
|
237
251
|
var newColumns, _columnConfig$onColum, catchColumns;
|
|
@@ -422,7 +436,8 @@ function ProTable(props) {
|
|
|
422
436
|
summary: summary,
|
|
423
437
|
dataSource: _dataSource
|
|
424
438
|
},
|
|
425
|
-
dataSource: _dataSource
|
|
439
|
+
dataSource: _dataSource,
|
|
440
|
+
scroll: _scroll
|
|
426
441
|
})), (0, _jsxRuntime.jsx)("span", {
|
|
427
442
|
className: "pro-table-resizable-line",
|
|
428
443
|
style: {
|
|
@@ -257,12 +257,14 @@
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
.@{ant-prefix}-table-
|
|
261
|
-
.@{ant-prefix}-table-
|
|
262
|
-
background: #d2fff4 !important;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
260
|
+
tbody.@{ant-prefix}-table-tbody {
|
|
261
|
+
tr.@{ant-prefix}-table-row.new-cell {
|
|
262
|
+
background: var(--zaui-contract-bg-add; #d2fff4) !important;
|
|
263
|
+
background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
|
|
264
|
+
|
|
265
|
+
td.@{ant-prefix}-table-cell {
|
|
266
|
+
background: var(--zaui-contract-bg-add; #d2fff4) !important;
|
|
267
|
+
background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
|
|
266
268
|
border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
|
|
267
269
|
}
|
|
268
270
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
"Android >= 4"
|
|
50
50
|
],
|
|
51
51
|
"resolutions": {
|
|
52
|
-
"@types/react": "^17.0.53"
|
|
52
|
+
"@types/react": "^17.0.53",
|
|
53
|
+
"mockjs/commander": "9.2.0"
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"@ant-design/icons": "^4.2.2",
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"@dnd-kit/sortable": "^7.0.2",
|
|
59
60
|
"@dnd-kit/utilities": "^3.2.1",
|
|
60
61
|
"@pansy/react-watermark": "^3.1.13",
|
|
61
|
-
"@zat-design/utils": "1.1.
|
|
62
|
+
"@zat-design/utils": "1.1.35",
|
|
62
63
|
"ahooks": "3.7.4",
|
|
63
64
|
"antd": "4.24.8",
|
|
64
65
|
"big.js": "^6.2.1",
|