@para-ui/core 4.0.15 → 4.0.16

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 (95) hide show
  1. package/Cascader/index.js +7 -6
  2. package/ComboSelect/index.js +7 -3
  3. package/CycleSelector/index.js +1 -2
  4. package/DatePicker/index.js +1 -2
  5. package/DynamicMultiBox/index.js +8 -5
  6. package/Form/index.js +8 -4
  7. package/FormItem/index.js +8 -4
  8. package/FunctionModal/index.js +2 -2
  9. package/PopMenu/context.d.ts +33 -0
  10. package/PopMenu/hooks.d.ts +5 -0
  11. package/PopMenu/index.d.ts +5 -0
  12. package/PopMenu/index.js +288 -0
  13. package/PopMenu/interface.d.ts +61 -0
  14. package/PopMenu/item.d.ts +4 -0
  15. package/PopMenu/list.d.ts +4 -0
  16. package/Popover/index.js +10 -1
  17. package/QuickReply/index.js +1 -1
  18. package/README.md +4 -0
  19. package/Selector/index.js +4 -326
  20. package/SelectorPicker/index.js +4 -2
  21. package/TimePicker/index.js +1 -2
  22. package/Tooltip/index.js +7 -3
  23. package/Tooltip/interface.d.ts +2 -0
  24. package/Tree/index.js +8 -4
  25. package/Upload/index.js +2 -1
  26. package/_verture/{defineProperty-1d116156.js → defineProperty-51493dbe.js} +10 -2
  27. package/_verture/{index-79cebfc8.js → index-06069532.js} +1 -1
  28. package/_verture/{index-767e63dd.js → index-0ad6af26.js} +394 -313
  29. package/_verture/index-287ae1b3.js +327 -0
  30. package/_verture/{index-9784b09c.js → index-782e05bf.js} +5 -20
  31. package/_verture/{slicedToArray-8223a2ef.js → slicedToArray-a8206399.js} +2 -15
  32. package/_verture/toConsumableArray-8f4c9589.js +19 -0
  33. package/_verture/unsupportedIterableToArray-cb478f24.js +16 -0
  34. package/index.d.ts +2 -0
  35. package/index.js +12 -9
  36. package/package.json +1 -1
  37. package/umd/AutoBox.js +1 -1
  38. package/umd/AutoTips.js +1 -1
  39. package/umd/Breadcrumbs.js +1 -1
  40. package/umd/Button.js +1 -1
  41. package/umd/ButtonGroup.js +1 -1
  42. package/umd/Cascader.js +1 -1
  43. package/umd/Checkbox.js +1 -1
  44. package/umd/CheckboxGroup.js +1 -1
  45. package/umd/ComboSelect.js +1 -1
  46. package/umd/CopyText.js +1 -1
  47. package/umd/CycleSelector.js +1 -1
  48. package/umd/DatePicker.js +1 -1
  49. package/umd/Descriptions.js +1 -1
  50. package/umd/Desktop.js +1 -1
  51. package/umd/Drawer.js +1 -1
  52. package/umd/DynamicMultiBox.js +1 -1
  53. package/umd/Form.js +1 -1
  54. package/umd/FormItem.js +1 -1
  55. package/umd/FunctionModal.js +1 -1
  56. package/umd/Help.js +1 -1
  57. package/umd/InputLang.js +1 -1
  58. package/umd/InputNumber.js +1 -1
  59. package/umd/Label.js +1 -1
  60. package/umd/Menu.js +1 -1
  61. package/umd/Modal.js +1 -1
  62. package/umd/MultiBox.js +1 -1
  63. package/umd/OperateBtn.js +1 -1
  64. package/umd/PageHeader.js +1 -1
  65. package/umd/Pagination.js +1 -1
  66. package/umd/PopConfirm.js +1 -1
  67. package/umd/PopMenu.js +43 -0
  68. package/umd/Popover.js +1 -1
  69. package/umd/QuickReply.js +1 -1
  70. package/umd/Radio.js +1 -1
  71. package/umd/RadioGroup.js +1 -1
  72. package/umd/Search.js +1 -1
  73. package/umd/Select.js +1 -1
  74. package/umd/SelectInput.js +1 -1
  75. package/umd/Selector.js +1 -1
  76. package/umd/SelectorPicker.js +1 -1
  77. package/umd/SingleBox.js +1 -1
  78. package/umd/Stepper.js +1 -1
  79. package/umd/Switch.js +1 -1
  80. package/umd/Table.js +1 -1
  81. package/umd/Tabs.js +1 -1
  82. package/umd/Tag.js +1 -1
  83. package/umd/TextEditor.js +1 -1
  84. package/umd/TextField.js +1 -1
  85. package/umd/TimePicker.js +1 -1
  86. package/umd/Title.js +1 -1
  87. package/umd/ToggleButton.js +1 -1
  88. package/umd/Tooltip.js +1 -1
  89. package/umd/Transfer.js +1 -1
  90. package/umd/Tree.js +1 -1
  91. package/umd/Upload.js +1 -1
  92. package/_verture/typeof-adeedc13.js +0 -11
  93. /package/_verture/{index-28a6bc3a.js → index-9bef932a.js} +0 -0
  94. /package/_verture/{modalContext-7380ea41.js → modalContext-b101ffaa.js} +0 -0
  95. /package/_verture/{typeof-c310ee4a.js → typeof-6ec38efd.js} +0 -0
@@ -1,15 +1,17 @@
1
+ import { _ as _toConsumableArray } from './toConsumableArray-8f4c9589.js';
2
+ import { a as _typeof, _ as _defineProperty } from './defineProperty-51493dbe.js';
3
+ import { _ as _slicedToArray } from './slicedToArray-a8206399.js';
4
+ import { r as regenerator } from './index-287ae1b3.js';
1
5
  import { _ as __rest, a as __awaiter } from './tslib.es6-55ed4bd2.js';
2
6
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
7
  import React__default, { isValidElement, cloneElement, useRef, useState, useImperativeHandle, useEffect, useMemo } from 'react';
4
8
  import RcTree from 'rc-tree';
5
9
  import clsx from 'clsx';
6
- import { _ as _typeof } from './typeof-adeedc13.js';
7
10
  import LoadingOutlined from '@para-ui/icons/LoadingF';
8
11
  import FileOutlined from '@para-ui/icons/Document';
9
12
  import SolidArrowDown from '@para-ui/icons/DownTriangleF';
10
13
  import { Radio } from '../Radio/index.js';
11
14
  import { $ as $prefixCls } from './constant-5317fc89.js';
12
- import { b as _slicedToArray } from './slicedToArray-8223a2ef.js';
13
15
  import ReactDOM from 'react-dom';
14
16
  import EditOutlinedIcon from '@para-ui/icons/EditFile';
15
17
  import AddOutlinedIcon from '@para-ui/icons/PlusCircle';
@@ -563,110 +565,129 @@ var OperateBar = function OperateBar(props) {
563
565
  };
564
566
 
565
567
  //默认分页信息
566
- const defaultPageSize = {
568
+ var defaultPageSize = {
567
569
  page: 1,
568
570
  size: 10
569
571
  };
570
572
  //tree 组件
571
- const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
572
- const {
573
- url,
574
- ctx,
575
- params = null,
576
- method = 'GET',
577
- headers,
578
- requestCallback,
579
- refresh,
580
- replaceFields = {
573
+ var Tree = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
574
+ var url = props.url,
575
+ ctx = props.ctx,
576
+ _props$params = props.params,
577
+ params = _props$params === void 0 ? null : _props$params,
578
+ _props$method = props.method,
579
+ method = _props$method === void 0 ? 'GET' : _props$method,
580
+ headers = props.headers,
581
+ requestCallback = props.requestCallback,
582
+ refresh = props.refresh,
583
+ _props$replaceFields = props.replaceFields,
584
+ replaceFields = _props$replaceFields === void 0 ? {
581
585
  key: 'key',
582
586
  parentId: 'parentId',
583
587
  children: 'children',
584
588
  title: 'title',
585
589
  loadKey: 'key'
586
- },
587
- treeData: originTreeData,
588
- className,
589
- showIcon,
590
- icon,
591
- showLine,
592
- switcherIcon,
593
- blockNode,
594
- checkable,
595
- selectable,
596
- radioable = false,
597
- showRadio = true,
598
- checkStrictly = false,
599
- actionsCallback,
600
- showActions,
601
- checkedKeys,
602
- defaultCheckedKeys,
603
- expandedKeys,
604
- defaultExpandedKeys,
605
- loadedKeys,
606
- onCheck,
607
- onExpand,
608
- asyncLoad = false,
609
- pagination = false,
610
- pageSize = defaultPageSize,
611
- loadData,
612
- localFilter = false,
613
- localParams,
614
- onFilter,
615
- loadMoreNode = null,
616
- paramsCallback,
617
- titleRender,
618
- emptyProps,
619
- emptyClassName,
620
- notFoundContent,
621
- wrapperClassName,
622
- wrapperStyle,
623
- showLoading = true,
624
- loadingNode,
625
- onLoadedKey,
626
- tipMaxWidth = 500
627
- } = props;
628
- const [treeData, setTreeData] = useState([]); //树数据
629
- const [inCheckedKeys, setInCheckedKeys] = useState([]); //选中keys
630
- const [inExpandedKeysKeys, setInExpandedKeys] = useState([]); //展开keys
631
- const opRef = useRef({}); //操作栏
632
- const mouseInSectorRef = useRef(false); //是否鼠标进入扇形
633
- const timeSectorRef = useRef(-1); //定时显示扇形
634
- const nodesRef = useRef([]); //保存节点状态
635
- const prefixCls = "".concat($prefixCls, "-tree"); //tree容器前缀
636
- const treeMapRef = useRef({}); //tree map
637
- const treeOriDataRef = useRef([]); //tree origin data
638
- const nPageSize = Object.assign(Object.assign({}, defaultPageSize), pageSize);
639
- const halfCheckedKeys = useRef([]); //半选keys
640
- const intl = useFormatMessage('Tree', localeJson);
641
- const [loading, setLoading] = useState(false);
642
- const firstRender = useRef(true); //是否第一次渲染
643
- const [inLoadedKeys, setInLoadKeys] = useState([]);
590
+ } : _props$replaceFields,
591
+ originTreeData = props.treeData,
592
+ className = props.className,
593
+ showIcon = props.showIcon,
594
+ _icon = props.icon,
595
+ showLine = props.showLine,
596
+ _switcherIcon = props.switcherIcon,
597
+ blockNode = props.blockNode,
598
+ checkable = props.checkable,
599
+ selectable = props.selectable,
600
+ _props$radioable = props.radioable,
601
+ radioable = _props$radioable === void 0 ? false : _props$radioable,
602
+ _props$showRadio = props.showRadio,
603
+ showRadio = _props$showRadio === void 0 ? true : _props$showRadio,
604
+ _props$checkStrictly = props.checkStrictly,
605
+ checkStrictly = _props$checkStrictly === void 0 ? false : _props$checkStrictly,
606
+ actionsCallback = props.actionsCallback,
607
+ showActions = props.showActions,
608
+ checkedKeys = props.checkedKeys,
609
+ defaultCheckedKeys = props.defaultCheckedKeys,
610
+ expandedKeys = props.expandedKeys,
611
+ defaultExpandedKeys = props.defaultExpandedKeys,
612
+ loadedKeys = props.loadedKeys,
613
+ onCheck = props.onCheck,
614
+ onExpand = props.onExpand,
615
+ _props$asyncLoad = props.asyncLoad,
616
+ asyncLoad = _props$asyncLoad === void 0 ? false : _props$asyncLoad,
617
+ _props$pagination = props.pagination,
618
+ pagination = _props$pagination === void 0 ? false : _props$pagination,
619
+ _props$pageSize = props.pageSize,
620
+ pageSize = _props$pageSize === void 0 ? defaultPageSize : _props$pageSize,
621
+ loadData = props.loadData,
622
+ _props$localFilter = props.localFilter,
623
+ localFilter = _props$localFilter === void 0 ? false : _props$localFilter,
624
+ localParams = props.localParams,
625
+ onFilter = props.onFilter,
626
+ _props$loadMoreNode = props.loadMoreNode,
627
+ loadMoreNode = _props$loadMoreNode === void 0 ? null : _props$loadMoreNode,
628
+ paramsCallback = props.paramsCallback,
629
+ titleRender = props.titleRender,
630
+ emptyProps = props.emptyProps,
631
+ emptyClassName = props.emptyClassName,
632
+ notFoundContent = props.notFoundContent,
633
+ wrapperClassName = props.wrapperClassName,
634
+ wrapperStyle = props.wrapperStyle,
635
+ _props$showLoading = props.showLoading,
636
+ showLoading = _props$showLoading === void 0 ? true : _props$showLoading,
637
+ loadingNode = props.loadingNode,
638
+ onLoadedKey = props.onLoadedKey,
639
+ _props$tipMaxWidth = props.tipMaxWidth,
640
+ tipMaxWidth = _props$tipMaxWidth === void 0 ? 500 : _props$tipMaxWidth;
641
+ var _useState = useState([]),
642
+ _useState2 = _slicedToArray(_useState, 2),
643
+ treeData = _useState2[0],
644
+ setTreeData = _useState2[1]; //树数据
645
+ var _useState3 = useState([]),
646
+ _useState4 = _slicedToArray(_useState3, 2),
647
+ inCheckedKeys = _useState4[0],
648
+ setInCheckedKeys = _useState4[1]; //选中keys
649
+ var _useState5 = useState([]),
650
+ _useState6 = _slicedToArray(_useState5, 2),
651
+ inExpandedKeysKeys = _useState6[0],
652
+ setInExpandedKeys = _useState6[1]; //展开keys
653
+ var opRef = useRef({}); //操作栏
654
+ var mouseInSectorRef = useRef(false); //是否鼠标进入扇形
655
+ var timeSectorRef = useRef(-1); //定时显示扇形
656
+ var nodesRef = useRef([]); //保存节点状态
657
+ var prefixCls = "".concat($prefixCls, "-tree"); //tree容器前缀
658
+ var treeMapRef = useRef({}); //tree map
659
+ var treeOriDataRef = useRef([]); //tree origin data
660
+ var nPageSize = Object.assign(Object.assign({}, defaultPageSize), pageSize);
661
+ var halfCheckedKeys = useRef([]); //半选keys
662
+ var intl = useFormatMessage('Tree', localeJson);
663
+ var _useState7 = useState(false),
664
+ _useState8 = _slicedToArray(_useState7, 2),
665
+ loading = _useState8[0],
666
+ setLoading = _useState8[1];
667
+ var firstRender = useRef(true); //是否第一次渲染
668
+ var _useState9 = useState([]),
669
+ _useState10 = _slicedToArray(_useState9, 2),
670
+ inLoadedKeys = _useState10[0],
671
+ setInLoadKeys = _useState10[1];
644
672
  //新属性
645
- const newProps = Object.assign(Object.assign({}, props), {
673
+ var newProps = Object.assign(Object.assign({}, props), {
646
674
  showLine: Boolean(showLine),
647
675
  checkStrictly: radioable || checkStrictly,
648
676
  showIcon: radioable || showIcon
649
677
  });
650
678
  //生成class
651
- const makeCls = () => {
652
- return clsx({
653
- ["".concat(prefixCls, "-icon-hide")]: !showIcon,
654
- ["".concat(prefixCls, "-block-node")]: blockNode,
655
- ["".concat(prefixCls, "-unselectable")]: !selectable,
656
- ["".concat(prefixCls, "-radioable")]: radioable,
657
- ["".concat(prefixCls, "-radioable-showradio")]: radioable && showRadio
658
- }, className);
679
+ var makeCls = function makeCls() {
680
+ return clsx(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-icon-hide"), !showIcon), "".concat(prefixCls, "-block-node"), blockNode), "".concat(prefixCls, "-unselectable"), !selectable), "".concat(prefixCls, "-radioable"), radioable), "".concat(prefixCls, "-radioable-showradio"), radioable && showRadio), className);
659
681
  };
660
682
  //格式化treeData 替换显示字段
661
- const formatTreeData = treeData => {
683
+ var formatTreeData = function formatTreeData(treeData) {
662
684
  function recursive(dataList) {
663
- const {
664
- key,
665
- title,
666
- children,
667
- parentId
668
- } = replaceFields || {};
669
- dataList.forEach(item => {
685
+ var _ref = replaceFields || {},
686
+ key = _ref.key,
687
+ title = _ref.title,
688
+ children = _ref.children,
689
+ parentId = _ref.parentId;
690
+ dataList.forEach(function (item) {
670
691
  var _a;
671
692
  if (key) item.key = item[key];
672
693
  if (title) item.title = item[title];
@@ -679,7 +700,7 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
679
700
  return treeData;
680
701
  };
681
702
  //内部 tree title render
682
- const internalTitleRender = nodeData => {
703
+ var internalTitleRender = function internalTitleRender(nodeData) {
683
704
  if (nodeData.moreFlag) {
684
705
  //加载更多节点
685
706
  return jsx("span", Object.assign({
@@ -708,7 +729,9 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
708
729
  children: typeof titleRender === 'function' ? titleRender(nodeData) : nodeData.title
709
730
  })), !!showActions && jsx("div", Object.assign({
710
731
  className: "sector-anchor",
711
- onMouseEnter: evt => handleSectorMEnter(nodeData, evt),
732
+ onMouseEnter: function onMouseEnter(evt) {
733
+ return handleSectorMEnter(nodeData, evt);
734
+ },
712
735
  onMouseLeave: handleSectorMLeave
713
736
  }, {
714
737
  children: jsx(MoreOutlinedIcon, {
@@ -718,44 +741,44 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
718
741
  }));
719
742
  };
720
743
  //tree node mouse enter
721
- const handleTreeNodeMEnter = evt => {
744
+ var handleTreeNodeMEnter = function handleTreeNodeMEnter(evt) {
722
745
  evt.stopPropagation();
723
746
  clearNodesState();
724
- const _currTarget = evt.currentTarget;
747
+ var _currTarget = evt.currentTarget;
725
748
  if (_currTarget) {
726
- const pClsx = ".".concat($prefixCls, "-tree-node-content-wrapper");
727
- const cParentEl = _currTarget.closest(pClsx);
749
+ var pClsx = ".".concat($prefixCls, "-tree-node-content-wrapper");
750
+ var cParentEl = _currTarget.closest(pClsx);
728
751
  nodesRef.current.push(cParentEl);
729
752
  showMoreActionIcon(cParentEl, true);
730
753
  }
731
754
  };
732
755
  //tree node mouse leave
733
- const handleTreeNodeMLeave = evt => {
756
+ var handleTreeNodeMLeave = function handleTreeNodeMLeave(evt) {
734
757
  evt.stopPropagation();
735
758
  clearNodesState();
736
- const _currTarget = evt.currentTarget;
759
+ var _currTarget = evt.currentTarget;
737
760
  if (_currTarget) {
738
- const pClsx = ".".concat($prefixCls, "-tree-node-content-wrapper");
739
- const cParentEl = _currTarget.closest(pClsx);
761
+ var pClsx = ".".concat($prefixCls, "-tree-node-content-wrapper");
762
+ var cParentEl = _currTarget.closest(pClsx);
740
763
  showMoreActionIcon(cParentEl, false);
741
764
  }
742
765
  };
743
766
  // Tree node Click
744
- const handleTreeNodeClick = () => {
767
+ var handleTreeNodeClick = function handleTreeNodeClick() {
745
768
  var _a;
746
769
  if (!showActions) return;
747
770
  // 点击tree node 的时候 rc 内部会把node节点的样式重写,导致之前逻辑添加的样式不存在,需要点击的时候加上样式
748
771
  if (((_a = nodesRef.current) === null || _a === void 0 ? void 0 : _a.length) > 0) {
749
772
  // 需要滞后到下次事件循环
750
- setTimeout(() => {
751
- nodesRef.current.forEach(el => {
773
+ setTimeout(function () {
774
+ nodesRef.current.forEach(function (el) {
752
775
  showMoreActionIcon(el, true);
753
776
  });
754
777
  });
755
778
  }
756
779
  };
757
780
  //节点显示更多图标
758
- const showMoreActionIcon = (cParentEl, isShow) => {
781
+ var showMoreActionIcon = function showMoreActionIcon(cParentEl, isShow) {
759
782
  if (!cParentEl) return;
760
783
  if (isShow) {
761
784
  cParentEl === null || cParentEl === void 0 ? void 0 : cParentEl.classList.add("".concat($prefixCls, "-tree-node-content-wrapper--active"));
@@ -764,21 +787,21 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
764
787
  }
765
788
  };
766
789
  //mouse enter sector
767
- const handleSectorMEnter = (nodeData, evt) => {
790
+ var handleSectorMEnter = function handleSectorMEnter(nodeData, evt) {
768
791
  evt.stopPropagation();
769
- const _currTarget = evt.currentTarget;
792
+ var _currTarget = evt.currentTarget;
770
793
  opRef.current.anchorEl = _currTarget;
771
- timeSectorRef.current = setTimeout(() => {
794
+ timeSectorRef.current = setTimeout(function () {
772
795
  clearTimeout(timeSectorRef.current);
773
796
  showSector(_currTarget, nodeData);
774
797
  }, 300);
775
798
  };
776
799
  //mouse sector leave
777
- const handleSectorMLeave = evt => {
800
+ var handleSectorMLeave = function handleSectorMLeave(evt) {
778
801
  evt.stopPropagation();
779
802
  clearTimeout(timeSectorRef.current);
780
- const _anchor = evt.currentTarget;
781
- const timer = setTimeout(() => {
803
+ var _anchor = evt.currentTarget;
804
+ var timer = setTimeout(function () {
782
805
  clearTimeout(timer);
783
806
  if (!mouseInSectorRef.current) {
784
807
  removeSector(_anchor);
@@ -786,19 +809,19 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
786
809
  }, 300);
787
810
  };
788
811
  //显示扇形
789
- const showSector = (anchorEl, nodeData) => {
812
+ var showSector = function showSector(anchorEl, nodeData) {
790
813
  var _a, _b;
791
- const portalRoot = document.getElementById(opRef.current.uid);
814
+ var portalRoot = document.getElementById(opRef.current.uid);
792
815
  anchorEl.classList.add('sector-anchor--active');
793
816
  if (portalRoot) {
794
- const container = portalRoot.querySelector('.sector-container');
817
+ var container = portalRoot.querySelector('.sector-container');
795
818
  if (container) {
796
819
  (_b = (_a = opRef.current) === null || _a === void 0 ? void 0 : _a.onShowSector) === null || _b === void 0 ? void 0 : _b.call(_a, nodeData, true);
797
820
  }
798
821
  }
799
822
  };
800
823
  //移除扇形
801
- const removeSector = anchorEl => {
824
+ var removeSector = function removeSector(anchorEl) {
802
825
  var _a, _b;
803
826
  if (anchorEl) {
804
827
  anchorEl.classList.remove('sector-anchor--active');
@@ -806,19 +829,19 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
806
829
  }
807
830
  };
808
831
  //离开扇形回调
809
- const handleOnRemove = anchorEl => {
832
+ var handleOnRemove = function handleOnRemove(anchorEl) {
810
833
  if (anchorEl) {
811
- const pCls = ".".concat($prefixCls, "-tree-node-content-wrapper");
812
- const cParentEl = anchorEl.closest(pCls);
834
+ var pCls = ".".concat($prefixCls, "-tree-node-content-wrapper");
835
+ var cParentEl = anchorEl.closest(pCls);
813
836
  showMoreActionIcon(cParentEl, false);
814
837
  removeSector(anchorEl);
815
838
  }
816
839
  };
817
840
  //清除节点状态
818
- const clearNodesState = () => {
841
+ var clearNodesState = function clearNodesState() {
819
842
  var _a;
820
843
  if ((_a = nodesRef.current) === null || _a === void 0 ? void 0 : _a.length) {
821
- nodesRef.current.forEach(el => {
844
+ nodesRef.current.forEach(function (el) {
822
845
  var _a;
823
846
  (_a = el === null || el === void 0 ? void 0 : el.classList) === null || _a === void 0 ? void 0 : _a.remove("".concat($prefixCls, "-tree-node-content-wrapper--active"));
824
847
  });
@@ -826,14 +849,14 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
826
849
  }
827
850
  };
828
851
  //内部check
829
- const internalCheck = (checkedKeys, e) => {
852
+ var internalCheck = function internalCheck(checkedKeys, e) {
830
853
  var _a;
831
- let temp = [];
832
- let halfChecked = [];
854
+ var temp = [];
855
+ var halfChecked = [];
833
856
  if (radioable) {
834
857
  //单选
835
- const node = e.node;
836
- const key = (_a = replaceFields.key) !== null && _a !== void 0 ? _a : 'key';
858
+ var node = e.node;
859
+ var key = (_a = replaceFields.key) !== null && _a !== void 0 ? _a : 'key';
837
860
  if (e.checked) temp = [node[key]];
838
861
  } else if (checkStrictly) {
839
862
  //严格模式
@@ -850,38 +873,59 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
850
873
  onCheck === null || onCheck === void 0 ? void 0 : onCheck(temp, e, halfChecked);
851
874
  };
852
875
  //展开节点
853
- const internalExpand = (expandedKeys, e) => {
876
+ var internalExpand = function internalExpand(expandedKeys, e) {
854
877
  if (!('expandedKeys' in props)) {
855
- setInExpandedKeys([...expandedKeys]);
878
+ setInExpandedKeys(_toConsumableArray(expandedKeys));
856
879
  }
857
880
  onExpand === null || onExpand === void 0 ? void 0 : onExpand(expandedKeys, e);
858
881
  };
859
882
  //请求树数据
860
- const requestTreeData = function () {
861
- let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
862
- return __awaiter(void 0, void 0, void 0, function* () {
863
- if (!url) return [];
864
- showLoading && setLoading(true);
865
- const tParams = (paramsCallback === null || paramsCallback === void 0 ? void 0 : paramsCallback(params)) || params;
866
- const m = method === null || method === void 0 ? void 0 : method.toUpperCase();
867
- const opts = {
868
- url,
869
- ctx,
870
- method: m,
871
- [m === 'GET' ? 'params' : 'data']: tParams || {}
872
- };
873
- if (headers) opts.headers = headers;
874
- const {
875
- data,
876
- err
877
- } = yield Request(opts); //分页数据格式 {list,page,size,total},否则 []
878
- showLoading && setLoading(false);
879
- if (err) return pagination ? {} : [];
880
- return pagination ? data.data || {} : data.data || [];
881
- });
883
+ var requestTreeData = function requestTreeData() {
884
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
885
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
886
+ var tParams, m, opts, _yield$Request, data, err;
887
+ return regenerator.wrap(function _callee$(_context) {
888
+ while (1) switch (_context.prev = _context.next) {
889
+ case 0:
890
+ if (url) {
891
+ _context.next = 2;
892
+ break;
893
+ }
894
+ return _context.abrupt("return", []);
895
+ case 2:
896
+ showLoading && setLoading(true);
897
+ tParams = (paramsCallback === null || paramsCallback === void 0 ? void 0 : paramsCallback(params)) || params;
898
+ m = method === null || method === void 0 ? void 0 : method.toUpperCase();
899
+ opts = _defineProperty({
900
+ url: url,
901
+ ctx: ctx,
902
+ method: m
903
+ }, m === 'GET' ? 'params' : 'data', tParams || {});
904
+ if (headers) opts.headers = headers;
905
+ _context.next = 9;
906
+ return Request(opts);
907
+ case 9:
908
+ _yield$Request = _context.sent;
909
+ data = _yield$Request.data;
910
+ err = _yield$Request.err;
911
+ //分页数据格式 {list,page,size,total},否则 []
912
+ showLoading && setLoading(false);
913
+ if (!err) {
914
+ _context.next = 15;
915
+ break;
916
+ }
917
+ return _context.abrupt("return", pagination ? {} : []);
918
+ case 15:
919
+ return _context.abrupt("return", pagination ? data.data || {} : data.data || []);
920
+ case 16:
921
+ case "end":
922
+ return _context.stop();
923
+ }
924
+ }, _callee);
925
+ }));
882
926
  };
883
927
  //加载更多节点数据
884
- const getLoadMoreData = () => {
928
+ var getLoadMoreData = function getLoadMoreData() {
885
929
  return {
886
930
  key: String((Math.random() * 1000000 | 0) + Date.now()),
887
931
  title: intl({
@@ -896,10 +940,10 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
896
940
  };
897
941
  };
898
942
  //渲染加载更多节点
899
- const renderLoadMoreNode = dataNode => {
943
+ var renderLoadMoreNode = function renderLoadMoreNode(dataNode) {
900
944
  return jsx("span", Object.assign({
901
945
  className: "".concat($prefixCls, "-tree-treenode-more-wrapper"),
902
- onClick: e => {
946
+ onClick: function onClick(e) {
903
947
  e.stopPropagation();
904
948
  onLoadData(dataNode);
905
949
  }
@@ -908,24 +952,24 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
908
952
  }));
909
953
  };
910
954
  //更新tree数据
911
- const updateTreeData = (list, key, children, moreFlag) => {
955
+ var updateTreeData = function updateTreeData(list, key, children, moreFlag) {
912
956
  //root节点
913
957
  if (key === 'ROOT_KEY') {
914
958
  list.pop(); //删除加载更多节点
915
959
  return list.concat(children);
916
960
  }
917
- return list.map(node => {
961
+ return list.map(function (node) {
918
962
  if (node.key === key) {
919
963
  if (moreFlag) {
920
964
  //加载更多
921
- const child = node.children || [];
965
+ var child = node.children || [];
922
966
  child.pop();
923
967
  return Object.assign(Object.assign({}, node), {
924
968
  children: child.concat(children)
925
969
  });
926
970
  }
927
971
  return Object.assign(Object.assign({}, node), {
928
- children
972
+ children: children
929
973
  });
930
974
  }
931
975
  if (node.children) {
@@ -937,101 +981,112 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
937
981
  });
938
982
  };
939
983
  //异步数据加载 [moreFlag]:加载更多标识
940
- const onLoadData = dataNode => {
941
- const {
942
- key,
943
- children,
944
- parentId,
945
- moreFlag
946
- } = dataNode;
947
- setInLoadKeys([...inLoadedKeys, key]);
984
+ var onLoadData = function onLoadData(dataNode) {
985
+ var key = dataNode.key,
986
+ children = dataNode.children,
987
+ parentId = dataNode.parentId,
988
+ moreFlag = dataNode.moreFlag;
989
+ setInLoadKeys([].concat(_toConsumableArray(inLoadedKeys), [key]));
948
990
  onLoadedKey === null || onLoadedKey === void 0 ? void 0 : onLoadedKey(key, dataNode);
949
- return new Promise(resolve => __awaiter(void 0, void 0, void 0, function* () {
950
- var _a;
951
- if (children) {
952
- resolve();
953
- return;
954
- }
955
- //当前节点key
956
- let tKey = key;
957
- //参数动态字段
958
- const loadKey = (_a = replaceFields.loadKey) !== null && _a !== void 0 ? _a : 'key';
959
- //加载节点时参数
960
- const loadParams = Object.assign({
961
- [loadKey]: tKey
962
- }, params);
963
- //是否分页
964
- if (pagination) {
965
- if (moreFlag) {
966
- //是否加载更多
967
- tKey = parentId;
968
- treeMapRef.current[tKey].page += 1;
969
- loadParams[loadKey] = tKey;
970
- if (tKey === 'ROOT_KEY') {
971
- //根节点加载更多,不需要key
972
- delete loadParams[loadKey];
991
+ return new Promise(function (resolve) {
992
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
993
+ var _a, tKey, loadKey, loadParams, treeData, handledData, pageInfo, _treeData, _treeData$list, list, page, size, total;
994
+ return regenerator.wrap(function _callee2$(_context2) {
995
+ while (1) switch (_context2.prev = _context2.next) {
996
+ case 0:
997
+ if (!children) {
998
+ _context2.next = 3;
999
+ break;
1000
+ }
1001
+ resolve();
1002
+ return _context2.abrupt("return");
1003
+ case 3:
1004
+ //当前节点key
1005
+ tKey = key; //参数动态字段
1006
+ loadKey = (_a = replaceFields.loadKey) !== null && _a !== void 0 ? _a : 'key'; //加载节点时参数
1007
+ loadParams = Object.assign(_defineProperty({}, loadKey, tKey), params); //是否分页
1008
+ if (pagination) {
1009
+ if (moreFlag) {
1010
+ //是否加载更多
1011
+ tKey = parentId;
1012
+ treeMapRef.current[tKey].page += 1;
1013
+ loadParams[loadKey] = tKey;
1014
+ if (tKey === 'ROOT_KEY') {
1015
+ //根节点加载更多,不需要key
1016
+ delete loadParams[loadKey];
1017
+ }
1018
+ }
1019
+ //分页参数
1020
+ loadParams.page = treeMapRef.current[tKey].page;
1021
+ loadParams.size = treeMapRef.current[tKey].size;
1022
+ }
1023
+ _context2.next = 9;
1024
+ return requestTreeData(loadParams);
1025
+ case 9:
1026
+ treeData = _context2.sent;
1027
+ _context2.next = 12;
1028
+ return requestCallback === null || requestCallback === void 0 ? void 0 : requestCallback(treeData);
1029
+ case 12:
1030
+ handledData = _context2.sent;
1031
+ if (handledData) treeData = handledData;
1032
+ pageInfo = {}; //分页信息
1033
+ if (!pagination) {
1034
+ _context2.next = 22;
1035
+ break;
1036
+ }
1037
+ if (Object.keys(treeData).length) {
1038
+ _context2.next = 19;
1039
+ break;
1040
+ }
1041
+ resolve();
1042
+ return _context2.abrupt("return");
1043
+ case 19:
1044
+ _treeData = treeData, _treeData$list = _treeData.list, list = _treeData$list === void 0 ? [] : _treeData$list, page = _treeData.page, size = _treeData.size, total = _treeData.total;
1045
+ treeData = list;
1046
+ pageInfo = {
1047
+ page: page,
1048
+ size: size,
1049
+ total: total
1050
+ };
1051
+ case 22:
1052
+ if (treeData === null || treeData === void 0 ? void 0 : treeData.length) {
1053
+ treeData = formatTreeData(treeData);
1054
+ if (pagination) {
1055
+ //是否分页
1056
+ treeData = transformTreeData(treeData, pageInfo, tKey);
1057
+ }
1058
+ }
1059
+ if (Array.isArray(treeData)) setTreeData(function (origin) {
1060
+ return updateTreeData(origin, tKey, treeData, moreFlag);
1061
+ });
1062
+ resolve();
1063
+ case 25:
1064
+ case "end":
1065
+ return _context2.stop();
973
1066
  }
974
- }
975
- //分页参数
976
- loadParams.page = treeMapRef.current[tKey].page;
977
- loadParams.size = treeMapRef.current[tKey].size;
978
- }
979
- let treeData = yield requestTreeData(loadParams);
980
- //透传数据
981
- const handledData = yield requestCallback === null || requestCallback === void 0 ? void 0 : requestCallback(treeData);
982
- if (handledData) treeData = handledData;
983
- let pageInfo = {}; //分页信息
984
- if (pagination) {
985
- //分页数据格式 {list,page,size,total}
986
- if (!Object.keys(treeData).length) {
987
- resolve();
988
- return;
989
- }
990
- const {
991
- list = [],
992
- page,
993
- size,
994
- total
995
- } = treeData;
996
- treeData = list;
997
- pageInfo = {
998
- page,
999
- size,
1000
- total
1001
- };
1002
- }
1003
- if (treeData === null || treeData === void 0 ? void 0 : treeData.length) {
1004
- treeData = formatTreeData(treeData);
1005
- if (pagination) {
1006
- //是否分页
1007
- treeData = transformTreeData(treeData, pageInfo, tKey);
1008
- }
1009
- }
1010
- if (Array.isArray(treeData)) setTreeData(origin => updateTreeData(origin, tKey, treeData, moreFlag));
1011
- resolve();
1012
- }));
1067
+ }, _callee2);
1068
+ }));
1069
+ });
1013
1070
  };
1014
1071
  //转化tree数据
1015
- const transformTreeData = (treeData, pageInfo, parentId) => {
1016
- const newTreeData = convert(treeData); //tree结构
1017
- const {
1018
- page,
1019
- size,
1020
- total
1021
- } = pageInfo;
1072
+ var transformTreeData = function transformTreeData(treeData, pageInfo, parentId) {
1073
+ var newTreeData = convert(treeData); //tree结构
1074
+ var page = pageInfo.page,
1075
+ size = pageInfo.size,
1076
+ total = pageInfo.total;
1022
1077
  //计算分页,是否显示加载更多
1023
1078
  if (page * size < total) {
1024
- const loadMoreData = getLoadMoreData();
1079
+ var loadMoreData = getLoadMoreData();
1025
1080
  loadMoreData.parentId = parentId || 'ROOT_KEY';
1026
1081
  loadMoreData.title = renderLoadMoreNode(loadMoreData);
1027
1082
  newTreeData.push(loadMoreData);
1028
1083
  }
1029
1084
  treeMapRef.current = _toObject(newTreeData);
1030
1085
  function _toObject(data) {
1031
- const obj = treeMapRef.current;
1086
+ var obj = treeMapRef.current;
1032
1087
  if (!(data === null || data === void 0 ? void 0 : data.length)) return obj;
1033
- data.forEach(item => {
1034
- const tKey = item.moreFlag ? item.parentId : item.key;
1088
+ data.forEach(function (item) {
1089
+ var tKey = item.moreFlag ? item.parentId : item.key;
1035
1090
  if (!obj[tKey]) {
1036
1091
  obj[tKey] = Object.assign(Object.assign({}, item), nPageSize);
1037
1092
  }
@@ -1041,49 +1096,73 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1041
1096
  return newTreeData;
1042
1097
  };
1043
1098
  //初始化树
1044
- const initTree = () => __awaiter(void 0, void 0, void 0, function* () {
1045
- const tParams = Object.assign({}, params);
1046
- if (pagination) {
1047
- //分页参数
1048
- tParams.page = nPageSize.page;
1049
- tParams.size = nPageSize.size;
1050
- }
1051
- let treeData = yield requestTreeData(tParams);
1052
- let pageInfo = {}; //分页信息
1053
- //透传数据
1054
- const handledData = yield requestCallback === null || requestCallback === void 0 ? void 0 : requestCallback(treeData);
1055
- if (handledData) treeData = handledData;
1056
- if (pagination) {
1057
- //分页数据格式 {list,page,size,total}
1058
- if (!Object.keys(treeData).length) return setTreeData([]);
1059
- const {
1060
- list = [],
1061
- page,
1062
- size,
1063
- total
1064
- } = treeData;
1065
- treeData = list;
1066
- pageInfo = {
1067
- page,
1068
- size,
1069
- total
1070
- };
1071
- //clean treeMapRef
1072
- treeMapRef.current = {};
1073
- }
1074
- if (!(treeData === null || treeData === void 0 ? void 0 : treeData.length)) return setTreeData([]);
1075
- treeData = formatTreeData(treeData);
1076
- if (localFilter)
1077
- //本地过滤
1078
- treeOriDataRef.current = deepCopy(treeData);
1079
- if (pagination)
1080
- //是否分页
1081
- treeData = transformTreeData(treeData, pageInfo);
1082
- setTreeData([...treeData]);
1083
- });
1099
+ var initTree = function initTree() {
1100
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee3() {
1101
+ var tParams, treeData, pageInfo, handledData, _treeData2, _treeData2$list, list, page, size, total;
1102
+ return regenerator.wrap(function _callee3$(_context3) {
1103
+ while (1) switch (_context3.prev = _context3.next) {
1104
+ case 0:
1105
+ tParams = Object.assign({}, params);
1106
+ if (pagination) {
1107
+ //分页参数
1108
+ tParams.page = nPageSize.page;
1109
+ tParams.size = nPageSize.size;
1110
+ }
1111
+ _context3.next = 4;
1112
+ return requestTreeData(tParams);
1113
+ case 4:
1114
+ treeData = _context3.sent;
1115
+ pageInfo = {}; //分页信息
1116
+ //透传数据
1117
+ _context3.next = 8;
1118
+ return requestCallback === null || requestCallback === void 0 ? void 0 : requestCallback(treeData);
1119
+ case 8:
1120
+ handledData = _context3.sent;
1121
+ if (handledData) treeData = handledData;
1122
+ if (!pagination) {
1123
+ _context3.next = 17;
1124
+ break;
1125
+ }
1126
+ if (Object.keys(treeData).length) {
1127
+ _context3.next = 13;
1128
+ break;
1129
+ }
1130
+ return _context3.abrupt("return", setTreeData([]));
1131
+ case 13:
1132
+ _treeData2 = treeData, _treeData2$list = _treeData2.list, list = _treeData2$list === void 0 ? [] : _treeData2$list, page = _treeData2.page, size = _treeData2.size, total = _treeData2.total;
1133
+ treeData = list;
1134
+ pageInfo = {
1135
+ page: page,
1136
+ size: size,
1137
+ total: total
1138
+ };
1139
+ //clean treeMapRef
1140
+ treeMapRef.current = {};
1141
+ case 17:
1142
+ if (treeData === null || treeData === void 0 ? void 0 : treeData.length) {
1143
+ _context3.next = 19;
1144
+ break;
1145
+ }
1146
+ return _context3.abrupt("return", setTreeData([]));
1147
+ case 19:
1148
+ treeData = formatTreeData(treeData);
1149
+ if (localFilter)
1150
+ //本地过滤
1151
+ treeOriDataRef.current = deepCopy(treeData);
1152
+ if (pagination)
1153
+ //是否分页
1154
+ treeData = transformTreeData(treeData, pageInfo);
1155
+ setTreeData(_toConsumableArray(treeData));
1156
+ case 23:
1157
+ case "end":
1158
+ return _context3.stop();
1159
+ }
1160
+ }, _callee3);
1161
+ }));
1162
+ };
1084
1163
  //额外的属性
1085
- const getAdditionProps = () => {
1086
- const additionProps = {};
1164
+ var getAdditionProps = function getAdditionProps() {
1165
+ var additionProps = {};
1087
1166
  if (asyncLoad)
1088
1167
  //异步加载
1089
1168
  additionProps.loadData = onLoadData;
@@ -1091,44 +1170,44 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1091
1170
  additionProps.titleRender = internalTitleRender;
1092
1171
  return additionProps;
1093
1172
  };
1094
- useEffect(() => {
1173
+ useEffect(function () {
1095
1174
  if (defaultCheckedKeys) {
1096
1175
  //默认值checked
1097
- setInCheckedKeys([...defaultCheckedKeys]);
1176
+ setInCheckedKeys(_toConsumableArray(defaultCheckedKeys));
1098
1177
  }
1099
1178
  if (defaultExpandedKeys) {
1100
1179
  //默认值expanded
1101
- setInExpandedKeys([...defaultExpandedKeys]);
1180
+ setInExpandedKeys(_toConsumableArray(defaultExpandedKeys));
1102
1181
  }
1103
1182
  }, [defaultCheckedKeys, defaultExpandedKeys]);
1104
- useEffect(() => {
1183
+ useEffect(function () {
1105
1184
  if (checkedKeys) {
1106
1185
  //选中keys
1107
- setInCheckedKeys([...getCheckedKeys(checkedKeys)]);
1186
+ setInCheckedKeys(_toConsumableArray(getCheckedKeys(checkedKeys)));
1108
1187
  halfCheckedKeys.current = getHalfCheckedKeys(checkedKeys);
1109
1188
  }
1110
1189
  if (expandedKeys) {
1111
1190
  //展开keys
1112
- setInExpandedKeys([...expandedKeys]);
1191
+ setInExpandedKeys(_toConsumableArray(expandedKeys));
1113
1192
  }
1114
1193
  }, [checkedKeys, expandedKeys]);
1115
- useEffect(() => {
1194
+ useEffect(function () {
1116
1195
  if (loadedKeys) {
1117
1196
  //loadedKeys
1118
1197
  if (loadedKeys.length === 0) {
1119
1198
  setInLoadKeys([]);
1120
1199
  setInExpandedKeys([]);
1121
1200
  } else {
1122
- setInLoadKeys([...loadedKeys]);
1201
+ setInLoadKeys(_toConsumableArray(loadedKeys));
1123
1202
  }
1124
1203
  }
1125
1204
  }, [loadedKeys]);
1126
- useEffect(() => {
1205
+ useEffect(function () {
1127
1206
  //默认展开所有
1128
1207
  function _expandAllNode(newTreeData) {
1129
- const keys = [];
1208
+ var keys = [];
1130
1209
  function recursive(dataList) {
1131
- dataList.forEach(item => {
1210
+ dataList.forEach(function (item) {
1132
1211
  var _a;
1133
1212
  if ((_a = item.children) === null || _a === void 0 ? void 0 : _a.length) {
1134
1213
  keys.push(item.key);
@@ -1143,51 +1222,51 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1143
1222
  }
1144
1223
  //tree 初始化
1145
1224
  if (Array.isArray(originTreeData)) {
1146
- const newTreeData = formatTreeData(originTreeData);
1225
+ var newTreeData = formatTreeData(originTreeData);
1147
1226
  //本地过滤
1148
1227
  if (localFilter) treeOriDataRef.current = deepCopy(newTreeData);
1149
1228
  if (newProps.defaultExpandAll) {
1150
1229
  //默认展开所有
1151
1230
  _expandAllNode(newTreeData);
1152
1231
  }
1153
- setTreeData([...newTreeData]);
1232
+ setTreeData(_toConsumableArray(newTreeData));
1154
1233
  } else {
1155
1234
  initTree();
1156
1235
  }
1157
1236
  }, [url, ctx, params, method, refresh, originTreeData]);
1158
- useEffect(() => {
1237
+ useEffect(function () {
1159
1238
  //过滤数据
1160
- function _filterData(_ref) {
1161
- let {
1162
- searchKey,
1163
- searchValue
1164
- } = _ref;
1239
+ function _filterData(_ref2) {
1240
+ var searchKey = _ref2.searchKey,
1241
+ searchValue = _ref2.searchValue;
1165
1242
  if (!searchKey) return;
1166
1243
  if (searchValue === '') {
1167
1244
  setTreeData(treeOriDataRef.current);
1168
- const tKeys = expandedKeys || defaultExpandedKeys;
1169
- setInExpandedKeys([...(tKeys || [])]);
1245
+ var tKeys = expandedKeys || defaultExpandedKeys;
1246
+ setInExpandedKeys(_toConsumableArray(tKeys || []));
1170
1247
  return;
1171
1248
  }
1172
- const flatData = flatten(treeOriDataRef.current);
1249
+ var flatData = flatten(treeOriDataRef.current);
1173
1250
  //匹配数据
1174
- const filterTreeData = flatData.reduce((acc, curr) => {
1175
- const title = String(curr[searchKey]).toLowerCase();
1176
- const isMatch = title.includes(searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase());
1251
+ var filterTreeData = flatData.reduce(function (acc, curr) {
1252
+ var title = String(curr[searchKey]).toLowerCase();
1253
+ var isMatch = title.includes(searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase());
1177
1254
  return isMatch ? acc.concat(curr) : acc;
1178
1255
  }, []);
1179
- const newTreeData = convertByFilter(deepCopy(flatData), filterTreeData);
1256
+ var newTreeData = convertByFilter(deepCopy(flatData), filterTreeData);
1180
1257
  setTreeData(newTreeData);
1181
1258
  setInExpandedKeys(_handleExpendKey(newTreeData));
1182
1259
  }
1183
1260
  //处理展开key
1184
1261
  function _handleExpendKey(list) {
1185
- return list.reduce((acc, curr) => acc.concat(curr.key, _handleExpendKey(curr.children || [])), []);
1262
+ return list.reduce(function (acc, curr) {
1263
+ return acc.concat(curr.key, _handleExpendKey(curr.children || []));
1264
+ }, []);
1186
1265
  }
1187
1266
  if (localFilter) {
1188
1267
  //开启本地过滤
1189
1268
  if (onFilter) {
1190
- const fData = onFilter(treeOriDataRef.current);
1269
+ var fData = onFilter(treeOriDataRef.current);
1191
1270
  if (!fData) return;
1192
1271
  setTreeData(fData);
1193
1272
  return;
@@ -1196,7 +1275,7 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1196
1275
  }
1197
1276
  }, [localFilter, localParams]);
1198
1277
  //渲染空状态
1199
- const renderEmpty = jsx("div", Object.assign({
1278
+ var renderEmpty = jsx("div", Object.assign({
1200
1279
  className: clsx("".concat($prefixCls, "-tree ").concat($prefixCls, "-tree-empty"), className, emptyClassName),
1201
1280
  style: props.style
1202
1281
  }, {
@@ -1205,14 +1284,14 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1205
1284
  }, emptyProps))
1206
1285
  }));
1207
1286
  //tree memo
1208
- const treeMemo = useMemo(() => {
1287
+ var treeMemo = useMemo(function () {
1209
1288
  if (!(treeData === null || treeData === void 0 ? void 0 : treeData.length) && firstRender.current) {
1210
1289
  firstRender.current = false;
1211
1290
  return null;
1212
1291
  } else if (!(treeData === null || treeData === void 0 ? void 0 : treeData.length)) {
1213
1292
  return !loading ? renderEmpty : null;
1214
1293
  }
1215
- let tCheckedKeys = inCheckedKeys;
1294
+ var tCheckedKeys = inCheckedKeys;
1216
1295
  if (checkStrictly) {
1217
1296
  tCheckedKeys = {
1218
1297
  checked: inCheckedKeys,
@@ -1229,7 +1308,9 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1229
1308
  className: "".concat(prefixCls, "-checkbox-inner")
1230
1309
  }) : checkable,
1231
1310
  selectable: radioable ? false : selectable,
1232
- switcherIcon: nodeProps => renderSwitcherIcon(prefixCls, switcherIcon, showLine, nodeProps)
1311
+ switcherIcon: function switcherIcon(nodeProps) {
1312
+ return renderSwitcherIcon(prefixCls, _switcherIcon, showLine, nodeProps);
1313
+ }
1233
1314
  }, getAdditionProps(), {
1234
1315
  treeData: treeData,
1235
1316
  checkedKeys: tCheckedKeys,
@@ -1237,9 +1318,9 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1237
1318
  loadedKeys: inLoadedKeys,
1238
1319
  onCheck: internalCheck,
1239
1320
  onExpand: internalExpand,
1240
- icon: nodeProps => {
1241
- if (icon) {
1242
- return typeof icon === 'function' ? icon(nodeProps) : icon;
1321
+ icon: function icon(nodeProps) {
1322
+ if (_icon) {
1323
+ return typeof _icon === 'function' ? _icon(nodeProps) : _icon;
1243
1324
  }
1244
1325
  if (nodeProps.checkable === false) return null;
1245
1326
  if (!radioable) {
@@ -1250,7 +1331,7 @@ const Tree = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1250
1331
  }));
1251
1332
  }, [treeData, inCheckedKeys, inExpandedKeysKeys, newProps.selectedKeys, inLoadedKeys]);
1252
1333
  //OperateBar render
1253
- const renderOperateBar = () => {
1334
+ var renderOperateBar = function renderOperateBar() {
1254
1335
  return !!showActions ? jsx(OperateBar, {
1255
1336
  opRef: opRef,
1256
1337
  mouseInRef: mouseInSectorRef,