@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
@@ -2,6 +2,7 @@ import { ColProps, FormListFieldData } from 'antd';
2
2
  import React from 'react';
3
3
  import { InternalNamePath } from 'antd/es/form/interface';
4
4
  import { FormListProps } from '../propsType';
5
+ import { DiffConfigProps } from '../../../../propsType';
5
6
  interface Props extends Omit<FormListProps, 'toolbarProps'> {
6
7
  className?: string;
7
8
  index: number;
@@ -12,6 +13,7 @@ interface Props extends Omit<FormListProps, 'toolbarProps'> {
12
13
  field: Omit<FormListFieldData, 'key'> & {
13
14
  key: string;
14
15
  };
16
+ diffConfig?: DiffConfigProps;
15
17
  }
16
18
  declare const LineFields: React.FC<Props>;
17
19
  export default LineFields;
@@ -35,7 +35,8 @@ var LineFields = function LineFields(props) {
35
35
  isView = props.isView,
36
36
  draggable = props.draggable,
37
37
  className = props.className,
38
- id = props.id;
38
+ id = props.id,
39
+ diffConfig = props.diffConfig;
39
40
  var isLess = mode === 'less';
40
41
  var _useSortable = (0, _sortable.useSortable)({
41
42
  id: field.key,
@@ -76,7 +77,8 @@ var LineFields = function LineFields(props) {
76
77
  form: form,
77
78
  colProps: colProps,
78
79
  disabled: disabled,
79
- isView: isView
80
+ isView: isView,
81
+ diffConfig: diffConfig
80
82
  })
81
83
  }), actionProps !== false && (0, _jsxRuntime.jsx)(_ActionButton.default, {
82
84
  min: min,
@@ -11,6 +11,7 @@ var _jsxRuntime = require("react/jsx-runtime");
11
11
  var _react = require("react");
12
12
  var _antd = require("antd");
13
13
  var _core = require("@dnd-kit/core");
14
+ var _lodash = require("lodash");
14
15
  var _sortable = require("@dnd-kit/sortable");
15
16
  var _utils = require("../../../utils");
16
17
  var _utils2 = require("./utils");
@@ -18,6 +19,7 @@ var _ToolbarButton = _interopRequireDefault(require("./components/ToolbarButton"
18
19
  var _BlockFields = _interopRequireDefault(require("./components/BlockFields"));
19
20
  var _LineFields = _interopRequireDefault(require("./components/LineFields"));
20
21
  var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
22
+ var _ProConfigProvider = require("../../../../ProConfigProvider");
21
23
  var FormList = function FormList(props, ref) {
22
24
  var columns = props.columns,
23
25
  min = props.min,
@@ -39,9 +41,16 @@ var FormList = function FormList(props, ref) {
39
41
  var _ref = _ProForm.default.useFieldProps() || {},
40
42
  form = _ref.form,
41
43
  name = _ref.name,
42
- isView = _ref.isView;
44
+ isView = _ref.isView,
45
+ diffConfig = _ref.diffConfig;
46
+ var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
47
+ isDiffAll = _useProConfig.isDiffAll;
43
48
  var errors = meta.errors;
44
49
  var _namePath = (0, _utils.toArray)(name);
50
+ var orgValues = (0, _lodash.get)(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
51
+ var _diffConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, diffConfig), {}, {
52
+ originalValues: isDiffAll ? orgValues || [] : orgValues
53
+ });
45
54
  var processColumns = (0, _react.useCallback)(function (fieldName, namePath) {
46
55
  return columns.map(function (item) {
47
56
  // names的name处理
@@ -104,7 +113,8 @@ var FormList = function FormList(props, ref) {
104
113
  colProps: {
105
114
  span: span
106
115
  },
107
- form: form
116
+ form: form,
117
+ diffConfig: _diffConfig
108
118
  }), field.key) : (0, _jsxRuntime.jsx)(_LineFields.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
109
119
  className: _fields.length === index + 1 ? 'pro-form-list-last' : ''
110
120
  }, props), {}, {
@@ -118,7 +128,8 @@ var FormList = function FormList(props, ref) {
118
128
  colProps: {
119
129
  span: mode === 'less' ? 24 : span
120
130
  },
121
- form: form
131
+ form: form,
132
+ diffConfig: _diffConfig
122
133
  }), field.key);
123
134
  }), (0, _jsxRuntime.jsx)(_antd.Form.ErrorList, {
124
135
  errors: errors
@@ -32,15 +32,15 @@ var Group = function Group(props) {
32
32
  value = props.value,
33
33
  onChange = props.onChange,
34
34
  otherProps = props.otherProps,
35
- disabled = props.disabled,
36
35
  id = props.id,
37
- isView = props.isView;
36
+ isParentView = props.isView;
38
37
  var contextProps = _ProForm.default.useFieldProps() || {};
39
38
  var names = contextProps.names,
40
39
  name = contextProps.name,
41
40
  form = contextProps.form,
42
41
  namePath = contextProps.namePath,
43
- index = contextProps.index;
42
+ index = contextProps.index,
43
+ isView = contextProps.isView;
44
44
  var _option = _react.default.useRef([]);
45
45
  // 组合onChange
46
46
  var handleChange = function handleChange(value, option, index) {
@@ -78,7 +78,7 @@ var Group = function Group(props) {
78
78
  children: columns.map(function (column, index) {
79
79
  return (0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
80
80
  contextProps: contextProps,
81
- isView: isView
81
+ isView: isParentView || isView
82
82
  }, column), {}, {
83
83
  otherProps: otherProps
84
84
  }), column.name);
@@ -89,7 +89,7 @@ var Group = function Group(props) {
89
89
  children: columns.map(function (column, index) {
90
90
  return (0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
91
91
  contextProps: contextProps,
92
- isView: isView
92
+ isView: isParentView || isView
93
93
  }, column), {}, {
94
94
  otherProps: otherProps
95
95
  }), column.name);
@@ -50,7 +50,7 @@ var getViewLabel = function getViewLabel(_ref) {
50
50
  return viewLabel;
51
51
  };
52
52
  var ProCascader = function ProCascader(props) {
53
- var _props$otherProps, _value$slice, _ref7, _ref7$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
53
+ var _props$otherProps, _value$slice, _ref5, _ref5$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
54
54
  var _ref2 = (0, _ProConfigProvider.useProConfig)('ProAddressBar') || {},
55
55
  configDetailMaxLength = _ref2.detailMaxLength,
56
56
  configEnumCode = _ref2.enumCode,
@@ -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 = (0, _objectWithoutProperties2.default)(props, _excluded);
85
85
  var _ref3 = _.default.useFieldProps() || {},
@@ -90,16 +90,18 @@ var ProCascader = function ProCascader(props) {
90
90
  var realLevel = Math.max(2, level);
91
91
  var detail = value === null || value === void 0 ? void 0 : value[realLevel];
92
92
  var enumData = (0, _useEnum.default)(addressCode);
93
- var _ref4 = Array.isArray(enumData) ? enumData : [],
94
- _ref5 = (0, _slicedToArray2.default)(_ref4, 1),
95
- _ref5$ = _ref5[0],
96
- enumDataSource = _ref5$ === void 0 ? [] : _ref5$;
93
+ var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProEnum'),
94
+ _useProConfig$dics = _useProConfig.dics,
95
+ dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
96
+ var enumDataSource = (0, _react.useMemo)(function () {
97
+ if (!(props === null || props === void 0 ? void 0 : props.mode)) {
98
+ return (dics === null || dics === void 0 ? void 0 : dics[addressCode]) || [];
99
+ }
100
+ return Array.isArray(enumData) ? enumData[0] : [];
101
+ }, [dics === null || dics === void 0 ? void 0 : dics[addressCode], enumData]);
97
102
  var realDataSource = (0, _react.useMemo)(function () {
98
103
  var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
99
104
  var result = (0, _index.transformDataName)(isAddressMode && realLevel === 2 ? _filterDataSource(innerDataSource, level, fieldNames) : innerDataSource, fieldNames);
100
- if (transformResponse) {
101
- return transformResponse(result);
102
- }
103
105
  return result;
104
106
  }, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
105
107
  var _useRequest = (0, _objectSpread3.default)({}, useRequest),
@@ -115,7 +117,7 @@ var ProCascader = function ProCascader(props) {
115
117
  defaultLabel = _useState4[0],
116
118
  setDefaultLabel = _useState4[1];
117
119
  var getFirstLevelOptions = /*#__PURE__*/function () {
118
- var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
120
+ var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
119
121
  var _yield$service, data, newData, transFormData, serviceData;
120
122
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
121
123
  while (1) switch (_context.prev = _context.next) {
@@ -143,9 +145,13 @@ var ProCascader = function ProCascader(props) {
143
145
  }, _callee);
144
146
  }));
145
147
  return function getFirstLevelOptions() {
146
- return _ref6.apply(this, arguments);
148
+ return _ref4.apply(this, arguments);
147
149
  };
148
150
  }();
151
+ // 提取出来默认每次都执行
152
+ if (transformResponse) {
153
+ realDataSource = transformResponse(realDataSource);
154
+ }
149
155
  (0, _react.useEffect)(function () {
150
156
  if (service) {
151
157
  // 传入useRequest时,初次加载级联第一级数据源
@@ -154,13 +160,14 @@ var ProCascader = function ProCascader(props) {
154
160
  }, [service]);
155
161
  (0, _react.useEffect)(function () {
156
162
  if (realIsView && value) {
163
+ var _realDataSource;
157
164
  // 传入dataSource + 查看时初始化展示
158
165
  if (service) {
159
166
  setDefaultLabel(getViewLabel({
160
167
  dataSource: serviceData,
161
168
  value: isAddressMode && hasDetail ? value === null || value === void 0 ? void 0 : value.slice(0, realLevel) : value
162
169
  }));
163
- } else if ((realDataSource === null || realDataSource === void 0 ? void 0 : realDataSource.length) > 0) {
170
+ } else if (((_realDataSource = realDataSource) === null || _realDataSource === void 0 ? void 0 : _realDataSource.length) > 0) {
164
171
  setDefaultLabel(getViewLabel({
165
172
  dataSource: realDataSource,
166
173
  value: isAddressMode && hasDetail ? value === null || value === void 0 ? void 0 : value.slice(0, realLevel) : value
@@ -194,9 +201,9 @@ var ProCascader = function ProCascader(props) {
194
201
  var addressValue = isAddressMode ? value && ((_value$slice = value.slice(0, realLevel)) === null || _value$slice === void 0 ? void 0 : _value$slice.some(function (item) {
195
202
  return !!item;
196
203
  })) ? value.slice(0, realLevel) : undefined : value;
197
- var viewValue = isAddressMode ? ((_ref7 = [].concat((0, _toConsumableArray2.default)(defaultLabel), [value === null || value === void 0 ? void 0 : value[realLevel]])) === null || _ref7 === void 0 ? void 0 : (_ref7$filter = _ref7.filter(function (item) {
204
+ var viewValue = isAddressMode ? ((_ref5 = [].concat((0, _toConsumableArray2.default)(defaultLabel), [value === null || value === void 0 ? void 0 : value[realLevel]])) === null || _ref5 === void 0 ? void 0 : (_ref5$filter = _ref5.filter(function (item) {
198
205
  return !!item;
199
- })) === null || _ref7$filter === void 0 ? void 0 : _ref7$filter.join(separator)) || '-' : (defaultLabel === null || defaultLabel === void 0 ? void 0 : (_defaultLabel$filter = defaultLabel.filter(function (item) {
206
+ })) === null || _ref5$filter === void 0 ? void 0 : _ref5$filter.join(separator)) || '-' : (defaultLabel === null || defaultLabel === void 0 ? void 0 : (_defaultLabel$filter = defaultLabel.filter(function (item) {
200
207
  return !!item;
201
208
  })) === null || _defaultLabel$filter === void 0 ? void 0 : _defaultLabel$filter.join(separator)) || '-';
202
209
  var _findSelectedOptions = function findSelectedOptions(options, value) {
@@ -190,11 +190,25 @@ var ProModalSelect = function ProModalSelect(props, ref) {
190
190
  value: item[valueKey],
191
191
  label: item[labelKey]
192
192
  }));
193
- })) === null || _data$map === void 0 ? void 0 : _data$map.join(',') : undefined;
193
+ })) === null || _data$map === void 0 ? void 0 : _data$map.join(',') : '';
194
194
  };
195
195
  var viewText = (0, _react.useMemo)(function () {
196
- return formatValue(labelInValue ? value : _value);
197
- }, [value, _value]);
196
+ var nextValue = labelInValue ? value : _value;
197
+ if (labelInValue) {
198
+ nextValue = value;
199
+ } else {
200
+ var _options$find;
201
+ var optionDTO = options === null || options === void 0 ? void 0 : (_options$find = options.find) === null || _options$find === void 0 ? void 0 : _options$find.call(options, function (item) {
202
+ return item[valueKey] === value;
203
+ });
204
+ if (optionDTO) {
205
+ nextValue = optionDTO;
206
+ } else {
207
+ nextValue = _value;
208
+ }
209
+ }
210
+ return formatValue(nextValue);
211
+ }, [value, _value, options]);
198
212
  /**
199
213
  * 获取表格的rowKey,支持函数、字符串
200
214
  * @date 2023-02-16
@@ -826,7 +840,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
826
840
  onOk: handleFinish,
827
841
  // @ts-ignore
828
842
  onCancel: handleClose,
829
- visible: visible
843
+ visible: visible,
844
+ zIndex: 1071
830
845
  }, restModalProps), {}, {
831
846
  children: [(0, _jsxRuntime.jsx)(_index.ProForm, {
832
847
  submitOnEnter: true,
@@ -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", "getValueProps"];
20
+ var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize", "getValueProps", "viewRender"];
21
21
  var ChangedWrapper = function ChangedWrapper(props) {
22
22
  var _diffConfig$toolTip, _children$props, _children$props2, _children$props3;
23
23
  var name = props.name,
@@ -32,12 +32,15 @@ var ChangedWrapper = function ChangedWrapper(props) {
32
32
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
33
33
  normalize = props.normalize,
34
34
  getValueProps = props.getValueProps,
35
+ viewRender = props.viewRender,
35
36
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
36
37
  var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
37
38
  isDiffAll = _useProConfig.isDiffAll;
38
39
  var originalValues = diffConfig.originalValues,
39
40
  changeTipColor = diffConfig.changeTipColor,
40
- addTipColor = diffConfig.addTipColor;
41
+ addTipColor = diffConfig.addTipColor,
42
+ _diffConfig$scrollFol = diffConfig.scrollFollowParent,
43
+ scrollFollowParent = _diffConfig$scrollFol === void 0 ? true : _diffConfig$scrollFol;
41
44
  var toolTip = (_diffConfig$toolTip = diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
42
45
  var isWatch = toolTip && !['FormList', 'ProEditTable'].includes(type);
43
46
  var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
@@ -57,9 +60,19 @@ var ChangedWrapper = function ChangedWrapper(props) {
57
60
  }, [isWatch, noChange, props[valuePropName], originalValue]);
58
61
  var isAdd = diffType === 'add';
59
62
  var isChanged = diffType === 'changed';
63
+ var viewRenderFun = (0, _react.useMemo)(function () {
64
+ return function (orgValue) {
65
+ return viewRender(orgValue, originalValues, {
66
+ form: form
67
+ });
68
+ };
69
+ }, [form]);
60
70
  var tipContent = (0, _react.useMemo)(function () {
61
71
  if (!isWatch || noChange) return undefined;
62
- var valueProps = getValueProps ? getValueProps(originalValue) : originalValue;
72
+ var valueProps = getValueProps && !names ? getValueProps(originalValue) : {
73
+ value: originalValue
74
+ };
75
+ if (viewRender) return viewRenderFun(valueProps === null || valueProps === void 0 ? void 0 : valueProps.value);
63
76
  return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), {}, (0, _defineProperty2.default)({
64
77
  isView: true
65
78
  }, valuePropName, valueProps === null || valueProps === void 0 ? void 0 : valueProps.value))) : undefined;
@@ -71,27 +84,32 @@ var ChangedWrapper = function ChangedWrapper(props) {
71
84
  originalValues: isNestedField ? originalValues : undefined
72
85
  }, children.props), rest));
73
86
  }
87
+ // eslint-disable-next-line react-hooks/rules-of-hooks
88
+ // const isFocus = useFocus(contentRef.current);
74
89
  var tipOpenCalc = function tipOpenCalc() {
75
90
  if (!toolTip) return false;
76
- // 传入undefined 鼠标移入显示移出隐藏
91
+ // 传入undefined 鼠标移入显示移出隐藏 获得焦点时不显示气泡
77
92
  return isChanged ? undefined : false;
78
93
  };
79
94
  var style = {
80
95
  '--zaui-contract-bg': changeTipColor,
81
96
  '--zaui-contract-bg-add': addTipColor
82
97
  };
98
+ // @ts-ignore
99
+ 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);
83
100
  var diffClassName = (0, _classnames.default)({
84
101
  'pro-form-item-changed': isChanged,
85
102
  'pro-form-item-add': isAdd
86
103
  });
87
- // @ts-ignore
88
- 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);
104
+ var open = tipOpenCalc();
89
105
  return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
90
- open: tipOpenCalc(),
91
- // mouseEnterDelay={1}
92
- getPopupContainer: function getPopupContainer(target) {
93
- return target.parentElement;
106
+ open: open,
107
+ getPopupContainer: function getPopupContainer(trigger) {
108
+ return scrollFollowParent ? trigger.parentElement : document.body;
94
109
  },
110
+ overlayClassName: "original-value-tootip",
111
+ placement: "topLeft",
112
+ autoAdjustOverflow: false,
95
113
  title: (0, _jsxRuntime.jsxs)(_antd.Space, {
96
114
  direction: "vertical",
97
115
  className: "changed-tooltip",
@@ -102,15 +120,16 @@ var ChangedWrapper = function ChangedWrapper(props) {
102
120
  }), _showEllipse && (0, _jsxRuntime.jsxs)(_antd.Space, {
103
121
  className: "current-value-container",
104
122
  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), {}, {
123
+ scrollFollowParent: scrollFollowParent,
105
124
  isView: true
106
125
  })) : undefined]
107
126
  })]
108
127
  }),
109
- placement: "topLeft",
110
128
  children: (0, _jsxRuntime.jsx)("div", {
111
129
  className: diffClassName,
112
130
  style: style,
113
131
  children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest), {}, {
132
+ scrollFollowParent: scrollFollowParent,
114
133
  otherProps: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.otherProps), {}, {
115
134
  isDiffChange: isChanged
116
135
  })
@@ -50,7 +50,8 @@ var Render = function Render(props) {
50
50
  requiredOnView = props.requiredOnView,
51
51
  confirm = props.confirm,
52
52
  globalControl = props.globalControl,
53
- diffConfig = props.diffConfig;
53
+ diffConfig = props.diffConfig,
54
+ viewRender = props.viewRender;
54
55
  var colProps = props.colProps;
55
56
  // 剔除一些不是FormItem的属性, 防止控制台报warning
56
57
  var labelWidth = formItemProps.labelWidth,
@@ -439,6 +440,7 @@ var Render = function Render(props) {
439
440
  valuePropName: _otherFormItemProps.valuePropName,
440
441
  normalize: _otherFormItemProps.normalize,
441
442
  getValueProps: _otherFormItemProps.getValueProps,
443
+ viewRender: viewRender,
442
444
  children: child
443
445
  });
444
446
  }
@@ -194,7 +194,8 @@ var RenderFields = function RenderFields(props) {
194
194
  namePath: column.namePath,
195
195
  listName: column.listName,
196
196
  globalControl: globalControl,
197
- formDisabled: formDisabled
197
+ formDisabled: formDisabled,
198
+ diffConfig: diffConfig
198
199
  };
199
200
  return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
200
201
  value: otherProps,
@@ -217,7 +218,8 @@ var RenderFields = function RenderFields(props) {
217
218
  diffConfig: diffConfig,
218
219
  equalWith: equalWith,
219
220
  requiredOnView: requiredOnView,
220
- globalControl: globalControl
221
+ globalControl: globalControl,
222
+ viewRender: viewRender
221
223
  })
222
224
  }, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
223
225
  });
@@ -45,6 +45,7 @@ export interface ProFormOtherProps {
45
45
  globalControl?: boolean;
46
46
  formDisabled?: boolean;
47
47
  isDiffChange?: boolean;
48
+ diffConfig?: DiffConfigProps;
48
49
  }
49
50
  export interface DiffConfigProps<Values = any> {
50
51
  /** 比对原始数据源 */
@@ -55,6 +56,8 @@ export interface DiffConfigProps<Values = any> {
55
56
  changeTipColor?: string;
56
57
  /** 新增提示颜色 */
57
58
  addTipColor?: string;
59
+ /** 是否跟随父组件滚动 */
60
+ scrollFollowParent?: string;
58
61
  }
59
62
  export interface ProFormProps<Values = any> extends FormProps<Values> {
60
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);
@@ -329,6 +334,9 @@
329
334
  border-radius: 4px;
330
335
  background: @zaui-contract-bg !important;
331
336
 
337
+ .@{ant-prefix}-input {
338
+ background: @zaui-contract-bg !important;
339
+ }
332
340
  .@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
333
341
  background: @zaui-contract-bg !important;
334
342
  }
@@ -403,6 +411,10 @@
403
411
  border-radius: 4px;
404
412
  background: @zaui-contract-bg-add !important;
405
413
 
414
+ .@{ant-prefix}-input {
415
+ background: @zaui-contract-bg !important;
416
+ }
417
+
406
418
  .@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
407
419
  background: @zaui-contract-bg-add !important;
408
420
  }
@@ -473,15 +485,29 @@
473
485
  }
474
486
  }
475
487
 
476
- .changed-tooltip {
477
- .original-value-container {
478
- .ant-space-item:nth-child(1) {
479
- white-space: nowrap;
488
+ .original-value-tootip{
489
+ max-width: 100%;
490
+ width: max-content;
491
+ position: fixed;
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
+ }
480
505
  }
481
- }
482
- .current-value-container {
483
- .ant-space-item:nth-child(1) {
484
- white-space: nowrap;
506
+ .current-value-container {
507
+ .ant-space-item:nth-child(1) {
508
+ white-space: nowrap;
509
+ }
485
510
  }
486
511
  }
487
- }
512
+ }
513
+
@@ -6,6 +6,18 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.diffOriginal = void 0;
7
7
  var _lodash = require("lodash");
8
8
  var _utils = require("../../utils");
9
+ // 过滤对象中undefined字段
10
+ // 防止{a: '1'} {a: '1', b: undefined}被认为不相等
11
+ var filterUndefined = function filterUndefined(data) {
12
+ if (!(0, _lodash.isObject)(data) || Array.isArray(data) || data === null) return data;
13
+ var resData = {};
14
+ Object.keys(data).forEach(function (key) {
15
+ if (data[key] !== undefined) {
16
+ resData[key] = data[key];
17
+ }
18
+ });
19
+ return resData;
20
+ };
9
21
  var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
10
22
  var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
11
23
  var originalValue = params.originalValue,
@@ -35,7 +47,7 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
35
47
  return isSame ? 'same' : 'changed';
36
48
  }
37
49
  if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
38
- return (0, _lodash.isEqual)(value, originalValue) ? 'same' : 'changed';
50
+ return (0, _lodash.isEqual)(filterUndefined(value), filterUndefined(originalValue)) ? 'same' : 'changed';
39
51
  }
40
52
  return 'same';
41
53
  };
@@ -170,9 +170,6 @@ var useShouldUpdate = function useShouldUpdate(props) {
170
170
  index: index,
171
171
  namePath: namePath
172
172
  }) : rules;
173
- // const _component = isFunction(originComponent)
174
- // ? originComponent(_currentValues, { form, index, namePath })
175
- // : newComponent;
176
173
  var _fieldProps = (0, _lodash.isFunction)(fieldProps) ? fieldProps(_currentValues, {
177
174
  form: form,
178
175
  index: index,
@@ -203,17 +200,12 @@ var useShouldUpdate = function useShouldUpdate(props) {
203
200
  }
204
201
  var equalRes = (0, _lodash.isEqualWith)(rulesRef.current, _rules, _index.customEqualForFun);
205
202
  var proEqualRes = (0, _lodash.isEqualWith)(fieldPropsRef.current, _fieldProps, _index.customEqualForFun);
206
- if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes
207
- // 值变更,需要同步更新函数式的fieldProps
208
- // (isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues)) ||
209
- // !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
210
- // equalDependencies(dependencies, prevValues, _currentValues)
203
+ if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes || (_fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.transformResponse) // 防止fieldProps变更时,transformResponse根据fieldProps新值无法触发更新
211
204
  ) {
212
205
  showRef.current = _show;
213
206
  disabledRef.current = _disabled;
214
207
  requiredRef.current = _required;
215
208
  rulesRef.current = _rules;
216
- // originComponentRef.current = _component;
217
209
  fieldPropsRef.current = _fieldProps;
218
210
  reRender({});
219
211
  return false;
@@ -1,14 +1,15 @@
1
1
  import React from 'react';
2
2
  import { ProTableColumn } from '../../propsType';
3
- export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, scroll, onUpdateMinWidth, }: {
3
+ export declare const formatColumn: ({ column, originalObj, rowKey, diffToolTip, wrapToolTipProps, scroll, onUpdateMinWidth, isInNewRow, diffConfig, }: {
4
4
  column: ProTableColumn;
5
5
  originalObj: any;
6
- dataSourceObj: any;
7
6
  rowKey: any;
8
7
  diffToolTip?: boolean;
9
8
  wrapToolTipProps?: any;
10
9
  scroll?: any;
11
10
  onUpdateMinWidth?: any;
11
+ isInNewRow?: any;
12
+ diffConfig: any;
12
13
  }) => void;
13
14
  /**
14
15
  * 查找最近的父级className