@zat-design/sisyphus-react 3.8.3 → 3.9.0

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 (68) hide show
  1. package/.vscode/extensions.json +5 -0
  2. package/dist/index.esm.css +38 -3
  3. package/dist/less.esm.css +37 -2
  4. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +83 -20
  5. package/es/ProEditTable/components/RenderField/index.js +6 -2
  6. package/es/ProEditTable/index.js +18 -9
  7. package/es/ProEditTable/propsType.d.ts +3 -6
  8. package/es/ProEditTable/style/index.less +0 -1
  9. package/es/ProEditTable/utils/index.js +10 -3
  10. package/es/ProForm/components/base/InputNumber/index.js +1 -1
  11. package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  12. package/es/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
  13. package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
  14. package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  15. package/es/ProForm/components/combination/FormList/index.js +14 -3
  16. package/es/ProForm/components/combination/Group/index.js +3 -4
  17. package/es/ProForm/components/combination/ProCascader/index.js +21 -14
  18. package/es/ProForm/components/combination/ProModalSelect/index.js +17 -3
  19. package/es/ProForm/components/render/ChangedWrapper.js +29 -10
  20. package/es/ProForm/components/render/Render.js +3 -1
  21. package/es/ProForm/components/render/RenderFields.js +4 -2
  22. package/es/ProForm/propsType.d.ts +3 -0
  23. package/es/ProForm/style/index.less +35 -9
  24. package/es/ProForm/utils/diffOriginal.js +14 -2
  25. package/es/ProForm/utils/useShouldUpdate.js +1 -9
  26. package/es/ProTable/components/FormatColumn/index.d.ts +2 -1
  27. package/es/ProTable/components/FormatColumn/index.js +107 -29
  28. package/es/ProTable/components/RenderColumn/index.d.ts +1 -0
  29. package/es/ProTable/components/RenderColumn/index.js +23 -6
  30. package/es/ProTable/index.js +8 -7
  31. package/es/ProTable/propsType.d.ts +4 -0
  32. package/es/ProTable/style/index.less +14 -0
  33. package/es/style/theme/antd.less +1 -1
  34. package/es/utils/index.d.ts +1 -0
  35. package/es/utils/index.js +26 -0
  36. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +82 -21
  37. package/lib/ProEditTable/components/RenderField/index.js +6 -2
  38. package/lib/ProEditTable/index.js +18 -9
  39. package/lib/ProEditTable/propsType.d.ts +3 -6
  40. package/lib/ProEditTable/style/index.less +0 -1
  41. package/lib/ProEditTable/utils/index.js +10 -3
  42. package/lib/ProForm/components/base/InputNumber/index.js +1 -1
  43. package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  44. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
  45. package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
  46. package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  47. package/lib/ProForm/components/combination/FormList/index.js +14 -3
  48. package/lib/ProForm/components/combination/Group/index.js +3 -4
  49. package/lib/ProForm/components/combination/ProCascader/index.js +21 -14
  50. package/lib/ProForm/components/combination/ProModalSelect/index.js +17 -3
  51. package/lib/ProForm/components/render/ChangedWrapper.js +29 -10
  52. package/lib/ProForm/components/render/Render.js +3 -1
  53. package/lib/ProForm/components/render/RenderFields.js +4 -2
  54. package/lib/ProForm/propsType.d.ts +3 -0
  55. package/lib/ProForm/style/index.less +35 -9
  56. package/lib/ProForm/utils/diffOriginal.js +13 -1
  57. package/lib/ProForm/utils/useShouldUpdate.js +1 -9
  58. package/lib/ProTable/components/FormatColumn/index.d.ts +2 -1
  59. package/lib/ProTable/components/FormatColumn/index.js +107 -29
  60. package/lib/ProTable/components/RenderColumn/index.d.ts +1 -0
  61. package/lib/ProTable/components/RenderColumn/index.js +20 -5
  62. package/lib/ProTable/index.js +8 -7
  63. package/lib/ProTable/propsType.d.ts +4 -0
  64. package/lib/ProTable/style/index.less +14 -0
  65. package/lib/style/theme/antd.less +1 -1
  66. package/lib/utils/index.d.ts +1 -0
  67. package/lib/utils/index.js +28 -1
  68. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ {
2
+ "recommendations": [
3
+ "kisstkondoros.vscode-codemetrics"
4
+ ]
5
+ }
@@ -1914,6 +1914,16 @@
1914
1914
  background: var(--zaui-contract-bg, #fffaa1) !important;
1915
1915
  border-radius: var(--zaui-border-radius, 8px);
1916
1916
  }
1917
+ .pro-table tbody.ant-table-tbody .ant-table-cell .varied-cell .pro-form-view-container {
1918
+ overflow: hidden;
1919
+ white-space: nowrap;
1920
+ text-overflow: ellipsis;
1921
+ }
1922
+ .pro-table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container {
1923
+ overflow: hidden;
1924
+ white-space: nowrap;
1925
+ text-overflow: ellipsis;
1926
+ }
1917
1927
  .pro-table tbody.ant-table-tbody .varied-cell.empty-cell {
1918
1928
  width: 24.5px;
1919
1929
  }
@@ -2823,6 +2833,12 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2823
2833
  display: unset;
2824
2834
  visibility: hidden;
2825
2835
  }
2836
+ .pro-form.pro-form-view .pro-group .ant-space-item,
2837
+ .pro-form.pro-form-view .pro-group .pro-form-view-container {
2838
+ width: -webkit-max-content;
2839
+ width: -moz-max-content;
2840
+ width: max-content;
2841
+ }
2826
2842
  .pro-form.pro-form-view .ant-form-item-label label {
2827
2843
  color: var(--zaui-aide-text, #939599);
2828
2844
  }
@@ -3029,6 +3045,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3029
3045
  border-radius: 4px;
3030
3046
  background: var(--zaui-contract-bg, #fffaa1) !important;
3031
3047
  }
3048
+ .pro-form .pro-form-item-changed .ant-input {
3049
+ background: var(--zaui-contract-bg, #fffaa1) !important;
3050
+ }
3032
3051
  .pro-form .pro-form-item-changed .ant-select.ant-select-disabled .ant-select-selector {
3033
3052
  background: var(--zaui-contract-bg, #fffaa1) !important;
3034
3053
  }
@@ -3086,6 +3105,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3086
3105
  border-radius: 4px;
3087
3106
  background: var(--zaui-contract-bg-add, #d2fff4) !important;
3088
3107
  }
3108
+ .pro-form .pro-form-item-add .ant-input {
3109
+ background: var(--zaui-contract-bg, #fffaa1) !important;
3110
+ }
3089
3111
  .pro-form .pro-form-item-add .ant-select.ant-select-disabled .ant-select-selector {
3090
3112
  background: var(--zaui-contract-bg-add, #d2fff4) !important;
3091
3113
  }
@@ -3139,10 +3161,23 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3139
3161
  background: var(--zaui-contract-bg-add, #d2fff4);
3140
3162
  border-radius: 4px;
3141
3163
  }
3142
- .changed-tooltip .original-value-container .ant-space-item:nth-child(1) {
3164
+ .original-value-tootip {
3165
+ max-width: 100%;
3166
+ width: -webkit-max-content;
3167
+ width: -moz-max-content;
3168
+ width: max-content;
3169
+ z-index: 99;
3170
+ }
3171
+ .original-value-tootip .changed-tooltip .original-value-container .ant-space-item:nth-child(1) {
3143
3172
  white-space: nowrap;
3144
3173
  }
3145
- .changed-tooltip .current-value-container .ant-space-item:nth-child(1) {
3174
+ .original-value-tootip .changed-tooltip .original-value-container .pro-group .ant-space-compact {
3175
+ display: block;
3176
+ }
3177
+ .original-value-tootip .changed-tooltip .original-value-container .pro-group .pro-form-view-container {
3178
+ word-break: keep-all;
3179
+ }
3180
+ .original-value-tootip .changed-tooltip .current-value-container .ant-space-item:nth-child(1) {
3146
3181
  white-space: nowrap;
3147
3182
  }
3148
3183
  .pro-upload .pro-upload-dragger .pro-upload-handle-box {
@@ -5615,7 +5650,7 @@ input[type='button'] {
5615
5650
  user-select: text;
5616
5651
  }
5617
5652
  .ant-table.ant-table-fixed-header .ant-table-tbody .ant-table-row:nth-child(even) td {
5618
- background: #ffffff !important;
5653
+ background: #ffffff;
5619
5654
  }
5620
5655
  .ant-table.ant-table-fixed-header .ant-table-tbody .ant-table-row:nth-child(odd) {
5621
5656
  background-color: var(--zaui-table-strip-bg, #fafafa);
package/dist/less.esm.css CHANGED
@@ -1914,6 +1914,16 @@
1914
1914
  background: var(--zaui-contract-bg, #fffaa1) !important;
1915
1915
  border-radius: var(--zaui-border-radius, 8px);
1916
1916
  }
1917
+ .pro-table tbody.ant-table-tbody .ant-table-cell .varied-cell .pro-form-view-container {
1918
+ overflow: hidden;
1919
+ white-space: nowrap;
1920
+ text-overflow: ellipsis;
1921
+ }
1922
+ .pro-table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container {
1923
+ overflow: hidden;
1924
+ white-space: nowrap;
1925
+ text-overflow: ellipsis;
1926
+ }
1917
1927
  .pro-table tbody.ant-table-tbody .varied-cell.empty-cell {
1918
1928
  width: 24.5px;
1919
1929
  }
@@ -2823,6 +2833,12 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2823
2833
  display: unset;
2824
2834
  visibility: hidden;
2825
2835
  }
2836
+ .pro-form.pro-form-view .pro-group .ant-space-item,
2837
+ .pro-form.pro-form-view .pro-group .pro-form-view-container {
2838
+ width: -webkit-max-content;
2839
+ width: -moz-max-content;
2840
+ width: max-content;
2841
+ }
2826
2842
  .pro-form.pro-form-view .ant-form-item-label label {
2827
2843
  color: var(--zaui-aide-text, #939599);
2828
2844
  }
@@ -3029,6 +3045,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3029
3045
  border-radius: 4px;
3030
3046
  background: var(--zaui-contract-bg, #fffaa1) !important;
3031
3047
  }
3048
+ .pro-form .pro-form-item-changed .ant-input {
3049
+ background: var(--zaui-contract-bg, #fffaa1) !important;
3050
+ }
3032
3051
  .pro-form .pro-form-item-changed .ant-select.ant-select-disabled .ant-select-selector {
3033
3052
  background: var(--zaui-contract-bg, #fffaa1) !important;
3034
3053
  }
@@ -3086,6 +3105,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3086
3105
  border-radius: 4px;
3087
3106
  background: var(--zaui-contract-bg-add, #d2fff4) !important;
3088
3107
  }
3108
+ .pro-form .pro-form-item-add .ant-input {
3109
+ background: var(--zaui-contract-bg, #fffaa1) !important;
3110
+ }
3089
3111
  .pro-form .pro-form-item-add .ant-select.ant-select-disabled .ant-select-selector {
3090
3112
  background: var(--zaui-contract-bg-add, #d2fff4) !important;
3091
3113
  }
@@ -3139,10 +3161,23 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3139
3161
  background: var(--zaui-contract-bg-add, #d2fff4);
3140
3162
  border-radius: 4px;
3141
3163
  }
3142
- .changed-tooltip .original-value-container .ant-space-item:nth-child(1) {
3164
+ .original-value-tootip {
3165
+ max-width: 100%;
3166
+ width: -webkit-max-content;
3167
+ width: -moz-max-content;
3168
+ width: max-content;
3169
+ z-index: 99;
3170
+ }
3171
+ .original-value-tootip .changed-tooltip .original-value-container .ant-space-item:nth-child(1) {
3143
3172
  white-space: nowrap;
3144
3173
  }
3145
- .changed-tooltip .current-value-container .ant-space-item:nth-child(1) {
3174
+ .original-value-tootip .changed-tooltip .original-value-container .pro-group .ant-space-compact {
3175
+ display: block;
3176
+ }
3177
+ .original-value-tootip .changed-tooltip .original-value-container .pro-group .pro-form-view-container {
3178
+ word-break: keep-all;
3179
+ }
3180
+ .original-value-tootip .changed-tooltip .current-value-container .ant-space-item:nth-child(1) {
3146
3181
  white-space: nowrap;
3147
3182
  }
3148
3183
  .pro-upload .pro-upload-dragger .pro-upload-handle-box {
@@ -1,13 +1,13 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  import "antd/es/space/style";
3
2
  import _Space from "antd/es/space";
4
3
  import "antd/es/tooltip/style";
5
4
  import _Tooltip from "antd/es/tooltip";
5
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
6
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
7
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
8
- var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName"];
8
+ var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName", "viewRender", "diffConfig", "index"];
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
- import React, { useMemo } from 'react';
10
+ import React, { useMemo, useRef } from 'react';
11
11
  import classNames from 'classnames';
12
12
  import { get } from 'lodash';
13
13
  import { diffOriginal } from '../../../ProForm/utils/diffOriginal';
@@ -34,6 +34,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
34
34
  if (!originalValues) {
35
35
  return undefined;
36
36
  }
37
+ var originalValueRow;
37
38
  if (rowKeyPath) {
38
39
  var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
39
40
  var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
@@ -42,7 +43,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
42
43
  var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
43
44
  if (!keyValue) return undefined;
44
45
  var originalValueList = get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
45
- var originalValueRow = originalValueList === null || originalValueList === void 0 ? void 0 : originalValueList.find(function (item) {
46
+ originalValueRow = originalValueList === null || originalValueList === void 0 ? void 0 : originalValueList.find(function (item) {
46
47
  return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
47
48
  });
48
49
  var originalValue;
@@ -58,15 +59,21 @@ var getOriginalValue = function getOriginalValue(_ref) {
58
59
  } else {
59
60
  originalValue = get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
60
61
  }
61
- return originalValue;
62
+ return {
63
+ originalValue: originalValue,
64
+ originalValueRow: originalValueRow
65
+ };
62
66
  }
63
67
  // 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
64
- return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
65
- return get(originalValues, originalName);
66
- }) : get(originalValues, originalName);
68
+ return {
69
+ originalValue: (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
70
+ return get(originalValues, originalName);
71
+ }) : get(originalValues, originalName),
72
+ originalValueRow: originalValueRow
73
+ };
67
74
  };
68
75
  var ListChangedWrapper = function ListChangedWrapper(props) {
69
- var _getValueProps;
76
+ var _diffConfig$toolTip, _children$props, _children$props2, _children$props3;
70
77
  var name = props.name,
71
78
  names = props.names,
72
79
  namesStr = props.namesStr,
@@ -84,21 +91,30 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
84
91
  getValueProps = props.getValueProps,
85
92
  _props$valuePropName = props.valuePropName,
86
93
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
94
+ viewRender = props.viewRender,
95
+ diffConfig = props.diffConfig,
96
+ index = props.index,
87
97
  rest = _objectWithoutProperties(props, _excluded);
88
98
  var _ref2 = useProConfig('ProEditTable') || {},
89
99
  isDiffAll = _ref2.isDiffAll;
100
+ var _ref3 = diffConfig || {},
101
+ _ref3$scrollFollowPar = _ref3.scrollFollowParent,
102
+ scrollFollowParent = _ref3$scrollFollowPar === void 0 ? true : _ref3$scrollFollowPar;
103
+ var contentRef = useRef(null);
90
104
  var namePath = toNamePath(namesStr || name);
91
105
  var originalNamePath = toNamePath(originalName);
92
106
  var originalNamePaths = originalNames && toNamePaths(originalNames);
107
+ var toolTip = (_diffConfig$toolTip = diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
93
108
  var isWatch = Boolean(originalValues);
94
- var originalValue = isWatch ? getOriginalValue({
109
+ var originalDTO = getOriginalValue({
95
110
  namePath: namePath,
96
111
  originalName: originalNamePath,
97
112
  originalNames: originalNamePaths,
98
113
  originalValues: originalValues,
99
114
  rowKeyPath: rowKeyPath,
100
115
  form: form
101
- }) : undefined;
116
+ });
117
+ var originalValue = isWatch ? originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originalValue : undefined;
102
118
  var noChange = !equalWith && (!originalValues || isDiffAll ? false : isEmpty(originalValue));
103
119
  var diffType = useMemo(function () {
104
120
  if (!isWatch || noChange) return 'same';
@@ -113,28 +129,75 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
113
129
  }, [props[valuePropName], originalValue]);
114
130
  var isAdd = diffType === 'add';
115
131
  var isChanged = diffType === 'changed';
132
+ var tipContent = useMemo(function () {
133
+ var _getValueProps;
134
+ if (!isWatch || noChange) return undefined;
135
+ var orgValue = getValueProps && !names ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : originalValue;
136
+ // 兼容viewRender函数和Element场景
137
+ var _children = children;
138
+ if (viewRender) {
139
+ if (! /*#__PURE__*/React.isValidElement(viewRender)) {
140
+ return viewRender(orgValue, (originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originalValueRow) || {}, {
141
+ form: form,
142
+ name: name,
143
+ index: index
144
+ });
145
+ }
146
+ _children = viewRender;
147
+ }
148
+ return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children), {}, _defineProperty(_defineProperty({
149
+ // @ts-ignore
150
+ isView: true
151
+ }, valuePropName, orgValue), "checked", type === 'Switch' ? originalValue : undefined))) : undefined;
152
+ }, [originalValue, children]);
116
153
  if (!isWatch || noChange) {
117
154
  return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
118
155
  }
156
+ // eslint-disable-next-line react-hooks/rules-of-hooks
157
+ // const isFocus = useFocus(contentRef.current);
158
+ var tipOpenCalc = function tipOpenCalc() {
159
+ if (!toolTip) return false;
160
+ // 传入undefined 鼠标移入显示移出隐藏
161
+ return isChanged ? undefined : false;
162
+ };
163
+ // @ts-ignore
164
+ var _showEllipse = ((_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.showEllipse) || ((_children$props2 = children.props) === null || _children$props2 === void 0 ? void 0 : _children$props2.tooltip);
119
165
  var diffClassName = classNames({
120
166
  'pro-form-item-changed': isChanged,
121
167
  'pro-form-item-add': isAdd
122
168
  });
169
+ var open = tipOpenCalc();
123
170
  return _jsx(_Tooltip, {
124
- // 传入undefined 鼠标移入显示移出隐藏
125
- open: isChanged ? undefined : false,
126
- getPopupContainer: function getPopupContainer(target) {
127
- return target.parentElement;
171
+ open: open,
172
+ getPopupContainer: function getPopupContainer(trigger) {
173
+ return scrollFollowParent ? trigger.parentElement : document.body;
128
174
  },
175
+ overlayClassName: "original-value-tootip",
176
+ placement: "topLeft",
177
+ autoAdjustOverflow: false,
129
178
  title: _jsxs(_Space, {
130
- children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children), {}, _defineProperty(_defineProperty({
131
- // @ts-ignore
132
- isView: true
133
- }, valuePropName, getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : props[valuePropName]), "checked", type === 'Switch' ? originalValue : undefined))) : undefined]
179
+ direction: "vertical",
180
+ className: "changed-tooltip",
181
+ children: [_jsxs(_Space, {
182
+ align: "start",
183
+ className: "original-value-container",
184
+ children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
185
+ }), _showEllipse && _jsxs(_Space, {
186
+ className: "current-value-container",
187
+ children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
188
+ isView: true,
189
+ scrollFollowParent: scrollFollowParent
190
+ })) : undefined]
191
+ })]
134
192
  }),
135
193
  children: _jsx("div", {
136
194
  className: diffClassName,
137
- children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
195
+ children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
196
+ scrollFollowParent: scrollFollowParent,
197
+ otherProps: _objectSpread(_objectSpread({}, (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.otherProps), {}, {
198
+ isDiffChange: isChanged
199
+ })
200
+ })) : undefined
138
201
  })
139
202
  });
140
203
  };
@@ -73,7 +73,8 @@ var RenderField = function RenderField(_ref) {
73
73
  rowDisabled = config.rowDisabled,
74
74
  _config$validateTrigg = config.validateTrigger,
75
75
  validateTrigger = _config$validateTrigg === void 0 ? ['onChange', 'onBlur', 'onSubmit'] : _config$validateTrigg,
76
- otherProps = config.otherProps;
76
+ otherProps = config.otherProps,
77
+ diffConfig = config.diffConfig;
77
78
  var _fieldProps = fieldProps || formItemProps || {};
78
79
  var _rules = rules || [];
79
80
  var _required = required;
@@ -254,7 +255,7 @@ var RenderField = function RenderField(_ref) {
254
255
  if (typeof viewRender === 'function') {
255
256
  var _column$dataIndex;
256
257
  currentValue = (column === null || column === void 0 ? void 0 : (_column$dataIndex = column.dataIndex) === null || _column$dataIndex === void 0 ? void 0 : _column$dataIndex.includes('-')) ? value : currentValue;
257
- var View = viewRender(currentValue, record, options);
258
+ var View = viewRender(currentValue, record || {}, options);
258
259
  TargetComponent = _jsx(Container, {
259
260
  viewEmpty: viewEmpty,
260
261
  children: View
@@ -560,6 +561,9 @@ var RenderField = function RenderField(_ref) {
560
561
  valuePropName: _formItemProps.valuePropName,
561
562
  normalize: _formItemProps.normalize,
562
563
  getValueProps: _formItemProps.getValueProps,
564
+ viewRender: viewRender,
565
+ diffConfig: diffConfig,
566
+ index: index,
563
567
  children: FieldComponent
564
568
  });
565
569
  }
@@ -9,7 +9,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
9
9
  import "antd/es/form/style";
10
10
  import _Form from "antd/es/form";
11
11
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
12
- var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "virtual", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection"];
12
+ var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "virtual", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection", "diffConfig"];
13
13
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
15
15
  import { get, isArray, isBoolean } from 'lodash';
@@ -23,7 +23,7 @@ import Empty from '../assets/empty.png';
23
23
  import locale, { formatMessage } from '../locale';
24
24
  import { BaseTable, DraggableTable, VirtualTable } from './components/RcTable';
25
25
  var ProEditTable = function ProEditTable(_ref, ref) {
26
- var _resetProps$id, _resetProps$id$split, _themeConfig$data2;
26
+ var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _resetProps$otherProp;
27
27
  var value = _ref.value,
28
28
  onChange = _ref.onChange,
29
29
  onDrag = _ref.onDrag,
@@ -51,13 +51,13 @@ var ProEditTable = function ProEditTable(_ref, ref) {
51
51
  headerRender = _ref.headerRender,
52
52
  pagination = _ref.pagination,
53
53
  originalValues = _ref.originalValues,
54
- originalDiffTip = _ref.originalDiffTip,
55
54
  rowKey = _ref.rowKey,
56
55
  rowDisabled = _ref.rowDisabled,
57
56
  rowDraggable = _ref.rowDraggable,
58
57
  footerRender = _ref.footerRender,
59
58
  scroll = _ref.scroll,
60
59
  actionDirection = _ref.actionDirection,
60
+ diffConfig = _ref.diffConfig,
61
61
  resetProps = _objectWithoutProperties(_ref, _excluded);
62
62
  // 上下文form
63
63
  var contentForm = _Form.useFormInstance();
@@ -89,7 +89,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
89
89
  return (_ref2 = (_themeConfig$data$zau = themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data = themeConfig.data) === null || _themeConfig$data === void 0 ? void 0 : _themeConfig$data.zauiFormAlign) !== null && _themeConfig$data$zau !== void 0 ? _themeConfig$data$zau : configRequiredAlign) !== null && _ref2 !== void 0 ? _ref2 : 'left';
90
90
  }, [themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data2 = themeConfig.data) === null || _themeConfig$data2 === void 0 ? void 0 : _themeConfig$data2.zauiFormAlign]);
91
91
  var _useSetState = useSetState({
92
- _columns: columns,
93
92
  cellNamePath: [],
94
93
  forceUpdate: {},
95
94
  editingKeys: [],
@@ -167,10 +166,10 @@ var ProEditTable = function ProEditTable(_ref, ref) {
167
166
  tableLength: value === null || value === void 0 ? void 0 : value.length,
168
167
  page: page,
169
168
  originalValues: originalValues,
170
- originalDiffTip: originalDiffTip,
171
169
  prefixCls: prefixCls,
172
170
  rowDisabled: rowDisabled,
173
- actionDirection: actionDirection
171
+ actionDirection: actionDirection,
172
+ diffConfig: _objectSpread(_objectSpread({}, resetProps === null || resetProps === void 0 ? void 0 : (_resetProps$otherProp = resetProps.otherProps) === null || _resetProps$otherProp === void 0 ? void 0 : _resetProps$otherProp.diffConfig), diffConfig)
174
173
  }, resetProps);
175
174
  // 编辑行设置下样式
176
175
  var _rowClassName = function _rowClassName(record) {
@@ -275,8 +274,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
275
274
  var _columns = useMemo(function () {
276
275
  return transformColumns(columns, config);
277
276
  }, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
278
- useEffect(function () {
279
- var _value$every, _originalArr$every;
277
+ var initDataSource = function initDataSource() {
278
+ var _value$every, _originalArr$every, _value$some, _originalArr$some;
280
279
  var isAllHasKey = value === null || value === void 0 ? void 0 : (_value$every = value.every) === null || _value$every === void 0 ? void 0 : _value$every.call(value, function (item) {
281
280
  return item.rowKey;
282
281
  });
@@ -285,8 +284,15 @@ var ProEditTable = function ProEditTable(_ref, ref) {
285
284
  var isOriginalAllHasKey = originalArr ? originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$every = originalArr.every) === null || _originalArr$every === void 0 ? void 0 : _originalArr$every.call(originalArr, function (item) {
286
285
  return item.rowKey;
287
286
  }) : true;
287
+ // 检测当前rowkey是否与制定key的值是否一致,不一致,则执行覆盖
288
+ var isNeedCover = value === null || value === void 0 ? void 0 : (_value$some = value.some) === null || _value$some === void 0 ? void 0 : _value$some.call(value, function (item) {
289
+ return item.rowKey !== getRowKey(item);
290
+ });
291
+ var isNeedCoverOriginal = originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$some = originalArr.some) === null || _originalArr$some === void 0 ? void 0 : _originalArr$some.call(originalArr, function (item) {
292
+ return item.rowKey !== getRowKey(item);
293
+ });
288
294
  // 初始化默认生成row-key
289
- if ((value === null || value === void 0 ? void 0 : value.length) && !isAllHasKey || (originalArr === null || originalArr === void 0 ? void 0 : originalArr.length) && !isOriginalAllHasKey) {
295
+ if ((value === null || value === void 0 ? void 0 : value.length) && (!isAllHasKey || isNeedCover) || (originalArr === null || originalArr === void 0 ? void 0 : originalArr.length) && (!isOriginalAllHasKey || isNeedCoverOriginal)) {
290
296
  var _originalArr$forEach;
291
297
  var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
292
298
  return _objectSpread(_objectSpread({}, item), {}, {
@@ -301,6 +307,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
301
307
  form.setFieldValue(virtualRowName, nextValues);
302
308
  }
303
309
  }
310
+ };
311
+ useEffect(function () {
312
+ initDataSource();
304
313
  }, [value, originalValues]);
305
314
  useImperativeHandle((resetProps === null || resetProps === void 0 ? void 0 : resetProps.ref) || ref, function () {
306
315
  return {
@@ -109,7 +109,6 @@ export interface ProColumnsProps<Values = any, T = any> extends Omit<FormItemPro
109
109
  }
110
110
  export type ProEditTableColumnsProps<K = any> = ProColumnsProps & ColumnPropsMap<K, 'ProEditTable'>;
111
111
  export interface State {
112
- _columns: ProEditTableColumnsProps[];
113
112
  cellNamePath: NamePath[];
114
113
  forceUpdate: {};
115
114
  editingKeys: string[];
@@ -139,11 +138,6 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
139
138
  * @description 原始数据源,是否tooltip显示
140
139
  * @default -
141
140
  */
142
- originalDiffTip?: boolean;
143
- /**
144
- * @description 可编辑表格的类型,单行、多行、单元格编辑
145
- * @default false
146
- */
147
141
  mode?: 'single' | 'multiple' | 'cell';
148
142
  /**
149
143
  * @description 可编辑表格的类型,单行编辑或者多行编辑
@@ -276,4 +270,7 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
276
270
  ref?: any;
277
271
  actionDirection?: 'vertical' | 'horizontal';
278
272
  validateTrigger?: string | string[];
273
+ diffConfig?: {
274
+ scrollFollowParent?: boolean;
275
+ };
279
276
  }
@@ -284,7 +284,6 @@
284
284
  .is-new-row, .is-new-row.@{ant-prefix}-table-row:hover {
285
285
  td, .@{ant-prefix}-table-cell-row-hover {
286
286
  background: var(--zaui-contract-bg-add, #d2fff4) !important;
287
-
288
287
  }
289
288
  }
290
289
  }
@@ -335,14 +335,21 @@ export var transformColumns = function transformColumns() {
335
335
  });
336
336
  }
337
337
  // 单行多行交互有较大差异
338
- return _jsx("div", {
338
+ return _jsxs("div", {
339
339
  className: cellClassName,
340
340
  onClick: function onClick() {
341
341
  isCanEdit && setState({
342
342
  cellNamePath: cellName
343
343
  });
344
344
  },
345
- children: _jsx(RenderField, {
345
+ children: [index === 0 && !item.width ? _jsx("div", {
346
+ style: {
347
+ visibility: 'hidden',
348
+ height: 0,
349
+ paddingLeft: (item === null || item === void 0 ? void 0 : item.required) ? 16 : 0
350
+ },
351
+ children: columnTitle
352
+ }) : null, _jsx(RenderField, {
346
353
  text: _text,
347
354
  record: record,
348
355
  index: index,
@@ -351,7 +358,7 @@ export var transformColumns = function transformColumns() {
351
358
  cellName: cellName,
352
359
  isEditing: isEditing // 是否正在编辑
353
360
  })
354
- })
361
+ })]
355
362
  });
356
363
  };
357
364
  item.render = _render;
@@ -286,7 +286,7 @@ var InputNumber = function InputNumber(props) {
286
286
  autoComplete: "off",
287
287
  placeholder: placeholder || "".concat(locale.ProForm.inputPlaceholder).concat(label !== null && label !== void 0 ? label : ''),
288
288
  className: _className
289
- }, valueProps), initialConfig), rest), {}, {
289
+ }, initialConfig), valueProps), rest), {}, {
290
290
  onBlur: handleBlur,
291
291
  onFocus: handleFocus,
292
292
  min: _min,
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { InternalNamePath } from 'antd/es/form/interface';
4
4
  import type { levelType } from '../../../../../ProLayout/components/ProCollapse/PropTypes';
5
5
  import type { FormListProps } from '../propsType';
6
+ import { DiffConfigProps } from '../../../../propsType';
6
7
  interface Props extends Omit<FormListProps, 'toolbarProps'> {
7
8
  index: number;
8
9
  namePath: InternalNamePath;
@@ -14,6 +15,7 @@ interface Props extends Omit<FormListProps, 'toolbarProps'> {
14
15
  };
15
16
  level?: levelType;
16
17
  towCollapse?: boolean;
18
+ diffConfig?: DiffConfigProps;
17
19
  }
18
20
  declare const BlockFields: React.FC<Props>;
19
21
  export default BlockFields;
@@ -31,7 +31,8 @@ var BlockFields = function BlockFields(props) {
31
31
  _props$level = props.level,
32
32
  level = _props$level === void 0 ? '2' : _props$level,
33
33
  towCollapse = props.towCollapse,
34
- id = props.id;
34
+ id = props.id,
35
+ diffConfig = props.diffConfig;
35
36
  var _title = useMemo(function () {
36
37
  if (isFunction(title)) {
37
38
  var record = form.getFieldValue(namePath);
@@ -73,7 +74,8 @@ var BlockFields = function BlockFields(props) {
73
74
  form: form,
74
75
  colProps: colProps,
75
76
  disabled: disabled,
76
- isView: isView
77
+ isView: isView,
78
+ diffConfig: diffConfig
77
79
  })
78
80
  }, field.key)
79
81
  })
@@ -2,6 +2,7 @@ import { ColProps, FormListFieldData } from 'antd';
2
2
  import React from 'react';
3
3
  import { InternalNamePath } from 'antd/es/form/interface';
4
4
  import { FormListProps } from '../propsType';
5
+ import { DiffConfigProps } from '../../../../propsType';
5
6
  interface Props extends Omit<FormListProps, 'toolbarProps'> {
6
7
  className?: string;
7
8
  index: number;
@@ -12,6 +13,7 @@ interface Props extends Omit<FormListProps, 'toolbarProps'> {
12
13
  field: Omit<FormListFieldData, 'key'> & {
13
14
  key: string;
14
15
  };
16
+ diffConfig?: DiffConfigProps;
15
17
  }
16
18
  declare const LineFields: React.FC<Props>;
17
19
  export default LineFields;
@@ -29,7 +29,8 @@ var LineFields = function LineFields(props) {
29
29
  isView = props.isView,
30
30
  draggable = props.draggable,
31
31
  className = props.className,
32
- id = props.id;
32
+ id = props.id,
33
+ diffConfig = props.diffConfig;
33
34
  var isLess = mode === 'less';
34
35
  var _useSortable = useSortable({
35
36
  id: field.key,
@@ -70,7 +71,8 @@ var LineFields = function LineFields(props) {
70
71
  form: form,
71
72
  colProps: colProps,
72
73
  disabled: disabled,
73
- isView: isView
74
+ isView: isView,
75
+ diffConfig: diffConfig
74
76
  })
75
77
  }), actionProps !== false && _jsx(ActionButton, {
76
78
  min: min,