@zat-design/sisyphus-react 3.8.3 → 3.9.0-beta.10

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 (82) hide show
  1. package/.vscode/extensions.json +5 -0
  2. package/dist/index.esm.css +48 -3
  3. package/dist/less.esm.css +47 -2
  4. package/es/ProDrawerForm/components/ProDrawer/index.js +3 -1
  5. package/es/ProDrawerForm/components/ProModal/index.js +5 -3
  6. package/es/ProDrawerForm/propsType.d.ts +1 -0
  7. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +83 -20
  8. package/es/ProEditTable/components/RenderField/index.js +6 -2
  9. package/es/ProEditTable/index.js +18 -9
  10. package/es/ProEditTable/propsType.d.ts +3 -6
  11. package/es/ProEditTable/style/index.less +0 -1
  12. package/es/ProEditTable/utils/index.js +10 -3
  13. package/es/ProEnum/index.js +1 -1
  14. package/es/ProForm/components/base/InputNumber/index.js +1 -1
  15. package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  16. package/es/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
  17. package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
  18. package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  19. package/es/ProForm/components/combination/FormList/index.js +14 -3
  20. package/es/ProForm/components/combination/Group/index.js +5 -5
  21. package/es/ProForm/components/combination/ProCascader/index.js +21 -14
  22. package/es/ProForm/components/combination/ProModalSelect/index.js +19 -4
  23. package/es/ProForm/components/render/ChangedWrapper.js +30 -11
  24. package/es/ProForm/components/render/Render.js +3 -1
  25. package/es/ProForm/components/render/RenderFields.js +4 -2
  26. package/es/ProForm/propsType.d.ts +3 -0
  27. package/es/ProForm/style/index.less +35 -9
  28. package/es/ProForm/utils/diffOriginal.js +14 -2
  29. package/es/ProForm/utils/useShouldUpdate.js +1 -9
  30. package/es/ProTable/components/FormatColumn/index.d.ts +3 -2
  31. package/es/ProTable/components/FormatColumn/index.js +143 -62
  32. package/es/ProTable/components/RenderColumn/index.d.ts +2 -0
  33. package/es/ProTable/components/RenderColumn/index.js +50 -19
  34. package/es/ProTable/index.d.ts +6 -5
  35. package/es/ProTable/index.js +12 -12
  36. package/es/ProTable/propsType.d.ts +6 -0
  37. package/es/ProTable/style/index.less +24 -1
  38. package/es/ProTable/utils/index.js +2 -2
  39. package/es/ProTree/components/ProTreeSelect/index.js +32 -13
  40. package/es/style/theme/antd.less +1 -1
  41. package/es/utils/index.d.ts +2 -1
  42. package/es/utils/index.js +30 -1
  43. package/lib/ProDrawerForm/components/ProDrawer/index.js +3 -1
  44. package/lib/ProDrawerForm/components/ProModal/index.js +5 -3
  45. package/lib/ProDrawerForm/propsType.d.ts +1 -0
  46. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +82 -21
  47. package/lib/ProEditTable/components/RenderField/index.js +6 -2
  48. package/lib/ProEditTable/index.js +18 -9
  49. package/lib/ProEditTable/propsType.d.ts +3 -6
  50. package/lib/ProEditTable/style/index.less +0 -1
  51. package/lib/ProEditTable/utils/index.js +10 -3
  52. package/lib/ProEnum/index.js +1 -1
  53. package/lib/ProForm/components/base/InputNumber/index.js +1 -1
  54. package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  55. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
  56. package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
  57. package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  58. package/lib/ProForm/components/combination/FormList/index.js +14 -3
  59. package/lib/ProForm/components/combination/Group/index.js +5 -5
  60. package/lib/ProForm/components/combination/ProCascader/index.js +21 -14
  61. package/lib/ProForm/components/combination/ProModalSelect/index.js +19 -4
  62. package/lib/ProForm/components/render/ChangedWrapper.js +30 -11
  63. package/lib/ProForm/components/render/Render.js +3 -1
  64. package/lib/ProForm/components/render/RenderFields.js +4 -2
  65. package/lib/ProForm/propsType.d.ts +3 -0
  66. package/lib/ProForm/style/index.less +35 -9
  67. package/lib/ProForm/utils/diffOriginal.js +13 -1
  68. package/lib/ProForm/utils/useShouldUpdate.js +1 -9
  69. package/lib/ProTable/components/FormatColumn/index.d.ts +3 -2
  70. package/lib/ProTable/components/FormatColumn/index.js +143 -62
  71. package/lib/ProTable/components/RenderColumn/index.d.ts +2 -0
  72. package/lib/ProTable/components/RenderColumn/index.js +47 -18
  73. package/lib/ProTable/index.d.ts +6 -5
  74. package/lib/ProTable/index.js +12 -12
  75. package/lib/ProTable/propsType.d.ts +6 -0
  76. package/lib/ProTable/style/index.less +24 -1
  77. package/lib/ProTable/utils/index.js +2 -2
  78. package/lib/ProTree/components/ProTreeSelect/index.js +31 -12
  79. package/lib/style/theme/antd.less +1 -1
  80. package/lib/utils/index.d.ts +2 -1
  81. package/lib/utils/index.js +32 -2
  82. package/package.json +1 -1
@@ -261,19 +261,42 @@
261
261
  tr.@{ant-prefix}-table-row.new-cell {
262
262
  background: var(--zaui-contract-bg-add; #d2fff4) !important;
263
263
  background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
264
-
265
264
  td.@{ant-prefix}-table-cell {
266
265
  background: var(--zaui-contract-bg-add; #d2fff4) !important;
267
266
  background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
268
267
  border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
268
+ &.@{ant-prefix}-table-cell-fix-right {
269
+ background: var(--zaui-contract-bg-add; #d2fff4) !important;
270
+ background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
271
+ border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
272
+ }
273
+ &.@{ant-prefix}-table-cell-fix-left {
274
+ background: var(--zaui-contract-bg-add; #d2fff4) !important;
275
+ background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
276
+ border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
277
+ }
269
278
  }
270
279
  }
271
280
 
272
281
  .@{ant-prefix}-table-cell .varied-cell {
273
282
  margin-left: -8px;
274
283
  padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
284
+
275
285
  background: var(--zaui-contract-bg; #fffaa1) !important;
276
286
  border-radius: var(--zaui-border-radius, 8px);
287
+ .pro-form-view-container {
288
+ overflow: hidden;
289
+ white-space: nowrap;
290
+ text-overflow: ellipsis;
291
+ }
292
+ }
293
+
294
+ .@{ant-prefix}-table-cell .@{ant-prefix}-typography-ellipsis {
295
+ .pro-form-view-container {
296
+ overflow: hidden;
297
+ white-space: nowrap;
298
+ text-overflow: ellipsis;
299
+ }
277
300
  }
278
301
 
279
302
  .varied-cell.empty-cell {
@@ -20,14 +20,14 @@ export var getDecimalDigits = function getDecimalDigits() {
20
20
  */
21
21
  export var getOriginalValue = function getOriginalValue(value, record, originalObj, rowKey, dataIndex) {
22
22
  if (!originalObj) {
23
- return undefined;
23
+ return null;
24
24
  }
25
25
  var originalRecord = get(originalObj, get(record, rowKey));
26
26
  var originalValue = get(originalRecord, dataIndex);
27
27
  if (!isEqual(originalValue, value)) {
28
28
  return originalValue;
29
29
  }
30
- return undefined;
30
+ return null;
31
31
  };
32
32
  export var getColumnDataIndex = function getColumnDataIndex(dataIndex) {
33
33
  return typeof dataIndex === 'string' ? dataIndex : dataIndex === null || dataIndex === void 0 ? void 0 : dataIndex.join('-');
@@ -1,6 +1,8 @@
1
1
  import "antd/es/tooltip/style";
2
2
  import _Tooltip from "antd/es/tooltip";
3
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
5
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
6
  import "antd/es/input/style";
5
7
  import _Input from "antd/es/input";
6
8
  import "antd/es/message/style";
@@ -18,7 +20,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
20
  import { useDeepCompareEffect, useRequest as useRequestFunc, useSetState } from 'ahooks';
19
21
  import classnames from 'classnames';
20
22
  import { useImperativeHandle, forwardRef } from 'react';
21
- import { cloneDeep } from 'lodash';
23
+ import { cloneDeep, debounce } from 'lodash';
22
24
  import { useProConfig } from '../../../ProConfigProvider';
23
25
  import Container from '../../../ProForm/components/Container';
24
26
  import AdaptiveTooltip from '../AdaptiveTooltip';
@@ -398,18 +400,35 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
398
400
  sourceList = _filterData(sourceList);
399
401
  return sourceList;
400
402
  }
401
- var searchTreeEvent = function searchTreeEvent(searchVal) {
402
- if (!searchVal) {
403
- setState({
404
- selectList: cloneDeep(origDataSource || [])
405
- });
406
- return null;
407
- }
408
- var result = filterTree(cloneDeep(origDataSource || []), searchVal);
409
- setState({
410
- selectList: result || []
411
- });
412
- };
403
+ var searchTreeEvent = debounce(/*#__PURE__*/function () {
404
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchVal) {
405
+ var result;
406
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
407
+ while (1) switch (_context.prev = _context.next) {
408
+ case 0:
409
+ if (searchVal) {
410
+ _context.next = 3;
411
+ break;
412
+ }
413
+ setState({
414
+ selectList: cloneDeep(origDataSource || [])
415
+ });
416
+ return _context.abrupt("return", null);
417
+ case 3:
418
+ result = filterTree(cloneDeep(origDataSource || []), searchVal);
419
+ setState({
420
+ selectList: result || []
421
+ });
422
+ case 5:
423
+ case "end":
424
+ return _context.stop();
425
+ }
426
+ }, _callee);
427
+ }));
428
+ return function (_x) {
429
+ return _ref5.apply(this, arguments);
430
+ };
431
+ }(), 500);
413
432
  function findTreeNode(treeList, nodeValue) {
414
433
  var result = {};
415
434
  var _filterData2 = function filterData(data) {
@@ -323,7 +323,7 @@
323
323
  .@{ant-prefix}-table-tbody {
324
324
  .@{ant-prefix}-table-row:nth-child(even) {
325
325
  td {
326
- background: #ffffff !important;
326
+ background: #ffffff;
327
327
  }
328
328
  }
329
329
 
@@ -1,2 +1,3 @@
1
1
  /** 判断一个值是否是空值 */
2
- export declare const isEmpty: (value: any) => boolean;
2
+ export declare const isEmpty: (value: any, emptyValue?: string) => boolean;
3
+ export declare const useFocus: (element: Element) => boolean;
package/es/utils/index.js CHANGED
@@ -1,6 +1,11 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { useEffect, useState } from 'react';
1
3
  var EMPTY_VALUE = [undefined, null, ''];
2
4
  /** 判断一个值是否是空值 */
3
- export var isEmpty = function isEmpty(value) {
5
+ export var isEmpty = function isEmpty(value, emptyValue) {
6
+ if (emptyValue) {
7
+ EMPTY_VALUE.push(emptyValue);
8
+ }
4
9
  if (EMPTY_VALUE.includes(value)) {
5
10
  return true;
6
11
  }
@@ -10,4 +15,28 @@ export var isEmpty = function isEmpty(value) {
10
15
  });
11
16
  }
12
17
  return false;
18
+ };
19
+ export var useFocus = function useFocus(element) {
20
+ var _useState = useState(false),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ focus = _useState2[0],
23
+ setFocus = _useState2[1];
24
+ useEffect(function () {
25
+ if (!element) return;
26
+ element.addEventListener('focus', function () {
27
+ setFocus(true);
28
+ }, true);
29
+ element.addEventListener('blur', function () {
30
+ setFocus(false);
31
+ }, true);
32
+ return function () {
33
+ element.removeEventListener('focus', function () {
34
+ setFocus(true);
35
+ }, true);
36
+ element.removeEventListener('blur', function () {
37
+ setFocus(false);
38
+ }, true);
39
+ };
40
+ }, [element]);
41
+ return focus;
13
42
  };
@@ -39,6 +39,7 @@ var ProDrawer = function ProDrawer(_ref) {
39
39
  onCancel = _ref.onCancel,
40
40
  children = _ref.children,
41
41
  className = _ref.className,
42
+ zIndex = _ref.zIndex,
42
43
  drawerProps = _ref.drawerProps;
43
44
  var ref = (0, _react.useRef)(null);
44
45
  var modalRef = (0, _react.useRef)(null);
@@ -195,7 +196,8 @@ var ProDrawer = function ProDrawer(_ref) {
195
196
  placement: "right",
196
197
  className: "pro-drawer ".concat(className !== null && className !== void 0 ? className : ''),
197
198
  closable: false,
198
- onClose: onCancel
199
+ onClose: onCancel,
200
+ zIndex: zIndex
199
201
  }, drawerProps), {}, {
200
202
  children: [(0, _jsxRuntime.jsx)("div", {
201
203
  className: "pro-drawer-close",
@@ -38,8 +38,9 @@ var ProModal = function ProModal(_ref) {
38
38
  onCancel = _ref.onCancel,
39
39
  children = _ref.children,
40
40
  className = _ref.className,
41
- modalProps = _ref.modalProps,
42
- extraLeft = _ref.extraLeft;
41
+ extraLeft = _ref.extraLeft,
42
+ zIndex = _ref.zIndex,
43
+ modalProps = _ref.modalProps;
43
44
  var ref = (0, _react.useRef)(null);
44
45
  var _ref2 = (0, _ahooks.useScroll)((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.parentNode) || {},
45
46
  top = _ref2.top;
@@ -181,7 +182,8 @@ var ProModal = function ProModal(_ref) {
181
182
  closeIcon: (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
182
183
  className: "close-icon",
183
184
  src: _close.default
184
- })
185
+ }),
186
+ zIndex: zIndex
185
187
  }, modalProps), {}, {
186
188
  children: (0, _jsxRuntime.jsx)("div", {
187
189
  ref: ref,
@@ -98,4 +98,5 @@ export interface ProDrawerFormPropsType {
98
98
  */
99
99
  onCloseClean?: boolean;
100
100
  children?: React.ReactNode;
101
+ zIndex?: number;
101
102
  }
@@ -17,7 +17,7 @@ var _lodash = require("lodash");
17
17
  var _diffOriginal = require("../../../ProForm/utils/diffOriginal");
18
18
  var _ProConfigProvider = require("../../../ProConfigProvider");
19
19
  var _utils = require("../../../utils");
20
- var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName"];
20
+ var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName", "viewRender", "diffConfig", "index"];
21
21
  var toNamePath = function toNamePath(name) {
22
22
  if (Array.isArray(name)) {
23
23
  return name;
@@ -39,6 +39,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
39
39
  if (!originalValues) {
40
40
  return undefined;
41
41
  }
42
+ var originalValueRow;
42
43
  if (rowKeyPath) {
43
44
  var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
44
45
  var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
@@ -47,7 +48,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
47
48
  var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
48
49
  if (!keyValue) return undefined;
49
50
  var originalValueList = (0, _lodash.get)(originalValues, originalName.slice(0, rowKeyPath.length - 2));
50
- var originalValueRow = originalValueList === null || originalValueList === void 0 ? void 0 : originalValueList.find(function (item) {
51
+ originalValueRow = originalValueList === null || originalValueList === void 0 ? void 0 : originalValueList.find(function (item) {
51
52
  return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
52
53
  });
53
54
  var originalValue;
@@ -63,15 +64,21 @@ var getOriginalValue = function getOriginalValue(_ref) {
63
64
  } else {
64
65
  originalValue = (0, _lodash.get)(originalValueRow, originalName.slice(rowKeyPath.length - 1));
65
66
  }
66
- return originalValue;
67
+ return {
68
+ originalValue: originalValue,
69
+ originalValueRow: originalValueRow
70
+ };
67
71
  }
68
72
  // 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
69
- return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
70
- return (0, _lodash.get)(originalValues, originalName);
71
- }) : (0, _lodash.get)(originalValues, originalName);
73
+ return {
74
+ originalValue: (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
75
+ return (0, _lodash.get)(originalValues, originalName);
76
+ }) : (0, _lodash.get)(originalValues, originalName),
77
+ originalValueRow: originalValueRow
78
+ };
72
79
  };
73
80
  var ListChangedWrapper = function ListChangedWrapper(props) {
74
- var _getValueProps;
81
+ var _diffConfig$toolTip, _children$props, _children$props2, _children$props3;
75
82
  var name = props.name,
76
83
  names = props.names,
77
84
  namesStr = props.namesStr,
@@ -89,21 +96,30 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
89
96
  getValueProps = props.getValueProps,
90
97
  _props$valuePropName = props.valuePropName,
91
98
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
99
+ viewRender = props.viewRender,
100
+ diffConfig = props.diffConfig,
101
+ index = props.index,
92
102
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
93
103
  var _ref2 = (0, _ProConfigProvider.useProConfig)('ProEditTable') || {},
94
104
  isDiffAll = _ref2.isDiffAll;
105
+ var _ref3 = diffConfig || {},
106
+ _ref3$scrollFollowPar = _ref3.scrollFollowParent,
107
+ scrollFollowParent = _ref3$scrollFollowPar === void 0 ? true : _ref3$scrollFollowPar;
108
+ var contentRef = (0, _react.useRef)(null);
95
109
  var namePath = toNamePath(namesStr || name);
96
110
  var originalNamePath = toNamePath(originalName);
97
111
  var originalNamePaths = originalNames && toNamePaths(originalNames);
112
+ var toolTip = (_diffConfig$toolTip = diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
98
113
  var isWatch = Boolean(originalValues);
99
- var originalValue = isWatch ? getOriginalValue({
114
+ var originalDTO = getOriginalValue({
100
115
  namePath: namePath,
101
116
  originalName: originalNamePath,
102
117
  originalNames: originalNamePaths,
103
118
  originalValues: originalValues,
104
119
  rowKeyPath: rowKeyPath,
105
120
  form: form
106
- }) : undefined;
121
+ });
122
+ var originalValue = isWatch ? originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originalValue : undefined;
107
123
  var noChange = !equalWith && (!originalValues || isDiffAll ? false : (0, _utils.isEmpty)(originalValue));
108
124
  var diffType = (0, _react.useMemo)(function () {
109
125
  if (!isWatch || noChange) return 'same';
@@ -118,30 +134,75 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
118
134
  }, [props[valuePropName], originalValue]);
119
135
  var isAdd = diffType === 'add';
120
136
  var isChanged = diffType === 'changed';
137
+ var tipContent = (0, _react.useMemo)(function () {
138
+ var _getValueProps;
139
+ if (!isWatch || noChange) return undefined;
140
+ var orgValue = getValueProps && !names ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : originalValue;
141
+ // 兼容viewRender函数和Element场景
142
+ var _children = children;
143
+ if (viewRender) {
144
+ if (! /*#__PURE__*/_react.default.isValidElement(viewRender)) {
145
+ return viewRender(orgValue, (originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originalValueRow) || {}, {
146
+ form: form,
147
+ name: name,
148
+ index: index
149
+ });
150
+ }
151
+ _children = viewRender;
152
+ }
153
+ return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)({
154
+ // @ts-ignore
155
+ isView: true
156
+ }, valuePropName, orgValue), "checked", type === 'Switch' ? originalValue : undefined))) : undefined;
157
+ }, [originalValue, children]);
121
158
  if (!isWatch || noChange) {
122
159
  return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest));
123
160
  }
161
+ // eslint-disable-next-line react-hooks/rules-of-hooks
162
+ // const isFocus = useFocus(contentRef.current);
163
+ var tipOpenCalc = function tipOpenCalc() {
164
+ if (!toolTip) return false;
165
+ // 传入undefined 鼠标移入显示移出隐藏
166
+ return isChanged ? undefined : false;
167
+ };
168
+ // @ts-ignore
169
+ 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);
124
170
  var diffClassName = (0, _classnames.default)({
125
171
  'pro-form-item-changed': isChanged,
126
172
  'pro-form-item-add': isAdd
127
173
  });
128
- return (0, _jsxRuntime.jsx)(_antd.Tooltip
129
- // 传入undefined 鼠标移入显示移出隐藏
130
- , {
131
- // 传入undefined 鼠标移入显示移出隐藏
132
- open: isChanged ? undefined : false,
133
- getPopupContainer: function getPopupContainer(target) {
134
- return target.parentElement;
174
+ var open = tipOpenCalc();
175
+ return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
176
+ open: open,
177
+ getPopupContainer: function getPopupContainer(trigger) {
178
+ return scrollFollowParent ? trigger.parentElement : document.body;
135
179
  },
180
+ overlayClassName: "original-value-tootip",
181
+ placement: "topLeft",
182
+ autoAdjustOverflow: false,
136
183
  title: (0, _jsxRuntime.jsxs)(_antd.Space, {
137
- children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)({
138
- // @ts-ignore
139
- isView: true
140
- }, valuePropName, getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : props[valuePropName]), "checked", type === 'Switch' ? originalValue : undefined))) : undefined]
184
+ direction: "vertical",
185
+ className: "changed-tooltip",
186
+ children: [(0, _jsxRuntime.jsxs)(_antd.Space, {
187
+ align: "start",
188
+ className: "original-value-container",
189
+ children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
190
+ }), _showEllipse && (0, _jsxRuntime.jsxs)(_antd.Space, {
191
+ className: "current-value-container",
192
+ children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest), {}, {
193
+ isView: true,
194
+ scrollFollowParent: scrollFollowParent
195
+ })) : undefined]
196
+ })]
141
197
  }),
142
198
  children: (0, _jsxRuntime.jsx)("div", {
143
199
  className: diffClassName,
144
- children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest)) : undefined
200
+ children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest), {}, {
201
+ scrollFollowParent: scrollFollowParent,
202
+ otherProps: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.otherProps), {}, {
203
+ isDiffChange: isChanged
204
+ })
205
+ })) : undefined
145
206
  })
146
207
  });
147
208
  };
@@ -80,7 +80,8 @@ var RenderField = function RenderField(_ref) {
80
80
  rowDisabled = config.rowDisabled,
81
81
  _config$validateTrigg = config.validateTrigger,
82
82
  validateTrigger = _config$validateTrigg === void 0 ? ['onChange', 'onBlur', 'onSubmit'] : _config$validateTrigg,
83
- otherProps = config.otherProps;
83
+ otherProps = config.otherProps,
84
+ diffConfig = config.diffConfig;
84
85
  var _fieldProps = fieldProps || formItemProps || {};
85
86
  var _rules = rules || [];
86
87
  var _required = required;
@@ -261,7 +262,7 @@ var RenderField = function RenderField(_ref) {
261
262
  if (typeof viewRender === 'function') {
262
263
  var _column$dataIndex;
263
264
  currentValue = (column === null || column === void 0 ? void 0 : (_column$dataIndex = column.dataIndex) === null || _column$dataIndex === void 0 ? void 0 : _column$dataIndex.includes('-')) ? value : currentValue;
264
- var View = viewRender(currentValue, record, options);
265
+ var View = viewRender(currentValue, record || {}, options);
265
266
  TargetComponent = (0, _jsxRuntime.jsx)(_Container.default, {
266
267
  viewEmpty: viewEmpty,
267
268
  children: View
@@ -567,6 +568,9 @@ var RenderField = function RenderField(_ref) {
567
568
  valuePropName: _formItemProps.valuePropName,
568
569
  normalize: _formItemProps.normalize,
569
570
  getValueProps: _formItemProps.getValueProps,
571
+ viewRender: viewRender,
572
+ diffConfig: diffConfig,
573
+ index: index,
570
574
  children: FieldComponent
571
575
  });
572
576
  }
@@ -24,9 +24,9 @@ var _ProForm = _interopRequireDefault(require("../ProForm"));
24
24
  var _empty = _interopRequireDefault(require("../assets/empty.png"));
25
25
  var _locale = _interopRequireWildcard(require("../locale"));
26
26
  var _RcTable = require("./components/RcTable");
27
- 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"];
27
+ 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"];
28
28
  var ProEditTable = function ProEditTable(_ref, ref) {
29
- var _resetProps$id, _resetProps$id$split, _themeConfig$data2;
29
+ var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _resetProps$otherProp;
30
30
  var value = _ref.value,
31
31
  onChange = _ref.onChange,
32
32
  onDrag = _ref.onDrag,
@@ -54,13 +54,13 @@ var ProEditTable = function ProEditTable(_ref, ref) {
54
54
  headerRender = _ref.headerRender,
55
55
  pagination = _ref.pagination,
56
56
  originalValues = _ref.originalValues,
57
- originalDiffTip = _ref.originalDiffTip,
58
57
  rowKey = _ref.rowKey,
59
58
  rowDisabled = _ref.rowDisabled,
60
59
  rowDraggable = _ref.rowDraggable,
61
60
  footerRender = _ref.footerRender,
62
61
  scroll = _ref.scroll,
63
62
  actionDirection = _ref.actionDirection,
63
+ diffConfig = _ref.diffConfig,
64
64
  resetProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
65
65
  // 上下文form
66
66
  var contentForm = _antd.Form.useFormInstance();
@@ -92,7 +92,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
92
92
  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';
93
93
  }, [themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data2 = themeConfig.data) === null || _themeConfig$data2 === void 0 ? void 0 : _themeConfig$data2.zauiFormAlign]);
94
94
  var _useSetState = (0, _ahooks.useSetState)({
95
- _columns: columns,
96
95
  cellNamePath: [],
97
96
  forceUpdate: {},
98
97
  editingKeys: [],
@@ -170,10 +169,10 @@ var ProEditTable = function ProEditTable(_ref, ref) {
170
169
  tableLength: value === null || value === void 0 ? void 0 : value.length,
171
170
  page: page,
172
171
  originalValues: originalValues,
173
- originalDiffTip: originalDiffTip,
174
172
  prefixCls: prefixCls,
175
173
  rowDisabled: rowDisabled,
176
- actionDirection: actionDirection
174
+ actionDirection: actionDirection,
175
+ diffConfig: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, resetProps === null || resetProps === void 0 ? void 0 : (_resetProps$otherProp = resetProps.otherProps) === null || _resetProps$otherProp === void 0 ? void 0 : _resetProps$otherProp.diffConfig), diffConfig)
177
176
  }, resetProps);
178
177
  // 编辑行设置下样式
179
178
  var _rowClassName = function _rowClassName(record) {
@@ -278,8 +277,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
278
277
  var _columns = (0, _react.useMemo)(function () {
279
278
  return (0, _utils.transformColumns)(columns, config);
280
279
  }, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
281
- (0, _react.useEffect)(function () {
282
- var _value$every, _originalArr$every;
280
+ var initDataSource = function initDataSource() {
281
+ var _value$every, _originalArr$every, _value$some, _originalArr$some;
283
282
  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) {
284
283
  return item.rowKey;
285
284
  });
@@ -288,8 +287,15 @@ var ProEditTable = function ProEditTable(_ref, ref) {
288
287
  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) {
289
288
  return item.rowKey;
290
289
  }) : true;
290
+ // 检测当前rowkey是否与制定key的值是否一致,不一致,则执行覆盖
291
+ 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) {
292
+ return item.rowKey !== getRowKey(item);
293
+ });
294
+ 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) {
295
+ return item.rowKey !== getRowKey(item);
296
+ });
291
297
  // 初始化默认生成row-key
292
- if ((value === null || value === void 0 ? void 0 : value.length) && !isAllHasKey || (originalArr === null || originalArr === void 0 ? void 0 : originalArr.length) && !isOriginalAllHasKey) {
298
+ if ((value === null || value === void 0 ? void 0 : value.length) && (!isAllHasKey || isNeedCover) || (originalArr === null || originalArr === void 0 ? void 0 : originalArr.length) && (!isOriginalAllHasKey || isNeedCoverOriginal)) {
293
299
  var _originalArr$forEach;
294
300
  var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
295
301
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
@@ -304,6 +310,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
304
310
  form.setFieldValue(virtualRowName, nextValues);
305
311
  }
306
312
  }
313
+ };
314
+ (0, _react.useEffect)(function () {
315
+ initDataSource();
307
316
  }, [value, originalValues]);
308
317
  (0, _react.useImperativeHandle)((resetProps === null || resetProps === void 0 ? void 0 : resetProps.ref) || ref, function () {
309
318
  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
  }
@@ -339,14 +339,21 @@ var transformColumns = exports.transformColumns = function transformColumns() {
339
339
  });
340
340
  }
341
341
  // 单行多行交互有较大差异
342
- return (0, _jsxRuntime.jsx)("div", {
342
+ return (0, _jsxRuntime.jsxs)("div", {
343
343
  className: cellClassName,
344
344
  onClick: function onClick() {
345
345
  isCanEdit && setState({
346
346
  cellNamePath: cellName
347
347
  });
348
348
  },
349
- children: (0, _jsxRuntime.jsx)(_components.RenderField, {
349
+ children: [index === 0 && !item.width ? (0, _jsxRuntime.jsx)("div", {
350
+ style: {
351
+ visibility: 'hidden',
352
+ height: 0,
353
+ paddingLeft: (item === null || item === void 0 ? void 0 : item.required) ? 16 : 0
354
+ },
355
+ children: columnTitle
356
+ }) : null, (0, _jsxRuntime.jsx)(_components.RenderField, {
350
357
  text: _text,
351
358
  record: record,
352
359
  index: index,
@@ -355,7 +362,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
355
362
  cellName: cellName,
356
363
  isEditing: isEditing // 是否正在编辑
357
364
  })
358
- })
365
+ })]
359
366
  });
360
367
  };
361
368
  item.render = _render;
@@ -44,7 +44,7 @@ var ProEnum = function ProEnum(props) {
44
44
  enumProps = (0, _objectWithoutProperties2.default)(props, _excluded);
45
45
  var _ref = otherProps || {},
46
46
  viewEmpty = _ref.viewEmpty;
47
- var _isView = isView || (otherProps === null || otherProps === void 0 ? void 0 : otherProps.isView);
47
+ var _isView = isView !== undefined && isView !== null ? isView : otherProps === null || otherProps === void 0 ? void 0 : otherProps.isView;
48
48
  var _ref2 = (0, _ProConfigProvider.useProConfig)('ProEnum') || {},
49
49
  fieldNames = _ref2.fieldNames,
50
50
  _ref2$clear = _ref2.clear,
@@ -290,7 +290,7 @@ var InputNumber = function InputNumber(props) {
290
290
  autoComplete: "off",
291
291
  placeholder: placeholder || "".concat(_locale.default.ProForm.inputPlaceholder).concat(label !== null && label !== void 0 ? label : ''),
292
292
  className: _className
293
- }, valueProps), initialConfig), rest), {}, {
293
+ }, initialConfig), valueProps), rest), {}, {
294
294
  onBlur: handleBlur,
295
295
  onFocus: handleFocus,
296
296
  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;
@@ -36,7 +36,8 @@ var BlockFields = function BlockFields(props) {
36
36
  _props$level = props.level,
37
37
  level = _props$level === void 0 ? '2' : _props$level,
38
38
  towCollapse = props.towCollapse,
39
- id = props.id;
39
+ id = props.id,
40
+ diffConfig = props.diffConfig;
40
41
  var _title = (0, _react.useMemo)(function () {
41
42
  if ((0, _lodash.isFunction)(title)) {
42
43
  var record = form.getFieldValue(namePath);
@@ -78,7 +79,8 @@ var BlockFields = function BlockFields(props) {
78
79
  form: form,
79
80
  colProps: colProps,
80
81
  disabled: disabled,
81
- isView: isView
82
+ isView: isView,
83
+ diffConfig: diffConfig
82
84
  })
83
85
  }, field.key)
84
86
  })