@zat-design/sisyphus-react 3.8.2 → 3.8.3-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 (109) hide show
  1. package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
  2. package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
  3. package/coverage/lcov-report/src/.umi/core/index.html +206 -0
  4. package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
  5. package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
  6. package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
  7. package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
  8. package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
  9. package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
  10. package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
  11. package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
  12. package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
  13. package/coverage/lcov-report/src/.umi/index.html +116 -0
  14. package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
  15. package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
  16. package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
  17. package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
  18. package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
  19. package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
  20. package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
  21. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
  22. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
  23. package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
  24. package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
  25. package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
  26. package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
  27. package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
  28. package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
  29. package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
  30. package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
  31. package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
  32. package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
  33. package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
  34. package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
  35. package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
  36. package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
  37. package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
  38. package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
  39. package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
  40. package/dist/index.esm.css +32 -8
  41. package/dist/less.esm.css +32 -8
  42. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +22 -7
  43. package/es/ProEditTable/components/RenderField/index.js +9 -1
  44. package/es/ProEditTable/index.js +0 -1
  45. package/es/ProEditTable/propsType.d.ts +0 -1
  46. package/es/ProEditTable/utils/index.js +10 -3
  47. package/es/ProEnum/hooks/useEnumRequest.js +1 -1
  48. package/es/ProEnum/index.js +2 -2
  49. package/es/ProForm/components/base/InputNumber/index.js +1 -1
  50. package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  51. package/es/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
  52. package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
  53. package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  54. package/es/ProForm/components/combination/FormList/index.js +14 -3
  55. package/es/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
  56. package/es/ProForm/components/combination/Group/component/ComRender.js +4 -2
  57. package/es/ProForm/components/combination/Group/index.js +6 -3
  58. package/es/ProForm/components/combination/ProCascader/index.js +20 -13
  59. package/es/ProForm/components/combination/ProModalSelect/index.js +17 -3
  60. package/es/ProForm/components/render/ChangedWrapper.js +20 -2
  61. package/es/ProForm/components/render/Render.js +6 -3
  62. package/es/ProForm/components/render/RenderFields.js +4 -2
  63. package/es/ProForm/components/render/propsType.d.ts +4 -0
  64. package/es/ProForm/propsType.d.ts +1 -0
  65. package/es/ProForm/style/index.less +22 -2
  66. package/es/ProForm/utils/diffOriginal.js +14 -2
  67. package/es/ProForm/utils/useShouldUpdate.js +20 -13
  68. package/es/ProTable/components/FormatColumn/index.d.ts +4 -1
  69. package/es/ProTable/components/FormatColumn/index.js +180 -30
  70. package/es/ProTable/components/RenderColumn/index.d.ts +2 -0
  71. package/es/ProTable/components/RenderColumn/index.js +28 -10
  72. package/es/ProTable/index.js +26 -10
  73. package/es/ProTable/propsType.d.ts +4 -0
  74. package/es/ProTable/style/index.less +22 -6
  75. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +25 -10
  76. package/lib/ProEditTable/components/RenderField/index.js +9 -1
  77. package/lib/ProEditTable/index.js +0 -1
  78. package/lib/ProEditTable/propsType.d.ts +0 -1
  79. package/lib/ProEditTable/utils/index.js +10 -3
  80. package/lib/ProEnum/hooks/useEnumRequest.js +1 -1
  81. package/lib/ProEnum/index.js +2 -2
  82. package/lib/ProForm/components/base/InputNumber/index.js +1 -1
  83. package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  84. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
  85. package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
  86. package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  87. package/lib/ProForm/components/combination/FormList/index.js +14 -3
  88. package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
  89. package/lib/ProForm/components/combination/Group/component/ComRender.js +4 -2
  90. package/lib/ProForm/components/combination/Group/index.js +6 -3
  91. package/lib/ProForm/components/combination/ProCascader/index.js +20 -13
  92. package/lib/ProForm/components/combination/ProModalSelect/index.js +17 -3
  93. package/lib/ProForm/components/render/ChangedWrapper.js +20 -2
  94. package/lib/ProForm/components/render/Render.js +6 -3
  95. package/lib/ProForm/components/render/RenderFields.js +4 -2
  96. package/lib/ProForm/components/render/propsType.d.ts +4 -0
  97. package/lib/ProForm/propsType.d.ts +1 -0
  98. package/lib/ProForm/style/index.less +22 -2
  99. package/lib/ProForm/utils/diffOriginal.js +13 -1
  100. package/lib/ProForm/utils/useShouldUpdate.js +18 -11
  101. package/lib/ProTable/components/FormatColumn/index.d.ts +4 -1
  102. package/lib/ProTable/components/FormatColumn/index.js +179 -29
  103. package/lib/ProTable/components/RenderColumn/index.d.ts +2 -0
  104. package/lib/ProTable/components/RenderColumn/index.js +27 -9
  105. package/lib/ProTable/index.js +26 -10
  106. package/lib/ProTable/propsType.d.ts +4 -0
  107. package/lib/ProTable/style/index.less +22 -6
  108. package/package.json +4 -3
  109. package/.vscode/extensions.json +0 -5
@@ -31,7 +31,8 @@ var BlockFields = function BlockFields(props) {
31
31
  _props$level = props.level,
32
32
  level = _props$level === void 0 ? '2' : _props$level,
33
33
  towCollapse = props.towCollapse,
34
- id = props.id;
34
+ id = props.id,
35
+ diffConfig = props.diffConfig;
35
36
  var _title = useMemo(function () {
36
37
  if (isFunction(title)) {
37
38
  var record = form.getFieldValue(namePath);
@@ -73,7 +74,8 @@ var BlockFields = function BlockFields(props) {
73
74
  form: form,
74
75
  colProps: colProps,
75
76
  disabled: disabled,
76
- isView: isView
77
+ isView: isView,
78
+ diffConfig: diffConfig
77
79
  })
78
80
  }, field.key)
79
81
  })
@@ -2,6 +2,7 @@ import { ColProps, FormListFieldData } from 'antd';
2
2
  import React from 'react';
3
3
  import { InternalNamePath } from 'antd/es/form/interface';
4
4
  import { FormListProps } from '../propsType';
5
+ import { DiffConfigProps } from '../../../../propsType';
5
6
  interface Props extends Omit<FormListProps, 'toolbarProps'> {
6
7
  className?: string;
7
8
  index: number;
@@ -12,6 +13,7 @@ interface Props extends Omit<FormListProps, 'toolbarProps'> {
12
13
  field: Omit<FormListFieldData, 'key'> & {
13
14
  key: string;
14
15
  };
16
+ diffConfig?: DiffConfigProps;
15
17
  }
16
18
  declare const LineFields: React.FC<Props>;
17
19
  export default LineFields;
@@ -29,7 +29,8 @@ var LineFields = function LineFields(props) {
29
29
  isView = props.isView,
30
30
  draggable = props.draggable,
31
31
  className = props.className,
32
- id = props.id;
32
+ id = props.id,
33
+ diffConfig = props.diffConfig;
33
34
  var isLess = mode === 'less';
34
35
  var _useSortable = useSortable({
35
36
  id: field.key,
@@ -70,7 +71,8 @@ var LineFields = function LineFields(props) {
70
71
  form: form,
71
72
  colProps: colProps,
72
73
  disabled: disabled,
73
- isView: isView
74
+ isView: isView,
75
+ diffConfig: diffConfig
74
76
  })
75
77
  }), actionProps !== false && _jsx(ActionButton, {
76
78
  min: min,
@@ -5,6 +5,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  import { forwardRef, useCallback, useImperativeHandle } from 'react';
7
7
  import { DndContext } from '@dnd-kit/core';
8
+ import { get } from 'lodash';
8
9
  import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
9
10
  import { toArray } from '../../../utils';
10
11
  import { namesPathTransform } from './utils';
@@ -12,6 +13,7 @@ import ToolbarButton from './components/ToolbarButton';
12
13
  import BlockFields from './components/BlockFields';
13
14
  import LineFields from './components/LineFields';
14
15
  import ProForm from '../../../../ProForm';
16
+ import { useProConfig } from '../../../../ProConfigProvider';
15
17
  var FormList = function FormList(props, ref) {
16
18
  var columns = props.columns,
17
19
  min = props.min,
@@ -33,9 +35,16 @@ var FormList = function FormList(props, ref) {
33
35
  var _ref = ProForm.useFieldProps() || {},
34
36
  form = _ref.form,
35
37
  name = _ref.name,
36
- isView = _ref.isView;
38
+ isView = _ref.isView,
39
+ diffConfig = _ref.diffConfig;
40
+ var _useProConfig = useProConfig('ProForm'),
41
+ isDiffAll = _useProConfig.isDiffAll;
37
42
  var errors = meta.errors;
38
43
  var _namePath = toArray(name);
44
+ var orgValues = get(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
45
+ var _diffConfig = _objectSpread(_objectSpread({}, diffConfig), {}, {
46
+ originalValues: isDiffAll ? orgValues || [] : orgValues
47
+ });
39
48
  var processColumns = useCallback(function (fieldName, namePath) {
40
49
  return columns.map(function (item) {
41
50
  // names的name处理
@@ -98,7 +107,8 @@ var FormList = function FormList(props, ref) {
98
107
  colProps: {
99
108
  span: span
100
109
  },
101
- form: form
110
+ form: form,
111
+ diffConfig: _diffConfig
102
112
  }), field.key) : _jsx(LineFields, _objectSpread(_objectSpread({
103
113
  className: _fields.length === index + 1 ? 'pro-form-list-last' : ''
104
114
  }, props), {}, {
@@ -112,7 +122,8 @@ var FormList = function FormList(props, ref) {
112
122
  colProps: {
113
123
  span: mode === 'less' ? 24 : span
114
124
  },
115
- form: form
125
+ form: form,
126
+ diffConfig: _diffConfig
116
127
  }), field.key);
117
128
  }), _jsx(_Form.ErrorList, {
118
129
  errors: errors
@@ -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
  /** 渲染组件 */
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
- var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after", "getValueProps", "valuePropName", "valueType"];
4
+ var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after", "getValueProps", "valuePropName", "valueType", "isView"];
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import React from 'react';
7
7
  import ConfirmWrapper from '../../../../components/render/ConfirmWrapper';
@@ -41,6 +41,7 @@ var ComRender = function ComRender(props) {
41
41
  _props$valuePropName = props.valuePropName,
42
42
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
43
43
  valueType = props.valueType,
44
+ isView = props.isView,
44
45
  rest = _objectWithoutProperties(props, _excluded);
45
46
  var TypeComponent = componentMap[type];
46
47
  var mergedGetValueProps = getValueProps || function (val) {
@@ -53,7 +54,8 @@ var ComRender = function ComRender(props) {
53
54
  return _jsx(FieldProvider, {
54
55
  value: _objectSpread(_objectSpread({}, contextProps), {}, {
55
56
  valueType: valueType,
56
- type: type
57
+ type: type,
58
+ isView: isView
57
59
  }),
58
60
  children: Com
59
61
  });
@@ -27,7 +27,8 @@ var Group = function Group(props) {
27
27
  onChange = props.onChange,
28
28
  otherProps = props.otherProps,
29
29
  disabled = props.disabled,
30
- id = props.id;
30
+ id = props.id,
31
+ isView = props.isView;
31
32
  var contextProps = ProForm.useFieldProps() || {};
32
33
  var names = contextProps.names,
33
34
  name = contextProps.name,
@@ -70,7 +71,8 @@ var Group = function Group(props) {
70
71
  children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
71
72
  children: columns.map(function (column, index) {
72
73
  return _jsx(ComRender, _objectSpread(_objectSpread({
73
- contextProps: contextProps
74
+ contextProps: contextProps,
75
+ isView: isView
74
76
  }, column), {}, {
75
77
  otherProps: otherProps
76
78
  }), column.name);
@@ -80,7 +82,8 @@ var Group = function Group(props) {
80
82
  }, omit(space, ['separator', 'compact'])), {}, {
81
83
  children: columns.map(function (column, index) {
82
84
  return _jsx(ComRender, _objectSpread(_objectSpread({
83
- contextProps: contextProps
85
+ contextProps: contextProps,
86
+ isView: isView
84
87
  }, column), {}, {
85
88
  otherProps: otherProps
86
89
  }), 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 = useProConfig('ProAddressBar') || {},
55
55
  configDetailMaxLength = _ref2.detailMaxLength,
56
56
  configEnumCode = _ref2.enumCode,
@@ -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 = useEnum(addressCode);
93
- var _ref4 = Array.isArray(enumData) ? enumData : [],
94
- _ref5 = _slicedToArray(_ref4, 1),
95
- _ref5$ = _ref5[0],
96
- enumDataSource = _ref5$ === void 0 ? [] : _ref5$;
93
+ var _useProConfig = useProConfig('ProEnum'),
94
+ _useProConfig$dics = _useProConfig.dics,
95
+ dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
96
+ var enumDataSource = 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 = useMemo(function () {
98
103
  var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
99
104
  var result = 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 = _objectSpread({}, 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 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
120
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
119
121
  var _yield$service, data, newData, transFormData, serviceData;
120
122
  return _regeneratorRuntime().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
  useEffect(function () {
150
156
  if (service) {
151
157
  // 传入useRequest时,初次加载级联第一级数据源
@@ -154,13 +160,14 @@ var ProCascader = function ProCascader(props) {
154
160
  }, [service]);
155
161
  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(_toConsumableArray(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(_toConsumableArray(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) {
@@ -195,11 +195,25 @@ var ProModalSelect = function ProModalSelect(props, ref) {
195
195
  value: item[valueKey],
196
196
  label: item[labelKey]
197
197
  }));
198
- })) === null || _data$map === void 0 ? void 0 : _data$map.join(',') : undefined;
198
+ })) === null || _data$map === void 0 ? void 0 : _data$map.join(',') : '';
199
199
  };
200
200
  var viewText = useMemo(function () {
201
- return formatValue(labelInValue ? value : _value);
202
- }, [value, _value]);
201
+ var nextValue = labelInValue ? value : _value;
202
+ if (labelInValue) {
203
+ nextValue = value;
204
+ } else {
205
+ var _options$find;
206
+ 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) {
207
+ return item[valueKey] === value;
208
+ });
209
+ if (optionDTO) {
210
+ nextValue = optionDTO;
211
+ } else {
212
+ nextValue = _value;
213
+ }
214
+ }
215
+ return formatValue(nextValue);
216
+ }, [value, _value, options]);
203
217
  /**
204
218
  * 获取表格的rowKey,支持函数、字符串
205
219
  * @date 2023-02-16
@@ -5,7 +5,7 @@ import _Tooltip from "antd/es/tooltip";
5
5
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
6
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
7
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
8
- var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize"];
8
+ var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize", "getValueProps", "viewRender"];
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  import classNames from 'classnames';
11
11
  import { get } from 'lodash';
@@ -26,6 +26,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
26
26
  _props$valuePropName = props.valuePropName,
27
27
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
28
28
  normalize = props.normalize,
29
+ getValueProps = props.getValueProps,
30
+ viewRender = props.viewRender,
29
31
  rest = _objectWithoutProperties(props, _excluded);
30
32
  var _useProConfig = useProConfig('ProForm'),
31
33
  isDiffAll = _useProConfig.isDiffAll;
@@ -51,11 +53,23 @@ var ChangedWrapper = function ChangedWrapper(props) {
51
53
  }, [isWatch, noChange, props[valuePropName], originalValue]);
52
54
  var isAdd = diffType === 'add';
53
55
  var isChanged = diffType === 'changed';
56
+ var viewRenderFun = useMemo(function () {
57
+ var record = form.getFieldsValue();
58
+ return function (orgValue) {
59
+ return viewRender(orgValue, record, {
60
+ form: form
61
+ });
62
+ };
63
+ }, [form]);
54
64
  var tipContent = useMemo(function () {
55
65
  if (!isWatch || noChange) return undefined;
66
+ var valueProps = getValueProps && !names ? getValueProps(originalValue) : {
67
+ value: originalValue
68
+ };
69
+ if (viewRender) return viewRenderFun(valueProps === null || valueProps === void 0 ? void 0 : valueProps.value);
56
70
  return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, _defineProperty({
57
71
  isView: true
58
- }, valuePropName, originalValue))) : undefined;
72
+ }, valuePropName, valueProps === null || valueProps === void 0 ? void 0 : valueProps.value))) : undefined;
59
73
  }, [originalValue, children]);
60
74
  if (!isWatch || noChange) {
61
75
  // 嵌套子组件
@@ -87,9 +101,13 @@ var ChangedWrapper = function ChangedWrapper(props) {
87
101
  },
88
102
  title: _jsxs(_Space, {
89
103
  direction: "vertical",
104
+ className: "changed-tooltip",
90
105
  children: [_jsxs(_Space, {
106
+ align: "start",
107
+ className: "original-value-container",
91
108
  children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
92
109
  }), _showEllipse && _jsxs(_Space, {
110
+ className: "current-value-container",
93
111
  children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
94
112
  isView: true
95
113
  })) : undefined]
@@ -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,
@@ -155,7 +156,7 @@ var Render = function Render(props) {
155
156
  };
156
157
  }
157
158
  /** 移除多余参数,防止透传给formItem报错 */
158
- var _otherFormItemProps = omit(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'toCSTString', 'switchValue', 'precision', 'clearNotShow']);
159
+ var _otherFormItemProps = omit(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'toCSTString', 'switchValue', 'precision', 'clearNotShow', 'dependNames']);
159
160
  /**
160
161
  * globalControl 全局控制优先
161
162
  * globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
@@ -426,7 +427,7 @@ var Render = function Render(props) {
426
427
  span: 24 // 默认占一行
427
428
  });
428
429
  }
429
- if (diffConfig) {
430
+ if (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues) {
430
431
  child = _jsx(ChangedWrapper, {
431
432
  name: formItemProps.name,
432
433
  names: otherProps.names,
@@ -438,6 +439,8 @@ var Render = function Render(props) {
438
439
  onChange: handleChange,
439
440
  valuePropName: _otherFormItemProps.valuePropName,
440
441
  normalize: _otherFormItemProps.normalize,
442
+ getValueProps: _otherFormItemProps.getValueProps,
443
+ viewRender: viewRender,
441
444
  children: child
442
445
  });
443
446
  }
@@ -186,7 +186,8 @@ var RenderFields = function RenderFields(props) {
186
186
  namePath: column.namePath,
187
187
  listName: column.listName,
188
188
  globalControl: globalControl,
189
- formDisabled: formDisabled
189
+ formDisabled: formDisabled,
190
+ diffConfig: diffConfig
190
191
  };
191
192
  return _jsx(FieldProvider, {
192
193
  value: otherProps,
@@ -209,7 +210,8 @@ var RenderFields = function RenderFields(props) {
209
210
  diffConfig: diffConfig,
210
211
  equalWith: equalWith,
211
212
  requiredOnView: requiredOnView,
212
- globalControl: globalControl
213
+ globalControl: globalControl,
214
+ viewRender: viewRender
213
215
  })
214
216
  }, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
215
217
  });
@@ -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属性
@@ -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
  /** 比对原始数据源 */
@@ -329,6 +329,9 @@
329
329
  border-radius: 4px;
330
330
  background: @zaui-contract-bg !important;
331
331
 
332
+ .@{ant-prefix}-input {
333
+ background: @zaui-contract-bg !important;
334
+ }
332
335
  .@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
333
336
  background: @zaui-contract-bg !important;
334
337
  }
@@ -387,7 +390,7 @@
387
390
 
388
391
  // textArea
389
392
  .@{ant-prefix}-input-textarea > textarea {
390
- background: @zaui-contract-bg;
393
+ background: @zaui-contract-bg !important;
391
394
  }
392
395
 
393
396
  .pro-form-view-container {
@@ -403,6 +406,10 @@
403
406
  border-radius: 4px;
404
407
  background: @zaui-contract-bg-add !important;
405
408
 
409
+ .@{ant-prefix}-input {
410
+ background: @zaui-contract-bg !important;
411
+ }
412
+
406
413
  .@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
407
414
  background: @zaui-contract-bg-add !important;
408
415
  }
@@ -461,7 +468,7 @@
461
468
 
462
469
  // textArea
463
470
  .@{ant-prefix}-input-textarea > textarea {
464
- background: @zaui-contract-bg-add;
471
+ background: @zaui-contract-bg-add !important;
465
472
  }
466
473
 
467
474
 
@@ -472,3 +479,16 @@
472
479
  }
473
480
  }
474
481
  }
482
+
483
+ .changed-tooltip {
484
+ .original-value-container {
485
+ .ant-space-item:nth-child(1) {
486
+ white-space: nowrap;
487
+ }
488
+ }
489
+ .current-value-container {
490
+ .ant-space-item:nth-child(1) {
491
+ white-space: nowrap;
492
+ }
493
+ }
494
+ }
@@ -1,5 +1,17 @@
1
- import { isEqual, isFunction } from 'lodash';
1
+ import { isEqual, isFunction, isObject } from 'lodash';
2
2
  import { isEmpty } from '../../utils';
3
+ // 过滤对象中undefined字段
4
+ // 防止{a: '1'} {a: '1', b: undefined}被认为不相等
5
+ var filterUndefined = function filterUndefined(data) {
6
+ if (!isObject(data) || Array.isArray(data) || data === null) return data;
7
+ var resData = {};
8
+ Object.keys(data).forEach(function (key) {
9
+ if (data[key] !== undefined) {
10
+ resData[key] = data[key];
11
+ }
12
+ });
13
+ return resData;
14
+ };
3
15
  var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
4
16
  export var diffOriginal = function diffOriginal(params) {
5
17
  var originalValue = params.originalValue,
@@ -29,7 +41,7 @@ export var diffOriginal = function diffOriginal(params) {
29
41
  return isSame ? 'same' : 'changed';
30
42
  }
31
43
  if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
32
- return isEqual(value, originalValue) ? 'same' : 'changed';
44
+ return isEqual(filterUndefined(value), filterUndefined(originalValue)) ? 'same' : 'changed';
33
45
  }
34
46
  return 'same';
35
47
  };
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import { useRef, useState } from 'react';
3
- import { isFunction, isEqualWith } from 'lodash';
4
- import { customEqualForFun, equalDependencies } from './index';
3
+ import { isFunction, isEqualWith, get } from 'lodash';
4
+ import { customEqualForFun } from './index';
5
5
  // 代理shouldUpdate事件, 执行函数值的[show, disabled], 当[show, disabled]与上一次值不相同时更新状态
6
6
  var useShouldUpdate = function useShouldUpdate(props) {
7
7
  var show = props.show,
@@ -20,7 +20,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
20
20
  index = formItemProps.index,
21
21
  namePath = formItemProps.namePath,
22
22
  names = formItemProps.names,
23
- dependencies = formItemProps.dependencies;
23
+ dependNames = formItemProps.dependNames;
24
24
  var timerRef = useRef();
25
25
  var needClear = useRef(); // 是否需要执行清值操作
26
26
  var showRef = useRef();
@@ -29,13 +29,14 @@ var useShouldUpdate = function useShouldUpdate(props) {
29
29
  var rulesRef = useRef();
30
30
  var fieldPropsRef = useRef();
31
31
  var originComponentRef = useRef();
32
+ var dependNamesRef = useRef();
32
33
  var newComponent = originComponent || component; // 解决component默认赋值污染问题,需要使用originComponent
33
34
  var _useState = useState({}),
34
35
  _useState2 = _slicedToArray(_useState, 2),
35
36
  reRender = _useState2[1];
36
37
  var values = {};
37
38
  // 不是动态函数直接返回
38
- if (!isFunction(show) && !isFunction(disabled) && !isFunction(required) && !isFunction(rules) && !isFunction(fieldProps) && !isFunction(originComponent)) {
39
+ if (!(dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) && !isFunction(show) && !isFunction(disabled) && !isFunction(required) && !isFunction(rules) && !isFunction(fieldProps) && !isFunction(originComponent)) {
39
40
  return {
40
41
  shouldUpdate: _shouldUpdate,
41
42
  show: show,
@@ -119,9 +120,22 @@ var useShouldUpdate = function useShouldUpdate(props) {
119
120
  } else {
120
121
  fieldPropsRef.current = fieldProps;
121
122
  }
123
+ if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
124
+ dependNamesRef.current = dependNames.map(function (name) {
125
+ return get(values, name);
126
+ });
127
+ }
122
128
  return {
123
129
  shouldUpdate: function shouldUpdate(prevValues, currentValues) {
124
130
  // @ts-ignore formList场景取当前行数据,不取shouldUpdate变更后值
131
+ if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
132
+ var curDependNamesValue = dependNames.map(function (name) {
133
+ return get(currentValues, name);
134
+ });
135
+ var dependNamesChanged = !isEqualWith(dependNamesRef.current, curDependNamesValue, customEqualForFun);
136
+ dependNamesRef.current = curDependNamesValue;
137
+ if (!dependNamesChanged) return false;
138
+ }
125
139
  var _currentValues;
126
140
  if (namePath) {
127
141
  // formList场景values取当前行数据
@@ -149,9 +163,6 @@ var useShouldUpdate = function useShouldUpdate(props) {
149
163
  index: index,
150
164
  namePath: namePath
151
165
  }) : rules;
152
- // const _component = isFunction(originComponent)
153
- // ? originComponent(_currentValues, { form, index, namePath })
154
- // : newComponent;
155
166
  var _fieldProps = isFunction(fieldProps) ? fieldProps(_currentValues, {
156
167
  form: form,
157
168
  index: index,
@@ -182,16 +193,12 @@ var useShouldUpdate = function useShouldUpdate(props) {
182
193
  }
183
194
  var equalRes = isEqualWith(rulesRef.current, _rules, customEqualForFun);
184
195
  var proEqualRes = isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun);
185
- if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes ||
186
- // 值变更,需要同步更新函数式的fieldProps
187
- // (isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues)) ||
188
- // !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
189
- equalDependencies(dependencies, prevValues, _currentValues)) {
196
+ if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes || (_fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.transformResponse) // 防止fieldProps变更时,transformResponse根据fieldProps新值无法触发更新
197
+ ) {
190
198
  showRef.current = _show;
191
199
  disabledRef.current = _disabled;
192
200
  requiredRef.current = _required;
193
201
  rulesRef.current = _rules;
194
- // originComponentRef.current = _component;
195
202
  fieldPropsRef.current = _fieldProps;
196
203
  reRender({});
197
204
  return false;
@@ -1,12 +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, }: {
3
+ export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, scroll, onUpdateMinWidth, isInNewRow, }: {
4
4
  column: ProTableColumn;
5
5
  originalObj: any;
6
6
  dataSourceObj: any;
7
7
  rowKey: any;
8
8
  diffToolTip?: boolean;
9
9
  wrapToolTipProps?: any;
10
+ scroll?: any;
11
+ onUpdateMinWidth?: any;
12
+ isInNewRow?: any;
10
13
  }) => void;
11
14
  /**
12
15
  * 查找最近的父级className