@zat-design/sisyphus-react 3.9.3 → 3.9.4-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 +42 -1
- package/dist/less.esm.css +38 -0
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +1 -1
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +20 -11
- package/es/ProEditTable/components/RenderField/index.js +42 -32
- package/es/ProEditTable/propsType.d.ts +1 -0
- package/es/ProEditTable/style/index.less +41 -0
- package/es/ProEditTable/utils/diffOriginal.d.ts +21 -0
- package/es/ProEditTable/utils/diffOriginal.js +62 -0
- package/es/ProForm/components/combination/ProCascader/index.js +11 -5
- package/es/ProForm/components/render/ChangedWrapper.js +14 -10
- package/es/ProForm/style/index.less +8 -0
- package/es/ProForm/utils/useShouldUpdate.js +10 -2
- package/es/ProStep/components/Item/index.js +13 -4
- package/es/style/theme/antd.less +4 -1
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +1 -1
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +20 -11
- package/lib/ProEditTable/components/RenderField/index.js +42 -32
- package/lib/ProEditTable/propsType.d.ts +1 -0
- package/lib/ProEditTable/style/index.less +41 -0
- package/lib/ProEditTable/utils/diffOriginal.d.ts +21 -0
- package/lib/ProEditTable/utils/diffOriginal.js +68 -0
- package/lib/ProForm/components/combination/ProCascader/index.js +10 -4
- package/lib/ProForm/components/render/ChangedWrapper.js +14 -10
- package/lib/ProForm/style/index.less +8 -0
- package/lib/ProForm/utils/useShouldUpdate.js +10 -2
- package/lib/ProStep/components/Item/index.js +13 -4
- package/lib/style/theme/antd.less +4 -1
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
@@ -3110,6 +3110,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
3110
3110
|
.pro-form .pro-form-item-changed .ant-select.ant-select-disabled .ant-select-selector {
|
3111
3111
|
background: var(--zaui-contract-bg, #fffaa1) !important;
|
3112
3112
|
}
|
3113
|
+
.pro-form .pro-form-item-changed .ant-picker-clear {
|
3114
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
3115
|
+
}
|
3113
3116
|
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper,
|
3114
3117
|
.pro-form .pro-form-item-changed .ant-select .ant-select-selector,
|
3115
3118
|
.pro-form .pro-form-item-changed .ant-picker,
|
@@ -3165,6 +3168,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
3165
3168
|
.pro-form .pro-form-item-add .ant-select.ant-select-disabled .ant-select-selector {
|
3166
3169
|
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
3167
3170
|
}
|
3171
|
+
.pro-form .pro-form-item-add .ant-picker-clear {
|
3172
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
3173
|
+
}
|
3168
3174
|
.pro-form .pro-form-item-add span.ant-input-affix-wrapper,
|
3169
3175
|
.pro-form .pro-form-item-add .ant-select .ant-select-selector,
|
3170
3176
|
.pro-form .pro-form-item-add .ant-picker,
|
@@ -4672,6 +4678,38 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
4672
4678
|
.pro-edit-table .ant-table.ant-table-scroll-horizontal table .ant-table-tbody .is-new-row.ant-table-row:hover .ant-table-cell-row-hover {
|
4673
4679
|
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
4674
4680
|
}
|
4681
|
+
.pro-edit-table * {
|
4682
|
+
scrollbar-face-color: #d2d3d7;
|
4683
|
+
scrollbar-highlight-color: #979797;
|
4684
|
+
scrollbar-3dlight-color: #979797;
|
4685
|
+
}
|
4686
|
+
.pro-edit-table * ::-webkit-scrollbar-thumb {
|
4687
|
+
background-color: #979797;
|
4688
|
+
background-clip: padding-box;
|
4689
|
+
border-color: transparent;
|
4690
|
+
border-style: dashed;
|
4691
|
+
border-width: 4px;
|
4692
|
+
border-radius: 10px;
|
4693
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
|
4694
|
+
}
|
4695
|
+
.pro-edit-table * ::-webkit-scrollbar-track {
|
4696
|
+
background: transparent;
|
4697
|
+
}
|
4698
|
+
.pro-edit-table * ::-webkit-scrollbar-thumb {
|
4699
|
+
background-color: #d2d3d7;
|
4700
|
+
background-clip: padding-box;
|
4701
|
+
border-color: transparent;
|
4702
|
+
border-style: dashed;
|
4703
|
+
border-width: 4px;
|
4704
|
+
border-radius: 10px;
|
4705
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
|
4706
|
+
}
|
4707
|
+
.pro-edit-table * ::-webkit-scrollbar-thumb {
|
4708
|
+
background-color: #979797;
|
4709
|
+
}
|
4710
|
+
.pro-edit-table * ::-webkit-scrollbar-track {
|
4711
|
+
background: transparent;
|
4712
|
+
}
|
4675
4713
|
.pro-edit-table-footer {
|
4676
4714
|
margin-top: 12px;
|
4677
4715
|
}
|
@@ -6043,5 +6081,8 @@ input[type='button'] {
|
|
6043
6081
|
--antd-arrow-background-color: linear-gradient(to right bottom, rgba(255, 255, 255, 0.95), #ffffff);
|
6044
6082
|
}
|
6045
6083
|
.ant-picker.ant-picker-disabled {
|
6046
|
-
background: var(--zaui-disabled-bg);
|
6084
|
+
background: var(--zaui-disabled-bg) !important;
|
6085
|
+
}
|
6086
|
+
.ant-input-affix-wrapper-disabled {
|
6087
|
+
background: var(--zaui-disabled-bg) !important;
|
6047
6088
|
}
|
package/dist/less.esm.css
CHANGED
@@ -3110,6 +3110,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
3110
3110
|
.pro-form .pro-form-item-changed .ant-select.ant-select-disabled .ant-select-selector {
|
3111
3111
|
background: var(--zaui-contract-bg, #fffaa1) !important;
|
3112
3112
|
}
|
3113
|
+
.pro-form .pro-form-item-changed .ant-picker-clear {
|
3114
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
3115
|
+
}
|
3113
3116
|
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper,
|
3114
3117
|
.pro-form .pro-form-item-changed .ant-select .ant-select-selector,
|
3115
3118
|
.pro-form .pro-form-item-changed .ant-picker,
|
@@ -3165,6 +3168,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
3165
3168
|
.pro-form .pro-form-item-add .ant-select.ant-select-disabled .ant-select-selector {
|
3166
3169
|
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
3167
3170
|
}
|
3171
|
+
.pro-form .pro-form-item-add .ant-picker-clear {
|
3172
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
3173
|
+
}
|
3168
3174
|
.pro-form .pro-form-item-add span.ant-input-affix-wrapper,
|
3169
3175
|
.pro-form .pro-form-item-add .ant-select .ant-select-selector,
|
3170
3176
|
.pro-form .pro-form-item-add .ant-picker,
|
@@ -4672,6 +4678,38 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
4672
4678
|
.pro-edit-table .ant-table.ant-table-scroll-horizontal table .ant-table-tbody .is-new-row.ant-table-row:hover .ant-table-cell-row-hover {
|
4673
4679
|
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
4674
4680
|
}
|
4681
|
+
.pro-edit-table * {
|
4682
|
+
scrollbar-face-color: #d2d3d7;
|
4683
|
+
scrollbar-highlight-color: #979797;
|
4684
|
+
scrollbar-3dlight-color: #979797;
|
4685
|
+
}
|
4686
|
+
.pro-edit-table * ::-webkit-scrollbar-thumb {
|
4687
|
+
background-color: #979797;
|
4688
|
+
background-clip: padding-box;
|
4689
|
+
border-color: transparent;
|
4690
|
+
border-style: dashed;
|
4691
|
+
border-width: 4px;
|
4692
|
+
border-radius: 10px;
|
4693
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
|
4694
|
+
}
|
4695
|
+
.pro-edit-table * ::-webkit-scrollbar-track {
|
4696
|
+
background: transparent;
|
4697
|
+
}
|
4698
|
+
.pro-edit-table * ::-webkit-scrollbar-thumb {
|
4699
|
+
background-color: #d2d3d7;
|
4700
|
+
background-clip: padding-box;
|
4701
|
+
border-color: transparent;
|
4702
|
+
border-style: dashed;
|
4703
|
+
border-width: 4px;
|
4704
|
+
border-radius: 10px;
|
4705
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
|
4706
|
+
}
|
4707
|
+
.pro-edit-table * ::-webkit-scrollbar-thumb {
|
4708
|
+
background-color: #979797;
|
4709
|
+
}
|
4710
|
+
.pro-edit-table * ::-webkit-scrollbar-track {
|
4711
|
+
background: transparent;
|
4712
|
+
}
|
4675
4713
|
.pro-edit-table-footer {
|
4676
4714
|
margin-top: 12px;
|
4677
4715
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { FormInstance } from 'antd';
|
3
3
|
import { NamePath } from 'antd/lib/form/interface';
|
4
|
-
import { DiffOriginalParams } from '
|
4
|
+
import { DiffOriginalParams } from '../../utils/diffOriginal';
|
5
5
|
interface Props {
|
6
6
|
name?: NamePath;
|
7
7
|
names?: NamePath[];
|
@@ -10,7 +10,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
import React, { useMemo, useRef } from 'react';
|
11
11
|
import classnames from 'classnames';
|
12
12
|
import { get } from 'lodash';
|
13
|
-
import { diffOriginal } from '
|
13
|
+
import { diffOriginal } from '../../utils/diffOriginal';
|
14
14
|
import { useProConfig } from '../../../ProConfigProvider';
|
15
15
|
import { isEmpty } from '../../../utils';
|
16
16
|
var toNamePath = function toNamePath(name) {
|
@@ -34,7 +34,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
34
34
|
if (!originalValues) {
|
35
35
|
return undefined;
|
36
36
|
}
|
37
|
-
var
|
37
|
+
var originRecord;
|
38
38
|
if (rowKeyPath) {
|
39
39
|
var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
|
40
40
|
var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
|
@@ -43,13 +43,13 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
43
43
|
var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
|
44
44
|
if (!keyValue) return undefined;
|
45
45
|
var originalValueList = get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|
46
|
-
|
46
|
+
originRecord = originalValueList === null || originalValueList === void 0 ? void 0 : originalValueList.find(function (item) {
|
47
47
|
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
48
48
|
});
|
49
49
|
var originalValue;
|
50
50
|
if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
|
51
51
|
var originalNamesValue = originalNames.map(function (originalName) {
|
52
|
-
return get(
|
52
|
+
return get(originRecord, originalName.slice(rowKeyPath.length - 1));
|
53
53
|
});
|
54
54
|
// 有可能出现数组中全是undefined的情况 视为没有值
|
55
55
|
var fillUndefined = originalNamesValue.every(function (valItem) {
|
@@ -57,11 +57,12 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
57
57
|
});
|
58
58
|
originalValue = fillUndefined ? undefined : originalNamesValue;
|
59
59
|
} else {
|
60
|
-
originalValue = get(
|
60
|
+
originalValue = get(originRecord, originalName.slice(rowKeyPath.length - 1));
|
61
61
|
}
|
62
62
|
return {
|
63
63
|
originalValue: originalValue,
|
64
|
-
|
64
|
+
originRecord: originRecord,
|
65
|
+
record: rowValue
|
65
66
|
};
|
66
67
|
}
|
67
68
|
// 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
|
@@ -69,7 +70,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
69
70
|
originalValue: (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
70
71
|
return get(originalValues, originalName);
|
71
72
|
}) : get(originalValues, originalName),
|
72
|
-
|
73
|
+
originRecord: originRecord
|
73
74
|
};
|
74
75
|
};
|
75
76
|
var ListChangedWrapper = function ListChangedWrapper(props) {
|
@@ -120,12 +121,20 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
120
121
|
if (!isWatch || noChange) return 'same';
|
121
122
|
var _value = normalize ? normalize(props[valuePropName], undefined, undefined, true) // true 代表是值比对时的调用
|
122
123
|
: props[valuePropName];
|
124
|
+
// fix:修复 DatePicker时,originalValue与最新值一致时,显示为 changed的问题
|
125
|
+
var _originalValue = normalize && ['DatePicker'].includes(props.type) ? normalize(originalValue, undefined, undefined, true) : originalValue;
|
126
|
+
// fix:修复 InputNumber 时,originalValue与最新值一致都为'0'时,显示为 changed的问题
|
127
|
+
if (['InputNumber'].includes(props.type) && normalize && _value === Number(originalValue)) {
|
128
|
+
return 'same';
|
129
|
+
}
|
123
130
|
return diffOriginal({
|
124
131
|
value: _value,
|
125
|
-
originalValue:
|
132
|
+
originalValue: _originalValue,
|
126
133
|
form: form,
|
127
|
-
equalWith: equalWith
|
128
|
-
|
134
|
+
equalWith: equalWith,
|
135
|
+
originRecord: originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originRecord,
|
136
|
+
record: originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.record,
|
137
|
+
index: index
|
129
138
|
});
|
130
139
|
}, [props[valuePropName], originalValue]);
|
131
140
|
var isAdd = diffType === 'add';
|
@@ -138,7 +147,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
138
147
|
var _children = children;
|
139
148
|
if (viewRender) {
|
140
149
|
if (! /*#__PURE__*/React.isValidElement(viewRender)) {
|
141
|
-
return viewRender(orgValue, (originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.
|
150
|
+
return viewRender(orgValue, (originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originRecord) || {}, {
|
142
151
|
form: form,
|
143
152
|
name: name,
|
144
153
|
index: index
|
@@ -6,7 +6,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
7
7
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
8
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
9
|
-
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "
|
9
|
+
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "onDiff", "className", "trim", "confirm", "dependencies"];
|
10
10
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
11
11
|
/* eslint-disable prefer-destructuring */
|
12
12
|
/* eslint-disable prefer-const */
|
@@ -52,11 +52,11 @@ var RenderField = function RenderField(_ref) {
|
|
52
52
|
required = _column$required === void 0 ? false : _column$required,
|
53
53
|
_column$rules = column.rules,
|
54
54
|
rules = _column$rules === void 0 ? [] : _column$rules,
|
55
|
-
equalWith = column.equalWith,
|
56
55
|
onDiff = column.onDiff,
|
57
56
|
className = column.className,
|
58
57
|
trim = column.trim,
|
59
58
|
confirm = column.confirm,
|
59
|
+
dependencies = column.dependencies,
|
60
60
|
resetProps = _objectWithoutProperties(column, _excluded);
|
61
61
|
// editRender弃用使用component同ProForm
|
62
62
|
var _editRender = component || editRender;
|
@@ -312,6 +312,8 @@ var RenderField = function RenderField(_ref) {
|
|
312
312
|
_key2,
|
313
313
|
_args,
|
314
314
|
rowPath,
|
315
|
+
_dependencies$map,
|
316
|
+
validateFieldKeys,
|
315
317
|
row,
|
316
318
|
orgRow,
|
317
319
|
_TargetComponent,
|
@@ -323,77 +325,85 @@ var RenderField = function RenderField(_ref) {
|
|
323
325
|
_Object$keys,
|
324
326
|
_Object$keys$map,
|
325
327
|
diff,
|
326
|
-
|
328
|
+
_validateFieldKeys,
|
327
329
|
_args2 = arguments;
|
328
330
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
329
331
|
while (1) switch (_context.prev = _context.next) {
|
330
332
|
case 0:
|
331
|
-
if (!(!onFieldChange && !onChange)) {
|
332
|
-
_context.next = 2;
|
333
|
-
break;
|
334
|
-
}
|
335
|
-
return _context.abrupt("return", null);
|
336
|
-
case 2:
|
337
333
|
for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
338
334
|
args[_key2] = _args2[_key2];
|
339
335
|
}
|
340
336
|
_args = [].concat(args);
|
341
337
|
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
342
|
-
|
338
|
+
if (!(!onFieldChange && !onChange)) {
|
339
|
+
_context.next = 6;
|
340
|
+
break;
|
341
|
+
}
|
342
|
+
if (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) {
|
343
|
+
validateFieldKeys = dependencies === null || dependencies === void 0 ? void 0 : (_dependencies$map = dependencies.map) === null || _dependencies$map === void 0 ? void 0 : _dependencies$map.call(dependencies, function (key) {
|
344
|
+
return [].concat(_toConsumableArray(rowPath), [key]);
|
345
|
+
});
|
346
|
+
setTimeout(function () {
|
347
|
+
form.validateFields(validateFieldKeys);
|
348
|
+
}, 100);
|
349
|
+
}
|
350
|
+
return _context.abrupt("return", null);
|
351
|
+
case 6:
|
352
|
+
row = form.getFieldValue(rowPath, true);
|
343
353
|
orgRow = cloneDeep(row);
|
344
354
|
if (!onFieldChange) {
|
345
|
-
_context.next =
|
355
|
+
_context.next = 21;
|
346
356
|
break;
|
347
357
|
}
|
348
358
|
_args = formatArgs(args);
|
349
359
|
_args[1] = row;
|
350
360
|
_context.t0 = (_TargetComponent = TargetComponent) === null || _TargetComponent === void 0 ? void 0 : (_TargetComponent$prop = _TargetComponent.props) === null || _TargetComponent$prop === void 0 ? void 0 : _TargetComponent$prop.onFieldChange;
|
351
361
|
if (!_context.t0) {
|
352
|
-
_context.next =
|
362
|
+
_context.next = 15;
|
353
363
|
break;
|
354
364
|
}
|
355
|
-
_context.next =
|
365
|
+
_context.next = 15;
|
356
366
|
return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, _toConsumableArray(_args));
|
357
|
-
case
|
367
|
+
case 15:
|
358
368
|
_context.t1 = onFieldChange;
|
359
369
|
if (!_context.t1) {
|
360
|
-
_context.next =
|
370
|
+
_context.next = 19;
|
361
371
|
break;
|
362
372
|
}
|
363
|
-
_context.next =
|
373
|
+
_context.next = 19;
|
364
374
|
return onFieldChange.apply(void 0, _toConsumableArray(_args));
|
365
|
-
case
|
366
|
-
_context.next =
|
375
|
+
case 19:
|
376
|
+
_context.next = 30;
|
367
377
|
break;
|
368
|
-
case
|
378
|
+
case 21:
|
369
379
|
_args = _args.concat([row, index, form]);
|
370
380
|
_context.t2 = (_TargetComponent2 = TargetComponent) === null || _TargetComponent2 === void 0 ? void 0 : (_TargetComponent2$pro = _TargetComponent2.props) === null || _TargetComponent2$pro === void 0 ? void 0 : _TargetComponent2$pro.onChange;
|
371
381
|
if (!_context.t2) {
|
372
|
-
_context.next =
|
382
|
+
_context.next = 26;
|
373
383
|
break;
|
374
384
|
}
|
375
|
-
_context.next =
|
385
|
+
_context.next = 26;
|
376
386
|
return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, _toConsumableArray(_args));
|
377
|
-
case
|
387
|
+
case 26:
|
378
388
|
_context.t3 = onChange;
|
379
389
|
if (!_context.t3) {
|
380
|
-
_context.next =
|
390
|
+
_context.next = 30;
|
381
391
|
break;
|
382
392
|
}
|
383
|
-
_context.next =
|
393
|
+
_context.next = 30;
|
384
394
|
return onChange.apply(void 0, _toConsumableArray(_args));
|
385
|
-
case
|
395
|
+
case 30:
|
386
396
|
// 判断属性是否变动
|
387
397
|
form.setFieldValue(rowPath, row);
|
388
398
|
if (validateTrigger && validateTrigger.includes('onChange')) {
|
389
399
|
if (!isEqual(orgRow, row)) {
|
390
400
|
diff = difference(row, orgRow) || {};
|
391
|
-
|
401
|
+
_validateFieldKeys = (_Object$keys = Object.keys(diff)) === null || _Object$keys === void 0 ? void 0 : (_Object$keys$map = _Object$keys.map) === null || _Object$keys$map === void 0 ? void 0 : _Object$keys$map.call(_Object$keys, function (key) {
|
392
402
|
return [].concat(_toConsumableArray(rowPath), [key]);
|
393
|
-
});
|
394
|
-
if (
|
403
|
+
}).concat(dependencies || []);
|
404
|
+
if (_validateFieldKeys === null || _validateFieldKeys === void 0 ? void 0 : _validateFieldKeys.length) {
|
395
405
|
setTimeout(function () {
|
396
|
-
form.validateFields(
|
406
|
+
form.validateFields(_validateFieldKeys);
|
397
407
|
}, 100);
|
398
408
|
}
|
399
409
|
}
|
@@ -403,7 +413,7 @@ var RenderField = function RenderField(_ref) {
|
|
403
413
|
d: Date.now()
|
404
414
|
}
|
405
415
|
});
|
406
|
-
case
|
416
|
+
case 33:
|
407
417
|
case "end":
|
408
418
|
return _context.stop();
|
409
419
|
}
|
@@ -464,7 +474,7 @@ var RenderField = function RenderField(_ref) {
|
|
464
474
|
diff = difference(row, orgRow) || {};
|
465
475
|
validateFieldKeys = (_Object$keys2 = Object.keys(diff)) === null || _Object$keys2 === void 0 ? void 0 : (_Object$keys2$map = _Object$keys2.map) === null || _Object$keys2$map === void 0 ? void 0 : _Object$keys2$map.call(_Object$keys2, function (key) {
|
466
476
|
return [].concat(_toConsumableArray(rowPath), [key]);
|
467
|
-
});
|
477
|
+
}).concat(dependencies || []);
|
468
478
|
if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
|
469
479
|
debounceValidate(validateFieldKeys);
|
470
480
|
}
|
@@ -557,7 +567,7 @@ var RenderField = function RenderField(_ref) {
|
|
557
567
|
originalNames: originalNames,
|
558
568
|
originalValues: originalValues,
|
559
569
|
form: form,
|
560
|
-
equalWith: onDiff
|
570
|
+
equalWith: onDiff,
|
561
571
|
type: type,
|
562
572
|
onChange: _onChange,
|
563
573
|
valuePropName: _formItemProps.valuePropName,
|
@@ -106,6 +106,7 @@ export interface ProColumnsProps<Values = any, T = any> extends Omit<FormItemPro
|
|
106
106
|
hiddenNames?: NamePath[] | NamePath[][];
|
107
107
|
rules?: ProRule[] | RulesFn<T>;
|
108
108
|
confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps | void>;
|
109
|
+
dependencies?: NamePath[];
|
109
110
|
onDiff?: DiffOriginalParams['equalWith'];
|
110
111
|
[key: string]: any;
|
111
112
|
}
|
@@ -305,6 +305,47 @@
|
|
305
305
|
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
306
306
|
}
|
307
307
|
}
|
308
|
+
|
309
|
+
* {
|
310
|
+
// ie浏览器
|
311
|
+
scrollbar-face-color: #d2d3d7;
|
312
|
+
scrollbar-highlight-color: #979797;
|
313
|
+
scrollbar-3dlight-color: #979797;
|
314
|
+
|
315
|
+
// 悬浮轨道
|
316
|
+
::-webkit-scrollbar-thumb {
|
317
|
+
background-color: #979797;
|
318
|
+
background-clip: padding-box;
|
319
|
+
border-color: transparent;
|
320
|
+
border-style: dashed;
|
321
|
+
border-width: 4px;
|
322
|
+
border-radius: 10px;
|
323
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
|
324
|
+
}
|
325
|
+
|
326
|
+
::-webkit-scrollbar-track {
|
327
|
+
background: transparent;
|
328
|
+
}
|
329
|
+
|
330
|
+
::-webkit-scrollbar-thumb {
|
331
|
+
background-color: #d2d3d7;
|
332
|
+
background-clip: padding-box;
|
333
|
+
border-color: transparent;
|
334
|
+
border-style: dashed;
|
335
|
+
border-width: 4px;
|
336
|
+
border-radius: 10px;
|
337
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
|
338
|
+
}
|
339
|
+
|
340
|
+
::-webkit-scrollbar-thumb {
|
341
|
+
background-color: #979797;
|
342
|
+
}
|
343
|
+
|
344
|
+
::-webkit-scrollbar-track {
|
345
|
+
background: transparent;
|
346
|
+
}
|
347
|
+
}
|
348
|
+
|
308
349
|
}
|
309
350
|
|
310
351
|
.pro-edit-table-footer{
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { FormInstance } from 'antd';
|
2
|
+
export type DiffType = 'same' | 'add' | 'changed';
|
3
|
+
export interface DiffOriginalParams {
|
4
|
+
originalValue: any;
|
5
|
+
value: any;
|
6
|
+
form: FormInstance;
|
7
|
+
equalWith?: ({ originValue, originRecord, value, record, index }: {
|
8
|
+
originValue: any;
|
9
|
+
originRecord: any;
|
10
|
+
value: any;
|
11
|
+
record: any;
|
12
|
+
index: number;
|
13
|
+
}) => DiffType | undefined;
|
14
|
+
/** 原始行数据 */
|
15
|
+
originRecord: any;
|
16
|
+
/** 当前行数据 */
|
17
|
+
record: any;
|
18
|
+
/** 当前行索引 */
|
19
|
+
index: number;
|
20
|
+
}
|
21
|
+
export declare const diffOriginal: (params: DiffOriginalParams) => DiffType;
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { isEqual, isFunction, isObject } from 'lodash';
|
2
|
+
import { validate } from '@zat-design/utils';
|
3
|
+
var isEmpty = validate.isEmpty;
|
4
|
+
// 过滤对象中undefined字段
|
5
|
+
// 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
|
6
|
+
var filterObject = function filterObject(data) {
|
7
|
+
if (!isObject(data) || Array.isArray(data) || data === null) return data;
|
8
|
+
var resData = {};
|
9
|
+
Object.keys(data).forEach(function (key) {
|
10
|
+
if (!isEmpty(data[key])) {
|
11
|
+
resData[key] = data[key];
|
12
|
+
}
|
13
|
+
});
|
14
|
+
// 空对象视为null 比较时 null undefined {} [] '' 视为相等
|
15
|
+
if (!Object.keys(resData).length) return null;
|
16
|
+
return resData;
|
17
|
+
};
|
18
|
+
export var diffOriginal = function diffOriginal(params) {
|
19
|
+
var originalValue = params.originalValue,
|
20
|
+
value = params.value,
|
21
|
+
equalWith = params.equalWith,
|
22
|
+
originRecord = params.originRecord,
|
23
|
+
record = params.record,
|
24
|
+
index = params.index;
|
25
|
+
// 支持传入自定义比较事件
|
26
|
+
if (isFunction(equalWith)) {
|
27
|
+
var diffRes = equalWith({
|
28
|
+
originValue: originalValue,
|
29
|
+
originRecord: originRecord,
|
30
|
+
value: value,
|
31
|
+
record: record,
|
32
|
+
index: index
|
33
|
+
});
|
34
|
+
// 如果返回undefined走内置比较逻辑
|
35
|
+
if (diffRes !== undefined) {
|
36
|
+
if (typeof diffRes === 'boolean') {
|
37
|
+
return diffRes ? 'same' : 'changed';
|
38
|
+
}
|
39
|
+
return diffRes;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
var _value = filterObject(value);
|
43
|
+
var _originalValue = filterObject(originalValue);
|
44
|
+
// 如果原始值为空 且当前有值的话 认为变更类型是新增
|
45
|
+
if (isEmpty(_originalValue) && !isEmpty(_value)) {
|
46
|
+
return 'add';
|
47
|
+
}
|
48
|
+
if (Array.isArray(_originalValue)) {
|
49
|
+
var isSame = _originalValue.every(function (valueItem, index) {
|
50
|
+
// 如果两个值有一个不是空值, 则进行深比较
|
51
|
+
if (!isEmpty(value === null || value === void 0 ? void 0 : value[index]) || !isEmpty(valueItem)) {
|
52
|
+
return isEqual(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
53
|
+
}
|
54
|
+
return true;
|
55
|
+
});
|
56
|
+
return isSame ? 'same' : 'changed';
|
57
|
+
}
|
58
|
+
if (!isEmpty(_originalValue) || !isEmpty(_value)) {
|
59
|
+
return isEqual(_value, _originalValue) ? 'same' : 'changed';
|
60
|
+
}
|
61
|
+
return 'same';
|
62
|
+
};
|
@@ -16,7 +16,7 @@ import _Typography from "antd/es/typography";
|
|
16
16
|
var _excluded = ["className", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator", "detailPlaceholder", "scrollFollowParent"];
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
18
18
|
import { useEffect, useState, memo, useMemo } from 'react';
|
19
|
-
import { omit, find as _find } from 'lodash';
|
19
|
+
import { omit, find as _find, isBoolean } from 'lodash';
|
20
20
|
import { transformDataName } from './utils/index';
|
21
21
|
import { useProConfig } from '../../../../ProConfigProvider';
|
22
22
|
import useEnum from '../../../../ProEnum/hooks/useEnum';
|
@@ -111,6 +111,12 @@ var ProCascader = function ProCascader(props) {
|
|
111
111
|
var result = transformDataName(isAddressMode && realLevel === 2 ? _filterDataSource(innerDataSource, level, fieldNames) : innerDataSource, fieldNames);
|
112
112
|
return result;
|
113
113
|
}, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
|
114
|
+
var lastDisabled = useMemo(function () {
|
115
|
+
if (isBoolean(disabled) || disabled === undefined) {
|
116
|
+
return [disabled, disabled];
|
117
|
+
}
|
118
|
+
return disabled;
|
119
|
+
}, [disabled]);
|
114
120
|
var _useRequest = _objectSpread({}, useRequest),
|
115
121
|
service = _useRequest.service,
|
116
122
|
_useRequest$defaultPa = _useRequest.defaultParams,
|
@@ -268,7 +274,7 @@ var ProCascader = function ProCascader(props) {
|
|
268
274
|
placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProAddressBar = locale.ProAddressBar) === null || _locale$ProAddressBar === void 0 ? void 0 : _locale$ProAddressBar.placeholder,
|
269
275
|
value: addressValue,
|
270
276
|
options: service ? serviceData : realDataSource,
|
271
|
-
disabled:
|
277
|
+
disabled: lastDisabled[0],
|
272
278
|
displayRender: displayRender,
|
273
279
|
showSearch: {
|
274
280
|
filter: handlefilter,
|
@@ -278,19 +284,19 @@ var ProCascader = function ProCascader(props) {
|
|
278
284
|
getPopupContainer: function getPopupContainer(trigger) {
|
279
285
|
return scrollFollowParent ? trigger.parentElement : document.body;
|
280
286
|
}
|
281
|
-
}, omit(otherProps, ['otherProps', 'scrollFollowParent']))), hasDetail && (tooltip &&
|
287
|
+
}, omit(otherProps, ['otherProps', 'scrollFollowParent']))), hasDetail && (tooltip && lastDisabled[1] && detail ? _jsx(_Tooltip, {
|
282
288
|
title: detail,
|
283
289
|
children: _jsx("span", {
|
284
290
|
className: "pro-address-detail",
|
285
291
|
children: _jsx(_Input, {
|
286
|
-
disabled:
|
292
|
+
disabled: lastDisabled[1],
|
287
293
|
value: detail
|
288
294
|
})
|
289
295
|
})
|
290
296
|
}) : _jsx(_Input, {
|
291
297
|
allowClear: true,
|
292
298
|
autoComplete: "off",
|
293
|
-
disabled:
|
299
|
+
disabled: lastDisabled[1],
|
294
300
|
value: detail,
|
295
301
|
maxLength: detailMaxLength,
|
296
302
|
placeholder: detailPlaceholder || (locale === null || locale === void 0 ? void 0 : (_locale$ProAddressBar2 = locale.ProAddressBar) === null || _locale$ProAddressBar2 === void 0 ? void 0 : _locale$ProAddressBar2.detailPlaceholder),
|
@@ -2,6 +2,7 @@ import "antd/es/space/style";
|
|
2
2
|
import _Space from "antd/es/space";
|
3
3
|
import "antd/es/tooltip/style";
|
4
4
|
import _Tooltip from "antd/es/tooltip";
|
5
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
5
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
6
7
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
7
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
@@ -47,9 +48,15 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
47
48
|
if (!isWatch || noChange) return 'same';
|
48
49
|
var _value = normalize ? normalize(props[valuePropName], undefined, undefined, true) // true 代表是值比对时的调用
|
49
50
|
: props[valuePropName];
|
51
|
+
// fix:修复 DatePicker时,originalValue与最新值一致时,显示为 changed的问题
|
52
|
+
var _originalValue = normalize && ['DatePicker'].includes(props.type) ? normalize(originalValue, undefined, undefined, true) : originalValue;
|
53
|
+
// fix:修复 InputNumber 时,originalValue与最新值一致都为'0'时,显示为 changed的问题
|
54
|
+
if (['InputNumber'].includes(props.type) && normalize && _value === Number(originalValue)) {
|
55
|
+
return 'same';
|
56
|
+
}
|
50
57
|
return diffOriginal({
|
51
|
-
originalValue: originalValue,
|
52
58
|
value: _value,
|
59
|
+
originalValue: _originalValue,
|
53
60
|
form: form,
|
54
61
|
equalWith: equalWith
|
55
62
|
// name: namesStr || name,
|
@@ -57,23 +64,20 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
57
64
|
}, [isWatch, noChange, props[valuePropName], originalValue]);
|
58
65
|
var isAdd = diffType === 'add';
|
59
66
|
var isChanged = diffType === 'changed';
|
60
|
-
var viewRenderFun = useMemo(function () {
|
61
|
-
return function (orgValue) {
|
62
|
-
return viewRender(orgValue, originalValues, {
|
63
|
-
form: form
|
64
|
-
});
|
65
|
-
};
|
66
|
-
}, [form]);
|
67
67
|
var tipContent = useMemo(function () {
|
68
68
|
if (!isWatch || noChange) return undefined;
|
69
69
|
var valueProps = getValueProps && !names ? getValueProps(originalValue) : {
|
70
70
|
value: originalValue
|
71
71
|
};
|
72
|
-
if (viewRender)
|
72
|
+
if (viewRender) {
|
73
|
+
return viewRender(valueProps === null || valueProps === void 0 ? void 0 : valueProps.value, originalValues, {
|
74
|
+
form: form
|
75
|
+
});
|
76
|
+
}
|
73
77
|
return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, _defineProperty({
|
74
78
|
isView: true
|
75
79
|
}, valuePropName, valueProps === null || valueProps === void 0 ? void 0 : valueProps.value))) : undefined;
|
76
|
-
}, [originalValue, children]);
|
80
|
+
}, [_typeof(viewRender), originalValue, children]);
|
77
81
|
if (!isWatch || noChange) {
|
78
82
|
// 嵌套子组件
|
79
83
|
var isNestedField = ['ProEditTable'].includes(type);
|