@zat-design/sisyphus-react 3.8.2 → 3.8.3-beta.2
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 +20 -13
- 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 +18 -11
- 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
|
@@ -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)({
|
package/lib/ProEnum/index.js
CHANGED
|
@@ -54,8 +54,8 @@ var ProEnum = function ProEnum(props) {
|
|
|
54
54
|
showCodeName = _ref2.showCodeName,
|
|
55
55
|
resProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
56
56
|
enumProps.showCodeName = (_enumProps$showCodeNa = enumProps.showCodeName) !== null && _enumProps$showCodeNa !== void 0 ? _enumProps$showCodeNa : showCodeName;
|
|
57
|
-
var label = '';
|
|
58
|
-
var fieldValue = '';
|
|
57
|
+
var label = 'label';
|
|
58
|
+
var fieldValue = 'value';
|
|
59
59
|
var _useState = (0, _react.useState)(dataSource || []),
|
|
60
60
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
61
61
|
dataList = _useState2[0],
|
|
@@ -86,7 +86,7 @@ var InputNumber = function InputNumber(props) {
|
|
|
86
86
|
var _parser = function parser(value, precision) {
|
|
87
87
|
if (value === '') return value;
|
|
88
88
|
var num = Number(value.replace(/[\s,]+/g, ''));
|
|
89
|
-
return Number.isNaN(num) || !precision && precision !== 0 ? Number.isNaN(Number(value)) ? null : value : num.toFixed(precision);
|
|
89
|
+
return Number.isNaN(num) || !precision && precision !== 0 ? Number.isNaN(Number(value)) ? null : Number(value) : Number(num.toFixed(precision));
|
|
90
90
|
};
|
|
91
91
|
if (valueType) {
|
|
92
92
|
switch (valueType) {
|
|
@@ -15,7 +15,7 @@ var _ConfirmWrapper = _interopRequireDefault(require("../../../../components/ren
|
|
|
15
15
|
var _useFieldProps = require("../../../../utils/useFieldProps");
|
|
16
16
|
var componentMap = _interopRequireWildcard(require("../../../../../index"));
|
|
17
17
|
var _AddonWrapper = _interopRequireDefault(require("./AddonWrapper"));
|
|
18
|
-
var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after", "getValueProps", "valuePropName", "valueType"];
|
|
18
|
+
var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after", "getValueProps", "valuePropName", "valueType", "isView"];
|
|
19
19
|
// 这里的key与组件内参数一致, 决定使用哪个包裹组件
|
|
20
20
|
var wrapperMap = {
|
|
21
21
|
confirm: _ConfirmWrapper.default,
|
|
@@ -49,6 +49,7 @@ var ComRender = function ComRender(props) {
|
|
|
49
49
|
_props$valuePropName = props.valuePropName,
|
|
50
50
|
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
51
51
|
valueType = props.valueType,
|
|
52
|
+
isView = props.isView,
|
|
52
53
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
53
54
|
var TypeComponent = componentMap[type];
|
|
54
55
|
var mergedGetValueProps = getValueProps || function (val) {
|
|
@@ -61,7 +62,8 @@ var ComRender = function ComRender(props) {
|
|
|
61
62
|
return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
|
|
62
63
|
value: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, contextProps), {}, {
|
|
63
64
|
valueType: valueType,
|
|
64
|
-
type: type
|
|
65
|
+
type: type,
|
|
66
|
+
isView: isView
|
|
65
67
|
}),
|
|
66
68
|
children: Com
|
|
67
69
|
});
|
|
@@ -33,7 +33,8 @@ var Group = function Group(props) {
|
|
|
33
33
|
onChange = props.onChange,
|
|
34
34
|
otherProps = props.otherProps,
|
|
35
35
|
disabled = props.disabled,
|
|
36
|
-
id = props.id
|
|
36
|
+
id = props.id,
|
|
37
|
+
isView = props.isView;
|
|
37
38
|
var contextProps = _ProForm.default.useFieldProps() || {};
|
|
38
39
|
var names = contextProps.names,
|
|
39
40
|
name = contextProps.name,
|
|
@@ -76,7 +77,8 @@ var Group = function Group(props) {
|
|
|
76
77
|
children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? (0, _jsxRuntime.jsx)(_antd.Space.Compact, {
|
|
77
78
|
children: columns.map(function (column, index) {
|
|
78
79
|
return (0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
79
|
-
contextProps: contextProps
|
|
80
|
+
contextProps: contextProps,
|
|
81
|
+
isView: isView
|
|
80
82
|
}, column), {}, {
|
|
81
83
|
otherProps: otherProps
|
|
82
84
|
}), column.name);
|
|
@@ -86,7 +88,8 @@ var Group = function Group(props) {
|
|
|
86
88
|
}, (0, _lodash.omit)(space, ['separator', 'compact'])), {}, {
|
|
87
89
|
children: columns.map(function (column, index) {
|
|
88
90
|
return (0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
89
|
-
contextProps: contextProps
|
|
91
|
+
contextProps: contextProps,
|
|
92
|
+
isView: isView
|
|
90
93
|
}, column), {}, {
|
|
91
94
|
otherProps: otherProps
|
|
92
95
|
}), column.name);
|