@zat-design/sisyphus-react 3.6.10 → 3.7.0-beta.1

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 (77) hide show
  1. package/dist/index.esm.css +52 -54
  2. package/dist/less.esm.css +52 -54
  3. package/es/ProEditTable/components/RenderField/ListChanged.d.ts +16 -0
  4. package/es/ProEditTable/components/RenderField/ListChanged.js +124 -0
  5. package/es/ProEditTable/components/RenderField/index.js +27 -46
  6. package/es/ProEditTable/style/index.less +2 -1
  7. package/es/ProEditTable/utils/index.d.ts +1 -1
  8. package/es/ProEditTable/utils/index.js +19 -13
  9. package/es/ProEditTable/utils/tools.d.ts +6 -0
  10. package/es/ProEditTable/utils/tools.js +15 -2
  11. package/es/ProEnum/hooks/useEnumRequest.js +3 -0
  12. package/es/ProEnum/utils/index.js +1 -1
  13. package/es/ProForm/components/combination/FormList/components/BlockFields.js +4 -2
  14. package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -1
  15. package/es/ProForm/components/combination/FormList/utils.d.ts +1 -0
  16. package/es/ProForm/components/combination/FormList/utils.js +13 -0
  17. package/es/ProForm/components/combination/ProCascader/index.js +8 -14
  18. package/es/ProForm/components/render/Changed.d.ts +14 -0
  19. package/es/ProForm/components/render/Changed.js +64 -0
  20. package/es/ProForm/components/render/Render.js +17 -37
  21. package/es/ProForm/style/index.less +52 -52
  22. package/es/ProForm/utils/diffOriginal.d.ts +0 -1
  23. package/es/ProForm/utils/diffOriginal.js +4 -27
  24. package/es/ProForm/utils/useChanged.js +1 -2
  25. package/es/ProForm/utils/useListChanged.js +3 -3
  26. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +3 -1
  27. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +108 -41
  28. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +14 -1
  29. package/es/ProTable/index.js +6 -2
  30. package/es/ProTable/propsType.d.ts +22 -0
  31. package/es/ProTable/style/index.less +27 -32
  32. package/es/ProThemeTools/component/{PrdTools → ProTools}/index.d.ts +2 -2
  33. package/es/ProThemeTools/component/{PrdTools → ProTools}/index.js +2 -2
  34. package/es/ProThemeTools/component/index.d.ts +1 -2
  35. package/es/ProThemeTools/component/index.js +1 -2
  36. package/es/ProThemeTools/index.js +2 -2
  37. package/es/ProThemeTools/style/index.less +1 -1
  38. package/es/ProTreeModal/components/List.js +30 -4
  39. package/lib/ProEditTable/components/RenderField/ListChanged.d.ts +16 -0
  40. package/lib/ProEditTable/components/RenderField/ListChanged.js +129 -0
  41. package/lib/ProEditTable/components/RenderField/index.js +26 -41
  42. package/lib/ProEditTable/style/index.less +2 -1
  43. package/lib/ProEditTable/utils/index.d.ts +1 -1
  44. package/lib/ProEditTable/utils/index.js +17 -11
  45. package/lib/ProEditTable/utils/tools.d.ts +6 -0
  46. package/lib/ProEditTable/utils/tools.js +15 -1
  47. package/lib/ProEnum/hooks/useEnumRequest.js +3 -0
  48. package/lib/ProEnum/utils/index.js +1 -1
  49. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +5 -2
  50. package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -1
  51. package/lib/ProForm/components/combination/FormList/utils.d.ts +1 -0
  52. package/lib/ProForm/components/combination/FormList/utils.js +15 -1
  53. package/lib/ProForm/components/combination/ProCascader/index.js +6 -12
  54. package/lib/ProForm/components/render/Changed.d.ts +14 -0
  55. package/lib/ProForm/components/render/Changed.js +69 -0
  56. package/lib/ProForm/components/render/Render.js +17 -35
  57. package/lib/ProForm/style/index.less +52 -52
  58. package/lib/ProForm/utils/diffOriginal.d.ts +0 -1
  59. package/lib/ProForm/utils/diffOriginal.js +3 -27
  60. package/lib/ProForm/utils/useChanged.js +1 -2
  61. package/lib/ProForm/utils/useListChanged.js +2 -2
  62. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +3 -1
  63. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +108 -41
  64. package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +13 -1
  65. package/lib/ProTable/index.js +6 -2
  66. package/lib/ProTable/propsType.d.ts +22 -0
  67. package/lib/ProTable/style/index.less +27 -32
  68. package/lib/ProThemeTools/component/{PrdTools → ProTools}/index.d.ts +2 -2
  69. package/lib/ProThemeTools/component/{PrdTools → ProTools}/index.js +2 -2
  70. package/lib/ProThemeTools/component/index.d.ts +1 -2
  71. package/lib/ProThemeTools/component/index.js +3 -3
  72. package/lib/ProThemeTools/index.js +1 -1
  73. package/lib/ProThemeTools/style/index.less +1 -1
  74. package/lib/ProTreeModal/components/List.js +30 -4
  75. package/package.json +1 -1
  76. /package/es/ProThemeTools/component/{PrdTools → ProTools}/style/index.less +0 -0
  77. /package/lib/ProThemeTools/component/{PrdTools → ProTools}/style/index.less +0 -0
@@ -13,28 +13,33 @@ var _excluded = ["type", "label", "show", "needConfirm", "onHandle", "onClick"],
13
13
  _excluded2 = ["title", "icon"];
14
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  import React from 'react';
16
- import { cloneDeep, isArray, isBoolean, isEqual } from 'lodash';
16
+ import { cloneDeep, cloneDeepWith, isArray, isBoolean, isEqual } from 'lodash';
17
17
  import classnames from 'classnames';
18
18
  import { ReactSVG } from 'react-svg';
19
19
  import { tools } from '@zat-design/utils';
20
20
  import { actions, defaultBtnNameMap, defaultSingleActionKeys, defaultMultipleActionKeys, defaultEditingActionKeys } from './config';
21
- import { customValidate, getNamePath, splitNames, handleScrollToError } from './tools';
21
+ import { customValidate, getNamePath, splitNames, handleScrollToError, cloneDeepFilterNode } from './tools';
22
22
  import ProTooltip from '../../ProTooltip';
23
23
  import { RenderField, ActionButton } from '../components';
24
24
  import tipSvg from '../../assets/tip.svg';
25
25
  import locale from '../../locale';
26
26
  // 渲染操作栏
27
27
  var getActionColumn = function getActionColumn(config) {
28
- var disabled = config.disabled,
29
- name = config.name,
30
- form = config.form,
31
- virtualKey = config.virtualKey,
32
- validateKeys = config.validateKeys,
33
- actionWidth = config.actionWidth,
34
- actionProps = config.actionProps,
35
- page = config.page,
36
- rowDisabled = config.rowDisabled,
37
- actionDirection = config.actionDirection;
28
+ var _cloneDeepWith = cloneDeepWith(config, function (value) {
29
+ if ( /*#__PURE__*/React.isValidElement(value)) {
30
+ return value;
31
+ }
32
+ }),
33
+ disabled = _cloneDeepWith.disabled,
34
+ name = _cloneDeepWith.name,
35
+ form = _cloneDeepWith.form,
36
+ virtualKey = _cloneDeepWith.virtualKey,
37
+ validateKeys = _cloneDeepWith.validateKeys,
38
+ actionWidth = _cloneDeepWith.actionWidth,
39
+ actionProps = _cloneDeepWith.actionProps,
40
+ page = _cloneDeepWith.page,
41
+ rowDisabled = _cloneDeepWith.rowDisabled,
42
+ actionDirection = _cloneDeepWith.actionDirection;
38
43
  var pageNum = tools.calc(page.pageNum, '-', 1);
39
44
  var firstIndex = tools.calc(pageNum, '*', page.pageSize);
40
45
  // actionProps配置为false 默认不插入
@@ -195,7 +200,8 @@ export var transformColumns = function transformColumns() {
195
200
  setState = config.setState,
196
201
  page = config.page;
197
202
  var isCell = mode === 'cell';
198
- var _columns = _toConsumableArray(columns);
203
+ var _columns = cloneDeepFilterNode(columns);
204
+ // 你的函数代码
199
205
  var _cacheMap = _objectSpread({}, cacheMap.current);
200
206
  var pageNum = tools.calc(page.pageNum, '-', 1);
201
207
  var firstIndex = tools.calc(pageNum, '*', page.pageSize);
@@ -29,3 +29,9 @@ export declare const getDisabled: ({ globalControl, formDisabled, column, tabled
29
29
  /** 表格自动滚动到报错位置
30
30
  */
31
31
  export declare const handleScrollToError: () => void;
32
+ /**
33
+ * 深copy一个对象,并过滤掉其中的React节点
34
+ * @param value 需要深拷贝的对象
35
+ * @returns 深拷贝后的对象,其中的React节点会被保留
36
+ */
37
+ export declare function cloneDeepFilterNode(value: any): any;
@@ -1,5 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import { cloneDeep, isString, isObject, isEqual, transform, isFunction, isBoolean } from 'lodash';
2
+ import React from 'react';
3
+ import { cloneDeep, cloneDeepWith, isString, isObject, isEqual, transform, isFunction, isBoolean } from 'lodash';
3
4
  export var getRandom = function getRandom() {
4
5
  return Math.random().toString(36).slice(-6);
5
6
  };
@@ -182,4 +183,16 @@ export var handleScrollToError = function handleScrollToError() {
182
183
  }
183
184
  }
184
185
  }, 0);
185
- };
186
+ };
187
+ /**
188
+ * 深copy一个对象,并过滤掉其中的React节点
189
+ * @param value 需要深拷贝的对象
190
+ * @returns 深拷贝后的对象,其中的React节点会被保留
191
+ */
192
+ export function cloneDeepFilterNode(value) {
193
+ return cloneDeepWith(value, function (val) {
194
+ if ( /*#__PURE__*/React.isValidElement(val)) {
195
+ return val;
196
+ }
197
+ });
198
+ }
@@ -91,6 +91,9 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
91
91
  // 忽略清洗的 codes
92
92
  ignoreCodes = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.ignoreCodes) || [];
93
93
  Object.keys(response).forEach(function (key) {
94
+ if (!response[key] || !Array.isArray(response[key])) {
95
+ return;
96
+ }
94
97
  var options = _toConsumableArray(response[key]) || [];
95
98
  if (ignoreCodes.includes(key)) {
96
99
  response[key] = options;
@@ -74,7 +74,7 @@ export function cacheFieldNames(fieldNames, dataSource) {
74
74
  });
75
75
  // 递归去对数据进行清洗
76
76
  if (children && Array.isArray(dataSource[children])) {
77
- result[children] = dataSource[children].map(function (item) {
77
+ result.children = dataSource[children].map(function (item) {
78
78
  return cacheFieldNames(fieldNames, item);
79
79
  });
80
80
  }
@@ -4,12 +4,14 @@ import "antd/es/space/style";
4
4
  import _Space from "antd/es/space";
5
5
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
- import { useMemo } from 'react';
7
+ import React, { useMemo } from 'react';
8
8
  import { isFunction } from 'lodash';
9
9
  import classNames from 'classnames';
10
10
  import ActionButton from './ActionButton';
11
11
  import RenderFields from '../../../render/RenderFields';
12
12
  import ProCollapse from '../../../../../ProLayout/components/ProCollapse';
13
+ import { memoWith } from '../utils';
14
+ var MemoRenderFields = /*#__PURE__*/React.memo(RenderFields, memoWith);
13
15
  var BlockFields = function BlockFields(props) {
14
16
  var title = props.title,
15
17
  mode = props.mode,
@@ -66,7 +68,7 @@ var BlockFields = function BlockFields(props) {
66
68
  }),
67
69
  children: _jsx(_Row, {
68
70
  gutter: 24,
69
- children: _jsx(RenderFields, {
71
+ children: _jsx(MemoRenderFields, {
70
72
  columns: columns,
71
73
  form: form,
72
74
  colProps: colProps,
@@ -3,12 +3,15 @@ import _Row from "antd/es/row";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ import React from 'react';
6
7
  import classNames from 'classnames';
7
8
  import { useSortable } from '@dnd-kit/sortable';
8
9
  import { CSS } from '@dnd-kit/utilities';
9
10
  import ProIcon from '../../../../../ProIcon';
10
11
  import ActionButton from './ActionButton';
11
12
  import RenderFields from '../../../render/RenderFields';
13
+ import { memoWith } from '../utils';
14
+ var MemoRenderFields = /*#__PURE__*/React.memo(RenderFields, memoWith);
12
15
  var LineFields = function LineFields(props) {
13
16
  var mode = props.mode,
14
17
  index = props.index,
@@ -62,7 +65,7 @@ var LineFields = function LineFields(props) {
62
65
  })
63
66
  })), _jsx(_Row, {
64
67
  gutter: isLess ? 0 : 24,
65
- children: _jsx(RenderFields, {
68
+ children: _jsx(MemoRenderFields, {
66
69
  columns: columns,
67
70
  form: form,
68
71
  colProps: colProps,
@@ -9,3 +9,4 @@ export declare const namesPathTransform: ({ names, prefixNamePath, type, }: {
9
9
  prefixNamePath: any[];
10
10
  type: string;
11
11
  }) => string;
12
+ export declare const memoWith: (pre: any, next: any) => boolean;
@@ -1,3 +1,5 @@
1
+ import { isEqualWith, isFunction } from 'lodash';
2
+ import React from 'react';
1
3
  /**
2
4
  * namesPath生产 [['list', 0, 'min'], ['list', 0, 'max']] => list_0_min-list_0_max
3
5
  * @param names name的集合
@@ -17,4 +19,15 @@ export var namesPathTransform = function namesPathTransform(_ref) {
17
19
  return newNamePath === null || newNamePath === void 0 ? void 0 : newNamePath.map(function (name) {
18
20
  return Array.isArray(name) ? name.join('_') : name;
19
21
  }).join('-');
22
+ };
23
+ // 比较memo
24
+ export var memoWith = function memoWith(pre, next) {
25
+ return isEqualWith(pre, next, function (objValue, othValue) {
26
+ if ( /*#__PURE__*/React.isValidElement(objValue) && /*#__PURE__*/React.isValidElement(othValue)) {
27
+ return true;
28
+ }
29
+ if (isFunction(objValue) && isFunction(othValue)) {
30
+ return true;
31
+ }
32
+ });
20
33
  };
@@ -1,9 +1,9 @@
1
1
  import "antd/es/input/style";
2
2
  import _Input from "antd/es/input";
3
- import "antd/es/cascader/style";
4
- import _Cascader from "antd/es/cascader";
5
3
  import "antd/es/tooltip/style";
6
4
  import _Tooltip from "antd/es/tooltip";
5
+ import "antd/es/cascader/style";
6
+ import _Cascader from "antd/es/cascader";
7
7
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
8
8
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
9
9
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
@@ -22,6 +22,7 @@ import { useProConfig } from '../../../../ProConfigProvider';
22
22
  import useEnum from '../../../../ProEnum/hooks/useEnum';
23
23
  import locale from '../../../../locale';
24
24
  import ProForm from '../../..';
25
+ import Container from '../../Container';
25
26
  var Text = _Typography.Text;
26
27
  var defaultFieldNames = {
27
28
  label: 'name',
@@ -82,7 +83,8 @@ var ProCascader = function ProCascader(props) {
82
83
  detailPlaceholder = props.detailPlaceholder,
83
84
  otherProps = _objectWithoutProperties(props, _excluded);
84
85
  var _ref3 = ProForm.useFieldProps() || {},
85
- isViewCon = _ref3.isView;
86
+ isViewCon = _ref3.isView,
87
+ viewEmpty = _ref3.viewEmpty;
86
88
  var addressCode = code || enumCode;
87
89
  var realIsView = typeof isView === 'boolean' ? isView : isViewCon;
88
90
  var realLevel = Math.max(2, level);
@@ -238,17 +240,9 @@ var ProCascader = function ProCascader(props) {
238
240
  }
239
241
  }
240
242
  };
241
- return realIsView ? tooltip ? _jsx(_Tooltip, {
242
- className: className,
243
- title: tooltip === true ? viewValue : tooltip,
244
- children: _jsx(Text, {
245
- ellipsis: {
246
- tooltip: false
247
- },
248
- children: viewValue
249
- })
250
- }) : _jsx("span", {
251
- className: className,
243
+ return realIsView ? _jsx(Container, {
244
+ tooltip: !!tooltip,
245
+ viewEmpty: viewEmpty,
252
246
  children: viewValue
253
247
  }) : _jsxs("div", {
254
248
  className: "pro-address ".concat(className),
@@ -0,0 +1,14 @@
1
+ import { FormInstance } from 'antd';
2
+ import { NamePath } from 'antd/lib/form/interface';
3
+ import React from 'react';
4
+ interface Props {
5
+ name?: NamePath;
6
+ names?: NamePath[];
7
+ namesStr?: string;
8
+ originalValues?: any;
9
+ form: FormInstance;
10
+ equalWith?: (preValue: any, curValue: any) => boolean | undefined;
11
+ [name: string]: any;
12
+ }
13
+ declare const Changed: React.FC<Props>;
14
+ export default Changed;
@@ -0,0 +1,64 @@
1
+ import "antd/es/space/style";
2
+ import _Space from "antd/es/space";
3
+ import "antd/es/tooltip/style";
4
+ import _Tooltip from "antd/es/tooltip";
5
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
+ var _excluded = ["name", "names", "namesStr", "originalValues", "form", "equalWith", "children", "type", "originalDiffTip"];
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ import { get } from 'lodash';
10
+ import React, { useMemo } from 'react';
11
+ import { diffOriginal } from '../../utils/diffOriginal';
12
+ var Changed = function Changed(props) {
13
+ var name = props.name,
14
+ names = props.names,
15
+ namesStr = props.namesStr,
16
+ originalValues = props.originalValues,
17
+ form = props.form,
18
+ equalWith = props.equalWith,
19
+ children = props.children,
20
+ type = props.type,
21
+ originalDiffTip = props.originalDiffTip,
22
+ rest = _objectWithoutProperties(props, _excluded);
23
+ // 不渲染tooltip
24
+ var notWatch = !originalDiffTip || ['FormList', 'ProEditTable'].includes(type);
25
+ var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
26
+ return get(originalValues, name);
27
+ }) : get(originalValues, name);
28
+ var noChange = !equalWith && (!originalValues || originalValue === undefined);
29
+ var changed = useMemo(function () {
30
+ if (notWatch || noChange) return false;
31
+ return diffOriginal({
32
+ originalValue: originalValue,
33
+ value: props.value,
34
+ form: form,
35
+ equalWith: equalWith
36
+ // name: namesStr || name,
37
+ });
38
+ }, [notWatch, noChange, props.value, originalValue]);
39
+ var tipContent = useMemo(function () {
40
+ if (notWatch || noChange) return undefined;
41
+ return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, {
42
+ isView: true,
43
+ value: originalValue,
44
+ checked: type === 'Switch' ? originalValue : undefined
45
+ })) : undefined;
46
+ }, [originalValue, children]);
47
+ if (notWatch || noChange) {
48
+ return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
49
+ }
50
+ return _jsx(_Tooltip, {
51
+ open: changed ? undefined : false,
52
+ getPopupContainer: function getPopupContainer(target) {
53
+ return target.parentElement;
54
+ },
55
+ title: _jsxs(_Space, {
56
+ children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
57
+ }),
58
+ children: _jsx("div", {
59
+ className: changed ? 'pro-form-item-changed' : '',
60
+ children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
61
+ })
62
+ });
63
+ };
64
+ export default Changed;
@@ -1,7 +1,5 @@
1
1
  import "antd/es/col/style";
2
2
  import _Col from "antd/es/col";
3
- import "antd/es/tooltip/style";
4
- import _Tooltip from "antd/es/tooltip";
5
3
  import "antd/es/space/style";
6
4
  import _Space from "antd/es/space";
7
5
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
@@ -13,7 +11,6 @@ import "antd/es/form/style";
13
11
  import _Form from "antd/es/form";
14
12
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
15
13
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
16
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
17
14
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
18
15
  var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className", "rules", "required", "labelRequired", "tooltip"];
19
16
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
@@ -28,10 +25,10 @@ import { isTrim, isUpperCase, findOptionByValue, parseNamePath } from '../../uti
28
25
  import { useProConfig } from '../../../ProConfigProvider';
29
26
  import transformNames from '../../utils/transformNames';
30
27
  import valueTypeMap from '../../utils/valueType';
31
- import { useChanged } from '../../utils/useChanged';
32
28
  import tipSvg from '../../../assets/tip.svg';
33
29
  import useRules from '../../utils/useRules';
34
30
  import ConfirmWrapper from './ConfirmWrapper';
31
+ import Changed from './Changed';
35
32
  // 这个组件只管渲染, 参数的整理在外部处理
36
33
  var Render = function Render(props) {
37
34
  var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
@@ -101,18 +98,6 @@ var Render = function Render(props) {
101
98
  return Array.isArray(name) ? name.join('_') : name;
102
99
  }).join('-');
103
100
  }, [otherProps === null || otherProps === void 0 ? void 0 : otherProps.names]);
104
- // 判断当前字段是否变更
105
- var _useChanged = useChanged({
106
- name: formItemProps.name,
107
- names: otherProps.names,
108
- namesStr: namesStr,
109
- originalValues: originalValues,
110
- form: form,
111
- equalWith: equalWith
112
- }),
113
- _useChanged2 = _slicedToArray(_useChanged, 2),
114
- changed = _useChanged2[0],
115
- originalValue = _useChanged2[1];
116
101
  var internalRule = useRules({
117
102
  names: otherProps.names,
118
103
  label: otherFormItemProps.label,
@@ -184,7 +169,7 @@ var Render = function Render(props) {
184
169
  var lastComponentProps = _objectSpread(_objectSpread(_objectSpread({}, componentProps), _fieldProps), {}, {
185
170
  disabled: lastDisabled
186
171
  });
187
- var _className = classNames(_defineProperty(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed), 'pro-form-item-width-auto', ['Switch'].includes(type)));
172
+ var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-width-auto', ['Switch'].includes(type)));
188
173
  if (formItemProps.hidden === true || _show === false) {
189
174
  // 为了监听shouldUpdate 必须存在一个FormItem, 空Input解决 【[antd: Form.Item] `name` is only used for validate React element】
190
175
  return _jsx(_Form.Item, {
@@ -442,6 +427,20 @@ var Render = function Render(props) {
442
427
  span: 24 // 默认占一行
443
428
  });
444
429
  }
430
+ if (originalValues) {
431
+ child = _jsx(Changed, {
432
+ name: formItemProps.name,
433
+ names: otherProps.names,
434
+ namesStr: namesStr,
435
+ originalValues: originalValues,
436
+ form: form,
437
+ equalWith: equalWith,
438
+ originalDiffTip: originalDiffTip,
439
+ type: type,
440
+ onChange: handleChange,
441
+ children: child
442
+ });
443
+ }
445
444
  var orgFormItem = _jsx(_Form.Item, _objectSpread(_objectSpread({}, omit(_otherFormItemProps, filterFormItemKey)), {}, {
446
445
  // @ts-ignore
447
446
  _internalItemRender: internalItemRender,
@@ -468,26 +467,7 @@ var Render = function Render(props) {
468
467
  })
469
468
  });
470
469
  }
471
- // 不渲染tooltip
472
- if (!originalDiffTip || ['FormList', 'ProEditTable'].includes(type)) {
473
- return formItem;
474
- }
475
- var title = _jsxs(_Space, {
476
- children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child), {}, {
477
- isView: true,
478
- value: originalValue,
479
- checked: type === 'Switch' ? originalValue : undefined
480
- }))]
481
- });
482
- return _jsx(_Tooltip, {
483
- title: title,
484
- open: changed ? undefined : false,
485
- // open={true}
486
- getPopupContainer: function getPopupContainer(target) {
487
- return target.parentElement;
488
- },
489
- children: formItem
490
- });
470
+ return formItem;
491
471
  };
492
472
  var FormItem = _jsxs(_Fragment, {
493
473
  children: [renderItem(), (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$names2 = otherProps.names) === null || _otherProps$names2 === void 0 ? void 0 : _otherProps$names2.length) ? otherProps.names.map(function (name) {
@@ -116,58 +116,6 @@
116
116
  }
117
117
  }
118
118
 
119
- // 比较原始值场景下 不同时的样式
120
- &.pro-form-item-changed {
121
- span.@{ant-prefix}-input-affix-wrapper,
122
- .@{ant-prefix}-select .@{ant-prefix}-select-selector,
123
- .@{ant-prefix}-picker,
124
- .@{ant-prefix}-input-number {
125
- background: @zaui-contract-bg !important;
126
-
127
- input {
128
- background: transparent;
129
- }
130
- .@{ant-prefix}-select-selection-placeholder {
131
- z-index: 9;
132
- }
133
- }
134
-
135
- .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
136
- .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
137
- background: @zaui-contract-bg;
138
- border-radius: 4px;
139
- }
140
-
141
- // 地址组件
142
- .@{ant-prefix}-form-item-control-input-content {
143
- // 查看模式
144
- & > span {
145
- border-radius: 4px;
146
- padding: 5px 8px;
147
- background: @zaui-contract-bg;
148
- }
149
-
150
- & > .pro-address {
151
- .@{ant-prefix}-select-selector,
152
- .@{ant-prefix}-input-affix-wrapper,
153
- .@{ant-prefix}-input-disabled {
154
- background: @zaui-contract-bg;
155
- }
156
- }
157
- & > .@{ant-prefix}-input-group {
158
- .forever-checkbox {
159
- background: @zaui-contract-bg;
160
- }
161
- }
162
- }
163
-
164
- .pro-form-view-container {
165
- padding: 4px 8px;
166
- background: @zaui-contract-bg;
167
- border-radius: 4px;
168
- }
169
- }
170
-
171
119
  .@{ant-prefix}-row {
172
120
  width: 100%;
173
121
  }
@@ -373,4 +321,56 @@
373
321
  }
374
322
  }
375
323
  }
324
+
325
+ // 比较原始值场景下 不同时的样式
326
+ .pro-form-item-changed {
327
+ span.@{ant-prefix}-input-affix-wrapper,
328
+ .@{ant-prefix}-select .@{ant-prefix}-select-selector,
329
+ .@{ant-prefix}-picker,
330
+ .@{ant-prefix}-input-number {
331
+ background: @zaui-contract-bg !important;
332
+
333
+ input {
334
+ background: transparent !important;
335
+ }
336
+ .@{ant-prefix}-select-selection-placeholder {
337
+ z-index: 9;
338
+ }
339
+ }
340
+
341
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
342
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
343
+ background: @zaui-contract-bg;
344
+ border-radius: 4px;
345
+ }
346
+
347
+ // 地址组件
348
+ .@{ant-prefix}-form-item-control-input-content {
349
+ // 查看模式
350
+ & > span {
351
+ border-radius: 4px;
352
+ padding: 5px 8px;
353
+ background: @zaui-contract-bg;
354
+ }
355
+
356
+ & > .pro-address {
357
+ .@{ant-prefix}-select-selector,
358
+ .@{ant-prefix}-input-affix-wrapper,
359
+ .@{ant-prefix}-input-disabled {
360
+ background: @zaui-contract-bg;
361
+ }
362
+ }
363
+ & > .@{ant-prefix}-input-group {
364
+ .forever-checkbox {
365
+ background: @zaui-contract-bg;
366
+ }
367
+ }
368
+ }
369
+
370
+ .pro-form-view-container {
371
+ padding: 4px 8px;
372
+ background: @zaui-contract-bg;
373
+ border-radius: 4px;
374
+ }
375
+ }
376
376
  }
@@ -3,7 +3,6 @@ interface Params {
3
3
  originalValue: any;
4
4
  value: any;
5
5
  form: FormInstance;
6
- name?: string | any[];
7
6
  equalWith?: (originalValue: any, currentValue: any) => boolean;
8
7
  }
9
8
  export declare const diffOriginal: (params: Params) => boolean;
@@ -1,31 +1,9 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import { isEqual, isFunction, isString } from 'lodash';
1
+ import { isEqual, isFunction } from 'lodash';
3
2
  var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
4
- /** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
5
- var extractValues = function extractValues(form, pathString) {
6
- var _pathString;
7
- var result = [];
8
- var PrefixesName = isString(pathString) ? [] : pathString.slice(0, -1);
9
- if (isString(pathString)) {
10
- pathString.split('-').forEach(function (item) {
11
- result.push(form.getFieldValue([].concat(_toConsumableArray(PrefixesName), [item])));
12
- });
13
- return result;
14
- }
15
- (_pathString = pathString[pathString.length - 1]) === null || _pathString === void 0 ? void 0 : _pathString.split('-').forEach(function (item) {
16
- result.push(form.getFieldValue([].concat(_toConsumableArray(PrefixesName), [item])));
17
- });
18
- return result;
19
- };
20
3
  export var diffOriginal = function diffOriginal(params) {
21
- var _name$join;
22
4
  var originalValue = params.originalValue,
23
- _value = params.value,
24
- equalWith = params.equalWith,
25
- form = params.form,
26
- name = params.name;
27
- var isNames = Array.isArray(name) && ((_name$join = name.join(',')) === null || _name$join === void 0 ? void 0 : _name$join.includes('-')) || (name === null || name === void 0 ? void 0 : name.includes('-'));
28
- var value = !isNames ? _value : extractValues(form, name);
5
+ value = params.value,
6
+ equalWith = params.equalWith;
29
7
  // 支持传入自定义比较事件
30
8
  if (isFunction(equalWith)) {
31
9
  return !equalWith(originalValue, value);
@@ -40,8 +18,7 @@ export var diffOriginal = function diffOriginal(params) {
40
18
  });
41
19
  }
42
20
  if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
43
- var res = !isEqual(value, originalValue);
44
- return res;
21
+ return !isEqual(value, originalValue);
45
22
  }
46
23
  return false;
47
24
  };
@@ -19,8 +19,7 @@ export var useChanged = function useChanged(_ref) {
19
19
  originalValue: originalValue,
20
20
  value: value,
21
21
  form: form,
22
- equalWith: equalWith,
23
- name: namesStr || name
22
+ equalWith: equalWith
24
23
  });
25
24
  return [changed, originalValue];
26
25
  };
@@ -1,6 +1,6 @@
1
1
  import "antd/es/form/style";
2
2
  import _Form from "antd/es/form";
3
- import { get, isString } from 'lodash';
3
+ import { get } from 'lodash';
4
4
  import { diffOriginal } from './diffOriginal';
5
5
  var toNamePath = function toNamePath(name) {
6
6
  if (Array.isArray(name)) {
@@ -86,8 +86,8 @@ export var useListChanged = function useListChanged(params) {
86
86
  value: value,
87
87
  originalValue: originalValue,
88
88
  form: form,
89
- equalWith: equalWith,
90
- name: isString(namesStr) ? namesStr : originalName || name
89
+ equalWith: equalWith
90
+ // name: isString(namesStr) ? namesStr : originalName || name,
91
91
  });
92
92
  return [changed, originalValue];
93
93
  };
@@ -5,12 +5,14 @@ interface RowProps extends React.HTMLAttributes<HTMLTableRowElement> {
5
5
  disabled?: boolean;
6
6
  }
7
7
  export declare const Row: FC<RowProps>;
8
- declare const DndWrapper: ({ draggable, value, onChange, disabled, children, rowKey }: {
8
+ declare const DndWrapper: ({ draggable, value, onChange, disabled, children, rowKey, onDragStartGuard, onDragEndGuard, }: {
9
9
  draggable: any;
10
10
  value: any;
11
11
  onChange: any;
12
12
  disabled: any;
13
13
  children: any;
14
14
  rowKey: any;
15
+ onDragStartGuard: any;
16
+ onDragEndGuard: any;
15
17
  }) => any;
16
18
  export default DndWrapper;