@zat-design/sisyphus-react 3.4.2 → 3.4.3
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 +286 -240
- package/dist/less.esm.css +5022 -0
- package/dist/less.esm.js +3 -0
- package/es/ProConfigProvider/index.js +2 -1
- package/es/ProEditLabel/style/index.less +1 -1
- package/es/ProEditTable/components/RenderField/index.js +28 -20
- package/es/ProEditTable/index.js +3 -3
- package/es/ProEditTable/propsType.d.ts +1 -1
- package/es/ProEditTable/style/index.less +1 -1
- package/es/ProEditTable/utils/config.js +5 -5
- package/es/ProEditTable/utils/index.js +67 -30
- package/es/ProEditTable/utils/tools.js +3 -1
- package/es/ProEnum/components/Group.d.ts +2 -0
- package/es/ProEnum/components/Group.js +26 -8
- package/es/ProEnum/index.js +4 -3
- package/es/ProEnum/style/index.less +12 -3
- package/es/ProForm/components/base/DatePicker/index.js +2 -2
- package/es/ProForm/components/combination/FormList/index.js +6 -3
- package/es/ProForm/components/combination/FormList/utils.d.ts +2 -1
- package/es/ProForm/components/combination/FormList/utils.js +5 -3
- package/es/ProForm/components/combination/Group/index.js +28 -15
- package/es/ProForm/components/combination/Group/propsType.d.ts +6 -0
- package/es/ProForm/components/combination/Group/style/index.less +4 -4
- package/es/ProForm/components/combination/Group/utils.d.ts +2 -0
- package/es/ProForm/components/combination/Group/utils.js +10 -0
- package/es/ProForm/components/combination/ProTimeLimit/index.js +8 -2
- package/es/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
- package/es/ProForm/components/index.d.ts +0 -1
- package/es/ProForm/components/index.js +1 -1
- package/es/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/es/ProForm/components/render/Render.js +21 -13
- package/es/ProForm/components/render/RenderFields.d.ts +2 -1
- package/es/ProForm/components/render/RenderFields.js +7 -3
- package/es/ProForm/components/render/propsType.d.ts +1 -4
- package/es/ProForm/index.js +8 -6
- package/es/ProForm/propsType.d.ts +5 -1
- package/es/ProForm/style/index.less +17 -13
- package/es/ProForm/utils/{contrastOriginal.d.ts → diffOriginal.d.ts} +2 -1
- package/es/ProForm/utils/diffOriginal.js +61 -0
- package/es/ProForm/utils/index.d.ts +1 -1
- package/es/ProForm/utils/index.js +1 -1
- package/es/ProForm/utils/transformNames.d.ts +1 -1
- package/es/ProForm/utils/transformNames.js +11 -4
- package/es/ProForm/utils/transformValue.js +2 -2
- package/es/ProForm/utils/useChanged.js +4 -3
- package/es/ProForm/utils/useListChanged.d.ts +1 -1
- package/es/ProForm/utils/useListChanged.js +5 -3
- package/es/ProForm/utils/valueType.d.ts +10 -5
- package/es/ProForm/utils/valueType.js +20 -10
- package/es/ProIcon/config/index.d.ts +2 -1
- package/es/ProIcon/config/index.js +191 -133
- package/es/ProIcon/index.d.ts +0 -1
- package/es/ProIcon/index.js +21 -36
- package/es/ProIcon/propsTypes.d.ts +2 -1
- package/es/ProLayout/components/Layout/Header/style/index.less +1 -1
- package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +58 -55
- package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
- package/es/ProLayout/components/Layout/Menu/style/index.less +52 -56
- package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -0
- package/es/ProLayout/components/ProCollapse/index.js +22 -3
- package/es/ProLayout/components/ProCollapse/style/index.less +29 -11
- package/es/ProLayout/components/ProFooter/index.js +1 -1
- package/es/ProLayout/components/ProFooter/style/index.less +1 -1
- package/es/ProLayout/components/ProHeader/style/index.less +6 -5
- package/es/ProLayout/style/index.less +176 -88
- package/es/ProStep/components/Item/index.js +2 -1
- package/es/ProStep/style/index.less +71 -70
- package/es/ProTable/components/RenderColumn/index.d.ts +1 -1
- package/es/ProTable/components/RenderColumn/index.js +3 -3
- package/es/ProTable/propsType.d.ts +1 -1
- package/es/ProTable/style/index.less +2 -2
- package/es/ProTable/utils.js +9 -9
- package/es/ProTabs/style/index.less +3 -1
- package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +2 -2
- package/es/ProThemeTools/component/PrdTools/style/index.less +1 -1
- package/es/ProThemeTools/index.js +21 -28
- package/es/ProThemeTools/propsType.d.ts +1 -1
- package/es/ProThemeTools/style/index.less +25 -8
- package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.js +7 -11
- package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.d.ts +1 -1
- package/es/ProTree/index.js +1 -1
- package/es/ProTreeModal/style/index.less +2 -2
- package/es/ProUpload/style/fileItem.less +2 -2
- package/es/ProUpload/style/index.less +2 -2
- package/es/assets/catalog.svg +30 -1
- package/es/assets/fold.svg +27 -0
- package/es/assets/setting.svg +14 -0
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/en_US.js +3 -0
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_CN.js +3 -0
- package/es/style/components.less +0 -1
- package/es/style/less.less +2 -0
- package/es/style/theme/antd.less +1 -2
- package/es/style/theme/index.less +2 -2
- package/es/style/theme/tokens.less +2 -2
- package/es/tokens.js +2 -2
- package/lib/ProConfigProvider/index.js +2 -1
- package/lib/ProEditLabel/style/index.less +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +27 -19
- package/lib/ProEditTable/index.js +3 -3
- package/lib/ProEditTable/propsType.d.ts +1 -1
- package/lib/ProEditTable/style/index.less +1 -1
- package/lib/ProEditTable/utils/config.js +5 -5
- package/lib/ProEditTable/utils/index.js +67 -30
- package/lib/ProEditTable/utils/tools.js +3 -1
- package/lib/ProEnum/components/Group.d.ts +2 -0
- package/lib/ProEnum/components/Group.js +26 -8
- package/lib/ProEnum/index.js +4 -3
- package/lib/ProEnum/style/index.less +12 -3
- package/lib/ProForm/components/base/DatePicker/index.js +1 -1
- package/lib/ProForm/components/combination/FormList/index.js +6 -3
- package/lib/ProForm/components/combination/FormList/utils.d.ts +2 -1
- package/lib/ProForm/components/combination/FormList/utils.js +5 -3
- package/lib/ProForm/components/combination/Group/index.js +25 -12
- package/lib/ProForm/components/combination/Group/propsType.d.ts +6 -0
- package/lib/ProForm/components/combination/Group/style/index.less +4 -4
- package/lib/ProForm/components/combination/Group/utils.d.ts +2 -0
- package/lib/ProForm/components/combination/Group/utils.js +11 -1
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +7 -1
- package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
- package/lib/ProForm/components/index.d.ts +0 -1
- package/lib/ProForm/components/index.js +0 -7
- package/lib/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/lib/ProForm/components/render/Render.js +21 -13
- package/lib/ProForm/components/render/RenderFields.d.ts +2 -1
- package/lib/ProForm/components/render/RenderFields.js +7 -3
- package/lib/ProForm/components/render/propsType.d.ts +1 -4
- package/lib/ProForm/index.js +7 -5
- package/lib/ProForm/propsType.d.ts +5 -1
- package/lib/ProForm/style/index.less +17 -13
- package/lib/ProForm/utils/{contrastOriginal.d.ts → diffOriginal.d.ts} +2 -1
- package/lib/ProForm/utils/diffOriginal.js +68 -0
- package/lib/ProForm/utils/index.d.ts +1 -1
- package/lib/ProForm/utils/index.js +2 -2
- package/lib/ProForm/utils/transformNames.d.ts +1 -1
- package/lib/ProForm/utils/transformNames.js +10 -3
- package/lib/ProForm/utils/transformValue.js +1 -1
- package/lib/ProForm/utils/useChanged.js +4 -3
- package/lib/ProForm/utils/useListChanged.d.ts +1 -1
- package/lib/ProForm/utils/useListChanged.js +5 -3
- package/lib/ProForm/utils/valueType.d.ts +10 -5
- package/lib/ProForm/utils/valueType.js +20 -10
- package/lib/ProIcon/config/index.d.ts +2 -1
- package/lib/ProIcon/config/index.js +191 -133
- package/lib/ProIcon/index.d.ts +0 -1
- package/lib/ProIcon/index.js +21 -37
- package/lib/ProIcon/propsTypes.d.ts +2 -1
- package/lib/ProLayout/components/Layout/Header/style/index.less +1 -1
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +58 -55
- package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
- package/lib/ProLayout/components/Layout/Menu/style/index.less +52 -56
- package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -0
- package/lib/ProLayout/components/ProCollapse/index.js +20 -3
- package/lib/ProLayout/components/ProCollapse/style/index.less +29 -11
- package/lib/ProLayout/components/ProFooter/index.js +1 -1
- package/lib/ProLayout/components/ProFooter/style/index.less +1 -1
- package/lib/ProLayout/components/ProHeader/style/index.less +6 -5
- package/lib/ProLayout/style/index.less +176 -88
- package/lib/ProStep/components/Item/index.js +2 -1
- package/lib/ProStep/style/index.less +71 -70
- package/lib/ProTable/components/RenderColumn/index.d.ts +1 -1
- package/lib/ProTable/components/RenderColumn/index.js +3 -3
- package/lib/ProTable/propsType.d.ts +1 -1
- package/lib/ProTable/style/index.less +2 -2
- package/lib/ProTable/utils.js +9 -9
- package/lib/ProTabs/style/index.less +3 -1
- package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +2 -2
- package/lib/ProThemeTools/component/PrdTools/style/index.less +1 -1
- package/lib/ProThemeTools/index.js +19 -27
- package/lib/ProThemeTools/propsType.d.ts +1 -1
- package/lib/ProThemeTools/style/index.less +25 -8
- package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.js +7 -11
- package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.d.ts +1 -1
- package/lib/ProTree/index.js +1 -1
- package/lib/ProTreeModal/style/index.less +2 -2
- package/lib/ProUpload/style/fileItem.less +2 -2
- package/lib/ProUpload/style/index.less +2 -2
- package/lib/assets/catalog.svg +30 -1
- package/lib/assets/fold.svg +27 -0
- package/lib/assets/setting.svg +14 -0
- package/lib/locale/en_US.d.ts +3 -0
- package/lib/locale/en_US.js +3 -0
- package/lib/locale/zh_CN.d.ts +3 -0
- package/lib/locale/zh_CN.js +3 -0
- package/lib/style/components.less +0 -1
- package/lib/style/less.less +2 -0
- package/lib/style/theme/antd.less +1 -2
- package/lib/style/theme/index.less +2 -2
- package/lib/style/theme/tokens.less +2 -2
- package/lib/tokens.js +2 -2
- package/package.json +1 -1
- package/es/ProForm/utils/contrastOriginal.js +0 -24
- package/es/ProIcon/symbolIcon.js +0 -43
- package/lib/ProForm/utils/contrastOriginal.js +0 -30
- package/lib/ProIcon/symbolIcon.js +0 -45
- /package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.d.ts +0 -0
- /package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.js +0 -0
- /package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/style/index.less +0 -0
- /package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.d.ts +0 -0
- /package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.js +0 -0
- /package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/style/index.less +0 -0
|
@@ -4,14 +4,13 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
4
4
|
import "antd/es/button/style";
|
|
5
5
|
import _Button from "antd/es/button";
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
8
|
import { useMemo } from 'react';
|
|
10
|
-
import { omit, isFunction } from 'lodash';
|
|
11
|
-
import { useDeepCompareEffect
|
|
9
|
+
import { omit, isFunction, union, isNumber } from 'lodash';
|
|
10
|
+
import { useDeepCompareEffect } from 'ahooks';
|
|
12
11
|
import classnames from 'classnames';
|
|
13
12
|
import RenderFields from '../../render/RenderFields';
|
|
14
|
-
import { insertSeparator } from './utils';
|
|
13
|
+
import { insertSeparator, transformNamesString } from './utils';
|
|
15
14
|
import ProForm from '../../../../ProForm';
|
|
16
15
|
var Group = function Group(props) {
|
|
17
16
|
var columns = props.children,
|
|
@@ -23,15 +22,16 @@ var Group = function Group(props) {
|
|
|
23
22
|
} : _props$space,
|
|
24
23
|
id = props.id,
|
|
25
24
|
value = props.value,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
inc = _useCounter2[1].inc;
|
|
25
|
+
isView = props.isView,
|
|
26
|
+
index = props.index,
|
|
27
|
+
onFieldChange = props.onFieldChange,
|
|
28
|
+
namePath = props.namePath;
|
|
31
29
|
var _ref = ProForm.useFieldProps() || {},
|
|
32
30
|
names = _ref.names,
|
|
33
31
|
name = _ref.name,
|
|
34
|
-
form = _ref.form
|
|
32
|
+
form = _ref.form,
|
|
33
|
+
_namePath = _ref.namePath;
|
|
34
|
+
var newNamePath = namePath || _namePath || [];
|
|
35
35
|
if (!Array.isArray(names)) {
|
|
36
36
|
console.error('Warning: Composite form components whose type is Group must be configured with names');
|
|
37
37
|
}
|
|
@@ -41,8 +41,10 @@ var Group = function Group(props) {
|
|
|
41
41
|
return _objectSpread(_objectSpread({
|
|
42
42
|
disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
|
|
43
43
|
}, item), {}, {
|
|
44
|
+
isView: isView !== null && isView !== void 0 ? isView : item.isView,
|
|
44
45
|
noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
|
|
45
|
-
parentNames: id
|
|
46
|
+
parentNames: id,
|
|
47
|
+
namePath: newNamePath
|
|
46
48
|
});
|
|
47
49
|
});
|
|
48
50
|
var node = _jsx(_Button, {
|
|
@@ -64,14 +66,25 @@ var Group = function Group(props) {
|
|
|
64
66
|
return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
|
|
65
67
|
})
|
|
66
68
|
}, "".concat(className), className));
|
|
69
|
+
// 用于formList场景下names移除掉了前缀,需要再次合并回来
|
|
70
|
+
var _names = names.map(function (item) {
|
|
71
|
+
if (isNumber(item === null || item === void 0 ? void 0 : item[0])) {
|
|
72
|
+
return union(newNamePath, item);
|
|
73
|
+
}
|
|
74
|
+
return item;
|
|
75
|
+
});
|
|
67
76
|
useDeepCompareEffect(function () {
|
|
77
|
+
var _document, _document$activeEleme;
|
|
78
|
+
// 焦点激活的表单
|
|
79
|
+
var touchName = ((_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) || '';
|
|
68
80
|
// 模拟change,初始化不执行onFieldChange
|
|
69
|
-
if (isFunction(onFieldChange) &&
|
|
70
|
-
onFieldChange(value, form.getFieldsValue(), {
|
|
71
|
-
form: form
|
|
81
|
+
if (isFunction(onFieldChange) && form.isFieldsTouched(_names) && transformNamesString(_names).includes(touchName)) {
|
|
82
|
+
onFieldChange(value, (newNamePath === null || newNamePath === void 0 ? void 0 : newNamePath.length) ? form.getFieldValue(newNamePath, true) : form.getFieldsValue(), {
|
|
83
|
+
form: form,
|
|
84
|
+
namePath: newNamePath,
|
|
85
|
+
index: index
|
|
72
86
|
});
|
|
73
87
|
}
|
|
74
|
-
inc();
|
|
75
88
|
}, [value]);
|
|
76
89
|
return _jsx("div", {
|
|
77
90
|
className: _className,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RowProps, SpaceProps } from 'antd';
|
|
3
3
|
import { FormInstance } from 'antd/es/form/Form';
|
|
4
|
+
import { NamePath } from 'antd/lib/form/interface';
|
|
4
5
|
import { ProColumnProps, ProFormOtherProps } from '../../../propsType';
|
|
5
6
|
export interface SpaceType extends SpaceProps {
|
|
6
7
|
/**
|
|
@@ -23,7 +24,12 @@ export interface GroupProps {
|
|
|
23
24
|
value?: any;
|
|
24
25
|
id?: string;
|
|
25
26
|
disabled?: boolean | (() => void);
|
|
27
|
+
isView?: boolean;
|
|
28
|
+
namePath?: NamePath;
|
|
29
|
+
index?: number;
|
|
26
30
|
onFieldChange?: (value: any[] | null, record: any, { form, }: {
|
|
27
31
|
form: FormInstance;
|
|
32
|
+
namePath?: NamePath;
|
|
33
|
+
index?: number;
|
|
28
34
|
}) => any;
|
|
29
35
|
}
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.start-radius() {
|
|
12
|
-
border-start-start-radius:
|
|
13
|
-
border-end-start-radius:
|
|
12
|
+
border-start-start-radius: 4px;
|
|
13
|
+
border-end-start-radius: 4px;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.end-radius() {
|
|
17
|
-
border-start-end-radius:
|
|
18
|
-
border-end-end-radius:
|
|
17
|
+
border-start-end-radius: 4px;
|
|
18
|
+
border-end-end-radius: 4px;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.pro-group {
|
|
@@ -6,3 +6,5 @@ import { SpaceType } from './propsType';
|
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
8
|
export declare const insertSeparator: (columns: any, space?: SpaceType, separatorNode?: ReactNode, otherProps?: any) => any;
|
|
9
|
+
/** 转换names */
|
|
10
|
+
export declare const transformNamesString: (arr: (string | string[])[]) => (string | string[])[];
|
|
@@ -33,4 +33,14 @@ export var insertSeparator = function insertSeparator(columns, space, separatorN
|
|
|
33
33
|
}
|
|
34
34
|
return result;
|
|
35
35
|
}, []);
|
|
36
|
+
};
|
|
37
|
+
/** 转换names */
|
|
38
|
+
export var transformNamesString = function transformNamesString(arr) {
|
|
39
|
+
var result = arr.map(function (subArr) {
|
|
40
|
+
if (Array.isArray(subArr)) {
|
|
41
|
+
return subArr.join('_');
|
|
42
|
+
}
|
|
43
|
+
return subArr;
|
|
44
|
+
});
|
|
45
|
+
return result;
|
|
36
46
|
};
|
|
@@ -11,7 +11,7 @@ var _excluded = ["format", "disabled", "foreverTime", "foreverText", "valueType"
|
|
|
11
11
|
_excluded2 = ["mode"];
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import { omit } from 'lodash';
|
|
14
|
+
import { omit, isObject } from 'lodash';
|
|
15
15
|
import moment from 'moment';
|
|
16
16
|
import { useMemo } from 'react';
|
|
17
17
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
@@ -53,7 +53,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
53
53
|
onChange = _useControlled2[1];
|
|
54
54
|
var initialConfig = useProConfig('ProTimeLimit');
|
|
55
55
|
var isForever = useMemo(function () {
|
|
56
|
-
if (
|
|
56
|
+
if (isObject(value)) {
|
|
57
57
|
return foreverMoment.format(format) === value.format(format);
|
|
58
58
|
}
|
|
59
59
|
return false;
|
|
@@ -73,6 +73,12 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
73
73
|
children: foreverText
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
+
if (isObject(value)) {
|
|
77
|
+
return _jsx(Container, {
|
|
78
|
+
viewEmpty: viewEmpty,
|
|
79
|
+
children: value.format(format)
|
|
80
|
+
});
|
|
81
|
+
}
|
|
76
82
|
return _jsx(Container, {
|
|
77
83
|
viewEmpty: viewEmpty,
|
|
78
84
|
children: props.value
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
~ .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
|
|
7
7
|
.@{ant-prefix}-input-borderless
|
|
8
8
|
).@{ant-prefix}-input {
|
|
9
|
-
background: @zaui-base-bg;
|
|
9
|
+
// background: @zaui-base-bg;
|
|
10
10
|
border-color: var(--ant-error-color);
|
|
11
11
|
}
|
|
12
12
|
.forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
|
|
@@ -24,7 +24,6 @@ export { default as Container } from './combination/Container';
|
|
|
24
24
|
export { default as ProEnum } from '../../ProEnum';
|
|
25
25
|
export { default as ProSelect } from '../../ProSelect';
|
|
26
26
|
export { default as ProUpload } from '../../ProUpload';
|
|
27
|
-
export { default as ProTreeSelect } from '../../ProTreeSelect';
|
|
28
27
|
export { default as ProTreeModal } from '../../ProTreeModal';
|
|
29
28
|
export { default as ProTree } from '../../ProTree';
|
|
30
29
|
export { default as FormFooter } from './FormFooter';
|
|
@@ -26,7 +26,7 @@ export { default as Container } from './combination/Container';
|
|
|
26
26
|
export { default as ProEnum } from '../../ProEnum';
|
|
27
27
|
export { default as ProSelect } from '../../ProSelect';
|
|
28
28
|
export { default as ProUpload } from '../../ProUpload';
|
|
29
|
-
export { default as ProTreeSelect } from '../../ProTreeSelect';
|
|
29
|
+
// export { default as ProTreeSelect } from '../../ProTreeSelect';
|
|
30
30
|
export { default as ProTreeModal } from '../../ProTreeModal';
|
|
31
31
|
export { default as ProTree } from '../../ProTree';
|
|
32
32
|
// footer组件
|
|
@@ -33,7 +33,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
if (isObject(confirmProps)) {
|
|
36
|
-
_Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, defaultConfirmProps), confirmProps), {}, {
|
|
36
|
+
_Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, 'title' in confirmProps || 'content' in confirmProps ? {} : defaultConfirmProps), confirmProps), {}, {
|
|
37
37
|
onOk: function onOk() {
|
|
38
38
|
var _confirmProps$onOk;
|
|
39
39
|
for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
@@ -34,7 +34,7 @@ import useRules from '../../utils/useRules';
|
|
|
34
34
|
import ConfirmWrapper from './ConfirmWrapper';
|
|
35
35
|
// 这个组件只管渲染, 参数的整理在外部处理
|
|
36
36
|
var Render = function Render(props) {
|
|
37
|
-
var _ref2, _ref3, _otherProps$names2;
|
|
37
|
+
var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
|
|
38
38
|
var component = props.component,
|
|
39
39
|
originComponent = props.originComponent,
|
|
40
40
|
_props$formItemProps = props.formItemProps,
|
|
@@ -52,8 +52,9 @@ var Render = function Render(props) {
|
|
|
52
52
|
originalValues = props.originalValues,
|
|
53
53
|
equalWith = props.equalWith,
|
|
54
54
|
requiredOnView = props.requiredOnView,
|
|
55
|
-
|
|
56
|
-
confirm = props.confirm
|
|
55
|
+
originalDiffTip = props.originalDiffTip,
|
|
56
|
+
confirm = props.confirm,
|
|
57
|
+
globalControl = props.globalControl;
|
|
57
58
|
var colProps = props.colProps;
|
|
58
59
|
// 剔除一些不是FormItem的属性, 防止控制台报warning
|
|
59
60
|
var labelWidth = formItemProps.labelWidth,
|
|
@@ -149,7 +150,7 @@ var Render = function Render(props) {
|
|
|
149
150
|
*/
|
|
150
151
|
var transforms = Array.isArray(otherProps === null || otherProps === void 0 ? void 0 : otherProps.names) ? transformNames(_objectSpread(_objectSpread({}, otherFormItemProps), valueTypeTransform()),
|
|
151
152
|
// 合并valueType的transform
|
|
152
|
-
form, otherProps.names, namesStr) : valueTypeTransform();
|
|
153
|
+
form, otherProps.names, namesStr, otherProps.type) : valueTypeTransform();
|
|
153
154
|
// ↑↑↑↑↑↑ formItem参数整理 ↑↑↑↑↑↑
|
|
154
155
|
Object.assign(otherFormItemProps, transforms, {
|
|
155
156
|
names: otherProps.names
|
|
@@ -169,8 +170,12 @@ var Render = function Render(props) {
|
|
|
169
170
|
}
|
|
170
171
|
/** 移除多余参数,防止透传给formItem报错 */
|
|
171
172
|
var _otherFormItemProps = omit(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'switchValue', 'precision', 'clearNotShow']);
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
/**
|
|
174
|
+
* globalControl 全局控制优先
|
|
175
|
+
* globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
|
|
176
|
+
* globalControl false时,优先级 组件上【fieldProps.disabled】 > formitem上【column.disabled】 > 全局【formDisabled】
|
|
177
|
+
*/
|
|
178
|
+
var lastDisabled = globalControl ? (_ref2 = (_ref3 = formDisabled !== null && formDisabled !== void 0 ? formDisabled : _disabled) !== null && _ref3 !== void 0 ? _ref3 : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref2 !== void 0 ? _ref2 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled : (_ref4 = (_ref5 = _disabled !== null && _disabled !== void 0 ? _disabled : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref5 !== void 0 ? _ref5 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled) !== null && _ref4 !== void 0 ? _ref4 : formDisabled;
|
|
174
179
|
/**
|
|
175
180
|
* 最新fieldProps: 更新后的组件Props
|
|
176
181
|
*/
|
|
@@ -198,8 +203,8 @@ var Render = function Render(props) {
|
|
|
198
203
|
var functionArgs = function functionArgs(args) {
|
|
199
204
|
var _otherFormItemProps$n;
|
|
200
205
|
var _args = _toConsumableArray(args);
|
|
201
|
-
var
|
|
202
|
-
valueType =
|
|
206
|
+
var _ref6 = otherProps || {},
|
|
207
|
+
valueType = _ref6.valueType;
|
|
203
208
|
_args[1] = form.getFieldsValue();
|
|
204
209
|
_args[2] = {
|
|
205
210
|
form: form
|
|
@@ -266,7 +271,7 @@ var Render = function Render(props) {
|
|
|
266
271
|
}, 60);
|
|
267
272
|
}
|
|
268
273
|
// ProTreeSelect返回option
|
|
269
|
-
if (['
|
|
274
|
+
if (['ProTree'].includes(type)) {
|
|
270
275
|
var _args2, _args2$;
|
|
271
276
|
_args[2].option = findOptionByValue(lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.dataSource, (_args2 = _args) === null || _args2 === void 0 ? void 0 : (_args2$ = _args2[0]) === null || _args2$ === void 0 ? void 0 : _args2$[0]);
|
|
272
277
|
}
|
|
@@ -276,7 +281,7 @@ var Render = function Render(props) {
|
|
|
276
281
|
* onBlur参数重置 (value, record, { form, index, namePath, option }) => void
|
|
277
282
|
*/
|
|
278
283
|
var handleBlur = /*#__PURE__*/function () {
|
|
279
|
-
var
|
|
284
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
280
285
|
var _len2,
|
|
281
286
|
args,
|
|
282
287
|
_key2,
|
|
@@ -303,7 +308,7 @@ var Render = function Render(props) {
|
|
|
303
308
|
}, _callee);
|
|
304
309
|
}));
|
|
305
310
|
return function handleBlur() {
|
|
306
|
-
return
|
|
311
|
+
return _ref7.apply(this, arguments);
|
|
307
312
|
};
|
|
308
313
|
}();
|
|
309
314
|
var renderItem = function renderItem() {
|
|
@@ -380,7 +385,7 @@ var Render = function Render(props) {
|
|
|
380
385
|
};
|
|
381
386
|
}
|
|
382
387
|
// 需要过滤掉的form_item的key
|
|
383
|
-
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after'];
|
|
388
|
+
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after', 'globalControl'];
|
|
384
389
|
if (type === 'FormList') {
|
|
385
390
|
lastComponentProps.disabled = lastDisabled;
|
|
386
391
|
var lessMode = lastComponentProps.mode === 'less';
|
|
@@ -429,7 +434,7 @@ var Render = function Render(props) {
|
|
|
429
434
|
});
|
|
430
435
|
}
|
|
431
436
|
// 不渲染tooltip
|
|
432
|
-
if (!
|
|
437
|
+
if (!originalDiffTip || ['FormList', 'ProEditTable'].includes(type)) {
|
|
433
438
|
return formItem;
|
|
434
439
|
}
|
|
435
440
|
var title = _jsxs(_Space, {
|
|
@@ -442,6 +447,9 @@ var Render = function Render(props) {
|
|
|
442
447
|
return _jsx(_Tooltip, {
|
|
443
448
|
title: title,
|
|
444
449
|
visible: changed ? undefined : false,
|
|
450
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
451
|
+
return target.parentElement;
|
|
452
|
+
},
|
|
445
453
|
children: formItem
|
|
446
454
|
});
|
|
447
455
|
};
|
|
@@ -17,7 +17,8 @@ interface Props<T = any> {
|
|
|
17
17
|
clearNotShow?: boolean;
|
|
18
18
|
requiredOnView?: boolean;
|
|
19
19
|
required?: boolean | (() => boolean);
|
|
20
|
-
|
|
20
|
+
originalDiffTip?: boolean;
|
|
21
|
+
globalControl?: boolean;
|
|
21
22
|
}
|
|
22
23
|
declare const RenderFields: React.FC<Props>;
|
|
23
24
|
export default RenderFields;
|
|
@@ -25,7 +25,8 @@ var RenderFields = function RenderFields(props) {
|
|
|
25
25
|
outerClearNotShow = props.clearNotShow,
|
|
26
26
|
requiredOnView = props.requiredOnView,
|
|
27
27
|
required = props.required,
|
|
28
|
-
|
|
28
|
+
originalDiffTip = props.originalDiffTip,
|
|
29
|
+
globalControl = props.globalControl;
|
|
29
30
|
// 是否包含隐藏字段
|
|
30
31
|
var hiddenData = columns.filter(function (item) {
|
|
31
32
|
return Array.isArray(item.hiddenNames);
|
|
@@ -175,7 +176,9 @@ var RenderFields = function RenderFields(props) {
|
|
|
175
176
|
form: form,
|
|
176
177
|
type: _type,
|
|
177
178
|
hiddenNames: column.hiddenNames,
|
|
178
|
-
colProps: _colProps
|
|
179
|
+
colProps: _colProps,
|
|
180
|
+
mode: componentProps.mode,
|
|
181
|
+
namePath: column.namePath
|
|
179
182
|
};
|
|
180
183
|
if (outerClearNotShow !== false && show === false && (column === null || column === void 0 ? void 0 : column.name) && form.getFieldValue(column === null || column === void 0 ? void 0 : column.name)) {
|
|
181
184
|
setTimeout(function () {
|
|
@@ -204,7 +207,8 @@ var RenderFields = function RenderFields(props) {
|
|
|
204
207
|
originalValues: originalValues,
|
|
205
208
|
equalWith: equalWith,
|
|
206
209
|
requiredOnView: requiredOnView,
|
|
207
|
-
|
|
210
|
+
originalDiffTip: originalDiffTip,
|
|
211
|
+
globalControl: globalControl
|
|
208
212
|
})
|
|
209
213
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|
|
210
214
|
});
|
|
@@ -26,7 +26,6 @@ import { Props as ProRangeLimitProps } from '../combination/ProRangeLimit';
|
|
|
26
26
|
import { CheckboxPropsMap, ProEnum, PropProSelectsMap, PropRadioPropsMap } from '../../../ProEnum/propsType';
|
|
27
27
|
import { PropSelectProps as ProSelectProps } from '../../../ProSelect/propsType';
|
|
28
28
|
import { ProEditTableProps } from '../../../ProEditTable/propsType';
|
|
29
|
-
import { PropTreeSelectProps } from '../../../ProTreeSelect/propsType';
|
|
30
29
|
import { ProTreeModalProps } from '../../../ProTreeModal/propsType';
|
|
31
30
|
import { ProUploadProps } from '../../../ProUpload/propsType';
|
|
32
31
|
import { ProTreeProps } from '../../../ProTree/propsType';
|
|
@@ -150,9 +149,6 @@ export type ColumnPropsMap<Values = any, T = 'ProForm'> = {
|
|
|
150
149
|
} | {
|
|
151
150
|
type?: 'ProEditTable';
|
|
152
151
|
fieldProps?: FieldProps<ProEditTableProps, Values, T>;
|
|
153
|
-
} | {
|
|
154
|
-
type?: 'ProTreeSelect';
|
|
155
|
-
fieldProps?: FieldProps<PropTreeSelectProps, Values, T>;
|
|
156
152
|
} | {
|
|
157
153
|
type?: 'ProTreeModal';
|
|
158
154
|
fieldProps?: FieldProps<ProTreeModalProps, Values, T>;
|
|
@@ -270,6 +266,7 @@ export interface RenderProps<Values = any> {
|
|
|
270
266
|
originalValues?: Values;
|
|
271
267
|
requiredOnView?: boolean;
|
|
272
268
|
confirm?: ProFormColumnProps['confirm'];
|
|
269
|
+
globalControl?: boolean;
|
|
273
270
|
[name: string]: any;
|
|
274
271
|
}
|
|
275
272
|
export {};
|
package/es/ProForm/index.js
CHANGED
|
@@ -12,13 +12,13 @@ import _Space from "antd/es/space";
|
|
|
12
12
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
13
13
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
14
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
15
|
-
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "
|
|
15
|
+
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalDiffTip", "formKey", "globalControl"];
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import { DoubleLeftOutlined } from '@ant-design/icons';
|
|
18
18
|
import classnames from 'classnames';
|
|
19
19
|
import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
20
20
|
import { isObject, isString, merge } from 'lodash';
|
|
21
|
-
import { FormFooter, InputRange, ProAddress, ProAddressBar, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload,
|
|
21
|
+
import { FormFooter, InputRange, ProAddress, ProAddressBar, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeModal, ProTree, EnumSelect } from './components';
|
|
22
22
|
import RenderFields from './components/render/RenderFields';
|
|
23
23
|
import { useProConfig, useContextForms } from '../ProConfigProvider';
|
|
24
24
|
import { getLayout, splitNameStr, useControlled, initialValuesToNames } from './utils/index';
|
|
@@ -63,9 +63,10 @@ var ProForm = function ProForm(props, ref) {
|
|
|
63
63
|
requiredOnView = _props$requiredOnView === void 0 ? true : _props$requiredOnView,
|
|
64
64
|
formId = props.formId,
|
|
65
65
|
required = props.required,
|
|
66
|
-
_props$
|
|
67
|
-
|
|
66
|
+
_props$originalDiffTi = props.originalDiffTip,
|
|
67
|
+
originalDiffTip = _props$originalDiffTi === void 0 ? true : _props$originalDiffTi,
|
|
68
68
|
formKey = props.formKey,
|
|
69
|
+
globalControl = props.globalControl,
|
|
69
70
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
70
71
|
var _useProConfig = useProConfig(),
|
|
71
72
|
state = _useProConfig.state,
|
|
@@ -253,7 +254,8 @@ var ProForm = function ProForm(props, ref) {
|
|
|
253
254
|
clearNotShow: clearNotShow,
|
|
254
255
|
requiredOnView: requiredOnView,
|
|
255
256
|
required: required,
|
|
256
|
-
|
|
257
|
+
originalDiffTip: originalDiffTip,
|
|
258
|
+
globalControl: globalControl
|
|
257
259
|
}), children, footerRender()]
|
|
258
260
|
}))
|
|
259
261
|
}));
|
|
@@ -318,7 +320,7 @@ ProFormForward.ProNumberRange = ProNumberRange;
|
|
|
318
320
|
ProFormForward.ProModalSelect = ProModalSelect;
|
|
319
321
|
ProFormForward.ProTimeLimit = ProTimeLimit;
|
|
320
322
|
ProFormForward.ProUpload = ProUpload;
|
|
321
|
-
ProFormForward.ProTreeSelect = ProTreeSelect;
|
|
323
|
+
// ProFormForward.ProTreeSelect = ProTreeSelect;
|
|
322
324
|
ProFormForward.ProTreeModal = ProTreeModal;
|
|
323
325
|
ProFormForward.ProTree = ProTree;
|
|
324
326
|
// 待废弃
|
|
@@ -39,9 +39,13 @@ export interface ProFormOtherProps {
|
|
|
39
39
|
disabled: boolean;
|
|
40
40
|
show?: boolean | (() => boolean);
|
|
41
41
|
required?: boolean | (() => boolean);
|
|
42
|
+
mode?: string;
|
|
43
|
+
namePath?: any[] | string | number;
|
|
42
44
|
}
|
|
43
45
|
export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
44
46
|
disabled?: boolean;
|
|
47
|
+
/** 全局控制优先 */
|
|
48
|
+
globalControl?: boolean;
|
|
45
49
|
mode?: ModeEnum;
|
|
46
50
|
formKey?: string;
|
|
47
51
|
/** 是否查看 */
|
|
@@ -67,7 +71,7 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
|
67
71
|
requiredOnView?: boolean;
|
|
68
72
|
formId?: string;
|
|
69
73
|
required?: boolean;
|
|
70
|
-
|
|
74
|
+
originalDiffTip?: boolean;
|
|
71
75
|
}
|
|
72
76
|
export interface Transform<T = any> {
|
|
73
77
|
normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
|
|
@@ -31,16 +31,6 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
&.@{ant-prefix}-form {
|
|
35
|
-
margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.pro-collapse-level2 {
|
|
39
|
-
.@{ant-prefix}-collapse-item {
|
|
40
|
-
margin-bottom: 0 !important;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
34
|
.@{ant-prefix}-form-item-control-input {
|
|
45
35
|
flex-grow: 1;
|
|
46
36
|
max-width: 100%;
|
|
@@ -135,7 +125,7 @@
|
|
|
135
125
|
background: @zaui-contract-bg !important;
|
|
136
126
|
|
|
137
127
|
input {
|
|
138
|
-
background:
|
|
128
|
+
background: transparent;
|
|
139
129
|
}
|
|
140
130
|
.@{ant-prefix}-select-selection-placeholder {
|
|
141
131
|
z-index: 9;
|
|
@@ -147,8 +137,22 @@
|
|
|
147
137
|
border-radius: 4px;
|
|
148
138
|
}
|
|
149
139
|
|
|
150
|
-
//
|
|
151
|
-
.@{ant-prefix}-form-item-control-input-content
|
|
140
|
+
// 地址组件
|
|
141
|
+
.@{ant-prefix}-form-item-control-input-content {
|
|
142
|
+
& > .pro-address {
|
|
143
|
+
.ant-select-selector,
|
|
144
|
+
.ant-input-affix-wrapper,
|
|
145
|
+
.ant-input-disabled {
|
|
146
|
+
background: @zaui-contract-bg;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
& > .ant-input-group {
|
|
150
|
+
.forever-checkbox {
|
|
151
|
+
background: @zaui-contract-bg;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
152
156
|
.pro-form-view-container {
|
|
153
157
|
padding: 4px 8px;
|
|
154
158
|
background: @zaui-contract-bg;
|
|
@@ -3,7 +3,8 @@ interface Params {
|
|
|
3
3
|
originalValue: any;
|
|
4
4
|
value: any;
|
|
5
5
|
form: FormInstance;
|
|
6
|
+
name?: string | any[];
|
|
6
7
|
equalWith?: (originalValue: any, currentValue: any) => boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare const
|
|
9
|
+
export declare const diffOriginal: (params: Params) => boolean;
|
|
9
10
|
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
|
+
import { isEqual, isFunction } from 'lodash';
|
|
3
|
+
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
4
|
+
var extractValue = function extractValue(obj, path) {
|
|
5
|
+
var value = obj || {};
|
|
6
|
+
if (!Object.keys(obj)) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
var _iterator = _createForOfIteratorHelper(path),
|
|
10
|
+
_step;
|
|
11
|
+
try {
|
|
12
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
13
|
+
var key = _step.value;
|
|
14
|
+
if (value && value.hasOwnProperty(key)) {
|
|
15
|
+
value = value[key];
|
|
16
|
+
} else {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
} catch (err) {
|
|
21
|
+
_iterator.e(err);
|
|
22
|
+
} finally {
|
|
23
|
+
_iterator.f();
|
|
24
|
+
}
|
|
25
|
+
return Object.values(value);
|
|
26
|
+
};
|
|
27
|
+
/** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
|
|
28
|
+
var extractValues = function extractValues(data, pathString) {
|
|
29
|
+
if (pathString.includes('_')) {
|
|
30
|
+
var namePrefixes = pathString.split('-')[0].split('_').slice(0, -1);
|
|
31
|
+
return extractValue(data, namePrefixes);
|
|
32
|
+
}
|
|
33
|
+
return pathString.split('-').map(function (item) {
|
|
34
|
+
return data[item];
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export var diffOriginal = function diffOriginal(params) {
|
|
38
|
+
var originalValue = params.originalValue,
|
|
39
|
+
_value = params.value,
|
|
40
|
+
equalWith = params.equalWith,
|
|
41
|
+
form = params.form,
|
|
42
|
+
name = params.name;
|
|
43
|
+
var value = !(name === null || name === void 0 ? void 0 : name.includes('-')) ? _value : extractValues(form.getFieldsValue(), name);
|
|
44
|
+
// 支持传入自定义比较事件
|
|
45
|
+
if (isFunction(equalWith)) {
|
|
46
|
+
return !equalWith(originalValue, value);
|
|
47
|
+
}
|
|
48
|
+
if (Array.isArray(originalValue)) {
|
|
49
|
+
return originalValue.some(function (valueItem, index) {
|
|
50
|
+
// 如果两个值有一个不是空值, 则进行深比较
|
|
51
|
+
if (!nullValue.includes(value === null || value === void 0 ? void 0 : value[index]) || !nullValue.includes(valueItem)) {
|
|
52
|
+
return !isEqual(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
58
|
+
return !isEqual(value, originalValue);
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
};
|
|
@@ -26,7 +26,7 @@ export declare const isTrim: (type: string, trim: boolean, configData: any) => a
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const isUpperCase: (type: string, upperCase: boolean) => any;
|
|
28
28
|
export declare const weedOutProps: (data: Record<string, any>, keys: string[]) => {}[];
|
|
29
|
-
export declare const
|
|
29
|
+
export declare const diffField: (prevValues: any, curValues: any, names: NamePath[]) => boolean;
|
|
30
30
|
export declare const splitNameStr: (name: string) => NamePath[];
|
|
31
31
|
export declare const filterInternalFields: (values: any) => any;
|
|
32
32
|
export declare const getAllNamePath: (object: Record<string, any>, currentPath?: InternalNamePath) => InternalNamePath[];
|
|
@@ -108,7 +108,7 @@ export var weedOutProps = function weedOutProps(data, keys) {
|
|
|
108
108
|
return [obj, weedOut];
|
|
109
109
|
};
|
|
110
110
|
// 对比字段变化
|
|
111
|
-
export var
|
|
111
|
+
export var diffField = function diffField(prevValues, curValues, names) {
|
|
112
112
|
return names.some(function (name) {
|
|
113
113
|
return _.get(prevValues, name) !== _.get(curValues, name);
|
|
114
114
|
});
|
|
@@ -6,5 +6,5 @@ interface TransformProps extends FormItemProps {
|
|
|
6
6
|
namePath: any[];
|
|
7
7
|
}
|
|
8
8
|
type TransformFun = 'normalize' | 'getValueProps' | 'shouldUpdate' | 'name';
|
|
9
|
-
declare const transformNames: (formItem: TransformProps, form: FormInstance, names: NamePath[], fieldName: string) => Pick<TransformProps, TransformFun>;
|
|
9
|
+
declare const transformNames: (formItem: TransformProps, form: FormInstance, names: NamePath[], fieldName: string, type?: string) => Pick<TransformProps, TransformFun>;
|
|
10
10
|
export default transformNames;
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import { union } from 'lodash';
|
|
1
|
+
import { union, isNumber } from 'lodash';
|
|
2
2
|
import { transformValue } from './transformValue';
|
|
3
|
-
var transformNames = function transformNames(formItem, form, names, fieldName) {
|
|
3
|
+
var transformNames = function transformNames(formItem, form, names, fieldName, type) {
|
|
4
|
+
var _names2, _names3, _names3$;
|
|
4
5
|
var _ref = formItem || {},
|
|
5
6
|
normalize = _ref.normalize,
|
|
6
7
|
getValueProps = _ref.getValueProps,
|
|
7
8
|
_shouldUpdate2 = _ref.shouldUpdate;
|
|
8
|
-
|
|
9
|
+
var _names = names;
|
|
10
|
+
if (!((_names2 = _names) === null || _names2 === void 0 ? void 0 : _names2.length)) {
|
|
9
11
|
return {};
|
|
10
12
|
}
|
|
11
13
|
// 当在formList场景下,给transformValue函数的setFiledProps的name, 需要全namePath
|
|
12
14
|
var _fieldName = Array.isArray(formItem === null || formItem === void 0 ? void 0 : formItem.name) ? union(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, formItem === null || formItem === void 0 ? void 0 : formItem.name) : fieldName;
|
|
13
|
-
|
|
15
|
+
if (type === 'Group' && isNumber((_names3 = _names) === null || _names3 === void 0 ? void 0 : (_names3$ = _names3[0]) === null || _names3$ === void 0 ? void 0 : _names3$[0])) {
|
|
16
|
+
_names = _names.map(function (item) {
|
|
17
|
+
return union(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, item);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
var _transformValue = transformValue(_names, form, _fieldName, normalize, getValueProps),
|
|
14
21
|
_normalize = _transformValue.normalize,
|
|
15
22
|
_getValueProps = _transformValue.getValueProps,
|
|
16
23
|
_shouldUpdate = _transformValue.shouldUpdate;
|