@zat-design/sisyphus-react 3.9.1 → 3.9.2-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 +72 -29
- package/dist/less.esm.css +72 -29
- package/es/ProDrawerForm/style/index.less +3 -0
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +2 -1
- package/es/ProEditTable/propsType.d.ts +2 -0
- package/es/ProEditTable/style/index.less +11 -4
- package/es/ProEnum/index.js +5 -3
- package/es/ProForm/components/combination/FormList/index.js +1 -1
- package/es/ProForm/components/combination/Group/index.js +15 -8
- package/es/ProForm/components/combination/Group/propsType.d.ts +2 -0
- package/es/ProForm/components/combination/Group/style/index.less +15 -0
- package/es/ProForm/components/combination/Group/utils.js +43 -9
- package/es/ProForm/components/combination/ProCascader/index.js +7 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +14 -13
- package/es/ProForm/components/render/ChangedWrapper.js +2 -1
- package/es/ProForm/style/index.less +2 -2
- package/es/ProLayout/style/index.less +5 -0
- package/es/ProTable/components/FormatColumn/index.js +69 -29
- package/es/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/es/ProTable/components/RenderColumn/index.js +3 -5
- package/es/ProTable/propsType.d.ts +4 -5
- package/es/ProTable/style/index.less +36 -17
- package/es/ProTable/utils/index.d.ts +2 -0
- package/es/ProTable/utils/index.js +16 -3
- package/lib/ProDrawerForm/style/index.less +3 -0
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +2 -1
- package/lib/ProEditTable/propsType.d.ts +2 -0
- package/lib/ProEditTable/style/index.less +11 -4
- package/lib/ProEnum/index.js +5 -3
- package/lib/ProForm/components/combination/FormList/index.js +1 -1
- package/lib/ProForm/components/combination/Group/index.js +15 -8
- package/lib/ProForm/components/combination/Group/propsType.d.ts +2 -0
- package/lib/ProForm/components/combination/Group/style/index.less +15 -0
- package/lib/ProForm/components/combination/Group/utils.js +44 -9
- package/lib/ProForm/components/combination/ProCascader/index.js +7 -1
- package/lib/ProForm/components/combination/ProModalSelect/index.js +14 -13
- package/lib/ProForm/components/render/ChangedWrapper.js +2 -1
- package/lib/ProForm/style/index.less +2 -2
- package/lib/ProLayout/style/index.less +5 -0
- package/lib/ProTable/components/FormatColumn/index.js +69 -29
- package/lib/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/lib/ProTable/components/RenderColumn/index.js +3 -5
- package/lib/ProTable/propsType.d.ts +4 -5
- package/lib/ProTable/style/index.less +36 -17
- package/lib/ProTable/utils/index.d.ts +2 -0
- package/lib/ProTable/utils/index.js +16 -3
- package/package.json +2 -2
@@ -666,7 +666,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
666
666
|
run(nextParams);
|
667
667
|
}, 300);
|
668
668
|
}
|
669
|
-
}, [JSON.stringify(value),
|
669
|
+
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams), JSON.stringify(initParams)]);
|
670
670
|
useDebounceEffect(function () {
|
671
671
|
if (!value) {
|
672
672
|
if (defaultOne) {
|
@@ -830,23 +830,24 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
830
830
|
children: "".concat(viewText)
|
831
831
|
});
|
832
832
|
}
|
833
|
-
return _jsxs(
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
833
|
+
return _jsxs(_Fragment, {
|
834
|
+
children: [_jsx("div", {
|
835
|
+
id: uuid,
|
836
|
+
className: "pro-modal-select ".concat(className !== null && className !== void 0 ? className : ''),
|
837
|
+
style: style,
|
838
|
+
children: isTooltip && viewText ? _jsx(_Tooltip, {
|
839
|
+
placement: "topLeft",
|
840
|
+
open: open,
|
841
|
+
title: viewText,
|
842
|
+
children: initRender
|
843
|
+
}) : initRender
|
844
|
+
}), _jsxs(ProDrawerForm, _objectSpread(_objectSpread({
|
843
845
|
showType: "Modal",
|
844
846
|
title: title,
|
845
847
|
onOk: handleFinish,
|
846
848
|
// @ts-ignore
|
847
849
|
onCancel: handleClose,
|
848
|
-
visible: visible
|
849
|
-
zIndex: 1071
|
850
|
+
visible: visible
|
850
851
|
}, restModalProps), {}, {
|
851
852
|
children: [_jsx(ProForm, {
|
852
853
|
submitOnEnter: true,
|
@@ -44,7 +44,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
44
44
|
var noChange = !equalWith && (!originalValues || isDiffAll ? false : isEmpty(originalValue));
|
45
45
|
var diffType = useMemo(function () {
|
46
46
|
if (!isWatch || noChange) return 'same';
|
47
|
-
var _value = normalize ? normalize(props[valuePropName])
|
47
|
+
var _value = normalize ? normalize(props[valuePropName], undefined, undefined, true) // true 代表是值比对时的调用
|
48
|
+
: props[valuePropName];
|
48
49
|
return diffOriginal({
|
49
50
|
originalValue: originalValue,
|
50
51
|
value: _value,
|
@@ -351,7 +351,7 @@
|
|
351
351
|
background: transparent !important;
|
352
352
|
}
|
353
353
|
.@{ant-prefix}-select-selection-placeholder {
|
354
|
-
z-index: 9;
|
354
|
+
// z-index: 9;
|
355
355
|
}
|
356
356
|
}
|
357
357
|
|
@@ -429,7 +429,7 @@
|
|
429
429
|
background: transparent !important;
|
430
430
|
}
|
431
431
|
.@{ant-prefix}-select-selection-placeholder {
|
432
|
-
z-index: 9;
|
432
|
+
// z-index: 9;
|
433
433
|
}
|
434
434
|
}
|
435
435
|
|
@@ -113,9 +113,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
113
113
|
}
|
114
114
|
};
|
115
115
|
if (column === null || column === void 0 ? void 0 : column.render) {
|
116
|
-
if (!originalObj && Object.keys(originalObj
|
117
|
-
|
118
|
-
}
|
116
|
+
// if (!originalObj && Object.keys(originalObj ?? {}).length === 0 && !onDiff) {
|
117
|
+
// return;
|
118
|
+
// }
|
119
119
|
var originalRender = column.render; // 保存原始的 render 方法
|
120
120
|
// 自定义render 手动重载下
|
121
121
|
column.render = function (value, record, index) {
|
@@ -123,8 +123,10 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
123
123
|
var _value = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(value, record !== null && record !== void 0 ? record : {}, index) : null;
|
124
124
|
var originalResult = getOriginalValue(value, record !== null && record !== void 0 ? record : {}, originalObj, rowKey, dataIndex);
|
125
125
|
var originalValue = originalResult.originalValue;
|
126
|
-
var isChanged = originalResult.isChanged
|
126
|
+
var isChanged = originalResult.isChanged,
|
127
|
+
isAddCell = originalResult.isAddCell;
|
127
128
|
var isInNewRowFlag = isInNewRow(record);
|
129
|
+
var _isAddCell = isAddCell;
|
128
130
|
otherProps.isChanged = isChanged;
|
129
131
|
// 存在比对
|
130
132
|
if (isFunction(otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewRender) && (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource)) {
|
@@ -142,6 +144,27 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
142
144
|
}
|
143
145
|
originalValue = diffResult;
|
144
146
|
}
|
147
|
+
// 存在自定义onDiff比对
|
148
|
+
if (isFunction(onDiff)) {
|
149
|
+
var _originalObj$record$r2;
|
150
|
+
var _diffResult = onDiff({
|
151
|
+
originalValue: originalValue,
|
152
|
+
originalRecord: (_originalObj$record$r2 = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r2 !== void 0 ? _originalObj$record$r2 : {},
|
153
|
+
value: value,
|
154
|
+
record: record,
|
155
|
+
index: index
|
156
|
+
});
|
157
|
+
if (_diffResult === 'changed') {
|
158
|
+
otherProps.isChanged = true;
|
159
|
+
}
|
160
|
+
if (_diffResult === 'same') {
|
161
|
+
otherProps.isChanged = false;
|
162
|
+
}
|
163
|
+
if (_diffResult === 'add') {
|
164
|
+
_isAddCell = true;
|
165
|
+
otherProps.isChanged = false;
|
166
|
+
}
|
167
|
+
}
|
145
168
|
return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
|
146
169
|
valueType: valueType,
|
147
170
|
originalValue: isEmpty(originalValue) ? null : originalValue,
|
@@ -152,7 +175,8 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
152
175
|
currentValue: _value,
|
153
176
|
toolTipProps: _toolTipProps,
|
154
177
|
minWidth: minWidth,
|
155
|
-
isInNewRowFlag: isInNewRowFlag
|
178
|
+
isInNewRowFlag: isInNewRowFlag,
|
179
|
+
isAddCell: _isAddCell
|
156
180
|
}));
|
157
181
|
};
|
158
182
|
return;
|
@@ -177,8 +201,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
177
201
|
var realValue = tools.calc(Number(value !== null && value !== void 0 ? value : 0), '*', multiple);
|
178
202
|
var renderValue = getDecimalDigits(value) > valueTypePrecision ? realValue : realValue.toFixed(valueTypePrecision);
|
179
203
|
var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
180
|
-
var
|
181
|
-
|
204
|
+
var isChanged = originalResult.isChanged,
|
205
|
+
originalValue = originalResult.originalValue,
|
206
|
+
isAddCell = originalResult.isAddCell;
|
182
207
|
otherProps.isChanged = isChanged;
|
183
208
|
var originalRealValue = tools.calc(Number(originalValue || null), '*', multiple);
|
184
209
|
var originalRenderValue = getDecimalDigits(originalValue) > valueTypePrecision ? originalRealValue : originalRealValue.toFixed(valueTypePrecision);
|
@@ -208,7 +233,8 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
208
233
|
currentValue: renderValue,
|
209
234
|
toolTipProps: _toolTipProps,
|
210
235
|
minWidth: minWidth,
|
211
|
-
isInNewRowFlag: isInNewRowFlag
|
236
|
+
isInNewRowFlag: isInNewRowFlag,
|
237
|
+
isAddCell: isAddCell
|
212
238
|
}));
|
213
239
|
};
|
214
240
|
// 千分位, 千分位带CNY前缀
|
@@ -217,8 +243,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
217
243
|
var valueStr = valueTypePrecision ? "".concat(Number(value).toFixed(valueTypePrecision)) : "".concat(value);
|
218
244
|
var renderValue = valueStr.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
219
245
|
var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
220
|
-
var
|
221
|
-
|
246
|
+
var isChanged = originalResult.isChanged,
|
247
|
+
originalValue = originalResult.originalValue,
|
248
|
+
isAddCell = originalResult.isAddCell;
|
222
249
|
otherProps.isChanged = isChanged;
|
223
250
|
var originalRealValue = valueTypePrecision ? "".concat(Number(originalValue).toFixed(valueTypePrecision)) : "".concat(originalValue);
|
224
251
|
var originalRenderValue = originalRealValue.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
@@ -248,7 +275,8 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
248
275
|
currentValue: renderValue,
|
249
276
|
toolTipProps: _toolTipProps,
|
250
277
|
minWidth: minWidth,
|
251
|
-
isInNewRowFlag: isInNewRowFlag
|
278
|
+
isInNewRowFlag: isInNewRowFlag,
|
279
|
+
isAddCell: isAddCell
|
252
280
|
}));
|
253
281
|
};
|
254
282
|
} else if (['datePicker', 'date', 'dateTime', 'dateStartTime', 'dateEndTime', 'dateStartEndTime'].includes(valueType)) {
|
@@ -256,8 +284,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
256
284
|
var _moment, _moment2, _moment3, _moment4, _moment5, _moment6, _moment7, _moment8, _moment9, _moment10, _moment11, _moment12, _moment13, _moment14;
|
257
285
|
var renderValue = (_moment = moment(value)) === null || _moment === void 0 ? void 0 : _moment.format(format);
|
258
286
|
var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
259
|
-
var
|
260
|
-
|
287
|
+
var isChanged = originalResult.isChanged,
|
288
|
+
originalValue = originalResult.originalValue,
|
289
|
+
isAddCell = originalResult.isAddCell;
|
261
290
|
otherProps.isChanged = isChanged;
|
262
291
|
var originalRenderValue = (_moment2 = moment(originalValue)) === null || _moment2 === void 0 ? void 0 : _moment2.format(format);
|
263
292
|
switch (valueType) {
|
@@ -311,7 +340,8 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
311
340
|
currentValue: renderValue,
|
312
341
|
toolTipProps: _toolTipProps,
|
313
342
|
minWidth: minWidth,
|
314
|
-
isInNewRowFlag: isInNewRowFlag
|
343
|
+
isInNewRowFlag: isInNewRowFlag,
|
344
|
+
isAddCell: isAddCell
|
315
345
|
}));
|
316
346
|
};
|
317
347
|
} else if (['enumName', 'enumCodeName'].includes(valueType)) {
|
@@ -319,8 +349,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
319
349
|
var realCode = typeof code === 'function' ? code(value, record) : code;
|
320
350
|
var renderValue = getEnumLabel(realCode, value, valueType === 'enumCodeName');
|
321
351
|
var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
322
|
-
var
|
323
|
-
|
352
|
+
var isChanged = originalResult.isChanged,
|
353
|
+
originalValue = originalResult.originalValue,
|
354
|
+
isAddCell = originalResult.isAddCell;
|
324
355
|
otherProps.isChanged = isChanged;
|
325
356
|
var originalRenderValue = getEnumLabel(realCode, originalValue, valueType === 'enumCodeName');
|
326
357
|
if (Array.isArray(column === null || column === void 0 ? void 0 : column.codeValues) && !realCode) {
|
@@ -354,15 +385,17 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
354
385
|
currentValue: renderValue,
|
355
386
|
toolTipProps: _toolTipProps,
|
356
387
|
minWidth: minWidth,
|
357
|
-
isInNewRowFlag: isInNewRowFlag
|
388
|
+
isInNewRowFlag: isInNewRowFlag,
|
389
|
+
isAddCell: isAddCell
|
358
390
|
}));
|
359
391
|
};
|
360
392
|
} else if (precision || prefix || suffix) {
|
361
393
|
column.render = function (value, record, index) {
|
362
394
|
var renderValue = value === 'number' ? value.toFixed(precision) : value;
|
363
395
|
var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
364
|
-
var
|
365
|
-
|
396
|
+
var isChanged = originalResult.isChanged,
|
397
|
+
originalValue = originalResult.originalValue,
|
398
|
+
isAddCell = originalResult.isAddCell;
|
366
399
|
otherProps.isChanged = isChanged;
|
367
400
|
var originalRenderValue = originalValue === 'number' ? originalValue.toFixed(precision) : originalValue;
|
368
401
|
var node = _jsxs(_Space, {
|
@@ -391,7 +424,8 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
391
424
|
currentValue: renderValue,
|
392
425
|
toolTipProps: _toolTipProps,
|
393
426
|
minWidth: minWidth,
|
394
|
-
isInNewRowFlag: isInNewRowFlag
|
427
|
+
isInNewRowFlag: isInNewRowFlag,
|
428
|
+
isAddCell: isAddCell
|
395
429
|
}));
|
396
430
|
};
|
397
431
|
} else if (valueType === 'address') {
|
@@ -399,8 +433,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
399
433
|
var _realValue$filter;
|
400
434
|
var realValue = transform ? transform(value, record) : value;
|
401
435
|
var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
402
|
-
var
|
403
|
-
|
436
|
+
var isChanged = originalResult.isChanged,
|
437
|
+
originalValue = originalResult.originalValue,
|
438
|
+
isAddCell = originalResult.isAddCell;
|
404
439
|
otherProps.isChanged = isChanged;
|
405
440
|
var originalRealValue = transform ? transform(originalValue, record) : originalValue;
|
406
441
|
var isEmpty = !realValue || Array.isArray(realValue) && (realValue === null || realValue === void 0 ? void 0 : (_realValue$filter = realValue.filter(function (item) {
|
@@ -448,7 +483,8 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
448
483
|
currentValue: renderValue,
|
449
484
|
toolTipProps: _toolTipProps,
|
450
485
|
minWidth: minWidth,
|
451
|
-
isInNewRowFlag: isInNewRowFlag
|
486
|
+
isInNewRowFlag: isInNewRowFlag,
|
487
|
+
isAddCell: isAddCell
|
452
488
|
}));
|
453
489
|
};
|
454
490
|
} else if (copyable) {
|
@@ -473,8 +509,9 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
473
509
|
} else if (ellipsis) {
|
474
510
|
column.render = function (value, record, index) {
|
475
511
|
var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
476
|
-
var
|
477
|
-
|
512
|
+
var isChanged = originalResult.isChanged,
|
513
|
+
originalValue = originalResult.originalValue,
|
514
|
+
isAddCell = originalResult.isAddCell;
|
478
515
|
otherProps.isChanged = isChanged;
|
479
516
|
if (!value && value !== 0 && value === originalValue) {
|
480
517
|
_jsx("div", {
|
@@ -497,15 +534,17 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
497
534
|
currentValue: value || '-',
|
498
535
|
toolTipProps: _toolTipProps,
|
499
536
|
minWidth: minWidth,
|
500
|
-
isInNewRowFlag: isInNewRowFlag
|
537
|
+
isInNewRowFlag: isInNewRowFlag,
|
538
|
+
isAddCell: isAddCell
|
501
539
|
})), suffixNode(value, record, index)]
|
502
540
|
});
|
503
541
|
};
|
504
542
|
} else {
|
505
543
|
column.render = function (value, record, index) {
|
506
544
|
var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
507
|
-
var
|
508
|
-
|
545
|
+
var isChanged = originalResult.isChanged,
|
546
|
+
originalValue = originalResult.originalValue,
|
547
|
+
isAddCell = originalResult.isAddCell;
|
509
548
|
otherProps.isChanged = isChanged;
|
510
549
|
var node = _jsxs(_Space, {
|
511
550
|
size: 8,
|
@@ -530,7 +569,8 @@ export var formatColumn = function formatColumn(_ref2) {
|
|
530
569
|
currentValue: value || '-',
|
531
570
|
toolTipProps: _toolTipProps,
|
532
571
|
minWidth: minWidth,
|
533
|
-
isInNewRowFlag: isInNewRowFlag
|
572
|
+
isInNewRowFlag: isInNewRowFlag,
|
573
|
+
isAddCell: isAddCell
|
534
574
|
}));
|
535
575
|
};
|
536
576
|
}
|
@@ -37,7 +37,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
37
37
|
tooltip = _useSetState2[0].tooltip,
|
38
38
|
setState = _useSetState2[1];
|
39
39
|
var cellDiffCls = classNames({
|
40
|
-
'varied-cell': props === null || props === void 0 ? void 0 : props.isChanged
|
40
|
+
'varied-cell': props === null || props === void 0 ? void 0 : props.isChanged,
|
41
|
+
'add-cell': props === null || props === void 0 ? void 0 : props.isAddCell
|
41
42
|
});
|
42
43
|
// 比对场景走的逻辑
|
43
44
|
if (!isInNewRowFlag && isBoolean(props === null || props === void 0 ? void 0 : props.isChanged)) {
|
@@ -97,10 +98,7 @@ var RenderColumn = function RenderColumn(props) {
|
|
97
98
|
children: renderNode
|
98
99
|
}));
|
99
100
|
}
|
100
|
-
|
101
|
-
return renderNode;
|
102
|
-
}
|
103
|
-
return _jsx("span", {
|
101
|
+
return _jsx("div", {
|
104
102
|
className: cellDiffCls,
|
105
103
|
style: {
|
106
104
|
width: width,
|
@@ -40,11 +40,10 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
|
|
40
40
|
toolTipProps?: TooltipProps & React.RefAttributes<unknown>;
|
41
41
|
transform?: (value: any, record?: any) => string[];
|
42
42
|
show?: boolean | (() => boolean);
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}) =>
|
47
|
-
viewRender?: ({ value, record, index, originalValue, originalRecord }: any) => any;
|
43
|
+
/** 自定义比对函数, 触发条件必须写render */
|
44
|
+
onDiff?: ({ value, record, index, originalValue, originalRecord }: any) => any;
|
45
|
+
/** 自定义提示render, 触发条件必须写render */
|
46
|
+
viewRender?: ({ value, record, index, originalValue, originalRecord }: any) => 'same' | 'changed' | 'add' | undefined;
|
48
47
|
isChanged?: boolean | null;
|
49
48
|
}
|
50
49
|
export interface CreateTreeFromArrayOptions {
|
@@ -257,37 +257,50 @@
|
|
257
257
|
}
|
258
258
|
}
|
259
259
|
|
260
|
-
|
261
|
-
|
262
|
-
|
260
|
+
|
261
|
+
.@{ant-prefix}-table table tbody.@{ant-prefix}-table-tbody,
|
262
|
+
.@{ant-prefix}-table.@{ant-prefix}-table-scroll-horizontal table tbody.@{ant-prefix}-table-tbody {
|
263
|
+
tr.@{ant-prefix}-table-row.new-cell,
|
264
|
+
tr.@{ant-prefix}-table-row.new-cell:hover {
|
263
265
|
background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
|
264
|
-
td.@{ant-prefix}-table-cell
|
265
|
-
background: var(--zaui-contract-bg-add; #d2fff4) !important;
|
266
|
+
td.@{ant-prefix}-table-cell{
|
266
267
|
background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
|
267
268
|
border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
|
268
269
|
&.@{ant-prefix}-table-cell-fix-right {
|
269
|
-
background: var(--zaui-contract-bg-add; #d2fff4) !important;
|
270
270
|
background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
|
271
271
|
border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
|
272
272
|
}
|
273
273
|
&.@{ant-prefix}-table-cell-fix-left {
|
274
|
-
background: var(--zaui-contract-bg-add; #d2fff4) !important;
|
275
274
|
background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
|
276
275
|
border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
|
277
276
|
}
|
278
277
|
}
|
279
278
|
}
|
280
279
|
|
281
|
-
.@{ant-prefix}-table-cell
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
280
|
+
.@{ant-prefix}-table-cell {
|
281
|
+
.varied-cell {
|
282
|
+
display: block;
|
283
|
+
margin-left: -8px;
|
284
|
+
padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
|
285
|
+
background-color: var(--zaui-contract-bg; #fffaa1) !important;
|
286
|
+
border-radius: var(--zaui-border-radius, 8px);
|
287
|
+
.pro-form-view-container {
|
288
|
+
overflow: hidden;
|
289
|
+
white-space: nowrap;
|
290
|
+
text-overflow: ellipsis;
|
291
|
+
}
|
292
|
+
}
|
293
|
+
.add-cell{
|
294
|
+
display: block;
|
295
|
+
margin-left: -8px;
|
296
|
+
padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
|
297
|
+
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
298
|
+
border-radius: var(--zaui-border-radius, 8px);
|
299
|
+
.pro-form-view-container {
|
300
|
+
overflow: hidden;
|
301
|
+
white-space: nowrap;
|
302
|
+
text-overflow: ellipsis;
|
303
|
+
}
|
291
304
|
}
|
292
305
|
}
|
293
306
|
|
@@ -583,3 +596,9 @@
|
|
583
596
|
}
|
584
597
|
}
|
585
598
|
}
|
599
|
+
|
600
|
+
.@{ant-prefix}-table{
|
601
|
+
.original-value-tooltip{
|
602
|
+
position: fixed;
|
603
|
+
}
|
604
|
+
}
|
@@ -12,9 +12,11 @@ export declare const getDecimalDigits: (num?: number) => number;
|
|
12
12
|
* @param any originalObj
|
13
13
|
* @param {any} dataIndex
|
14
14
|
* @return {any} isChanged 返回bool值,表示存在比对
|
15
|
+
* @return {any} isAddCell 返回bool值,表示存在比对
|
15
16
|
*/
|
16
17
|
export declare const getOriginalValue: (value: any, record: any, originalObj: any, rowKey: any, dataIndex: any) => {
|
17
18
|
originalValue: any;
|
19
|
+
isAddCell: boolean;
|
18
20
|
isChanged: boolean;
|
19
21
|
};
|
20
22
|
export declare const getColumnDataIndex: (dataIndex: string | string[]) => string;
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import { get, isEqual } from 'lodash';
|
2
|
+
import { validate } from '@zat-design/utils';
|
3
|
+
var isEmpty = validate.isEmpty;
|
2
4
|
/**
|
3
5
|
* 获取小数点后的位数
|
4
6
|
* @param num 数字
|
@@ -17,25 +19,36 @@ export var getDecimalDigits = function getDecimalDigits() {
|
|
17
19
|
* @param any originalObj
|
18
20
|
* @param {any} dataIndex
|
19
21
|
* @return {any} isChanged 返回bool值,表示存在比对
|
22
|
+
* @return {any} isAddCell 返回bool值,表示存在比对
|
20
23
|
*/
|
21
24
|
export var getOriginalValue = function getOriginalValue(value, record, originalObj, rowKey, dataIndex) {
|
22
25
|
if (!originalObj) {
|
23
26
|
return {
|
24
27
|
originalValue: null,
|
25
|
-
isChanged: null
|
28
|
+
isChanged: null,
|
29
|
+
isAddCell: null
|
26
30
|
};
|
27
31
|
}
|
28
32
|
var originalRecord = get(originalObj, get(record, rowKey));
|
29
33
|
var originalValue = get(originalRecord, dataIndex);
|
34
|
+
if (isEmpty(originalValue) && !isEmpty(value)) {
|
35
|
+
return {
|
36
|
+
originalValue: originalValue,
|
37
|
+
isAddCell: true,
|
38
|
+
isChanged: false
|
39
|
+
};
|
40
|
+
}
|
30
41
|
if (!isEqual(originalValue, value)) {
|
31
42
|
return {
|
32
43
|
originalValue: originalValue,
|
33
|
-
isChanged: true
|
44
|
+
isChanged: true,
|
45
|
+
isAddCell: false
|
34
46
|
};
|
35
47
|
}
|
36
48
|
return {
|
37
49
|
originalValue: null,
|
38
|
-
isChanged: false
|
50
|
+
isChanged: false,
|
51
|
+
isAddCell: false
|
39
52
|
};
|
40
53
|
};
|
41
54
|
export var getColumnDataIndex = function getColumnDataIndex(dataIndex) {
|
@@ -123,7 +123,8 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
123
123
|
var noChange = !equalWith && (!originalValues || isDiffAll ? false : (0, _utils.isEmpty)(originalValue));
|
124
124
|
var diffType = (0, _react.useMemo)(function () {
|
125
125
|
if (!isWatch || noChange) return 'same';
|
126
|
-
var _value = normalize ? normalize(props[valuePropName])
|
126
|
+
var _value = normalize ? normalize(props[valuePropName], undefined, undefined, true) // true 代表是值比对时的调用
|
127
|
+
: props[valuePropName];
|
127
128
|
return (0, _diffOriginal.diffOriginal)({
|
128
129
|
value: _value,
|
129
130
|
originalValue: originalValue,
|
@@ -8,6 +8,7 @@ import type { ColumnType, TableProps } from 'antd/es/table';
|
|
8
8
|
import type { FormInstance, FormItemProps } from 'antd/es/form';
|
9
9
|
import type { FunctionArgs, ProRule } from '../ProForm/propsType';
|
10
10
|
import { ProFormValueType, ColumnPropsMap } from '../ProForm/components/render/propsType';
|
11
|
+
import { DiffOriginalParams } from '../ProForm/utils/diffOriginal';
|
11
12
|
export type ActionType = 'edit' | 'delete' | 'save' | 'cancel' | 'add' | 'mulDelete' | 'custom';
|
12
13
|
export type ShowFunction<T> = (record?: T, options?: {
|
13
14
|
index?: number;
|
@@ -105,6 +106,7 @@ export interface ProColumnsProps<Values = any, T = any> extends Omit<FormItemPro
|
|
105
106
|
hiddenNames?: NamePath[] | NamePath[][];
|
106
107
|
rules?: ProRule[] | RulesFn<T>;
|
107
108
|
confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps | void>;
|
109
|
+
onDiff?: DiffOriginalParams['equalWith'];
|
108
110
|
[key: string]: any;
|
109
111
|
}
|
110
112
|
export type ProEditTableColumnsProps<K = any> = ProColumnsProps & ColumnPropsMap<K, 'ProEditTable'>;
|
@@ -290,12 +290,19 @@
|
|
290
290
|
}
|
291
291
|
}
|
292
292
|
|
293
|
-
.@{ant-prefix}-table .@{ant-prefix}-table-tbody .is-new-row.@{ant-prefix}-table-row td
|
294
|
-
|
293
|
+
.@{ant-prefix}-table table .@{ant-prefix}-table-tbody .is-new-row.@{ant-prefix}-table-row td,
|
294
|
+
.@{ant-prefix}-table table .@{ant-prefix}-table-tbody .is-new-row.@{ant-prefix}-table-row td.@{ant-prefix}-table-cell-fix-left,
|
295
|
+
.@{ant-prefix}-table table .@{ant-prefix}-table-tbody .is-new-row.@{ant-prefix}-table-row td.@{ant-prefix}-table-cell-fix-right,
|
296
|
+
.@{ant-prefix}-table.@{ant-prefix}-table-scroll-horizontal table .@{ant-prefix}-table-tbody .is-new-row.@{ant-prefix}-table-row td,
|
297
|
+
.@{ant-prefix}-table.@{ant-prefix}-table-scroll-horizontal table .@{ant-prefix}-table-tbody .is-new-row.@{ant-prefix}-table-row td.@{ant-prefix}-table-cell-fix-left,
|
298
|
+
.@{ant-prefix}-table.@{ant-prefix}-table-scroll-horizontal table .@{ant-prefix}-table-tbody .is-new-row.@{ant-prefix}-table-row td.@{ant-prefix}-table-cell-fix-right{
|
299
|
+
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
300
|
+
border-bottom: 1px solid var(--zaui-form-control-line,#dcdcdc) ;
|
295
301
|
}
|
296
|
-
.@{ant-prefix}-table .@{ant-prefix}-table-tbody .is-new-row.@{ant-prefix}-table-row:hover
|
302
|
+
.@{ant-prefix}-table .@{ant-prefix}-table-tbody .is-new-row.@{ant-prefix}-table-row:hover,
|
303
|
+
.@{ant-prefix}-table.@{ant-prefix}-table-scroll-horizontal table .@{ant-prefix}-table-tbody .is-new-row.@{ant-prefix}-table-row:hover{
|
297
304
|
td, .@{ant-prefix}-table-cell-row-hover {
|
298
|
-
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
305
|
+
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
299
306
|
}
|
300
307
|
}
|
301
308
|
}
|
package/lib/ProEnum/index.js
CHANGED
@@ -26,10 +26,11 @@ var _getEnumLabel = _interopRequireDefault(require("./utils/getEnumLabel"));
|
|
26
26
|
var _useEnum = _interopRequireDefault(require("./hooks/useEnum"));
|
27
27
|
var _locale = _interopRequireDefault(require("../locale"));
|
28
28
|
require("./style/index.less");
|
29
|
+
var _useFieldProps2 = require("../ProForm/utils/useFieldProps");
|
29
30
|
var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps", "isView"],
|
30
31
|
_excluded2 = ["fieldNames", "clear", "cacheKey", "showCodeName"];
|
31
32
|
var ProEnum = function ProEnum(props) {
|
32
|
-
var _enumProps$showCodeNa;
|
33
|
+
var _otherProps$isView, _enumProps$showCodeNa;
|
33
34
|
var code = props.code,
|
34
35
|
_props$type = props.type,
|
35
36
|
type = _props$type === void 0 ? 'ProSelect' : _props$type,
|
@@ -44,8 +45,9 @@ var ProEnum = function ProEnum(props) {
|
|
44
45
|
enumProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
45
46
|
var _ref = otherProps || {},
|
46
47
|
viewEmpty = _ref.viewEmpty;
|
47
|
-
var _isView = isView !== undefined && isView !== null ? isView : otherProps === null || otherProps === void 0 ? void 0 : otherProps.isView;
|
48
48
|
var _defalutValue = props === null || props === void 0 ? void 0 : props.defaultValue;
|
49
|
+
var _useFieldProps = (0, _useFieldProps2.useFieldProps)(),
|
50
|
+
configIsView = _useFieldProps.isView;
|
49
51
|
var _ref2 = (0, _ProConfigProvider.useProConfig)('ProEnum') || {},
|
50
52
|
fieldNames = _ref2.fieldNames,
|
51
53
|
_ref2$clear = _ref2.clear,
|
@@ -54,6 +56,7 @@ var ProEnum = function ProEnum(props) {
|
|
54
56
|
cacheKey = _ref2$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref2$cacheKey,
|
55
57
|
showCodeName = _ref2.showCodeName,
|
56
58
|
resProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
59
|
+
var _isView = isView !== undefined && isView !== null ? isView : (_otherProps$isView = otherProps === null || otherProps === void 0 ? void 0 : otherProps.isView) !== null && _otherProps$isView !== void 0 ? _otherProps$isView : configIsView;
|
57
60
|
enumProps.showCodeName = (_enumProps$showCodeNa = enumProps.showCodeName) !== null && _enumProps$showCodeNa !== void 0 ? _enumProps$showCodeNa : showCodeName;
|
58
61
|
var label = 'label';
|
59
62
|
var fieldValue = 'value';
|
@@ -229,7 +232,6 @@ var ProEnum = function ProEnum(props) {
|
|
229
232
|
if (!code && !dataSource && !useRequest) {
|
230
233
|
var _locale$ProEnum4;
|
231
234
|
_antd.message.error(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum4 = _locale.default.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.errorNoEnumType);
|
232
|
-
// return;
|
233
235
|
}
|
234
236
|
var transToLabel = function transToLabel(value) {
|
235
237
|
var list = dataList && dataList.length ? dataList : enumLists;
|
@@ -49,7 +49,7 @@ var FormList = function FormList(props, ref) {
|
|
49
49
|
var _namePath = (0, _utils.toArray)(name);
|
50
50
|
var orgValues = (0, _lodash.get)(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
|
51
51
|
var _diffConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, diffConfig), {}, {
|
52
|
-
originalValues: isDiffAll ? orgValues || [] : orgValues
|
52
|
+
originalValues: (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues) && isDiffAll ? orgValues || [] : orgValues
|
53
53
|
});
|
54
54
|
var processColumns = (0, _react.useCallback)(function (fieldName, namePath) {
|
55
55
|
return columns.map(function (item) {
|