@zat-design/sisyphus-react 3.8.2 → 3.8.3

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 (42) hide show
  1. package/dist/index.esm.css +16 -8
  2. package/dist/less.esm.css +16 -8
  3. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +7 -6
  4. package/es/ProEditTable/components/RenderField/index.js +1 -0
  5. package/es/ProEnum/hooks/useEnumRequest.js +1 -1
  6. package/es/ProEnum/index.js +2 -2
  7. package/es/ProForm/components/base/InputNumber/index.js +1 -1
  8. package/es/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
  9. package/es/ProForm/components/combination/Group/component/ComRender.js +4 -2
  10. package/es/ProForm/components/combination/Group/index.js +6 -3
  11. package/es/ProForm/components/render/ChangedWrapper.js +8 -2
  12. package/es/ProForm/components/render/Render.js +3 -2
  13. package/es/ProForm/components/render/propsType.d.ts +4 -0
  14. package/es/ProForm/style/index.less +15 -2
  15. package/es/ProForm/utils/useShouldUpdate.js +21 -6
  16. package/es/ProTable/components/FormatColumn/index.d.ts +3 -1
  17. package/es/ProTable/components/FormatColumn/index.js +92 -17
  18. package/es/ProTable/components/RenderColumn/index.d.ts +1 -0
  19. package/es/ProTable/components/RenderColumn/index.js +22 -7
  20. package/es/ProTable/index.js +20 -5
  21. package/es/ProTable/style/index.less +8 -6
  22. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +10 -9
  23. package/lib/ProEditTable/components/RenderField/index.js +1 -0
  24. package/lib/ProEnum/hooks/useEnumRequest.js +1 -1
  25. package/lib/ProEnum/index.js +2 -2
  26. package/lib/ProForm/components/base/InputNumber/index.js +1 -1
  27. package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
  28. package/lib/ProForm/components/combination/Group/component/ComRender.js +4 -2
  29. package/lib/ProForm/components/combination/Group/index.js +6 -3
  30. package/lib/ProForm/components/render/ChangedWrapper.js +8 -2
  31. package/lib/ProForm/components/render/Render.js +3 -2
  32. package/lib/ProForm/components/render/propsType.d.ts +4 -0
  33. package/lib/ProForm/style/index.less +15 -2
  34. package/lib/ProForm/utils/useShouldUpdate.js +19 -4
  35. package/lib/ProTable/components/FormatColumn/index.d.ts +3 -1
  36. package/lib/ProTable/components/FormatColumn/index.js +91 -16
  37. package/lib/ProTable/components/RenderColumn/index.d.ts +1 -0
  38. package/lib/ProTable/components/RenderColumn/index.js +22 -7
  39. package/lib/ProTable/index.js +20 -5
  40. package/lib/ProTable/style/index.less +8 -6
  41. package/package.json +4 -3
  42. package/.vscode/extensions.json +0 -5
@@ -5,20 +5,53 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
5
5
  import { isValidElement } from 'react';
6
6
  import moment from 'moment';
7
7
  import classnames from 'classnames';
8
- import { isEqual, isFunction, isString } from 'lodash';
8
+ import ReactDOM from 'react-dom';
9
+ import { isEqual, isFunction, isString, isObject } from 'lodash';
9
10
  import { tools } from '@zat-design/utils';
10
11
  import TooltipTitle from '../TooltipTitle';
11
12
  import RenderColumn from '../RenderColumn';
12
13
  import { getDecimalDigits, getOriginalValue } from '../../utils';
13
14
  import getEnumLabel from '../../../ProEnum/utils/getEnumLabel';
14
15
  import ProForm from '../../../ProForm';
15
- export var formatColumn = function formatColumn(_ref) {
16
- var column = _ref.column,
17
- originalObj = _ref.originalObj,
18
- dataSourceObj = _ref.dataSourceObj,
19
- rowKey = _ref.rowKey,
20
- diffToolTip = _ref.diffToolTip,
21
- wrapToolTipProps = _ref.wrapToolTipProps;
16
+ var isReactElement = function isReactElement(element) {
17
+ return /*#__PURE__*/isValidElement(element);
18
+ };
19
+ var calcMinWidth = function calcMinWidth(_ref) {
20
+ var minWidth = _ref.minWidth,
21
+ width = _ref.width,
22
+ title = _ref.title,
23
+ isMaxContentOverFlow = _ref.isMaxContentOverFlow,
24
+ callback = _ref.callback;
25
+ if (!minWidth && !width && isMaxContentOverFlow) {
26
+ var tempEl = document.createElement('div');
27
+ tempEl.style.display = 'inline-block';
28
+ document.body.appendChild(tempEl);
29
+ if (isFunction(title)) {
30
+ var component = title();
31
+ ReactDOM.render(component, tempEl);
32
+ } else if (isReactElement(title)) {
33
+ ReactDOM.render(title, tempEl);
34
+ } else {
35
+ tempEl.innerHTML = title;
36
+ }
37
+ // 使用 requestAnimationFrame 确保在下一个浏览器重绘周期中获取宽度
38
+ requestAnimationFrame(function () {
39
+ var _width = tempEl.offsetWidth;
40
+ ReactDOM.unmountComponentAtNode(tempEl);
41
+ tempEl.remove();
42
+ callback(_width);
43
+ });
44
+ }
45
+ };
46
+ export var formatColumn = function formatColumn(_ref2) {
47
+ var column = _ref2.column,
48
+ originalObj = _ref2.originalObj,
49
+ dataSourceObj = _ref2.dataSourceObj,
50
+ rowKey = _ref2.rowKey,
51
+ diffToolTip = _ref2.diffToolTip,
52
+ wrapToolTipProps = _ref2.wrapToolTipProps,
53
+ scroll = _ref2.scroll,
54
+ onUpdateMinWidth = _ref2.onUpdateMinWidth;
22
55
  var title = column.title,
23
56
  valueType = column.valueType,
24
57
  _column$format = column.format,
@@ -37,7 +70,17 @@ export var formatColumn = function formatColumn(_ref) {
37
70
  _column$originalDiffT = column.originalDiffTip,
38
71
  originalDiffTip = _column$originalDiffT === void 0 ? true : _column$originalDiffT,
39
72
  _column$toolTipProps = column.toolTipProps,
40
- toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps;
73
+ toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps,
74
+ minWidth = column.minWidth;
75
+ // 仅在 {x: 'max-content', y: 300 } 且 column无指定 width minWidth 情况下 才开启 minWidth的自动计算
76
+ var isMaxContentOverFlow = isObject(scroll) ? (scroll === null || scroll === void 0 ? void 0 : scroll.x) === 'max-content' && Reflect.ownKeys(scroll).includes('y') : false;
77
+ calcMinWidth({
78
+ minWidth: minWidth,
79
+ width: width,
80
+ title: title,
81
+ isMaxContentOverFlow: isMaxContentOverFlow,
82
+ callback: onUpdateMinWidth
83
+ });
41
84
  var _toolTipProps = _objectSpread(_objectSpread({}, toolTipProps), wrapToolTipProps);
42
85
  var _originalDiffTip = diffToolTip !== null && diffToolTip !== void 0 ? diffToolTip : originalDiffTip;
43
86
  // 前缀处理
@@ -65,6 +108,30 @@ export var formatColumn = function formatColumn(_ref) {
65
108
  }
66
109
  };
67
110
  if (column === null || column === void 0 ? void 0 : column.render) {
111
+ if (!originalObj && Object.keys(originalObj !== null && originalObj !== void 0 ? originalObj : {}).length === 0) {
112
+ return;
113
+ }
114
+ var originalRender = column.render; // 保存原始的 render 方法
115
+ // 自定义render 手动重载下
116
+ column.render = function (value, record, index) {
117
+ var _originalObj$record$r;
118
+ var isFn = isFunction(originalRender);
119
+ var _value = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(value, record !== null && record !== void 0 ? record : {}, index) : undefined;
120
+ var originalValue = getOriginalValue(value, record !== null && record !== void 0 ? record : {}, originalObj, rowKey, dataIndex);
121
+ var originalRenderValue = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(originalValue, (_originalObj$record$r = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r !== void 0 ? _originalObj$record$r : {}, index) : undefined;
122
+ return _jsx(RenderColumn, {
123
+ valueType: valueType,
124
+ originalValue: originalValue === undefined ? undefined : originalRenderValue,
125
+ ellipsis: ellipsis,
126
+ width: width,
127
+ value: _value,
128
+ node: _value,
129
+ currentValue: _value,
130
+ originalDiffTip: _originalDiffTip,
131
+ toolTipProps: _toolTipProps,
132
+ minWidth: minWidth
133
+ });
134
+ };
68
135
  return;
69
136
  }
70
137
  if (tooltip) {
@@ -108,7 +175,8 @@ export var formatColumn = function formatColumn(_ref) {
108
175
  value: value,
109
176
  currentValue: renderValue,
110
177
  originalDiffTip: _originalDiffTip,
111
- toolTipProps: _toolTipProps
178
+ toolTipProps: _toolTipProps,
179
+ minWidth: minWidth
112
180
  });
113
181
  };
114
182
  // 千分位, 千分位带CNY前缀
@@ -138,7 +206,8 @@ export var formatColumn = function formatColumn(_ref) {
138
206
  value: value,
139
207
  currentValue: renderValue,
140
208
  originalDiffTip: _originalDiffTip,
141
- toolTipProps: _toolTipProps
209
+ toolTipProps: _toolTipProps,
210
+ minWidth: minWidth
142
211
  });
143
212
  };
144
213
  } else if (['datePicker', 'date', 'dateTime', 'dateStartTime', 'dateEndTime', 'dateStartEndTime'].includes(valueType)) {
@@ -191,7 +260,8 @@ export var formatColumn = function formatColumn(_ref) {
191
260
  value: value,
192
261
  currentValue: renderValue,
193
262
  originalDiffTip: _originalDiffTip,
194
- toolTipProps: _toolTipProps
263
+ toolTipProps: _toolTipProps,
264
+ minWidth: minWidth
195
265
  });
196
266
  };
197
267
  } else if (['enumName', 'enumCodeName'].includes(valueType)) {
@@ -229,7 +299,8 @@ export var formatColumn = function formatColumn(_ref) {
229
299
  value: value,
230
300
  currentValue: renderValue,
231
301
  originalDiffTip: _originalDiffTip,
232
- toolTipProps: _toolTipProps
302
+ toolTipProps: _toolTipProps,
303
+ minWidth: minWidth
233
304
  });
234
305
  };
235
306
  } else if (precision || prefix || suffix) {
@@ -256,7 +327,8 @@ export var formatColumn = function formatColumn(_ref) {
256
327
  value: value,
257
328
  currentValue: renderValue,
258
329
  originalDiffTip: _originalDiffTip,
259
- toolTipProps: _toolTipProps
330
+ toolTipProps: _toolTipProps,
331
+ minWidth: minWidth
260
332
  });
261
333
  };
262
334
  } else if (valueType === 'address') {
@@ -312,7 +384,8 @@ export var formatColumn = function formatColumn(_ref) {
312
384
  node: value,
313
385
  value: value,
314
386
  currentValue: value,
315
- toolTipProps: _toolTipProps
387
+ toolTipProps: _toolTipProps,
388
+ minWidth: minWidth
316
389
  }), suffixNode(value, record, index)]
317
390
  });
318
391
  };
@@ -333,7 +406,8 @@ export var formatColumn = function formatColumn(_ref) {
333
406
  value: value,
334
407
  currentValue: value || '-',
335
408
  originalDiffTip: _originalDiffTip,
336
- toolTipProps: _toolTipProps
409
+ toolTipProps: _toolTipProps,
410
+ minWidth: minWidth
337
411
  }), suffixNode(value, record, index)]
338
412
  });
339
413
  };
@@ -356,7 +430,8 @@ export var formatColumn = function formatColumn(_ref) {
356
430
  value: value,
357
431
  currentValue: value || '-',
358
432
  originalDiffTip: _originalDiffTip,
359
- toolTipProps: _toolTipProps
433
+ toolTipProps: _toolTipProps,
434
+ minWidth: minWidth
360
435
  });
361
436
  };
362
437
  }
@@ -11,6 +11,7 @@ interface Props {
11
11
  width?: number | string;
12
12
  originalValue?: any;
13
13
  toolTipProps?: TooltipProps & React.RefAttributes<unknown>;
14
+ minWidth?: number;
14
15
  }
15
16
  declare const RenderColumn: FC<Props>;
16
17
  export default RenderColumn;
@@ -23,7 +23,8 @@ var RenderColumn = function RenderColumn(props) {
23
23
  originalValue = props.originalValue,
24
24
  originalDiffTip = props.originalDiffTip,
25
25
  _props$toolTipProps = props.toolTipProps,
26
- toolTipProps = _props$toolTipProps === void 0 ? {} : _props$toolTipProps;
26
+ toolTipProps = _props$toolTipProps === void 0 ? {} : _props$toolTipProps,
27
+ minWidth = props.minWidth;
27
28
  var _useSetState = useSetState({
28
29
  tooltip: false
29
30
  }),
@@ -36,7 +37,8 @@ var RenderColumn = function RenderColumn(props) {
36
37
  if (ellipsis) {
37
38
  renderNode = _jsx(Text, {
38
39
  style: {
39
- width: currentValue === '-' ? 32.5 : width
40
+ width: currentValue === '-' ? 32.5 : width,
41
+ minWidth: minWidth
40
42
  },
41
43
  ellipsis: {
42
44
  tooltip: false
@@ -47,7 +49,8 @@ var RenderColumn = function RenderColumn(props) {
47
49
  return _jsx(_Tooltip, _objectSpread(_objectSpread({
48
50
  className: "varied-cell",
49
51
  style: {
50
- width: width
52
+ width: width,
53
+ minWidth: minWidth
51
54
  },
52
55
  title: originalDiffTip ? _jsxs(_Fragment, {
53
56
  children: ["\u521D\u59CB\u503C\uFF1A", originalValue, _jsx("br", {}), ellipsis ? "\u5F53\u524D\u503C\uFF1A".concat(currentValue) : undefined]
@@ -62,7 +65,8 @@ var RenderColumn = function RenderColumn(props) {
62
65
  return _jsx("span", {
63
66
  className: "varied-cell",
64
67
  style: {
65
- width: width
68
+ width: width,
69
+ minWidth: minWidth
66
70
  },
67
71
  children: renderNode
68
72
  });
@@ -133,7 +137,12 @@ var RenderColumn = function RenderColumn(props) {
133
137
  }
134
138
  }, toolTipProps);
135
139
  if (!value) {
136
- return '-';
140
+ return _jsx("div", {
141
+ style: {
142
+ minWidth: minWidth
143
+ },
144
+ children: "-"
145
+ });
137
146
  }
138
147
  return _jsx(_Tooltip, _objectSpread(_objectSpread({
139
148
  title: value,
@@ -146,7 +155,8 @@ var RenderColumn = function RenderColumn(props) {
146
155
  }, tooltipProps), {}, {
147
156
  children: _jsx(Text, {
148
157
  style: {
149
- width: width
158
+ width: width,
159
+ minWidth: minWidth
150
160
  },
151
161
  ellipsis: true,
152
162
  onMouseOver: handleMouseOver,
@@ -155,6 +165,11 @@ var RenderColumn = function RenderColumn(props) {
155
165
  })
156
166
  }));
157
167
  }
158
- return value || value === 0 ? node : '-';
168
+ return _jsx("div", {
169
+ style: {
170
+ minWidth: minWidth
171
+ },
172
+ children: value || value === 0 ? node : '-'
173
+ });
159
174
  };
160
175
  export default RenderColumn;
@@ -30,7 +30,7 @@ export var defaultPage = {
30
30
  pageSize: 10
31
31
  };
32
32
  function ProTable(props) {
33
- var _locale$ProTable, _curTableConfig$pathK;
33
+ var _locale$ProTable, _props$scroll, _curTableConfig$pathK;
34
34
  var _ref = useProConfig('globalConfig') || {},
35
35
  configStorage = _ref.storage; // 获取全局缓存位置配置
36
36
  var _ref2 = useProConfig('ProTable') || {},
@@ -58,6 +58,9 @@ function ProTable(props) {
58
58
  restProps = _objectWithoutProperties(props, _excluded);
59
59
  var _props$scrollFollowPa = props.scrollFollowParent,
60
60
  scrollFollowParent = _props$scrollFollowPa === void 0 ? true : _props$scrollFollowPa;
61
+ var _scroll = (_props$scroll = props === null || props === void 0 ? void 0 : props.scroll) !== null && _props$scroll !== void 0 ? _props$scroll : {
62
+ x: 'max-content'
63
+ };
61
64
  var wrapToolTipProps = {
62
65
  getPopupContainer: scrollFollowParent ? function (triggerNode) {
63
66
  return triggerNode.parentNode;
@@ -201,18 +204,22 @@ function ProTable(props) {
201
204
  }).filter(function (item) {
202
205
  return !(item === null || item === void 0 ? void 0 : item.delete);
203
206
  });
204
- newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item) {
207
+ newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item, index) {
205
208
  formatColumn({
206
209
  column: item,
207
210
  originalObj: originalObj,
208
211
  dataSourceObj: dataSourceObj,
209
212
  rowKey: 'rowKey',
210
213
  diffToolTip: toolTip,
211
- wrapToolTipProps: wrapToolTipProps
214
+ wrapToolTipProps: wrapToolTipProps,
215
+ scroll: _scroll,
216
+ onUpdateMinWidth: function onUpdateMinWidth(w) {
217
+ curColumns[index].minWidth = w;
218
+ }
212
219
  });
213
220
  });
214
221
  return newColumns;
215
- }, [curColumns, handleResize]);
222
+ }, [curColumns, handleResize, _scroll]);
216
223
  var _columns = useMemo(function () {
217
224
  return columns === null || columns === void 0 ? void 0 : columns.filter(function (item, index) {
218
225
  var show = item.show;
@@ -225,6 +232,13 @@ function ProTable(props) {
225
232
  return true;
226
233
  });
227
234
  }, [columns]);
235
+ var isExistPercentWidth = !!(_columns === null || _columns === void 0 ? void 0 : _columns.find(function (item) {
236
+ var _item$width;
237
+ return (item === null || item === void 0 ? void 0 : item.width) && typeof (item === null || item === void 0 ? void 0 : item.width) === 'string' && (item === null || item === void 0 ? void 0 : (_item$width = item.width) === null || _item$width === void 0 ? void 0 : _item$width.endsWith('%'));
238
+ }));
239
+ if (isExistPercentWidth) {
240
+ _scroll = props === null || props === void 0 ? void 0 : props.scroll;
241
+ }
228
242
  var handleColumnConfig = /*#__PURE__*/function () {
229
243
  var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(checkList) {
230
244
  var newColumns, _columnConfig$onColum, catchColumns;
@@ -415,7 +429,8 @@ function ProTable(props) {
415
429
  summary: summary,
416
430
  dataSource: _dataSource
417
431
  },
418
- dataSource: _dataSource
432
+ dataSource: _dataSource,
433
+ scroll: _scroll
419
434
  })), _jsx("span", {
420
435
  className: "pro-table-resizable-line",
421
436
  style: {
@@ -257,12 +257,14 @@
257
257
  }
258
258
  }
259
259
 
260
- .@{ant-prefix}-table-body {
261
- .@{ant-prefix}-table-tbody .@{ant-prefix}-table-row:nth-child(odd).new-cell {
262
- background: #d2fff4 !important;
263
-
264
- td {
265
- background: #d2fff4 !important;
260
+ tbody.@{ant-prefix}-table-tbody {
261
+ tr.@{ant-prefix}-table-row.new-cell {
262
+ background: var(--zaui-contract-bg-add; #d2fff4) !important;
263
+ background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
264
+
265
+ td.@{ant-prefix}-table-cell {
266
+ background: var(--zaui-contract-bg-add; #d2fff4) !important;
267
+ background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
266
268
  border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
267
269
  }
268
270
  }
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  var _react = _interopRequireWildcard(require("react"));
@@ -16,7 +17,7 @@ var _lodash = require("lodash");
16
17
  var _diffOriginal = require("../../../ProForm/utils/diffOriginal");
17
18
  var _ProConfigProvider = require("../../../ProConfigProvider");
18
19
  var _utils = require("../../../utils");
19
- var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "valuePropName"];
20
+ var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName"];
20
21
  var toNamePath = function toNamePath(name) {
21
22
  if (Array.isArray(name)) {
22
23
  return name;
@@ -70,6 +71,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
70
71
  }) : (0, _lodash.get)(originalValues, originalName);
71
72
  };
72
73
  var ListChangedWrapper = function ListChangedWrapper(props) {
74
+ var _getValueProps;
73
75
  var name = props.name,
74
76
  names = props.names,
75
77
  namesStr = props.namesStr,
@@ -84,6 +86,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
84
86
  children = props.children,
85
87
  type = props.type,
86
88
  normalize = props.normalize,
89
+ getValueProps = props.getValueProps,
87
90
  _props$valuePropName = props.valuePropName,
88
91
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
89
92
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
@@ -116,7 +119,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
116
119
  var isAdd = diffType === 'add';
117
120
  var isChanged = diffType === 'changed';
118
121
  if (!isWatch || noChange) {
119
- return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest));
122
+ return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest));
120
123
  }
121
124
  var diffClassName = (0, _classnames.default)({
122
125
  'pro-form-item-changed': isChanged,
@@ -131,16 +134,14 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
131
134
  return target.parentElement;
132
135
  },
133
136
  title: (0, _jsxRuntime.jsxs)(_antd.Space, {
134
- children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children), {}, {
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)({
135
138
  // @ts-ignore
136
- isView: true,
137
- value: originalValue,
138
- checked: type === 'Switch' ? originalValue : undefined
139
- })) : undefined]
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]
140
141
  }),
141
142
  children: (0, _jsxRuntime.jsx)("div", {
142
143
  className: diffClassName,
143
- children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest)) : undefined
144
+ children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest)) : undefined
144
145
  })
145
146
  });
146
147
  };
@@ -566,6 +566,7 @@ var RenderField = function RenderField(_ref) {
566
566
  onChange: _onChange,
567
567
  valuePropName: _formItemProps.valuePropName,
568
568
  normalize: _formItemProps.normalize,
569
+ getValueProps: _formItemProps.getValueProps,
569
570
  children: FieldComponent
570
571
  });
571
572
  }
@@ -49,7 +49,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
49
49
  }
50
50
  var logDebug = function logDebug(msg) {
51
51
  if (props.debugger) {
52
- console.info('proEnum:', msg);
52
+ console.warn('proEnum:', msg);
53
53
  }
54
54
  };
55
55
  var enumRes = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)((0, _objectSpread2.default)({
@@ -54,8 +54,8 @@ var ProEnum = function ProEnum(props) {
54
54
  showCodeName = _ref2.showCodeName,
55
55
  resProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
56
56
  enumProps.showCodeName = (_enumProps$showCodeNa = enumProps.showCodeName) !== null && _enumProps$showCodeNa !== void 0 ? _enumProps$showCodeNa : showCodeName;
57
- var label = '';
58
- var fieldValue = '';
57
+ var label = 'label';
58
+ var fieldValue = 'value';
59
59
  var _useState = (0, _react.useState)(dataSource || []),
60
60
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
61
61
  dataList = _useState2[0],
@@ -86,7 +86,7 @@ var InputNumber = function InputNumber(props) {
86
86
  var _parser = function parser(value, precision) {
87
87
  if (value === '') return value;
88
88
  var num = Number(value.replace(/[\s,]+/g, ''));
89
- return Number.isNaN(num) || !precision && precision !== 0 ? Number.isNaN(Number(value)) ? null : value : num.toFixed(precision);
89
+ return Number.isNaN(num) || !precision && precision !== 0 ? Number.isNaN(Number(value)) ? null : Number(value) : Number(num.toFixed(precision));
90
90
  };
91
91
  if (valueType) {
92
92
  switch (valueType) {
@@ -14,6 +14,7 @@ interface Props {
14
14
  name?: NamePath;
15
15
  valueType: string;
16
16
  valuePropName?: string;
17
+ isView?: boolean;
17
18
  getValueProps?: (value: any) => Record<string, unknown>;
18
19
  }
19
20
  /** 渲染组件 */
@@ -15,7 +15,7 @@ var _ConfirmWrapper = _interopRequireDefault(require("../../../../components/ren
15
15
  var _useFieldProps = require("../../../../utils/useFieldProps");
16
16
  var componentMap = _interopRequireWildcard(require("../../../../../index"));
17
17
  var _AddonWrapper = _interopRequireDefault(require("./AddonWrapper"));
18
- var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after", "getValueProps", "valuePropName", "valueType"];
18
+ var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after", "getValueProps", "valuePropName", "valueType", "isView"];
19
19
  // 这里的key与组件内参数一致, 决定使用哪个包裹组件
20
20
  var wrapperMap = {
21
21
  confirm: _ConfirmWrapper.default,
@@ -49,6 +49,7 @@ var ComRender = function ComRender(props) {
49
49
  _props$valuePropName = props.valuePropName,
50
50
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
51
51
  valueType = props.valueType,
52
+ isView = props.isView,
52
53
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
53
54
  var TypeComponent = componentMap[type];
54
55
  var mergedGetValueProps = getValueProps || function (val) {
@@ -61,7 +62,8 @@ var ComRender = function ComRender(props) {
61
62
  return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
62
63
  value: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, contextProps), {}, {
63
64
  valueType: valueType,
64
- type: type
65
+ type: type,
66
+ isView: isView
65
67
  }),
66
68
  children: Com
67
69
  });
@@ -33,7 +33,8 @@ var Group = function Group(props) {
33
33
  onChange = props.onChange,
34
34
  otherProps = props.otherProps,
35
35
  disabled = props.disabled,
36
- id = props.id;
36
+ id = props.id,
37
+ isView = props.isView;
37
38
  var contextProps = _ProForm.default.useFieldProps() || {};
38
39
  var names = contextProps.names,
39
40
  name = contextProps.name,
@@ -76,7 +77,8 @@ var Group = function Group(props) {
76
77
  children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? (0, _jsxRuntime.jsx)(_antd.Space.Compact, {
77
78
  children: columns.map(function (column, index) {
78
79
  return (0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
79
- contextProps: contextProps
80
+ contextProps: contextProps,
81
+ isView: isView
80
82
  }, column), {}, {
81
83
  otherProps: otherProps
82
84
  }), column.name);
@@ -86,7 +88,8 @@ var Group = function Group(props) {
86
88
  }, (0, _lodash.omit)(space, ['separator', 'compact'])), {}, {
87
89
  children: columns.map(function (column, index) {
88
90
  return (0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
89
- contextProps: contextProps
91
+ contextProps: contextProps,
92
+ isView: isView
90
93
  }, column), {}, {
91
94
  otherProps: otherProps
92
95
  }), column.name);
@@ -17,7 +17,7 @@ var _react = _interopRequireWildcard(require("react"));
17
17
  var _diffOriginal = require("../../utils/diffOriginal");
18
18
  var _ProConfigProvider = require("../../../ProConfigProvider");
19
19
  var _utils = require("../../../utils");
20
- var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize"];
20
+ var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize", "getValueProps"];
21
21
  var ChangedWrapper = function ChangedWrapper(props) {
22
22
  var _diffConfig$toolTip, _children$props, _children$props2, _children$props3;
23
23
  var name = props.name,
@@ -31,6 +31,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
31
31
  _props$valuePropName = props.valuePropName,
32
32
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
33
33
  normalize = props.normalize,
34
+ getValueProps = props.getValueProps,
34
35
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
35
36
  var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
36
37
  isDiffAll = _useProConfig.isDiffAll;
@@ -58,9 +59,10 @@ var ChangedWrapper = function ChangedWrapper(props) {
58
59
  var isChanged = diffType === 'changed';
59
60
  var tipContent = (0, _react.useMemo)(function () {
60
61
  if (!isWatch || noChange) return undefined;
62
+ var valueProps = getValueProps ? getValueProps(originalValue) : originalValue;
61
63
  return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), {}, (0, _defineProperty2.default)({
62
64
  isView: true
63
- }, valuePropName, originalValue))) : undefined;
65
+ }, valuePropName, valueProps === null || valueProps === void 0 ? void 0 : valueProps.value))) : undefined;
64
66
  }, [originalValue, children]);
65
67
  if (!isWatch || noChange) {
66
68
  // 嵌套子组件
@@ -92,9 +94,13 @@ var ChangedWrapper = function ChangedWrapper(props) {
92
94
  },
93
95
  title: (0, _jsxRuntime.jsxs)(_antd.Space, {
94
96
  direction: "vertical",
97
+ className: "changed-tooltip",
95
98
  children: [(0, _jsxRuntime.jsxs)(_antd.Space, {
99
+ align: "start",
100
+ className: "original-value-container",
96
101
  children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
97
102
  }), _showEllipse && (0, _jsxRuntime.jsxs)(_antd.Space, {
103
+ className: "current-value-container",
98
104
  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), {}, {
99
105
  isView: true
100
106
  })) : undefined]
@@ -155,7 +155,7 @@ var Render = function Render(props) {
155
155
  };
156
156
  }
157
157
  /** 移除多余参数,防止透传给formItem报错 */
158
- var _otherFormItemProps = (0, _lodash.omit)(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'toCSTString', 'switchValue', 'precision', 'clearNotShow']);
158
+ var _otherFormItemProps = (0, _lodash.omit)(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'toCSTString', 'switchValue', 'precision', 'clearNotShow', 'dependNames']);
159
159
  /**
160
160
  * globalControl 全局控制优先
161
161
  * globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
@@ -426,7 +426,7 @@ var Render = function Render(props) {
426
426
  span: 24 // 默认占一行
427
427
  });
428
428
  }
429
- if (diffConfig) {
429
+ if (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues) {
430
430
  child = (0, _jsxRuntime.jsx)(_ChangedWrapper.default, {
431
431
  name: formItemProps.name,
432
432
  names: otherProps.names,
@@ -438,6 +438,7 @@ var Render = function Render(props) {
438
438
  onChange: handleChange,
439
439
  valuePropName: _otherFormItemProps.valuePropName,
440
440
  normalize: _otherFormItemProps.normalize,
441
+ getValueProps: _otherFormItemProps.getValueProps,
441
442
  children: child
442
443
  });
443
444
  }
@@ -182,6 +182,8 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
182
182
  }) => React.ReactElement<any, any> | string | undefined | null;
183
183
  viewType?: ViewType;
184
184
  colProps?: ColProps;
185
+ /** 依赖刷新字段列表 */
186
+ dependNames?: NamePath[];
185
187
  /**
186
188
  * @description 表单item的props属性
187
189
  * @deprecated 将于下个版本 4.0.0 被弃用
@@ -190,6 +192,8 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
190
192
  formItemProps?: FormItemProps<Values> & {
191
193
  index?: number;
192
194
  namePath?: NamePath;
195
+ /** 依赖刷新字段列表 */
196
+ dependNames?: NamePath[];
193
197
  };
194
198
  /**
195
199
  * @description 表单props属性
@@ -387,7 +387,7 @@
387
387
 
388
388
  // textArea
389
389
  .@{ant-prefix}-input-textarea > textarea {
390
- background: @zaui-contract-bg;
390
+ background: @zaui-contract-bg !important;
391
391
  }
392
392
 
393
393
  .pro-form-view-container {
@@ -461,7 +461,7 @@
461
461
 
462
462
  // textArea
463
463
  .@{ant-prefix}-input-textarea > textarea {
464
- background: @zaui-contract-bg-add;
464
+ background: @zaui-contract-bg-add !important;
465
465
  }
466
466
 
467
467
 
@@ -472,3 +472,16 @@
472
472
  }
473
473
  }
474
474
  }
475
+
476
+ .changed-tooltip {
477
+ .original-value-container {
478
+ .ant-space-item:nth-child(1) {
479
+ white-space: nowrap;
480
+ }
481
+ }
482
+ .current-value-container {
483
+ .ant-space-item:nth-child(1) {
484
+ white-space: nowrap;
485
+ }
486
+ }
487
+ }