@zat-design/sisyphus-react 3.7.3 → 3.8.0

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 (127) hide show
  1. package/dist/index.esm.css +100 -4
  2. package/dist/less.esm.css +97 -4
  3. package/es/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts} +4 -3
  4. package/es/ProEditTable/components/RenderField/{ListChanged.js → ListChangedWrapper.js} +22 -10
  5. package/es/ProEditTable/components/RenderField/index.js +3 -3
  6. package/es/ProEnum/components/Group.js +10 -2
  7. package/es/ProEnum/index.js +5 -4
  8. package/es/ProEnum/style/index.less +14 -4
  9. package/es/ProEnum/utils/index.d.ts +1 -1
  10. package/es/ProEnum/utils/index.js +4 -0
  11. package/es/ProForm/components/combination/Container/index.js +5 -3
  12. package/es/ProForm/components/combination/Container/propsType.d.ts +2 -1
  13. package/es/ProForm/components/combination/FormList/utils.js +5 -4
  14. package/es/ProForm/components/combination/ProModalSelect/index.js +50 -45
  15. package/es/ProForm/components/combination/ProNumberRange/index.js +14 -5
  16. package/es/ProForm/components/combination/ProNumberRange/style/index.less +5 -1
  17. package/es/ProForm/components/render/ChangedWrapper.d.ts +17 -0
  18. package/es/ProForm/components/render/ChangedWrapper.js +108 -0
  19. package/es/ProForm/components/render/Render.js +7 -8
  20. package/es/ProForm/components/render/RenderFields.d.ts +2 -3
  21. package/es/ProForm/components/render/RenderFields.js +3 -4
  22. package/es/ProForm/components/render/propsType.d.ts +4 -3
  23. package/es/ProForm/index.js +3 -6
  24. package/es/ProForm/propsType.d.ts +13 -2
  25. package/es/ProForm/style/index.less +103 -5
  26. package/es/ProForm/utils/diffOriginal.d.ts +4 -4
  27. package/es/ProForm/utils/diffOriginal.js +18 -7
  28. package/es/ProForm/utils/transformValue.js +17 -11
  29. package/es/ProSelect/index.js +12 -11
  30. package/es/ProSelect/propsType.d.ts +4 -0
  31. package/es/ProSelect/utils/index.js +5 -4
  32. package/es/ProStep/components/Listener/index.d.ts +1 -1
  33. package/es/ProStep/components/Listener/index.js +5 -2
  34. package/es/ProStep/index.d.ts +1 -1
  35. package/es/ProStep/index.js +24 -17
  36. package/es/ProTable/components/FormatColumn/index.d.ts +7 -1
  37. package/es/ProTable/components/FormatColumn/index.js +14 -8
  38. package/es/ProTable/index.js +30 -13
  39. package/es/ProTable/propsType.d.ts +14 -1
  40. package/es/ProTable/style/index.less +1 -1
  41. package/es/ProTree/components/AdaptiveTooltip.d.ts +4 -0
  42. package/es/ProTree/components/AdaptiveTooltip.js +55 -0
  43. package/es/ProTree/components/List.js +15 -3
  44. package/es/ProTree/components/ProTreeSelect/index.js +25 -5
  45. package/es/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
  46. package/es/ProTree/components/ProTreeSelect/style/index.less +2 -2
  47. package/es/ProTree/components/SearchTitle.d.ts +2 -0
  48. package/es/ProTree/components/SearchTitle.js +17 -8
  49. package/es/ProTree/style/index.less +14 -0
  50. package/es/ProTreeModal/components/Tree.js +15 -17
  51. package/es/ProTreeModal/index.js +62 -7
  52. package/es/ProTreeModal/utils.d.ts +1 -0
  53. package/es/ProTreeModal/utils.js +21 -1
  54. package/es/style/theme/antd.less +5 -0
  55. package/es/style/theme/index.less +2 -1
  56. package/es/style/theme/tokens.less +1 -0
  57. package/es/utils/index.d.ts +2 -0
  58. package/es/utils/index.js +13 -0
  59. package/lib/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts} +4 -3
  60. package/lib/ProEditTable/components/RenderField/{ListChanged.js → ListChangedWrapper.js} +25 -11
  61. package/lib/ProEditTable/components/RenderField/index.js +3 -3
  62. package/lib/ProEnum/components/Group.js +10 -2
  63. package/lib/ProEnum/index.js +5 -4
  64. package/lib/ProEnum/style/index.less +14 -4
  65. package/lib/ProEnum/utils/index.d.ts +1 -1
  66. package/lib/ProEnum/utils/index.js +4 -0
  67. package/lib/ProForm/components/combination/Container/index.js +5 -3
  68. package/lib/ProForm/components/combination/Container/propsType.d.ts +2 -1
  69. package/lib/ProForm/components/combination/FormList/utils.js +4 -3
  70. package/lib/ProForm/components/combination/ProModalSelect/index.js +49 -44
  71. package/lib/ProForm/components/combination/ProNumberRange/index.js +14 -5
  72. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +5 -1
  73. package/lib/ProForm/components/render/ChangedWrapper.d.ts +17 -0
  74. package/lib/ProForm/components/render/ChangedWrapper.js +113 -0
  75. package/lib/ProForm/components/render/Render.js +7 -8
  76. package/lib/ProForm/components/render/RenderFields.d.ts +2 -3
  77. package/lib/ProForm/components/render/RenderFields.js +3 -4
  78. package/lib/ProForm/components/render/propsType.d.ts +4 -3
  79. package/lib/ProForm/index.js +3 -6
  80. package/lib/ProForm/propsType.d.ts +13 -2
  81. package/lib/ProForm/style/index.less +103 -5
  82. package/lib/ProForm/utils/diffOriginal.d.ts +4 -4
  83. package/lib/ProForm/utils/diffOriginal.js +18 -7
  84. package/lib/ProForm/utils/transformValue.js +17 -11
  85. package/lib/ProSelect/index.js +12 -11
  86. package/lib/ProSelect/propsType.d.ts +4 -0
  87. package/lib/ProSelect/utils/index.js +5 -4
  88. package/lib/ProStep/components/Listener/index.d.ts +1 -1
  89. package/lib/ProStep/components/Listener/index.js +5 -2
  90. package/lib/ProStep/index.d.ts +1 -1
  91. package/lib/ProStep/index.js +24 -17
  92. package/lib/ProTable/components/FormatColumn/index.d.ts +7 -1
  93. package/lib/ProTable/components/FormatColumn/index.js +14 -8
  94. package/lib/ProTable/index.js +30 -13
  95. package/lib/ProTable/propsType.d.ts +14 -1
  96. package/lib/ProTable/style/index.less +1 -1
  97. package/lib/ProTree/components/AdaptiveTooltip.d.ts +4 -0
  98. package/lib/ProTree/components/AdaptiveTooltip.js +61 -0
  99. package/lib/ProTree/components/List.js +15 -3
  100. package/lib/ProTree/components/ProTreeSelect/index.js +25 -5
  101. package/lib/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
  102. package/lib/ProTree/components/ProTreeSelect/style/index.less +2 -2
  103. package/lib/ProTree/components/SearchTitle.d.ts +2 -0
  104. package/lib/ProTree/components/SearchTitle.js +19 -7
  105. package/lib/ProTree/style/index.less +14 -0
  106. package/lib/ProTreeModal/components/Tree.js +15 -17
  107. package/lib/ProTreeModal/index.js +61 -6
  108. package/lib/ProTreeModal/utils.d.ts +1 -0
  109. package/lib/ProTreeModal/utils.js +20 -0
  110. package/lib/style/theme/antd.less +5 -0
  111. package/lib/style/theme/index.less +2 -1
  112. package/lib/style/theme/tokens.less +1 -0
  113. package/lib/utils/index.d.ts +2 -0
  114. package/lib/utils/index.js +19 -0
  115. package/package.json +2 -1
  116. package/es/ProForm/components/render/Changed.d.ts +0 -14
  117. package/es/ProForm/components/render/Changed.js +0 -64
  118. package/lib/ProForm/components/render/Changed.d.ts +0 -14
  119. package/lib/ProForm/components/render/Changed.js +0 -69
  120. /package/es/ProForm/utils/{useChanged.d.ts → _useChanged.d.ts} +0 -0
  121. /package/es/ProForm/utils/{useChanged.js → _useChanged.js} +0 -0
  122. /package/es/ProForm/utils/{useListChanged.d.ts → _useListChanged.d.ts} +0 -0
  123. /package/es/ProForm/utils/{useListChanged.js → _useListChanged.js} +0 -0
  124. /package/lib/ProForm/utils/{useChanged.d.ts → _useChanged.d.ts} +0 -0
  125. /package/lib/ProForm/utils/{useChanged.js → _useChanged.js} +0 -0
  126. /package/lib/ProForm/utils/{useListChanged.d.ts → _useListChanged.d.ts} +0 -0
  127. /package/lib/ProForm/utils/{useListChanged.js → _useListChanged.js} +0 -0
@@ -0,0 +1,13 @@
1
+ var EMPTY_VALUE = [undefined, null, ''];
2
+ /** 判断一个值是否是空值 */
3
+ export var isEmpty = function isEmpty(value) {
4
+ if (EMPTY_VALUE.includes(value)) {
5
+ return true;
6
+ }
7
+ if (Array.isArray(value)) {
8
+ return !(value === null || value === void 0 ? void 0 : value.length) || value.every(function (item) {
9
+ return EMPTY_VALUE.includes(item);
10
+ });
11
+ }
12
+ return false;
13
+ };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { FormInstance } from 'antd';
3
3
  import { NamePath } from 'antd/lib/form/interface';
4
+ import { DiffOriginalParams } from '../../../ProForm/utils/diffOriginal';
4
5
  interface Props {
5
6
  name?: NamePath;
6
7
  names?: NamePath[];
@@ -9,8 +10,8 @@ interface Props {
9
10
  namesStr?: NamePath;
10
11
  originalValues?: any;
11
12
  form: FormInstance;
12
- equalWith?: (preValue: any, curValue: any) => boolean | undefined;
13
+ equalWith?: DiffOriginalParams['equalWith'];
13
14
  [name: string]: any;
14
15
  }
15
- declare const ListChanged: React.FC<Props>;
16
- export default ListChanged;
16
+ declare const ListChangedWrapper: React.FC<Props>;
17
+ export default ListChangedWrapper;
@@ -11,8 +11,11 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _antd = require("antd");
14
+ var _classnames = _interopRequireDefault(require("classnames"));
14
15
  var _lodash = require("lodash");
15
16
  var _diffOriginal = require("../../../ProForm/utils/diffOriginal");
17
+ var _ProConfigProvider = require("../../../ProConfigProvider");
18
+ var _utils = require("../../../utils");
16
19
  var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type"];
17
20
  var toNamePath = function toNamePath(name) {
18
21
  if (Array.isArray(name)) {
@@ -66,7 +69,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
66
69
  return (0, _lodash.get)(originalValues, originalName);
67
70
  }) : (0, _lodash.get)(originalValues, originalName);
68
71
  };
69
- var ListChanged = function ListChanged(props) {
72
+ var ListChangedWrapper = function ListChangedWrapper(props) {
70
73
  var name = props.name,
71
74
  names = props.names,
72
75
  namesStr = props.namesStr,
@@ -81,11 +84,13 @@ var ListChanged = function ListChanged(props) {
81
84
  children = props.children,
82
85
  type = props.type,
83
86
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
87
+ var _ref2 = (0, _ProConfigProvider.useProConfig)('ProEditTable') || {},
88
+ isDiffAll = _ref2.isDiffAll;
84
89
  var namePath = toNamePath(namesStr || name);
85
90
  var originalNamePath = toNamePath(originalName);
86
91
  var originalNamePaths = originalNames && toNamePaths(originalNames);
87
- var notWatch = !originalValues || ['FormList', 'ProEditTable'].includes(type);
88
- var originalValue = !notWatch ? getOriginalValue({
92
+ var isWatch = originalValues && !['FormList', 'ProEditTable'].includes(type);
93
+ var originalValue = isWatch ? getOriginalValue({
89
94
  namePath: namePath,
90
95
  originalName: originalNamePath,
91
96
  originalNames: originalNamePaths,
@@ -93,9 +98,9 @@ var ListChanged = function ListChanged(props) {
93
98
  rowKeyPath: rowKeyPath,
94
99
  form: form
95
100
  }) : undefined;
96
- var noChange = !equalWith && (!originalValues || originalValue === undefined);
97
- var changed = (0, _react.useMemo)(function () {
98
- if (notWatch || noChange) return false;
101
+ var noChange = !equalWith && (!originalValues || isDiffAll ? false : (0, _utils.isEmpty)(originalValue));
102
+ var diffType = (0, _react.useMemo)(function () {
103
+ if (!isWatch || noChange) return 'same';
99
104
  return (0, _diffOriginal.diffOriginal)({
100
105
  value: props.value,
101
106
  originalValue: originalValue,
@@ -104,11 +109,20 @@ var ListChanged = function ListChanged(props) {
104
109
  // name: isString(namesStr) ? namesStr : originalName || name,
105
110
  });
106
111
  }, [props.value, originalValue]);
107
- if (notWatch || noChange) {
112
+ var isAdd = diffType === 'add';
113
+ var isChanged = diffType === 'changed';
114
+ if (!isWatch || noChange) {
108
115
  return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest));
109
116
  }
110
- return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
111
- open: changed ? undefined : false,
117
+ var diffClassName = (0, _classnames.default)({
118
+ 'pro-form-item-changed': isChanged,
119
+ 'pro-form-item-add': isAdd
120
+ });
121
+ return (0, _jsxRuntime.jsx)(_antd.Tooltip
122
+ // 传入undefined 鼠标移入显示移出隐藏
123
+ , {
124
+ // 传入undefined 鼠标移入显示移出隐藏
125
+ open: isChanged ? undefined : false,
112
126
  getPopupContainer: function getPopupContainer(target) {
113
127
  return target.parentElement;
114
128
  },
@@ -121,9 +135,9 @@ var ListChanged = function ListChanged(props) {
121
135
  })) : undefined]
122
136
  }),
123
137
  children: (0, _jsxRuntime.jsx)("div", {
124
- className: changed ? 'pro-form-item-changed' : '',
138
+ className: diffClassName,
125
139
  children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest)) : undefined
126
140
  })
127
141
  });
128
142
  };
129
- var _default = exports.default = ListChanged;
143
+ var _default = exports.default = ListChangedWrapper;
@@ -29,7 +29,7 @@ var _useRules = _interopRequireDefault(require("../../../ProForm/utils/useRules"
29
29
  var _utils = require("../../../ProForm/utils");
30
30
  var _ConfirmWrapper = _interopRequireDefault(require("../../../ProForm/components/render/ConfirmWrapper"));
31
31
  var _getDefaultProps = require("../../utils/getDefaultProps");
32
- var _ListChanged = _interopRequireDefault(require("./ListChanged"));
32
+ var _ListChangedWrapper = _interopRequireDefault(require("./ListChangedWrapper"));
33
33
  var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim", "confirm"];
34
34
  /* eslint-disable prefer-destructuring */
35
35
  /* eslint-disable prefer-const */
@@ -517,7 +517,7 @@ var RenderField = function RenderField(_ref) {
517
517
  form: form,
518
518
  names: names,
519
519
  namePath: [].concat((0, _toConsumableArray2.default)(namePath), [index]),
520
- name: cellName,
520
+ name: originalName,
521
521
  listName: cellName,
522
522
  viewEmpty: viewEmpty,
523
523
  valueType: _valueType,
@@ -554,7 +554,7 @@ var RenderField = function RenderField(_ref) {
554
554
  var FormItem = null;
555
555
  var FieldComponent = /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, componentProps)) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)({}, componentProps));
556
556
  if (originalValues) {
557
- FieldComponent = (0, _jsxRuntime.jsx)(_ListChanged.default, {
557
+ FieldComponent = (0, _jsxRuntime.jsx)(_ListChangedWrapper.default, {
558
558
  name: cellName,
559
559
  names: names,
560
560
  namesStr: [].concat((0, _toConsumableArray2.default)(baseName), [index, dataIndex]),
@@ -50,7 +50,10 @@ var Group = function Group(props) {
50
50
  }
51
51
  return (0, _jsxRuntime.jsx)("div", {
52
52
  id: id,
53
- className: (0, _classnames.default)('pro-enum-group-root', disabled ? 'pro-enum-group-root-disabled' : ''),
53
+ className: (0, _classnames.default)({
54
+ 'pro-enum-group-root': true,
55
+ 'pro-enum-group-root-disabled': disabled
56
+ }),
54
57
  children: dataSource.map(function (item, index) {
55
58
  return (0, _jsxRuntime.jsx)("div", {
56
59
  onClick: function onClick() {
@@ -58,7 +61,12 @@ var Group = function Group(props) {
58
61
  handleClick(item[fieldValue], index);
59
62
  }
60
63
  },
61
- className: (0, _classnames.default)('pro-enum-group-item', value === item[fieldValue] ? 'pro-enum-group-item-selected' : '', index === idx.current || index + 1 === idx.current ? 'pro-enum-group-item-disabled-after' : '', item.disabled ? 'pro-enum-group-item-disabled' : ''),
64
+ className: (0, _classnames.default)({
65
+ 'pro-enum-group-item': true,
66
+ 'pro-enum-group-item-selected': value === item[fieldValue],
67
+ 'pro-enum-group-item-disabled-after': index === idx.current || index + 1 === idx.current,
68
+ 'pro-enum-group-item-disabled': item.disabled
69
+ }),
62
70
  children: item[fieldLabel]
63
71
  }, item[fieldValue]);
64
72
  })
@@ -26,7 +26,7 @@ var _getEnumLabel = _interopRequireDefault(require("./utils/getEnumLabel"));
26
26
  var _useEnum = _interopRequireDefault(require("./hooks/useEnum"));
27
27
  var _locale = _interopRequireDefault(require("../locale"));
28
28
  require("./style/index.less");
29
- var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps"],
29
+ var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps", "isView"],
30
30
  _excluded2 = ["fieldNames", "clear", "cacheKey", "showCodeName"];
31
31
  var ProEnum = function ProEnum(props) {
32
32
  var _enumProps$showCodeNa;
@@ -40,10 +40,11 @@ var ProEnum = function ProEnum(props) {
40
40
  onChange = props.onChange,
41
41
  transformResponse = props.transformResponse,
42
42
  otherProps = props.otherProps,
43
+ isView = props.isView,
43
44
  enumProps = (0, _objectWithoutProperties2.default)(props, _excluded);
44
45
  var _ref = otherProps || {},
45
- isView = _ref.isView,
46
46
  viewEmpty = _ref.viewEmpty;
47
+ var _isView = isView || (otherProps === null || otherProps === void 0 ? void 0 : otherProps.isView);
47
48
  var _ref2 = (0, _ProConfigProvider.useProConfig)('ProEnum') || {},
48
49
  fieldNames = _ref2.fieldNames,
49
50
  _ref2$clear = _ref2.clear,
@@ -227,7 +228,7 @@ var ProEnum = function ProEnum(props) {
227
228
  if (!code && !dataSource && !useRequest) {
228
229
  var _locale$ProEnum4;
229
230
  _antd.message.error(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum4 = _locale.default.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.errorNoEnumType);
230
- return;
231
+ // return;
231
232
  }
232
233
  var transToLabel = function transToLabel(value) {
233
234
  var list = dataList && dataList.length ? dataList : enumLists;
@@ -272,7 +273,7 @@ var ProEnum = function ProEnum(props) {
272
273
  };
273
274
  return (0, _lodash.isFunction)(props.optionRender) && record.length ? _optionRender() : labelList === null || labelList === void 0 ? void 0 : labelList.join(',');
274
275
  };
275
- if (isView) {
276
+ if (_isView) {
276
277
  if (Array.isArray(value)) {
277
278
  return (0, _jsxRuntime.jsx)(_Container.default, {
278
279
  tooltip: true,
@@ -1,6 +1,8 @@
1
1
  @root-entry-name: 'default';
2
2
  @import (reference) '~antd/es/style/themes/index.less';
3
3
 
4
+ @zaui-disabled-bg: var(--zaui-disabled-bg);
5
+
4
6
  .pro-enum {
5
7
  &-tag-root {
6
8
  display: flex;
@@ -19,7 +21,7 @@
19
21
  justify-content: center;
20
22
  margin-right: var(--zaui-space-size-sm);
21
23
  padding: var(--zaui-space-size-xs) 10px;
22
- background-color: #f5f5f5;
24
+ background-color: var(--zaui-disabled-bg);
23
25
  border-radius: var(--zaui-space-size-xs);
24
26
  cursor: pointer;
25
27
  }
@@ -29,7 +31,7 @@
29
31
  background-color: var(--zaui-brand);
30
32
  }
31
33
  &-tag-item-disabled {
32
- background-color: #f5f5f5;
34
+ background-color: var(--zaui-disabled-bg);
33
35
  pointer-events: none;
34
36
  }
35
37
 
@@ -90,12 +92,20 @@
90
92
 
91
93
  .pro-enum-group-item-disabled {
92
94
  color: rgba(0, 0, 0, 0.25);
93
- background: #f5f5f5;
95
+ background: var(--zaui-disabled-bg);
94
96
  cursor: not-allowed;
95
97
  }
96
98
  }
97
99
 
98
100
  &-group-root-disabled {
99
- opacity: 0.7;
101
+ color: var(--zaui-aide-text);
102
+
103
+ .pro-enum-group-item {
104
+ background: var(--zaui-disabled-bg);
105
+ &.pro-enum-group-item-selected {
106
+ background: var(--zaui-brand-disabled);
107
+ border-color: var(--zaui-brand-disabled);
108
+ }
109
+ }
100
110
  }
101
111
  }
@@ -5,7 +5,7 @@ interface EnumRes {
5
5
  [key: string]: any;
6
6
  }
7
7
  export declare function getEnumData(storage: StorageType, cacheKey: string, baseEnumStorage?: any): EnumRes;
8
- export declare function setEnumData(storage: StorageType, cacheKey: string, data: Object): void;
8
+ export declare function setEnumData(storage: StorageType, cacheKey: string, data: any): boolean;
9
9
  export declare function hasEnumList(storage: StorageType, cacheKey: any, code: string): DataOption[];
10
10
  export declare function isObject(obj: any): boolean;
11
11
  export declare function mergeCacheData(storage: string, code: string, cacheKey: string, responseData: any): void;
@@ -26,6 +26,10 @@ function getEnumData(storage, cacheKey, baseEnumStorage) {
26
26
  }
27
27
  }
28
28
  function setEnumData(storage, cacheKey, data) {
29
+ var _Object$keys;
30
+ if (!((_Object$keys = Object.keys(data === null || data === void 0 ? void 0 : data.data)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length)) {
31
+ return false;
32
+ }
29
33
  if (storage === 'localStorage') {
30
34
  window.localStorage.setItem(cacheKey, JSON.stringify(data));
31
35
  } else if (storage === 'sessionStorage') {
@@ -16,11 +16,12 @@ var _ProCollapse = _interopRequireDefault(require("../../../../ProLayout/compone
16
16
  var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
17
17
  var Container = function Container(props) {
18
18
  var children = props.children,
19
- otherProps = props.otherProps,
20
19
  className = props.className,
21
20
  container = props.container,
22
21
  show = props.show,
23
- clearNotShow = props.clearNotShow;
22
+ clearNotShow = props.clearNotShow,
23
+ diffConfig = props.diffConfig,
24
+ otherProps = props.otherProps;
24
25
  var _ref = _ProForm.default.useFieldProps() || {},
25
26
  type = _ref.type,
26
27
  form = _ref.form,
@@ -45,7 +46,8 @@ var Container = function Container(props) {
45
46
  var childRender = function childRender() {
46
47
  var child = (0, _jsxRuntime.jsx)(_RenderFields.default, (0, _objectSpread2.default)({
47
48
  columns: _children,
48
- form: form
49
+ form: form,
50
+ diffConfig: diffConfig
49
51
  }, otherProps));
50
52
  if (type === 'ProCollapse') {
51
53
  return (0, _jsxRuntime.jsx)(_ProCollapse.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(props, ['otherProps', 'children', 'onBlur', 'onChange', 'placeholder', 'className'])), {}, {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { RowProps } from 'antd';
3
- import { ProColumnProps, ProFormOtherProps } from '../../../propsType';
3
+ import { ProColumnProps, ProFormOtherProps, DiffConfigProps } from '../../../propsType';
4
4
  export interface ContainerProps {
5
5
  children?: ProColumnProps[];
6
6
  otherProps?: ProFormOtherProps;
@@ -8,5 +8,6 @@ export interface ContainerProps {
8
8
  className?: string;
9
9
  container?: string | React.ReactNode;
10
10
  show?: boolean | (() => boolean);
11
+ diffConfig?: DiffConfigProps;
11
12
  clearNotShow?: boolean;
12
13
  }
@@ -33,8 +33,9 @@ var memoWith = exports.memoWith = function memoWith(pre, next) {
33
33
  if ( /*#__PURE__*/_react.default.isValidElement(objValue) && /*#__PURE__*/_react.default.isValidElement(othValue)) {
34
34
  return true;
35
35
  }
36
- if ((0, _lodash.isFunction)(objValue) && (0, _lodash.isFunction)(othValue)) {
37
- return true;
38
- }
36
+ // 移除解决formlist函数里不更新问题
37
+ // if (isFunction(objValue) && isFunction(othValue)) {
38
+ // return true;
39
+ // }
39
40
  });
40
41
  };
@@ -132,10 +132,10 @@ var ProModalSelect = function ProModalSelect(props, ref) {
132
132
  }, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
133
133
  manual: true,
134
134
  onSuccess: function onSuccess(res) {
135
- var _res$data;
135
+ var _res$data, _ref5;
136
136
  var list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list : res === null || res === void 0 ? void 0 : res.data;
137
137
  setState({
138
- options: transformResponse ? transformResponse(res === null || res === void 0 ? void 0 : res.data) : list
138
+ options: (_ref5 = transformResponse ? transformResponse(res === null || res === void 0 ? void 0 : res.data) : list) !== null && _ref5 !== void 0 ? _ref5 : []
139
139
  });
140
140
  }
141
141
  })),
@@ -161,9 +161,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
161
161
  };
162
162
  var handleFormat = onFormat || defaultOptionRender;
163
163
  if (showCodeName) {
164
- handleFormat = function handleFormat(_ref5) {
165
- var value = _ref5.value,
166
- label = _ref5.label;
164
+ handleFormat = function handleFormat(_ref6) {
165
+ var value = _ref6.value,
166
+ label = _ref6.label;
167
167
  return "".concat(value, "-").concat(label);
168
168
  };
169
169
  }
@@ -232,7 +232,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
232
232
  onChange(val, option);
233
233
  };
234
234
  var handleClick = /*#__PURE__*/function () {
235
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
235
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
236
236
  var _yield$beforeOpen, res;
237
237
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
238
238
  while (1) switch (_context.prev = _context.next) {
@@ -275,7 +275,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
275
275
  }, _callee);
276
276
  }));
277
277
  return function handleClick() {
278
- return _ref6.apply(this, arguments);
278
+ return _ref7.apply(this, arguments);
279
279
  };
280
280
  }();
281
281
  var handleClose = function handleClose() {
@@ -294,7 +294,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
294
294
  }
295
295
  };
296
296
  var handleFinish = /*#__PURE__*/function () {
297
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
297
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
298
298
  var _nextSelectedRows, _nextSelectedRows2, nextSelectedRows, record, flag, res;
299
299
  return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
300
300
  while (1) switch (_context2.prev = _context2.next) {
@@ -355,11 +355,11 @@ var ProModalSelect = function ProModalSelect(props, ref) {
355
355
  }, _callee2, null, [[0, 18]]);
356
356
  }));
357
357
  return function handleFinish() {
358
- return _ref7.apply(this, arguments);
358
+ return _ref8.apply(this, arguments);
359
359
  };
360
360
  }();
361
361
  var handleSearch = /*#__PURE__*/function () {
362
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3() {
362
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3() {
363
363
  var values;
364
364
  return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
365
365
  while (1) switch (_context3.prev = _context3.next) {
@@ -378,7 +378,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
378
378
  }, _callee3);
379
379
  }));
380
380
  return function handleSearch() {
381
- return _ref8.apply(this, arguments);
381
+ return _ref9.apply(this, arguments);
382
382
  };
383
383
  }();
384
384
  var _rowSelection = (0, _objectSpread3.default)({
@@ -432,7 +432,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
432
432
  };
433
433
  // 初始化回显,当传入initParams时,前端用来回险
434
434
  var getInitValues = /*#__PURE__*/function () {
435
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {
435
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {
436
436
  var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
437
437
  return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
438
438
  while (1) switch (_context4.prev = _context4.next) {
@@ -490,12 +490,12 @@ var ProModalSelect = function ProModalSelect(props, ref) {
490
490
  }, _callee4);
491
491
  }));
492
492
  return function getInitValues() {
493
- return _ref9.apply(this, arguments);
493
+ return _ref10.apply(this, arguments);
494
494
  };
495
495
  }();
496
496
  // 初始化回显,当传入initParams时,前端用来回险
497
497
  var getDefaultOneValues = /*#__PURE__*/function () {
498
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee5() {
498
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee5() {
499
499
  var _useRequest$options4, _useRequest$options5;
500
500
  var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
501
501
  return (0, _regeneratorRuntime2.default)().wrap(function _callee5$(_context5) {
@@ -543,7 +543,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
543
543
  }, _callee5);
544
544
  }));
545
545
  return function getDefaultOneValues() {
546
- return _ref10.apply(this, arguments);
546
+ return _ref11.apply(this, arguments);
547
547
  };
548
548
  }();
549
549
  (0, _react.useImperativeHandle)(ref, function () {
@@ -574,7 +574,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
574
574
  });
575
575
  }
576
576
  });
577
- (0, _react.useEffect)(function () {
577
+ (0, _ahooks.useDeepCompareEffect)(function () {
578
578
  if (onOff && !visible) {
579
579
  var _useRequest$options6;
580
580
  if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.manual) !== true) {
@@ -610,34 +610,39 @@ var ProModalSelect = function ProModalSelect(props, ref) {
610
610
  setState(nextState);
611
611
  }
612
612
  }, [onOff, visible, value]);
613
- (0, _react.useEffect)(function () {
614
- if (value && !visible && isInit) {
615
- if (readOnly) {
616
- // 加定时器 修复依赖数据同步更新未取到问题
617
- setTimeout(function () {
618
- var _useRequest$options7, _useRequest$options8;
619
- var initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams;
620
- if (typeof (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) === 'function') {
621
- var _contentForm$getField2;
622
- initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm === null || contentForm === void 0 ? void 0 : (_contentForm$getField2 = contentForm.getFieldsValue) === null || _contentForm$getField2 === void 0 ? void 0 : _contentForm$getField2.call(contentForm));
623
- }
624
- var params = withPagination ? {
625
- pageNum: 1,
626
- pageSize: 50,
627
- queryBean: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.defaultParams), initParams)
628
- } : (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
629
- var nextParams = transformParams ? transformParams(params) : params;
630
- run(nextParams);
631
- setState({
632
- isInit: false
633
- });
634
- }, 300);
635
- } else {
636
- getInitValues();
613
+ (0, _ahooks.useDeepCompareEffect)(function () {
614
+ if (value && !visible && isInit && !readOnly) {
615
+ getInitValues();
616
+ }
617
+ }, [value, visible, isInit]);
618
+ (0, _ahooks.useDeepCompareEffect)(function () {
619
+ if (value && !visible && readOnly) {
620
+ var _options$some;
621
+ var isHasValue = options === null || options === void 0 ? void 0 : (_options$some = options.some) === null || _options$some === void 0 ? void 0 : _options$some.call(options, function (item) {
622
+ return item[valueKey] === value;
623
+ });
624
+ if (isHasValue) {
625
+ return;
637
626
  }
627
+ // 加定时器 修复依赖数据同步更新未取到问题
628
+ setTimeout(function () {
629
+ var _useRequest$options7, _useRequest$options8;
630
+ var initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams;
631
+ if (typeof (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) === 'function') {
632
+ var _contentForm$getField2;
633
+ initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm === null || contentForm === void 0 ? void 0 : (_contentForm$getField2 = contentForm.getFieldsValue) === null || _contentForm$getField2 === void 0 ? void 0 : _contentForm$getField2.call(contentForm));
634
+ }
635
+ var params = withPagination ? {
636
+ pageNum: 1,
637
+ pageSize: 50,
638
+ queryBean: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.defaultParams), initParams)
639
+ } : (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
640
+ var nextParams = transformParams ? transformParams(params) : params;
641
+ run(nextParams);
642
+ }, 300);
638
643
  }
639
- }, [value, visible, isInit, useRequest]);
640
- (0, _react.useEffect)(function () {
644
+ }, [value, options, visible, useRequest]);
645
+ (0, _ahooks.useDeepCompareEffect)(function () {
641
646
  if (!value) {
642
647
  if (defaultOne) {
643
648
  getDefaultOneValues();
@@ -737,7 +742,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
737
742
  children: customRender
738
743
  });
739
744
  }
740
- (0, _react.useEffect)(function () {
745
+ (0, _ahooks.useDeepCompareEffect)(function () {
741
746
  if (isTooltip && value) {
742
747
  var dom = document.getElementById(uuid);
743
748
  dom.addEventListener('mouseover', function (e) {
@@ -774,7 +779,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
774
779
  }, [value, isTooltip]);
775
780
  (0, _ahooks.useDeepCompareEffect)(function () {
776
781
  setState({
777
- options: tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource
782
+ options: (tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource) || []
778
783
  });
779
784
  }, [tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource]);
780
785
  // 当搜索条件只有一个时,且为输入框,默认设置suffix
@@ -17,11 +17,9 @@ var _utils = require("@zat-design/utils");
17
17
  var _Container = _interopRequireDefault(require("../../Container"));
18
18
  var _locale = _interopRequireDefault(require("../../../../locale"));
19
19
  var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
20
- var formatAmount = _utils.tools.formatAmount,
21
- formatPercent = _utils.tools.formatPercent,
22
- formatPerMill = _utils.tools.formatPerMill;
20
+ var formatAmount = _utils.tools.formatAmount;
23
21
  var ProNumberRange = function ProNumberRange(props) {
24
- var _valueProps, _ref2, _ref3, _value$, _valueProps2, _ref4, _ref5, _value$2, _valueProps3, _valueProps4;
22
+ var _document$querySelect, _valueProps, _ref2, _ref3, _value$, _valueProps2, _ref4, _ref5, _value$2, _valueProps3, _valueProps4;
25
23
  var _props$value = props.value,
26
24
  value = _props$value === void 0 ? [] : _props$value,
27
25
  _props$onChange = props.onChange,
@@ -46,6 +44,7 @@ var ProNumberRange = function ProNumberRange(props) {
46
44
  viewEmpty = _ref.viewEmpty,
47
45
  valueType = _ref.valueType;
48
46
  var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
47
+ var addonAfterDomWidth = (_document$querySelect = document.querySelector('.ant-input-number-group-addon')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.clientWidth;
49
48
  var _useSetState = (0, _ahooks.useSetState)({
50
49
  range: value || []
51
50
  }),
@@ -91,11 +90,15 @@ var ProNumberRange = function ProNumberRange(props) {
91
90
  };
92
91
  var cls = (0, _classnames.default)({
93
92
  'pro-number-range': true,
93
+ 'pro-number-range-after': addonAfter,
94
+ 'pro-number-range-before': addonBefore,
94
95
  className: className
95
96
  });
96
97
  // 查看模式
97
98
  if (isView || props.isView) {
98
- if ((0, _lodash.isEmpty)(value)) {
99
+ if ((0, _lodash.isEmpty)(value) || (value === null || value === void 0 ? void 0 : value.every(function (item) {
100
+ return typeof item !== 'number';
101
+ }))) {
99
102
  return viewEmpty;
100
103
  }
101
104
  switch (valueType) {
@@ -192,6 +195,9 @@ var ProNumberRange = function ProNumberRange(props) {
192
195
  },
193
196
  addonBefore: addonBefore
194
197
  }, valueProps), {}, {
198
+ style: addonAfter ? {
199
+ width: "calc(50% - ".concat(16 + addonAfterDomWidth / 2, "px)")
200
+ } : null,
195
201
  min: min !== null && min !== void 0 ? min : (_valueProps = valueProps) === null || _valueProps === void 0 ? void 0 : _valueProps.min,
196
202
  max: (_ref2 = (_ref3 = (_value$ = value === null || value === void 0 ? void 0 : value[1]) !== null && _value$ !== void 0 ? _value$ : range[1]) !== null && _ref3 !== void 0 ? _ref3 : max) !== null && _ref2 !== void 0 ? _ref2 : (_valueProps2 = valueProps) === null || _valueProps2 === void 0 ? void 0 : _valueProps2.max
197
203
  }, childProps === null || childProps === void 0 ? void 0 : childProps[0])), (0, _jsxRuntime.jsx)(_antd.Input, {
@@ -212,6 +218,9 @@ var ProNumberRange = function ProNumberRange(props) {
212
218
  },
213
219
  addonAfter: addonAfter
214
220
  }, valueProps), {}, {
221
+ style: addonAfter ? {
222
+ width: "calc(50% - ".concat(16 - addonAfterDomWidth / 2, "px)")
223
+ } : null,
215
224
  min: (_ref4 = (_ref5 = (_value$2 = value === null || value === void 0 ? void 0 : value[0]) !== null && _value$2 !== void 0 ? _value$2 : range[0]) !== null && _ref5 !== void 0 ? _ref5 : min) !== null && _ref4 !== void 0 ? _ref4 : (_valueProps3 = valueProps) === null || _valueProps3 === void 0 ? void 0 : _valueProps3.min,
216
225
  max: max !== null && max !== void 0 ? max : (_valueProps4 = valueProps) === null || _valueProps4 === void 0 ? void 0 : _valueProps4.max
217
226
  }, childProps === null || childProps === void 0 ? void 0 : childProps[1]))]
@@ -40,8 +40,12 @@
40
40
 
41
41
  .range-left,
42
42
  .range-right {
43
- width: calc(50% - 20px);
43
+ width: calc(50% - 16px);
44
44
  text-align: center;
45
+ transition: none;
46
+ .range-left {
47
+ width: calc(100% + 2px) !important;
48
+ }
45
49
  }
46
50
 
47
51
  .range-left {
@@ -0,0 +1,17 @@
1
+ import { FormInstance } from 'antd';
2
+ import { NamePath } from 'antd/lib/form/interface';
3
+ import React from 'react';
4
+ import { DiffOriginalParams } from '../../utils/diffOriginal';
5
+ import { DiffConfigProps } from '../../propsType';
6
+ interface Props {
7
+ name?: NamePath;
8
+ names?: NamePath[];
9
+ namesStr?: string;
10
+ diffConfig?: DiffConfigProps;
11
+ form: FormInstance;
12
+ equalWith?: DiffOriginalParams['equalWith'];
13
+ valuePropName?: string;
14
+ [name: string]: any;
15
+ }
16
+ declare const ChangedWrapper: React.FC<Props>;
17
+ export default ChangedWrapper;