@zat-design/sisyphus-react 3.8.2 → 3.8.3-beta.10
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 +32 -8
- package/dist/less.esm.css +32 -8
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +22 -7
- package/es/ProEditTable/components/RenderField/index.js +9 -1
- package/es/ProEditTable/index.js +0 -1
- package/es/ProEditTable/propsType.d.ts +0 -1
- package/es/ProEditTable/utils/index.js +10 -3
- 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/FormList/components/BlockFields.d.ts +2 -0
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
- package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
- package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/es/ProForm/components/combination/FormList/index.js +14 -3
- 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/combination/ProCascader/index.js +20 -13
- package/es/ProForm/components/combination/ProModalSelect/index.js +17 -3
- package/es/ProForm/components/render/ChangedWrapper.js +20 -2
- package/es/ProForm/components/render/Render.js +6 -3
- package/es/ProForm/components/render/RenderFields.js +4 -2
- package/es/ProForm/components/render/propsType.d.ts +4 -0
- package/es/ProForm/propsType.d.ts +1 -0
- package/es/ProForm/style/index.less +22 -2
- package/es/ProForm/utils/diffOriginal.js +14 -2
- package/es/ProForm/utils/useShouldUpdate.js +20 -13
- package/es/ProTable/components/FormatColumn/index.d.ts +4 -1
- package/es/ProTable/components/FormatColumn/index.js +180 -30
- package/es/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/es/ProTable/components/RenderColumn/index.js +28 -10
- package/es/ProTable/index.js +26 -10
- package/es/ProTable/propsType.d.ts +4 -0
- package/es/ProTable/style/index.less +22 -6
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +25 -10
- package/lib/ProEditTable/components/RenderField/index.js +9 -1
- package/lib/ProEditTable/index.js +0 -1
- package/lib/ProEditTable/propsType.d.ts +0 -1
- package/lib/ProEditTable/utils/index.js +10 -3
- 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/FormList/components/BlockFields.d.ts +2 -0
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
- package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/lib/ProForm/components/combination/FormList/index.js +14 -3
- 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/combination/ProCascader/index.js +20 -13
- package/lib/ProForm/components/combination/ProModalSelect/index.js +17 -3
- package/lib/ProForm/components/render/ChangedWrapper.js +20 -2
- package/lib/ProForm/components/render/Render.js +6 -3
- package/lib/ProForm/components/render/RenderFields.js +4 -2
- package/lib/ProForm/components/render/propsType.d.ts +4 -0
- package/lib/ProForm/propsType.d.ts +1 -0
- package/lib/ProForm/style/index.less +22 -2
- package/lib/ProForm/utils/diffOriginal.js +13 -1
- package/lib/ProForm/utils/useShouldUpdate.js +18 -11
- package/lib/ProTable/components/FormatColumn/index.d.ts +4 -1
- package/lib/ProTable/components/FormatColumn/index.js +179 -29
- package/lib/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/lib/ProTable/components/RenderColumn/index.js +27 -9
- package/lib/ProTable/index.js +26 -10
- package/lib/ProTable/propsType.d.ts +4 -0
- package/lib/ProTable/style/index.less +22 -6
- package/package.json +4 -3
- package/.vscode/extensions.json +0 -5
|
@@ -5,20 +5,54 @@ 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,
|
|
55
|
+
isInNewRow = _ref2.isInNewRow;
|
|
22
56
|
var title = column.title,
|
|
23
57
|
valueType = column.valueType,
|
|
24
58
|
_column$format = column.format,
|
|
@@ -37,7 +71,18 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
37
71
|
_column$originalDiffT = column.originalDiffTip,
|
|
38
72
|
originalDiffTip = _column$originalDiffT === void 0 ? true : _column$originalDiffT,
|
|
39
73
|
_column$toolTipProps = column.toolTipProps,
|
|
40
|
-
toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps
|
|
74
|
+
toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps,
|
|
75
|
+
minWidth = column.minWidth,
|
|
76
|
+
onDiff = column.onDiff;
|
|
77
|
+
// 仅在 {x: 'max-content', y: 300 } 且 column无指定 width minWidth 情况下 才开启 minWidth的自动计算
|
|
78
|
+
var isMaxContentOverFlow = isObject(scroll) ? (scroll === null || scroll === void 0 ? void 0 : scroll.x) === 'max-content' && Reflect.ownKeys(scroll).includes('y') : false;
|
|
79
|
+
calcMinWidth({
|
|
80
|
+
minWidth: minWidth,
|
|
81
|
+
width: width,
|
|
82
|
+
title: title,
|
|
83
|
+
isMaxContentOverFlow: isMaxContentOverFlow,
|
|
84
|
+
callback: onUpdateMinWidth
|
|
85
|
+
});
|
|
41
86
|
var _toolTipProps = _objectSpread(_objectSpread({}, toolTipProps), wrapToolTipProps);
|
|
42
87
|
var _originalDiffTip = diffToolTip !== null && diffToolTip !== void 0 ? diffToolTip : originalDiffTip;
|
|
43
88
|
// 前缀处理
|
|
@@ -65,6 +110,42 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
65
110
|
}
|
|
66
111
|
};
|
|
67
112
|
if (column === null || column === void 0 ? void 0 : column.render) {
|
|
113
|
+
if (!originalObj && Object.keys(originalObj !== null && originalObj !== void 0 ? originalObj : {}).length === 0 && !onDiff) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
var originalRender = column.render; // 保存原始的 render 方法
|
|
117
|
+
// 自定义render 手动重载下
|
|
118
|
+
column.render = function (value, record, index) {
|
|
119
|
+
var _originalObj$record$r;
|
|
120
|
+
var isFn = isFunction(originalRender);
|
|
121
|
+
var _value = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(value, record !== null && record !== void 0 ? record : {}, index) : null;
|
|
122
|
+
var originalValue = getOriginalValue(value, record !== null && record !== void 0 ? record : {}, originalObj, rowKey, dataIndex);
|
|
123
|
+
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) : null;
|
|
124
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
125
|
+
// 把比对结果告诉我
|
|
126
|
+
if (onDiff) {
|
|
127
|
+
var isDiff = onDiff({
|
|
128
|
+
value: record,
|
|
129
|
+
originValue: originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]
|
|
130
|
+
});
|
|
131
|
+
if (!isDiff) {
|
|
132
|
+
originalValue = null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return _jsx(RenderColumn, {
|
|
136
|
+
valueType: valueType,
|
|
137
|
+
originalValue: !originalValue && originalValue !== 0 ? null : originalRenderValue,
|
|
138
|
+
ellipsis: ellipsis,
|
|
139
|
+
width: width,
|
|
140
|
+
value: _value,
|
|
141
|
+
node: _value,
|
|
142
|
+
currentValue: _value,
|
|
143
|
+
originalDiffTip: _originalDiffTip,
|
|
144
|
+
toolTipProps: _toolTipProps,
|
|
145
|
+
minWidth: minWidth,
|
|
146
|
+
isInNewRowFlag: isInNewRowFlag
|
|
147
|
+
});
|
|
148
|
+
};
|
|
68
149
|
return;
|
|
69
150
|
}
|
|
70
151
|
if (tooltip) {
|
|
@@ -93,12 +174,18 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
93
174
|
originalRenderValue = '-';
|
|
94
175
|
}
|
|
95
176
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
96
|
-
return
|
|
177
|
+
return _jsx("div", {
|
|
178
|
+
style: {
|
|
179
|
+
minWidth: minWidth
|
|
180
|
+
},
|
|
181
|
+
children: "-"
|
|
182
|
+
});
|
|
97
183
|
}
|
|
98
184
|
var node = _jsxs(_Space, {
|
|
99
185
|
size: 8,
|
|
100
186
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
101
187
|
});
|
|
188
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
102
189
|
return _jsx(RenderColumn, {
|
|
103
190
|
valueType: valueType,
|
|
104
191
|
originalValue: originalValue === undefined ? undefined : originalRenderValue,
|
|
@@ -108,7 +195,9 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
108
195
|
value: value,
|
|
109
196
|
currentValue: renderValue,
|
|
110
197
|
originalDiffTip: _originalDiffTip,
|
|
111
|
-
toolTipProps: _toolTipProps
|
|
198
|
+
toolTipProps: _toolTipProps,
|
|
199
|
+
minWidth: minWidth,
|
|
200
|
+
isInNewRowFlag: isInNewRowFlag
|
|
112
201
|
});
|
|
113
202
|
};
|
|
114
203
|
// 千分位, 千分位带CNY前缀
|
|
@@ -127,8 +216,14 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
127
216
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
128
217
|
});
|
|
129
218
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
130
|
-
|
|
219
|
+
_jsx("div", {
|
|
220
|
+
style: {
|
|
221
|
+
minWidth: minWidth
|
|
222
|
+
},
|
|
223
|
+
children: "-"
|
|
224
|
+
});
|
|
131
225
|
}
|
|
226
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
132
227
|
return _jsx(RenderColumn, {
|
|
133
228
|
valueType: valueType,
|
|
134
229
|
originalValue: originalValue === undefined ? undefined : originalRenderValue,
|
|
@@ -138,7 +233,9 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
138
233
|
value: value,
|
|
139
234
|
currentValue: renderValue,
|
|
140
235
|
originalDiffTip: _originalDiffTip,
|
|
141
|
-
toolTipProps: _toolTipProps
|
|
236
|
+
toolTipProps: _toolTipProps,
|
|
237
|
+
minWidth: minWidth,
|
|
238
|
+
isInNewRowFlag: isInNewRowFlag
|
|
142
239
|
});
|
|
143
240
|
};
|
|
144
241
|
} else if (['datePicker', 'date', 'dateTime', 'dateStartTime', 'dateEndTime', 'dateStartEndTime'].includes(valueType)) {
|
|
@@ -180,8 +277,14 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
180
277
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
181
278
|
});
|
|
182
279
|
if (!value && renderValue === originalRenderValue) {
|
|
183
|
-
|
|
280
|
+
_jsx("div", {
|
|
281
|
+
style: {
|
|
282
|
+
minWidth: minWidth
|
|
283
|
+
},
|
|
284
|
+
children: "-"
|
|
285
|
+
});
|
|
184
286
|
}
|
|
287
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
185
288
|
return _jsx(RenderColumn, {
|
|
186
289
|
valueType: valueType,
|
|
187
290
|
originalValue: originalValue === undefined ? undefined : originalRenderValue,
|
|
@@ -191,7 +294,9 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
191
294
|
value: value,
|
|
192
295
|
currentValue: renderValue,
|
|
193
296
|
originalDiffTip: _originalDiffTip,
|
|
194
|
-
toolTipProps: _toolTipProps
|
|
297
|
+
toolTipProps: _toolTipProps,
|
|
298
|
+
minWidth: minWidth,
|
|
299
|
+
isInNewRowFlag: isInNewRowFlag
|
|
195
300
|
});
|
|
196
301
|
};
|
|
197
302
|
} else if (['enumName', 'enumCodeName'].includes(valueType)) {
|
|
@@ -220,6 +325,7 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
220
325
|
size: 8,
|
|
221
326
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
222
327
|
});
|
|
328
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
223
329
|
return _jsx(RenderColumn, {
|
|
224
330
|
valueType: valueType,
|
|
225
331
|
originalValue: originalValue === undefined ? undefined : originalRenderValue,
|
|
@@ -229,7 +335,9 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
229
335
|
value: value,
|
|
230
336
|
currentValue: renderValue,
|
|
231
337
|
originalDiffTip: _originalDiffTip,
|
|
232
|
-
toolTipProps: _toolTipProps
|
|
338
|
+
toolTipProps: _toolTipProps,
|
|
339
|
+
minWidth: minWidth,
|
|
340
|
+
isInNewRowFlag: isInNewRowFlag
|
|
233
341
|
});
|
|
234
342
|
};
|
|
235
343
|
} else if (precision || prefix || suffix) {
|
|
@@ -245,8 +353,14 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
245
353
|
originalRenderValue = '-';
|
|
246
354
|
}
|
|
247
355
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
248
|
-
|
|
356
|
+
_jsx("div", {
|
|
357
|
+
style: {
|
|
358
|
+
minWidth: minWidth
|
|
359
|
+
},
|
|
360
|
+
children: "-"
|
|
361
|
+
});
|
|
249
362
|
}
|
|
363
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
250
364
|
return _jsx(RenderColumn, {
|
|
251
365
|
valueType: valueType,
|
|
252
366
|
originalValue: originalValue === undefined ? undefined : originalRenderValue,
|
|
@@ -256,7 +370,9 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
256
370
|
value: value,
|
|
257
371
|
currentValue: renderValue,
|
|
258
372
|
originalDiffTip: _originalDiffTip,
|
|
259
|
-
toolTipProps: _toolTipProps
|
|
373
|
+
toolTipProps: _toolTipProps,
|
|
374
|
+
minWidth: minWidth,
|
|
375
|
+
isInNewRowFlag: isInNewRowFlag
|
|
260
376
|
});
|
|
261
377
|
};
|
|
262
378
|
} else if (valueType === 'address') {
|
|
@@ -269,7 +385,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
269
385
|
return !!item;
|
|
270
386
|
})) === null || _realValue$filter === void 0 ? void 0 : _realValue$filter.length) === 0;
|
|
271
387
|
if (isEqual(value, originalValue) && isEmpty) {
|
|
272
|
-
|
|
388
|
+
_jsx("div", {
|
|
389
|
+
style: {
|
|
390
|
+
minWidth: minWidth
|
|
391
|
+
},
|
|
392
|
+
children: "-"
|
|
393
|
+
});
|
|
273
394
|
}
|
|
274
395
|
var className = classnames({
|
|
275
396
|
'varied-cell': originalValue !== undefined,
|
|
@@ -287,21 +408,32 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
287
408
|
code: code,
|
|
288
409
|
value: originalRealValue
|
|
289
410
|
});
|
|
290
|
-
|
|
411
|
+
var renderNode = _jsx(ProForm.ProCascader, {
|
|
291
412
|
className: className,
|
|
292
413
|
isView: true,
|
|
293
414
|
mode: "address",
|
|
294
415
|
code: code,
|
|
295
416
|
value: realValue,
|
|
296
|
-
tooltip:
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
417
|
+
tooltip: false
|
|
418
|
+
});
|
|
419
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
420
|
+
return _jsx(RenderColumn, {
|
|
421
|
+
valueType: valueType,
|
|
422
|
+
originalValue: originalRealValue === undefined ? undefined : originalRenderValue,
|
|
423
|
+
ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : true,
|
|
424
|
+
width: width,
|
|
425
|
+
node: renderNode,
|
|
426
|
+
value: renderValue,
|
|
427
|
+
currentValue: renderValue,
|
|
428
|
+
originalDiffTip: _originalDiffTip,
|
|
429
|
+
toolTipProps: _toolTipProps,
|
|
430
|
+
minWidth: minWidth,
|
|
431
|
+
isInNewRowFlag: isInNewRowFlag
|
|
301
432
|
});
|
|
302
433
|
};
|
|
303
434
|
} else if (copyable) {
|
|
304
435
|
column.render = function (value, record, index) {
|
|
436
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
305
437
|
return _jsxs(_Space, {
|
|
306
438
|
size: 8,
|
|
307
439
|
children: [prefixNode(value, record, index), _jsx(RenderColumn, {
|
|
@@ -312,7 +444,9 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
312
444
|
node: value,
|
|
313
445
|
value: value,
|
|
314
446
|
currentValue: value,
|
|
315
|
-
toolTipProps: _toolTipProps
|
|
447
|
+
toolTipProps: _toolTipProps,
|
|
448
|
+
minWidth: minWidth,
|
|
449
|
+
isInNewRowFlag: isInNewRowFlag
|
|
316
450
|
}), suffixNode(value, record, index)]
|
|
317
451
|
});
|
|
318
452
|
};
|
|
@@ -320,8 +454,14 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
320
454
|
column.render = function (value, record, index) {
|
|
321
455
|
var originalValue = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
|
322
456
|
if (!value && value !== 0 && value === originalValue) {
|
|
323
|
-
|
|
457
|
+
_jsx("div", {
|
|
458
|
+
style: {
|
|
459
|
+
minWidth: minWidth
|
|
460
|
+
},
|
|
461
|
+
children: "-"
|
|
462
|
+
});
|
|
324
463
|
}
|
|
464
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
325
465
|
return _jsxs(_Space, {
|
|
326
466
|
size: 8,
|
|
327
467
|
children: [prefixNode(value, record, index), _jsx(RenderColumn, {
|
|
@@ -333,7 +473,9 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
333
473
|
value: value,
|
|
334
474
|
currentValue: value || '-',
|
|
335
475
|
originalDiffTip: _originalDiffTip,
|
|
336
|
-
toolTipProps: _toolTipProps
|
|
476
|
+
toolTipProps: _toolTipProps,
|
|
477
|
+
minWidth: minWidth,
|
|
478
|
+
isInNewRowFlag: isInNewRowFlag
|
|
337
479
|
}), suffixNode(value, record, index)]
|
|
338
480
|
});
|
|
339
481
|
};
|
|
@@ -345,8 +487,14 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
345
487
|
children: [prefixNode(value, record, index), value, suffixNode(value, record, index)]
|
|
346
488
|
});
|
|
347
489
|
if (!value && value !== 0 && value === originalValue) {
|
|
348
|
-
|
|
490
|
+
_jsx("div", {
|
|
491
|
+
style: {
|
|
492
|
+
minWidth: minWidth
|
|
493
|
+
},
|
|
494
|
+
children: "-"
|
|
495
|
+
});
|
|
349
496
|
}
|
|
497
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
350
498
|
return _jsx(RenderColumn, {
|
|
351
499
|
valueType: valueType,
|
|
352
500
|
originalValue: originalValue === undefined ? undefined : originalValue || '-',
|
|
@@ -356,7 +504,9 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
356
504
|
value: value,
|
|
357
505
|
currentValue: value || '-',
|
|
358
506
|
originalDiffTip: _originalDiffTip,
|
|
359
|
-
toolTipProps: _toolTipProps
|
|
507
|
+
toolTipProps: _toolTipProps,
|
|
508
|
+
minWidth: minWidth,
|
|
509
|
+
isInNewRowFlag: isInNewRowFlag
|
|
360
510
|
});
|
|
361
511
|
};
|
|
362
512
|
}
|
|
@@ -11,6 +11,8 @@ interface Props {
|
|
|
11
11
|
width?: number | string;
|
|
12
12
|
originalValue?: any;
|
|
13
13
|
toolTipProps?: TooltipProps & React.RefAttributes<unknown>;
|
|
14
|
+
minWidth?: number;
|
|
15
|
+
isInNewRowFlag?: boolean;
|
|
14
16
|
}
|
|
15
17
|
declare const RenderColumn: FC<Props>;
|
|
16
18
|
export default RenderColumn;
|
|
@@ -4,7 +4,7 @@ import _Tooltip from "antd/es/tooltip";
|
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
import "antd/es/typography/style";
|
|
6
6
|
import _Typography from "antd/es/typography";
|
|
7
|
-
import { jsx as _jsx,
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
8
|
import { useSetState } from 'ahooks';
|
|
9
9
|
import { CheckOutlined } from '@ant-design/icons';
|
|
10
10
|
import { ReactSVG } from 'react-svg';
|
|
@@ -23,20 +23,23 @@ 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,
|
|
28
|
+
isInNewRowFlag = props.isInNewRowFlag;
|
|
27
29
|
var _useSetState = useSetState({
|
|
28
30
|
tooltip: false
|
|
29
31
|
}),
|
|
30
32
|
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
31
33
|
tooltip = _useSetState2[0].tooltip,
|
|
32
34
|
setState = _useSetState2[1];
|
|
33
|
-
if (originalValue
|
|
35
|
+
if ((originalValue || originalValue === 0) && !isInNewRowFlag) {
|
|
34
36
|
var renderNode = value ? node : '-';
|
|
35
37
|
if (ellipsis || originalDiffTip) {
|
|
36
38
|
if (ellipsis) {
|
|
37
39
|
renderNode = _jsx(Text, {
|
|
38
40
|
style: {
|
|
39
|
-
width: currentValue === '-' ? 32.5 : width
|
|
41
|
+
width: currentValue === '-' ? 32.5 : width,
|
|
42
|
+
minWidth: minWidth
|
|
40
43
|
},
|
|
41
44
|
ellipsis: {
|
|
42
45
|
tooltip: false
|
|
@@ -47,10 +50,13 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
47
50
|
return _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
48
51
|
className: "varied-cell",
|
|
49
52
|
style: {
|
|
50
|
-
width: width
|
|
53
|
+
width: width,
|
|
54
|
+
minWidth: minWidth
|
|
51
55
|
},
|
|
52
56
|
title: originalDiffTip ? _jsxs(_Fragment, {
|
|
53
|
-
children: ["\u521D\u59CB\u503C\uFF1A", originalValue, _jsx("br", {}), ellipsis ? "
|
|
57
|
+
children: ["\u521D\u59CB\u503C\uFF1A", originalValue, _jsx("br", {}), ellipsis ? _jsxs("span", {
|
|
58
|
+
children: ["\u5F53\u524D\u503C\uFF1A", currentValue]
|
|
59
|
+
}) : null]
|
|
54
60
|
}) : node,
|
|
55
61
|
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
56
62
|
return triggerNode.parentNode;
|
|
@@ -62,7 +68,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
62
68
|
return _jsx("span", {
|
|
63
69
|
className: "varied-cell",
|
|
64
70
|
style: {
|
|
65
|
-
width: width
|
|
71
|
+
width: width,
|
|
72
|
+
minWidth: minWidth
|
|
66
73
|
},
|
|
67
74
|
children: renderNode
|
|
68
75
|
});
|
|
@@ -133,7 +140,12 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
133
140
|
}
|
|
134
141
|
}, toolTipProps);
|
|
135
142
|
if (!value) {
|
|
136
|
-
return
|
|
143
|
+
return _jsx("div", {
|
|
144
|
+
style: {
|
|
145
|
+
minWidth: minWidth
|
|
146
|
+
},
|
|
147
|
+
children: "-"
|
|
148
|
+
});
|
|
137
149
|
}
|
|
138
150
|
return _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
139
151
|
title: value,
|
|
@@ -146,7 +158,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
146
158
|
}, tooltipProps), {}, {
|
|
147
159
|
children: _jsx(Text, {
|
|
148
160
|
style: {
|
|
149
|
-
width: width
|
|
161
|
+
width: width,
|
|
162
|
+
minWidth: minWidth
|
|
150
163
|
},
|
|
151
164
|
ellipsis: true,
|
|
152
165
|
onMouseOver: handleMouseOver,
|
|
@@ -155,6 +168,11 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
155
168
|
})
|
|
156
169
|
}));
|
|
157
170
|
}
|
|
158
|
-
return
|
|
171
|
+
return _jsx("div", {
|
|
172
|
+
style: {
|
|
173
|
+
minWidth: minWidth
|
|
174
|
+
},
|
|
175
|
+
children: value || value === 0 ? node : '-'
|
|
176
|
+
});
|
|
159
177
|
};
|
|
160
178
|
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;
|
|
@@ -180,6 +183,11 @@ function ProTable(props) {
|
|
|
180
183
|
setCurColumns(nextColumns);
|
|
181
184
|
};
|
|
182
185
|
};
|
|
186
|
+
var _rowClassName = function _rowClassName(record, index) {
|
|
187
|
+
if (originalDataSource && !originalObj.hasOwnProperty(get(record, 'rowKey'))) {
|
|
188
|
+
return 'new-cell';
|
|
189
|
+
}
|
|
190
|
+
};
|
|
183
191
|
var columns = useMemo(function () {
|
|
184
192
|
var newColumns = curColumns.map(function (item, index) {
|
|
185
193
|
var _propsColumnObj$getCo2;
|
|
@@ -201,18 +209,23 @@ function ProTable(props) {
|
|
|
201
209
|
}).filter(function (item) {
|
|
202
210
|
return !(item === null || item === void 0 ? void 0 : item.delete);
|
|
203
211
|
});
|
|
204
|
-
newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item) {
|
|
212
|
+
newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item, index) {
|
|
205
213
|
formatColumn({
|
|
206
214
|
column: item,
|
|
207
215
|
originalObj: originalObj,
|
|
208
216
|
dataSourceObj: dataSourceObj,
|
|
209
217
|
rowKey: 'rowKey',
|
|
210
218
|
diffToolTip: toolTip,
|
|
211
|
-
wrapToolTipProps: wrapToolTipProps
|
|
219
|
+
wrapToolTipProps: wrapToolTipProps,
|
|
220
|
+
scroll: _scroll,
|
|
221
|
+
onUpdateMinWidth: function onUpdateMinWidth(w) {
|
|
222
|
+
curColumns[index].minWidth = w;
|
|
223
|
+
},
|
|
224
|
+
isInNewRow: _rowClassName
|
|
212
225
|
});
|
|
213
226
|
});
|
|
214
227
|
return newColumns;
|
|
215
|
-
}, [curColumns, handleResize]);
|
|
228
|
+
}, [curColumns, handleResize, _scroll, originalDataSource, originalObj, _rowClassName]);
|
|
216
229
|
var _columns = useMemo(function () {
|
|
217
230
|
return columns === null || columns === void 0 ? void 0 : columns.filter(function (item, index) {
|
|
218
231
|
var show = item.show;
|
|
@@ -225,6 +238,13 @@ function ProTable(props) {
|
|
|
225
238
|
return true;
|
|
226
239
|
});
|
|
227
240
|
}, [columns]);
|
|
241
|
+
var isExistPercentWidth = !!(_columns === null || _columns === void 0 ? void 0 : _columns.find(function (item) {
|
|
242
|
+
var _item$width;
|
|
243
|
+
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('%'));
|
|
244
|
+
}));
|
|
245
|
+
if (isExistPercentWidth) {
|
|
246
|
+
_scroll = props === null || props === void 0 ? void 0 : props.scroll;
|
|
247
|
+
}
|
|
228
248
|
var handleColumnConfig = /*#__PURE__*/function () {
|
|
229
249
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(checkList) {
|
|
230
250
|
var newColumns, _columnConfig$onColum, catchColumns;
|
|
@@ -354,11 +374,6 @@ function ProTable(props) {
|
|
|
354
374
|
return _ref7.apply(this, arguments);
|
|
355
375
|
};
|
|
356
376
|
}();
|
|
357
|
-
var _rowClassName = function _rowClassName(record, index) {
|
|
358
|
-
if (originalDataSource && !originalObj.hasOwnProperty(get(record, 'rowKey'))) {
|
|
359
|
-
return 'new-cell';
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
377
|
var TableComponent = draggable ? DraggableTable : BaseTable;
|
|
363
378
|
// 标记样式
|
|
364
379
|
var tagStyle = {
|
|
@@ -415,7 +430,8 @@ function ProTable(props) {
|
|
|
415
430
|
summary: summary,
|
|
416
431
|
dataSource: _dataSource
|
|
417
432
|
},
|
|
418
|
-
dataSource: _dataSource
|
|
433
|
+
dataSource: _dataSource,
|
|
434
|
+
scroll: _scroll
|
|
419
435
|
})), _jsx("span", {
|
|
420
436
|
className: "pro-table-resizable-line",
|
|
421
437
|
style: {
|
|
@@ -41,6 +41,10 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
|
|
|
41
41
|
toolTipProps?: TooltipProps & React.RefAttributes<unknown>;
|
|
42
42
|
transform?: (value: any, record?: any) => string[];
|
|
43
43
|
show?: boolean | (() => boolean);
|
|
44
|
+
onDiff?: ({ value, originValue }: {
|
|
45
|
+
value: any;
|
|
46
|
+
originValue: any;
|
|
47
|
+
}) => boolean;
|
|
44
48
|
}
|
|
45
49
|
export interface CreateTreeFromArrayOptions {
|
|
46
50
|
itemKey?: string;
|
|
@@ -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
|
}
|
|
@@ -270,8 +272,22 @@
|
|
|
270
272
|
.@{ant-prefix}-table-cell .varied-cell {
|
|
271
273
|
margin-left: -8px;
|
|
272
274
|
padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
|
|
275
|
+
|
|
273
276
|
background: var(--zaui-contract-bg; #fffaa1) !important;
|
|
274
277
|
border-radius: var(--zaui-border-radius, 8px);
|
|
278
|
+
.pro-form-view-container {
|
|
279
|
+
overflow: hidden;
|
|
280
|
+
white-space: nowrap;
|
|
281
|
+
text-overflow: ellipsis;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.@{ant-prefix}-table-cell .@{ant-prefix}-typography-ellipsis {
|
|
286
|
+
.pro-form-view-container {
|
|
287
|
+
overflow: hidden;
|
|
288
|
+
white-space: nowrap;
|
|
289
|
+
text-overflow: ellipsis;
|
|
290
|
+
}
|
|
275
291
|
}
|
|
276
292
|
|
|
277
293
|
.varied-cell.empty-cell {
|