@zat-design/sisyphus-react 3.8.3-beta.9 → 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 (38) hide show
  1. package/.vscode/extensions.json +5 -0
  2. package/dist/index.esm.css +22 -3
  3. package/dist/less.esm.css +21 -2
  4. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +66 -17
  5. package/es/ProEditTable/components/RenderField/index.js +6 -9
  6. package/es/ProEditTable/index.js +18 -8
  7. package/es/ProEditTable/propsType.d.ts +3 -5
  8. package/es/ProEditTable/style/index.less +0 -1
  9. package/es/ProForm/components/base/InputNumber/index.js +1 -1
  10. package/es/ProForm/components/combination/Group/index.js +3 -4
  11. package/es/ProForm/components/combination/ProCascader/index.js +1 -1
  12. package/es/ProForm/components/render/ChangedWrapper.js +17 -10
  13. package/es/ProForm/propsType.d.ts +2 -0
  14. package/es/ProForm/style/index.less +28 -9
  15. package/es/ProTable/components/FormatColumn/index.js +16 -10
  16. package/es/ProTable/components/RenderColumn/index.js +20 -6
  17. package/es/ProTable/propsType.d.ts +4 -1
  18. package/es/style/theme/antd.less +1 -1
  19. package/es/utils/index.d.ts +1 -0
  20. package/es/utils/index.js +26 -0
  21. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +66 -19
  22. package/lib/ProEditTable/components/RenderField/index.js +6 -9
  23. package/lib/ProEditTable/index.js +18 -8
  24. package/lib/ProEditTable/propsType.d.ts +3 -5
  25. package/lib/ProEditTable/style/index.less +0 -1
  26. package/lib/ProForm/components/base/InputNumber/index.js +1 -1
  27. package/lib/ProForm/components/combination/Group/index.js +3 -4
  28. package/lib/ProForm/components/combination/ProCascader/index.js +1 -1
  29. package/lib/ProForm/components/render/ChangedWrapper.js +17 -10
  30. package/lib/ProForm/propsType.d.ts +2 -0
  31. package/lib/ProForm/style/index.less +28 -9
  32. package/lib/ProTable/components/FormatColumn/index.js +16 -10
  33. package/lib/ProTable/components/RenderColumn/index.js +18 -6
  34. package/lib/ProTable/propsType.d.ts +4 -1
  35. package/lib/style/theme/antd.less +1 -1
  36. package/lib/utils/index.d.ts +1 -0
  37. package/lib/utils/index.js +28 -1
  38. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ {
2
+ "recommendations": [
3
+ "kisstkondoros.vscode-codemetrics"
4
+ ]
5
+ }
@@ -2833,6 +2833,12 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2833
2833
  display: unset;
2834
2834
  visibility: hidden;
2835
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
+ }
2836
2842
  .pro-form.pro-form-view .ant-form-item-label label {
2837
2843
  color: var(--zaui-aide-text, #939599);
2838
2844
  }
@@ -3155,10 +3161,23 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3155
3161
  background: var(--zaui-contract-bg-add, #d2fff4);
3156
3162
  border-radius: 4px;
3157
3163
  }
3158
- .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) {
3159
3172
  white-space: nowrap;
3160
3173
  }
3161
- .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) {
3162
3181
  white-space: nowrap;
3163
3182
  }
3164
3183
  .pro-upload .pro-upload-dragger .pro-upload-handle-box {
@@ -5631,7 +5650,7 @@ input[type='button'] {
5631
5650
  user-select: text;
5632
5651
  }
5633
5652
  .ant-table.ant-table-fixed-header .ant-table-tbody .ant-table-row:nth-child(even) td {
5634
- background: #ffffff !important;
5653
+ background: #ffffff;
5635
5654
  }
5636
5655
  .ant-table.ant-table-fixed-header .ant-table-tbody .ant-table-row:nth-child(odd) {
5637
5656
  background-color: var(--zaui-table-strip-bg, #fafafa);
package/dist/less.esm.css CHANGED
@@ -2833,6 +2833,12 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2833
2833
  display: unset;
2834
2834
  visibility: hidden;
2835
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
+ }
2836
2842
  .pro-form.pro-form-view .ant-form-item-label label {
2837
2843
  color: var(--zaui-aide-text, #939599);
2838
2844
  }
@@ -3155,10 +3161,23 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3155
3161
  background: var(--zaui-contract-bg-add, #d2fff4);
3156
3162
  border-radius: 4px;
3157
3163
  }
3158
- .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) {
3159
3172
  white-space: nowrap;
3160
3173
  }
3161
- .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) {
3162
3181
  white-space: nowrap;
3163
3182
  }
3164
3183
  .pro-upload .pro-upload-dragger .pro-upload-handle-box {
@@ -5,9 +5,9 @@ import _Tooltip from "antd/es/tooltip";
5
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", "viewRender"];
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,14 +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) {
76
+ var _diffConfig$toolTip, _children$props, _children$props2, _children$props3;
69
77
  var name = props.name,
70
78
  names = props.names,
71
79
  namesStr = props.namesStr,
@@ -84,21 +92,29 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
84
92
  _props$valuePropName = props.valuePropName,
85
93
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
86
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';
@@ -116,12 +132,16 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
116
132
  var tipContent = useMemo(function () {
117
133
  var _getValueProps;
118
134
  if (!isWatch || noChange) return undefined;
119
- var orgValue = getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : originalValue;
135
+ var orgValue = getValueProps && !names ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : originalValue;
120
136
  // 兼容viewRender函数和Element场景
121
137
  var _children = children;
122
138
  if (viewRender) {
123
139
  if (! /*#__PURE__*/React.isValidElement(viewRender)) {
124
- return viewRender(orgValue);
140
+ return viewRender(orgValue, (originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originalValueRow) || {}, {
141
+ form: form,
142
+ name: name,
143
+ index: index
144
+ });
125
145
  }
126
146
  _children = viewRender;
127
147
  }
@@ -133,22 +153,51 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
133
153
  if (!isWatch || noChange) {
134
154
  return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
135
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);
136
165
  var diffClassName = classNames({
137
166
  'pro-form-item-changed': isChanged,
138
167
  'pro-form-item-add': isAdd
139
168
  });
169
+ var open = tipOpenCalc();
140
170
  return _jsx(_Tooltip, {
141
- // 传入undefined 鼠标移入显示移出隐藏
142
- open: isChanged ? undefined : false,
143
- getPopupContainer: function getPopupContainer(target) {
144
- return target.parentElement;
171
+ open: open,
172
+ getPopupContainer: function getPopupContainer(trigger) {
173
+ return scrollFollowParent ? trigger.parentElement : document.body;
145
174
  },
175
+ overlayClassName: "original-value-tootip",
176
+ placement: "topLeft",
177
+ autoAdjustOverflow: false,
146
178
  title: _jsxs(_Space, {
147
- children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
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
+ })]
148
192
  }),
149
193
  children: _jsx("div", {
150
194
  className: diffClassName,
151
- 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
152
201
  })
153
202
  });
154
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;
@@ -248,19 +249,13 @@ var RenderField = function RenderField(_ref) {
248
249
  TargetComponent = _editRender;
249
250
  }
250
251
  }
251
- var viewRenderFun = function viewRenderFun(value) {
252
- if (/*#__PURE__*/React.isValidElement(viewRender)) {
253
- return viewRender;
254
- }
255
- return viewRender === null || viewRender === void 0 ? void 0 : viewRender(value, record, options);
256
- };
257
252
  // 查看模式
258
253
  if (isView) {
259
254
  // 存在viewRender覆盖默认值
260
255
  if (typeof viewRender === 'function') {
261
256
  var _column$dataIndex;
262
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;
263
- var View = viewRenderFun(currentValue);
258
+ var View = viewRender(currentValue, record || {}, options);
264
259
  TargetComponent = _jsx(Container, {
265
260
  viewEmpty: viewEmpty,
266
261
  children: View
@@ -566,7 +561,9 @@ var RenderField = function RenderField(_ref) {
566
561
  valuePropName: _formItemProps.valuePropName,
567
562
  normalize: _formItemProps.normalize,
568
563
  getValueProps: _formItemProps.getValueProps,
569
- viewRender: viewRender && viewRenderFun,
564
+ viewRender: viewRender,
565
+ diffConfig: diffConfig,
566
+ index: index,
570
567
  children: FieldComponent
571
568
  });
572
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();
@@ -166,10 +166,10 @@ var ProEditTable = function ProEditTable(_ref, ref) {
166
166
  tableLength: value === null || value === void 0 ? void 0 : value.length,
167
167
  page: page,
168
168
  originalValues: originalValues,
169
- originalDiffTip: originalDiffTip,
170
169
  prefixCls: prefixCls,
171
170
  rowDisabled: rowDisabled,
172
- 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)
173
173
  }, resetProps);
174
174
  // 编辑行设置下样式
175
175
  var _rowClassName = function _rowClassName(record) {
@@ -274,8 +274,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
274
274
  var _columns = useMemo(function () {
275
275
  return transformColumns(columns, config);
276
276
  }, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
277
- useEffect(function () {
278
- var _value$every, _originalArr$every;
277
+ var initDataSource = function initDataSource() {
278
+ var _value$every, _originalArr$every, _value$some, _originalArr$some;
279
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) {
280
280
  return item.rowKey;
281
281
  });
@@ -284,8 +284,15 @@ var ProEditTable = function ProEditTable(_ref, ref) {
284
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) {
285
285
  return item.rowKey;
286
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
+ });
287
294
  // 初始化默认生成row-key
288
- 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)) {
289
296
  var _originalArr$forEach;
290
297
  var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
291
298
  return _objectSpread(_objectSpread({}, item), {}, {
@@ -300,6 +307,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
300
307
  form.setFieldValue(virtualRowName, nextValues);
301
308
  }
302
309
  }
310
+ };
311
+ useEffect(function () {
312
+ initDataSource();
303
313
  }, [value, originalValues]);
304
314
  useImperativeHandle((resetProps === null || resetProps === void 0 ? void 0 : resetProps.ref) || ref, function () {
305
315
  return {
@@ -138,11 +138,6 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
138
138
  * @description 原始数据源,是否tooltip显示
139
139
  * @default -
140
140
  */
141
- originalDiffTip?: boolean;
142
- /**
143
- * @description 可编辑表格的类型,单行、多行、单元格编辑
144
- * @default false
145
- */
146
141
  mode?: 'single' | 'multiple' | 'cell';
147
142
  /**
148
143
  * @description 可编辑表格的类型,单行编辑或者多行编辑
@@ -275,4 +270,7 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
275
270
  ref?: any;
276
271
  actionDirection?: 'vertical' | 'horizontal';
277
272
  validateTrigger?: string | string[];
273
+ diffConfig?: {
274
+ scrollFollowParent?: boolean;
275
+ };
278
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
  }
@@ -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,
@@ -26,15 +26,14 @@ var Group = function Group(props) {
26
26
  value = props.value,
27
27
  onChange = props.onChange,
28
28
  otherProps = props.otherProps,
29
- disabled = props.disabled,
30
- id = props.id,
31
- isView = props.isView;
29
+ id = props.id;
32
30
  var contextProps = ProForm.useFieldProps() || {};
33
31
  var names = contextProps.names,
34
32
  name = contextProps.name,
35
33
  form = contextProps.form,
36
34
  namePath = contextProps.namePath,
37
- index = contextProps.index;
35
+ index = contextProps.index,
36
+ isView = contextProps.isView;
38
37
  var _option = React.useRef([]);
39
38
  // 组合onChange
40
39
  var handleChange = function handleChange(value, option, index) {
@@ -79,7 +79,7 @@ var ProCascader = function ProCascader(props) {
79
79
  code = _props$code === void 0 ? configCode : _props$code,
80
80
  tooltip = props.tooltip,
81
81
  _props$separator = props.separator,
82
- separator = _props$separator === void 0 ? '' : _props$separator,
82
+ separator = _props$separator === void 0 ? '/' : _props$separator,
83
83
  detailPlaceholder = props.detailPlaceholder,
84
84
  otherProps = _objectWithoutProperties(props, _excluded);
85
85
  var _ref3 = ProForm.useFieldProps() || {},
@@ -29,11 +29,14 @@ var ChangedWrapper = function ChangedWrapper(props) {
29
29
  getValueProps = props.getValueProps,
30
30
  viewRender = props.viewRender,
31
31
  rest = _objectWithoutProperties(props, _excluded);
32
+ // const contentRef = useRef(null);
32
33
  var _useProConfig = useProConfig('ProForm'),
33
34
  isDiffAll = _useProConfig.isDiffAll;
34
35
  var originalValues = diffConfig.originalValues,
35
36
  changeTipColor = diffConfig.changeTipColor,
36
- addTipColor = diffConfig.addTipColor;
37
+ addTipColor = diffConfig.addTipColor,
38
+ _diffConfig$scrollFol = diffConfig.scrollFollowParent,
39
+ scrollFollowParent = _diffConfig$scrollFol === void 0 ? true : _diffConfig$scrollFol;
37
40
  var toolTip = (_diffConfig$toolTip = diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
38
41
  var isWatch = toolTip && !['FormList', 'ProEditTable'].includes(type);
39
42
  var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
@@ -54,9 +57,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
54
57
  var isAdd = diffType === 'add';
55
58
  var isChanged = diffType === 'changed';
56
59
  var viewRenderFun = useMemo(function () {
57
- var record = form.getFieldsValue();
58
60
  return function (orgValue) {
59
- return viewRender(orgValue, record, {
61
+ return viewRender(orgValue, originalValues, {
60
62
  form: form
61
63
  });
62
64
  };
@@ -78,27 +80,30 @@ var ChangedWrapper = function ChangedWrapper(props) {
78
80
  originalValues: isNestedField ? originalValues : undefined
79
81
  }, children.props), rest));
80
82
  }
83
+ // eslint-disable-next-line react-hooks/rules-of-hooks
84
+ // const isFocus = useFocus(contentRef.current);
81
85
  var tipOpenCalc = function tipOpenCalc() {
82
86
  if (!toolTip) return false;
83
- // 传入undefined 鼠标移入显示移出隐藏
87
+ // 传入undefined 鼠标移入显示移出隐藏 获得焦点时不显示气泡
84
88
  return isChanged ? undefined : false;
85
89
  };
86
90
  var style = {
87
91
  '--zaui-contract-bg': changeTipColor,
88
92
  '--zaui-contract-bg-add': addTipColor
89
93
  };
94
+ // @ts-ignore
95
+ 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);
90
96
  var diffClassName = classNames({
91
97
  'pro-form-item-changed': isChanged,
92
98
  'pro-form-item-add': isAdd
93
99
  });
94
- // @ts-ignore
95
- 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);
100
+ var open = tipOpenCalc();
96
101
  return _jsx(_Tooltip, {
97
- open: tipOpenCalc(),
98
- // mouseEnterDelay={1}
99
- getPopupContainer: function getPopupContainer(target) {
100
- return target.parentElement;
102
+ open: open,
103
+ getPopupContainer: function getPopupContainer(trigger) {
104
+ return scrollFollowParent ? trigger.parentElement : document.body;
101
105
  },
106
+ overlayClassName: "original-value-tootip",
102
107
  title: _jsxs(_Space, {
103
108
  direction: "vertical",
104
109
  className: "changed-tooltip",
@@ -109,6 +114,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
109
114
  }), _showEllipse && _jsxs(_Space, {
110
115
  className: "current-value-container",
111
116
  children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
117
+ scrollFollowParent: scrollFollowParent,
112
118
  isView: true
113
119
  })) : undefined]
114
120
  })]
@@ -118,6 +124,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
118
124
  className: diffClassName,
119
125
  style: style,
120
126
  children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
127
+ scrollFollowParent: scrollFollowParent,
121
128
  otherProps: _objectSpread(_objectSpread({}, (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.otherProps), {}, {
122
129
  isDiffChange: isChanged
123
130
  })
@@ -56,6 +56,8 @@ export interface DiffConfigProps<Values = any> {
56
56
  changeTipColor?: string;
57
57
  /** 新增提示颜色 */
58
58
  addTipColor?: string;
59
+ /** 是否跟随父组件滚动 */
60
+ scrollFollowParent?: string;
59
61
  }
60
62
  export interface ProFormProps<Values = any> extends FormProps<Values> {
61
63
  disabled?: boolean;
@@ -53,6 +53,11 @@
53
53
  }
54
54
 
55
55
  &.pro-form-view {
56
+ .pro-group{
57
+ .@{ant-prefix}-space-item, .pro-form-view-container{
58
+ width: max-content;
59
+ }
60
+ }
56
61
  .@{ant-prefix}-form-item-label {
57
62
  label {
58
63
  color: var(--zaui-aide-text, #939599);
@@ -480,15 +485,29 @@
480
485
  }
481
486
  }
482
487
 
483
- .changed-tooltip {
484
- .original-value-container {
485
- .ant-space-item:nth-child(1) {
486
- white-space: nowrap;
488
+ .original-value-tootip{
489
+ max-width: 100%;
490
+ width: max-content;
491
+ z-index: 99;
492
+ .changed-tooltip {
493
+ .original-value-container {
494
+ .ant-space-item:nth-child(1) {
495
+ white-space: nowrap;
496
+ }
497
+ .pro-group{
498
+ .ant-space-compact{
499
+ display: block;
500
+ }
501
+ .pro-form-view-container{
502
+ word-break: keep-all;
503
+ }
504
+ }
487
505
  }
488
- }
489
- .current-value-container {
490
- .ant-space-item:nth-child(1) {
491
- white-space: nowrap;
506
+ .current-value-container {
507
+ .ant-space-item:nth-child(1) {
508
+ white-space: nowrap;
509
+ }
492
510
  }
493
511
  }
494
- }
512
+ }
513
+