@zat-design/sisyphus-react 3.7.3-beta.3 → 3.7.3-beta.5

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.
Files changed (27) hide show
  1. package/dist/index.esm.css +47 -6
  2. package/dist/less.esm.css +47 -6
  3. package/es/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +2 -1
  4. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +12 -5
  5. package/es/ProForm/components/combination/Container/index.js +5 -3
  6. package/es/ProForm/components/combination/Container/propsType.d.ts +2 -1
  7. package/es/ProForm/components/combination/ProNumberRange/index.js +3 -1
  8. package/es/ProForm/components/render/ChangedWrapper.d.ts +2 -1
  9. package/es/ProForm/components/render/ChangedWrapper.js +21 -7
  10. package/es/ProForm/components/render/RenderFields.js +1 -0
  11. package/es/ProForm/components/render/propsType.d.ts +2 -1
  12. package/es/ProForm/style/index.less +59 -6
  13. package/es/ProForm/utils/diffOriginal.d.ts +4 -4
  14. package/es/ProForm/utils/diffOriginal.js +18 -7
  15. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +2 -1
  16. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +12 -5
  17. package/lib/ProForm/components/combination/Container/index.js +5 -3
  18. package/lib/ProForm/components/combination/Container/propsType.d.ts +2 -1
  19. package/lib/ProForm/components/combination/ProNumberRange/index.js +3 -1
  20. package/lib/ProForm/components/render/ChangedWrapper.d.ts +2 -1
  21. package/lib/ProForm/components/render/ChangedWrapper.js +21 -7
  22. package/lib/ProForm/components/render/RenderFields.js +1 -0
  23. package/lib/ProForm/components/render/propsType.d.ts +2 -1
  24. package/lib/ProForm/style/index.less +59 -6
  25. package/lib/ProForm/utils/diffOriginal.d.ts +4 -4
  26. package/lib/ProForm/utils/diffOriginal.js +18 -7
  27. package/package.json +1 -1
@@ -3063,7 +3063,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3063
3063
  .pro-form .pro-form-item-changed .ant-select .ant-select-selector,
3064
3064
  .pro-form .pro-form-item-changed .ant-picker,
3065
3065
  .pro-form .pro-form-item-changed .ant-input-number {
3066
- background: var(--zaui-contract-bg, #fffaa1) !important;
3066
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1)) !important;
3067
3067
  }
3068
3068
  .pro-form .pro-form-item-changed span.ant-input-affix-wrapper input,
3069
3069
  .pro-form .pro-form-item-changed .ant-select .ant-select-selector input,
@@ -3079,25 +3079,66 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3079
3079
  }
3080
3080
  .pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
3081
3081
  .pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
3082
- background: var(--zaui-contract-bg, #fffaa1);
3082
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1));
3083
3083
  border-radius: 4px;
3084
3084
  }
3085
3085
  .pro-form .pro-form-item-changed .ant-form-item-control-input-content > span {
3086
3086
  border-radius: 4px;
3087
3087
  padding: 5px 8px;
3088
- background: var(--zaui-contract-bg, #fffaa1);
3088
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1));
3089
3089
  }
3090
3090
  .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
3091
3091
  .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
3092
3092
  .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
3093
- background: var(--zaui-contract-bg, #fffaa1);
3093
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1));
3094
3094
  }
3095
3095
  .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
3096
- background: var(--zaui-contract-bg, #fffaa1);
3096
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1));
3097
3097
  }
3098
3098
  .pro-form .pro-form-item-changed .pro-form-view-container {
3099
3099
  padding: 4px 8px;
3100
- background: var(--zaui-contract-bg, #fffaa1);
3100
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1));
3101
+ border-radius: 4px;
3102
+ }
3103
+ .pro-form .pro-form-item-add span.ant-input-affix-wrapper,
3104
+ .pro-form .pro-form-item-add .ant-select .ant-select-selector,
3105
+ .pro-form .pro-form-item-add .ant-picker,
3106
+ .pro-form .pro-form-item-add .ant-input-number {
3107
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1)) !important;
3108
+ }
3109
+ .pro-form .pro-form-item-add span.ant-input-affix-wrapper input,
3110
+ .pro-form .pro-form-item-add .ant-select .ant-select-selector input,
3111
+ .pro-form .pro-form-item-add .ant-picker input,
3112
+ .pro-form .pro-form-item-add .ant-input-number input {
3113
+ background: transparent !important;
3114
+ }
3115
+ .pro-form .pro-form-item-add span.ant-input-affix-wrapper .ant-select-selection-placeholder,
3116
+ .pro-form .pro-form-item-add .ant-select .ant-select-selector .ant-select-selection-placeholder,
3117
+ .pro-form .pro-form-item-add .ant-picker .ant-select-selection-placeholder,
3118
+ .pro-form .pro-form-item-add .ant-input-number .ant-select-selection-placeholder {
3119
+ z-index: 9;
3120
+ }
3121
+ .pro-form .pro-form-item-add .ant-form-item-control:has(.ant-switch-handle),
3122
+ .pro-form .pro-form-item-add .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
3123
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1));
3124
+ border-radius: 4px;
3125
+ }
3126
+ .pro-form .pro-form-item-add .ant-form-item-control-input-content > span {
3127
+ border-radius: 4px;
3128
+ padding: 5px 8px;
3129
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1));
3130
+ }
3131
+ .pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-select-selector,
3132
+ .pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
3133
+ .pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
3134
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1));
3135
+ }
3136
+ .pro-form .pro-form-item-add .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
3137
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1));
3138
+ }
3139
+ .pro-form .pro-form-item-add .pro-form-view-container {
3140
+ padding: 4px 8px;
3141
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1));
3101
3142
  border-radius: 4px;
3102
3143
  }
3103
3144
  .pro-upload .pro-upload-dragger .pro-upload-handle-box {
package/dist/less.esm.css CHANGED
@@ -3063,7 +3063,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3063
3063
  .pro-form .pro-form-item-changed .ant-select .ant-select-selector,
3064
3064
  .pro-form .pro-form-item-changed .ant-picker,
3065
3065
  .pro-form .pro-form-item-changed .ant-input-number {
3066
- background: var(--zaui-contract-bg, #fffaa1) !important;
3066
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1)) !important;
3067
3067
  }
3068
3068
  .pro-form .pro-form-item-changed span.ant-input-affix-wrapper input,
3069
3069
  .pro-form .pro-form-item-changed .ant-select .ant-select-selector input,
@@ -3079,25 +3079,66 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3079
3079
  }
3080
3080
  .pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
3081
3081
  .pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
3082
- background: var(--zaui-contract-bg, #fffaa1);
3082
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1));
3083
3083
  border-radius: 4px;
3084
3084
  }
3085
3085
  .pro-form .pro-form-item-changed .ant-form-item-control-input-content > span {
3086
3086
  border-radius: 4px;
3087
3087
  padding: 5px 8px;
3088
- background: var(--zaui-contract-bg, #fffaa1);
3088
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1));
3089
3089
  }
3090
3090
  .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
3091
3091
  .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
3092
3092
  .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
3093
- background: var(--zaui-contract-bg, #fffaa1);
3093
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1));
3094
3094
  }
3095
3095
  .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
3096
- background: var(--zaui-contract-bg, #fffaa1);
3096
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1));
3097
3097
  }
3098
3098
  .pro-form .pro-form-item-changed .pro-form-view-container {
3099
3099
  padding: 4px 8px;
3100
- background: var(--zaui-contract-bg, #fffaa1);
3100
+ background: var(--change-tip-color, var(--zaui-contract-bg, #fffaa1));
3101
+ border-radius: 4px;
3102
+ }
3103
+ .pro-form .pro-form-item-add span.ant-input-affix-wrapper,
3104
+ .pro-form .pro-form-item-add .ant-select .ant-select-selector,
3105
+ .pro-form .pro-form-item-add .ant-picker,
3106
+ .pro-form .pro-form-item-add .ant-input-number {
3107
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1)) !important;
3108
+ }
3109
+ .pro-form .pro-form-item-add span.ant-input-affix-wrapper input,
3110
+ .pro-form .pro-form-item-add .ant-select .ant-select-selector input,
3111
+ .pro-form .pro-form-item-add .ant-picker input,
3112
+ .pro-form .pro-form-item-add .ant-input-number input {
3113
+ background: transparent !important;
3114
+ }
3115
+ .pro-form .pro-form-item-add span.ant-input-affix-wrapper .ant-select-selection-placeholder,
3116
+ .pro-form .pro-form-item-add .ant-select .ant-select-selector .ant-select-selection-placeholder,
3117
+ .pro-form .pro-form-item-add .ant-picker .ant-select-selection-placeholder,
3118
+ .pro-form .pro-form-item-add .ant-input-number .ant-select-selection-placeholder {
3119
+ z-index: 9;
3120
+ }
3121
+ .pro-form .pro-form-item-add .ant-form-item-control:has(.ant-switch-handle),
3122
+ .pro-form .pro-form-item-add .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
3123
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1));
3124
+ border-radius: 4px;
3125
+ }
3126
+ .pro-form .pro-form-item-add .ant-form-item-control-input-content > span {
3127
+ border-radius: 4px;
3128
+ padding: 5px 8px;
3129
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1));
3130
+ }
3131
+ .pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-select-selector,
3132
+ .pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
3133
+ .pro-form .pro-form-item-add .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
3134
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1));
3135
+ }
3136
+ .pro-form .pro-form-item-add .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
3137
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1));
3138
+ }
3139
+ .pro-form .pro-form-item-add .pro-form-view-container {
3140
+ padding: 4px 8px;
3141
+ background: var(--add-tip-color, var(--zaui-contract-bg, #fffaa1));
3101
3142
  border-radius: 4px;
3102
3143
  }
3103
3144
  .pro-upload .pro-upload-dragger .pro-upload-handle-box {
@@ -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?: (preValue: any, curValue: any) => boolean | undefined;
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 _useProConfig = useProConfig('ProEditTable'),
82
- isDiffAll = _useProConfig.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 isChanged = useMemo(function () {
97
- if (!isWatch || noChange) return false;
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: isChanged ? 'pro-form-item-changed' : '',
131
+ className: diffClassName,
125
132
  children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
126
133
  })
127
134
  });
@@ -9,11 +9,12 @@ import ProCollapse from '../../../../ProLayout/components/ProCollapse';
9
9
  import ProForm from '../../../../ProForm';
10
10
  var Container = function Container(props) {
11
11
  var children = props.children,
12
- otherProps = props.otherProps,
13
12
  className = props.className,
14
13
  container = props.container,
15
14
  show = props.show,
16
- clearNotShow = props.clearNotShow;
15
+ clearNotShow = props.clearNotShow,
16
+ diffConfig = props.diffConfig,
17
+ otherProps = props.otherProps;
17
18
  var _ref = ProForm.useFieldProps() || {},
18
19
  type = _ref.type,
19
20
  form = _ref.form,
@@ -38,7 +39,8 @@ var Container = function Container(props) {
38
39
  var childRender = function childRender() {
39
40
  var child = _jsx(RenderFields, _objectSpread({
40
41
  columns: _children,
41
- form: form
42
+ form: form,
43
+ diffConfig: diffConfig
42
44
  }, otherProps));
43
45
  if (type === 'ProCollapse') {
44
46
  return _jsx(ProCollapse, _objectSpread(_objectSpread({}, omit(props, ['otherProps', 'children', 'onBlur', 'onChange', 'placeholder', 'className'])), {}, {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { RowProps } from 'antd';
3
- import { ProColumnProps, ProFormOtherProps } from '../../../propsType';
3
+ import { ProColumnProps, ProFormOtherProps, DiffConfigProps } from '../../../propsType';
4
4
  export interface ContainerProps {
5
5
  children?: ProColumnProps[];
6
6
  otherProps?: ProFormOtherProps;
@@ -8,5 +8,6 @@ export interface ContainerProps {
8
8
  className?: string;
9
9
  container?: string | React.ReactNode;
10
10
  show?: boolean | (() => boolean);
11
+ diffConfig?: DiffConfigProps;
11
12
  clearNotShow?: boolean;
12
13
  }
@@ -91,7 +91,9 @@ var ProNumberRange = function ProNumberRange(props) {
91
91
  });
92
92
  // 查看模式
93
93
  if (isView || props.isView) {
94
- if (isEmpty(value)) {
94
+ if (isEmpty(value) || (value === null || value === void 0 ? void 0 : value.every(function (item) {
95
+ return typeof item !== 'number';
96
+ }))) {
95
97
  return viewEmpty;
96
98
  }
97
99
  switch (valueType) {
@@ -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?: (preValue: any, curValue: any) => boolean | undefined;
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';
@@ -24,7 +25,11 @@ var ChangedWrapper = function ChangedWrapper(props) {
24
25
  rest = _objectWithoutProperties(props, _excluded);
25
26
  var _useProConfig = useProConfig('ProForm'),
26
27
  isDiffAll = _useProConfig.isDiffAll;
27
- var originalValues = diffConfig.originalValues;
28
+ var originalValues = diffConfig.originalValues,
29
+ _diffConfig$changeTip = diffConfig.changeTipColor,
30
+ changeTipColor = _diffConfig$changeTip === void 0 ? '#fffaa1' : _diffConfig$changeTip,
31
+ _diffConfig$addTipCol = diffConfig.addTipColor,
32
+ addTipColor = _diffConfig$addTipCol === void 0 ? '#d2fff4' : _diffConfig$addTipCol;
28
33
  var toolTip = (_diffConfig$toolTip = diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
29
34
  // 不渲染tooltip
30
35
  var isWatch = toolTip && !['FormList', 'ProEditTable'].includes(type);
@@ -32,8 +37,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
32
37
  return get(originalValues, name);
33
38
  }) : get(originalValues, name);
34
39
  var noChange = !equalWith && (!originalValues || isDiffAll ? false : isEmpty(originalValue));
35
- var isChanged = useMemo(function () {
36
- if (!isWatch || noChange) return false;
40
+ var diffType = useMemo(function () {
41
+ if (!isWatch || noChange) return 'same';
37
42
  return diffOriginal({
38
43
  originalValue: originalValue,
39
44
  value: props.value,
@@ -42,6 +47,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
42
47
  // name: namesStr || name,
43
48
  });
44
49
  }, [isWatch, noChange, props.value, originalValue]);
50
+ var isAdd = diffType === 'add';
51
+ var isChanged = diffType === 'changed';
45
52
  var tipContent = useMemo(function () {
46
53
  if (!isWatch || noChange) return undefined;
47
54
  return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, {
@@ -54,12 +61,18 @@ var ChangedWrapper = function ChangedWrapper(props) {
54
61
  return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
55
62
  }
56
63
  var tipOpenCalc = function tipOpenCalc() {
57
- if (!toolTip) {
58
- return false;
59
- }
64
+ if (!toolTip) return false;
60
65
  // 传入undefined 鼠标移入显示移出隐藏
61
66
  return isChanged ? undefined : false;
62
67
  };
68
+ var style = {
69
+ '--change-tip-color': changeTipColor || '@zaui-contract-bg',
70
+ '--add-tip-color': addTipColor || '@zaui-contract-bg'
71
+ };
72
+ var diffClassName = classNames({
73
+ 'pro-form-item-changed': isChanged,
74
+ 'pro-form-item-add': isAdd
75
+ });
63
76
  return _jsx(_Tooltip, {
64
77
  open: tipOpenCalc(),
65
78
  getPopupContainer: function getPopupContainer(target) {
@@ -70,7 +83,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
70
83
  }),
71
84
  placement: "topLeft",
72
85
  children: _jsx("div", {
73
- className: isChanged ? 'pro-form-item-changed' : '',
86
+ className: diffClassName,
87
+ style: style,
74
88
  children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
75
89
  })
76
90
  });
@@ -153,6 +153,7 @@ var RenderFields = function RenderFields(props) {
153
153
  if (['ProCollapse', 'Container'].includes(_type)) {
154
154
  componentProps.show = show;
155
155
  componentProps.clearNotShow = clearNotShow;
156
+ componentProps.diffConfig = diffConfig;
156
157
  }
157
158
  // switch与SwitchCheckbox单独添加valuePropName
158
159
  if (['Switch', 'SwitchCheckbox'].includes(_type)) {
@@ -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?: (originValue: any, currentValue: any) => boolean;
205
+ equalWith?: DiffOriginalParams['equalWith'];
205
206
  required?: boolean | boolean[] | ReactiveFunction<Values, boolean | boolean[]>;
206
207
  labelRequired?: boolean;
207
208
  toISOString?: boolean;
@@ -328,7 +328,7 @@
328
328
  .@{ant-prefix}-select .@{ant-prefix}-select-selector,
329
329
  .@{ant-prefix}-picker,
330
330
  .@{ant-prefix}-input-number {
331
- background: @zaui-contract-bg !important;
331
+ background: var(--change-tip-color, @zaui-contract-bg) !important;
332
332
 
333
333
  input {
334
334
  background: transparent !important;
@@ -340,7 +340,7 @@
340
340
 
341
341
  .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
342
342
  .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
343
- background: @zaui-contract-bg;
343
+ background: var(--change-tip-color, @zaui-contract-bg);
344
344
  border-radius: 4px;
345
345
  }
346
346
 
@@ -350,26 +350,79 @@
350
350
  & > span {
351
351
  border-radius: 4px;
352
352
  padding: 5px 8px;
353
- background: @zaui-contract-bg;
353
+ background: var(--change-tip-color, @zaui-contract-bg);
354
354
  }
355
355
 
356
356
  & > .pro-address {
357
357
  .@{ant-prefix}-select-selector,
358
358
  .@{ant-prefix}-input-affix-wrapper,
359
359
  .@{ant-prefix}-input-disabled {
360
- background: @zaui-contract-bg;
360
+ background: var(--change-tip-color, @zaui-contract-bg);
361
361
  }
362
362
  }
363
363
  & > .@{ant-prefix}-input-group {
364
364
  .forever-checkbox {
365
- background: @zaui-contract-bg;
365
+ background: var(--change-tip-color, @zaui-contract-bg);
366
366
  }
367
367
  }
368
368
  }
369
369
 
370
370
  .pro-form-view-container {
371
371
  padding: 4px 8px;
372
- background: @zaui-contract-bg;
372
+ background: var(--change-tip-color, @zaui-contract-bg);
373
+ border-radius: 4px;
374
+ }
375
+ }
376
+
377
+
378
+ // 比较原始值场景下 不同时的样式
379
+ .pro-form-item-add {
380
+ span.@{ant-prefix}-input-affix-wrapper,
381
+ .@{ant-prefix}-select .@{ant-prefix}-select-selector,
382
+ .@{ant-prefix}-picker,
383
+ .@{ant-prefix}-input-number {
384
+ background: var(--add-tip-color, @zaui-contract-bg) !important;
385
+
386
+ input {
387
+ background: transparent !important;
388
+ }
389
+ .@{ant-prefix}-select-selection-placeholder {
390
+ z-index: 9;
391
+ }
392
+ }
393
+
394
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
395
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
396
+ background: var(--add-tip-color, @zaui-contract-bg);
397
+ border-radius: 4px;
398
+ }
399
+
400
+ // 地址组件
401
+ .@{ant-prefix}-form-item-control-input-content {
402
+ // 查看模式
403
+ & > span {
404
+ border-radius: 4px;
405
+ padding: 5px 8px;
406
+ background: var(--add-tip-color, @zaui-contract-bg);
407
+ }
408
+
409
+ & > .pro-address {
410
+ .@{ant-prefix}-select-selector,
411
+ .@{ant-prefix}-input-affix-wrapper,
412
+ .@{ant-prefix}-input-disabled {
413
+ background: var(--add-tip-color, @zaui-contract-bg);
414
+ }
415
+ }
416
+ & > .@{ant-prefix}-input-group {
417
+ .forever-checkbox {
418
+ background: var(--add-tip-color, @zaui-contract-bg);
419
+ }
420
+ }
421
+ }
422
+
423
+ .pro-form-view-container {
424
+ padding: 4px 8px;
425
+ background: var(--add-tip-color, @zaui-contract-bg);
373
426
  border-radius: 4px;
374
427
  }
375
428
  }
@@ -1,9 +1,9 @@
1
1
  import { FormInstance } from 'antd';
2
- interface Params {
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 declare const diffOriginal: (params: Params) => boolean;
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
- return !equalWith(originalValue, value);
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
- return originalValue.some(function (valueItem, index) {
22
+ var isSame = originalValue.every(function (valueItem, index) {
13
23
  // 如果两个值有一个不是空值, 则进行深比较
14
- if (!nullValue.includes(value === null || value === void 0 ? void 0 : value[index]) || !nullValue.includes(valueItem)) {
15
- return !isEqual(value === null || value === void 0 ? void 0 : value[index], valueItem);
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 false;
27
+ return true;
18
28
  });
29
+ return isSame ? 'same' : 'changed';
19
30
  }
20
31
  if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
21
- return !isEqual(value, originalValue);
32
+ return isEqual(value, originalValue) ? 'same' : 'changed';
22
33
  }
23
- return false;
34
+ return 'same';
24
35
  };
@@ -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?: (preValue: any, curValue: any) => boolean | undefined;
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 _useProConfig = (0, _ProConfigProvider.useProConfig)('ProEditTable'),
87
- isDiffAll = _useProConfig.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 isChanged = (0, _react.useMemo)(function () {
102
- if (!isWatch || noChange) return false;
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: isChanged ? 'pro-form-item-changed' : '',
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
  });
@@ -16,11 +16,12 @@ var _ProCollapse = _interopRequireDefault(require("../../../../ProLayout/compone
16
16
  var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
17
17
  var Container = function Container(props) {
18
18
  var children = props.children,
19
- otherProps = props.otherProps,
20
19
  className = props.className,
21
20
  container = props.container,
22
21
  show = props.show,
23
- clearNotShow = props.clearNotShow;
22
+ clearNotShow = props.clearNotShow,
23
+ diffConfig = props.diffConfig,
24
+ otherProps = props.otherProps;
24
25
  var _ref = _ProForm.default.useFieldProps() || {},
25
26
  type = _ref.type,
26
27
  form = _ref.form,
@@ -45,7 +46,8 @@ var Container = function Container(props) {
45
46
  var childRender = function childRender() {
46
47
  var child = (0, _jsxRuntime.jsx)(_RenderFields.default, (0, _objectSpread2.default)({
47
48
  columns: _children,
48
- form: form
49
+ form: form,
50
+ diffConfig: diffConfig
49
51
  }, otherProps));
50
52
  if (type === 'ProCollapse') {
51
53
  return (0, _jsxRuntime.jsx)(_ProCollapse.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(props, ['otherProps', 'children', 'onBlur', 'onChange', 'placeholder', 'className'])), {}, {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { RowProps } from 'antd';
3
- import { ProColumnProps, ProFormOtherProps } from '../../../propsType';
3
+ import { ProColumnProps, ProFormOtherProps, DiffConfigProps } from '../../../propsType';
4
4
  export interface ContainerProps {
5
5
  children?: ProColumnProps[];
6
6
  otherProps?: ProFormOtherProps;
@@ -8,5 +8,6 @@ export interface ContainerProps {
8
8
  className?: string;
9
9
  container?: string | React.ReactNode;
10
10
  show?: boolean | (() => boolean);
11
+ diffConfig?: DiffConfigProps;
11
12
  clearNotShow?: boolean;
12
13
  }
@@ -95,7 +95,9 @@ var ProNumberRange = function ProNumberRange(props) {
95
95
  });
96
96
  // 查看模式
97
97
  if (isView || props.isView) {
98
- if ((0, _lodash.isEmpty)(value)) {
98
+ if ((0, _lodash.isEmpty)(value) || (value === null || value === void 0 ? void 0 : value.every(function (item) {
99
+ return typeof item !== 'number';
100
+ }))) {
99
101
  return viewEmpty;
100
102
  }
101
103
  switch (valueType) {
@@ -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?: (preValue: any, curValue: any) => boolean | undefined;
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");
@@ -29,7 +30,11 @@ var ChangedWrapper = function ChangedWrapper(props) {
29
30
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
30
31
  var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
31
32
  isDiffAll = _useProConfig.isDiffAll;
32
- var originalValues = diffConfig.originalValues;
33
+ var originalValues = diffConfig.originalValues,
34
+ _diffConfig$changeTip = diffConfig.changeTipColor,
35
+ changeTipColor = _diffConfig$changeTip === void 0 ? '#fffaa1' : _diffConfig$changeTip,
36
+ _diffConfig$addTipCol = diffConfig.addTipColor,
37
+ addTipColor = _diffConfig$addTipCol === void 0 ? '#d2fff4' : _diffConfig$addTipCol;
33
38
  var toolTip = (_diffConfig$toolTip = diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
34
39
  // 不渲染tooltip
35
40
  var isWatch = toolTip && !['FormList', 'ProEditTable'].includes(type);
@@ -37,8 +42,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
37
42
  return (0, _lodash.get)(originalValues, name);
38
43
  }) : (0, _lodash.get)(originalValues, name);
39
44
  var noChange = !equalWith && (!originalValues || isDiffAll ? false : (0, _utils.isEmpty)(originalValue));
40
- var isChanged = (0, _react.useMemo)(function () {
41
- if (!isWatch || noChange) return false;
45
+ var diffType = (0, _react.useMemo)(function () {
46
+ if (!isWatch || noChange) return 'same';
42
47
  return (0, _diffOriginal.diffOriginal)({
43
48
  originalValue: originalValue,
44
49
  value: props.value,
@@ -47,6 +52,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
47
52
  // name: namesStr || name,
48
53
  });
49
54
  }, [isWatch, noChange, props.value, originalValue]);
55
+ var isAdd = diffType === 'add';
56
+ var isChanged = diffType === 'changed';
50
57
  var tipContent = (0, _react.useMemo)(function () {
51
58
  if (!isWatch || noChange) return undefined;
52
59
  return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), {}, {
@@ -59,12 +66,18 @@ var ChangedWrapper = function ChangedWrapper(props) {
59
66
  return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest));
60
67
  }
61
68
  var tipOpenCalc = function tipOpenCalc() {
62
- if (!toolTip) {
63
- return false;
64
- }
69
+ if (!toolTip) return false;
65
70
  // 传入undefined 鼠标移入显示移出隐藏
66
71
  return isChanged ? undefined : false;
67
72
  };
73
+ var style = {
74
+ '--change-tip-color': changeTipColor || '@zaui-contract-bg',
75
+ '--add-tip-color': addTipColor || '@zaui-contract-bg'
76
+ };
77
+ var diffClassName = (0, _classnames.default)({
78
+ 'pro-form-item-changed': isChanged,
79
+ 'pro-form-item-add': isAdd
80
+ });
68
81
  return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
69
82
  open: tipOpenCalc(),
70
83
  getPopupContainer: function getPopupContainer(target) {
@@ -75,7 +88,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
75
88
  }),
76
89
  placement: "topLeft",
77
90
  children: (0, _jsxRuntime.jsx)("div", {
78
- className: isChanged ? 'pro-form-item-changed' : '',
91
+ className: diffClassName,
92
+ style: style,
79
93
  children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest)) : undefined
80
94
  })
81
95
  });
@@ -161,6 +161,7 @@ var RenderFields = function RenderFields(props) {
161
161
  if (['ProCollapse', 'Container'].includes(_type)) {
162
162
  componentProps.show = show;
163
163
  componentProps.clearNotShow = clearNotShow;
164
+ componentProps.diffConfig = diffConfig;
164
165
  }
165
166
  // switch与SwitchCheckbox单独添加valuePropName
166
167
  if (['Switch', 'SwitchCheckbox'].includes(_type)) {
@@ -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?: (originValue: any, currentValue: any) => boolean;
205
+ equalWith?: DiffOriginalParams['equalWith'];
205
206
  required?: boolean | boolean[] | ReactiveFunction<Values, boolean | boolean[]>;
206
207
  labelRequired?: boolean;
207
208
  toISOString?: boolean;
@@ -328,7 +328,7 @@
328
328
  .@{ant-prefix}-select .@{ant-prefix}-select-selector,
329
329
  .@{ant-prefix}-picker,
330
330
  .@{ant-prefix}-input-number {
331
- background: @zaui-contract-bg !important;
331
+ background: var(--change-tip-color, @zaui-contract-bg) !important;
332
332
 
333
333
  input {
334
334
  background: transparent !important;
@@ -340,7 +340,7 @@
340
340
 
341
341
  .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
342
342
  .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
343
- background: @zaui-contract-bg;
343
+ background: var(--change-tip-color, @zaui-contract-bg);
344
344
  border-radius: 4px;
345
345
  }
346
346
 
@@ -350,26 +350,79 @@
350
350
  & > span {
351
351
  border-radius: 4px;
352
352
  padding: 5px 8px;
353
- background: @zaui-contract-bg;
353
+ background: var(--change-tip-color, @zaui-contract-bg);
354
354
  }
355
355
 
356
356
  & > .pro-address {
357
357
  .@{ant-prefix}-select-selector,
358
358
  .@{ant-prefix}-input-affix-wrapper,
359
359
  .@{ant-prefix}-input-disabled {
360
- background: @zaui-contract-bg;
360
+ background: var(--change-tip-color, @zaui-contract-bg);
361
361
  }
362
362
  }
363
363
  & > .@{ant-prefix}-input-group {
364
364
  .forever-checkbox {
365
- background: @zaui-contract-bg;
365
+ background: var(--change-tip-color, @zaui-contract-bg);
366
366
  }
367
367
  }
368
368
  }
369
369
 
370
370
  .pro-form-view-container {
371
371
  padding: 4px 8px;
372
- background: @zaui-contract-bg;
372
+ background: var(--change-tip-color, @zaui-contract-bg);
373
+ border-radius: 4px;
374
+ }
375
+ }
376
+
377
+
378
+ // 比较原始值场景下 不同时的样式
379
+ .pro-form-item-add {
380
+ span.@{ant-prefix}-input-affix-wrapper,
381
+ .@{ant-prefix}-select .@{ant-prefix}-select-selector,
382
+ .@{ant-prefix}-picker,
383
+ .@{ant-prefix}-input-number {
384
+ background: var(--add-tip-color, @zaui-contract-bg) !important;
385
+
386
+ input {
387
+ background: transparent !important;
388
+ }
389
+ .@{ant-prefix}-select-selection-placeholder {
390
+ z-index: 9;
391
+ }
392
+ }
393
+
394
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
395
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
396
+ background: var(--add-tip-color, @zaui-contract-bg);
397
+ border-radius: 4px;
398
+ }
399
+
400
+ // 地址组件
401
+ .@{ant-prefix}-form-item-control-input-content {
402
+ // 查看模式
403
+ & > span {
404
+ border-radius: 4px;
405
+ padding: 5px 8px;
406
+ background: var(--add-tip-color, @zaui-contract-bg);
407
+ }
408
+
409
+ & > .pro-address {
410
+ .@{ant-prefix}-select-selector,
411
+ .@{ant-prefix}-input-affix-wrapper,
412
+ .@{ant-prefix}-input-disabled {
413
+ background: var(--add-tip-color, @zaui-contract-bg);
414
+ }
415
+ }
416
+ & > .@{ant-prefix}-input-group {
417
+ .forever-checkbox {
418
+ background: var(--add-tip-color, @zaui-contract-bg);
419
+ }
420
+ }
421
+ }
422
+
423
+ .pro-form-view-container {
424
+ padding: 4px 8px;
425
+ background: var(--add-tip-color, @zaui-contract-bg);
373
426
  border-radius: 4px;
374
427
  }
375
428
  }
@@ -1,9 +1,9 @@
1
1
  import { FormInstance } from 'antd';
2
- interface Params {
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 declare const diffOriginal: (params: Params) => boolean;
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
- return !equalWith(originalValue, value);
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
- return originalValue.some(function (valueItem, index) {
28
+ var isSame = originalValue.every(function (valueItem, index) {
19
29
  // 如果两个值有一个不是空值, 则进行深比较
20
- if (!nullValue.includes(value === null || value === void 0 ? void 0 : value[index]) || !nullValue.includes(valueItem)) {
21
- return !(0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
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 false;
33
+ return true;
24
34
  });
35
+ return isSame ? 'same' : 'changed';
25
36
  }
26
37
  if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
27
- return !(0, _lodash.isEqual)(value, originalValue);
38
+ return (0, _lodash.isEqual)(value, originalValue) ? 'same' : 'changed';
28
39
  }
29
- return false;
40
+ return 'same';
30
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.7.3-beta.3",
3
+ "version": "3.7.3-beta.5",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",