@zat-design/sisyphus-react 3.7.3-beta.9 → 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 (67) hide show
  1. package/dist/index.esm.css +21 -4
  2. package/dist/less.esm.css +21 -4
  3. package/es/ProEditTable/components/RenderField/index.js +1 -1
  4. package/es/ProEnum/components/Group.js +10 -2
  5. package/es/ProEnum/index.js +1 -1
  6. package/es/ProEnum/style/index.less +7 -1
  7. package/es/ProForm/components/combination/ProModalSelect/index.js +50 -45
  8. package/es/ProForm/components/combination/ProNumberRange/index.js +11 -4
  9. package/es/ProForm/components/combination/ProNumberRange/style/index.less +5 -1
  10. package/es/ProForm/components/render/ChangedWrapper.d.ts +1 -0
  11. package/es/ProForm/components/render/ChangedWrapper.js +26 -10
  12. package/es/ProForm/propsType.d.ts +1 -0
  13. package/es/ProForm/style/index.less +1 -1
  14. package/es/ProForm/utils/transformValue.js +17 -11
  15. package/es/ProSelect/index.js +3 -4
  16. package/es/ProSelect/utils/index.js +5 -4
  17. package/es/ProTable/components/FormatColumn/index.d.ts +7 -1
  18. package/es/ProTable/components/FormatColumn/index.js +14 -8
  19. package/es/ProTable/index.js +30 -13
  20. package/es/ProTable/propsType.d.ts +14 -1
  21. package/es/ProTable/style/index.less +1 -1
  22. package/es/ProTree/components/AdaptiveTooltip.d.ts +4 -0
  23. package/es/ProTree/components/AdaptiveTooltip.js +55 -0
  24. package/es/ProTree/components/List.js +15 -3
  25. package/es/ProTree/components/ProTreeSelect/index.js +25 -5
  26. package/es/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
  27. package/es/ProTree/components/SearchTitle.d.ts +2 -0
  28. package/es/ProTree/components/SearchTitle.js +17 -8
  29. package/es/ProTree/style/index.less +14 -0
  30. package/es/ProTreeModal/components/Tree.js +15 -17
  31. package/es/ProTreeModal/index.js +62 -7
  32. package/es/ProTreeModal/utils.d.ts +1 -0
  33. package/es/ProTreeModal/utils.js +21 -1
  34. package/es/style/theme/index.less +1 -1
  35. package/lib/ProEditTable/components/RenderField/index.js +1 -1
  36. package/lib/ProEnum/components/Group.js +10 -2
  37. package/lib/ProEnum/index.js +1 -1
  38. package/lib/ProEnum/style/index.less +7 -1
  39. package/lib/ProForm/components/combination/ProModalSelect/index.js +49 -44
  40. package/lib/ProForm/components/combination/ProNumberRange/index.js +11 -4
  41. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +5 -1
  42. package/lib/ProForm/components/render/ChangedWrapper.d.ts +1 -0
  43. package/lib/ProForm/components/render/ChangedWrapper.js +27 -11
  44. package/lib/ProForm/propsType.d.ts +1 -0
  45. package/lib/ProForm/style/index.less +1 -1
  46. package/lib/ProForm/utils/transformValue.js +17 -11
  47. package/lib/ProSelect/index.js +3 -4
  48. package/lib/ProSelect/utils/index.js +5 -4
  49. package/lib/ProTable/components/FormatColumn/index.d.ts +7 -1
  50. package/lib/ProTable/components/FormatColumn/index.js +14 -8
  51. package/lib/ProTable/index.js +30 -13
  52. package/lib/ProTable/propsType.d.ts +14 -1
  53. package/lib/ProTable/style/index.less +1 -1
  54. package/lib/ProTree/components/AdaptiveTooltip.d.ts +4 -0
  55. package/lib/ProTree/components/AdaptiveTooltip.js +61 -0
  56. package/lib/ProTree/components/List.js +15 -3
  57. package/lib/ProTree/components/ProTreeSelect/index.js +25 -5
  58. package/lib/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
  59. package/lib/ProTree/components/SearchTitle.d.ts +2 -0
  60. package/lib/ProTree/components/SearchTitle.js +19 -7
  61. package/lib/ProTree/style/index.less +14 -0
  62. package/lib/ProTreeModal/components/Tree.js +15 -17
  63. package/lib/ProTreeModal/index.js +61 -6
  64. package/lib/ProTreeModal/utils.d.ts +1 -0
  65. package/lib/ProTreeModal/utils.js +20 -0
  66. package/lib/style/theme/index.less +1 -1
  67. package/package.json +1 -1
@@ -15,7 +15,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
15
15
  * @Author: za-xuwenli xuwenli@zhongan.io
16
16
  * @Date: 2024-06-04 10:01:18
17
17
  * @LastEditors: za-xuwenli xuwenli@zhongan.io
18
- * @LastEditTime: 2024-06-25 17:56:33
18
+ * @LastEditTime: 2024-09-27 11:49:28
19
19
  * @FilePath: /za-material-warehouse/src/ProTreeModal/index.tsx
20
20
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
21
21
  */
@@ -26,7 +26,8 @@ import { ReactSVG } from 'react-svg';
26
26
  import classNames from 'classnames';
27
27
  import { ProDrawerForm, useProConfig } from '../index';
28
28
  import { Trigger, ListView, TreeView, Cascader } from './components';
29
- import { getFlatTreeData, filterCheckedNodes, getChildrenKeys, findTreeNodeByKey, getAllKeys, transformMessage } from './utils';
29
+ import { getFlatTreeData, filterCheckedNodes, getChildrenKeys, findTreeNodeByKey, getAllKeys, transformMessage, addLevelAndParentId } from './utils';
30
+ import { transformTreeToArray, treeNodeFind } from '../ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index';
30
31
  import searchSVG from '../assets/input-search.svg';
31
32
  import locale, { formatMessage } from '../locale';
32
33
  import './style/index.less';
@@ -98,7 +99,8 @@ var ProTreeModal = function ProTreeModal(props) {
98
99
  flatTreeData: [],
99
100
  searchStr: '',
100
101
  checkAll: false,
101
- allKeys: []
102
+ allKeys: [],
103
+ transformedTree: []
102
104
  }),
103
105
  _useSetState2 = _slicedToArray(_useSetState, 2),
104
106
  state = _useSetState2[0],
@@ -220,6 +222,12 @@ var ProTreeModal = function ProTreeModal(props) {
220
222
  });
221
223
  }
222
224
  }, [value, state.allKeys, state.open]);
225
+ useDeepCompareEffect(function () {
226
+ var transformedTree = addLevelAndParentId(state.treeData, fieldNames);
227
+ setState({
228
+ transformedTree: transformedTree
229
+ });
230
+ }, [state.treeData]);
223
231
  var handleClick = function handleClick() {
224
232
  setState({
225
233
  open: true
@@ -360,8 +368,55 @@ var ProTreeModal = function ProTreeModal(props) {
360
368
  var onCheck = function onCheck(checkedKeys, info) {
361
369
  var checkedValues = _toConsumableArray(state.checkedValues);
362
370
  var originalTreeData = state.originalTreeData;
371
+ // 如果有检索则自管理
372
+ if (state.searchStr) {
373
+ var _transformTreeToArray;
374
+ var node = info.node;
375
+ // 从完整树中找到当前节点
376
+ var activeNode = treeNodeFind(state.transformedTree, function (t) {
377
+ return t[fieldNameValue] === node[fieldNameValue];
378
+ }, {
379
+ childrenKey: fieldNames.children
380
+ });
381
+ var allChildren = (_transformTreeToArray = transformTreeToArray([activeNode], {
382
+ childrenKey: fieldNames.children
383
+ })) === null || _transformTreeToArray === void 0 ? void 0 : _transformTreeToArray.map(function (item) {
384
+ return item[fieldNameValue];
385
+ });
386
+ // 子项合并勾选
387
+ checkedValues = checkedValues.concat(allChildren);
388
+ // 从完整树中拿到父节点 只要存在父节点,那么就判断当前children是否全被勾选 若全被勾选就合并当前key到勾选队列
389
+ var _recourse2 = function _recourse(findNode) {
390
+ if (findNode.parentId) {
391
+ var _transformTreeToArray2;
392
+ var parentNode = treeNodeFind(state.transformedTree, function (t) {
393
+ return t[fieldNameValue] === findNode.parentId;
394
+ }, {
395
+ childrenKey: fieldNames.children
396
+ });
397
+ var parentChildrenKeys = (_transformTreeToArray2 = transformTreeToArray([parentNode], {
398
+ childrenKey: fieldNames.children
399
+ })) === null || _transformTreeToArray2 === void 0 ? void 0 : _transformTreeToArray2.map(function (item) {
400
+ return item[fieldNameValue];
401
+ });
402
+ var parentChildrenAllChecked = parentChildrenKeys.every(function (key) {
403
+ return checkedValues.includes(key);
404
+ });
405
+ if (parentChildrenAllChecked) {
406
+ // 把当前父节点追加进来
407
+ checkedValues = checkedValues.concat([parentNode[fieldNameValue]]);
408
+ // 继续向上查找
409
+ if (parentNode.parentId) {
410
+ _recourse2(parentNode);
411
+ }
412
+ }
413
+ }
414
+ };
415
+ _recourse2(activeNode);
416
+ }
417
+ var _checkStrictly = state.searchStr ? true : checkStrictly;
363
418
  // 此时应该取消掉自身并包含它所有的子集
364
- if (!info.checked && !checkStrictly) {
419
+ if (!info.checked && !_checkStrictly) {
365
420
  // 1. 取消自身
366
421
  // 2. 把所有的子节点也要取消
367
422
  var childrenkeys = [];
@@ -378,8 +433,8 @@ var ProTreeModal = function ProTreeModal(props) {
378
433
  return !parentKeys.includes(key);
379
434
  });
380
435
  } else {
381
- // checkStrictly 模式下取 checkedKeys.checked 或者自身的 key
382
- if (checkStrictly) {
436
+ // _checkStrictly 模式下取 checkedKeys.checked 或者自身的 key
437
+ if (_checkStrictly) {
383
438
  if (!info.checked) {
384
439
  checkedValues = checkedValues.filter(function (key) {
385
440
  return key !== info.node.key;
@@ -618,7 +673,7 @@ var ProTreeModal = function ProTreeModal(props) {
618
673
  });
619
674
  case TREE:
620
675
  return _jsx(TreeView, {
621
- treeData: state.treeData,
676
+ treeData: state.transformedTree,
622
677
  originalTreeData: state.originalTreeData,
623
678
  flatTreeData: state.flatTreeData,
624
679
  checkedValues: state.checkedValues,
@@ -36,3 +36,4 @@ export declare function filterCheckedNodes(data: any, checkedKeys: any, searchSt
36
36
  */
37
37
  export declare function getChildrenKeys(node: TreeDataProps, childrenKeys: string[], fieldNames: FieldNamesType, type: 'treeClose' | 'treeCheck'): void;
38
38
  export declare const transformMessage: (obj: any, message: string) => string;
39
+ export declare const addLevelAndParentId: (tree: any[], fieldNames: any, currentLevel?: number, currentParentId?: any) => any[];
@@ -197,4 +197,24 @@ export var transformMessage = function transformMessage(obj, message) {
197
197
  _message = message.replaceAll("{".concat(key, "}"), obj[key]);
198
198
  });
199
199
  return _message;
200
- };
200
+ };
201
+ var _addLevelAndParentId = function addLevelAndParentId() {
202
+ var tree = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
203
+ var fieldNames = arguments.length > 1 ? arguments[1] : undefined;
204
+ var currentLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
205
+ var currentParentId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
206
+ var _fieldNames$children = fieldNames.children,
207
+ children = _fieldNames$children === void 0 ? 'children' : _fieldNames$children,
208
+ _fieldNames$value = fieldNames.value,
209
+ value = _fieldNames$value === void 0 ? 'value' : _fieldNames$value;
210
+ return tree.map(function (node) {
211
+ var newNode = _objectSpread({}, node);
212
+ newNode.level = currentLevel;
213
+ newNode.parentId = currentParentId;
214
+ if (node[children]) {
215
+ newNode[children] = _addLevelAndParentId(node[children], fieldNames, currentLevel + 1, newNode[value]);
216
+ }
217
+ return newNode;
218
+ });
219
+ };
220
+ export { _addLevelAndParentId as addLevelAndParentId };
@@ -8,7 +8,7 @@
8
8
  --zaui-brand : #006aff;
9
9
  --zaui-brand-hover : #3387ff;
10
10
  --zaui-brand-active : #005ad9;
11
- --zaui-brand-disabled : #99c3ff;
11
+ --zaui-brand-disabled : color-mix(in srgb, var(--zaui-brand) 70%, white);
12
12
  --zaui-text : #343434;
13
13
  --zaui-text-weak : #616161;
14
14
  --zaui-aide-text : #909090;
@@ -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,
@@ -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
  })
@@ -44,7 +44,7 @@ var ProEnum = function ProEnum(props) {
44
44
  enumProps = (0, _objectWithoutProperties2.default)(props, _excluded);
45
45
  var _ref = otherProps || {},
46
46
  viewEmpty = _ref.viewEmpty;
47
- var _isView = isView || otherProps.isView;
47
+ var _isView = isView || (otherProps === null || otherProps === void 0 ? void 0 : otherProps.isView);
48
48
  var _ref2 = (0, _ProConfigProvider.useProConfig)('ProEnum') || {},
49
49
  fieldNames = _ref2.fieldNames,
50
50
  _ref2$clear = _ref2.clear,
@@ -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;
@@ -96,10 +98,14 @@
96
98
  }
97
99
 
98
100
  &-group-root-disabled {
99
- color: #bfbfbf;
101
+ color: var(--zaui-aide-text);
100
102
 
101
103
  .pro-enum-group-item {
102
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
+ }
103
109
  }
104
110
  }
105
111
  }
@@ -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,6 +90,8 @@ 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
  // 查看模式
@@ -194,6 +195,9 @@ var ProNumberRange = function ProNumberRange(props) {
194
195
  },
195
196
  addonBefore: addonBefore
196
197
  }, valueProps), {}, {
198
+ style: addonAfter ? {
199
+ width: "calc(50% - ".concat(16 + addonAfterDomWidth / 2, "px)")
200
+ } : null,
197
201
  min: min !== null && min !== void 0 ? min : (_valueProps = valueProps) === null || _valueProps === void 0 ? void 0 : _valueProps.min,
198
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
199
203
  }, childProps === null || childProps === void 0 ? void 0 : childProps[0])), (0, _jsxRuntime.jsx)(_antd.Input, {
@@ -214,6 +218,9 @@ var ProNumberRange = function ProNumberRange(props) {
214
218
  },
215
219
  addonAfter: addonAfter
216
220
  }, valueProps), {}, {
221
+ style: addonAfter ? {
222
+ width: "calc(50% - ".concat(16 - addonAfterDomWidth / 2, "px)")
223
+ } : null,
217
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,
218
225
  max: max !== null && max !== void 0 ? max : (_valueProps4 = valueProps) === null || _valueProps4 === void 0 ? void 0 : _valueProps4.max
219
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 {
@@ -10,6 +10,7 @@ interface Props {
10
10
  diffConfig?: DiffConfigProps;
11
11
  form: FormInstance;
12
12
  equalWith?: DiffOriginalParams['equalWith'];
13
+ valuePropName?: string;
13
14
  [name: string]: any;
14
15
  }
15
16
  declare const ChangedWrapper: React.FC<Props>;
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  var _antd = require("antd");
@@ -18,7 +19,7 @@ var _ProConfigProvider = require("../../../ProConfigProvider");
18
19
  var _utils = require("../../../utils");
19
20
  var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName"];
20
21
  var ChangedWrapper = function ChangedWrapper(props) {
21
- var _diffConfig$toolTip;
22
+ var _diffConfig$toolTip, _children$props, _children$props2, _children$props3;
22
23
  var name = props.name,
23
24
  names = props.names,
24
25
  namesStr = props.namesStr,
@@ -36,7 +37,6 @@ var ChangedWrapper = function ChangedWrapper(props) {
36
37
  changeTipColor = diffConfig.changeTipColor,
37
38
  addTipColor = diffConfig.addTipColor;
38
39
  var toolTip = (_diffConfig$toolTip = diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
39
- // 不渲染tooltip
40
40
  var isWatch = toolTip && !['FormList', 'ProEditTable'].includes(type);
41
41
  var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
42
42
  return (0, _lodash.get)(originalValues, name);
@@ -56,14 +56,16 @@ var ChangedWrapper = function ChangedWrapper(props) {
56
56
  var isChanged = diffType === 'changed';
57
57
  var tipContent = (0, _react.useMemo)(function () {
58
58
  if (!isWatch || noChange) return undefined;
59
- return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), {}, {
60
- isView: true,
61
- value: originalValue,
62
- checked: type === 'Switch' ? originalValue : undefined
63
- })) : undefined;
59
+ return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), {}, (0, _defineProperty2.default)({
60
+ isView: true
61
+ }, valuePropName, originalValue))) : undefined;
64
62
  }, [originalValue, children]);
65
63
  if (!isWatch || noChange) {
66
- return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest));
64
+ // 嵌套子组件
65
+ var isNestedField = ['ProEditTable'].includes(type);
66
+ return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({
67
+ originalValues: isNestedField ? originalValues : undefined
68
+ }, children.props), rest));
67
69
  }
68
70
  var tipOpenCalc = function tipOpenCalc() {
69
71
  if (!toolTip) return false;
@@ -78,19 +80,33 @@ var ChangedWrapper = function ChangedWrapper(props) {
78
80
  'pro-form-item-changed': isChanged,
79
81
  'pro-form-item-add': isAdd
80
82
  });
83
+ // @ts-ignore
84
+ var _showEllipse = ((_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.showEllipse) || ((_children$props2 = children.props) === null || _children$props2 === void 0 ? void 0 : _children$props2.tooltip);
81
85
  return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
82
86
  open: tipOpenCalc(),
87
+ mouseEnterDelay: 1,
83
88
  getPopupContainer: function getPopupContainer(target) {
84
89
  return target.parentElement;
85
90
  },
86
91
  title: (0, _jsxRuntime.jsxs)(_antd.Space, {
87
- children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
92
+ direction: "vertical",
93
+ children: [(0, _jsxRuntime.jsxs)(_antd.Space, {
94
+ children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
95
+ }), _showEllipse && (0, _jsxRuntime.jsxs)(_antd.Space, {
96
+ children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest), {}, {
97
+ isView: true
98
+ })) : undefined]
99
+ })]
88
100
  }),
89
101
  placement: "topLeft",
90
102
  children: (0, _jsxRuntime.jsx)("div", {
91
103
  className: diffClassName,
92
104
  style: style,
93
- children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest)) : undefined
105
+ children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest), {}, {
106
+ otherProps: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.otherProps), {}, {
107
+ isDiffChange: isChanged
108
+ })
109
+ })) : undefined
94
110
  })
95
111
  });
96
112
  };
@@ -44,6 +44,7 @@ export interface ProFormOtherProps {
44
44
  listName?: any[] | string | number;
45
45
  globalControl?: boolean;
46
46
  formDisabled?: boolean;
47
+ isDiffChange?: boolean;
47
48
  }
48
49
  export interface DiffConfigProps<Values = any> {
49
50
  /** 比对原始数据源 */
@@ -218,7 +218,7 @@
218
218
 
219
219
  .site-input-left,
220
220
  .site-input-right {
221
- width: calc(50% - 20px);
221
+ width: calc(50% - 16px);
222
222
  }
223
223
 
224
224
  .site-input-left {