@zat-design/sisyphus-react 3.8.3 → 3.9.0-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/.vscode/extensions.json +5 -0
- package/dist/index.esm.css +48 -3
- package/dist/less.esm.css +47 -2
- package/es/ProDrawerForm/components/ProDrawer/index.js +3 -1
- package/es/ProDrawerForm/components/ProModal/index.js +5 -3
- package/es/ProDrawerForm/propsType.d.ts +1 -0
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +83 -20
- package/es/ProEditTable/components/RenderField/index.js +6 -2
- package/es/ProEditTable/index.js +18 -9
- package/es/ProEditTable/propsType.d.ts +3 -6
- package/es/ProEditTable/style/index.less +0 -1
- package/es/ProEditTable/utils/index.js +10 -3
- package/es/ProEnum/index.js +1 -1
- 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/index.js +5 -5
- package/es/ProForm/components/combination/ProCascader/index.js +21 -14
- package/es/ProForm/components/combination/ProModalSelect/index.js +19 -4
- package/es/ProForm/components/render/ChangedWrapper.js +30 -11
- package/es/ProForm/components/render/Render.js +3 -1
- package/es/ProForm/components/render/RenderFields.js +4 -2
- package/es/ProForm/propsType.d.ts +3 -0
- package/es/ProForm/style/index.less +35 -9
- package/es/ProForm/utils/diffOriginal.js +14 -2
- package/es/ProForm/utils/useShouldUpdate.js +1 -9
- package/es/ProTable/components/FormatColumn/index.d.ts +3 -2
- package/es/ProTable/components/FormatColumn/index.js +143 -62
- package/es/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/es/ProTable/components/RenderColumn/index.js +50 -19
- package/es/ProTable/index.d.ts +6 -5
- package/es/ProTable/index.js +12 -12
- package/es/ProTable/propsType.d.ts +6 -0
- package/es/ProTable/style/index.less +24 -1
- package/es/ProTable/utils/index.js +2 -2
- package/es/ProTree/components/ProTreeSelect/index.js +32 -13
- package/es/style/theme/antd.less +1 -1
- package/es/utils/index.d.ts +2 -1
- package/es/utils/index.js +30 -1
- package/lib/ProDrawerForm/components/ProDrawer/index.js +3 -1
- package/lib/ProDrawerForm/components/ProModal/index.js +5 -3
- package/lib/ProDrawerForm/propsType.d.ts +1 -0
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +82 -21
- package/lib/ProEditTable/components/RenderField/index.js +6 -2
- package/lib/ProEditTable/index.js +18 -9
- package/lib/ProEditTable/propsType.d.ts +3 -6
- package/lib/ProEditTable/style/index.less +0 -1
- package/lib/ProEditTable/utils/index.js +10 -3
- package/lib/ProEnum/index.js +1 -1
- 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/index.js +5 -5
- package/lib/ProForm/components/combination/ProCascader/index.js +21 -14
- package/lib/ProForm/components/combination/ProModalSelect/index.js +19 -4
- package/lib/ProForm/components/render/ChangedWrapper.js +30 -11
- package/lib/ProForm/components/render/Render.js +3 -1
- package/lib/ProForm/components/render/RenderFields.js +4 -2
- package/lib/ProForm/propsType.d.ts +3 -0
- package/lib/ProForm/style/index.less +35 -9
- package/lib/ProForm/utils/diffOriginal.js +13 -1
- package/lib/ProForm/utils/useShouldUpdate.js +1 -9
- package/lib/ProTable/components/FormatColumn/index.d.ts +3 -2
- package/lib/ProTable/components/FormatColumn/index.js +143 -62
- package/lib/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/lib/ProTable/components/RenderColumn/index.js +47 -18
- package/lib/ProTable/index.d.ts +6 -5
- package/lib/ProTable/index.js +12 -12
- package/lib/ProTable/propsType.d.ts +6 -0
- package/lib/ProTable/style/index.less +24 -1
- package/lib/ProTable/utils/index.js +2 -2
- package/lib/ProTree/components/ProTreeSelect/index.js +31 -12
- package/lib/style/theme/antd.less +1 -1
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +32 -2
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import "antd/es/space/style";
|
|
2
2
|
import _Space from "antd/es/space";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["title", "valueType", "format", "precision", "ellipsis", "code", "copyable", "width", "tooltip", "transform", "prefix", "suffix", "dataIndex", "originalDiffTip", "toolTipProps", "minWidth", "onDiff"];
|
|
4
6
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
7
|
import { isValidElement } from 'react';
|
|
6
8
|
import moment from 'moment';
|
|
@@ -11,6 +13,7 @@ import { tools } from '@zat-design/utils';
|
|
|
11
13
|
import TooltipTitle from '../TooltipTitle';
|
|
12
14
|
import RenderColumn from '../RenderColumn';
|
|
13
15
|
import { getDecimalDigits, getOriginalValue } from '../../utils';
|
|
16
|
+
import { isEmpty } from '../../../utils';
|
|
14
17
|
import getEnumLabel from '../../../ProEnum/utils/getEnumLabel';
|
|
15
18
|
import ProForm from '../../../ProForm';
|
|
16
19
|
var isReactElement = function isReactElement(element) {
|
|
@@ -46,12 +49,13 @@ var calcMinWidth = function calcMinWidth(_ref) {
|
|
|
46
49
|
export var formatColumn = function formatColumn(_ref2) {
|
|
47
50
|
var column = _ref2.column,
|
|
48
51
|
originalObj = _ref2.originalObj,
|
|
49
|
-
dataSourceObj = _ref2.dataSourceObj,
|
|
50
52
|
rowKey = _ref2.rowKey,
|
|
51
53
|
diffToolTip = _ref2.diffToolTip,
|
|
52
54
|
wrapToolTipProps = _ref2.wrapToolTipProps,
|
|
53
55
|
scroll = _ref2.scroll,
|
|
54
|
-
onUpdateMinWidth = _ref2.onUpdateMinWidth
|
|
56
|
+
onUpdateMinWidth = _ref2.onUpdateMinWidth,
|
|
57
|
+
isInNewRow = _ref2.isInNewRow,
|
|
58
|
+
diffConfig = _ref2.diffConfig;
|
|
55
59
|
var title = column.title,
|
|
56
60
|
valueType = column.valueType,
|
|
57
61
|
_column$format = column.format,
|
|
@@ -67,11 +71,12 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
67
71
|
prefix = column.prefix,
|
|
68
72
|
suffix = column.suffix,
|
|
69
73
|
dataIndex = column.dataIndex,
|
|
70
|
-
|
|
71
|
-
originalDiffTip = _column$originalDiffT === void 0 ? true : _column$originalDiffT,
|
|
74
|
+
originalDiffTip = column.originalDiffTip,
|
|
72
75
|
_column$toolTipProps = column.toolTipProps,
|
|
73
76
|
toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps,
|
|
74
|
-
minWidth = column.minWidth
|
|
77
|
+
minWidth = column.minWidth,
|
|
78
|
+
onDiff = column.onDiff,
|
|
79
|
+
otherProps = _objectWithoutProperties(column, _excluded);
|
|
75
80
|
// 仅在 {x: 'max-content', y: 300 } 且 column无指定 width minWidth 情况下 才开启 minWidth的自动计算
|
|
76
81
|
var isMaxContentOverFlow = isObject(scroll) ? (scroll === null || scroll === void 0 ? void 0 : scroll.x) === 'max-content' && Reflect.ownKeys(scroll).includes('y') : false;
|
|
77
82
|
calcMinWidth({
|
|
@@ -82,7 +87,7 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
82
87
|
callback: onUpdateMinWidth
|
|
83
88
|
});
|
|
84
89
|
var _toolTipProps = _objectSpread(_objectSpread({}, toolTipProps), wrapToolTipProps);
|
|
85
|
-
var _originalDiffTip =
|
|
90
|
+
var _originalDiffTip = (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource) || (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.toolTip);
|
|
86
91
|
// 前缀处理
|
|
87
92
|
var prefixNode = function prefixNode(value, record, index) {
|
|
88
93
|
if (!prefix) {
|
|
@@ -108,20 +113,32 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
108
113
|
}
|
|
109
114
|
};
|
|
110
115
|
if (column === null || column === void 0 ? void 0 : column.render) {
|
|
111
|
-
if (!originalObj && Object.keys(originalObj !== null && originalObj !== void 0 ? originalObj : {}).length === 0) {
|
|
116
|
+
if (!originalObj && Object.keys(originalObj !== null && originalObj !== void 0 ? originalObj : {}).length === 0 && !onDiff) {
|
|
112
117
|
return;
|
|
113
118
|
}
|
|
114
119
|
var originalRender = column.render; // 保存原始的 render 方法
|
|
115
120
|
// 自定义render 手动重载下
|
|
116
121
|
column.render = function (value, record, index) {
|
|
117
|
-
var _originalObj$record$r;
|
|
118
122
|
var isFn = isFunction(originalRender);
|
|
119
|
-
var _value = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(value, record !== null && record !== void 0 ? record : {}, index) :
|
|
123
|
+
var _value = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(value, record !== null && record !== void 0 ? record : {}, index) : null;
|
|
120
124
|
var originalValue = getOriginalValue(value, record !== null && record !== void 0 ? record : {}, originalObj, rowKey, dataIndex);
|
|
121
|
-
var
|
|
122
|
-
|
|
125
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
126
|
+
// 存在比对
|
|
127
|
+
if (isFunction(otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewRender) && (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource)) {
|
|
128
|
+
var _originalObj$record$r;
|
|
129
|
+
var diffResult = otherProps.viewRender({
|
|
130
|
+
originalValue: originalValue,
|
|
131
|
+
originalRecord: (_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 : {},
|
|
132
|
+
value: value,
|
|
133
|
+
record: record,
|
|
134
|
+
index: index
|
|
135
|
+
});
|
|
136
|
+
originalValue = diffResult;
|
|
137
|
+
otherProps.diffChange = diffResult;
|
|
138
|
+
}
|
|
139
|
+
return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
123
140
|
valueType: valueType,
|
|
124
|
-
originalValue: originalValue
|
|
141
|
+
originalValue: isEmpty(originalValue) ? null : originalValue,
|
|
125
142
|
ellipsis: ellipsis,
|
|
126
143
|
width: width,
|
|
127
144
|
value: _value,
|
|
@@ -129,8 +146,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
129
146
|
currentValue: _value,
|
|
130
147
|
originalDiffTip: _originalDiffTip,
|
|
131
148
|
toolTipProps: _toolTipProps,
|
|
132
|
-
minWidth: minWidth
|
|
133
|
-
|
|
149
|
+
minWidth: minWidth,
|
|
150
|
+
isInNewRowFlag: isInNewRowFlag
|
|
151
|
+
}));
|
|
134
152
|
};
|
|
135
153
|
return;
|
|
136
154
|
}
|
|
@@ -156,19 +174,25 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
156
174
|
var originalValue = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
|
157
175
|
var originalRealValue = tools.calc(Number(originalValue || null), '*', multiple);
|
|
158
176
|
var originalRenderValue = getDecimalDigits(originalValue) > valueTypePrecision ? originalRealValue : originalRealValue.toFixed(valueTypePrecision);
|
|
159
|
-
if (
|
|
177
|
+
if (isEmpty(originalValue)) {
|
|
160
178
|
originalRenderValue = '-';
|
|
161
179
|
}
|
|
162
180
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
163
|
-
return
|
|
181
|
+
return _jsx("div", {
|
|
182
|
+
style: {
|
|
183
|
+
minWidth: minWidth
|
|
184
|
+
},
|
|
185
|
+
children: "-"
|
|
186
|
+
});
|
|
164
187
|
}
|
|
165
188
|
var node = _jsxs(_Space, {
|
|
166
189
|
size: 8,
|
|
167
190
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
168
191
|
});
|
|
169
|
-
|
|
192
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
193
|
+
return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
170
194
|
valueType: valueType,
|
|
171
|
-
originalValue: originalValue ===
|
|
195
|
+
originalValue: originalValue === null ? null : originalRenderValue,
|
|
172
196
|
ellipsis: ellipsis,
|
|
173
197
|
width: width,
|
|
174
198
|
node: node,
|
|
@@ -176,8 +200,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
176
200
|
currentValue: renderValue,
|
|
177
201
|
originalDiffTip: _originalDiffTip,
|
|
178
202
|
toolTipProps: _toolTipProps,
|
|
179
|
-
minWidth: minWidth
|
|
180
|
-
|
|
203
|
+
minWidth: minWidth,
|
|
204
|
+
isInNewRowFlag: isInNewRowFlag
|
|
205
|
+
}));
|
|
181
206
|
};
|
|
182
207
|
// 千分位, 千分位带CNY前缀
|
|
183
208
|
} else if (['thousandth', 'thousandthCNY'].includes(valueType)) {
|
|
@@ -187,7 +212,7 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
187
212
|
var originalValue = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
|
188
213
|
var originalRealValue = valueTypePrecision ? "".concat(Number(originalValue).toFixed(valueTypePrecision)) : "".concat(originalValue);
|
|
189
214
|
var originalRenderValue = originalRealValue.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
190
|
-
if (
|
|
215
|
+
if (isEmpty(originalValue)) {
|
|
191
216
|
originalRenderValue = '-';
|
|
192
217
|
}
|
|
193
218
|
var node = _jsxs(_Space, {
|
|
@@ -195,11 +220,17 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
195
220
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
196
221
|
});
|
|
197
222
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
198
|
-
|
|
223
|
+
_jsx("div", {
|
|
224
|
+
style: {
|
|
225
|
+
minWidth: minWidth
|
|
226
|
+
},
|
|
227
|
+
children: "-"
|
|
228
|
+
});
|
|
199
229
|
}
|
|
200
|
-
|
|
230
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
231
|
+
return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
201
232
|
valueType: valueType,
|
|
202
|
-
originalValue: originalValue ===
|
|
233
|
+
originalValue: originalValue === null ? null : originalRenderValue,
|
|
203
234
|
ellipsis: ellipsis,
|
|
204
235
|
width: width,
|
|
205
236
|
node: node,
|
|
@@ -207,8 +238,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
207
238
|
currentValue: renderValue,
|
|
208
239
|
originalDiffTip: _originalDiffTip,
|
|
209
240
|
toolTipProps: _toolTipProps,
|
|
210
|
-
minWidth: minWidth
|
|
211
|
-
|
|
241
|
+
minWidth: minWidth,
|
|
242
|
+
isInNewRowFlag: isInNewRowFlag
|
|
243
|
+
}));
|
|
212
244
|
};
|
|
213
245
|
} else if (['datePicker', 'date', 'dateTime', 'dateStartTime', 'dateEndTime', 'dateStartEndTime'].includes(valueType)) {
|
|
214
246
|
column.render = function (value, record, index) {
|
|
@@ -249,11 +281,17 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
249
281
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
250
282
|
});
|
|
251
283
|
if (!value && renderValue === originalRenderValue) {
|
|
252
|
-
|
|
284
|
+
_jsx("div", {
|
|
285
|
+
style: {
|
|
286
|
+
minWidth: minWidth
|
|
287
|
+
},
|
|
288
|
+
children: "-"
|
|
289
|
+
});
|
|
253
290
|
}
|
|
254
|
-
|
|
291
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
292
|
+
return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
255
293
|
valueType: valueType,
|
|
256
|
-
originalValue: originalValue ===
|
|
294
|
+
originalValue: originalValue === null ? null : originalRenderValue,
|
|
257
295
|
ellipsis: ellipsis,
|
|
258
296
|
width: width,
|
|
259
297
|
node: node,
|
|
@@ -261,8 +299,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
261
299
|
currentValue: renderValue,
|
|
262
300
|
originalDiffTip: _originalDiffTip,
|
|
263
301
|
toolTipProps: _toolTipProps,
|
|
264
|
-
minWidth: minWidth
|
|
265
|
-
|
|
302
|
+
minWidth: minWidth,
|
|
303
|
+
isInNewRowFlag: isInNewRowFlag
|
|
304
|
+
}));
|
|
266
305
|
};
|
|
267
306
|
} else if (['enumName', 'enumCodeName'].includes(valueType)) {
|
|
268
307
|
column.render = function (value, record, index) {
|
|
@@ -290,9 +329,10 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
290
329
|
size: 8,
|
|
291
330
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
292
331
|
});
|
|
293
|
-
|
|
332
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
333
|
+
return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
294
334
|
valueType: valueType,
|
|
295
|
-
originalValue: originalValue ===
|
|
335
|
+
originalValue: originalValue === null ? null : originalRenderValue,
|
|
296
336
|
ellipsis: ellipsis,
|
|
297
337
|
width: width,
|
|
298
338
|
node: node,
|
|
@@ -300,8 +340,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
300
340
|
currentValue: renderValue,
|
|
301
341
|
originalDiffTip: _originalDiffTip,
|
|
302
342
|
toolTipProps: _toolTipProps,
|
|
303
|
-
minWidth: minWidth
|
|
304
|
-
|
|
343
|
+
minWidth: minWidth,
|
|
344
|
+
isInNewRowFlag: isInNewRowFlag
|
|
345
|
+
}));
|
|
305
346
|
};
|
|
306
347
|
} else if (precision || prefix || suffix) {
|
|
307
348
|
column.render = function (value, record, index) {
|
|
@@ -312,15 +353,21 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
312
353
|
size: 8,
|
|
313
354
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
314
355
|
});
|
|
315
|
-
if (
|
|
356
|
+
if (isEmpty(originalValue)) {
|
|
316
357
|
originalRenderValue = '-';
|
|
317
358
|
}
|
|
318
359
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
319
|
-
|
|
360
|
+
_jsx("div", {
|
|
361
|
+
style: {
|
|
362
|
+
minWidth: minWidth
|
|
363
|
+
},
|
|
364
|
+
children: "-"
|
|
365
|
+
});
|
|
320
366
|
}
|
|
321
|
-
|
|
367
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
368
|
+
return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
322
369
|
valueType: valueType,
|
|
323
|
-
originalValue: originalValue ===
|
|
370
|
+
originalValue: originalValue === null ? null : originalRenderValue,
|
|
324
371
|
ellipsis: ellipsis,
|
|
325
372
|
width: width,
|
|
326
373
|
node: node,
|
|
@@ -328,8 +375,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
328
375
|
currentValue: renderValue,
|
|
329
376
|
originalDiffTip: _originalDiffTip,
|
|
330
377
|
toolTipProps: _toolTipProps,
|
|
331
|
-
minWidth: minWidth
|
|
332
|
-
|
|
378
|
+
minWidth: minWidth,
|
|
379
|
+
isInNewRowFlag: isInNewRowFlag
|
|
380
|
+
}));
|
|
333
381
|
};
|
|
334
382
|
} else if (valueType === 'address') {
|
|
335
383
|
column.render = function (value, record, index) {
|
|
@@ -341,10 +389,17 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
341
389
|
return !!item;
|
|
342
390
|
})) === null || _realValue$filter === void 0 ? void 0 : _realValue$filter.length) === 0;
|
|
343
391
|
if (isEqual(value, originalValue) && isEmpty) {
|
|
344
|
-
|
|
392
|
+
_jsx("div", {
|
|
393
|
+
style: {
|
|
394
|
+
minWidth: minWidth
|
|
395
|
+
},
|
|
396
|
+
children: "-"
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
if (originalValue && !isEqual(realValue, originalRealValue)) {
|
|
400
|
+
otherProps.diffChange = true;
|
|
345
401
|
}
|
|
346
402
|
var className = classnames({
|
|
347
|
-
'varied-cell': originalValue !== undefined,
|
|
348
403
|
'empty-cell': isEmpty
|
|
349
404
|
});
|
|
350
405
|
var renderValue = _jsx(ProForm.ProCascader, {
|
|
@@ -359,24 +414,35 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
359
414
|
code: code,
|
|
360
415
|
value: originalRealValue
|
|
361
416
|
});
|
|
362
|
-
|
|
417
|
+
var renderNode = _jsx(ProForm.ProCascader, {
|
|
363
418
|
className: className,
|
|
364
419
|
isView: true,
|
|
365
420
|
mode: "address",
|
|
366
421
|
code: code,
|
|
367
422
|
value: realValue,
|
|
368
|
-
tooltip:
|
|
369
|
-
children: ["\u521D\u59CB\u503C\uFF1A", originalRenderValue, _jsx("br", {}), ellipsis ? _jsxs(_Fragment, {
|
|
370
|
-
children: ["\u5F53\u524D\u503C\uFF1A", renderValue]
|
|
371
|
-
}) : undefined]
|
|
372
|
-
}) : ellipsis
|
|
423
|
+
tooltip: false
|
|
373
424
|
});
|
|
425
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
426
|
+
return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
427
|
+
valueType: valueType,
|
|
428
|
+
originalValue: originalValue === null ? null : originalRenderValue,
|
|
429
|
+
ellipsis: ellipsis,
|
|
430
|
+
width: width,
|
|
431
|
+
node: renderNode,
|
|
432
|
+
value: renderValue,
|
|
433
|
+
currentValue: renderValue,
|
|
434
|
+
originalDiffTip: _originalDiffTip,
|
|
435
|
+
toolTipProps: _toolTipProps,
|
|
436
|
+
minWidth: minWidth,
|
|
437
|
+
isInNewRowFlag: isInNewRowFlag
|
|
438
|
+
}));
|
|
374
439
|
};
|
|
375
440
|
} else if (copyable) {
|
|
376
441
|
column.render = function (value, record, index) {
|
|
442
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
377
443
|
return _jsxs(_Space, {
|
|
378
444
|
size: 8,
|
|
379
|
-
children: [prefixNode(value, record, index), _jsx(RenderColumn, {
|
|
445
|
+
children: [prefixNode(value, record, index), _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
380
446
|
valueType: valueType,
|
|
381
447
|
copyable: copyable,
|
|
382
448
|
ellipsis: ellipsis,
|
|
@@ -385,21 +451,28 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
385
451
|
value: value,
|
|
386
452
|
currentValue: value,
|
|
387
453
|
toolTipProps: _toolTipProps,
|
|
388
|
-
minWidth: minWidth
|
|
389
|
-
|
|
454
|
+
minWidth: minWidth,
|
|
455
|
+
isInNewRowFlag: isInNewRowFlag
|
|
456
|
+
})), suffixNode(value, record, index)]
|
|
390
457
|
});
|
|
391
458
|
};
|
|
392
459
|
} else if (ellipsis) {
|
|
393
460
|
column.render = function (value, record, index) {
|
|
394
461
|
var originalValue = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
|
395
462
|
if (!value && value !== 0 && value === originalValue) {
|
|
396
|
-
|
|
463
|
+
_jsx("div", {
|
|
464
|
+
style: {
|
|
465
|
+
minWidth: minWidth
|
|
466
|
+
},
|
|
467
|
+
children: "-"
|
|
468
|
+
});
|
|
397
469
|
}
|
|
470
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
398
471
|
return _jsxs(_Space, {
|
|
399
472
|
size: 8,
|
|
400
|
-
children: [prefixNode(value, record, index), _jsx(RenderColumn, {
|
|
473
|
+
children: [prefixNode(value, record, index), _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
401
474
|
valueType: valueType,
|
|
402
|
-
originalValue: originalValue ===
|
|
475
|
+
originalValue: originalValue === null ? null : originalValue || '-',
|
|
403
476
|
ellipsis: ellipsis,
|
|
404
477
|
width: width,
|
|
405
478
|
node: value,
|
|
@@ -407,8 +480,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
407
480
|
currentValue: value || '-',
|
|
408
481
|
originalDiffTip: _originalDiffTip,
|
|
409
482
|
toolTipProps: _toolTipProps,
|
|
410
|
-
minWidth: minWidth
|
|
411
|
-
|
|
483
|
+
minWidth: minWidth,
|
|
484
|
+
isInNewRowFlag: isInNewRowFlag
|
|
485
|
+
})), suffixNode(value, record, index)]
|
|
412
486
|
});
|
|
413
487
|
};
|
|
414
488
|
} else {
|
|
@@ -419,11 +493,17 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
419
493
|
children: [prefixNode(value, record, index), value, suffixNode(value, record, index)]
|
|
420
494
|
});
|
|
421
495
|
if (!value && value !== 0 && value === originalValue) {
|
|
422
|
-
|
|
496
|
+
_jsx("div", {
|
|
497
|
+
style: {
|
|
498
|
+
minWidth: minWidth
|
|
499
|
+
},
|
|
500
|
+
children: "-"
|
|
501
|
+
});
|
|
423
502
|
}
|
|
424
|
-
|
|
503
|
+
var isInNewRowFlag = isInNewRow(record);
|
|
504
|
+
return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
425
505
|
valueType: valueType,
|
|
426
|
-
originalValue: originalValue ===
|
|
506
|
+
originalValue: originalValue === null ? null : originalValue || '-',
|
|
427
507
|
ellipsis: ellipsis,
|
|
428
508
|
width: width,
|
|
429
509
|
node: node,
|
|
@@ -431,8 +511,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
|
431
511
|
currentValue: value || '-',
|
|
432
512
|
originalDiffTip: _originalDiffTip,
|
|
433
513
|
toolTipProps: _toolTipProps,
|
|
434
|
-
minWidth: minWidth
|
|
435
|
-
|
|
514
|
+
minWidth: minWidth,
|
|
515
|
+
isInNewRowFlag: isInNewRowFlag
|
|
516
|
+
}));
|
|
436
517
|
};
|
|
437
518
|
}
|
|
438
519
|
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import "antd/es/space/style";
|
|
2
|
+
import _Space from "antd/es/space";
|
|
1
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
4
|
import "antd/es/tooltip/style";
|
|
3
5
|
import _Tooltip from "antd/es/tooltip";
|
|
4
6
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
7
|
import "antd/es/typography/style";
|
|
6
8
|
import _Typography from "antd/es/typography";
|
|
7
|
-
import { jsx as _jsx,
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
10
|
import { useSetState } from 'ahooks';
|
|
11
|
+
import classNames from 'classnames';
|
|
9
12
|
import { CheckOutlined } from '@ant-design/icons';
|
|
10
13
|
import { ReactSVG } from 'react-svg';
|
|
14
|
+
import { isEmpty } from '../../../utils';
|
|
11
15
|
import copySvg from '../../../assets/copy.svg';
|
|
12
16
|
var Paragraph = _Typography.Paragraph,
|
|
13
17
|
Text = _Typography.Text;
|
|
@@ -24,37 +28,61 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
24
28
|
originalDiffTip = props.originalDiffTip,
|
|
25
29
|
_props$toolTipProps = props.toolTipProps,
|
|
26
30
|
toolTipProps = _props$toolTipProps === void 0 ? {} : _props$toolTipProps,
|
|
27
|
-
minWidth = props.minWidth
|
|
31
|
+
minWidth = props.minWidth,
|
|
32
|
+
isInNewRowFlag = props.isInNewRowFlag;
|
|
28
33
|
var _useSetState = useSetState({
|
|
29
34
|
tooltip: false
|
|
30
35
|
}),
|
|
31
36
|
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
32
37
|
tooltip = _useSetState2[0].tooltip,
|
|
33
38
|
setState = _useSetState2[1];
|
|
34
|
-
|
|
39
|
+
var cellDiffCls = classNames({
|
|
40
|
+
'varied-cell': originalDiffTip
|
|
41
|
+
});
|
|
42
|
+
if (!isEmpty(originalValue, '-') && !isInNewRowFlag) {
|
|
35
43
|
var renderNode = value ? node : '-';
|
|
36
44
|
if (ellipsis || originalDiffTip) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
renderNode = _jsx(Text, {
|
|
46
|
+
style: {
|
|
47
|
+
width: currentValue === '-' ? 32.5 : width,
|
|
48
|
+
minWidth: minWidth
|
|
49
|
+
},
|
|
50
|
+
ellipsis: {
|
|
51
|
+
tooltip: false
|
|
52
|
+
},
|
|
53
|
+
children: ellipsis ? currentValue : renderNode
|
|
54
|
+
});
|
|
55
|
+
if ((props === null || props === void 0 ? void 0 : props.diffChange) === false) {
|
|
56
|
+
return renderNode;
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(originalValue)) {
|
|
59
|
+
console.error('Error: When enabled, dataIndex corresponds to an array, which needs to be converted using viewRender');
|
|
48
60
|
}
|
|
49
61
|
return _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
50
|
-
className:
|
|
62
|
+
className: cellDiffCls,
|
|
51
63
|
style: {
|
|
52
64
|
width: width,
|
|
53
65
|
minWidth: minWidth
|
|
54
66
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
overlayClassName: "original-value-tootip",
|
|
68
|
+
placement: "topLeft",
|
|
69
|
+
autoAdjustOverflow: false,
|
|
70
|
+
title: _jsx(_Space, {
|
|
71
|
+
direction: "vertical",
|
|
72
|
+
className: "changed-tooltip",
|
|
73
|
+
children: originalDiffTip ? _jsxs(_Fragment, {
|
|
74
|
+
children: [_jsxs(_Space, {
|
|
75
|
+
align: "start",
|
|
76
|
+
className: "original-value-container",
|
|
77
|
+
children: ["\u521D\u59CB\u503C\uFF1A", !Array.isArray(originalValue) ? originalValue : null]
|
|
78
|
+
}), _jsx(_Space, {
|
|
79
|
+
className: "current-value-container",
|
|
80
|
+
children: ellipsis ? _jsxs(_Space, {
|
|
81
|
+
children: ["\u5F53\u524D\u503C\uFF1A", currentValue]
|
|
82
|
+
}) : null
|
|
83
|
+
})]
|
|
84
|
+
}) : node
|
|
85
|
+
}),
|
|
58
86
|
getPopupContainer: function getPopupContainer(triggerNode) {
|
|
59
87
|
return triggerNode.parentNode;
|
|
60
88
|
}
|
|
@@ -62,8 +90,11 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
62
90
|
children: renderNode
|
|
63
91
|
}));
|
|
64
92
|
}
|
|
93
|
+
if ((props === null || props === void 0 ? void 0 : props.diffChange) === false) {
|
|
94
|
+
return renderNode;
|
|
95
|
+
}
|
|
65
96
|
return _jsx("span", {
|
|
66
|
-
className:
|
|
97
|
+
className: cellDiffCls,
|
|
67
98
|
style: {
|
|
68
99
|
width: width,
|
|
69
100
|
minWidth: minWidth
|
package/es/ProTable/index.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ProTableProps } from './propsType';
|
|
3
|
+
import useAntdTable from './hooks/useAntdTable';
|
|
3
4
|
export declare const TableContext: import("react").Context<{}>;
|
|
4
5
|
export declare const defaultPage: {
|
|
5
6
|
pageNum: number;
|
|
6
7
|
pageSize: number;
|
|
7
8
|
};
|
|
8
|
-
declare
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
declare const ProTable: {
|
|
10
|
+
(props: ProTableProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
defaultProps: {
|
|
11
12
|
quickConfig: boolean;
|
|
12
13
|
stripe: boolean;
|
|
13
14
|
draggable: boolean;
|
|
14
15
|
disabled: boolean;
|
|
15
16
|
isView: boolean;
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
-
}
|
|
18
|
+
useAntdTable: typeof useAntdTable;
|
|
19
|
+
};
|
|
19
20
|
export default ProTable;
|
package/es/ProTable/index.js
CHANGED
|
@@ -29,7 +29,7 @@ export var defaultPage = {
|
|
|
29
29
|
pageNum: 1,
|
|
30
30
|
pageSize: 10
|
|
31
31
|
};
|
|
32
|
-
function ProTable(props) {
|
|
32
|
+
var ProTable = function ProTable(props) {
|
|
33
33
|
var _locale$ProTable, _props$scroll, _curTableConfig$pathK;
|
|
34
34
|
var _ref = useProConfig('globalConfig') || {},
|
|
35
35
|
configStorage = _ref.storage; // 获取全局缓存位置配置
|
|
@@ -114,7 +114,6 @@ function ProTable(props) {
|
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
116
|
var originalObj = _originalDataSource ? keyBy(_originalDataSource, 'rowKey') : undefined;
|
|
117
|
-
var dataSourceObj = _dataSource ? keyBy(_dataSource, 'rowKey') : {};
|
|
118
117
|
var propsColumnObj = useMemo(function () {
|
|
119
118
|
return propsColumns.reduce(function (acc, cur) {
|
|
120
119
|
// @ts-ignore
|
|
@@ -183,6 +182,11 @@ function ProTable(props) {
|
|
|
183
182
|
setCurColumns(nextColumns);
|
|
184
183
|
};
|
|
185
184
|
};
|
|
185
|
+
var _rowClassName = function _rowClassName(record, index) {
|
|
186
|
+
if (originalDataSource && !originalObj.hasOwnProperty(get(record, 'rowKey'))) {
|
|
187
|
+
return 'new-cell';
|
|
188
|
+
}
|
|
189
|
+
};
|
|
186
190
|
var columns = useMemo(function () {
|
|
187
191
|
var newColumns = curColumns.map(function (item, index) {
|
|
188
192
|
var _propsColumnObj$getCo2;
|
|
@@ -208,18 +212,19 @@ function ProTable(props) {
|
|
|
208
212
|
formatColumn({
|
|
209
213
|
column: item,
|
|
210
214
|
originalObj: originalObj,
|
|
211
|
-
|
|
212
|
-
|
|
215
|
+
rowKey: props.rowKey,
|
|
216
|
+
diffConfig: diffConfig,
|
|
213
217
|
diffToolTip: toolTip,
|
|
214
218
|
wrapToolTipProps: wrapToolTipProps,
|
|
215
219
|
scroll: _scroll,
|
|
216
220
|
onUpdateMinWidth: function onUpdateMinWidth(w) {
|
|
217
221
|
curColumns[index].minWidth = w;
|
|
218
|
-
}
|
|
222
|
+
},
|
|
223
|
+
isInNewRow: _rowClassName
|
|
219
224
|
});
|
|
220
225
|
});
|
|
221
226
|
return newColumns;
|
|
222
|
-
}, [curColumns, handleResize, _scroll]);
|
|
227
|
+
}, [curColumns, handleResize, _scroll, originalDataSource, originalObj, _rowClassName]);
|
|
223
228
|
var _columns = useMemo(function () {
|
|
224
229
|
return columns === null || columns === void 0 ? void 0 : columns.filter(function (item, index) {
|
|
225
230
|
var show = item.show;
|
|
@@ -368,11 +373,6 @@ function ProTable(props) {
|
|
|
368
373
|
return _ref7.apply(this, arguments);
|
|
369
374
|
};
|
|
370
375
|
}();
|
|
371
|
-
var _rowClassName = function _rowClassName(record, index) {
|
|
372
|
-
if (originalDataSource && !originalObj.hasOwnProperty(get(record, 'rowKey'))) {
|
|
373
|
-
return 'new-cell';
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
376
|
var TableComponent = draggable ? DraggableTable : BaseTable;
|
|
377
377
|
// 标记样式
|
|
378
378
|
var tagStyle = {
|
|
@@ -446,7 +446,7 @@ function ProTable(props) {
|
|
|
446
446
|
})]
|
|
447
447
|
})
|
|
448
448
|
});
|
|
449
|
-
}
|
|
449
|
+
};
|
|
450
450
|
ProTable.defaultProps = {
|
|
451
451
|
quickConfig: false,
|
|
452
452
|
stripe: true,
|
|
@@ -41,6 +41,12 @@ 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;
|
|
48
|
+
viewRender?: ({ value, record, index, originalValue, originalRecord }: any) => any;
|
|
49
|
+
diffChange?: boolean;
|
|
44
50
|
}
|
|
45
51
|
export interface CreateTreeFromArrayOptions {
|
|
46
52
|
itemKey?: string;
|