@zat-design/sisyphus-react 3.6.8-beta.5 → 3.6.9-beta.1
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 +41 -41
- package/dist/less.esm.css +41 -41
- package/es/ProEditTable/components/RenderField/ListChanged.d.ts +16 -0
- package/es/ProEditTable/components/RenderField/ListChanged.js +124 -0
- package/es/ProEditTable/components/RenderField/index.js +26 -46
- package/es/ProForm/components/combination/ProCascader/index.js +8 -14
- package/es/ProForm/components/render/Changed.d.ts +14 -0
- package/es/ProForm/components/render/Changed.js +60 -0
- package/es/ProForm/components/render/Render.js +25 -39
- package/es/ProForm/style/index.less +52 -52
- package/es/ProForm/utils/diffOriginal.d.ts +0 -1
- package/es/ProForm/utils/diffOriginal.js +4 -27
- package/es/ProForm/utils/useChanged.js +1 -2
- package/es/ProForm/utils/useListChanged.js +3 -3
- package/lib/ProEditTable/components/RenderField/ListChanged.d.ts +16 -0
- package/lib/ProEditTable/components/RenderField/ListChanged.js +129 -0
- package/lib/ProEditTable/components/RenderField/index.js +25 -41
- package/lib/ProForm/components/combination/ProCascader/index.js +6 -12
- package/lib/ProForm/components/render/Changed.d.ts +14 -0
- package/lib/ProForm/components/render/Changed.js +65 -0
- package/lib/ProForm/components/render/Render.js +25 -37
- package/lib/ProForm/style/index.less +52 -52
- package/lib/ProForm/utils/diffOriginal.d.ts +0 -1
- package/lib/ProForm/utils/diffOriginal.js +3 -27
- package/lib/ProForm/utils/useChanged.js +1 -2
- package/lib/ProForm/utils/useListChanged.js +2 -2
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
|
@@ -2883,47 +2883,6 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2883
2883
|
vertical-align: bottom;
|
|
2884
2884
|
fill: var(--zaui-aide-text, #909090);
|
|
2885
2885
|
}
|
|
2886
|
-
.pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper,
|
|
2887
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector,
|
|
2888
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-picker,
|
|
2889
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number {
|
|
2890
|
-
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
2891
|
-
}
|
|
2892
|
-
.pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper input,
|
|
2893
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector input,
|
|
2894
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-picker input,
|
|
2895
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number input {
|
|
2896
|
-
background: transparent;
|
|
2897
|
-
}
|
|
2898
|
-
.pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
|
|
2899
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector .ant-select-selection-placeholder,
|
|
2900
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-picker .ant-select-selection-placeholder,
|
|
2901
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
|
|
2902
|
-
z-index: 9;
|
|
2903
|
-
}
|
|
2904
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
|
|
2905
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
|
|
2906
|
-
background: var(--zaui-contract-bg, #fffaa1);
|
|
2907
|
-
border-radius: 4px;
|
|
2908
|
-
}
|
|
2909
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > span {
|
|
2910
|
-
border-radius: 4px;
|
|
2911
|
-
padding: 5px 8px;
|
|
2912
|
-
background: var(--zaui-contract-bg, #fffaa1);
|
|
2913
|
-
}
|
|
2914
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
|
|
2915
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
|
|
2916
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
|
|
2917
|
-
background: var(--zaui-contract-bg, #fffaa1);
|
|
2918
|
-
}
|
|
2919
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
|
|
2920
|
-
background: var(--zaui-contract-bg, #fffaa1);
|
|
2921
|
-
}
|
|
2922
|
-
.pro-form .ant-form-item.pro-form-item-changed .pro-form-view-container {
|
|
2923
|
-
padding: 4px 8px;
|
|
2924
|
-
background: var(--zaui-contract-bg, #fffaa1);
|
|
2925
|
-
border-radius: 4px;
|
|
2926
|
-
}
|
|
2927
2886
|
.pro-form .ant-form-item .ant-row {
|
|
2928
2887
|
width: 100%;
|
|
2929
2888
|
}
|
|
@@ -3076,6 +3035,47 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3076
3035
|
.pro-form .pro-form-list-mode-block .pro-collapse-content .ant-row {
|
|
3077
3036
|
width: auto;
|
|
3078
3037
|
}
|
|
3038
|
+
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper,
|
|
3039
|
+
.pro-form .pro-form-item-changed .ant-select-selector,
|
|
3040
|
+
.pro-form .pro-form-item-changed .ant-picker,
|
|
3041
|
+
.pro-form .pro-form-item-changed .ant-input-number {
|
|
3042
|
+
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3043
|
+
}
|
|
3044
|
+
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper input,
|
|
3045
|
+
.pro-form .pro-form-item-changed .ant-select-selector input,
|
|
3046
|
+
.pro-form .pro-form-item-changed .ant-picker input,
|
|
3047
|
+
.pro-form .pro-form-item-changed .ant-input-number input {
|
|
3048
|
+
background: transparent;
|
|
3049
|
+
}
|
|
3050
|
+
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
|
|
3051
|
+
.pro-form .pro-form-item-changed .ant-select-selector .ant-select-selection-placeholder,
|
|
3052
|
+
.pro-form .pro-form-item-changed .ant-picker .ant-select-selection-placeholder,
|
|
3053
|
+
.pro-form .pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
|
|
3054
|
+
z-index: 9;
|
|
3055
|
+
}
|
|
3056
|
+
.pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
|
|
3057
|
+
.pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
|
|
3058
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3059
|
+
border-radius: 4px;
|
|
3060
|
+
}
|
|
3061
|
+
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > span {
|
|
3062
|
+
border-radius: 4px;
|
|
3063
|
+
padding: 5px 8px;
|
|
3064
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3065
|
+
}
|
|
3066
|
+
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
|
|
3067
|
+
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
|
|
3068
|
+
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
|
|
3069
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3070
|
+
}
|
|
3071
|
+
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
|
|
3072
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3073
|
+
}
|
|
3074
|
+
.pro-form .pro-form-item-changed .pro-form-view-container {
|
|
3075
|
+
padding: 4px 8px;
|
|
3076
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3077
|
+
border-radius: 4px;
|
|
3078
|
+
}
|
|
3079
3079
|
.pro-upload .pro-upload-dragger .pro-upload-handle-box {
|
|
3080
3080
|
padding: var(--zaui-space-size-sm, 8px);
|
|
3081
3081
|
background: #f8f9fa;
|
package/dist/less.esm.css
CHANGED
|
@@ -2883,47 +2883,6 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2883
2883
|
vertical-align: bottom;
|
|
2884
2884
|
fill: var(--zaui-aide-text, #909090);
|
|
2885
2885
|
}
|
|
2886
|
-
.pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper,
|
|
2887
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector,
|
|
2888
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-picker,
|
|
2889
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number {
|
|
2890
|
-
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
2891
|
-
}
|
|
2892
|
-
.pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper input,
|
|
2893
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector input,
|
|
2894
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-picker input,
|
|
2895
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number input {
|
|
2896
|
-
background: transparent;
|
|
2897
|
-
}
|
|
2898
|
-
.pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
|
|
2899
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector .ant-select-selection-placeholder,
|
|
2900
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-picker .ant-select-selection-placeholder,
|
|
2901
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
|
|
2902
|
-
z-index: 9;
|
|
2903
|
-
}
|
|
2904
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
|
|
2905
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
|
|
2906
|
-
background: var(--zaui-contract-bg, #fffaa1);
|
|
2907
|
-
border-radius: 4px;
|
|
2908
|
-
}
|
|
2909
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > span {
|
|
2910
|
-
border-radius: 4px;
|
|
2911
|
-
padding: 5px 8px;
|
|
2912
|
-
background: var(--zaui-contract-bg, #fffaa1);
|
|
2913
|
-
}
|
|
2914
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
|
|
2915
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
|
|
2916
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
|
|
2917
|
-
background: var(--zaui-contract-bg, #fffaa1);
|
|
2918
|
-
}
|
|
2919
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
|
|
2920
|
-
background: var(--zaui-contract-bg, #fffaa1);
|
|
2921
|
-
}
|
|
2922
|
-
.pro-form .ant-form-item.pro-form-item-changed .pro-form-view-container {
|
|
2923
|
-
padding: 4px 8px;
|
|
2924
|
-
background: var(--zaui-contract-bg, #fffaa1);
|
|
2925
|
-
border-radius: 4px;
|
|
2926
|
-
}
|
|
2927
2886
|
.pro-form .ant-form-item .ant-row {
|
|
2928
2887
|
width: 100%;
|
|
2929
2888
|
}
|
|
@@ -3076,6 +3035,47 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3076
3035
|
.pro-form .pro-form-list-mode-block .pro-collapse-content .ant-row {
|
|
3077
3036
|
width: auto;
|
|
3078
3037
|
}
|
|
3038
|
+
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper,
|
|
3039
|
+
.pro-form .pro-form-item-changed .ant-select-selector,
|
|
3040
|
+
.pro-form .pro-form-item-changed .ant-picker,
|
|
3041
|
+
.pro-form .pro-form-item-changed .ant-input-number {
|
|
3042
|
+
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3043
|
+
}
|
|
3044
|
+
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper input,
|
|
3045
|
+
.pro-form .pro-form-item-changed .ant-select-selector input,
|
|
3046
|
+
.pro-form .pro-form-item-changed .ant-picker input,
|
|
3047
|
+
.pro-form .pro-form-item-changed .ant-input-number input {
|
|
3048
|
+
background: transparent;
|
|
3049
|
+
}
|
|
3050
|
+
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
|
|
3051
|
+
.pro-form .pro-form-item-changed .ant-select-selector .ant-select-selection-placeholder,
|
|
3052
|
+
.pro-form .pro-form-item-changed .ant-picker .ant-select-selection-placeholder,
|
|
3053
|
+
.pro-form .pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
|
|
3054
|
+
z-index: 9;
|
|
3055
|
+
}
|
|
3056
|
+
.pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
|
|
3057
|
+
.pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
|
|
3058
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3059
|
+
border-radius: 4px;
|
|
3060
|
+
}
|
|
3061
|
+
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > span {
|
|
3062
|
+
border-radius: 4px;
|
|
3063
|
+
padding: 5px 8px;
|
|
3064
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3065
|
+
}
|
|
3066
|
+
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
|
|
3067
|
+
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
|
|
3068
|
+
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
|
|
3069
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3070
|
+
}
|
|
3071
|
+
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
|
|
3072
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3073
|
+
}
|
|
3074
|
+
.pro-form .pro-form-item-changed .pro-form-view-container {
|
|
3075
|
+
padding: 4px 8px;
|
|
3076
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3077
|
+
border-radius: 4px;
|
|
3078
|
+
}
|
|
3079
3079
|
.pro-upload .pro-upload-dragger .pro-upload-handle-box {
|
|
3080
3080
|
padding: var(--zaui-space-size-sm, 8px);
|
|
3081
3081
|
background: #f8f9fa;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormInstance } from 'antd';
|
|
3
|
+
import { NamePath } from 'antd/lib/form/interface';
|
|
4
|
+
interface Props {
|
|
5
|
+
name?: NamePath;
|
|
6
|
+
names?: NamePath[];
|
|
7
|
+
originalName?: NamePath;
|
|
8
|
+
originalNames?: NamePath[];
|
|
9
|
+
namesStr?: NamePath;
|
|
10
|
+
originalValues?: any;
|
|
11
|
+
form: FormInstance;
|
|
12
|
+
equalWith?: (preValue: any, curValue: any) => boolean | undefined;
|
|
13
|
+
[name: string]: any;
|
|
14
|
+
}
|
|
15
|
+
declare const ListChanged: React.FC<Props>;
|
|
16
|
+
export default ListChanged;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import "antd/es/space/style";
|
|
2
|
+
import _Space from "antd/es/space";
|
|
3
|
+
import "antd/es/tooltip/style";
|
|
4
|
+
import _Tooltip from "antd/es/tooltip";
|
|
5
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
+
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type"];
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import React, { useMemo } from 'react';
|
|
10
|
+
import { get } from 'lodash';
|
|
11
|
+
import { diffOriginal } from '@/ProForm/utils/diffOriginal';
|
|
12
|
+
var toNamePath = function toNamePath(name) {
|
|
13
|
+
if (Array.isArray(name)) {
|
|
14
|
+
return name;
|
|
15
|
+
}
|
|
16
|
+
return [name];
|
|
17
|
+
};
|
|
18
|
+
var toNamePaths = function toNamePaths(names) {
|
|
19
|
+
return names.map(function (name) {
|
|
20
|
+
return toNamePath(name);
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var getOriginalValue = function getOriginalValue(_ref) {
|
|
24
|
+
var namePath = _ref.namePath,
|
|
25
|
+
originalName = _ref.originalName,
|
|
26
|
+
originalNames = _ref.originalNames,
|
|
27
|
+
originalValues = _ref.originalValues,
|
|
28
|
+
rowKeyPath = _ref.rowKeyPath,
|
|
29
|
+
form = _ref.form;
|
|
30
|
+
if (!originalValues) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
if (rowKeyPath) {
|
|
34
|
+
var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
|
|
35
|
+
var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
|
|
36
|
+
var rowValue = form.getFieldValue(rowValueNamePath);
|
|
37
|
+
if (!rowValue) return undefined;
|
|
38
|
+
var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
|
|
39
|
+
if (!keyValue) return undefined;
|
|
40
|
+
var originalValueList = get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|
|
41
|
+
var originalValueRow = originalValueList.find(function (item) {
|
|
42
|
+
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
|
43
|
+
});
|
|
44
|
+
var originalValue;
|
|
45
|
+
if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
|
|
46
|
+
var originalNamesValue = originalNames.map(function (originalName) {
|
|
47
|
+
return get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
48
|
+
});
|
|
49
|
+
// 有可能出现数组中全是undefined的情况 视为没有值
|
|
50
|
+
var fillUndefined = originalNamesValue.every(function (valItem) {
|
|
51
|
+
return valItem === undefined;
|
|
52
|
+
});
|
|
53
|
+
originalValue = fillUndefined ? undefined : originalNamesValue;
|
|
54
|
+
} else {
|
|
55
|
+
originalValue = get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
56
|
+
}
|
|
57
|
+
return originalValue;
|
|
58
|
+
}
|
|
59
|
+
// 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
|
|
60
|
+
return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
|
61
|
+
return get(originalValues, originalName);
|
|
62
|
+
}) : get(originalValues, originalName);
|
|
63
|
+
};
|
|
64
|
+
var ListChanged = function ListChanged(props) {
|
|
65
|
+
var name = props.name,
|
|
66
|
+
names = props.names,
|
|
67
|
+
namesStr = props.namesStr,
|
|
68
|
+
_props$originalName = props.originalName,
|
|
69
|
+
originalName = _props$originalName === void 0 ? name : _props$originalName,
|
|
70
|
+
_props$originalNames = props.originalNames,
|
|
71
|
+
originalNames = _props$originalNames === void 0 ? names : _props$originalNames,
|
|
72
|
+
originalValues = props.originalValues,
|
|
73
|
+
form = props.form,
|
|
74
|
+
equalWith = props.equalWith,
|
|
75
|
+
rowKeyPath = props.rowKeyPath,
|
|
76
|
+
children = props.children,
|
|
77
|
+
type = props.type,
|
|
78
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
79
|
+
var namePath = toNamePath(namesStr || name);
|
|
80
|
+
var originalNamePath = toNamePath(originalName);
|
|
81
|
+
var originalNamePaths = originalNames && toNamePaths(originalNames);
|
|
82
|
+
var notWatch = !originalValues || ['FormList', 'ProEditTable'].includes(type);
|
|
83
|
+
var originalValue = !notWatch ? getOriginalValue({
|
|
84
|
+
namePath: namePath,
|
|
85
|
+
originalName: originalNamePath,
|
|
86
|
+
originalNames: originalNamePaths,
|
|
87
|
+
originalValues: originalValues,
|
|
88
|
+
rowKeyPath: rowKeyPath,
|
|
89
|
+
form: form
|
|
90
|
+
}) : undefined;
|
|
91
|
+
var noChange = !equalWith && (!originalValues || originalValue === undefined);
|
|
92
|
+
var changed = useMemo(function () {
|
|
93
|
+
if (notWatch || noChange) return false;
|
|
94
|
+
return diffOriginal({
|
|
95
|
+
value: props.value,
|
|
96
|
+
originalValue: originalValue,
|
|
97
|
+
form: form,
|
|
98
|
+
equalWith: equalWith
|
|
99
|
+
// name: isString(namesStr) ? namesStr : originalName || name,
|
|
100
|
+
});
|
|
101
|
+
}, [props.value, originalValue]);
|
|
102
|
+
if (notWatch || noChange) {
|
|
103
|
+
return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
|
|
104
|
+
}
|
|
105
|
+
return _jsx(_Tooltip, {
|
|
106
|
+
open: changed ? undefined : false,
|
|
107
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
108
|
+
return target.parentElement;
|
|
109
|
+
},
|
|
110
|
+
title: _jsxs(_Space, {
|
|
111
|
+
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children), {}, {
|
|
112
|
+
// @ts-ignore
|
|
113
|
+
isView: true,
|
|
114
|
+
value: originalValue,
|
|
115
|
+
checked: type === 'Switch' ? originalValue : undefined
|
|
116
|
+
})) : undefined]
|
|
117
|
+
}),
|
|
118
|
+
children: _jsx("div", {
|
|
119
|
+
className: changed ? 'pro-form-item-changed' : '',
|
|
120
|
+
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
|
|
121
|
+
})
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
export default ListChanged;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import "antd/es/tooltip/style";
|
|
2
|
-
import _Tooltip from "antd/es/tooltip";
|
|
3
|
-
import "antd/es/space/style";
|
|
4
|
-
import _Space from "antd/es/space";
|
|
5
1
|
import "antd/es/form/style";
|
|
6
2
|
import _Form from "antd/es/form";
|
|
7
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
9
4
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
10
5
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
11
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
12
7
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
13
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
14
9
|
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim", "confirm", "validateTrigger"];
|
|
15
|
-
import { Fragment as _Fragment, jsx as _jsx
|
|
10
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
16
11
|
/* eslint-disable prefer-destructuring */
|
|
17
12
|
/* eslint-disable prefer-const */
|
|
18
13
|
import React, { useCallback, useEffect } from 'react';
|
|
@@ -26,10 +21,10 @@ import { useProConfig } from '../../../ProConfigProvider';
|
|
|
26
21
|
import Container from '../../../ProForm/components/Container';
|
|
27
22
|
import transformNames from '../../../ProForm/utils/transformNames';
|
|
28
23
|
import { FieldProvider } from '../../../ProForm/utils/useFieldProps';
|
|
29
|
-
import { useListChanged } from '../../../ProForm/utils/useListChanged';
|
|
30
24
|
import useRules from '../../../ProForm/utils/useRules';
|
|
31
25
|
import { isSelect, isTrim } from '../../../ProForm/utils';
|
|
32
26
|
import ConfirmWrapper from '../../../ProForm/components/render/ConfirmWrapper';
|
|
27
|
+
import ListChanged from './ListChanged';
|
|
33
28
|
var RenderField = function RenderField(_ref) {
|
|
34
29
|
var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps, _componentProps2;
|
|
35
30
|
var value = _ref.text,
|
|
@@ -491,21 +486,6 @@ var RenderField = function RenderField(_ref) {
|
|
|
491
486
|
return _ref3.apply(this, arguments);
|
|
492
487
|
};
|
|
493
488
|
}();
|
|
494
|
-
// 判断当前字段是否变更
|
|
495
|
-
var _useListChanged = useListChanged({
|
|
496
|
-
name: cellName,
|
|
497
|
-
names: names,
|
|
498
|
-
namesStr: [].concat(_toConsumableArray(baseName), [index, dataIndex]),
|
|
499
|
-
rowKeyPath: [].concat(_toConsumableArray(baseName), [index, 'rowKey']),
|
|
500
|
-
originalName: originalName,
|
|
501
|
-
originalNames: originalNames,
|
|
502
|
-
originalValues: originalValues,
|
|
503
|
-
form: form,
|
|
504
|
-
equalWith: equalWith
|
|
505
|
-
}),
|
|
506
|
-
_useListChanged2 = _slicedToArray(_useListChanged, 2),
|
|
507
|
-
changed = _useListChanged2[0],
|
|
508
|
-
originalValue = _useListChanged2[1];
|
|
509
489
|
var componentProps = _objectSpread(_objectSpread(_objectSpread({
|
|
510
490
|
form: form,
|
|
511
491
|
name: cellName
|
|
@@ -551,16 +531,35 @@ var RenderField = function RenderField(_ref) {
|
|
|
551
531
|
if (isView) {
|
|
552
532
|
delete _formItemProps.rules;
|
|
553
533
|
}
|
|
554
|
-
var _className = classNames(_defineProperty(
|
|
534
|
+
var _className = classNames(_defineProperty({}, className, className));
|
|
555
535
|
var FormItem = null;
|
|
536
|
+
var FieldComponent = /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps));
|
|
537
|
+
if (originalValues) {
|
|
538
|
+
FieldComponent = _jsx(ListChanged, {
|
|
539
|
+
name: cellName,
|
|
540
|
+
names: names,
|
|
541
|
+
namesStr: [].concat(_toConsumableArray(baseName), [index, dataIndex]),
|
|
542
|
+
rowKeyPath: [].concat(_toConsumableArray(baseName), [index, 'rowKey']),
|
|
543
|
+
originalName: originalName,
|
|
544
|
+
originalNames: originalNames,
|
|
545
|
+
originalValues: originalValues,
|
|
546
|
+
form: form,
|
|
547
|
+
equalWith: equalWith,
|
|
548
|
+
type: type,
|
|
549
|
+
children: FieldComponent
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
if ((_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.confirm) {
|
|
553
|
+
FieldComponent = _jsx(ConfirmWrapper, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
554
|
+
children: FieldComponent
|
|
555
|
+
}));
|
|
556
|
+
}
|
|
556
557
|
FormItem = TargetComponent ? _jsx(_Form.Item, _objectSpread(_objectSpread({
|
|
557
558
|
validateFirst: true
|
|
558
559
|
}, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name', 'onCell'])), {}, {
|
|
559
560
|
className: _className,
|
|
560
561
|
name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
|
|
561
|
-
children:
|
|
562
|
-
children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
|
|
563
|
-
})) : /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
|
|
562
|
+
children: FieldComponent
|
|
564
563
|
})) : _jsx(Container, {
|
|
565
564
|
viewEmpty: viewEmpty
|
|
566
565
|
});
|
|
@@ -578,28 +577,9 @@ var RenderField = function RenderField(_ref) {
|
|
|
578
577
|
}
|
|
579
578
|
}));
|
|
580
579
|
}
|
|
581
|
-
var originalTitle = originalDiffTip && originalValues ? _jsxs(_Space, {
|
|
582
|
-
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
583
|
-
isView: true,
|
|
584
|
-
value: originalValue,
|
|
585
|
-
checked: type === 'Switch' ? originalValue : undefined
|
|
586
|
-
}))) : _jsx(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
587
|
-
isView: true,
|
|
588
|
-
value: originalValue,
|
|
589
|
-
checked: type === 'Switch' ? originalValue : undefined
|
|
590
|
-
}))]
|
|
591
|
-
}) : null;
|
|
592
580
|
return _jsx(FieldProvider, {
|
|
593
581
|
value: (_componentProps2 = componentProps) === null || _componentProps2 === void 0 ? void 0 : _componentProps2.otherProps,
|
|
594
|
-
children:
|
|
595
|
-
title: originalTitle,
|
|
596
|
-
placement: "topLeft",
|
|
597
|
-
open: changed ? undefined : false,
|
|
598
|
-
getPopupContainer: function getPopupContainer(target) {
|
|
599
|
-
return target.parentElement;
|
|
600
|
-
},
|
|
601
|
-
children: FormItem
|
|
602
|
-
})
|
|
582
|
+
children: FormItem
|
|
603
583
|
});
|
|
604
584
|
};
|
|
605
585
|
export default RenderField;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "antd/es/input/style";
|
|
2
2
|
import _Input from "antd/es/input";
|
|
3
|
-
import "antd/es/cascader/style";
|
|
4
|
-
import _Cascader from "antd/es/cascader";
|
|
5
3
|
import "antd/es/tooltip/style";
|
|
6
4
|
import _Tooltip from "antd/es/tooltip";
|
|
5
|
+
import "antd/es/cascader/style";
|
|
6
|
+
import _Cascader from "antd/es/cascader";
|
|
7
7
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
8
8
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
9
9
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
@@ -22,6 +22,7 @@ import { useProConfig } from '../../../../ProConfigProvider';
|
|
|
22
22
|
import useEnum from '../../../../ProEnum/hooks/useEnum';
|
|
23
23
|
import locale from '../../../../locale';
|
|
24
24
|
import ProForm from '../../..';
|
|
25
|
+
import Container from '../../Container';
|
|
25
26
|
var Text = _Typography.Text;
|
|
26
27
|
var defaultFieldNames = {
|
|
27
28
|
label: 'name',
|
|
@@ -82,7 +83,8 @@ var ProCascader = function ProCascader(props) {
|
|
|
82
83
|
detailPlaceholder = props.detailPlaceholder,
|
|
83
84
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
84
85
|
var _ref3 = ProForm.useFieldProps() || {},
|
|
85
|
-
isViewCon = _ref3.isView
|
|
86
|
+
isViewCon = _ref3.isView,
|
|
87
|
+
viewEmpty = _ref3.viewEmpty;
|
|
86
88
|
var addressCode = code || enumCode;
|
|
87
89
|
var realIsView = typeof isView === 'boolean' ? isView : isViewCon;
|
|
88
90
|
var realLevel = Math.max(2, level);
|
|
@@ -238,17 +240,9 @@ var ProCascader = function ProCascader(props) {
|
|
|
238
240
|
}
|
|
239
241
|
}
|
|
240
242
|
};
|
|
241
|
-
return realIsView ?
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
children: _jsx(Text, {
|
|
245
|
-
ellipsis: {
|
|
246
|
-
tooltip: false
|
|
247
|
-
},
|
|
248
|
-
children: viewValue
|
|
249
|
-
})
|
|
250
|
-
}) : _jsx("span", {
|
|
251
|
-
className: className,
|
|
243
|
+
return realIsView ? _jsx(Container, {
|
|
244
|
+
tooltip: !!tooltip,
|
|
245
|
+
viewEmpty: viewEmpty,
|
|
252
246
|
children: viewValue
|
|
253
247
|
}) : _jsxs("div", {
|
|
254
248
|
className: "pro-address ".concat(className),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FormInstance } from 'antd';
|
|
2
|
+
import { NamePath } from 'antd/lib/form/interface';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
interface Props {
|
|
5
|
+
name?: NamePath;
|
|
6
|
+
names?: NamePath[];
|
|
7
|
+
namesStr?: string;
|
|
8
|
+
originalValues?: any;
|
|
9
|
+
form: FormInstance;
|
|
10
|
+
equalWith?: (preValue: any, curValue: any) => boolean | undefined;
|
|
11
|
+
[name: string]: any;
|
|
12
|
+
}
|
|
13
|
+
declare const Changed: React.FC<Props>;
|
|
14
|
+
export default Changed;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import "antd/es/space/style";
|
|
2
|
+
import _Space from "antd/es/space";
|
|
3
|
+
import "antd/es/tooltip/style";
|
|
4
|
+
import _Tooltip from "antd/es/tooltip";
|
|
5
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
+
var _excluded = ["name", "names", "namesStr", "originalValues", "form", "equalWith", "children", "type", "originalDiffTip"];
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { get } from 'lodash';
|
|
10
|
+
import React, { useMemo } from 'react';
|
|
11
|
+
import { diffOriginal } from '@/ProForm/utils/diffOriginal';
|
|
12
|
+
var Changed = function Changed(props) {
|
|
13
|
+
var name = props.name,
|
|
14
|
+
names = props.names,
|
|
15
|
+
namesStr = props.namesStr,
|
|
16
|
+
originalValues = props.originalValues,
|
|
17
|
+
form = props.form,
|
|
18
|
+
equalWith = props.equalWith,
|
|
19
|
+
children = props.children,
|
|
20
|
+
type = props.type,
|
|
21
|
+
originalDiffTip = props.originalDiffTip,
|
|
22
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
23
|
+
// 不渲染tooltip
|
|
24
|
+
var notWatch = !originalDiffTip || ['FormList', 'ProEditTable'].includes(type);
|
|
25
|
+
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
|
26
|
+
return get(originalValues, name);
|
|
27
|
+
}) : get(originalValues, name);
|
|
28
|
+
var noChange = !equalWith && (!originalValues || originalValue === undefined);
|
|
29
|
+
var changed = useMemo(function () {
|
|
30
|
+
if (notWatch || noChange) return false;
|
|
31
|
+
return diffOriginal({
|
|
32
|
+
originalValue: originalValue,
|
|
33
|
+
value: props.value,
|
|
34
|
+
form: form,
|
|
35
|
+
equalWith: equalWith
|
|
36
|
+
// name: namesStr || name,
|
|
37
|
+
});
|
|
38
|
+
}, [notWatch, noChange, props.value, originalValue]);
|
|
39
|
+
if (notWatch || noChange) {
|
|
40
|
+
return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
|
|
41
|
+
}
|
|
42
|
+
return _jsx(_Tooltip, {
|
|
43
|
+
open: changed ? undefined : false,
|
|
44
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
45
|
+
return target.parentElement;
|
|
46
|
+
},
|
|
47
|
+
title: _jsxs(_Space, {
|
|
48
|
+
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, {
|
|
49
|
+
isView: true,
|
|
50
|
+
value: originalValue,
|
|
51
|
+
checked: type === 'Switch' ? originalValue : undefined
|
|
52
|
+
})) : undefined]
|
|
53
|
+
}),
|
|
54
|
+
children: _jsx("div", {
|
|
55
|
+
className: changed ? 'pro-form-item-changed' : '',
|
|
56
|
+
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
export default Changed;
|