@zat-design/sisyphus-react 3.7.3-beta.15 → 3.7.3-beta.17

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 (60) hide show
  1. package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
  2. package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
  3. package/coverage/lcov-report/src/.umi/core/index.html +206 -0
  4. package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
  5. package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
  6. package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
  7. package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
  8. package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
  9. package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
  10. package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
  11. package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
  12. package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
  13. package/coverage/lcov-report/src/.umi/index.html +116 -0
  14. package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
  15. package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
  16. package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
  17. package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
  18. package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
  19. package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
  20. package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
  21. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
  22. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
  23. package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
  24. package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
  25. package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
  26. package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
  27. package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
  28. package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
  29. package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
  30. package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
  31. package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
  32. package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
  33. package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
  34. package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
  35. package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
  36. package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
  37. package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
  38. package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
  39. package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
  40. package/es/ProForm/components/render/ChangedWrapper.js +21 -8
  41. package/es/ProForm/propsType.d.ts +1 -0
  42. package/es/ProSelect/index.js +4 -3
  43. package/es/ProTree/components/ProTreeSelect/index.js +8 -8
  44. package/es/ProTree/components/SearchTitle.d.ts +2 -1
  45. package/es/ProTree/components/SearchTitle.js +12 -2
  46. package/es/ProTreeModal/components/Tree.js +15 -17
  47. package/es/ProTreeModal/index.js +62 -7
  48. package/es/ProTreeModal/utils.d.ts +1 -0
  49. package/es/ProTreeModal/utils.js +21 -1
  50. package/lib/ProForm/components/render/ChangedWrapper.js +23 -10
  51. package/lib/ProForm/propsType.d.ts +1 -0
  52. package/lib/ProSelect/index.js +4 -3
  53. package/lib/ProTree/components/ProTreeSelect/index.js +8 -8
  54. package/lib/ProTree/components/SearchTitle.d.ts +2 -1
  55. package/lib/ProTree/components/SearchTitle.js +13 -2
  56. package/lib/ProTreeModal/components/Tree.js +15 -17
  57. package/lib/ProTreeModal/index.js +61 -6
  58. package/lib/ProTreeModal/utils.d.ts +1 -0
  59. package/lib/ProTreeModal/utils.js +20 -0
  60. package/package.json +1 -1
@@ -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,
@@ -56,14 +57,12 @@ var ChangedWrapper = function ChangedWrapper(props) {
56
57
  var isChanged = diffType === 'changed';
57
58
  var tipContent = (0, _react.useMemo)(function () {
58
59
  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;
60
+ return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), {}, (0, _defineProperty2.default)({
61
+ isView: true
62
+ }, valuePropName, originalValue))) : undefined;
64
63
  }, [originalValue, children]);
65
64
  if (!isWatch || noChange) {
66
- return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest));
65
+ return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest));
67
66
  }
68
67
  var tipOpenCalc = function tipOpenCalc() {
69
68
  if (!toolTip) return false;
@@ -78,19 +77,33 @@ var ChangedWrapper = function ChangedWrapper(props) {
78
77
  'pro-form-item-changed': isChanged,
79
78
  'pro-form-item-add': isAdd
80
79
  });
80
+ // @ts-ignore
81
+ 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
82
  return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
82
83
  open: tipOpenCalc(),
84
+ mouseEnterDelay: 1,
83
85
  getPopupContainer: function getPopupContainer(target) {
84
86
  return target.parentElement;
85
87
  },
86
88
  title: (0, _jsxRuntime.jsxs)(_antd.Space, {
87
- children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
89
+ direction: "vertical",
90
+ children: [(0, _jsxRuntime.jsxs)(_antd.Space, {
91
+ children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
92
+ }), _showEllipse && (0, _jsxRuntime.jsxs)(_antd.Space, {
93
+ 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), {}, {
94
+ isView: true
95
+ })) : undefined]
96
+ })]
88
97
  }),
89
98
  placement: "topLeft",
90
99
  children: (0, _jsxRuntime.jsx)("div", {
91
100
  className: diffClassName,
92
101
  style: style,
93
- children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest)) : undefined
102
+ children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread3.default)((0, _objectSpread3.default)((0, _objectSpread3.default)({}, children.props), rest), {}, {
103
+ otherProps: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, (_children$props3 = children.props) === null || _children$props3 === void 0 ? void 0 : _children$props3.otherProps), {}, {
104
+ isDiffChange: isChanged
105
+ })
106
+ })) : undefined
94
107
  })
95
108
  });
96
109
  };
@@ -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
  /** 比对原始数据源 */
@@ -25,6 +25,7 @@ var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames"
25
25
  var Option = _antd.Select.Option;
26
26
  var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
27
27
  var _selectProps$showCode, _locale$ProSelect;
28
+ console.log('props11: ', props);
28
29
  var _ref = (0, _ProConfigProvider.useProConfig)('ProSelect') || {},
29
30
  _ref$fieldNames = _ref.fieldNames,
30
31
  proSelectFieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames,
@@ -297,7 +298,8 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
297
298
  showArrow: true,
298
299
  loading: fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.loading,
299
300
  onChange: handleChange,
300
- optionLabelProp: "children" // 解决warning报错,添加默认值
301
+ // optionLabelProp={otherProps?.isDiffChange ? "label" : 'children'} // 解决warning报错,添加默认值
302
+ optionLabelProp: "label" // 解决warning报错,添加默认值
301
303
  ,
302
304
  showSearch: true,
303
305
  filterOption: (0, _lodash.isFunction)(_onSearch) ? false : function (input, option) {
@@ -315,16 +317,15 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
315
317
  value: transformValue(),
316
318
  children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
317
319
  return (0, _jsxRuntime.jsx)(Option, {
320
+ label: item[label],
318
321
  value: item[code],
319
322
  record: item,
320
323
  disabled: !!item.disabled,
321
324
  children: (0, _jsxRuntime.jsx)(TooltipOption, {
322
325
  title: OptionRender ? OptionRender(item) : selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
323
326
  children: OptionRender ? (0, _jsxRuntime.jsx)("span", {
324
- title: OptionRender(item),
325
327
  children: OptionRender(item)
326
328
  }) : (0, _jsxRuntime.jsx)("span", {
327
- title: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
328
329
  children: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label]
329
330
  })
330
331
  }, item[code])
@@ -76,13 +76,13 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
76
76
  var _props$value = props.value,
77
77
  value = _props$value === void 0 ? undefined : _props$value;
78
78
  var _props$showEllipse = props.showEllipse,
79
- showEllipse = _props$showEllipse === void 0 ? true : _props$showEllipse,
80
- _props$isDiffChange = props.isDiffChange,
81
- isDiffChange = _props$isDiffChange === void 0 ? false : _props$isDiffChange;
79
+ showEllipse = _props$showEllipse === void 0 ? true : _props$showEllipse;
80
+ var _ref2 = otherProps !== null && otherProps !== void 0 ? otherProps : {},
81
+ isDiffChange = _ref2.isDiffChange;
82
82
  var _showEllipse = showEllipse && !isDiffChange;
83
- var _ref2 = otherProps || {},
84
- isView = _ref2.isView,
85
- viewEmpty = _ref2.viewEmpty;
83
+ var _ref3 = otherProps || {},
84
+ isView = _ref3.isView,
85
+ viewEmpty = _ref3.viewEmpty;
86
86
  if (fieldNames && Object.keys(fieldNames).length) {
87
87
  code = fieldNames.value || 'value';
88
88
  label = fieldNames.label || 'label';
@@ -215,8 +215,8 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
215
215
  return undefined;
216
216
  }
217
217
  // 如果配置手动加载,不执行请求
218
- var _ref3 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
219
- defaultParams = _ref3.defaultParams;
218
+ var _ref4 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
219
+ defaultParams = _ref4.defaultParams;
220
220
  // 执行用户配置的枚举服务,拉取枚举数据进行更新
221
221
  fetchFunction.run(defaultParams);
222
222
  }, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, defaultDisableValue]);
@@ -1,10 +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;
7
- isDiffChange?: boolean;
8
+ otherProps?: ProFormOtherProps;
8
9
  }): import("react/jsx-runtime").JSX.Element;
9
10
  declare const _default: import("react").MemoExoticComponent<typeof SearchTitle>;
10
11
  export default _default;
@@ -8,14 +8,25 @@ exports.default = void 0;
8
8
  var _jsxRuntime = require("react/jsx-runtime");
9
9
  var _react = require("react");
10
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
+
11
20
  function SearchTitle(props) {
12
21
  var label = props.label,
13
22
  _props$searchStr = props.searchStr,
14
23
  searchStr = _props$searchStr === void 0 ? '' : _props$searchStr,
15
24
  showEllipse = props.showEllipse,
16
25
  ellipseWidth = props.ellipseWidth,
17
- _props$isDiffChange = props.isDiffChange,
18
- isDiffChange = _props$isDiffChange === void 0 ? false : _props$isDiffChange;
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;
19
30
  var strTitle = label;
20
31
  var index = strTitle === null || strTitle === void 0 ? void 0 : strTitle.indexOf(searchStr);
21
32
  var beforeStr = strTitle === null || strTitle === void 0 ? void 0 : strTitle.substring(0, index);
@@ -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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.7.3-beta.15",
3
+ "version": "3.7.3-beta.17",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",