@zat-design/sisyphus-react 3.3.2-beta.3 → 3.3.2-beta.4
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 +8 -4
- package/es/ProForm/style/index.less +6 -3
- package/es/ProForm/utils/useChanged.js +1 -1
- package/es/ProForm/utils/useListChanged.js +22 -10
- package/lib/ProForm/style/index.less +6 -3
- package/lib/ProForm/utils/useChanged.js +1 -1
- package/lib/ProForm/utils/useListChanged.js +22 -10
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
|
@@ -2568,20 +2568,24 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2568
2568
|
}
|
|
2569
2569
|
.pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper,
|
|
2570
2570
|
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector,
|
|
2571
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-picker
|
|
2571
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-picker,
|
|
2572
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number {
|
|
2572
2573
|
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
2573
2574
|
}
|
|
2574
2575
|
.pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper input,
|
|
2575
2576
|
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector input,
|
|
2576
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-picker input
|
|
2577
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-picker input,
|
|
2578
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number input {
|
|
2577
2579
|
background: var(--zaui-contract-bg, #fffaa1);
|
|
2578
2580
|
}
|
|
2579
2581
|
.pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
|
|
2580
2582
|
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector .ant-select-selection-placeholder,
|
|
2581
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-picker .ant-select-selection-placeholder
|
|
2583
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-picker .ant-select-selection-placeholder,
|
|
2584
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
|
|
2582
2585
|
z-index: 9;
|
|
2583
2586
|
}
|
|
2584
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content >
|
|
2587
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > span,
|
|
2588
|
+
.pro-form .ant-form-item.pro-form-item-changed .pro-form-view-container {
|
|
2585
2589
|
padding: 4px 8px;
|
|
2586
2590
|
background: var(--zaui-contract-bg, #fffaa1);
|
|
2587
2591
|
border-radius: 4px;
|
|
@@ -126,11 +126,12 @@
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
// 比较原始值场景下
|
|
129
|
+
// 比较原始值场景下 不同时的样式
|
|
130
130
|
&.pro-form-item-changed {
|
|
131
131
|
span.@{ant-prefix}-input-affix-wrapper,
|
|
132
132
|
.@{ant-prefix}-select-selector,
|
|
133
|
-
.@{ant-prefix}-picker
|
|
133
|
+
.@{ant-prefix}-picker,
|
|
134
|
+
.@{ant-prefix}-input-number {
|
|
134
135
|
background: @zaui-contract-bg !important;
|
|
135
136
|
|
|
136
137
|
input {
|
|
@@ -141,7 +142,9 @@
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
|
|
145
|
+
// 查看模式 修改容器样式
|
|
146
|
+
.@{ant-prefix}-form-item-control-input-content > span, // 地址组件
|
|
147
|
+
.pro-form-view-container {
|
|
145
148
|
padding: 4px 8px;
|
|
146
149
|
background: @zaui-contract-bg;
|
|
147
150
|
border-radius: 4px;
|
|
@@ -12,7 +12,7 @@ export var useChanged = function useChanged(_ref) {
|
|
|
12
12
|
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
|
13
13
|
return get(originalValues, name);
|
|
14
14
|
}) : get(originalValues, name);
|
|
15
|
-
var notWatch = !originalValues || originalValue === undefined;
|
|
15
|
+
var notWatch = !equalWith && (!originalValues || originalValue === undefined);
|
|
16
16
|
if (notWatch) form = [];
|
|
17
17
|
var value = _Form.useWatch(namesStr || name, form);
|
|
18
18
|
if (notWatch) return [false];
|
|
@@ -33,11 +33,22 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
|
33
33
|
var originalValueRow = originalValueList.find(function (item) {
|
|
34
34
|
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
|
35
35
|
});
|
|
36
|
-
var originalValue
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
var originalValue;
|
|
37
|
+
if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
|
|
38
|
+
var originalNamesValue = originalNames.map(function (originalName) {
|
|
39
|
+
return get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
40
|
+
});
|
|
41
|
+
// 有可能出现数组中全是undefined的情况 视为没有值
|
|
42
|
+
var fillUndefined = originalNamesValue.every(function (valItem) {
|
|
43
|
+
return valItem === undefined;
|
|
44
|
+
});
|
|
45
|
+
originalValue = fillUndefined ? undefined : originalNamesValue;
|
|
46
|
+
} else {
|
|
47
|
+
originalValue = get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
48
|
+
}
|
|
39
49
|
return originalValue;
|
|
40
50
|
}
|
|
51
|
+
// 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
|
|
41
52
|
return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
|
42
53
|
return get(originalValues, originalName);
|
|
43
54
|
}) : get(originalValues, originalName);
|
|
@@ -54,23 +65,24 @@ export var useListChanged = function useListChanged(params) {
|
|
|
54
65
|
form = params.form,
|
|
55
66
|
equalWith = params.equalWith,
|
|
56
67
|
rowKeyPath = params.rowKeyPath;
|
|
57
|
-
// let _form = form;
|
|
58
68
|
var namePath = toNamePath(namesStr || name);
|
|
59
69
|
var originalNamePath = toNamePath(originalName);
|
|
60
70
|
var originalNamePaths = originalNames && toNamePaths(originalNames);
|
|
61
|
-
var
|
|
71
|
+
var notWatch = !originalValues;
|
|
72
|
+
var originalValue = !notWatch ? getOriginalValue({
|
|
62
73
|
namePath: namePath,
|
|
63
74
|
originalName: originalNamePath,
|
|
64
75
|
originalNames: originalNamePaths,
|
|
65
76
|
originalValues: originalValues,
|
|
66
77
|
rowKeyPath: rowKeyPath,
|
|
67
78
|
form: form
|
|
68
|
-
});
|
|
69
|
-
var
|
|
79
|
+
}) : undefined;
|
|
80
|
+
var noChange = !equalWith && (!originalValues || originalValue === undefined);
|
|
81
|
+
var _form = form;
|
|
70
82
|
// @ts-ignore
|
|
71
|
-
|
|
72
|
-
var value = _Form.useWatch(namePath,
|
|
73
|
-
if (notWatch) return [false];
|
|
83
|
+
if (notWatch) _form = [];
|
|
84
|
+
var value = _Form.useWatch(namePath, _form);
|
|
85
|
+
if (notWatch || noChange) return [false];
|
|
74
86
|
var changed = contrastOriginal({
|
|
75
87
|
value: value,
|
|
76
88
|
originalValue: originalValue,
|
|
@@ -126,11 +126,12 @@
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
// 比较原始值场景下
|
|
129
|
+
// 比较原始值场景下 不同时的样式
|
|
130
130
|
&.pro-form-item-changed {
|
|
131
131
|
span.@{ant-prefix}-input-affix-wrapper,
|
|
132
132
|
.@{ant-prefix}-select-selector,
|
|
133
|
-
.@{ant-prefix}-picker
|
|
133
|
+
.@{ant-prefix}-picker,
|
|
134
|
+
.@{ant-prefix}-input-number {
|
|
134
135
|
background: @zaui-contract-bg !important;
|
|
135
136
|
|
|
136
137
|
input {
|
|
@@ -141,7 +142,9 @@
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
|
|
145
|
+
// 查看模式 修改容器样式
|
|
146
|
+
.@{ant-prefix}-form-item-control-input-content > span, // 地址组件
|
|
147
|
+
.pro-form-view-container {
|
|
145
148
|
padding: 4px 8px;
|
|
146
149
|
background: @zaui-contract-bg;
|
|
147
150
|
border-radius: 4px;
|
|
@@ -17,7 +17,7 @@ var useChanged = exports.useChanged = function useChanged(_ref) {
|
|
|
17
17
|
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
|
18
18
|
return (0, _lodash.get)(originalValues, name);
|
|
19
19
|
}) : (0, _lodash.get)(originalValues, name);
|
|
20
|
-
var notWatch = !originalValues || originalValue === undefined;
|
|
20
|
+
var notWatch = !equalWith && (!originalValues || originalValue === undefined);
|
|
21
21
|
if (notWatch) form = [];
|
|
22
22
|
var value = _antd.Form.useWatch(namesStr || name, form);
|
|
23
23
|
if (notWatch) return [false];
|
|
@@ -38,11 +38,22 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
|
38
38
|
var originalValueRow = originalValueList.find(function (item) {
|
|
39
39
|
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
|
40
40
|
});
|
|
41
|
-
var originalValue
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
var originalValue;
|
|
42
|
+
if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
|
|
43
|
+
var originalNamesValue = originalNames.map(function (originalName) {
|
|
44
|
+
return (0, _lodash.get)(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
45
|
+
});
|
|
46
|
+
// 有可能出现数组中全是undefined的情况 视为没有值
|
|
47
|
+
var fillUndefined = originalNamesValue.every(function (valItem) {
|
|
48
|
+
return valItem === undefined;
|
|
49
|
+
});
|
|
50
|
+
originalValue = fillUndefined ? undefined : originalNamesValue;
|
|
51
|
+
} else {
|
|
52
|
+
originalValue = (0, _lodash.get)(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
53
|
+
}
|
|
44
54
|
return originalValue;
|
|
45
55
|
}
|
|
56
|
+
// 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
|
|
46
57
|
return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
|
47
58
|
return (0, _lodash.get)(originalValues, originalName);
|
|
48
59
|
}) : (0, _lodash.get)(originalValues, originalName);
|
|
@@ -59,23 +70,24 @@ var useListChanged = exports.useListChanged = function useListChanged(params) {
|
|
|
59
70
|
form = params.form,
|
|
60
71
|
equalWith = params.equalWith,
|
|
61
72
|
rowKeyPath = params.rowKeyPath;
|
|
62
|
-
// let _form = form;
|
|
63
73
|
var namePath = toNamePath(namesStr || name);
|
|
64
74
|
var originalNamePath = toNamePath(originalName);
|
|
65
75
|
var originalNamePaths = originalNames && toNamePaths(originalNames);
|
|
66
|
-
var
|
|
76
|
+
var notWatch = !originalValues;
|
|
77
|
+
var originalValue = !notWatch ? getOriginalValue({
|
|
67
78
|
namePath: namePath,
|
|
68
79
|
originalName: originalNamePath,
|
|
69
80
|
originalNames: originalNamePaths,
|
|
70
81
|
originalValues: originalValues,
|
|
71
82
|
rowKeyPath: rowKeyPath,
|
|
72
83
|
form: form
|
|
73
|
-
});
|
|
74
|
-
var
|
|
84
|
+
}) : undefined;
|
|
85
|
+
var noChange = !equalWith && (!originalValues || originalValue === undefined);
|
|
86
|
+
var _form = form;
|
|
75
87
|
// @ts-ignore
|
|
76
|
-
|
|
77
|
-
var value = _antd.Form.useWatch(namePath,
|
|
78
|
-
if (notWatch) return [false];
|
|
88
|
+
if (notWatch) _form = [];
|
|
89
|
+
var value = _antd.Form.useWatch(namePath, _form);
|
|
90
|
+
if (notWatch || noChange) return [false];
|
|
79
91
|
var changed = (0, _contrastOriginal.contrastOriginal)({
|
|
80
92
|
value: value,
|
|
81
93
|
originalValue: originalValue,
|