@zat-design/sisyphus-react 3.8.2 → 3.8.3-beta.1
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/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
- package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
- package/coverage/lcov-report/src/.umi/core/index.html +206 -0
- package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
- package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
- package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
- package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
- package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
- package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
- package/coverage/lcov-report/src/.umi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
- package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
- package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
- package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
- package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
- 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 +134 -24
- 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 +133 -23
- 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
|
@@ -387,7 +387,7 @@
|
|
|
387
387
|
|
|
388
388
|
// textArea
|
|
389
389
|
.@{ant-prefix}-input-textarea > textarea {
|
|
390
|
-
background: @zaui-contract-bg;
|
|
390
|
+
background: @zaui-contract-bg !important;
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
.pro-form-view-container {
|
|
@@ -461,7 +461,7 @@
|
|
|
461
461
|
|
|
462
462
|
// textArea
|
|
463
463
|
.@{ant-prefix}-input-textarea > textarea {
|
|
464
|
-
background: @zaui-contract-bg-add;
|
|
464
|
+
background: @zaui-contract-bg-add !important;
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
|
|
@@ -472,3 +472,16 @@
|
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
+
|
|
476
|
+
.changed-tooltip {
|
|
477
|
+
.original-value-container {
|
|
478
|
+
.ant-space-item:nth-child(1) {
|
|
479
|
+
white-space: nowrap;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
.current-value-container {
|
|
483
|
+
.ant-space-item:nth-child(1) {
|
|
484
|
+
white-space: nowrap;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import { useRef, useState } from 'react';
|
|
3
|
-
import { isFunction, isEqualWith } from 'lodash';
|
|
4
|
-
import { customEqualForFun
|
|
3
|
+
import { isFunction, isEqualWith, get } from 'lodash';
|
|
4
|
+
import { customEqualForFun } from './index';
|
|
5
5
|
// 代理shouldUpdate事件, 执行函数值的[show, disabled], 当[show, disabled]与上一次值不相同时更新状态
|
|
6
6
|
var useShouldUpdate = function useShouldUpdate(props) {
|
|
7
7
|
var show = props.show,
|
|
@@ -20,7 +20,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
20
20
|
index = formItemProps.index,
|
|
21
21
|
namePath = formItemProps.namePath,
|
|
22
22
|
names = formItemProps.names,
|
|
23
|
-
|
|
23
|
+
dependNames = formItemProps.dependNames;
|
|
24
24
|
var timerRef = useRef();
|
|
25
25
|
var needClear = useRef(); // 是否需要执行清值操作
|
|
26
26
|
var showRef = useRef();
|
|
@@ -29,13 +29,14 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
29
29
|
var rulesRef = useRef();
|
|
30
30
|
var fieldPropsRef = useRef();
|
|
31
31
|
var originComponentRef = useRef();
|
|
32
|
+
var dependNamesRef = useRef();
|
|
32
33
|
var newComponent = originComponent || component; // 解决component默认赋值污染问题,需要使用originComponent
|
|
33
34
|
var _useState = useState({}),
|
|
34
35
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
36
|
reRender = _useState2[1];
|
|
36
37
|
var values = {};
|
|
37
38
|
// 不是动态函数直接返回
|
|
38
|
-
if (!isFunction(show) && !isFunction(disabled) && !isFunction(required) && !isFunction(rules) && !isFunction(fieldProps) && !isFunction(originComponent)) {
|
|
39
|
+
if (!(dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) && !isFunction(show) && !isFunction(disabled) && !isFunction(required) && !isFunction(rules) && !isFunction(fieldProps) && !isFunction(originComponent)) {
|
|
39
40
|
return {
|
|
40
41
|
shouldUpdate: _shouldUpdate,
|
|
41
42
|
show: show,
|
|
@@ -119,9 +120,22 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
119
120
|
} else {
|
|
120
121
|
fieldPropsRef.current = fieldProps;
|
|
121
122
|
}
|
|
123
|
+
if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
|
|
124
|
+
dependNamesRef.current = dependNames.map(function (name) {
|
|
125
|
+
return get(values, name);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
122
128
|
return {
|
|
123
129
|
shouldUpdate: function shouldUpdate(prevValues, currentValues) {
|
|
124
130
|
// @ts-ignore formList场景取当前行数据,不取shouldUpdate变更后值
|
|
131
|
+
if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
|
|
132
|
+
var curDependNamesValue = dependNames.map(function (name) {
|
|
133
|
+
return get(currentValues, name);
|
|
134
|
+
});
|
|
135
|
+
var dependNamesChanged = !isEqualWith(dependNamesRef.current, curDependNamesValue, customEqualForFun);
|
|
136
|
+
dependNamesRef.current = curDependNamesValue;
|
|
137
|
+
if (!dependNamesChanged) return false;
|
|
138
|
+
}
|
|
125
139
|
var _currentValues;
|
|
126
140
|
if (namePath) {
|
|
127
141
|
// formList场景values取当前行数据
|
|
@@ -182,11 +196,12 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
182
196
|
}
|
|
183
197
|
var equalRes = isEqualWith(rulesRef.current, _rules, customEqualForFun);
|
|
184
198
|
var proEqualRes = isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun);
|
|
185
|
-
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes
|
|
199
|
+
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes
|
|
186
200
|
// 值变更,需要同步更新函数式的fieldProps
|
|
187
201
|
// (isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues)) ||
|
|
188
202
|
// !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
|
|
189
|
-
equalDependencies(dependencies, prevValues, _currentValues)
|
|
203
|
+
// equalDependencies(dependencies, prevValues, _currentValues)
|
|
204
|
+
) {
|
|
190
205
|
showRef.current = _show;
|
|
191
206
|
disabledRef.current = _disabled;
|
|
192
207
|
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
|
|
@@ -5,20 +5,53 @@ 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
|
|
8
|
+
import ReactDOM from 'react-dom';
|
|
9
|
+
import { isEqual, isFunction, isString, isObject } from 'lodash';
|
|
9
10
|
import { tools } from '@zat-design/utils';
|
|
10
11
|
import TooltipTitle from '../TooltipTitle';
|
|
11
12
|
import RenderColumn from '../RenderColumn';
|
|
12
13
|
import { getDecimalDigits, getOriginalValue } from '../../utils';
|
|
13
14
|
import getEnumLabel from '../../../ProEnum/utils/getEnumLabel';
|
|
14
15
|
import ProForm from '../../../ProForm';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
var isReactElement = function isReactElement(element) {
|
|
17
|
+
return /*#__PURE__*/isValidElement(element);
|
|
18
|
+
};
|
|
19
|
+
var calcMinWidth = function calcMinWidth(_ref) {
|
|
20
|
+
var minWidth = _ref.minWidth,
|
|
21
|
+
width = _ref.width,
|
|
22
|
+
title = _ref.title,
|
|
23
|
+
isMaxContentOverFlow = _ref.isMaxContentOverFlow,
|
|
24
|
+
callback = _ref.callback;
|
|
25
|
+
if (!minWidth && !width && isMaxContentOverFlow) {
|
|
26
|
+
var tempEl = document.createElement('div');
|
|
27
|
+
tempEl.style.display = 'inline-block';
|
|
28
|
+
document.body.appendChild(tempEl);
|
|
29
|
+
if (isFunction(title)) {
|
|
30
|
+
var component = title();
|
|
31
|
+
ReactDOM.render(component, tempEl);
|
|
32
|
+
} else if (isReactElement(title)) {
|
|
33
|
+
ReactDOM.render(title, tempEl);
|
|
34
|
+
} else {
|
|
35
|
+
tempEl.innerHTML = title;
|
|
36
|
+
}
|
|
37
|
+
// 使用 requestAnimationFrame 确保在下一个浏览器重绘周期中获取宽度
|
|
38
|
+
requestAnimationFrame(function () {
|
|
39
|
+
var _width = tempEl.offsetWidth;
|
|
40
|
+
ReactDOM.unmountComponentAtNode(tempEl);
|
|
41
|
+
tempEl.remove();
|
|
42
|
+
callback(_width);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export var formatColumn = function formatColumn(_ref2) {
|
|
47
|
+
var column = _ref2.column,
|
|
48
|
+
originalObj = _ref2.originalObj,
|
|
49
|
+
dataSourceObj = _ref2.dataSourceObj,
|
|
50
|
+
rowKey = _ref2.rowKey,
|
|
51
|
+
diffToolTip = _ref2.diffToolTip,
|
|
52
|
+
wrapToolTipProps = _ref2.wrapToolTipProps,
|
|
53
|
+
scroll = _ref2.scroll,
|
|
54
|
+
onUpdateMinWidth = _ref2.onUpdateMinWidth;
|
|
22
55
|
var title = column.title,
|
|
23
56
|
valueType = column.valueType,
|
|
24
57
|
_column$format = column.format,
|
|
@@ -37,7 +70,17 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
37
70
|
_column$originalDiffT = column.originalDiffTip,
|
|
38
71
|
originalDiffTip = _column$originalDiffT === void 0 ? true : _column$originalDiffT,
|
|
39
72
|
_column$toolTipProps = column.toolTipProps,
|
|
40
|
-
toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps
|
|
73
|
+
toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps,
|
|
74
|
+
minWidth = column.minWidth;
|
|
75
|
+
// 仅在 {x: 'max-content', y: 300 } 且 column无指定 width minWidth 情况下 才开启 minWidth的自动计算
|
|
76
|
+
var isMaxContentOverFlow = isObject(scroll) ? (scroll === null || scroll === void 0 ? void 0 : scroll.x) === 'max-content' && Reflect.ownKeys(scroll).includes('y') : false;
|
|
77
|
+
calcMinWidth({
|
|
78
|
+
minWidth: minWidth,
|
|
79
|
+
width: width,
|
|
80
|
+
title: title,
|
|
81
|
+
isMaxContentOverFlow: isMaxContentOverFlow,
|
|
82
|
+
callback: onUpdateMinWidth
|
|
83
|
+
});
|
|
41
84
|
var _toolTipProps = _objectSpread(_objectSpread({}, toolTipProps), wrapToolTipProps);
|
|
42
85
|
var _originalDiffTip = diffToolTip !== null && diffToolTip !== void 0 ? diffToolTip : originalDiffTip;
|
|
43
86
|
// 前缀处理
|
|
@@ -65,6 +108,30 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
65
108
|
}
|
|
66
109
|
};
|
|
67
110
|
if (column === null || column === void 0 ? void 0 : column.render) {
|
|
111
|
+
if (!originalObj && Object.keys(originalObj !== null && originalObj !== void 0 ? originalObj : {}).length === 0) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
var originalRender = column.render; // 保存原始的 render 方法
|
|
115
|
+
// 自定义render 手动重载下
|
|
116
|
+
column.render = function (value, record, index) {
|
|
117
|
+
var _originalObj$record$r;
|
|
118
|
+
var isFn = isFunction(originalRender);
|
|
119
|
+
var _value = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(value, record !== null && record !== void 0 ? record : {}, index) : undefined;
|
|
120
|
+
var originalValue = getOriginalValue(value, record !== null && record !== void 0 ? record : {}, originalObj, rowKey, dataIndex);
|
|
121
|
+
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;
|
|
122
|
+
return _jsx(RenderColumn, {
|
|
123
|
+
valueType: valueType,
|
|
124
|
+
originalValue: originalValue === undefined ? undefined : originalRenderValue,
|
|
125
|
+
ellipsis: ellipsis,
|
|
126
|
+
width: width,
|
|
127
|
+
value: _value,
|
|
128
|
+
node: _value,
|
|
129
|
+
currentValue: _value,
|
|
130
|
+
originalDiffTip: _originalDiffTip,
|
|
131
|
+
toolTipProps: _toolTipProps,
|
|
132
|
+
minWidth: minWidth
|
|
133
|
+
});
|
|
134
|
+
};
|
|
68
135
|
return;
|
|
69
136
|
}
|
|
70
137
|
if (tooltip) {
|
|
@@ -93,7 +160,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
93
160
|
originalRenderValue = '-';
|
|
94
161
|
}
|
|
95
162
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
96
|
-
return
|
|
163
|
+
return _jsx("div", {
|
|
164
|
+
style: {
|
|
165
|
+
minWidth: minWidth
|
|
166
|
+
},
|
|
167
|
+
children: "-"
|
|
168
|
+
});
|
|
97
169
|
}
|
|
98
170
|
var node = _jsxs(_Space, {
|
|
99
171
|
size: 8,
|
|
@@ -108,7 +180,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
108
180
|
value: value,
|
|
109
181
|
currentValue: renderValue,
|
|
110
182
|
originalDiffTip: _originalDiffTip,
|
|
111
|
-
toolTipProps: _toolTipProps
|
|
183
|
+
toolTipProps: _toolTipProps,
|
|
184
|
+
minWidth: minWidth
|
|
112
185
|
});
|
|
113
186
|
};
|
|
114
187
|
// 千分位, 千分位带CNY前缀
|
|
@@ -127,7 +200,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
127
200
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
128
201
|
});
|
|
129
202
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
130
|
-
|
|
203
|
+
_jsx("div", {
|
|
204
|
+
style: {
|
|
205
|
+
minWidth: minWidth
|
|
206
|
+
},
|
|
207
|
+
children: "-"
|
|
208
|
+
});
|
|
131
209
|
}
|
|
132
210
|
return _jsx(RenderColumn, {
|
|
133
211
|
valueType: valueType,
|
|
@@ -138,7 +216,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
138
216
|
value: value,
|
|
139
217
|
currentValue: renderValue,
|
|
140
218
|
originalDiffTip: _originalDiffTip,
|
|
141
|
-
toolTipProps: _toolTipProps
|
|
219
|
+
toolTipProps: _toolTipProps,
|
|
220
|
+
minWidth: minWidth
|
|
142
221
|
});
|
|
143
222
|
};
|
|
144
223
|
} else if (['datePicker', 'date', 'dateTime', 'dateStartTime', 'dateEndTime', 'dateStartEndTime'].includes(valueType)) {
|
|
@@ -180,7 +259,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
180
259
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
181
260
|
});
|
|
182
261
|
if (!value && renderValue === originalRenderValue) {
|
|
183
|
-
|
|
262
|
+
_jsx("div", {
|
|
263
|
+
style: {
|
|
264
|
+
minWidth: minWidth
|
|
265
|
+
},
|
|
266
|
+
children: "-"
|
|
267
|
+
});
|
|
184
268
|
}
|
|
185
269
|
return _jsx(RenderColumn, {
|
|
186
270
|
valueType: valueType,
|
|
@@ -191,7 +275,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
191
275
|
value: value,
|
|
192
276
|
currentValue: renderValue,
|
|
193
277
|
originalDiffTip: _originalDiffTip,
|
|
194
|
-
toolTipProps: _toolTipProps
|
|
278
|
+
toolTipProps: _toolTipProps,
|
|
279
|
+
minWidth: minWidth
|
|
195
280
|
});
|
|
196
281
|
};
|
|
197
282
|
} else if (['enumName', 'enumCodeName'].includes(valueType)) {
|
|
@@ -229,7 +314,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
229
314
|
value: value,
|
|
230
315
|
currentValue: renderValue,
|
|
231
316
|
originalDiffTip: _originalDiffTip,
|
|
232
|
-
toolTipProps: _toolTipProps
|
|
317
|
+
toolTipProps: _toolTipProps,
|
|
318
|
+
minWidth: minWidth
|
|
233
319
|
});
|
|
234
320
|
};
|
|
235
321
|
} else if (precision || prefix || suffix) {
|
|
@@ -245,7 +331,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
245
331
|
originalRenderValue = '-';
|
|
246
332
|
}
|
|
247
333
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
248
|
-
|
|
334
|
+
_jsx("div", {
|
|
335
|
+
style: {
|
|
336
|
+
minWidth: minWidth
|
|
337
|
+
},
|
|
338
|
+
children: "-"
|
|
339
|
+
});
|
|
249
340
|
}
|
|
250
341
|
return _jsx(RenderColumn, {
|
|
251
342
|
valueType: valueType,
|
|
@@ -256,7 +347,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
256
347
|
value: value,
|
|
257
348
|
currentValue: renderValue,
|
|
258
349
|
originalDiffTip: _originalDiffTip,
|
|
259
|
-
toolTipProps: _toolTipProps
|
|
350
|
+
toolTipProps: _toolTipProps,
|
|
351
|
+
minWidth: minWidth
|
|
260
352
|
});
|
|
261
353
|
};
|
|
262
354
|
} else if (valueType === 'address') {
|
|
@@ -269,7 +361,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
269
361
|
return !!item;
|
|
270
362
|
})) === null || _realValue$filter === void 0 ? void 0 : _realValue$filter.length) === 0;
|
|
271
363
|
if (isEqual(value, originalValue) && isEmpty) {
|
|
272
|
-
|
|
364
|
+
_jsx("div", {
|
|
365
|
+
style: {
|
|
366
|
+
minWidth: minWidth
|
|
367
|
+
},
|
|
368
|
+
children: "-"
|
|
369
|
+
});
|
|
273
370
|
}
|
|
274
371
|
var className = classnames({
|
|
275
372
|
'varied-cell': originalValue !== undefined,
|
|
@@ -312,7 +409,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
312
409
|
node: value,
|
|
313
410
|
value: value,
|
|
314
411
|
currentValue: value,
|
|
315
|
-
toolTipProps: _toolTipProps
|
|
412
|
+
toolTipProps: _toolTipProps,
|
|
413
|
+
minWidth: minWidth
|
|
316
414
|
}), suffixNode(value, record, index)]
|
|
317
415
|
});
|
|
318
416
|
};
|
|
@@ -320,7 +418,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
320
418
|
column.render = function (value, record, index) {
|
|
321
419
|
var originalValue = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
|
322
420
|
if (!value && value !== 0 && value === originalValue) {
|
|
323
|
-
|
|
421
|
+
_jsx("div", {
|
|
422
|
+
style: {
|
|
423
|
+
minWidth: minWidth
|
|
424
|
+
},
|
|
425
|
+
children: "-"
|
|
426
|
+
});
|
|
324
427
|
}
|
|
325
428
|
return _jsxs(_Space, {
|
|
326
429
|
size: 8,
|
|
@@ -333,7 +436,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
333
436
|
value: value,
|
|
334
437
|
currentValue: value || '-',
|
|
335
438
|
originalDiffTip: _originalDiffTip,
|
|
336
|
-
toolTipProps: _toolTipProps
|
|
439
|
+
toolTipProps: _toolTipProps,
|
|
440
|
+
minWidth: minWidth
|
|
337
441
|
}), suffixNode(value, record, index)]
|
|
338
442
|
});
|
|
339
443
|
};
|
|
@@ -345,7 +449,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
345
449
|
children: [prefixNode(value, record, index), value, suffixNode(value, record, index)]
|
|
346
450
|
});
|
|
347
451
|
if (!value && value !== 0 && value === originalValue) {
|
|
348
|
-
|
|
452
|
+
_jsx("div", {
|
|
453
|
+
style: {
|
|
454
|
+
minWidth: minWidth
|
|
455
|
+
},
|
|
456
|
+
children: "-"
|
|
457
|
+
});
|
|
349
458
|
}
|
|
350
459
|
return _jsx(RenderColumn, {
|
|
351
460
|
valueType: valueType,
|
|
@@ -356,7 +465,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
356
465
|
value: value,
|
|
357
466
|
currentValue: value || '-',
|
|
358
467
|
originalDiffTip: _originalDiffTip,
|
|
359
|
-
toolTipProps: _toolTipProps
|
|
468
|
+
toolTipProps: _toolTipProps,
|
|
469
|
+
minWidth: minWidth
|
|
360
470
|
});
|
|
361
471
|
};
|
|
362
472
|
}
|
|
@@ -23,7 +23,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
23
23
|
originalValue = props.originalValue,
|
|
24
24
|
originalDiffTip = props.originalDiffTip,
|
|
25
25
|
_props$toolTipProps = props.toolTipProps,
|
|
26
|
-
toolTipProps = _props$toolTipProps === void 0 ? {} : _props$toolTipProps
|
|
26
|
+
toolTipProps = _props$toolTipProps === void 0 ? {} : _props$toolTipProps,
|
|
27
|
+
minWidth = props.minWidth;
|
|
27
28
|
var _useSetState = useSetState({
|
|
28
29
|
tooltip: false
|
|
29
30
|
}),
|
|
@@ -36,7 +37,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
36
37
|
if (ellipsis) {
|
|
37
38
|
renderNode = _jsx(Text, {
|
|
38
39
|
style: {
|
|
39
|
-
width: currentValue === '-' ? 32.5 : width
|
|
40
|
+
width: currentValue === '-' ? 32.5 : width,
|
|
41
|
+
minWidth: minWidth
|
|
40
42
|
},
|
|
41
43
|
ellipsis: {
|
|
42
44
|
tooltip: false
|
|
@@ -47,7 +49,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
47
49
|
return _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
48
50
|
className: "varied-cell",
|
|
49
51
|
style: {
|
|
50
|
-
width: width
|
|
52
|
+
width: width,
|
|
53
|
+
minWidth: minWidth
|
|
51
54
|
},
|
|
52
55
|
title: originalDiffTip ? _jsxs(_Fragment, {
|
|
53
56
|
children: ["\u521D\u59CB\u503C\uFF1A", originalValue, _jsx("br", {}), ellipsis ? "\u5F53\u524D\u503C\uFF1A".concat(currentValue) : undefined]
|
|
@@ -62,7 +65,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
62
65
|
return _jsx("span", {
|
|
63
66
|
className: "varied-cell",
|
|
64
67
|
style: {
|
|
65
|
-
width: width
|
|
68
|
+
width: width,
|
|
69
|
+
minWidth: minWidth
|
|
66
70
|
},
|
|
67
71
|
children: renderNode
|
|
68
72
|
});
|
|
@@ -133,7 +137,12 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
133
137
|
}
|
|
134
138
|
}, toolTipProps);
|
|
135
139
|
if (!value) {
|
|
136
|
-
return
|
|
140
|
+
return _jsx("div", {
|
|
141
|
+
style: {
|
|
142
|
+
minWidth: minWidth
|
|
143
|
+
},
|
|
144
|
+
children: "-"
|
|
145
|
+
});
|
|
137
146
|
}
|
|
138
147
|
return _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
139
148
|
title: value,
|
|
@@ -146,7 +155,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
146
155
|
}, tooltipProps), {}, {
|
|
147
156
|
children: _jsx(Text, {
|
|
148
157
|
style: {
|
|
149
|
-
width: width
|
|
158
|
+
width: width,
|
|
159
|
+
minWidth: minWidth
|
|
150
160
|
},
|
|
151
161
|
ellipsis: true,
|
|
152
162
|
onMouseOver: handleMouseOver,
|
|
@@ -155,6 +165,11 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
155
165
|
})
|
|
156
166
|
}));
|
|
157
167
|
}
|
|
158
|
-
return
|
|
168
|
+
return _jsx("div", {
|
|
169
|
+
style: {
|
|
170
|
+
minWidth: minWidth
|
|
171
|
+
},
|
|
172
|
+
children: value || value === 0 ? node : '-'
|
|
173
|
+
});
|
|
159
174
|
};
|
|
160
175
|
export default RenderColumn;
|
package/es/ProTable/index.js
CHANGED
|
@@ -30,7 +30,7 @@ export var defaultPage = {
|
|
|
30
30
|
pageSize: 10
|
|
31
31
|
};
|
|
32
32
|
function ProTable(props) {
|
|
33
|
-
var _locale$ProTable, _curTableConfig$pathK;
|
|
33
|
+
var _locale$ProTable, _props$scroll, _curTableConfig$pathK;
|
|
34
34
|
var _ref = useProConfig('globalConfig') || {},
|
|
35
35
|
configStorage = _ref.storage; // 获取全局缓存位置配置
|
|
36
36
|
var _ref2 = useProConfig('ProTable') || {},
|
|
@@ -58,6 +58,9 @@ function ProTable(props) {
|
|
|
58
58
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
59
59
|
var _props$scrollFollowPa = props.scrollFollowParent,
|
|
60
60
|
scrollFollowParent = _props$scrollFollowPa === void 0 ? true : _props$scrollFollowPa;
|
|
61
|
+
var _scroll = (_props$scroll = props === null || props === void 0 ? void 0 : props.scroll) !== null && _props$scroll !== void 0 ? _props$scroll : {
|
|
62
|
+
x: 'max-content'
|
|
63
|
+
};
|
|
61
64
|
var wrapToolTipProps = {
|
|
62
65
|
getPopupContainer: scrollFollowParent ? function (triggerNode) {
|
|
63
66
|
return triggerNode.parentNode;
|
|
@@ -201,18 +204,22 @@ function ProTable(props) {
|
|
|
201
204
|
}).filter(function (item) {
|
|
202
205
|
return !(item === null || item === void 0 ? void 0 : item.delete);
|
|
203
206
|
});
|
|
204
|
-
newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item) {
|
|
207
|
+
newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item, index) {
|
|
205
208
|
formatColumn({
|
|
206
209
|
column: item,
|
|
207
210
|
originalObj: originalObj,
|
|
208
211
|
dataSourceObj: dataSourceObj,
|
|
209
212
|
rowKey: 'rowKey',
|
|
210
213
|
diffToolTip: toolTip,
|
|
211
|
-
wrapToolTipProps: wrapToolTipProps
|
|
214
|
+
wrapToolTipProps: wrapToolTipProps,
|
|
215
|
+
scroll: _scroll,
|
|
216
|
+
onUpdateMinWidth: function onUpdateMinWidth(w) {
|
|
217
|
+
curColumns[index].minWidth = w;
|
|
218
|
+
}
|
|
212
219
|
});
|
|
213
220
|
});
|
|
214
221
|
return newColumns;
|
|
215
|
-
}, [curColumns, handleResize]);
|
|
222
|
+
}, [curColumns, handleResize, _scroll]);
|
|
216
223
|
var _columns = useMemo(function () {
|
|
217
224
|
return columns === null || columns === void 0 ? void 0 : columns.filter(function (item, index) {
|
|
218
225
|
var show = item.show;
|
|
@@ -225,6 +232,13 @@ function ProTable(props) {
|
|
|
225
232
|
return true;
|
|
226
233
|
});
|
|
227
234
|
}, [columns]);
|
|
235
|
+
var isExistPercentWidth = !!(_columns === null || _columns === void 0 ? void 0 : _columns.find(function (item) {
|
|
236
|
+
var _item$width;
|
|
237
|
+
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('%'));
|
|
238
|
+
}));
|
|
239
|
+
if (isExistPercentWidth) {
|
|
240
|
+
_scroll = props === null || props === void 0 ? void 0 : props.scroll;
|
|
241
|
+
}
|
|
228
242
|
var handleColumnConfig = /*#__PURE__*/function () {
|
|
229
243
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(checkList) {
|
|
230
244
|
var newColumns, _columnConfig$onColum, catchColumns;
|
|
@@ -415,7 +429,8 @@ function ProTable(props) {
|
|
|
415
429
|
summary: summary,
|
|
416
430
|
dataSource: _dataSource
|
|
417
431
|
},
|
|
418
|
-
dataSource: _dataSource
|
|
432
|
+
dataSource: _dataSource,
|
|
433
|
+
scroll: _scroll
|
|
419
434
|
})), _jsx("span", {
|
|
420
435
|
className: "pro-table-resizable-line",
|
|
421
436
|
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
|
}
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -16,7 +17,7 @@ var _lodash = require("lodash");
|
|
|
16
17
|
var _diffOriginal = require("../../../ProForm/utils/diffOriginal");
|
|
17
18
|
var _ProConfigProvider = require("../../../ProConfigProvider");
|
|
18
19
|
var _utils = require("../../../utils");
|
|
19
|
-
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "valuePropName"];
|
|
20
|
+
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName"];
|
|
20
21
|
var toNamePath = function toNamePath(name) {
|
|
21
22
|
if (Array.isArray(name)) {
|
|
22
23
|
return name;
|
|
@@ -70,6 +71,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
|
70
71
|
}) : (0, _lodash.get)(originalValues, originalName);
|
|
71
72
|
};
|
|
72
73
|
var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
74
|
+
var _getValueProps;
|
|
73
75
|
var name = props.name,
|
|
74
76
|
names = props.names,
|
|
75
77
|
namesStr = props.namesStr,
|
|
@@ -84,6 +86,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
84
86
|
children = props.children,
|
|
85
87
|
type = props.type,
|
|
86
88
|
normalize = props.normalize,
|
|
89
|
+
getValueProps = props.getValueProps,
|
|
87
90
|
_props$valuePropName = props.valuePropName,
|
|
88
91
|
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
89
92
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
@@ -116,7 +119,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
116
119
|
var isAdd = diffType === 'add';
|
|
117
120
|
var isChanged = diffType === 'changed';
|
|
118
121
|
if (!isWatch || noChange) {
|
|
119
|
-
return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0,
|
|
122
|
+
return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest));
|
|
120
123
|
}
|
|
121
124
|
var diffClassName = (0, _classnames.default)({
|
|
122
125
|
'pro-form-item-changed': isChanged,
|
|
@@ -131,16 +134,14 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
131
134
|
return target.parentElement;
|
|
132
135
|
},
|
|
133
136
|
title: (0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
134
|
-
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0,
|
|
137
|
+
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)({
|
|
135
138
|
// @ts-ignore
|
|
136
|
-
isView: true
|
|
137
|
-
|
|
138
|
-
checked: type === 'Switch' ? originalValue : undefined
|
|
139
|
-
})) : undefined]
|
|
139
|
+
isView: true
|
|
140
|
+
}, valuePropName, getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : props[valuePropName]), "checked", type === 'Switch' ? originalValue : undefined))) : undefined]
|
|
140
141
|
}),
|
|
141
142
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
142
143
|
className: diffClassName,
|
|
143
|
-
children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0,
|
|
144
|
+
children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest)) : undefined
|
|
144
145
|
})
|
|
145
146
|
});
|
|
146
147
|
};
|
|
@@ -49,7 +49,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
49
49
|
}
|
|
50
50
|
var logDebug = function logDebug(msg) {
|
|
51
51
|
if (props.debugger) {
|
|
52
|
-
console.
|
|
52
|
+
console.warn('proEnum:', msg);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
var enumRes = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|