@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
@@ -341,6 +341,10 @@
|
|
341
341
|
background: @zaui-contract-bg !important;
|
342
342
|
}
|
343
343
|
|
344
|
+
.ant-picker-clear {
|
345
|
+
background: @zaui-contract-bg;
|
346
|
+
}
|
347
|
+
|
344
348
|
span.@{ant-prefix}-input-affix-wrapper,
|
345
349
|
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
346
350
|
.@{ant-prefix}-picker,
|
@@ -419,6 +423,10 @@
|
|
419
423
|
background: @zaui-contract-bg-add !important;
|
420
424
|
}
|
421
425
|
|
426
|
+
.ant-picker-clear {
|
427
|
+
background: @zaui-contract-bg-add;
|
428
|
+
}
|
429
|
+
|
422
430
|
span.@{ant-prefix}-input-affix-wrapper,
|
423
431
|
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
424
432
|
.@{ant-prefix}-picker,
|
@@ -2,6 +2,14 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import { useRef, useState } from 'react';
|
3
3
|
import { isFunction, isEqualWith, get } from 'lodash';
|
4
4
|
import { customEqualForFun } from './index';
|
5
|
+
/** FormList中被删除的行也会再触发一次响应式函数 排除这种场景 */
|
6
|
+
var isDeleteLine = function isDeleteLine(form, namePath) {
|
7
|
+
if (namePath) {
|
8
|
+
var line = form.getFieldValue(namePath);
|
9
|
+
return line === undefined;
|
10
|
+
}
|
11
|
+
return false;
|
12
|
+
};
|
5
13
|
// 代理shouldUpdate事件, 执行函数值的[show, disabled], 当[show, disabled]与上一次值不相同时更新状态
|
6
14
|
var useShouldUpdate = function useShouldUpdate(props) {
|
7
15
|
var show = props.show,
|
@@ -64,7 +72,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
64
72
|
}
|
65
73
|
if (isFunction(disabled)) {
|
66
74
|
// RangePicker返回数组时,特殊处理
|
67
|
-
if (['Group', 'RangePicker'].includes(type) && Array.isArray(disabled(values, {
|
75
|
+
if (['Group', 'RangePicker', 'ProCascader'].includes(type) && Array.isArray(disabled(values, {
|
68
76
|
form: form,
|
69
77
|
index: index,
|
70
78
|
namePath: namePath
|
@@ -169,7 +177,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
169
177
|
namePath: namePath
|
170
178
|
}) : fieldProps;
|
171
179
|
// 清值防抖 多次刷新时以最后一次为准
|
172
|
-
if (clearNotShow !== false && (name || names)) {
|
180
|
+
if (clearNotShow !== false && (name || names) && !isDeleteLine(form, namePath)) {
|
173
181
|
// 当show为其他变为false的时候记录一次需要清值
|
174
182
|
if (_show !== showRef.current && _show === false) {
|
175
183
|
needClear.current = true;
|
@@ -2,6 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
3
|
var _excluded = ["id", "title", "collapse", "children"];
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
import { useEffect } from 'react';
|
5
6
|
import { useStep } from '../../index';
|
6
7
|
import ProCollapse from '../../../ProLayout/components/ProCollapse';
|
7
8
|
export default (function (_ref) {
|
@@ -14,10 +15,18 @@ export default (function (_ref) {
|
|
14
15
|
var _useStep = useStep(),
|
15
16
|
register = _useStep.register,
|
16
17
|
collapse = _useStep.collapse;
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
useEffect(function () {
|
19
|
+
// 子组件更新父组件 延迟状态更新,避免重渲染
|
20
|
+
var timeoutId = setTimeout(function () {
|
21
|
+
register === null || register === void 0 ? void 0 : register(_objectSpread(_objectSpread({}, restProps), {}, {
|
22
|
+
title: title,
|
23
|
+
id: id
|
24
|
+
}));
|
25
|
+
}, 0);
|
26
|
+
return function () {
|
27
|
+
return clearTimeout(timeoutId);
|
28
|
+
};
|
29
|
+
}, [register]);
|
21
30
|
return _jsx("div", {
|
22
31
|
className: "pro-step-item",
|
23
32
|
id: id,
|
package/es/style/theme/antd.less
CHANGED
@@ -753,6 +753,9 @@
|
|
753
753
|
}
|
754
754
|
|
755
755
|
.@{ant-prefix}-picker.@{ant-prefix}-picker-disabled {
|
756
|
-
background: var(--zaui-disabled-bg);
|
756
|
+
background: var(--zaui-disabled-bg) !important;
|
757
757
|
}
|
758
758
|
|
759
|
+
.@{ant-prefix}-input-affix-wrapper-disabled {
|
760
|
+
background: var(--zaui-disabled-bg) !important;
|
761
|
+
}
|
@@ -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[];
|
@@ -14,7 +14,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _antd = require("antd");
|
15
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
16
16
|
var _lodash = require("lodash");
|
17
|
-
var _diffOriginal = require("
|
17
|
+
var _diffOriginal = require("../../utils/diffOriginal");
|
18
18
|
var _ProConfigProvider = require("../../../ProConfigProvider");
|
19
19
|
var _utils = require("../../../utils");
|
20
20
|
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName", "viewRender", "diffConfig", "index"];
|
@@ -39,7 +39,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
39
39
|
if (!originalValues) {
|
40
40
|
return undefined;
|
41
41
|
}
|
42
|
-
var
|
42
|
+
var originRecord;
|
43
43
|
if (rowKeyPath) {
|
44
44
|
var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
|
45
45
|
var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
|
@@ -48,13 +48,13 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
48
48
|
var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
|
49
49
|
if (!keyValue) return undefined;
|
50
50
|
var originalValueList = (0, _lodash.get)(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|
51
|
-
|
51
|
+
originRecord = originalValueList === null || originalValueList === void 0 ? void 0 : originalValueList.find(function (item) {
|
52
52
|
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
53
53
|
});
|
54
54
|
var originalValue;
|
55
55
|
if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
|
56
56
|
var originalNamesValue = originalNames.map(function (originalName) {
|
57
|
-
return (0, _lodash.get)(
|
57
|
+
return (0, _lodash.get)(originRecord, originalName.slice(rowKeyPath.length - 1));
|
58
58
|
});
|
59
59
|
// 有可能出现数组中全是undefined的情况 视为没有值
|
60
60
|
var fillUndefined = originalNamesValue.every(function (valItem) {
|
@@ -62,11 +62,12 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
62
62
|
});
|
63
63
|
originalValue = fillUndefined ? undefined : originalNamesValue;
|
64
64
|
} else {
|
65
|
-
originalValue = (0, _lodash.get)(
|
65
|
+
originalValue = (0, _lodash.get)(originRecord, originalName.slice(rowKeyPath.length - 1));
|
66
66
|
}
|
67
67
|
return {
|
68
68
|
originalValue: originalValue,
|
69
|
-
|
69
|
+
originRecord: originRecord,
|
70
|
+
record: rowValue
|
70
71
|
};
|
71
72
|
}
|
72
73
|
// 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
|
@@ -74,7 +75,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
74
75
|
originalValue: (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
75
76
|
return (0, _lodash.get)(originalValues, originalName);
|
76
77
|
}) : (0, _lodash.get)(originalValues, originalName),
|
77
|
-
|
78
|
+
originRecord: originRecord
|
78
79
|
};
|
79
80
|
};
|
80
81
|
var ListChangedWrapper = function ListChangedWrapper(props) {
|
@@ -125,12 +126,20 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
125
126
|
if (!isWatch || noChange) return 'same';
|
126
127
|
var _value = normalize ? normalize(props[valuePropName], undefined, undefined, true) // true 代表是值比对时的调用
|
127
128
|
: props[valuePropName];
|
129
|
+
// fix:修复 DatePicker时,originalValue与最新值一致时,显示为 changed的问题
|
130
|
+
var _originalValue = normalize && ['DatePicker'].includes(props.type) ? normalize(originalValue, undefined, undefined, true) : originalValue;
|
131
|
+
// fix:修复 InputNumber 时,originalValue与最新值一致都为'0'时,显示为 changed的问题
|
132
|
+
if (['InputNumber'].includes(props.type) && normalize && _value === Number(originalValue)) {
|
133
|
+
return 'same';
|
134
|
+
}
|
128
135
|
return (0, _diffOriginal.diffOriginal)({
|
129
136
|
value: _value,
|
130
|
-
originalValue:
|
137
|
+
originalValue: _originalValue,
|
131
138
|
form: form,
|
132
|
-
equalWith: equalWith
|
133
|
-
|
139
|
+
equalWith: equalWith,
|
140
|
+
originRecord: originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originRecord,
|
141
|
+
record: originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.record,
|
142
|
+
index: index
|
134
143
|
});
|
135
144
|
}, [props[valuePropName], originalValue]);
|
136
145
|
var isAdd = diffType === 'add';
|
@@ -143,7 +152,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
143
152
|
var _children = children;
|
144
153
|
if (viewRender) {
|
145
154
|
if (! /*#__PURE__*/_react.default.isValidElement(viewRender)) {
|
146
|
-
return viewRender(orgValue, (originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.
|
155
|
+
return viewRender(orgValue, (originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originRecord) || {}, {
|
147
156
|
form: form,
|
148
157
|
name: name,
|
149
158
|
index: index
|
@@ -30,7 +30,7 @@ var _utils = require("../../../ProForm/utils");
|
|
30
30
|
var _ConfirmWrapper = _interopRequireDefault(require("../../../ProForm/components/render/ConfirmWrapper"));
|
31
31
|
var _getDefaultProps = require("../../utils/getDefaultProps");
|
32
32
|
var _ListChangedWrapper = _interopRequireDefault(require("./ListChangedWrapper"));
|
33
|
-
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "
|
33
|
+
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "onDiff", "className", "trim", "confirm", "dependencies"];
|
34
34
|
/* eslint-disable prefer-destructuring */
|
35
35
|
/* eslint-disable prefer-const */
|
36
36
|
var RenderField = function RenderField(_ref) {
|
@@ -59,11 +59,11 @@ var RenderField = function RenderField(_ref) {
|
|
59
59
|
required = _column$required === void 0 ? false : _column$required,
|
60
60
|
_column$rules = column.rules,
|
61
61
|
rules = _column$rules === void 0 ? [] : _column$rules,
|
62
|
-
equalWith = column.equalWith,
|
63
62
|
onDiff = column.onDiff,
|
64
63
|
className = column.className,
|
65
64
|
trim = column.trim,
|
66
65
|
confirm = column.confirm,
|
66
|
+
dependencies = column.dependencies,
|
67
67
|
resetProps = (0, _objectWithoutProperties2.default)(column, _excluded);
|
68
68
|
// editRender弃用使用component同ProForm
|
69
69
|
var _editRender = component || editRender;
|
@@ -319,6 +319,8 @@ var RenderField = function RenderField(_ref) {
|
|
319
319
|
_key2,
|
320
320
|
_args,
|
321
321
|
rowPath,
|
322
|
+
_dependencies$map,
|
323
|
+
validateFieldKeys,
|
322
324
|
row,
|
323
325
|
orgRow,
|
324
326
|
_TargetComponent,
|
@@ -330,77 +332,85 @@ var RenderField = function RenderField(_ref) {
|
|
330
332
|
_Object$keys,
|
331
333
|
_Object$keys$map,
|
332
334
|
diff,
|
333
|
-
|
335
|
+
_validateFieldKeys,
|
334
336
|
_args2 = arguments;
|
335
337
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
336
338
|
while (1) switch (_context.prev = _context.next) {
|
337
339
|
case 0:
|
338
|
-
if (!(!onFieldChange && !onChange)) {
|
339
|
-
_context.next = 2;
|
340
|
-
break;
|
341
|
-
}
|
342
|
-
return _context.abrupt("return", null);
|
343
|
-
case 2:
|
344
340
|
for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
345
341
|
args[_key2] = _args2[_key2];
|
346
342
|
}
|
347
343
|
_args = [].concat(args);
|
348
344
|
rowPath = [].concat((0, _toConsumableArray2.default)(namePath), [index]);
|
349
|
-
|
345
|
+
if (!(!onFieldChange && !onChange)) {
|
346
|
+
_context.next = 6;
|
347
|
+
break;
|
348
|
+
}
|
349
|
+
if (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) {
|
350
|
+
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) {
|
351
|
+
return [].concat((0, _toConsumableArray2.default)(rowPath), [key]);
|
352
|
+
});
|
353
|
+
setTimeout(function () {
|
354
|
+
form.validateFields(validateFieldKeys);
|
355
|
+
}, 100);
|
356
|
+
}
|
357
|
+
return _context.abrupt("return", null);
|
358
|
+
case 6:
|
359
|
+
row = form.getFieldValue(rowPath, true);
|
350
360
|
orgRow = (0, _lodash.cloneDeep)(row);
|
351
361
|
if (!onFieldChange) {
|
352
|
-
_context.next =
|
362
|
+
_context.next = 21;
|
353
363
|
break;
|
354
364
|
}
|
355
365
|
_args = formatArgs(args);
|
356
366
|
_args[1] = row;
|
357
367
|
_context.t0 = (_TargetComponent = TargetComponent) === null || _TargetComponent === void 0 ? void 0 : (_TargetComponent$prop = _TargetComponent.props) === null || _TargetComponent$prop === void 0 ? void 0 : _TargetComponent$prop.onFieldChange;
|
358
368
|
if (!_context.t0) {
|
359
|
-
_context.next =
|
369
|
+
_context.next = 15;
|
360
370
|
break;
|
361
371
|
}
|
362
|
-
_context.next =
|
372
|
+
_context.next = 15;
|
363
373
|
return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, (0, _toConsumableArray2.default)(_args));
|
364
|
-
case
|
374
|
+
case 15:
|
365
375
|
_context.t1 = onFieldChange;
|
366
376
|
if (!_context.t1) {
|
367
|
-
_context.next =
|
377
|
+
_context.next = 19;
|
368
378
|
break;
|
369
379
|
}
|
370
|
-
_context.next =
|
380
|
+
_context.next = 19;
|
371
381
|
return onFieldChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
372
|
-
case
|
373
|
-
_context.next =
|
382
|
+
case 19:
|
383
|
+
_context.next = 30;
|
374
384
|
break;
|
375
|
-
case
|
385
|
+
case 21:
|
376
386
|
_args = _args.concat([row, index, form]);
|
377
387
|
_context.t2 = (_TargetComponent2 = TargetComponent) === null || _TargetComponent2 === void 0 ? void 0 : (_TargetComponent2$pro = _TargetComponent2.props) === null || _TargetComponent2$pro === void 0 ? void 0 : _TargetComponent2$pro.onChange;
|
378
388
|
if (!_context.t2) {
|
379
|
-
_context.next =
|
389
|
+
_context.next = 26;
|
380
390
|
break;
|
381
391
|
}
|
382
|
-
_context.next =
|
392
|
+
_context.next = 26;
|
383
393
|
return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, (0, _toConsumableArray2.default)(_args));
|
384
|
-
case
|
394
|
+
case 26:
|
385
395
|
_context.t3 = onChange;
|
386
396
|
if (!_context.t3) {
|
387
|
-
_context.next =
|
397
|
+
_context.next = 30;
|
388
398
|
break;
|
389
399
|
}
|
390
|
-
_context.next =
|
400
|
+
_context.next = 30;
|
391
401
|
return onChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
392
|
-
case
|
402
|
+
case 30:
|
393
403
|
// 判断属性是否变动
|
394
404
|
form.setFieldValue(rowPath, row);
|
395
405
|
if (validateTrigger && validateTrigger.includes('onChange')) {
|
396
406
|
if (!(0, _lodash.isEqual)(orgRow, row)) {
|
397
407
|
diff = (0, _tools.difference)(row, orgRow) || {};
|
398
|
-
|
408
|
+
_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) {
|
399
409
|
return [].concat((0, _toConsumableArray2.default)(rowPath), [key]);
|
400
|
-
});
|
401
|
-
if (
|
410
|
+
}).concat(dependencies || []);
|
411
|
+
if (_validateFieldKeys === null || _validateFieldKeys === void 0 ? void 0 : _validateFieldKeys.length) {
|
402
412
|
setTimeout(function () {
|
403
|
-
form.validateFields(
|
413
|
+
form.validateFields(_validateFieldKeys);
|
404
414
|
}, 100);
|
405
415
|
}
|
406
416
|
}
|
@@ -410,7 +420,7 @@ var RenderField = function RenderField(_ref) {
|
|
410
420
|
d: Date.now()
|
411
421
|
}
|
412
422
|
});
|
413
|
-
case
|
423
|
+
case 33:
|
414
424
|
case "end":
|
415
425
|
return _context.stop();
|
416
426
|
}
|
@@ -471,7 +481,7 @@ var RenderField = function RenderField(_ref) {
|
|
471
481
|
diff = (0, _tools.difference)(row, orgRow) || {};
|
472
482
|
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) {
|
473
483
|
return [].concat((0, _toConsumableArray2.default)(rowPath), [key]);
|
474
|
-
});
|
484
|
+
}).concat(dependencies || []);
|
475
485
|
if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
|
476
486
|
debounceValidate(validateFieldKeys);
|
477
487
|
}
|
@@ -564,7 +574,7 @@ var RenderField = function RenderField(_ref) {
|
|
564
574
|
originalNames: originalNames,
|
565
575
|
originalValues: originalValues,
|
566
576
|
form: form,
|
567
|
-
equalWith: onDiff
|
577
|
+
equalWith: onDiff,
|
568
578
|
type: type,
|
569
579
|
onChange: _onChange,
|
570
580
|
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,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.diffOriginal = void 0;
|
7
|
+
var _lodash = require("lodash");
|
8
|
+
var _utils = require("@zat-design/utils");
|
9
|
+
var isEmpty = _utils.validate.isEmpty;
|
10
|
+
// 过滤对象中undefined字段
|
11
|
+
// 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
|
12
|
+
var filterObject = function filterObject(data) {
|
13
|
+
if (!(0, _lodash.isObject)(data) || Array.isArray(data) || data === null) return data;
|
14
|
+
var resData = {};
|
15
|
+
Object.keys(data).forEach(function (key) {
|
16
|
+
if (!isEmpty(data[key])) {
|
17
|
+
resData[key] = data[key];
|
18
|
+
}
|
19
|
+
});
|
20
|
+
// 空对象视为null 比较时 null undefined {} [] '' 视为相等
|
21
|
+
if (!Object.keys(resData).length) return null;
|
22
|
+
return resData;
|
23
|
+
};
|
24
|
+
var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
25
|
+
var originalValue = params.originalValue,
|
26
|
+
value = params.value,
|
27
|
+
equalWith = params.equalWith,
|
28
|
+
originRecord = params.originRecord,
|
29
|
+
record = params.record,
|
30
|
+
index = params.index;
|
31
|
+
// 支持传入自定义比较事件
|
32
|
+
if ((0, _lodash.isFunction)(equalWith)) {
|
33
|
+
var diffRes = equalWith({
|
34
|
+
originValue: originalValue,
|
35
|
+
originRecord: originRecord,
|
36
|
+
value: value,
|
37
|
+
record: record,
|
38
|
+
index: index
|
39
|
+
});
|
40
|
+
// 如果返回undefined走内置比较逻辑
|
41
|
+
if (diffRes !== undefined) {
|
42
|
+
if (typeof diffRes === 'boolean') {
|
43
|
+
return diffRes ? 'same' : 'changed';
|
44
|
+
}
|
45
|
+
return diffRes;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
var _value = filterObject(value);
|
49
|
+
var _originalValue = filterObject(originalValue);
|
50
|
+
// 如果原始值为空 且当前有值的话 认为变更类型是新增
|
51
|
+
if (isEmpty(_originalValue) && !isEmpty(_value)) {
|
52
|
+
return 'add';
|
53
|
+
}
|
54
|
+
if (Array.isArray(_originalValue)) {
|
55
|
+
var isSame = _originalValue.every(function (valueItem, index) {
|
56
|
+
// 如果两个值有一个不是空值, 则进行深比较
|
57
|
+
if (!isEmpty(value === null || value === void 0 ? void 0 : value[index]) || !isEmpty(valueItem)) {
|
58
|
+
return (0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
59
|
+
}
|
60
|
+
return true;
|
61
|
+
});
|
62
|
+
return isSame ? 'same' : 'changed';
|
63
|
+
}
|
64
|
+
if (!isEmpty(_originalValue) || !isEmpty(_value)) {
|
65
|
+
return (0, _lodash.isEqual)(_value, _originalValue) ? 'same' : 'changed';
|
66
|
+
}
|
67
|
+
return 'same';
|
68
|
+
};
|
@@ -111,6 +111,12 @@ var ProCascader = function ProCascader(props) {
|
|
111
111
|
var result = (0, _index.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 = (0, _react.useMemo)(function () {
|
115
|
+
if ((0, _lodash.isBoolean)(disabled) || disabled === undefined) {
|
116
|
+
return [disabled, disabled];
|
117
|
+
}
|
118
|
+
return disabled;
|
119
|
+
}, [disabled]);
|
114
120
|
var _useRequest = (0, _objectSpread3.default)({}, 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.default === null || _locale.default === void 0 ? void 0 : (_locale$ProAddressBar = _locale.default.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
|
-
}, (0, _lodash.omit)(otherProps, ['otherProps', 'scrollFollowParent']))), hasDetail && (tooltip &&
|
287
|
+
}, (0, _lodash.omit)(otherProps, ['otherProps', 'scrollFollowParent']))), hasDetail && (tooltip && lastDisabled[1] && detail ? (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
282
288
|
title: detail,
|
283
289
|
children: (0, _jsxRuntime.jsx)("span", {
|
284
290
|
className: "pro-address-detail",
|
285
291
|
children: (0, _jsxRuntime.jsx)(_antd.Input, {
|
286
|
-
disabled:
|
292
|
+
disabled: lastDisabled[1],
|
287
293
|
value: detail
|
288
294
|
})
|
289
295
|
})
|
290
296
|
}) : (0, _jsxRuntime.jsx)(_antd.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.default === null || _locale.default === void 0 ? void 0 : (_locale$ProAddressBar2 = _locale.default.ProAddressBar) === null || _locale$ProAddressBar2 === void 0 ? void 0 : _locale$ProAddressBar2.detailPlaceholder),
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
7
7
|
});
|
8
8
|
exports.default = void 0;
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
10
11
|
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
11
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
@@ -52,9 +53,15 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
52
53
|
if (!isWatch || noChange) return 'same';
|
53
54
|
var _value = normalize ? normalize(props[valuePropName], undefined, undefined, true) // true 代表是值比对时的调用
|
54
55
|
: props[valuePropName];
|
56
|
+
// fix:修复 DatePicker时,originalValue与最新值一致时,显示为 changed的问题
|
57
|
+
var _originalValue = normalize && ['DatePicker'].includes(props.type) ? normalize(originalValue, undefined, undefined, true) : originalValue;
|
58
|
+
// fix:修复 InputNumber 时,originalValue与最新值一致都为'0'时,显示为 changed的问题
|
59
|
+
if (['InputNumber'].includes(props.type) && normalize && _value === Number(originalValue)) {
|
60
|
+
return 'same';
|
61
|
+
}
|
55
62
|
return (0, _diffOriginal.diffOriginal)({
|
56
|
-
originalValue: originalValue,
|
57
63
|
value: _value,
|
64
|
+
originalValue: _originalValue,
|
58
65
|
form: form,
|
59
66
|
equalWith: equalWith
|
60
67
|
// name: namesStr || name,
|
@@ -62,23 +69,20 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
62
69
|
}, [isWatch, noChange, props[valuePropName], originalValue]);
|
63
70
|
var isAdd = diffType === 'add';
|
64
71
|
var isChanged = diffType === 'changed';
|
65
|
-
var viewRenderFun = (0, _react.useMemo)(function () {
|
66
|
-
return function (orgValue) {
|
67
|
-
return viewRender(orgValue, originalValues, {
|
68
|
-
form: form
|
69
|
-
});
|
70
|
-
};
|
71
|
-
}, [form]);
|
72
72
|
var tipContent = (0, _react.useMemo)(function () {
|
73
73
|
if (!isWatch || noChange) return undefined;
|
74
74
|
var valueProps = getValueProps && !names ? getValueProps(originalValue) : {
|
75
75
|
value: originalValue
|
76
76
|
};
|
77
|
-
if (viewRender)
|
77
|
+
if (viewRender) {
|
78
|
+
return viewRender(valueProps === null || valueProps === void 0 ? void 0 : valueProps.value, originalValues, {
|
79
|
+
form: form
|
80
|
+
});
|
81
|
+
}
|
78
82
|
return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), {}, (0, _defineProperty2.default)({
|
79
83
|
isView: true
|
80
84
|
}, valuePropName, valueProps === null || valueProps === void 0 ? void 0 : valueProps.value))) : undefined;
|
81
|
-
}, [originalValue, children]);
|
85
|
+
}, [(0, _typeof2.default)(viewRender), originalValue, children]);
|
82
86
|
if (!isWatch || noChange) {
|
83
87
|
// 嵌套子组件
|
84
88
|
var isNestedField = ['ProEditTable'].includes(type);
|
@@ -341,6 +341,10 @@
|
|
341
341
|
background: @zaui-contract-bg !important;
|
342
342
|
}
|
343
343
|
|
344
|
+
.ant-picker-clear {
|
345
|
+
background: @zaui-contract-bg;
|
346
|
+
}
|
347
|
+
|
344
348
|
span.@{ant-prefix}-input-affix-wrapper,
|
345
349
|
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
346
350
|
.@{ant-prefix}-picker,
|
@@ -419,6 +423,10 @@
|
|
419
423
|
background: @zaui-contract-bg-add !important;
|
420
424
|
}
|
421
425
|
|
426
|
+
.ant-picker-clear {
|
427
|
+
background: @zaui-contract-bg-add;
|
428
|
+
}
|
429
|
+
|
422
430
|
span.@{ant-prefix}-input-affix-wrapper,
|
423
431
|
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
424
432
|
.@{ant-prefix}-picker,
|