@zat-design/sisyphus-react 3.6.10-beta.4 → 3.6.11

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