@zat-design/sisyphus-react 3.9.5-beta.5 → 3.9.5-beta.6
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/es/ProForm/components/render/Render.js +4 -4
- package/es/ProForm/utils/diffOriginal.js +7 -21
- package/es/utils/index.d.ts +4 -1
- package/es/utils/index.js +4 -1
- package/lib/ProForm/components/render/Render.js +4 -4
- package/lib/ProForm/utils/diffOriginal.js +7 -21
- package/lib/utils/index.d.ts +4 -1
- package/lib/utils/index.js +4 -1
- package/package.json +1 -1
@@ -409,7 +409,10 @@ var Render = function Render(props) {
|
|
409
409
|
if (type === 'FormList') {
|
410
410
|
lastComponentProps.disabled = lastDisabled;
|
411
411
|
var lessMode = lastComponentProps.mode === 'less';
|
412
|
-
|
412
|
+
colProps = _objectSpread(_objectSpread({}, colProps), {}, {
|
413
|
+
span: lessMode ? colProps.span : 24 // 默认占一行
|
414
|
+
});
|
415
|
+
return _jsx(_Form.List, _objectSpread(_objectSpread({
|
413
416
|
name: _otherFormItemProps.name
|
414
417
|
}, omit(_otherFormItemProps, ['rules'])), {}, {
|
415
418
|
children: function children(fields, operation, meta) {
|
@@ -421,9 +424,6 @@ var Render = function Render(props) {
|
|
421
424
|
}));
|
422
425
|
}
|
423
426
|
}));
|
424
|
-
colProps = _objectSpread(_objectSpread({}, colProps), {}, {
|
425
|
-
span: lessMode ? colProps.span : 24 // 默认占一行
|
426
|
-
});
|
427
427
|
}
|
428
428
|
// 默认占据一行
|
429
429
|
if (['ProCollapse', 'Container'].includes(type)) {
|
@@ -31,25 +31,11 @@ export var diffOriginal = function diffOriginal(params) {
|
|
31
31
|
}
|
32
32
|
var _value = filterObject(value);
|
33
33
|
var _originalValue = filterObject(originalValue);
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
// 如果两个值有一个不是空值, 则进行深比较
|
42
|
-
if (!isEmpty(value === null || value === void 0 ? void 0 : value[index]) || !isEmpty(valueItem)) {
|
43
|
-
return isEqual(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
44
|
-
}
|
45
|
-
return true;
|
46
|
-
});
|
47
|
-
return isSame ? 'same' : 'changed';
|
48
|
-
}
|
49
|
-
return 'changed';
|
50
|
-
}
|
51
|
-
if (!isEmpty(_originalValue) || !isEmpty(_value)) {
|
52
|
-
return isEqual(_value, _originalValue) ? 'same' : 'changed';
|
53
|
-
}
|
54
|
-
return 'same';
|
34
|
+
var isEmptyVal = isEmpty(_value);
|
35
|
+
var isEmptyOrg = isEmpty(_originalValue);
|
36
|
+
// 都为空视为相等
|
37
|
+
if (isEmptyOrg && isEmptyVal) return 'same';
|
38
|
+
// 如果原始值为空 且当前有值的话 视为新增
|
39
|
+
if (isEmptyOrg && !isEmptyVal) return 'add';
|
40
|
+
return isEqual(_value, _originalValue) ? 'same' : 'changed';
|
55
41
|
};
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.js
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
2
|
import { useEffect, useState } from 'react';
|
3
3
|
var EMPTY_VALUE = [undefined, null, ''];
|
4
|
-
/**
|
4
|
+
/**
|
5
|
+
* 判断一个值是否是空值
|
6
|
+
* 空值 或者 仅包含空值的数组视为空
|
7
|
+
*/
|
5
8
|
export var isEmpty = function isEmpty(value, emptyValue) {
|
6
9
|
if (emptyValue) {
|
7
10
|
EMPTY_VALUE.push(emptyValue);
|
@@ -409,7 +409,10 @@ var Render = function Render(props) {
|
|
409
409
|
if (type === 'FormList') {
|
410
410
|
lastComponentProps.disabled = lastDisabled;
|
411
411
|
var lessMode = lastComponentProps.mode === 'less';
|
412
|
-
|
412
|
+
colProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, colProps), {}, {
|
413
|
+
span: lessMode ? colProps.span : 24 // 默认占一行
|
414
|
+
});
|
415
|
+
return (0, _jsxRuntime.jsx)(_antd.Form.List, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
413
416
|
name: _otherFormItemProps.name
|
414
417
|
}, (0, _lodash.omit)(_otherFormItemProps, ['rules'])), {}, {
|
415
418
|
children: function children(fields, operation, meta) {
|
@@ -421,9 +424,6 @@ var Render = function Render(props) {
|
|
421
424
|
}));
|
422
425
|
}
|
423
426
|
}));
|
424
|
-
colProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, colProps), {}, {
|
425
|
-
span: lessMode ? colProps.span : 24 // 默认占一行
|
426
|
-
});
|
427
427
|
}
|
428
428
|
// 默认占据一行
|
429
429
|
if (['ProCollapse', 'Container'].includes(type)) {
|
@@ -37,25 +37,11 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
37
37
|
}
|
38
38
|
var _value = filterObject(value);
|
39
39
|
var _originalValue = filterObject(originalValue);
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
// 如果两个值有一个不是空值, 则进行深比较
|
48
|
-
if (!(0, _utils.isEmpty)(value === null || value === void 0 ? void 0 : value[index]) || !(0, _utils.isEmpty)(valueItem)) {
|
49
|
-
return (0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
50
|
-
}
|
51
|
-
return true;
|
52
|
-
});
|
53
|
-
return isSame ? 'same' : 'changed';
|
54
|
-
}
|
55
|
-
return 'changed';
|
56
|
-
}
|
57
|
-
if (!(0, _utils.isEmpty)(_originalValue) || !(0, _utils.isEmpty)(_value)) {
|
58
|
-
return (0, _lodash.isEqual)(_value, _originalValue) ? 'same' : 'changed';
|
59
|
-
}
|
60
|
-
return 'same';
|
40
|
+
var isEmptyVal = (0, _utils.isEmpty)(_value);
|
41
|
+
var isEmptyOrg = (0, _utils.isEmpty)(_originalValue);
|
42
|
+
// 都为空视为相等
|
43
|
+
if (isEmptyOrg && isEmptyVal) return 'same';
|
44
|
+
// 如果原始值为空 且当前有值的话 视为新增
|
45
|
+
if (isEmptyOrg && !isEmptyVal) return 'add';
|
46
|
+
return (0, _lodash.isEqual)(_value, _originalValue) ? 'same' : 'changed';
|
61
47
|
};
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
@@ -8,7 +8,10 @@ exports.useFocus = exports.isEmpty = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
9
|
var _react = require("react");
|
10
10
|
var EMPTY_VALUE = [undefined, null, ''];
|
11
|
-
/**
|
11
|
+
/**
|
12
|
+
* 判断一个值是否是空值
|
13
|
+
* 空值 或者 仅包含空值的数组视为空
|
14
|
+
*/
|
12
15
|
var isEmpty = exports.isEmpty = function isEmpty(value, emptyValue) {
|
13
16
|
if (emptyValue) {
|
14
17
|
EMPTY_VALUE.push(emptyValue);
|