@zat-design/sisyphus-react 3.8.3-beta.1 → 3.8.3-beta.12

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 (96) hide show
  1. package/dist/index.esm.css +16 -0
  2. package/dist/less.esm.css +16 -0
  3. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +21 -7
  4. package/es/ProEditTable/components/RenderField/index.js +8 -1
  5. package/es/ProEditTable/index.js +14 -7
  6. package/es/ProEditTable/propsType.d.ts +0 -6
  7. package/es/ProEditTable/utils/index.js +10 -3
  8. package/es/ProForm/components/base/InputNumber/index.js +1 -1
  9. package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  10. package/es/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
  11. package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
  12. package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  13. package/es/ProForm/components/combination/FormList/index.js +14 -3
  14. package/es/ProForm/components/combination/ProCascader/index.js +20 -13
  15. package/es/ProForm/components/combination/ProModalSelect/index.js +17 -3
  16. package/es/ProForm/components/render/ChangedWrapper.js +14 -2
  17. package/es/ProForm/components/render/Render.js +3 -1
  18. package/es/ProForm/components/render/RenderFields.js +4 -2
  19. package/es/ProForm/propsType.d.ts +1 -0
  20. package/es/ProForm/style/index.less +7 -0
  21. package/es/ProForm/utils/diffOriginal.js +14 -2
  22. package/es/ProForm/utils/useShouldUpdate.js +1 -9
  23. package/es/ProTable/components/FormatColumn/index.d.ts +2 -1
  24. package/es/ProTable/components/FormatColumn/index.js +61 -21
  25. package/es/ProTable/components/RenderColumn/index.d.ts +1 -0
  26. package/es/ProTable/components/RenderColumn/index.js +7 -4
  27. package/es/ProTable/index.js +8 -7
  28. package/es/ProTable/propsType.d.ts +4 -0
  29. package/es/ProTable/style/index.less +14 -0
  30. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +20 -6
  31. package/lib/ProEditTable/components/RenderField/index.js +8 -1
  32. package/lib/ProEditTable/index.js +14 -7
  33. package/lib/ProEditTable/propsType.d.ts +0 -6
  34. package/lib/ProEditTable/utils/index.js +10 -3
  35. package/lib/ProForm/components/base/InputNumber/index.js +1 -1
  36. package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  37. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
  38. package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +2 -0
  39. package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
  40. package/lib/ProForm/components/combination/FormList/index.js +14 -3
  41. package/lib/ProForm/components/combination/ProCascader/index.js +20 -13
  42. package/lib/ProForm/components/combination/ProModalSelect/index.js +17 -3
  43. package/lib/ProForm/components/render/ChangedWrapper.js +14 -2
  44. package/lib/ProForm/components/render/Render.js +3 -1
  45. package/lib/ProForm/components/render/RenderFields.js +4 -2
  46. package/lib/ProForm/propsType.d.ts +1 -0
  47. package/lib/ProForm/style/index.less +7 -0
  48. package/lib/ProForm/utils/diffOriginal.js +13 -1
  49. package/lib/ProForm/utils/useShouldUpdate.js +1 -9
  50. package/lib/ProTable/components/FormatColumn/index.d.ts +2 -1
  51. package/lib/ProTable/components/FormatColumn/index.js +61 -21
  52. package/lib/ProTable/components/RenderColumn/index.d.ts +1 -0
  53. package/lib/ProTable/components/RenderColumn/index.js +6 -3
  54. package/lib/ProTable/index.js +8 -7
  55. package/lib/ProTable/propsType.d.ts +4 -0
  56. package/lib/ProTable/style/index.less +14 -0
  57. package/package.json +1 -1
  58. package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +0 -241
  59. package/coverage/lcov-report/src/.umi/core/history.ts.html +0 -148
  60. package/coverage/lcov-report/src/.umi/core/index.html +0 -206
  61. package/coverage/lcov-report/src/.umi/core/plugin.ts.html +0 -109
  62. package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +0 -160
  63. package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +0 -97
  64. package/coverage/lcov-report/src/.umi/core/routes.ts.html +0 -26050
  65. package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +0 -112
  66. package/coverage/lcov-report/src/.umi/dumi/demos/index.html +0 -116
  67. package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +0 -6340
  68. package/coverage/lcov-report/src/.umi/dumi/index.html +0 -116
  69. package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +0 -109
  70. package/coverage/lcov-report/src/.umi/index.html +0 -116
  71. package/coverage/lcov-report/src/.umi/plugin-antd/index.html +0 -116
  72. package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +0 -172
  73. package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +0 -94
  74. package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +0 -116
  75. package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +0 -196
  76. package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +0 -106
  77. package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +0 -146
  78. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +0 -116
  79. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +0 -88
  80. package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +0 -124
  81. package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +0 -1246
  82. package/coverage/lcov-report/src/.umi/plugin-locale/index.html +0 -161
  83. package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +0 -268
  84. package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +0 -778
  85. package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +0 -115
  86. package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +0 -202
  87. package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +0 -97
  88. package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +0 -142
  89. package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +0 -334
  90. package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +0 -146
  91. package/coverage/lcov-report/src/.umi/plugin-model/index.html +0 -146
  92. package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +0 -121
  93. package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +0 -298
  94. package/coverage/lcov-report/src/.umi/plugin-request/index.html +0 -116
  95. package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +0 -919
  96. package/coverage/lcov-report/src/.umi/umi.ts.html +0 -268
@@ -1914,6 +1914,16 @@
1914
1914
  background: var(--zaui-contract-bg, #fffaa1) !important;
1915
1915
  border-radius: var(--zaui-border-radius, 8px);
1916
1916
  }
1917
+ .pro-table tbody.ant-table-tbody .ant-table-cell .varied-cell .pro-form-view-container {
1918
+ overflow: hidden;
1919
+ white-space: nowrap;
1920
+ text-overflow: ellipsis;
1921
+ }
1922
+ .pro-table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container {
1923
+ overflow: hidden;
1924
+ white-space: nowrap;
1925
+ text-overflow: ellipsis;
1926
+ }
1917
1927
  .pro-table tbody.ant-table-tbody .varied-cell.empty-cell {
1918
1928
  width: 24.5px;
1919
1929
  }
@@ -3029,6 +3039,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3029
3039
  border-radius: 4px;
3030
3040
  background: var(--zaui-contract-bg, #fffaa1) !important;
3031
3041
  }
3042
+ .pro-form .pro-form-item-changed .ant-input {
3043
+ background: var(--zaui-contract-bg, #fffaa1) !important;
3044
+ }
3032
3045
  .pro-form .pro-form-item-changed .ant-select.ant-select-disabled .ant-select-selector {
3033
3046
  background: var(--zaui-contract-bg, #fffaa1) !important;
3034
3047
  }
@@ -3086,6 +3099,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3086
3099
  border-radius: 4px;
3087
3100
  background: var(--zaui-contract-bg-add, #d2fff4) !important;
3088
3101
  }
3102
+ .pro-form .pro-form-item-add .ant-input {
3103
+ background: var(--zaui-contract-bg, #fffaa1) !important;
3104
+ }
3089
3105
  .pro-form .pro-form-item-add .ant-select.ant-select-disabled .ant-select-selector {
3090
3106
  background: var(--zaui-contract-bg-add, #d2fff4) !important;
3091
3107
  }
package/dist/less.esm.css CHANGED
@@ -1914,6 +1914,16 @@
1914
1914
  background: var(--zaui-contract-bg, #fffaa1) !important;
1915
1915
  border-radius: var(--zaui-border-radius, 8px);
1916
1916
  }
1917
+ .pro-table tbody.ant-table-tbody .ant-table-cell .varied-cell .pro-form-view-container {
1918
+ overflow: hidden;
1919
+ white-space: nowrap;
1920
+ text-overflow: ellipsis;
1921
+ }
1922
+ .pro-table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container {
1923
+ overflow: hidden;
1924
+ white-space: nowrap;
1925
+ text-overflow: ellipsis;
1926
+ }
1917
1927
  .pro-table tbody.ant-table-tbody .varied-cell.empty-cell {
1918
1928
  width: 24.5px;
1919
1929
  }
@@ -3029,6 +3039,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3029
3039
  border-radius: 4px;
3030
3040
  background: var(--zaui-contract-bg, #fffaa1) !important;
3031
3041
  }
3042
+ .pro-form .pro-form-item-changed .ant-input {
3043
+ background: var(--zaui-contract-bg, #fffaa1) !important;
3044
+ }
3032
3045
  .pro-form .pro-form-item-changed .ant-select.ant-select-disabled .ant-select-selector {
3033
3046
  background: var(--zaui-contract-bg, #fffaa1) !important;
3034
3047
  }
@@ -3086,6 +3099,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3086
3099
  border-radius: 4px;
3087
3100
  background: var(--zaui-contract-bg-add, #d2fff4) !important;
3088
3101
  }
3102
+ .pro-form .pro-form-item-add .ant-input {
3103
+ background: var(--zaui-contract-bg, #fffaa1) !important;
3104
+ }
3089
3105
  .pro-form .pro-form-item-add .ant-select.ant-select-disabled .ant-select-selector {
3090
3106
  background: var(--zaui-contract-bg-add, #d2fff4) !important;
3091
3107
  }
@@ -1,11 +1,11 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  import "antd/es/space/style";
3
2
  import _Space from "antd/es/space";
4
3
  import "antd/es/tooltip/style";
5
4
  import _Tooltip from "antd/es/tooltip";
5
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
6
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
7
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
8
- var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName"];
8
+ var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName", "viewRender"];
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  import React, { useMemo } from 'react';
11
11
  import classNames from 'classnames';
@@ -66,7 +66,6 @@ var getOriginalValue = function getOriginalValue(_ref) {
66
66
  }) : get(originalValues, originalName);
67
67
  };
68
68
  var ListChangedWrapper = function ListChangedWrapper(props) {
69
- var _getValueProps;
70
69
  var name = props.name,
71
70
  names = props.names,
72
71
  namesStr = props.namesStr,
@@ -84,6 +83,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
84
83
  getValueProps = props.getValueProps,
85
84
  _props$valuePropName = props.valuePropName,
86
85
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
86
+ viewRender = props.viewRender,
87
87
  rest = _objectWithoutProperties(props, _excluded);
88
88
  var _ref2 = useProConfig('ProEditTable') || {},
89
89
  isDiffAll = _ref2.isDiffAll;
@@ -113,6 +113,23 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
113
113
  }, [props[valuePropName], originalValue]);
114
114
  var isAdd = diffType === 'add';
115
115
  var isChanged = diffType === 'changed';
116
+ var tipContent = useMemo(function () {
117
+ var _getValueProps;
118
+ if (!isWatch || noChange) return undefined;
119
+ var orgValue = getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : originalValue;
120
+ // 兼容viewRender函数和Element场景
121
+ var _children = children;
122
+ if (viewRender) {
123
+ if (! /*#__PURE__*/React.isValidElement(viewRender)) {
124
+ return viewRender(orgValue);
125
+ }
126
+ _children = viewRender;
127
+ }
128
+ return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children), {}, _defineProperty(_defineProperty({
129
+ // @ts-ignore
130
+ isView: true
131
+ }, valuePropName, orgValue), "checked", type === 'Switch' ? originalValue : undefined))) : undefined;
132
+ }, [originalValue, children]);
116
133
  if (!isWatch || noChange) {
117
134
  return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
118
135
  }
@@ -127,10 +144,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
127
144
  return target.parentElement;
128
145
  },
129
146
  title: _jsxs(_Space, {
130
- children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children), {}, _defineProperty(_defineProperty({
131
- // @ts-ignore
132
- isView: true
133
- }, valuePropName, getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : props[valuePropName]), "checked", type === 'Switch' ? originalValue : undefined))) : undefined]
147
+ children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
134
148
  }),
135
149
  children: _jsx("div", {
136
150
  className: diffClassName,
@@ -248,13 +248,19 @@ var RenderField = function RenderField(_ref) {
248
248
  TargetComponent = _editRender;
249
249
  }
250
250
  }
251
+ var viewRenderFun = function viewRenderFun(value) {
252
+ if (/*#__PURE__*/React.isValidElement(viewRender)) {
253
+ return viewRender;
254
+ }
255
+ return viewRender === null || viewRender === void 0 ? void 0 : viewRender(value, record, options);
256
+ };
251
257
  // 查看模式
252
258
  if (isView) {
253
259
  // 存在viewRender覆盖默认值
254
260
  if (typeof viewRender === 'function') {
255
261
  var _column$dataIndex;
256
262
  currentValue = (column === null || column === void 0 ? void 0 : (_column$dataIndex = column.dataIndex) === null || _column$dataIndex === void 0 ? void 0 : _column$dataIndex.includes('-')) ? value : currentValue;
257
- var View = viewRender(currentValue, record, options);
263
+ var View = viewRenderFun(currentValue);
258
264
  TargetComponent = _jsx(Container, {
259
265
  viewEmpty: viewEmpty,
260
266
  children: View
@@ -560,6 +566,7 @@ var RenderField = function RenderField(_ref) {
560
566
  valuePropName: _formItemProps.valuePropName,
561
567
  normalize: _formItemProps.normalize,
562
568
  getValueProps: _formItemProps.getValueProps,
569
+ viewRender: viewRender && viewRenderFun,
563
570
  children: FieldComponent
564
571
  });
565
572
  }
@@ -9,7 +9,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
9
9
  import "antd/es/form/style";
10
10
  import _Form from "antd/es/form";
11
11
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
12
- var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "virtual", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection"];
12
+ var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "virtual", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection"];
13
13
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
15
15
  import { get, isArray, isBoolean } from 'lodash';
@@ -51,7 +51,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
51
51
  headerRender = _ref.headerRender,
52
52
  pagination = _ref.pagination,
53
53
  originalValues = _ref.originalValues,
54
- originalDiffTip = _ref.originalDiffTip,
55
54
  rowKey = _ref.rowKey,
56
55
  rowDisabled = _ref.rowDisabled,
57
56
  rowDraggable = _ref.rowDraggable,
@@ -89,7 +88,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
89
88
  return (_ref2 = (_themeConfig$data$zau = themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data = themeConfig.data) === null || _themeConfig$data === void 0 ? void 0 : _themeConfig$data.zauiFormAlign) !== null && _themeConfig$data$zau !== void 0 ? _themeConfig$data$zau : configRequiredAlign) !== null && _ref2 !== void 0 ? _ref2 : 'left';
90
89
  }, [themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data2 = themeConfig.data) === null || _themeConfig$data2 === void 0 ? void 0 : _themeConfig$data2.zauiFormAlign]);
91
90
  var _useSetState = useSetState({
92
- _columns: columns,
93
91
  cellNamePath: [],
94
92
  forceUpdate: {},
95
93
  editingKeys: [],
@@ -167,7 +165,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
167
165
  tableLength: value === null || value === void 0 ? void 0 : value.length,
168
166
  page: page,
169
167
  originalValues: originalValues,
170
- originalDiffTip: originalDiffTip,
171
168
  prefixCls: prefixCls,
172
169
  rowDisabled: rowDisabled,
173
170
  actionDirection: actionDirection
@@ -275,8 +272,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
275
272
  var _columns = useMemo(function () {
276
273
  return transformColumns(columns, config);
277
274
  }, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
278
- useEffect(function () {
279
- var _value$every, _originalArr$every;
275
+ var initDataSource = function initDataSource() {
276
+ var _value$every, _originalArr$every, _value$some, _originalArr$some;
280
277
  var isAllHasKey = value === null || value === void 0 ? void 0 : (_value$every = value.every) === null || _value$every === void 0 ? void 0 : _value$every.call(value, function (item) {
281
278
  return item.rowKey;
282
279
  });
@@ -285,8 +282,15 @@ var ProEditTable = function ProEditTable(_ref, ref) {
285
282
  var isOriginalAllHasKey = originalArr ? originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$every = originalArr.every) === null || _originalArr$every === void 0 ? void 0 : _originalArr$every.call(originalArr, function (item) {
286
283
  return item.rowKey;
287
284
  }) : true;
285
+ // 检测当前rowkey是否与制定key的值是否一致,不一致,则执行覆盖
286
+ var isNeedCover = value === null || value === void 0 ? void 0 : (_value$some = value.some) === null || _value$some === void 0 ? void 0 : _value$some.call(value, function (item) {
287
+ return item.rowKey !== getRowKey(item);
288
+ });
289
+ var isNeedCoverOriginal = originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$some = originalArr.some) === null || _originalArr$some === void 0 ? void 0 : _originalArr$some.call(originalArr, function (item) {
290
+ return item.rowKey !== getRowKey(item);
291
+ });
288
292
  // 初始化默认生成row-key
289
- if ((value === null || value === void 0 ? void 0 : value.length) && !isAllHasKey || (originalArr === null || originalArr === void 0 ? void 0 : originalArr.length) && !isOriginalAllHasKey) {
293
+ if ((value === null || value === void 0 ? void 0 : value.length) && (!isAllHasKey || isNeedCover) || (originalArr === null || originalArr === void 0 ? void 0 : originalArr.length) && (!isOriginalAllHasKey || isNeedCoverOriginal)) {
290
294
  var _originalArr$forEach;
291
295
  var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
292
296
  return _objectSpread(_objectSpread({}, item), {}, {
@@ -301,6 +305,9 @@ var ProEditTable = function ProEditTable(_ref, ref) {
301
305
  form.setFieldValue(virtualRowName, nextValues);
302
306
  }
303
307
  }
308
+ };
309
+ useEffect(function () {
310
+ initDataSource();
304
311
  }, [value, originalValues]);
305
312
  useImperativeHandle((resetProps === null || resetProps === void 0 ? void 0 : resetProps.ref) || ref, function () {
306
313
  return {
@@ -109,7 +109,6 @@ export interface ProColumnsProps<Values = any, T = any> extends Omit<FormItemPro
109
109
  }
110
110
  export type ProEditTableColumnsProps<K = any> = ProColumnsProps & ColumnPropsMap<K, 'ProEditTable'>;
111
111
  export interface State {
112
- _columns: ProEditTableColumnsProps[];
113
112
  cellNamePath: NamePath[];
114
113
  forceUpdate: {};
115
114
  editingKeys: string[];
@@ -139,11 +138,6 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
139
138
  * @description 原始数据源,是否tooltip显示
140
139
  * @default -
141
140
  */
142
- originalDiffTip?: boolean;
143
- /**
144
- * @description 可编辑表格的类型,单行、多行、单元格编辑
145
- * @default false
146
- */
147
141
  mode?: 'single' | 'multiple' | 'cell';
148
142
  /**
149
143
  * @description 可编辑表格的类型,单行编辑或者多行编辑
@@ -335,14 +335,21 @@ export var transformColumns = function transformColumns() {
335
335
  });
336
336
  }
337
337
  // 单行多行交互有较大差异
338
- return _jsx("div", {
338
+ return _jsxs("div", {
339
339
  className: cellClassName,
340
340
  onClick: function onClick() {
341
341
  isCanEdit && setState({
342
342
  cellNamePath: cellName
343
343
  });
344
344
  },
345
- children: _jsx(RenderField, {
345
+ children: [index === 0 && !item.width ? _jsx("div", {
346
+ style: {
347
+ visibility: 'hidden',
348
+ height: 0,
349
+ paddingLeft: (item === null || item === void 0 ? void 0 : item.required) ? 16 : 0
350
+ },
351
+ children: columnTitle
352
+ }) : null, _jsx(RenderField, {
346
353
  text: _text,
347
354
  record: record,
348
355
  index: index,
@@ -351,7 +358,7 @@ export var transformColumns = function transformColumns() {
351
358
  cellName: cellName,
352
359
  isEditing: isEditing // 是否正在编辑
353
360
  })
354
- })
361
+ })]
355
362
  });
356
363
  };
357
364
  item.render = _render;
@@ -286,7 +286,7 @@ var InputNumber = function InputNumber(props) {
286
286
  autoComplete: "off",
287
287
  placeholder: placeholder || "".concat(locale.ProForm.inputPlaceholder).concat(label !== null && label !== void 0 ? label : ''),
288
288
  className: _className
289
- }, valueProps), initialConfig), rest), {}, {
289
+ }, initialConfig), valueProps), rest), {}, {
290
290
  onBlur: handleBlur,
291
291
  onFocus: handleFocus,
292
292
  min: _min,
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { InternalNamePath } from 'antd/es/form/interface';
4
4
  import type { levelType } from '../../../../../ProLayout/components/ProCollapse/PropTypes';
5
5
  import type { FormListProps } from '../propsType';
6
+ import { DiffConfigProps } from '../../../../propsType';
6
7
  interface Props extends Omit<FormListProps, 'toolbarProps'> {
7
8
  index: number;
8
9
  namePath: InternalNamePath;
@@ -14,6 +15,7 @@ interface Props extends Omit<FormListProps, 'toolbarProps'> {
14
15
  };
15
16
  level?: levelType;
16
17
  towCollapse?: boolean;
18
+ diffConfig?: DiffConfigProps;
17
19
  }
18
20
  declare const BlockFields: React.FC<Props>;
19
21
  export default BlockFields;
@@ -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
@@ -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", "getValueProps"];
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';
@@ -27,6 +27,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
27
27
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
28
28
  normalize = props.normalize,
29
29
  getValueProps = props.getValueProps,
30
+ viewRender = props.viewRender,
30
31
  rest = _objectWithoutProperties(props, _excluded);
31
32
  var _useProConfig = useProConfig('ProForm'),
32
33
  isDiffAll = _useProConfig.isDiffAll;
@@ -52,9 +53,20 @@ var ChangedWrapper = function ChangedWrapper(props) {
52
53
  }, [isWatch, noChange, props[valuePropName], originalValue]);
53
54
  var isAdd = diffType === 'add';
54
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]);
55
64
  var tipContent = useMemo(function () {
56
65
  if (!isWatch || noChange) return undefined;
57
- var valueProps = getValueProps ? getValueProps(originalValue) : originalValue;
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);
58
70
  return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, _defineProperty({
59
71
  isView: true
60
72
  }, valuePropName, valueProps === null || valueProps === void 0 ? void 0 : valueProps.value))) : 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,
@@ -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
  }
@@ -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
  });
@@ -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
  /** 比对原始数据源 */