@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
|
@@ -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,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.diffOriginal = void 0;
|
|
8
|
+
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
|
9
|
+
var _lodash = require("lodash");
|
|
10
|
+
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
11
|
+
var extractValue = function extractValue(obj, path) {
|
|
12
|
+
var value = obj || {};
|
|
13
|
+
if (!Object.keys(obj)) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
var _iterator = (0, _createForOfIteratorHelper2.default)(path),
|
|
17
|
+
_step;
|
|
18
|
+
try {
|
|
19
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
20
|
+
var key = _step.value;
|
|
21
|
+
if (value && value.hasOwnProperty(key)) {
|
|
22
|
+
value = value[key];
|
|
23
|
+
} else {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} catch (err) {
|
|
28
|
+
_iterator.e(err);
|
|
29
|
+
} finally {
|
|
30
|
+
_iterator.f();
|
|
31
|
+
}
|
|
32
|
+
return Object.values(value);
|
|
33
|
+
};
|
|
34
|
+
/** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
|
|
35
|
+
var extractValues = function extractValues(data, pathString) {
|
|
36
|
+
if (pathString.includes('_')) {
|
|
37
|
+
var namePrefixes = pathString.split('-')[0].split('_').slice(0, -1);
|
|
38
|
+
return extractValue(data, namePrefixes);
|
|
39
|
+
}
|
|
40
|
+
return pathString.split('-').map(function (item) {
|
|
41
|
+
return data[item];
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
45
|
+
var originalValue = params.originalValue,
|
|
46
|
+
_value = params.value,
|
|
47
|
+
equalWith = params.equalWith,
|
|
48
|
+
form = params.form,
|
|
49
|
+
name = params.name;
|
|
50
|
+
var value = !(name === null || name === void 0 ? void 0 : name.includes('-')) ? _value : extractValues(form.getFieldsValue(), name);
|
|
51
|
+
// 支持传入自定义比较事件
|
|
52
|
+
if ((0, _lodash.isFunction)(equalWith)) {
|
|
53
|
+
return !equalWith(originalValue, value);
|
|
54
|
+
}
|
|
55
|
+
if (Array.isArray(originalValue)) {
|
|
56
|
+
return originalValue.some(function (valueItem, index) {
|
|
57
|
+
// 如果两个值有一个不是空值, 则进行深比较
|
|
58
|
+
if (!nullValue.includes(value === null || value === void 0 ? void 0 : value[index]) || !nullValue.includes(valueItem)) {
|
|
59
|
+
return !(0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
65
|
+
return !(0, _lodash.isEqual)(value, originalValue);
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
};
|
|
@@ -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[];
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.getAllNamePath = exports.findOptionByValue = exports.filterInternalFields = exports.equalDependencies = exports.
|
|
8
|
+
exports.getAllNamePath = exports.findOptionByValue = exports.filterInternalFields = exports.equalDependencies = exports.diffField = exports.deleteForPath = exports.customEqualForFun = void 0;
|
|
9
9
|
exports.getArrayBeforeNumber = getArrayBeforeNumber;
|
|
10
10
|
exports.hasRowKey = exports.getLayout = exports.getDecimalDigits = void 0;
|
|
11
11
|
exports.initialValuesToNames = initialValuesToNames;
|
|
@@ -124,7 +124,7 @@ var weedOutProps = exports.weedOutProps = function weedOutProps(data, keys) {
|
|
|
124
124
|
return [obj, weedOut];
|
|
125
125
|
};
|
|
126
126
|
// 对比字段变化
|
|
127
|
-
var
|
|
127
|
+
var diffField = exports.diffField = function diffField(prevValues, curValues, names) {
|
|
128
128
|
return names.some(function (name) {
|
|
129
129
|
return _lodash.default.get(prevValues, name) !== _lodash.default.get(curValues, name);
|
|
130
130
|
});
|
|
@@ -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;
|
|
@@ -6,17 +6,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
8
|
var _transformValue2 = require("./transformValue");
|
|
9
|
-
var transformNames = function transformNames(formItem, form, names, fieldName) {
|
|
9
|
+
var transformNames = function transformNames(formItem, form, names, fieldName, type) {
|
|
10
|
+
var _names2, _names3, _names3$;
|
|
10
11
|
var _ref = formItem || {},
|
|
11
12
|
normalize = _ref.normalize,
|
|
12
13
|
getValueProps = _ref.getValueProps,
|
|
13
14
|
_shouldUpdate2 = _ref.shouldUpdate;
|
|
14
|
-
|
|
15
|
+
var _names = names;
|
|
16
|
+
if (!((_names2 = _names) === null || _names2 === void 0 ? void 0 : _names2.length)) {
|
|
15
17
|
return {};
|
|
16
18
|
}
|
|
17
19
|
// 当在formList场景下,给transformValue函数的setFiledProps的name, 需要全namePath
|
|
18
20
|
var _fieldName = Array.isArray(formItem === null || formItem === void 0 ? void 0 : formItem.name) ? (0, _lodash.union)(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, formItem === null || formItem === void 0 ? void 0 : formItem.name) : fieldName;
|
|
19
|
-
|
|
21
|
+
if (type === 'Group' && (0, _lodash.isNumber)((_names3 = _names) === null || _names3 === void 0 ? void 0 : (_names3$ = _names3[0]) === null || _names3$ === void 0 ? void 0 : _names3$[0])) {
|
|
22
|
+
_names = _names.map(function (item) {
|
|
23
|
+
return (0, _lodash.union)(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, item);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
var _transformValue = (0, _transformValue2.transformValue)(_names, form, _fieldName, normalize, getValueProps),
|
|
20
27
|
_normalize = _transformValue.normalize,
|
|
21
28
|
_getValueProps = _transformValue.getValueProps,
|
|
22
29
|
_shouldUpdate = _transformValue.shouldUpdate;
|
|
@@ -48,7 +48,7 @@ var transformValue = exports.transformValue = function transformValue(names, for
|
|
|
48
48
|
}, cusRest);
|
|
49
49
|
},
|
|
50
50
|
shouldUpdate: function shouldUpdate(prevValues, curValues) {
|
|
51
|
-
return (0, _utils.
|
|
51
|
+
return (0, _utils.diffField)(prevValues, curValues, names);
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
};
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useChanged = void 0;
|
|
7
7
|
var _antd = require("antd");
|
|
8
8
|
var _lodash = require("lodash");
|
|
9
|
-
var
|
|
9
|
+
var _diffOriginal = require("./diffOriginal");
|
|
10
10
|
var useChanged = exports.useChanged = function useChanged(_ref) {
|
|
11
11
|
var name = _ref.name,
|
|
12
12
|
names = _ref.names,
|
|
@@ -21,11 +21,12 @@ var useChanged = exports.useChanged = function useChanged(_ref) {
|
|
|
21
21
|
if (notWatch) form = [];
|
|
22
22
|
var value = _antd.Form.useWatch(namesStr || name, form);
|
|
23
23
|
if (notWatch) return [false];
|
|
24
|
-
var changed = (0,
|
|
24
|
+
var changed = (0, _diffOriginal.diffOriginal)({
|
|
25
25
|
originalValue: originalValue,
|
|
26
26
|
value: value,
|
|
27
27
|
form: form,
|
|
28
|
-
equalWith: equalWith
|
|
28
|
+
equalWith: equalWith,
|
|
29
|
+
name: namesStr || name
|
|
29
30
|
});
|
|
30
31
|
return [changed, originalValue];
|
|
31
32
|
};
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useListChanged = void 0;
|
|
7
7
|
var _antd = require("antd");
|
|
8
8
|
var _lodash = require("lodash");
|
|
9
|
-
var
|
|
9
|
+
var _diffOriginal = require("./diffOriginal");
|
|
10
10
|
var toNamePath = function toNamePath(name) {
|
|
11
11
|
if (Array.isArray(name)) {
|
|
12
12
|
return name;
|
|
@@ -32,6 +32,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
|
32
32
|
var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
|
|
33
33
|
var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
|
|
34
34
|
var rowValue = form.getFieldValue(rowValueNamePath);
|
|
35
|
+
if (!rowValue) return undefined;
|
|
35
36
|
var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
|
|
36
37
|
if (!keyValue) return undefined;
|
|
37
38
|
var originalValueList = (0, _lodash.get)(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|
|
@@ -88,11 +89,12 @@ var useListChanged = exports.useListChanged = function useListChanged(params) {
|
|
|
88
89
|
if (notWatch) _form = [];
|
|
89
90
|
var value = _antd.Form.useWatch(namePath, _form);
|
|
90
91
|
if (notWatch || noChange) return [false];
|
|
91
|
-
var changed = (0,
|
|
92
|
+
var changed = (0, _diffOriginal.diffOriginal)({
|
|
92
93
|
value: value,
|
|
93
94
|
originalValue: originalValue,
|
|
94
95
|
form: form,
|
|
95
|
-
equalWith: equalWith
|
|
96
|
+
equalWith: equalWith,
|
|
97
|
+
name: namesStr || name
|
|
96
98
|
});
|
|
97
99
|
return [changed, originalValue];
|
|
98
100
|
};
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
/** 年月日 */
|
|
3
|
-
date: ({ type, toISOString }: {
|
|
3
|
+
date: ({ type, toISOString, mode }: {
|
|
4
4
|
type: any;
|
|
5
5
|
toISOString: any;
|
|
6
|
+
mode: any;
|
|
6
7
|
}) => {};
|
|
7
8
|
/** 年月日 时分秒 */
|
|
8
|
-
dateTime: ({ type, toISOString }: {
|
|
9
|
+
dateTime: ({ type, toISOString, mode }: {
|
|
9
10
|
type: any;
|
|
10
11
|
toISOString: any;
|
|
12
|
+
mode: any;
|
|
11
13
|
}) => {};
|
|
12
14
|
/** 年月日 00:00:00 */
|
|
13
|
-
dateStartTime: ({ type, toISOString }: {
|
|
15
|
+
dateStartTime: ({ type, toISOString, mode }: {
|
|
14
16
|
type: any;
|
|
15
17
|
toISOString: any;
|
|
18
|
+
mode: any;
|
|
16
19
|
}) => {};
|
|
17
20
|
/** 年月日 23:59:59 */
|
|
18
|
-
dateEndTime: ({ type, toISOString }: {
|
|
21
|
+
dateEndTime: ({ type, toISOString, mode }: {
|
|
19
22
|
type: any;
|
|
20
23
|
toISOString: any;
|
|
24
|
+
mode: any;
|
|
21
25
|
}) => {};
|
|
22
26
|
/** 年月日 00:00:00 ~ 年月日 23:59:59 */
|
|
23
|
-
dateStartEndTime: ({ type, toISOString }: {
|
|
27
|
+
dateStartEndTime: ({ type, toISOString, mode }: {
|
|
24
28
|
type: any;
|
|
25
29
|
toISOString: any;
|
|
30
|
+
mode: any;
|
|
26
31
|
}) => {};
|
|
27
32
|
/** 百分比 */
|
|
28
33
|
percentage: ({ type, valueType }: {
|
|
@@ -160,51 +160,61 @@ var _default = exports.default = {
|
|
|
160
160
|
/** 年月日 */
|
|
161
161
|
date: function date(_ref3) {
|
|
162
162
|
var type = _ref3.type,
|
|
163
|
-
toISOString = _ref3.toISOString
|
|
163
|
+
toISOString = _ref3.toISOString,
|
|
164
|
+
mode = _ref3.mode;
|
|
164
165
|
return dateTransform({
|
|
165
166
|
type: type,
|
|
166
167
|
_valueType: 'date',
|
|
167
|
-
toISOString: toISOString
|
|
168
|
+
toISOString: toISOString,
|
|
169
|
+
mode: mode
|
|
168
170
|
});
|
|
169
171
|
},
|
|
170
172
|
/** 年月日 时分秒 */
|
|
171
173
|
dateTime: function dateTime(_ref4) {
|
|
172
174
|
var type = _ref4.type,
|
|
173
|
-
toISOString = _ref4.toISOString
|
|
175
|
+
toISOString = _ref4.toISOString,
|
|
176
|
+
mode = _ref4.mode;
|
|
174
177
|
return dateTransform({
|
|
175
178
|
type: type,
|
|
176
179
|
_valueType: 'dateTime',
|
|
177
|
-
toISOString: toISOString
|
|
180
|
+
toISOString: toISOString,
|
|
181
|
+
mode: mode
|
|
178
182
|
});
|
|
179
183
|
},
|
|
180
184
|
/** 年月日 00:00:00 */
|
|
181
185
|
dateStartTime: function dateStartTime(_ref5) {
|
|
182
186
|
var type = _ref5.type,
|
|
183
|
-
toISOString = _ref5.toISOString
|
|
187
|
+
toISOString = _ref5.toISOString,
|
|
188
|
+
mode = _ref5.mode;
|
|
184
189
|
return dateTransform({
|
|
185
190
|
type: type,
|
|
186
191
|
_valueType: 'dateStartTime',
|
|
187
|
-
toISOString: toISOString
|
|
192
|
+
toISOString: toISOString,
|
|
193
|
+
mode: mode
|
|
188
194
|
});
|
|
189
195
|
},
|
|
190
196
|
/** 年月日 23:59:59 */
|
|
191
197
|
dateEndTime: function dateEndTime(_ref6) {
|
|
192
198
|
var type = _ref6.type,
|
|
193
|
-
toISOString = _ref6.toISOString
|
|
199
|
+
toISOString = _ref6.toISOString,
|
|
200
|
+
mode = _ref6.mode;
|
|
194
201
|
return dateTransform({
|
|
195
202
|
type: type,
|
|
196
203
|
_valueType: 'dateEndTime',
|
|
197
|
-
toISOString: toISOString
|
|
204
|
+
toISOString: toISOString,
|
|
205
|
+
mode: mode
|
|
198
206
|
});
|
|
199
207
|
},
|
|
200
208
|
/** 年月日 00:00:00 ~ 年月日 23:59:59 */
|
|
201
209
|
dateStartEndTime: function dateStartEndTime(_ref7) {
|
|
202
210
|
var type = _ref7.type,
|
|
203
|
-
toISOString = _ref7.toISOString
|
|
211
|
+
toISOString = _ref7.toISOString,
|
|
212
|
+
mode = _ref7.mode;
|
|
204
213
|
return dateTransform({
|
|
205
214
|
type: type,
|
|
206
215
|
_valueType: 'dateStartEndTime',
|
|
207
|
-
toISOString: toISOString
|
|
216
|
+
toISOString: toISOString,
|
|
217
|
+
mode: mode
|
|
208
218
|
});
|
|
209
219
|
},
|
|
210
220
|
/** 百分比 */
|