@zat-design/sisyphus-react 3.7.3-beta.4 → 3.7.3-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +60 -6
- package/dist/less.esm.css +60 -6
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +2 -1
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +12 -5
- package/es/ProForm/components/render/ChangedWrapper.d.ts +2 -1
- package/es/ProForm/components/render/ChangedWrapper.js +15 -12
- package/es/ProForm/components/render/propsType.d.ts +2 -1
- package/es/ProForm/style/index.less +69 -6
- package/es/ProForm/utils/diffOriginal.d.ts +4 -4
- package/es/ProForm/utils/diffOriginal.js +18 -7
- package/es/style/theme/index.less +1 -0
- package/es/style/theme/tokens.less +1 -0
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +2 -1
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +12 -5
- package/lib/ProForm/components/render/ChangedWrapper.d.ts +2 -1
- package/lib/ProForm/components/render/ChangedWrapper.js +15 -12
- package/lib/ProForm/components/render/propsType.d.ts +2 -1
- package/lib/ProForm/style/index.less +69 -6
- package/lib/ProForm/utils/diffOriginal.d.ts +4 -4
- package/lib/ProForm/utils/diffOriginal.js +18 -7
- package/lib/style/theme/index.less +1 -0
- package/lib/style/theme/tokens.less +1 -0
- package/package.json +1 -1
- package/.vscode/extensions.json +0 -5
package/dist/index.esm.css
CHANGED
|
@@ -3059,11 +3059,17 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3059
3059
|
.pro-form .pro-form-list-mode-block .pro-collapse-content .ant-row {
|
|
3060
3060
|
width: auto;
|
|
3061
3061
|
}
|
|
3062
|
+
.pro-form .pro-form-item-changed {
|
|
3063
|
+
border-radius: 4px;
|
|
3064
|
+
height: 100%;
|
|
3065
|
+
width: 100%;
|
|
3066
|
+
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3067
|
+
}
|
|
3062
3068
|
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper,
|
|
3063
3069
|
.pro-form .pro-form-item-changed .ant-select .ant-select-selector,
|
|
3064
3070
|
.pro-form .pro-form-item-changed .ant-picker,
|
|
3065
3071
|
.pro-form .pro-form-item-changed .ant-input-number {
|
|
3066
|
-
background: var(--
|
|
3072
|
+
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3067
3073
|
}
|
|
3068
3074
|
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper input,
|
|
3069
3075
|
.pro-form .pro-form-item-changed .ant-select .ant-select-selector input,
|
|
@@ -3079,25 +3085,72 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3079
3085
|
}
|
|
3080
3086
|
.pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
|
|
3081
3087
|
.pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
|
|
3082
|
-
background: var(--
|
|
3088
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3083
3089
|
border-radius: 4px;
|
|
3084
3090
|
}
|
|
3085
3091
|
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > span {
|
|
3086
3092
|
border-radius: 4px;
|
|
3087
3093
|
padding: 5px 8px;
|
|
3088
|
-
background: var(--
|
|
3094
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3089
3095
|
}
|
|
3090
3096
|
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
|
|
3091
3097
|
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
|
|
3092
3098
|
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
|
|
3093
|
-
background: var(--
|
|
3099
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3094
3100
|
}
|
|
3095
3101
|
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
|
|
3096
|
-
background: var(--
|
|
3102
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3097
3103
|
}
|
|
3098
3104
|
.pro-form .pro-form-item-changed .pro-form-view-container {
|
|
3099
3105
|
padding: 4px 8px;
|
|
3100
|
-
background: var(--
|
|
3106
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3107
|
+
border-radius: 4px;
|
|
3108
|
+
}
|
|
3109
|
+
.pro-form .pro-form-item-add {
|
|
3110
|
+
border-radius: 4px;
|
|
3111
|
+
height: 100%;
|
|
3112
|
+
width: 100%;
|
|
3113
|
+
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
3114
|
+
}
|
|
3115
|
+
.pro-form .pro-form-item-add span.ant-input-affix-wrapper,
|
|
3116
|
+
.pro-form .pro-form-item-add .ant-select .ant-select-selector,
|
|
3117
|
+
.pro-form .pro-form-item-add .ant-picker,
|
|
3118
|
+
.pro-form .pro-form-item-add .ant-input-number {
|
|
3119
|
+
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
3120
|
+
}
|
|
3121
|
+
.pro-form .pro-form-item-add span.ant-input-affix-wrapper input,
|
|
3122
|
+
.pro-form .pro-form-item-add .ant-select .ant-select-selector input,
|
|
3123
|
+
.pro-form .pro-form-item-add .ant-picker input,
|
|
3124
|
+
.pro-form .pro-form-item-add .ant-input-number input {
|
|
3125
|
+
background: transparent !important;
|
|
3126
|
+
}
|
|
3127
|
+
.pro-form .pro-form-item-add span.ant-input-affix-wrapper .ant-select-selection-placeholder,
|
|
3128
|
+
.pro-form .pro-form-item-add .ant-select .ant-select-selector .ant-select-selection-placeholder,
|
|
3129
|
+
.pro-form .pro-form-item-add .ant-picker .ant-select-selection-placeholder,
|
|
3130
|
+
.pro-form .pro-form-item-add .ant-input-number .ant-select-selection-placeholder {
|
|
3131
|
+
z-index: 9;
|
|
3132
|
+
}
|
|
3133
|
+
.pro-form .pro-form-item-add .ant-form-item-control:has(.ant-switch-handle),
|
|
3134
|
+
.pro-form .pro-form-item-add .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
|
|
3135
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3136
|
+
border-radius: 4px;
|
|
3137
|
+
}
|
|
3138
|
+
.pro-form .pro-form-item-add .ant-form-item-control-input-content > span {
|
|
3139
|
+
border-radius: 4px;
|
|
3140
|
+
padding: 5px 8px;
|
|
3141
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3142
|
+
}
|
|
3143
|
+
.pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-select-selector,
|
|
3144
|
+
.pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
|
|
3145
|
+
.pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
|
|
3146
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3147
|
+
}
|
|
3148
|
+
.pro-form .pro-form-item-add .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
|
|
3149
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3150
|
+
}
|
|
3151
|
+
.pro-form .pro-form-item-add .pro-form-view-container {
|
|
3152
|
+
padding: 4px 8px;
|
|
3153
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3101
3154
|
border-radius: 4px;
|
|
3102
3155
|
}
|
|
3103
3156
|
.pro-upload .pro-upload-dragger .pro-upload-handle-box {
|
|
@@ -5287,6 +5340,7 @@ input[type='button'] {
|
|
|
5287
5340
|
--zaui-table-selected-hover-bg: var(--zaui-table-hover-bg);
|
|
5288
5341
|
--zaui-table-nested-bg: #fafcfe;
|
|
5289
5342
|
--zaui-contract-bg: #fffaa1;
|
|
5343
|
+
--zaui-contract-bg-add: #d2fff4;
|
|
5290
5344
|
--zaui-form-label-width: 130px;
|
|
5291
5345
|
--zaui-border-radius: 8px;
|
|
5292
5346
|
--zaui-border-radius-card: 4px;
|
package/dist/less.esm.css
CHANGED
|
@@ -3059,11 +3059,17 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3059
3059
|
.pro-form .pro-form-list-mode-block .pro-collapse-content .ant-row {
|
|
3060
3060
|
width: auto;
|
|
3061
3061
|
}
|
|
3062
|
+
.pro-form .pro-form-item-changed {
|
|
3063
|
+
border-radius: 4px;
|
|
3064
|
+
height: 100%;
|
|
3065
|
+
width: 100%;
|
|
3066
|
+
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3067
|
+
}
|
|
3062
3068
|
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper,
|
|
3063
3069
|
.pro-form .pro-form-item-changed .ant-select .ant-select-selector,
|
|
3064
3070
|
.pro-form .pro-form-item-changed .ant-picker,
|
|
3065
3071
|
.pro-form .pro-form-item-changed .ant-input-number {
|
|
3066
|
-
background: var(--
|
|
3072
|
+
background: var(--zaui-contract-bg, #fffaa1) !important;
|
|
3067
3073
|
}
|
|
3068
3074
|
.pro-form .pro-form-item-changed span.ant-input-affix-wrapper input,
|
|
3069
3075
|
.pro-form .pro-form-item-changed .ant-select .ant-select-selector input,
|
|
@@ -3079,25 +3085,72 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3079
3085
|
}
|
|
3080
3086
|
.pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
|
|
3081
3087
|
.pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
|
|
3082
|
-
background: var(--
|
|
3088
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3083
3089
|
border-radius: 4px;
|
|
3084
3090
|
}
|
|
3085
3091
|
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > span {
|
|
3086
3092
|
border-radius: 4px;
|
|
3087
3093
|
padding: 5px 8px;
|
|
3088
|
-
background: var(--
|
|
3094
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3089
3095
|
}
|
|
3090
3096
|
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
|
|
3091
3097
|
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
|
|
3092
3098
|
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
|
|
3093
|
-
background: var(--
|
|
3099
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3094
3100
|
}
|
|
3095
3101
|
.pro-form .pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
|
|
3096
|
-
background: var(--
|
|
3102
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3097
3103
|
}
|
|
3098
3104
|
.pro-form .pro-form-item-changed .pro-form-view-container {
|
|
3099
3105
|
padding: 4px 8px;
|
|
3100
|
-
background: var(--
|
|
3106
|
+
background: var(--zaui-contract-bg, #fffaa1);
|
|
3107
|
+
border-radius: 4px;
|
|
3108
|
+
}
|
|
3109
|
+
.pro-form .pro-form-item-add {
|
|
3110
|
+
border-radius: 4px;
|
|
3111
|
+
height: 100%;
|
|
3112
|
+
width: 100%;
|
|
3113
|
+
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
3114
|
+
}
|
|
3115
|
+
.pro-form .pro-form-item-add span.ant-input-affix-wrapper,
|
|
3116
|
+
.pro-form .pro-form-item-add .ant-select .ant-select-selector,
|
|
3117
|
+
.pro-form .pro-form-item-add .ant-picker,
|
|
3118
|
+
.pro-form .pro-form-item-add .ant-input-number {
|
|
3119
|
+
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
3120
|
+
}
|
|
3121
|
+
.pro-form .pro-form-item-add span.ant-input-affix-wrapper input,
|
|
3122
|
+
.pro-form .pro-form-item-add .ant-select .ant-select-selector input,
|
|
3123
|
+
.pro-form .pro-form-item-add .ant-picker input,
|
|
3124
|
+
.pro-form .pro-form-item-add .ant-input-number input {
|
|
3125
|
+
background: transparent !important;
|
|
3126
|
+
}
|
|
3127
|
+
.pro-form .pro-form-item-add span.ant-input-affix-wrapper .ant-select-selection-placeholder,
|
|
3128
|
+
.pro-form .pro-form-item-add .ant-select .ant-select-selector .ant-select-selection-placeholder,
|
|
3129
|
+
.pro-form .pro-form-item-add .ant-picker .ant-select-selection-placeholder,
|
|
3130
|
+
.pro-form .pro-form-item-add .ant-input-number .ant-select-selection-placeholder {
|
|
3131
|
+
z-index: 9;
|
|
3132
|
+
}
|
|
3133
|
+
.pro-form .pro-form-item-add .ant-form-item-control:has(.ant-switch-handle),
|
|
3134
|
+
.pro-form .pro-form-item-add .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
|
|
3135
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3136
|
+
border-radius: 4px;
|
|
3137
|
+
}
|
|
3138
|
+
.pro-form .pro-form-item-add .ant-form-item-control-input-content > span {
|
|
3139
|
+
border-radius: 4px;
|
|
3140
|
+
padding: 5px 8px;
|
|
3141
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3142
|
+
}
|
|
3143
|
+
.pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-select-selector,
|
|
3144
|
+
.pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
|
|
3145
|
+
.pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
|
|
3146
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3147
|
+
}
|
|
3148
|
+
.pro-form .pro-form-item-add .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
|
|
3149
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3150
|
+
}
|
|
3151
|
+
.pro-form .pro-form-item-add .pro-form-view-container {
|
|
3152
|
+
padding: 4px 8px;
|
|
3153
|
+
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3101
3154
|
border-radius: 4px;
|
|
3102
3155
|
}
|
|
3103
3156
|
.pro-upload .pro-upload-dragger .pro-upload-handle-box {
|
|
@@ -5287,6 +5340,7 @@ input[type='button'] {
|
|
|
5287
5340
|
--zaui-table-selected-hover-bg: var(--zaui-table-hover-bg);
|
|
5288
5341
|
--zaui-table-nested-bg: #fafcfe;
|
|
5289
5342
|
--zaui-contract-bg: #fffaa1;
|
|
5343
|
+
--zaui-contract-bg-add: #d2fff4;
|
|
5290
5344
|
--zaui-form-label-width: 130px;
|
|
5291
5345
|
--zaui-border-radius: 8px;
|
|
5292
5346
|
--zaui-border-radius-card: 4px;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormInstance } from 'antd';
|
|
3
3
|
import { NamePath } from 'antd/lib/form/interface';
|
|
4
|
+
import { DiffOriginalParams } from '../../../ProForm/utils/diffOriginal';
|
|
4
5
|
interface Props {
|
|
5
6
|
name?: NamePath;
|
|
6
7
|
names?: NamePath[];
|
|
@@ -9,7 +10,7 @@ interface Props {
|
|
|
9
10
|
namesStr?: NamePath;
|
|
10
11
|
originalValues?: any;
|
|
11
12
|
form: FormInstance;
|
|
12
|
-
equalWith?:
|
|
13
|
+
equalWith?: DiffOriginalParams['equalWith'];
|
|
13
14
|
[name: string]: any;
|
|
14
15
|
}
|
|
15
16
|
declare const ListChangedWrapper: React.FC<Props>;
|
|
@@ -7,6 +7,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
7
7
|
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type"];
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
import React, { useMemo } from 'react';
|
|
10
|
+
import classNames from 'classnames';
|
|
10
11
|
import { get } from 'lodash';
|
|
11
12
|
import { diffOriginal } from '../../../ProForm/utils/diffOriginal';
|
|
12
13
|
import { useProConfig } from '../../../ProConfigProvider';
|
|
@@ -78,8 +79,8 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
78
79
|
children = props.children,
|
|
79
80
|
type = props.type,
|
|
80
81
|
rest = _objectWithoutProperties(props, _excluded);
|
|
81
|
-
var
|
|
82
|
-
isDiffAll =
|
|
82
|
+
var _ref2 = useProConfig('ProEditTable') || {},
|
|
83
|
+
isDiffAll = _ref2.isDiffAll;
|
|
83
84
|
var namePath = toNamePath(namesStr || name);
|
|
84
85
|
var originalNamePath = toNamePath(originalName);
|
|
85
86
|
var originalNamePaths = originalNames && toNamePaths(originalNames);
|
|
@@ -93,8 +94,8 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
93
94
|
form: form
|
|
94
95
|
}) : undefined;
|
|
95
96
|
var noChange = !equalWith && (!originalValues || isDiffAll ? false : isEmpty(originalValue));
|
|
96
|
-
var
|
|
97
|
-
if (!isWatch || noChange) return
|
|
97
|
+
var diffType = useMemo(function () {
|
|
98
|
+
if (!isWatch || noChange) return 'same';
|
|
98
99
|
return diffOriginal({
|
|
99
100
|
value: props.value,
|
|
100
101
|
originalValue: originalValue,
|
|
@@ -103,9 +104,15 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
103
104
|
// name: isString(namesStr) ? namesStr : originalName || name,
|
|
104
105
|
});
|
|
105
106
|
}, [props.value, originalValue]);
|
|
107
|
+
var isAdd = diffType === 'add';
|
|
108
|
+
var isChanged = diffType === 'changed';
|
|
106
109
|
if (!isWatch || noChange) {
|
|
107
110
|
return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
|
|
108
111
|
}
|
|
112
|
+
var diffClassName = classNames({
|
|
113
|
+
'pro-form-item-changed': isChanged,
|
|
114
|
+
'pro-form-item-add': isAdd
|
|
115
|
+
});
|
|
109
116
|
return _jsx(_Tooltip, {
|
|
110
117
|
// 传入undefined 鼠标移入显示移出隐藏
|
|
111
118
|
open: isChanged ? undefined : false,
|
|
@@ -121,7 +128,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
121
128
|
})) : undefined]
|
|
122
129
|
}),
|
|
123
130
|
children: _jsx("div", {
|
|
124
|
-
className:
|
|
131
|
+
className: diffClassName,
|
|
125
132
|
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
|
|
126
133
|
})
|
|
127
134
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FormInstance } from 'antd';
|
|
2
2
|
import { NamePath } from 'antd/lib/form/interface';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { DiffOriginalParams } from '../../utils/diffOriginal';
|
|
4
5
|
import { DiffConfigProps } from '../../propsType';
|
|
5
6
|
interface Props {
|
|
6
7
|
name?: NamePath;
|
|
@@ -8,7 +9,7 @@ interface Props {
|
|
|
8
9
|
namesStr?: string;
|
|
9
10
|
diffConfig?: DiffConfigProps;
|
|
10
11
|
form: FormInstance;
|
|
11
|
-
equalWith?:
|
|
12
|
+
equalWith?: DiffOriginalParams['equalWith'];
|
|
12
13
|
[name: string]: any;
|
|
13
14
|
}
|
|
14
15
|
declare const ChangedWrapper: React.FC<Props>;
|
|
@@ -6,6 +6,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
6
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
7
|
var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig"];
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import classNames from 'classnames';
|
|
9
10
|
import { get } from 'lodash';
|
|
10
11
|
import React, { useMemo } from 'react';
|
|
11
12
|
import { diffOriginal } from '../../utils/diffOriginal';
|
|
@@ -25,10 +26,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
25
26
|
var _useProConfig = useProConfig('ProForm'),
|
|
26
27
|
isDiffAll = _useProConfig.isDiffAll;
|
|
27
28
|
var originalValues = diffConfig.originalValues,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_diffConfig$addTipCol = diffConfig.addTipColor,
|
|
31
|
-
addTipColor = _diffConfig$addTipCol === void 0 ? '#d2fff4' : _diffConfig$addTipCol;
|
|
29
|
+
changeTipColor = diffConfig.changeTipColor,
|
|
30
|
+
addTipColor = diffConfig.addTipColor;
|
|
32
31
|
var toolTip = (_diffConfig$toolTip = diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
|
|
33
32
|
// 不渲染tooltip
|
|
34
33
|
var isWatch = toolTip && !['FormList', 'ProEditTable'].includes(type);
|
|
@@ -36,8 +35,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
36
35
|
return get(originalValues, name);
|
|
37
36
|
}) : get(originalValues, name);
|
|
38
37
|
var noChange = !equalWith && (!originalValues || isDiffAll ? false : isEmpty(originalValue));
|
|
39
|
-
var
|
|
40
|
-
if (!isWatch || noChange) return
|
|
38
|
+
var diffType = useMemo(function () {
|
|
39
|
+
if (!isWatch || noChange) return 'same';
|
|
41
40
|
return diffOriginal({
|
|
42
41
|
originalValue: originalValue,
|
|
43
42
|
value: props.value,
|
|
@@ -46,6 +45,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
46
45
|
// name: namesStr || name,
|
|
47
46
|
});
|
|
48
47
|
}, [isWatch, noChange, props.value, originalValue]);
|
|
48
|
+
var isAdd = diffType === 'add';
|
|
49
|
+
var isChanged = diffType === 'changed';
|
|
49
50
|
var tipContent = useMemo(function () {
|
|
50
51
|
if (!isWatch || noChange) return undefined;
|
|
51
52
|
return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, {
|
|
@@ -58,16 +59,18 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
58
59
|
return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
|
|
59
60
|
}
|
|
60
61
|
var tipOpenCalc = function tipOpenCalc() {
|
|
61
|
-
if (!toolTip)
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
62
|
+
if (!toolTip) return false;
|
|
64
63
|
// 传入undefined 鼠标移入显示移出隐藏
|
|
65
64
|
return isChanged ? undefined : false;
|
|
66
65
|
};
|
|
67
66
|
var style = {
|
|
68
|
-
'--
|
|
69
|
-
'--
|
|
67
|
+
'--zaui-contract-bg': changeTipColor,
|
|
68
|
+
'--zaui-contract-bg-add': addTipColor
|
|
70
69
|
};
|
|
70
|
+
var diffClassName = classNames({
|
|
71
|
+
'pro-form-item-changed': isChanged,
|
|
72
|
+
'pro-form-item-add': isAdd
|
|
73
|
+
});
|
|
71
74
|
return _jsx(_Tooltip, {
|
|
72
75
|
open: tipOpenCalc(),
|
|
73
76
|
getPopupContainer: function getPopupContainer(target) {
|
|
@@ -78,7 +81,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
78
81
|
}),
|
|
79
82
|
placement: "topLeft",
|
|
80
83
|
children: _jsx("div", {
|
|
81
|
-
className:
|
|
84
|
+
className: diffClassName,
|
|
82
85
|
style: style,
|
|
83
86
|
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
|
|
84
87
|
})
|
|
@@ -31,6 +31,7 @@ import { ProTreeProps } from '../../../ProTree/propsType';
|
|
|
31
31
|
import { GroupProps as GroupCopyProps } from '../combination/Group/propsType';
|
|
32
32
|
import { ProCollapseProps } from '../../../ProLayout/components/ProCollapse/PropTypes';
|
|
33
33
|
import { DistributiveOmit, DiffConfigProps } from '../../propsType';
|
|
34
|
+
import { DiffOriginalParams } from '../../utils/diffOriginal';
|
|
34
35
|
export type ComponentMap = keyof typeof componentMap;
|
|
35
36
|
type ValidateKey = keyof typeof validate;
|
|
36
37
|
type RegExpKey = keyof typeof regExp;
|
|
@@ -201,7 +202,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
201
202
|
upperCase?: boolean;
|
|
202
203
|
hiddenNames?: string[] | any[];
|
|
203
204
|
rules?: ProRule[] | ReactiveFunction<Values, ProRule[]>;
|
|
204
|
-
equalWith?:
|
|
205
|
+
equalWith?: DiffOriginalParams['equalWith'];
|
|
205
206
|
required?: boolean | boolean[] | ReactiveFunction<Values, boolean | boolean[]>;
|
|
206
207
|
labelRequired?: boolean;
|
|
207
208
|
toISOString?: boolean;
|
|
@@ -324,11 +324,74 @@
|
|
|
324
324
|
|
|
325
325
|
// 比较原始值场景下 不同时的样式
|
|
326
326
|
.pro-form-item-changed {
|
|
327
|
+
border-radius: 4px;
|
|
328
|
+
height: 100%;
|
|
329
|
+
width: 100%;
|
|
330
|
+
background: @zaui-contract-bg !important;
|
|
331
|
+
|
|
332
|
+
span.@{ant-prefix}-input-affix-wrapper,
|
|
333
|
+
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
|
334
|
+
.@{ant-prefix}-picker,
|
|
335
|
+
.@{ant-prefix}-input-number {
|
|
336
|
+
background: @zaui-contract-bg !important;
|
|
337
|
+
|
|
338
|
+
input {
|
|
339
|
+
background: transparent !important;
|
|
340
|
+
}
|
|
341
|
+
.@{ant-prefix}-select-selection-placeholder {
|
|
342
|
+
z-index: 9;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
|
|
347
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
|
|
348
|
+
background: @zaui-contract-bg;
|
|
349
|
+
border-radius: 4px;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// 地址组件
|
|
353
|
+
.@{ant-prefix}-form-item-control-input-content {
|
|
354
|
+
// 查看模式
|
|
355
|
+
& > span {
|
|
356
|
+
border-radius: 4px;
|
|
357
|
+
padding: 5px 8px;
|
|
358
|
+
background: @zaui-contract-bg;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
& > .pro-address {
|
|
362
|
+
.@{ant-prefix}-select-selector,
|
|
363
|
+
.@{ant-prefix}-input-affix-wrapper,
|
|
364
|
+
.@{ant-prefix}-input-disabled {
|
|
365
|
+
background: @zaui-contract-bg;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
& > .@{ant-prefix}-input-group {
|
|
369
|
+
.forever-checkbox {
|
|
370
|
+
background: @zaui-contract-bg;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.pro-form-view-container {
|
|
376
|
+
padding: 4px 8px;
|
|
377
|
+
background: @zaui-contract-bg;
|
|
378
|
+
border-radius: 4px;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
// 比较原始值场景下 不同时的样式
|
|
384
|
+
.pro-form-item-add {
|
|
385
|
+
border-radius: 4px;
|
|
386
|
+
height: 100%;
|
|
387
|
+
width: 100%;
|
|
388
|
+
background: @zaui-contract-bg-add !important;
|
|
389
|
+
|
|
327
390
|
span.@{ant-prefix}-input-affix-wrapper,
|
|
328
391
|
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
|
329
392
|
.@{ant-prefix}-picker,
|
|
330
393
|
.@{ant-prefix}-input-number {
|
|
331
|
-
background:
|
|
394
|
+
background: @zaui-contract-bg-add !important;
|
|
332
395
|
|
|
333
396
|
input {
|
|
334
397
|
background: transparent !important;
|
|
@@ -340,7 +403,7 @@
|
|
|
340
403
|
|
|
341
404
|
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
|
|
342
405
|
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
|
|
343
|
-
background:
|
|
406
|
+
background: @zaui-contract-bg-add;
|
|
344
407
|
border-radius: 4px;
|
|
345
408
|
}
|
|
346
409
|
|
|
@@ -350,26 +413,26 @@
|
|
|
350
413
|
& > span {
|
|
351
414
|
border-radius: 4px;
|
|
352
415
|
padding: 5px 8px;
|
|
353
|
-
background:
|
|
416
|
+
background: @zaui-contract-bg-add;
|
|
354
417
|
}
|
|
355
418
|
|
|
356
419
|
& > .pro-address {
|
|
357
420
|
.@{ant-prefix}-select-selector,
|
|
358
421
|
.@{ant-prefix}-input-affix-wrapper,
|
|
359
422
|
.@{ant-prefix}-input-disabled {
|
|
360
|
-
background:
|
|
423
|
+
background: @zaui-contract-bg-add;
|
|
361
424
|
}
|
|
362
425
|
}
|
|
363
426
|
& > .@{ant-prefix}-input-group {
|
|
364
427
|
.forever-checkbox {
|
|
365
|
-
background:
|
|
428
|
+
background: @zaui-contract-bg-add;
|
|
366
429
|
}
|
|
367
430
|
}
|
|
368
431
|
}
|
|
369
432
|
|
|
370
433
|
.pro-form-view-container {
|
|
371
434
|
padding: 4px 8px;
|
|
372
|
-
background:
|
|
435
|
+
background: @zaui-contract-bg-add;
|
|
373
436
|
border-radius: 4px;
|
|
374
437
|
}
|
|
375
438
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FormInstance } from 'antd';
|
|
2
|
-
interface
|
|
2
|
+
export interface DiffOriginalParams {
|
|
3
3
|
originalValue: any;
|
|
4
4
|
value: any;
|
|
5
5
|
form: FormInstance;
|
|
6
|
-
equalWith?: (originalValue: any, currentValue: any) => boolean;
|
|
6
|
+
equalWith?: (originalValue: any, currentValue: any) => DiffType | boolean | undefined;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type DiffType = 'same' | 'add' | 'changed';
|
|
9
|
+
export declare const diffOriginal: (params: DiffOriginalParams) => DiffType;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isEqual, isFunction } from 'lodash';
|
|
2
|
+
import { isEmpty } from '../../utils';
|
|
2
3
|
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
3
4
|
export var diffOriginal = function diffOriginal(params) {
|
|
4
5
|
var originalValue = params.originalValue,
|
|
@@ -6,19 +7,29 @@ export var diffOriginal = function diffOriginal(params) {
|
|
|
6
7
|
equalWith = params.equalWith;
|
|
7
8
|
// 支持传入自定义比较事件
|
|
8
9
|
if (isFunction(equalWith)) {
|
|
9
|
-
|
|
10
|
+
var diffRes = equalWith(originalValue, value);
|
|
11
|
+
if (diffRes === undefined) return 'same';
|
|
12
|
+
if (typeof diffRes === 'boolean') {
|
|
13
|
+
return diffRes ? 'same' : 'changed';
|
|
14
|
+
}
|
|
15
|
+
return diffRes;
|
|
16
|
+
}
|
|
17
|
+
// 如果原始值为空 且当前有值的话 认为变更类型是新增
|
|
18
|
+
if (isEmpty(originalValue) && !isEmpty(value)) {
|
|
19
|
+
return 'add';
|
|
10
20
|
}
|
|
11
21
|
if (Array.isArray(originalValue)) {
|
|
12
|
-
|
|
22
|
+
var isSame = originalValue.every(function (valueItem, index) {
|
|
13
23
|
// 如果两个值有一个不是空值, 则进行深比较
|
|
14
|
-
if (!
|
|
15
|
-
return
|
|
24
|
+
if (!isEmpty(value === null || value === void 0 ? void 0 : value[index]) || !isEmpty(valueItem)) {
|
|
25
|
+
return isEqual(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
|
16
26
|
}
|
|
17
|
-
return
|
|
27
|
+
return true;
|
|
18
28
|
});
|
|
29
|
+
return isSame ? 'same' : 'changed';
|
|
19
30
|
}
|
|
20
31
|
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
21
|
-
return
|
|
32
|
+
return isEqual(value, originalValue) ? 'same' : 'changed';
|
|
22
33
|
}
|
|
23
|
-
return
|
|
34
|
+
return 'same';
|
|
24
35
|
};
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
--zaui-table-selected-hover-bg : var(--zaui-table-hover-bg); // 默认同悬停
|
|
56
56
|
--zaui-table-nested-bg : #fafcfe;
|
|
57
57
|
--zaui-contract-bg : #fffaa1; // 对比背景色
|
|
58
|
+
--zaui-contract-bg-add : #d2fff4; // 新增对比背景色
|
|
58
59
|
--zaui-form-label-width : 130px; // 8个全角字符宽度
|
|
59
60
|
--zaui-border-radius : 8px;
|
|
60
61
|
--zaui-border-radius-card : 4px;
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
@zaui-table-selected-hover-bg: var(--zaui-table-hover-bg #fafafa);
|
|
54
54
|
@zaui-table-nested-bg: var(--zaui-table-nested-bg #FAFCFE);
|
|
55
55
|
@zaui-contract-bg: var(--zaui-contract-bg; #fffaa1); // 对比背景色
|
|
56
|
+
@zaui-contract-bg-add: var(--zaui-contract-bg-add; #d2fff4); // 新增对比背景色
|
|
56
57
|
@zaui-form-required-after: var(--zaui-form-required-after; inline);
|
|
57
58
|
@zaui-form-required-before: var(--zaui-form-required-before; none);
|
|
58
59
|
@zaui-form-label-width: var(--zaui-form-label-width; 130px);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormInstance } from 'antd';
|
|
3
3
|
import { NamePath } from 'antd/lib/form/interface';
|
|
4
|
+
import { DiffOriginalParams } from '../../../ProForm/utils/diffOriginal';
|
|
4
5
|
interface Props {
|
|
5
6
|
name?: NamePath;
|
|
6
7
|
names?: NamePath[];
|
|
@@ -9,7 +10,7 @@ interface Props {
|
|
|
9
10
|
namesStr?: NamePath;
|
|
10
11
|
originalValues?: any;
|
|
11
12
|
form: FormInstance;
|
|
12
|
-
equalWith?:
|
|
13
|
+
equalWith?: DiffOriginalParams['equalWith'];
|
|
13
14
|
[name: string]: any;
|
|
14
15
|
}
|
|
15
16
|
declare const ListChangedWrapper: React.FC<Props>;
|
|
@@ -11,6 +11,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _antd = require("antd");
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
15
|
var _lodash = require("lodash");
|
|
15
16
|
var _diffOriginal = require("../../../ProForm/utils/diffOriginal");
|
|
16
17
|
var _ProConfigProvider = require("../../../ProConfigProvider");
|
|
@@ -83,8 +84,8 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
83
84
|
children = props.children,
|
|
84
85
|
type = props.type,
|
|
85
86
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
86
|
-
var
|
|
87
|
-
isDiffAll =
|
|
87
|
+
var _ref2 = (0, _ProConfigProvider.useProConfig)('ProEditTable') || {},
|
|
88
|
+
isDiffAll = _ref2.isDiffAll;
|
|
88
89
|
var namePath = toNamePath(namesStr || name);
|
|
89
90
|
var originalNamePath = toNamePath(originalName);
|
|
90
91
|
var originalNamePaths = originalNames && toNamePaths(originalNames);
|
|
@@ -98,8 +99,8 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
98
99
|
form: form
|
|
99
100
|
}) : undefined;
|
|
100
101
|
var noChange = !equalWith && (!originalValues || isDiffAll ? false : (0, _utils.isEmpty)(originalValue));
|
|
101
|
-
var
|
|
102
|
-
if (!isWatch || noChange) return
|
|
102
|
+
var diffType = (0, _react.useMemo)(function () {
|
|
103
|
+
if (!isWatch || noChange) return 'same';
|
|
103
104
|
return (0, _diffOriginal.diffOriginal)({
|
|
104
105
|
value: props.value,
|
|
105
106
|
originalValue: originalValue,
|
|
@@ -108,9 +109,15 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
108
109
|
// name: isString(namesStr) ? namesStr : originalName || name,
|
|
109
110
|
});
|
|
110
111
|
}, [props.value, originalValue]);
|
|
112
|
+
var isAdd = diffType === 'add';
|
|
113
|
+
var isChanged = diffType === 'changed';
|
|
111
114
|
if (!isWatch || noChange) {
|
|
112
115
|
return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest));
|
|
113
116
|
}
|
|
117
|
+
var diffClassName = (0, _classnames.default)({
|
|
118
|
+
'pro-form-item-changed': isChanged,
|
|
119
|
+
'pro-form-item-add': isAdd
|
|
120
|
+
});
|
|
114
121
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip
|
|
115
122
|
// 传入undefined 鼠标移入显示移出隐藏
|
|
116
123
|
, {
|
|
@@ -128,7 +135,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
128
135
|
})) : undefined]
|
|
129
136
|
}),
|
|
130
137
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
131
|
-
className:
|
|
138
|
+
className: diffClassName,
|
|
132
139
|
children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest)) : undefined
|
|
133
140
|
})
|
|
134
141
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FormInstance } from 'antd';
|
|
2
2
|
import { NamePath } from 'antd/lib/form/interface';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { DiffOriginalParams } from '../../utils/diffOriginal';
|
|
4
5
|
import { DiffConfigProps } from '../../propsType';
|
|
5
6
|
interface Props {
|
|
6
7
|
name?: NamePath;
|
|
@@ -8,7 +9,7 @@ interface Props {
|
|
|
8
9
|
namesStr?: string;
|
|
9
10
|
diffConfig?: DiffConfigProps;
|
|
10
11
|
form: FormInstance;
|
|
11
|
-
equalWith?:
|
|
12
|
+
equalWith?: DiffOriginalParams['equalWith'];
|
|
12
13
|
[name: string]: any;
|
|
13
14
|
}
|
|
14
15
|
declare const ChangedWrapper: React.FC<Props>;
|
|
@@ -10,6 +10,7 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
var _antd = require("antd");
|
|
13
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
14
|
var _lodash = require("lodash");
|
|
14
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
16
|
var _diffOriginal = require("../../utils/diffOriginal");
|
|
@@ -30,10 +31,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
30
31
|
var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
|
|
31
32
|
isDiffAll = _useProConfig.isDiffAll;
|
|
32
33
|
var originalValues = diffConfig.originalValues,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_diffConfig$addTipCol = diffConfig.addTipColor,
|
|
36
|
-
addTipColor = _diffConfig$addTipCol === void 0 ? '#d2fff4' : _diffConfig$addTipCol;
|
|
34
|
+
changeTipColor = diffConfig.changeTipColor,
|
|
35
|
+
addTipColor = diffConfig.addTipColor;
|
|
37
36
|
var toolTip = (_diffConfig$toolTip = diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
|
|
38
37
|
// 不渲染tooltip
|
|
39
38
|
var isWatch = toolTip && !['FormList', 'ProEditTable'].includes(type);
|
|
@@ -41,8 +40,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
41
40
|
return (0, _lodash.get)(originalValues, name);
|
|
42
41
|
}) : (0, _lodash.get)(originalValues, name);
|
|
43
42
|
var noChange = !equalWith && (!originalValues || isDiffAll ? false : (0, _utils.isEmpty)(originalValue));
|
|
44
|
-
var
|
|
45
|
-
if (!isWatch || noChange) return
|
|
43
|
+
var diffType = (0, _react.useMemo)(function () {
|
|
44
|
+
if (!isWatch || noChange) return 'same';
|
|
46
45
|
return (0, _diffOriginal.diffOriginal)({
|
|
47
46
|
originalValue: originalValue,
|
|
48
47
|
value: props.value,
|
|
@@ -51,6 +50,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
51
50
|
// name: namesStr || name,
|
|
52
51
|
});
|
|
53
52
|
}, [isWatch, noChange, props.value, originalValue]);
|
|
53
|
+
var isAdd = diffType === 'add';
|
|
54
|
+
var isChanged = diffType === 'changed';
|
|
54
55
|
var tipContent = (0, _react.useMemo)(function () {
|
|
55
56
|
if (!isWatch || noChange) return undefined;
|
|
56
57
|
return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), {}, {
|
|
@@ -63,16 +64,18 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
63
64
|
return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest));
|
|
64
65
|
}
|
|
65
66
|
var tipOpenCalc = function tipOpenCalc() {
|
|
66
|
-
if (!toolTip)
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
67
|
+
if (!toolTip) return false;
|
|
69
68
|
// 传入undefined 鼠标移入显示移出隐藏
|
|
70
69
|
return isChanged ? undefined : false;
|
|
71
70
|
};
|
|
72
71
|
var style = {
|
|
73
|
-
'--
|
|
74
|
-
'--
|
|
72
|
+
'--zaui-contract-bg': changeTipColor,
|
|
73
|
+
'--zaui-contract-bg-add': addTipColor
|
|
75
74
|
};
|
|
75
|
+
var diffClassName = (0, _classnames.default)({
|
|
76
|
+
'pro-form-item-changed': isChanged,
|
|
77
|
+
'pro-form-item-add': isAdd
|
|
78
|
+
});
|
|
76
79
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
77
80
|
open: tipOpenCalc(),
|
|
78
81
|
getPopupContainer: function getPopupContainer(target) {
|
|
@@ -83,7 +86,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
83
86
|
}),
|
|
84
87
|
placement: "topLeft",
|
|
85
88
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
86
|
-
className:
|
|
89
|
+
className: diffClassName,
|
|
87
90
|
style: style,
|
|
88
91
|
children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest)) : undefined
|
|
89
92
|
})
|
|
@@ -31,6 +31,7 @@ import { ProTreeProps } from '../../../ProTree/propsType';
|
|
|
31
31
|
import { GroupProps as GroupCopyProps } from '../combination/Group/propsType';
|
|
32
32
|
import { ProCollapseProps } from '../../../ProLayout/components/ProCollapse/PropTypes';
|
|
33
33
|
import { DistributiveOmit, DiffConfigProps } from '../../propsType';
|
|
34
|
+
import { DiffOriginalParams } from '../../utils/diffOriginal';
|
|
34
35
|
export type ComponentMap = keyof typeof componentMap;
|
|
35
36
|
type ValidateKey = keyof typeof validate;
|
|
36
37
|
type RegExpKey = keyof typeof regExp;
|
|
@@ -201,7 +202,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
201
202
|
upperCase?: boolean;
|
|
202
203
|
hiddenNames?: string[] | any[];
|
|
203
204
|
rules?: ProRule[] | ReactiveFunction<Values, ProRule[]>;
|
|
204
|
-
equalWith?:
|
|
205
|
+
equalWith?: DiffOriginalParams['equalWith'];
|
|
205
206
|
required?: boolean | boolean[] | ReactiveFunction<Values, boolean | boolean[]>;
|
|
206
207
|
labelRequired?: boolean;
|
|
207
208
|
toISOString?: boolean;
|
|
@@ -324,11 +324,74 @@
|
|
|
324
324
|
|
|
325
325
|
// 比较原始值场景下 不同时的样式
|
|
326
326
|
.pro-form-item-changed {
|
|
327
|
+
border-radius: 4px;
|
|
328
|
+
height: 100%;
|
|
329
|
+
width: 100%;
|
|
330
|
+
background: @zaui-contract-bg !important;
|
|
331
|
+
|
|
332
|
+
span.@{ant-prefix}-input-affix-wrapper,
|
|
333
|
+
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
|
334
|
+
.@{ant-prefix}-picker,
|
|
335
|
+
.@{ant-prefix}-input-number {
|
|
336
|
+
background: @zaui-contract-bg !important;
|
|
337
|
+
|
|
338
|
+
input {
|
|
339
|
+
background: transparent !important;
|
|
340
|
+
}
|
|
341
|
+
.@{ant-prefix}-select-selection-placeholder {
|
|
342
|
+
z-index: 9;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
|
|
347
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
|
|
348
|
+
background: @zaui-contract-bg;
|
|
349
|
+
border-radius: 4px;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// 地址组件
|
|
353
|
+
.@{ant-prefix}-form-item-control-input-content {
|
|
354
|
+
// 查看模式
|
|
355
|
+
& > span {
|
|
356
|
+
border-radius: 4px;
|
|
357
|
+
padding: 5px 8px;
|
|
358
|
+
background: @zaui-contract-bg;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
& > .pro-address {
|
|
362
|
+
.@{ant-prefix}-select-selector,
|
|
363
|
+
.@{ant-prefix}-input-affix-wrapper,
|
|
364
|
+
.@{ant-prefix}-input-disabled {
|
|
365
|
+
background: @zaui-contract-bg;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
& > .@{ant-prefix}-input-group {
|
|
369
|
+
.forever-checkbox {
|
|
370
|
+
background: @zaui-contract-bg;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.pro-form-view-container {
|
|
376
|
+
padding: 4px 8px;
|
|
377
|
+
background: @zaui-contract-bg;
|
|
378
|
+
border-radius: 4px;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
// 比较原始值场景下 不同时的样式
|
|
384
|
+
.pro-form-item-add {
|
|
385
|
+
border-radius: 4px;
|
|
386
|
+
height: 100%;
|
|
387
|
+
width: 100%;
|
|
388
|
+
background: @zaui-contract-bg-add !important;
|
|
389
|
+
|
|
327
390
|
span.@{ant-prefix}-input-affix-wrapper,
|
|
328
391
|
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
|
329
392
|
.@{ant-prefix}-picker,
|
|
330
393
|
.@{ant-prefix}-input-number {
|
|
331
|
-
background:
|
|
394
|
+
background: @zaui-contract-bg-add !important;
|
|
332
395
|
|
|
333
396
|
input {
|
|
334
397
|
background: transparent !important;
|
|
@@ -340,7 +403,7 @@
|
|
|
340
403
|
|
|
341
404
|
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
|
|
342
405
|
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
|
|
343
|
-
background:
|
|
406
|
+
background: @zaui-contract-bg-add;
|
|
344
407
|
border-radius: 4px;
|
|
345
408
|
}
|
|
346
409
|
|
|
@@ -350,26 +413,26 @@
|
|
|
350
413
|
& > span {
|
|
351
414
|
border-radius: 4px;
|
|
352
415
|
padding: 5px 8px;
|
|
353
|
-
background:
|
|
416
|
+
background: @zaui-contract-bg-add;
|
|
354
417
|
}
|
|
355
418
|
|
|
356
419
|
& > .pro-address {
|
|
357
420
|
.@{ant-prefix}-select-selector,
|
|
358
421
|
.@{ant-prefix}-input-affix-wrapper,
|
|
359
422
|
.@{ant-prefix}-input-disabled {
|
|
360
|
-
background:
|
|
423
|
+
background: @zaui-contract-bg-add;
|
|
361
424
|
}
|
|
362
425
|
}
|
|
363
426
|
& > .@{ant-prefix}-input-group {
|
|
364
427
|
.forever-checkbox {
|
|
365
|
-
background:
|
|
428
|
+
background: @zaui-contract-bg-add;
|
|
366
429
|
}
|
|
367
430
|
}
|
|
368
431
|
}
|
|
369
432
|
|
|
370
433
|
.pro-form-view-container {
|
|
371
434
|
padding: 4px 8px;
|
|
372
|
-
background:
|
|
435
|
+
background: @zaui-contract-bg-add;
|
|
373
436
|
border-radius: 4px;
|
|
374
437
|
}
|
|
375
438
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FormInstance } from 'antd';
|
|
2
|
-
interface
|
|
2
|
+
export interface DiffOriginalParams {
|
|
3
3
|
originalValue: any;
|
|
4
4
|
value: any;
|
|
5
5
|
form: FormInstance;
|
|
6
|
-
equalWith?: (originalValue: any, currentValue: any) => boolean;
|
|
6
|
+
equalWith?: (originalValue: any, currentValue: any) => DiffType | boolean | undefined;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type DiffType = 'same' | 'add' | 'changed';
|
|
9
|
+
export declare const diffOriginal: (params: DiffOriginalParams) => DiffType;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.diffOriginal = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
+
var _utils = require("../../utils");
|
|
8
9
|
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
9
10
|
var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
10
11
|
var originalValue = params.originalValue,
|
|
@@ -12,19 +13,29 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
|
12
13
|
equalWith = params.equalWith;
|
|
13
14
|
// 支持传入自定义比较事件
|
|
14
15
|
if ((0, _lodash.isFunction)(equalWith)) {
|
|
15
|
-
|
|
16
|
+
var diffRes = equalWith(originalValue, value);
|
|
17
|
+
if (diffRes === undefined) return 'same';
|
|
18
|
+
if (typeof diffRes === 'boolean') {
|
|
19
|
+
return diffRes ? 'same' : 'changed';
|
|
20
|
+
}
|
|
21
|
+
return diffRes;
|
|
22
|
+
}
|
|
23
|
+
// 如果原始值为空 且当前有值的话 认为变更类型是新增
|
|
24
|
+
if ((0, _utils.isEmpty)(originalValue) && !(0, _utils.isEmpty)(value)) {
|
|
25
|
+
return 'add';
|
|
16
26
|
}
|
|
17
27
|
if (Array.isArray(originalValue)) {
|
|
18
|
-
|
|
28
|
+
var isSame = originalValue.every(function (valueItem, index) {
|
|
19
29
|
// 如果两个值有一个不是空值, 则进行深比较
|
|
20
|
-
if (!
|
|
21
|
-
return
|
|
30
|
+
if (!(0, _utils.isEmpty)(value === null || value === void 0 ? void 0 : value[index]) || !(0, _utils.isEmpty)(valueItem)) {
|
|
31
|
+
return (0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
|
22
32
|
}
|
|
23
|
-
return
|
|
33
|
+
return true;
|
|
24
34
|
});
|
|
35
|
+
return isSame ? 'same' : 'changed';
|
|
25
36
|
}
|
|
26
37
|
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
27
|
-
return
|
|
38
|
+
return (0, _lodash.isEqual)(value, originalValue) ? 'same' : 'changed';
|
|
28
39
|
}
|
|
29
|
-
return
|
|
40
|
+
return 'same';
|
|
30
41
|
};
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
--zaui-table-selected-hover-bg : var(--zaui-table-hover-bg); // 默认同悬停
|
|
56
56
|
--zaui-table-nested-bg : #fafcfe;
|
|
57
57
|
--zaui-contract-bg : #fffaa1; // 对比背景色
|
|
58
|
+
--zaui-contract-bg-add : #d2fff4; // 新增对比背景色
|
|
58
59
|
--zaui-form-label-width : 130px; // 8个全角字符宽度
|
|
59
60
|
--zaui-border-radius : 8px;
|
|
60
61
|
--zaui-border-radius-card : 4px;
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
@zaui-table-selected-hover-bg: var(--zaui-table-hover-bg #fafafa);
|
|
54
54
|
@zaui-table-nested-bg: var(--zaui-table-nested-bg #FAFCFE);
|
|
55
55
|
@zaui-contract-bg: var(--zaui-contract-bg; #fffaa1); // 对比背景色
|
|
56
|
+
@zaui-contract-bg-add: var(--zaui-contract-bg-add; #d2fff4); // 新增对比背景色
|
|
56
57
|
@zaui-form-required-after: var(--zaui-form-required-after; inline);
|
|
57
58
|
@zaui-form-required-before: var(--zaui-form-required-before; none);
|
|
58
59
|
@zaui-form-label-width: var(--zaui-form-label-width; 130px);
|
package/package.json
CHANGED