@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
@@ -17,6 +17,7 @@ var _react = require("react");
17
17
  var _lodash = require("lodash");
18
18
  var _ProConfigProvider = require("../../../ProConfigProvider");
19
19
  var _Container = _interopRequireDefault(require("../../../ProForm/components/Container"));
20
+ var _AdaptiveTooltip = _interopRequireDefault(require("../AdaptiveTooltip"));
20
21
  var _excluded = ["disabled", "code", "dataSource", "defaultDisableValue", "onChange", "useRequest", "transformResponse", "fieldNames", "tooltip", "showSearch", "filterTreeNode", "treeNodeFilterProp", "defaultExpandAll", "expandedKeys", "treeCheckable", "onSearch", "otherProps", "width", "dropdownStyle", "popupClassName", "style", "allowClear", "listHeight", "showCodeName", "className", "checkStrictly", "checkable"],
21
22
  _excluded2 = ["children"];
22
23
  /* eslint-disable react/no-danger */
@@ -74,9 +75,14 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
74
75
  selectProps = (0, _objectWithoutProperties2.default)(props, _excluded);
75
76
  var _props$value = props.value,
76
77
  value = _props$value === void 0 ? undefined : _props$value;
77
- var _ref2 = otherProps || {},
78
- isView = _ref2.isView,
79
- viewEmpty = _ref2.viewEmpty;
78
+ var _props$showEllipse = props.showEllipse,
79
+ showEllipse = _props$showEllipse === void 0 ? true : _props$showEllipse;
80
+ var _ref2 = otherProps !== null && otherProps !== void 0 ? otherProps : {},
81
+ isDiffChange = _ref2.isDiffChange;
82
+ var _showEllipse = showEllipse && !isDiffChange;
83
+ var _ref3 = otherProps || {},
84
+ isView = _ref3.isView,
85
+ viewEmpty = _ref3.viewEmpty;
80
86
  if (fieldNames && Object.keys(fieldNames).length) {
81
87
  code = fieldNames.value || 'value';
82
88
  label = fieldNames.label || 'label';
@@ -209,8 +215,8 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
209
215
  return undefined;
210
216
  }
211
217
  // 如果配置手动加载,不执行请求
212
- var _ref3 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
213
- defaultParams = _ref3.defaultParams;
218
+ var _ref4 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
219
+ defaultParams = _ref4.defaultParams;
214
220
  // 执行用户配置的枚举服务,拉取枚举数据进行更新
215
221
  fetchFunction.run(defaultParams);
216
222
  }, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, defaultDisableValue]);
@@ -312,6 +318,20 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
312
318
  children: (0, _jsxRuntime.jsx)(Icon, {})
313
319
  }) : null]
314
320
  });
321
+ if (_showEllipse) {
322
+ title = (0, _jsxRuntime.jsx)(_AdaptiveTooltip.default, {
323
+ children: treeCheckable ? titleHtml : (0, _jsxRuntime.jsxs)("span", {
324
+ className: "check-option-text",
325
+ children: [(0, _jsxRuntime.jsx)("span", {
326
+ className: "check-option-text-content",
327
+ children: titleHtml
328
+ }), !disabled ? (0, _jsxRuntime.jsx)("span", {
329
+ className: "check-mark-icon",
330
+ children: (0, _jsxRuntime.jsx)(Icon, {})
331
+ }) : null]
332
+ })
333
+ });
334
+ }
315
335
  if (!children) {
316
336
  return (0, _jsxRuntime.jsx)(_antd.TreeSelect.TreeNode, {
317
337
  value: value,
@@ -73,6 +73,8 @@ export interface PropTreeSelectProps extends Omit<TreeSelectProps, 'onSearch'> {
73
73
  expandedKeys?: any[];
74
74
  checkStrictly?: boolean;
75
75
  checkable?: boolean;
76
+ showEllipse?: boolean;
77
+ isDiffChange?: boolean;
76
78
  }
77
79
  export interface ProSelectAction {
78
80
  /** 获取发生请求的 useRequest 的 ref */
@@ -70,7 +70,7 @@
70
70
  }
71
71
  }
72
72
  .@{ant-prefix}-select-tree-treenode:hover{
73
- background-color: #f5f5f5;
73
+ background-color: var(--zaui-disabled-bg);
74
74
  }
75
75
  .check-option-text{
76
76
  .check-mark-icon{
@@ -90,7 +90,7 @@
90
90
  padding-left: 7px;
91
91
  }
92
92
  .@{ant-prefix}-select-tree-treenode:hover{
93
- background-color: #f5f5f5;
93
+ background-color: var(--zaui-disabled-bg);;
94
94
  }
95
95
  .@{ant-prefix}-select-tree-node-content-wrapper{
96
96
  padding-right: var(--zaui-space-size-md);
@@ -1,9 +1,11 @@
1
1
  /// <reference types="react" />
2
+ import { ProFormOtherProps } from '../../ProForm/propsType';
2
3
  declare function SearchTitle(props: {
3
4
  searchStr?: string;
4
5
  label?: string;
5
6
  showEllipse?: boolean;
6
7
  ellipseWidth?: string;
8
+ otherProps?: ProFormOtherProps;
7
9
  }): import("react/jsx-runtime").JSX.Element;
8
10
  declare const _default: import("react").MemoExoticComponent<typeof SearchTitle>;
9
11
  export default _default;
@@ -1,18 +1,32 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
7
8
  var _jsxRuntime = require("react/jsx-runtime");
8
9
  var _react = require("react");
9
- var _antd = require("antd");
10
+ var _AdaptiveTooltip = _interopRequireDefault(require("./AdaptiveTooltip"));
11
+ /*
12
+ * @Author: za-xuwenli xuwenli@zhongan.io
13
+ * @Date: 2024-09-26 14:37:00
14
+ * @LastEditors: za-xuwenli xuwenli@zhongan.io
15
+ * @LastEditTime: 2024-09-26 17:50:59
16
+ * @FilePath: /za-material-warehouse/src/ProTree/components/SearchTitle.tsx
17
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
18
+ */
19
+
10
20
  function SearchTitle(props) {
11
21
  var label = props.label,
12
22
  _props$searchStr = props.searchStr,
13
23
  searchStr = _props$searchStr === void 0 ? '' : _props$searchStr,
14
24
  showEllipse = props.showEllipse,
15
- ellipseWidth = props.ellipseWidth;
25
+ ellipseWidth = props.ellipseWidth,
26
+ otherProps = props.otherProps;
27
+ var _ref = otherProps !== null && otherProps !== void 0 ? otherProps : {},
28
+ _ref$isDiffChange = _ref.isDiffChange,
29
+ isDiffChange = _ref$isDiffChange === void 0 ? false : _ref$isDiffChange;
16
30
  var strTitle = label;
17
31
  var index = strTitle === null || strTitle === void 0 ? void 0 : strTitle.indexOf(searchStr);
18
32
  var beforeStr = strTitle === null || strTitle === void 0 ? void 0 : strTitle.substring(0, index);
@@ -45,11 +59,9 @@ function SearchTitle(props) {
45
59
  style: style,
46
60
  children: strTitle
47
61
  });
48
- if (classEllipse) {
49
- return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
50
- title: titleTips,
51
- placement: "rightTop",
52
- children: title
62
+ if (classEllipse && !isDiffChange) {
63
+ return (0, _jsxRuntime.jsx)(_AdaptiveTooltip.default, {
64
+ children: titleTips
53
65
  });
54
66
  }
55
67
  return title;
@@ -1,6 +1,15 @@
1
1
  @root-entry-name: 'default';
2
2
  @import (reference) '~antd/es/style/themes/index.less';
3
3
 
4
+ .pro-tree-wrap-ellipse {
5
+ display: block;
6
+ width: 100%;
7
+ overflow: hidden;
8
+ white-space: nowrap;
9
+ text-overflow: ellipsis;
10
+ word-break: keep-all;
11
+ }
12
+
4
13
  .pro-tree {
5
14
  height: 100%; // tree auto css
6
15
  .@{ant-prefix}-tree-iconEle{
@@ -368,3 +377,8 @@
368
377
  }
369
378
 
370
379
 
380
+ .@{ant-prefix}-select-tree-node-content-wrapper {
381
+ &:has(.pro-tree-wrap-ellipse){
382
+ overflow: hidden;
383
+ }
384
+ }
@@ -183,23 +183,21 @@ function List(props, ref) {
183
183
  setAutoExpandParent(false);
184
184
  };
185
185
  if (mode === 'render') {
186
- return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
187
- children: (0, _jsxRuntime.jsx)(_antd.Tree, {
188
- disabled: disabled,
189
- style: {
190
- width: '100%'
191
- },
192
- checkable: true,
193
- treeData: _treeData,
194
- onExpand: onExpand,
195
- expandedKeys: expandedKeys,
196
- autoExpandParent: autoExpandParent,
197
- selectable: false,
198
- onCheck: onCheck,
199
- checkedKeys: checkedValues,
200
- checkStrictly: checkStrictly,
201
- height: 432
202
- })
186
+ return (0, _jsxRuntime.jsx)(_antd.Tree, {
187
+ disabled: disabled,
188
+ style: {
189
+ width: '100%'
190
+ },
191
+ checkable: true,
192
+ treeData: _treeData,
193
+ onExpand: onExpand,
194
+ expandedKeys: expandedKeys,
195
+ autoExpandParent: autoExpandParent,
196
+ selectable: false,
197
+ onCheck: onCheck,
198
+ checkedKeys: checkedValues,
199
+ checkStrictly: searchStr ? true : checkStrictly,
200
+ height: 432
203
201
  });
204
202
  }
205
203
  return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
@@ -20,6 +20,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
20
20
  var _index = require("../index");
21
21
  var _components = require("./components");
22
22
  var _utils = require("./utils");
23
+ var _index2 = require("../ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index");
23
24
  var _inputSearch = _interopRequireDefault(require("../assets/input-search.svg"));
24
25
  var _locale = _interopRequireWildcard(require("../locale"));
25
26
  require("./style/index.less");
@@ -27,7 +28,7 @@ require("./style/index.less");
27
28
  * @Author: za-xuwenli xuwenli@zhongan.io
28
29
  * @Date: 2024-06-04 10:01:18
29
30
  * @LastEditors: za-xuwenli xuwenli@zhongan.io
30
- * @LastEditTime: 2024-06-25 17:56:33
31
+ * @LastEditTime: 2024-09-27 11:49:28
31
32
  * @FilePath: /za-material-warehouse/src/ProTreeModal/index.tsx
32
33
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
33
34
  */
@@ -100,7 +101,8 @@ var ProTreeModal = function ProTreeModal(props) {
100
101
  flatTreeData: [],
101
102
  searchStr: '',
102
103
  checkAll: false,
103
- allKeys: []
104
+ allKeys: [],
105
+ transformedTree: []
104
106
  }),
105
107
  _useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
106
108
  state = _useSetState2[0],
@@ -222,6 +224,12 @@ var ProTreeModal = function ProTreeModal(props) {
222
224
  });
223
225
  }
224
226
  }, [value, state.allKeys, state.open]);
227
+ (0, _ahooks.useDeepCompareEffect)(function () {
228
+ var transformedTree = (0, _utils.addLevelAndParentId)(state.treeData, fieldNames);
229
+ setState({
230
+ transformedTree: transformedTree
231
+ });
232
+ }, [state.treeData]);
225
233
  var handleClick = function handleClick() {
226
234
  setState({
227
235
  open: true
@@ -362,8 +370,55 @@ var ProTreeModal = function ProTreeModal(props) {
362
370
  var onCheck = function onCheck(checkedKeys, info) {
363
371
  var checkedValues = (0, _toConsumableArray2.default)(state.checkedValues);
364
372
  var originalTreeData = state.originalTreeData;
373
+ // 如果有检索则自管理
374
+ if (state.searchStr) {
375
+ var _transformTreeToArray;
376
+ var node = info.node;
377
+ // 从完整树中找到当前节点
378
+ var activeNode = (0, _index2.treeNodeFind)(state.transformedTree, function (t) {
379
+ return t[fieldNameValue] === node[fieldNameValue];
380
+ }, {
381
+ childrenKey: fieldNames.children
382
+ });
383
+ var allChildren = (_transformTreeToArray = (0, _index2.transformTreeToArray)([activeNode], {
384
+ childrenKey: fieldNames.children
385
+ })) === null || _transformTreeToArray === void 0 ? void 0 : _transformTreeToArray.map(function (item) {
386
+ return item[fieldNameValue];
387
+ });
388
+ // 子项合并勾选
389
+ checkedValues = checkedValues.concat(allChildren);
390
+ // 从完整树中拿到父节点 只要存在父节点,那么就判断当前children是否全被勾选 若全被勾选就合并当前key到勾选队列
391
+ var _recourse2 = function _recourse(findNode) {
392
+ if (findNode.parentId) {
393
+ var _transformTreeToArray2;
394
+ var parentNode = (0, _index2.treeNodeFind)(state.transformedTree, function (t) {
395
+ return t[fieldNameValue] === findNode.parentId;
396
+ }, {
397
+ childrenKey: fieldNames.children
398
+ });
399
+ var parentChildrenKeys = (_transformTreeToArray2 = (0, _index2.transformTreeToArray)([parentNode], {
400
+ childrenKey: fieldNames.children
401
+ })) === null || _transformTreeToArray2 === void 0 ? void 0 : _transformTreeToArray2.map(function (item) {
402
+ return item[fieldNameValue];
403
+ });
404
+ var parentChildrenAllChecked = parentChildrenKeys.every(function (key) {
405
+ return checkedValues.includes(key);
406
+ });
407
+ if (parentChildrenAllChecked) {
408
+ // 把当前父节点追加进来
409
+ checkedValues = checkedValues.concat([parentNode[fieldNameValue]]);
410
+ // 继续向上查找
411
+ if (parentNode.parentId) {
412
+ _recourse2(parentNode);
413
+ }
414
+ }
415
+ }
416
+ };
417
+ _recourse2(activeNode);
418
+ }
419
+ var _checkStrictly = state.searchStr ? true : checkStrictly;
365
420
  // 此时应该取消掉自身并包含它所有的子集
366
- if (!info.checked && !checkStrictly) {
421
+ if (!info.checked && !_checkStrictly) {
367
422
  // 1. 取消自身
368
423
  // 2. 把所有的子节点也要取消
369
424
  var childrenkeys = [];
@@ -380,8 +435,8 @@ var ProTreeModal = function ProTreeModal(props) {
380
435
  return !parentKeys.includes(key);
381
436
  });
382
437
  } else {
383
- // checkStrictly 模式下取 checkedKeys.checked 或者自身的 key
384
- if (checkStrictly) {
438
+ // _checkStrictly 模式下取 checkedKeys.checked 或者自身的 key
439
+ if (_checkStrictly) {
385
440
  if (!info.checked) {
386
441
  checkedValues = checkedValues.filter(function (key) {
387
442
  return key !== info.node.key;
@@ -620,7 +675,7 @@ var ProTreeModal = function ProTreeModal(props) {
620
675
  });
621
676
  case TREE:
622
677
  return (0, _jsxRuntime.jsx)(_components.TreeView, {
623
- treeData: state.treeData,
678
+ treeData: state.transformedTree,
624
679
  originalTreeData: state.originalTreeData,
625
680
  flatTreeData: state.flatTreeData,
626
681
  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[];
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ exports.addLevelAndParentId = void 0;
7
8
  exports.filterCheckedNodes = filterCheckedNodes;
8
9
  exports.findTreeNodeByKey = findTreeNodeByKey;
9
10
  exports.getAllKeys = getAllKeys;
@@ -209,4 +210,23 @@ var transformMessage = exports.transformMessage = function transformMessage(obj,
209
210
  _message = message.replaceAll("{".concat(key, "}"), obj[key]);
210
211
  });
211
212
  return _message;
213
+ };
214
+ var _addLevelAndParentId = exports.addLevelAndParentId = function addLevelAndParentId() {
215
+ var tree = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
216
+ var fieldNames = arguments.length > 1 ? arguments[1] : undefined;
217
+ var currentLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
218
+ var currentParentId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
219
+ var _fieldNames$children = fieldNames.children,
220
+ children = _fieldNames$children === void 0 ? 'children' : _fieldNames$children,
221
+ _fieldNames$value = fieldNames.value,
222
+ value = _fieldNames$value === void 0 ? 'value' : _fieldNames$value;
223
+ return tree.map(function (node) {
224
+ var newNode = (0, _objectSpread4.default)({}, node);
225
+ newNode.level = currentLevel;
226
+ newNode.parentId = currentParentId;
227
+ if (node[children]) {
228
+ newNode[children] = _addLevelAndParentId(node[children], fieldNames, currentLevel + 1, newNode[value]);
229
+ }
230
+ return newNode;
231
+ });
212
232
  };
@@ -749,3 +749,8 @@
749
749
  }
750
750
  }
751
751
  }
752
+
753
+ .@{ant-prefix}-picker.@{ant-prefix}-picker-disabled {
754
+ background: var(--zaui-disabled-bg);
755
+ }
756
+
@@ -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;
@@ -55,6 +55,7 @@
55
55
  --zaui-table-selected-hover-bg : var(--zaui-table-hover-bg); // 默认同悬停
56
56
  --zaui-table-nested-bg : #fafcfe;
57
57
  --zaui-contract-bg : #fffaa1; // 对比背景色
58
+ --zaui-contract-bg-add : #d2fff4; // 新增对比背景色
58
59
  --zaui-form-label-width : 130px; // 8个全角字符宽度
59
60
  --zaui-border-radius : 8px;
60
61
  --zaui-border-radius-card : 4px;
@@ -53,6 +53,7 @@
53
53
  @zaui-table-selected-hover-bg: var(--zaui-table-hover-bg #fafafa);
54
54
  @zaui-table-nested-bg: var(--zaui-table-nested-bg #FAFCFE);
55
55
  @zaui-contract-bg: var(--zaui-contract-bg; #fffaa1); // 对比背景色
56
+ @zaui-contract-bg-add: var(--zaui-contract-bg-add; #d2fff4); // 新增对比背景色
56
57
  @zaui-form-required-after: var(--zaui-form-required-after; inline);
57
58
  @zaui-form-required-before: var(--zaui-form-required-before; none);
58
59
  @zaui-form-label-width: var(--zaui-form-label-width; 130px);
@@ -0,0 +1,2 @@
1
+ /** 判断一个值是否是空值 */
2
+ export declare const isEmpty: (value: any) => boolean;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isEmpty = void 0;
7
+ var EMPTY_VALUE = [undefined, null, ''];
8
+ /** 判断一个值是否是空值 */
9
+ var isEmpty = exports.isEmpty = function isEmpty(value) {
10
+ if (EMPTY_VALUE.includes(value)) {
11
+ return true;
12
+ }
13
+ if (Array.isArray(value)) {
14
+ return !(value === null || value === void 0 ? void 0 : value.length) || value.every(function (item) {
15
+ return EMPTY_VALUE.includes(item);
16
+ });
17
+ }
18
+ return false;
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.7.3",
3
+ "version": "3.8.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -102,6 +102,7 @@
102
102
  "eslint": "7.10.0",
103
103
  "eslint-config-za": "2.1.0",
104
104
  "eslint-plugin-babel": "5.3.0",
105
+ "eslint-plugin-complexity": "^1.0.2",
105
106
  "eslint-plugin-import": "^2.22.1",
106
107
  "eslint-plugin-jsx-a11y": "6.2.3",
107
108
  "eslint-plugin-react": "7.16.0",
@@ -1,14 +0,0 @@
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;
@@ -1,64 +0,0 @@
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,14 +0,0 @@
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;
@@ -1,69 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
- var _jsxRuntime = require("react/jsx-runtime");
12
- var _antd = require("antd");
13
- var _lodash = require("lodash");
14
- var _react = _interopRequireWildcard(require("react"));
15
- var _diffOriginal = require("../../utils/diffOriginal");
16
- var _excluded = ["name", "names", "namesStr", "originalValues", "form", "equalWith", "children", "type", "originalDiffTip"];
17
- var Changed = function Changed(props) {
18
- var name = props.name,
19
- names = props.names,
20
- namesStr = props.namesStr,
21
- originalValues = props.originalValues,
22
- form = props.form,
23
- equalWith = props.equalWith,
24
- children = props.children,
25
- type = props.type,
26
- originalDiffTip = props.originalDiffTip,
27
- rest = (0, _objectWithoutProperties2.default)(props, _excluded);
28
- // 不渲染tooltip
29
- var notWatch = !originalDiffTip || ['FormList', 'ProEditTable'].includes(type);
30
- var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
31
- return (0, _lodash.get)(originalValues, name);
32
- }) : (0, _lodash.get)(originalValues, name);
33
- var noChange = !equalWith && (!originalValues || originalValue === undefined);
34
- var changed = (0, _react.useMemo)(function () {
35
- if (notWatch || noChange) return false;
36
- return (0, _diffOriginal.diffOriginal)({
37
- originalValue: originalValue,
38
- value: props.value,
39
- form: form,
40
- equalWith: equalWith
41
- // name: namesStr || name,
42
- });
43
- }, [notWatch, noChange, props.value, originalValue]);
44
- var tipContent = (0, _react.useMemo)(function () {
45
- if (notWatch || noChange) return undefined;
46
- return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), {}, {
47
- isView: true,
48
- value: originalValue,
49
- checked: type === 'Switch' ? originalValue : undefined
50
- })) : undefined;
51
- }, [originalValue, children]);
52
- if (notWatch || noChange) {
53
- return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest));
54
- }
55
- return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
56
- open: changed ? undefined : false,
57
- getPopupContainer: function getPopupContainer(target) {
58
- return target.parentElement;
59
- },
60
- title: (0, _jsxRuntime.jsxs)(_antd.Space, {
61
- children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
62
- }),
63
- children: (0, _jsxRuntime.jsx)("div", {
64
- className: changed ? 'pro-form-item-changed' : '',
65
- children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest)) : undefined
66
- })
67
- });
68
- };
69
- var _default = exports.default = Changed;