@qsxy/element-plus-react 1.0.0-next.10 → 1.0.0-next.11
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.
- package/dist/Avatar/Avatar.js +73 -72
- package/dist/Avatar/index.js +1 -39
- package/dist/Avatar/typings.js +1 -17
- package/dist/Badge/Badge.d.ts +2 -2
- package/dist/Badge/Badge.js +63 -60
- package/dist/Badge/index.js +1 -39
- package/dist/Badge/typings.d.ts +1 -1
- package/dist/Badge/typings.js +1 -17
- package/dist/Breadcrumb/Breadcrumb.js +23 -50
- package/dist/Breadcrumb/BreadcrumbItem.js +45 -51
- package/dist/Breadcrumb/index.js +2 -42
- package/dist/Breadcrumb/typings.js +1 -17
- package/dist/Button/Button.js +132 -105
- package/dist/Button/ButtonGroup.js +29 -48
- package/dist/Button/ButtonGroupContext.js +2 -30
- package/dist/Button/index.js +2 -42
- package/dist/Button/typings.d.ts +4 -2
- package/dist/Button/typings.js +1 -17
- package/dist/Button/useButtonCustomStyle.d.ts +4 -0
- package/dist/Button/useButtonCustomStyle.js +65 -0
- package/dist/Calendar/Calendar.js +310 -237
- package/dist/Calendar/CalendarContext.js +3 -27
- package/dist/Calendar/DatePanel.js +191 -158
- package/dist/Calendar/DateRangePanel.js +140 -125
- package/dist/Calendar/Footer.js +41 -51
- package/dist/Calendar/Header.js +83 -65
- package/dist/Calendar/MonthPanel.js +138 -124
- package/dist/Calendar/MonthRangePanel.js +137 -124
- package/dist/Calendar/ShortCuts.js +21 -40
- package/dist/Calendar/WeekPanel.js +213 -145
- package/dist/Calendar/YearPanel.js +150 -125
- package/dist/Calendar/YearRangePanel.js +138 -128
- package/dist/Calendar/index.js +4 -47
- package/dist/Calendar/typings.js +1 -17
- package/dist/Calendar/util.js +26 -68
- package/dist/Card/Card.js +36 -46
- package/dist/Card/index.js +1 -39
- package/dist/Card/typings.js +1 -17
- package/dist/Carousel/Carousel.js +202 -166
- package/dist/Carousel/CarouselContext.js +14 -42
- package/dist/Carousel/CarouselItem.js +55 -71
- package/dist/Carousel/hooks/useCarousel.js +263 -238
- package/dist/Carousel/hooks/useCarouselItem.js +136 -132
- package/dist/Carousel/index.js +2 -42
- package/dist/Carousel/typings.js +1 -17
- package/dist/Cascader/Cascader.js +693 -569
- package/dist/Cascader/CascaderContext.js +9 -45
- package/dist/Cascader/CascaderDropdown.js +90 -77
- package/dist/Cascader/CascaderMenu.js +101 -114
- package/dist/Cascader/Utils.js +6 -33
- package/dist/Cascader/index.js +1 -39
- package/dist/Cascader/typings.d.ts +1 -1
- package/dist/Cascader/typings.js +1 -17
- package/dist/Cascader/useCascader.js +648 -458
- package/dist/Checkbox/Checkbox.d.ts +3 -3
- package/dist/Checkbox/Checkbox.js +136 -161
- package/dist/Checkbox/CheckboxButton.js +132 -157
- package/dist/Checkbox/index.js +2 -42
- package/dist/Checkbox/typings.d.ts +1 -1
- package/dist/Checkbox/typings.js +1 -17
- package/dist/CheckboxGroup/CheckboxGroup.js +133 -112
- package/dist/CheckboxGroup/CheckboxGroupContext.js +2 -30
- package/dist/CheckboxGroup/index.js +2 -42
- package/dist/Col/Col.js +53 -72
- package/dist/Col/index.js +1 -39
- package/dist/Col/typings.js +1 -17
- package/dist/Collapse/Collapse.js +36 -45
- package/dist/Collapse/CollapseContext.js +3 -31
- package/dist/Collapse/CollapseItem.js +88 -73
- package/dist/Collapse/CollapseTransition.js +29 -67
- package/dist/Collapse/index.js +2 -42
- package/dist/Collapse/typings.js +1 -17
- package/dist/ColorPicker/AlphaSlider.js +117 -99
- package/dist/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/ColorPicker/ColorPicker.js +233 -189
- package/dist/ColorPicker/HueSlider.js +102 -96
- package/dist/ColorPicker/Predefine.js +65 -66
- package/dist/ColorPicker/SvPanel.js +95 -81
- package/dist/ColorPicker/color.js +301 -213
- package/dist/ColorPicker/draggable.js +30 -48
- package/dist/ColorPicker/index.js +1 -39
- package/dist/ColorPicker/typings.js +1 -17
- package/dist/ColorPicker/util.js +23 -60
- package/dist/ConfigProvider/ConfigProvider.js +4 -28
- package/dist/ConfigProvider/index.js +1 -39
- package/dist/DatePicker/DatePicker.d.ts +3 -3
- package/dist/DatePicker/DatePicker.js +251 -227
- package/dist/DatePicker/DateRangePicker.d.ts +3 -3
- package/dist/DatePicker/DateRangePicker.js +279 -276
- package/dist/DatePicker/index.js +2 -39
- package/dist/DatePicker/main.d.ts +2 -2
- package/dist/DatePicker/main.js +21 -44
- package/dist/DatePicker/typings.d.ts +24 -17
- package/dist/DatePicker/typings.js +1 -17
- package/dist/DateTimePicker/DateTimePicker.d.ts +3 -5
- package/dist/DateTimePicker/DateTimePicker.js +286 -215
- package/dist/DateTimePicker/index.js +1 -39
- package/dist/DateTimePicker/typings.d.ts +10 -13
- package/dist/DateTimePicker/typings.js +1 -17
- package/dist/DateTimePicker/util.js +5 -35
- package/dist/Descriptions/Descriptions.js +83 -63
- package/dist/Descriptions/DescriptionsCell.js +67 -79
- package/dist/Descriptions/DescriptionsContext.js +4 -32
- package/dist/Descriptions/DescriptionsItem.js +4 -27
- package/dist/Descriptions/DescriptionsRow.js +42 -44
- package/dist/Descriptions/index.js +2 -42
- package/dist/Descriptions/typings.js +1 -17
- package/dist/Dialog/Dialog.js +224 -176
- package/dist/Dialog/DialogBody.js +52 -59
- package/dist/Dialog/DialogContext.js +6 -44
- package/dist/Dialog/DialogFooter.js +21 -45
- package/dist/Dialog/DialogHeader.js +44 -50
- package/dist/Dialog/index.js +1 -39
- package/dist/Dialog/typings.d.ts +1 -1
- package/dist/Dialog/typings.js +1 -17
- package/dist/Dialog/useDraggable.js +52 -79
- package/dist/Divider/Divider.d.ts +3 -3
- package/dist/Divider/Divider.js +38 -44
- package/dist/Divider/index.js +1 -39
- package/dist/Drawer/Drawer.js +144 -136
- package/dist/Drawer/DrawerBody.js +35 -57
- package/dist/Drawer/DrawerContext.js +13 -44
- package/dist/Drawer/DrawerFooter.js +22 -43
- package/dist/Drawer/DrawerHeader.js +41 -48
- package/dist/Drawer/index.js +1 -39
- package/dist/Drawer/typings.js +1 -17
- package/dist/Dropdown/Dropdown.js +89 -107
- package/dist/Dropdown/DropdownContext.js +5 -43
- package/dist/Dropdown/DropdownItem.js +40 -60
- package/dist/Dropdown/DropdownMenu.js +28 -56
- package/dist/Dropdown/index.js +3 -45
- package/dist/Dropdown/typings.js +1 -17
- package/dist/Empty/Empty.js +32 -53
- package/dist/Empty/ImgEmpty.js +115 -117
- package/dist/Empty/index.js +1 -39
- package/dist/Form/FieldContext.js +8 -37
- package/dist/Form/Form.js +167 -162
- package/dist/Form/FormContext.js +58 -97
- package/dist/Form/FormItem.js +620 -352
- package/dist/Form/FormItemContext.js +3 -31
- package/dist/Form/List.js +121 -104
- package/dist/Form/ListContext.js +3 -27
- package/dist/Form/index.js +3 -45
- package/dist/Form/typings.d.ts +25 -4
- package/dist/Form/typings.js +1 -17
- package/dist/Form/useForm.js +830 -690
- package/dist/Form/useWatch.js +64 -79
- package/dist/Form/utils/NameMap.js +98 -69
- package/dist/Form/utils/asyncUtil.js +9 -37
- package/dist/Form/utils/classUtil.js +26 -48
- package/dist/Form/utils/cloneDeep.js +8 -29
- package/dist/Form/utils/get.js +6 -30
- package/dist/Form/utils/messages.js +25 -53
- package/dist/Form/utils/set.js +31 -44
- package/dist/Form/utils/typeUtil.js +3 -31
- package/dist/Form/utils/util.js +18 -55
- package/dist/Form/utils/validateUtil.js +284 -159
- package/dist/Form/utils/valueUtil.js +102 -107
- package/dist/Icon/Icon.js +39 -63
- package/dist/Icon/IconList/Check.js +25 -65
- package/dist/Icon/IconList/Close.js +23 -52
- package/dist/Icon/IconList/Delete.js +25 -65
- package/dist/Icon/IconList/Down.js +25 -65
- package/dist/Icon/IconList/Eye.js +25 -65
- package/dist/Icon/IconList/EyeClose.js +25 -65
- package/dist/Icon/IconList/Left.js +25 -65
- package/dist/Icon/IconList/Link.js +19 -55
- package/dist/Icon/IconList/More.js +25 -65
- package/dist/Icon/IconList/Question.js +25 -65
- package/dist/Icon/IconList/Right.js +25 -65
- package/dist/Icon/IconList/Search.js +25 -65
- package/dist/Icon/IconList/Up.js +25 -65
- package/dist/Icon/IconList/Upload.js +25 -65
- package/dist/Icon/IconList/index.js +14 -68
- package/dist/Icon/index.js +2 -42
- package/dist/Icon/typings.js +1 -17
- package/dist/Input/Input.js +334 -358
- package/dist/Input/InputGroup.js +27 -43
- package/dist/Input/InputRange.js +295 -308
- package/dist/Input/TextArea.js +129 -120
- package/dist/Input/index.js +3 -45
- package/dist/Input/typings.js +1 -17
- package/dist/InputNumber/InputNumber.js +219 -203
- package/dist/InputNumber/index.js +1 -39
- package/dist/InputNumber/typings.d.ts +1 -1
- package/dist/InputNumber/typings.js +1 -17
- package/dist/Link/Link.js +43 -60
- package/dist/Link/index.js +1 -39
- package/dist/Link/typings.js +1 -17
- package/dist/Loading/Loading.js +93 -66
- package/dist/Loading/index.js +1 -39
- package/dist/Loading/typings.js +1 -17
- package/dist/Message/Main.js +41 -66
- package/dist/Message/Message.js +167 -130
- package/dist/Message/index.js +68 -88
- package/dist/Message/typings.js +1 -17
- package/dist/MessageBox/Main.js +43 -68
- package/dist/MessageBox/MessageBox.js +253 -202
- package/dist/MessageBox/index.js +74 -79
- package/dist/MessageBox/typings.js +1 -17
- package/dist/Notification/Main.js +41 -66
- package/dist/Notification/Notification.js +148 -131
- package/dist/Notification/index.js +76 -92
- package/dist/Notification/typings.js +1 -17
- package/dist/Pagination/Options.js +104 -99
- package/dist/Pagination/Pager.js +30 -61
- package/dist/Pagination/Pagination.js +462 -380
- package/dist/Pagination/index.js +1 -39
- package/dist/Pagination/typings.js +1 -17
- package/dist/Pagination/util.js +10 -41
- package/dist/Popconfirm/Popconfirm.js +108 -116
- package/dist/Popconfirm/index.js +1 -39
- package/dist/Popconfirm/typings.js +1 -17
- package/dist/Popover/Popover.js +87 -89
- package/dist/Popover/index.js +1 -39
- package/dist/Popover/typings.js +1 -17
- package/dist/Popper/Popper.js +172 -149
- package/dist/Popper/index.js +1 -39
- package/dist/Popper/popperOptions.js +79 -90
- package/dist/Popper/typings.js +1 -17
- package/dist/Progress/Progress.js +186 -155
- package/dist/Progress/index.js +1 -39
- package/dist/Progress/typings.js +1 -17
- package/dist/Radio/Radio.js +158 -117
- package/dist/Radio/RadioButton.js +127 -117
- package/dist/Radio/index.js +1 -39
- package/dist/Radio/typings.js +1 -17
- package/dist/RadioGroup/RadioGroup.js +63 -78
- package/dist/RadioGroup/index.js +1 -39
- package/dist/RadioGroup/typings.js +1 -17
- package/dist/Row/Row.js +41 -62
- package/dist/Row/RowContext.js +3 -31
- package/dist/Row/index.js +2 -42
- package/dist/Row/typings.js +1 -17
- package/dist/Scrollbar/Scrollbar.js +172 -133
- package/dist/Scrollbar/Thumb.js +108 -96
- package/dist/Scrollbar/index.js +1 -39
- package/dist/Scrollbar/typings.d.ts +11 -2
- package/dist/Scrollbar/typings.js +1 -17
- package/dist/Scrollbar/util.js +24 -51
- package/dist/Select/Option.js +50 -75
- package/dist/Select/OptionGroup.js +31 -47
- package/dist/Select/Select.js +25 -48
- package/dist/Select/SelectContext.js +8 -46
- package/dist/Select/SelectCore.js +449 -377
- package/dist/Select/SelectDropdown.js +200 -160
- package/dist/Select/index.js +2 -42
- package/dist/Select/typings.d.ts +1 -1
- package/dist/Select/typings.js +1 -17
- package/dist/Skeleton/PlaceholderGraph.js +39 -45
- package/dist/Skeleton/PlaceholderGrid.js +55 -67
- package/dist/Skeleton/PlaceholderParagraph.js +51 -52
- package/dist/Skeleton/Skeleton.js +8 -42
- package/dist/Skeleton/index.js +1 -39
- package/dist/Switch/Switch.js +177 -154
- package/dist/Switch/index.js +1 -39
- package/dist/Switch/typings.js +1 -17
- package/dist/Table/Colgroup.js +17 -41
- package/dist/Table/Table.js +246 -188
- package/dist/Table/TableBody.js +265 -200
- package/dist/Table/TableCell.js +461 -320
- package/dist/Table/TableColumn.js +9 -43
- package/dist/Table/TableContext.js +44 -63
- package/dist/Table/TableHeader.js +112 -102
- package/dist/Table/TableHeaderCell.js +211 -158
- package/dist/Table/hooks/useResize.js +69 -83
- package/dist/Table/hooks/useScroll.js +88 -114
- package/dist/Table/hooks/useSelection.js +145 -110
- package/dist/Table/hooks/useTable.js +411 -309
- package/dist/Table/index.js +2 -42
- package/dist/Table/treeUtil.js +99 -77
- package/dist/Table/typings.js +1 -17
- package/dist/Table/util.js +168 -109
- package/dist/Tabs/TabPane.js +51 -53
- package/dist/Tabs/Tabs.js +277 -178
- package/dist/Tabs/TabsContext.js +4 -32
- package/dist/Tabs/index.js +2 -42
- package/dist/Tabs/typings.js +1 -17
- package/dist/Tag/Tag.js +75 -74
- package/dist/Tag/index.js +1 -39
- package/dist/Tag/typings.js +1 -17
- package/dist/TimeLine/TimeLine.js +13 -42
- package/dist/TimeLine/TimeLineItem.js +66 -54
- package/dist/TimeLine/index.js +2 -42
- package/dist/TimeLine/typings.js +1 -17
- package/dist/TimePicker/TimePicker.d.ts +1 -4
- package/dist/TimePicker/TimePicker.js +275 -215
- package/dist/TimePicker/TimePickerPanel.js +62 -71
- package/dist/TimePicker/TimePickerRange.d.ts +4 -4
- package/dist/TimePicker/TimePickerRange.js +371 -334
- package/dist/TimePicker/TimeRangePanel.js +182 -165
- package/dist/TimePicker/TimeSpinnerPanel.js +321 -267
- package/dist/TimePicker/index.d.ts +2 -3
- package/dist/TimePicker/index.js +1 -42
- package/dist/TimePicker/main.d.ts +9 -0
- package/dist/TimePicker/main.js +17 -0
- package/dist/TimePicker/typings.d.ts +29 -24
- package/dist/TimePicker/typings.js +1 -17
- package/dist/TimePicker/useTimePicker.js +62 -65
- package/dist/TimePicker/util.js +8 -40
- package/dist/Tooltip/Tooltip.js +172 -180
- package/dist/Tooltip/TooltipContext.js +8 -46
- package/dist/Tooltip/index.js +2 -42
- package/dist/Tooltip/typings.js +1 -17
- package/dist/Transfer/List.js +290 -241
- package/dist/Transfer/ListBody.js +92 -106
- package/dist/Transfer/ListItem.js +38 -51
- package/dist/Transfer/Transfer.js +323 -280
- package/dist/Transfer/index.js +1 -39
- package/dist/Transfer/interface.js +1 -17
- package/dist/Transfer/operation.js +35 -48
- package/dist/Transfer/search.js +30 -62
- package/dist/Transfer/typings/index.js +1 -17
- package/dist/Transfer/typings/list.js +1 -17
- package/dist/Transfer/typings/listBody.js +2 -30
- package/dist/Transition/Transition.js +271 -234
- package/dist/Transition/TransitionGroup.js +136 -88
- package/dist/Transition/TransitionGroupContext.js +2 -26
- package/dist/Transition/childMapping.js +84 -71
- package/dist/Transition/index.js +2 -42
- package/dist/Transition/util.d.ts +0 -1
- package/dist/Transition/util.js +6 -47
- package/dist/Tree/DirectoryTree.js +146 -118
- package/dist/Tree/DropIndicator.js +15 -45
- package/dist/Tree/Indent.js +23 -54
- package/dist/Tree/MotionTreeNode.js +94 -95
- package/dist/Tree/NodeList.js +228 -221
- package/dist/Tree/RCTree.js +969 -702
- package/dist/Tree/Tree.js +64 -79
- package/dist/Tree/TreeNode.js +254 -255
- package/dist/Tree/contextTypes.js +8 -42
- package/dist/Tree/index.js +4 -48
- package/dist/Tree/typings.js +1 -17
- package/dist/Tree/useUnmount.js +21 -41
- package/dist/Tree/util.js +156 -134
- package/dist/Tree/utils/conductUtil.js +113 -104
- package/dist/Tree/utils/dictUtil.js +50 -78
- package/dist/Tree/utils/diffUtil.js +26 -43
- package/dist/Tree/utils/dropIndicator.js +23 -51
- package/dist/Tree/utils/iconUtil.js +44 -51
- package/dist/Tree/utils/keyUtil.js +2 -26
- package/dist/Tree/utils/motion.js +34 -72
- package/dist/Tree/utils/pickAttrs.js +30 -58
- package/dist/Tree/utils/treeUtil.js +263 -203
- package/dist/TreeSelect/TreeSelect.js +521 -459
- package/dist/TreeSelect/Utils.js +15 -36
- package/dist/TreeSelect/index.js +1 -39
- package/dist/TreeSelect/typings.d.ts +1 -1
- package/dist/TreeSelect/typings.js +1 -17
- package/dist/Upload/Upload.js +106 -109
- package/dist/Upload/UploadContent.js +227 -182
- package/dist/Upload/UploadContext.js +5 -33
- package/dist/Upload/UploadDrag.js +77 -97
- package/dist/Upload/UploadList.js +104 -73
- package/dist/Upload/ajax.js +45 -71
- package/dist/Upload/index.js +1 -39
- package/dist/Upload/typings.js +34 -36
- package/dist/Upload/use-handlers.js +182 -126
- package/dist/Util/Math.js +81 -78
- package/dist/Util/PopupManager.js +5 -27
- package/dist/Util/base.js +101 -171
- package/dist/Util/genFileId.js +3 -29
- package/dist/Util/index.js +6 -51
- package/dist/Util/resize-event.js +31 -54
- package/dist/Util/shallowEqual.js +30 -28
- package/dist/Util/treeUtils.js +68 -64
- package/dist/config/Constants.js +17 -47
- package/dist/display.css +1 -0
- package/dist/hooks/animationPropsUtils.js +25 -49
- package/dist/hooks/htmlPropsUtils.js +54 -121
- package/dist/hooks/index.js +14 -73
- package/dist/hooks/popperPropsUtils.js +25 -67
- package/dist/hooks/prefix.js +22 -55
- package/dist/hooks/treePropsUtils.js +24 -103
- package/dist/hooks/useChildrenInstance.js +51 -60
- package/dist/hooks/useClassNames.d.ts +2 -0
- package/dist/hooks/useClassNames.js +279 -197
- package/dist/hooks/useClickOutside.js +37 -62
- package/dist/hooks/useCommonProps.js +17 -53
- package/dist/hooks/useComponentWillMount.js +4 -28
- package/dist/hooks/useControlled.js +31 -37
- package/dist/hooks/useForceUpdate.js +16 -34
- package/dist/hooks/useUpdateEffect.js +6 -29
- package/dist/index.css +1 -57810
- package/dist/index.d.ts +0 -2
- package/dist/index.js +69 -237
- package/dist/theme-chalk/common/index.js +1 -2
- package/dist/theme-chalk/common/index.scss +2 -2
- package/dist/theme-chalk/date-picker/index.scss +1 -1
- package/dist/theme-chalk/display.scss +46 -0
- package/dist/theme-chalk/form/index.scss +21 -2
- package/dist/types/common.js +1 -17
- package/dist/types/type.js +16 -28
- package/package.json +6 -1
- package/theme-chalk/common/index.scss +2 -2
- package/theme-chalk/date-picker/index.scss +1 -1
- package/theme-chalk/display.scss +46 -0
- package/theme-chalk/form/index.scss +21 -2
package/dist/Tree/RCTree.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var import_DropIndicator = __toESM(require("./DropIndicator"));
|
|
41
|
-
var import_NodeList = __toESM(require("./NodeList"));
|
|
42
|
-
var import_TreeNode = __toESM(require("./TreeNode"));
|
|
43
|
-
var import_contextTypes = require("./contextTypes");
|
|
44
|
-
var import_util = require("./util");
|
|
45
|
-
var import_conductUtil = require("./utils/conductUtil");
|
|
46
|
-
var import_keyUtil = __toESM(require("./utils/keyUtil"));
|
|
47
|
-
var import_treeUtil = require("./utils/treeUtil");
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
18
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
|
+
// TODO: https://www.w3.org/TR/2017/NOTE-wai-aria-practices-1.1-20171214/examples/treeview/treeview-2/treeview-2a.html
|
|
25
|
+
// Fully accessibility support
|
|
26
|
+
|
|
27
|
+
import classNames from 'classnames';
|
|
28
|
+
import KeyCode from 'rc-util/lib/KeyCode';
|
|
29
|
+
import pickAttrs from 'rc-util/lib/pickAttrs';
|
|
30
|
+
import warning from 'rc-util/lib/warning';
|
|
31
|
+
import * as React from 'react';
|
|
32
|
+
import DropIndicator from "./DropIndicator";
|
|
33
|
+
import NodeList, { MOTION_KEY, MotionEntity } from "./NodeList";
|
|
34
|
+
import TreeNode from "./TreeNode";
|
|
35
|
+
import { TreeContext } from "./contextTypes";
|
|
36
|
+
import { arrAdd, arrDel, calcDropPosition, calcSelectedKeys, conductExpandParent, getDragChildrenKeys, parseCheckedKeys, posToArr } from "./util";
|
|
37
|
+
import { conductCheck } from "./utils/conductUtil";
|
|
38
|
+
import getEntity from "./utils/keyUtil";
|
|
39
|
+
import { convertDataToEntities, convertNodePropsToEventData, convertTreeToData, fillFieldNames, flattenTreeData, getTreeNodeProps, warningWithoutKey } from "./utils/treeUtil";
|
|
48
40
|
var MAX_RETRY_TIMES = 10;
|
|
49
|
-
var Tree =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this
|
|
41
|
+
var Tree = /*#__PURE__*/function (_React$Component) {
|
|
42
|
+
_inherits(Tree, _React$Component);
|
|
43
|
+
var _super = _createSuper(Tree);
|
|
44
|
+
function Tree() {
|
|
45
|
+
var _this;
|
|
46
|
+
_classCallCheck(this, Tree);
|
|
47
|
+
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48
|
+
_args[_key] = arguments[_key];
|
|
49
|
+
}
|
|
50
|
+
_this = _super.call.apply(_super, [this].concat(_args));
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "destroyed", false);
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "delayedDragEnterLogic", void 0);
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "loadingRetryTimes", {});
|
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
55
55
|
keyEntities: {},
|
|
56
56
|
indent: null,
|
|
57
57
|
selectedKeys: [],
|
|
@@ -86,217 +86,265 @@ var Tree = class extends React.Component {
|
|
|
86
86
|
activeKey: null,
|
|
87
87
|
listChanging: false,
|
|
88
88
|
prevProps: null,
|
|
89
|
-
fieldNames:
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
fieldNames: fillFieldNames()
|
|
90
|
+
});
|
|
91
|
+
_defineProperty(_assertThisInitialized(_this), "dragStartMousePosition", null);
|
|
92
|
+
_defineProperty(_assertThisInitialized(_this), "dragNodeProps", null);
|
|
93
|
+
_defineProperty(_assertThisInitialized(_this), "currentMouseOverDroppableNodeKey", null);
|
|
94
|
+
_defineProperty(_assertThisInitialized(_this), "listRef", /*#__PURE__*/React.createRef());
|
|
95
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeDragStart", function (event, nodeProps) {
|
|
96
|
+
var _this$state = _this.state,
|
|
97
|
+
expandedKeys = _this$state.expandedKeys,
|
|
98
|
+
keyEntities = _this$state.keyEntities;
|
|
99
|
+
var onDragStart = _this.props.onDragStart;
|
|
100
|
+
var eventKey = nodeProps.eventKey;
|
|
101
|
+
_this.dragNodeProps = nodeProps;
|
|
102
|
+
_this.dragStartMousePosition = {
|
|
101
103
|
x: event.clientX,
|
|
102
104
|
y: event.clientY
|
|
103
105
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
var newExpandedKeys = arrDel(expandedKeys, eventKey);
|
|
107
|
+
_this.setState({
|
|
106
108
|
draggingNodeKey: eventKey,
|
|
107
|
-
dragChildrenKeys:
|
|
108
|
-
indent:
|
|
109
|
+
dragChildrenKeys: getDragChildrenKeys(eventKey, keyEntities),
|
|
110
|
+
indent: _this.listRef.current.getIndentWidth()
|
|
109
111
|
});
|
|
110
|
-
|
|
111
|
-
window.addEventListener(
|
|
112
|
-
onDragStart
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
*
|
|
119
|
-
*
|
|
112
|
+
_this.setExpandedKeys(newExpandedKeys);
|
|
113
|
+
window.addEventListener('dragend', _this.onWindowDragEnd);
|
|
114
|
+
onDragStart === null || onDragStart === void 0 || onDragStart({
|
|
115
|
+
event: event,
|
|
116
|
+
node: convertNodePropsToEventData(nodeProps)
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* [Legacy] Select handler is smaller than node,
|
|
121
|
+
* so that this will trigger when drag enter node or select handler.
|
|
122
|
+
* This is a little tricky if customize css without padding.
|
|
123
|
+
* Better for use mouse move event to refresh drag state.
|
|
124
|
+
* But let's just keep it to avoid event trigger logic change.
|
|
120
125
|
*/
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeDragEnter", function (event, nodeProps) {
|
|
127
|
+
var _this$state2 = _this.state,
|
|
128
|
+
expandedKeys = _this$state2.expandedKeys,
|
|
129
|
+
keyEntities = _this$state2.keyEntities,
|
|
130
|
+
dragChildrenKeys = _this$state2.dragChildrenKeys,
|
|
131
|
+
flattenNodes = _this$state2.flattenNodes,
|
|
132
|
+
indent = _this$state2.indent;
|
|
133
|
+
var _this$props = _this.props,
|
|
134
|
+
onDragEnter = _this$props.onDragEnter,
|
|
135
|
+
onExpand = _this$props.onExpand,
|
|
136
|
+
allowDrop = _this$props.allowDrop,
|
|
137
|
+
direction = _this$props.direction;
|
|
138
|
+
var pos = nodeProps.pos,
|
|
139
|
+
eventKey = nodeProps.eventKey;
|
|
140
|
+
|
|
141
|
+
// record the key of node which is latest entered, used in dragleave event.
|
|
142
|
+
if (_this.currentMouseOverDroppableNodeKey !== eventKey) {
|
|
143
|
+
_this.currentMouseOverDroppableNodeKey = eventKey;
|
|
144
|
+
}
|
|
145
|
+
if (!_this.dragNodeProps) {
|
|
146
|
+
_this.resetDragState();
|
|
130
147
|
return;
|
|
131
148
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
keyEntities,
|
|
141
|
-
expandedKeys,
|
|
142
|
-
direction
|
|
143
|
-
);
|
|
149
|
+
var _calcDropPosition = calcDropPosition(event, _this.dragNodeProps, nodeProps, indent, _this.dragStartMousePosition, allowDrop, flattenNodes, keyEntities, expandedKeys, direction),
|
|
150
|
+
dropPosition = _calcDropPosition.dropPosition,
|
|
151
|
+
dropLevelOffset = _calcDropPosition.dropLevelOffset,
|
|
152
|
+
dropTargetKey = _calcDropPosition.dropTargetKey,
|
|
153
|
+
dropContainerKey = _calcDropPosition.dropContainerKey,
|
|
154
|
+
dropTargetPos = _calcDropPosition.dropTargetPos,
|
|
155
|
+
dropAllowed = _calcDropPosition.dropAllowed,
|
|
156
|
+
dragOverNodeKey = _calcDropPosition.dragOverNodeKey;
|
|
144
157
|
if (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
) {
|
|
149
|
-
|
|
158
|
+
// don't allow drop inside its children
|
|
159
|
+
dragChildrenKeys.includes(dropTargetKey) ||
|
|
160
|
+
// don't allow drop when drop is not allowed caculated by calcDropPosition
|
|
161
|
+
!dropAllowed) {
|
|
162
|
+
_this.resetDragState();
|
|
150
163
|
return;
|
|
151
164
|
}
|
|
152
|
-
|
|
153
|
-
|
|
165
|
+
|
|
166
|
+
// Side effect for delay drag
|
|
167
|
+
if (!_this.delayedDragEnterLogic) {
|
|
168
|
+
_this.delayedDragEnterLogic = {};
|
|
154
169
|
}
|
|
155
|
-
Object.keys(
|
|
156
|
-
clearTimeout(
|
|
170
|
+
Object.keys(_this.delayedDragEnterLogic).forEach(function (key) {
|
|
171
|
+
clearTimeout(_this.delayedDragEnterLogic[key]);
|
|
157
172
|
});
|
|
158
|
-
if (
|
|
173
|
+
if (_this.dragNodeProps.eventKey !== nodeProps.eventKey) {
|
|
174
|
+
// hoist expand logic here
|
|
175
|
+
// since if logic is on the bottom
|
|
176
|
+
// it will be blocked by abstract dragover node check
|
|
177
|
+
// => if you dragenter from top, you mouse will still be consider as in the top node
|
|
159
178
|
event.persist();
|
|
160
|
-
|
|
161
|
-
if (
|
|
179
|
+
_this.delayedDragEnterLogic[pos] = window.setTimeout(function () {
|
|
180
|
+
if (_this.state.draggingNodeKey === null) {
|
|
162
181
|
return;
|
|
163
182
|
}
|
|
164
|
-
|
|
165
|
-
|
|
183
|
+
var newExpandedKeys = _toConsumableArray(expandedKeys);
|
|
184
|
+
var entity = getEntity(keyEntities, nodeProps.eventKey);
|
|
166
185
|
if (entity && (entity.children || []).length) {
|
|
167
|
-
newExpandedKeys =
|
|
186
|
+
newExpandedKeys = arrAdd(expandedKeys, nodeProps.eventKey);
|
|
168
187
|
}
|
|
169
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
170
|
-
|
|
188
|
+
if (!Object.prototype.hasOwnProperty.call(_this.props, 'expandedKeys')) {
|
|
189
|
+
_this.setExpandedKeys(newExpandedKeys);
|
|
171
190
|
}
|
|
172
|
-
onExpand
|
|
173
|
-
node:
|
|
191
|
+
onExpand === null || onExpand === void 0 || onExpand(newExpandedKeys, {
|
|
192
|
+
node: convertNodePropsToEventData(nodeProps),
|
|
174
193
|
expanded: true,
|
|
175
194
|
nativeEvent: event.nativeEvent
|
|
176
195
|
});
|
|
177
196
|
}, 800);
|
|
178
197
|
}
|
|
179
|
-
|
|
180
|
-
|
|
198
|
+
|
|
199
|
+
// Skip if drag node is self
|
|
200
|
+
if (_this.dragNodeProps.eventKey === dropTargetKey && dropLevelOffset === 0) {
|
|
201
|
+
_this.resetDragState();
|
|
181
202
|
return;
|
|
182
203
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
204
|
+
|
|
205
|
+
// Update drag over node and drag state
|
|
206
|
+
_this.setState({
|
|
207
|
+
dragOverNodeKey: dragOverNodeKey,
|
|
208
|
+
dropPosition: dropPosition,
|
|
209
|
+
dropLevelOffset: dropLevelOffset,
|
|
210
|
+
dropTargetKey: dropTargetKey,
|
|
211
|
+
dropContainerKey: dropContainerKey,
|
|
212
|
+
dropTargetPos: dropTargetPos,
|
|
213
|
+
dropAllowed: dropAllowed
|
|
191
214
|
});
|
|
192
|
-
onDragEnter
|
|
193
|
-
event,
|
|
194
|
-
node:
|
|
195
|
-
expandedKeys
|
|
215
|
+
onDragEnter === null || onDragEnter === void 0 || onDragEnter({
|
|
216
|
+
event: event,
|
|
217
|
+
node: convertNodePropsToEventData(nodeProps),
|
|
218
|
+
expandedKeys: expandedKeys
|
|
196
219
|
});
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
220
|
+
});
|
|
221
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeDragOver", function (event, nodeProps) {
|
|
222
|
+
var _this$state3 = _this.state,
|
|
223
|
+
dragChildrenKeys = _this$state3.dragChildrenKeys,
|
|
224
|
+
flattenNodes = _this$state3.flattenNodes,
|
|
225
|
+
keyEntities = _this$state3.keyEntities,
|
|
226
|
+
expandedKeys = _this$state3.expandedKeys,
|
|
227
|
+
indent = _this$state3.indent;
|
|
228
|
+
var _this$props2 = _this.props,
|
|
229
|
+
onDragOver = _this$props2.onDragOver,
|
|
230
|
+
allowDrop = _this$props2.allowDrop,
|
|
231
|
+
direction = _this$props2.direction;
|
|
232
|
+
if (!_this.dragNodeProps) {
|
|
202
233
|
return;
|
|
203
234
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
keyEntities,
|
|
213
|
-
expandedKeys,
|
|
214
|
-
direction
|
|
215
|
-
);
|
|
235
|
+
var _calcDropPosition2 = calcDropPosition(event, _this.dragNodeProps, nodeProps, indent, _this.dragStartMousePosition, allowDrop, flattenNodes, keyEntities, expandedKeys, direction),
|
|
236
|
+
dropPosition = _calcDropPosition2.dropPosition,
|
|
237
|
+
dropLevelOffset = _calcDropPosition2.dropLevelOffset,
|
|
238
|
+
dropTargetKey = _calcDropPosition2.dropTargetKey,
|
|
239
|
+
dropContainerKey = _calcDropPosition2.dropContainerKey,
|
|
240
|
+
dropTargetPos = _calcDropPosition2.dropTargetPos,
|
|
241
|
+
dropAllowed = _calcDropPosition2.dropAllowed,
|
|
242
|
+
dragOverNodeKey = _calcDropPosition2.dragOverNodeKey;
|
|
216
243
|
if (dragChildrenKeys.includes(dropTargetKey) || !dropAllowed) {
|
|
244
|
+
// don't allow drop inside its children
|
|
245
|
+
// don't allow drop when drop is not allowed calculated by calcDropPosition
|
|
217
246
|
return;
|
|
218
247
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
248
|
+
|
|
249
|
+
// Update drag position
|
|
250
|
+
|
|
251
|
+
if (_this.dragNodeProps.eventKey === dropTargetKey && dropLevelOffset === 0) {
|
|
252
|
+
if (!(_this.state.dropPosition === null && _this.state.dropLevelOffset === null && _this.state.dropTargetKey === null && _this.state.dropContainerKey === null && _this.state.dropTargetPos === null && _this.state.dropAllowed === false && _this.state.dragOverNodeKey === null)) {
|
|
253
|
+
_this.resetDragState();
|
|
222
254
|
}
|
|
223
|
-
} else if (!(dropPosition ===
|
|
224
|
-
|
|
225
|
-
dropPosition,
|
|
226
|
-
dropLevelOffset,
|
|
227
|
-
dropTargetKey,
|
|
228
|
-
dropContainerKey,
|
|
229
|
-
dropTargetPos,
|
|
230
|
-
dropAllowed,
|
|
231
|
-
dragOverNodeKey
|
|
255
|
+
} else if (!(dropPosition === _this.state.dropPosition && dropLevelOffset === _this.state.dropLevelOffset && dropTargetKey === _this.state.dropTargetKey && dropContainerKey === _this.state.dropContainerKey && dropTargetPos === _this.state.dropTargetPos && dropAllowed === _this.state.dropAllowed && dragOverNodeKey === _this.state.dragOverNodeKey)) {
|
|
256
|
+
_this.setState({
|
|
257
|
+
dropPosition: dropPosition,
|
|
258
|
+
dropLevelOffset: dropLevelOffset,
|
|
259
|
+
dropTargetKey: dropTargetKey,
|
|
260
|
+
dropContainerKey: dropContainerKey,
|
|
261
|
+
dropTargetPos: dropTargetPos,
|
|
262
|
+
dropAllowed: dropAllowed,
|
|
263
|
+
dragOverNodeKey: dragOverNodeKey
|
|
232
264
|
});
|
|
233
265
|
}
|
|
234
|
-
onDragOver
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
266
|
+
onDragOver === null || onDragOver === void 0 || onDragOver({
|
|
267
|
+
event: event,
|
|
268
|
+
node: convertNodePropsToEventData(nodeProps)
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeDragLeave", function (event, nodeProps) {
|
|
272
|
+
// if it is outside the droppable area
|
|
273
|
+
// currentMouseOverDroppableNodeKey will be updated in dragenter event when into another droppable receiver.
|
|
274
|
+
if (_this.currentMouseOverDroppableNodeKey === nodeProps.eventKey && !event.currentTarget.contains(event.relatedTarget)) {
|
|
275
|
+
_this.resetDragState();
|
|
276
|
+
_this.currentMouseOverDroppableNodeKey = null;
|
|
240
277
|
}
|
|
241
|
-
|
|
242
|
-
onDragLeave
|
|
243
|
-
|
|
278
|
+
var onDragLeave = _this.props.onDragLeave;
|
|
279
|
+
onDragLeave === null || onDragLeave === void 0 || onDragLeave({
|
|
280
|
+
event: event,
|
|
281
|
+
node: convertNodePropsToEventData(nodeProps)
|
|
282
|
+
});
|
|
283
|
+
});
|
|
244
284
|
// since stopPropagation() is called in treeNode
|
|
245
285
|
// if onWindowDrag is called, whice means state is keeped, drag state should be cleared
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
window.removeEventListener(
|
|
249
|
-
};
|
|
286
|
+
_defineProperty(_assertThisInitialized(_this), "onWindowDragEnd", function (event) {
|
|
287
|
+
_this.onNodeDragEnd(event, null, true);
|
|
288
|
+
window.removeEventListener('dragend', _this.onWindowDragEnd);
|
|
289
|
+
});
|
|
250
290
|
// if onNodeDragEnd is called, onWindowDragEnd won't be called since stopPropagation() is called
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
291
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeDragEnd", function (event, nodeProps) {
|
|
292
|
+
var onDragEnd = _this.props.onDragEnd;
|
|
293
|
+
_this.setState({
|
|
254
294
|
dragOverNodeKey: null
|
|
255
295
|
});
|
|
256
|
-
|
|
257
|
-
onDragEnd
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
296
|
+
_this.cleanDragState();
|
|
297
|
+
onDragEnd === null || onDragEnd === void 0 || onDragEnd({
|
|
298
|
+
event: event,
|
|
299
|
+
node: convertNodePropsToEventData(nodeProps)
|
|
300
|
+
});
|
|
301
|
+
_this.dragNodeProps = null;
|
|
302
|
+
window.removeEventListener('dragend', _this.onWindowDragEnd);
|
|
303
|
+
});
|
|
304
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeDrop", function (event, _) {
|
|
305
|
+
var _this$getActiveItem;
|
|
306
|
+
var outsideTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
307
|
+
var _this$state4 = _this.state,
|
|
308
|
+
dragChildrenKeys = _this$state4.dragChildrenKeys,
|
|
309
|
+
dropPosition = _this$state4.dropPosition,
|
|
310
|
+
dropTargetKey = _this$state4.dropTargetKey,
|
|
311
|
+
dropTargetPos = _this$state4.dropTargetPos,
|
|
312
|
+
dropAllowed = _this$state4.dropAllowed;
|
|
264
313
|
if (!dropAllowed) {
|
|
265
314
|
return;
|
|
266
315
|
}
|
|
267
|
-
|
|
268
|
-
|
|
316
|
+
var onDrop = _this.props.onDrop;
|
|
317
|
+
_this.setState({
|
|
269
318
|
dragOverNodeKey: null
|
|
270
319
|
});
|
|
271
|
-
|
|
320
|
+
_this.cleanDragState();
|
|
272
321
|
if (dropTargetKey === null) {
|
|
273
322
|
return;
|
|
274
323
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
dragNodesKeys: [this.dragNodeProps.eventKey].concat(dragChildrenKeys),
|
|
324
|
+
var abstractDropNodeProps = _objectSpread(_objectSpread({}, getTreeNodeProps(dropTargetKey, _this.getTreeNodeRequiredProps())), {}, {
|
|
325
|
+
active: ((_this$getActiveItem = _this.getActiveItem()) === null || _this$getActiveItem === void 0 ? void 0 : _this$getActiveItem.key) === dropTargetKey,
|
|
326
|
+
data: getEntity(_this.state.keyEntities, dropTargetKey).node
|
|
327
|
+
});
|
|
328
|
+
var dropToChild = dragChildrenKeys.includes(dropTargetKey);
|
|
329
|
+
warning(!dropToChild, 'Can not drop to dragNodes children node. This is a bug of rc-tree. Please report an issue.');
|
|
330
|
+
var posArr = posToArr(dropTargetPos);
|
|
331
|
+
var dropResult = {
|
|
332
|
+
event: event,
|
|
333
|
+
node: convertNodePropsToEventData(abstractDropNodeProps),
|
|
334
|
+
dragNode: _this.dragNodeProps ? convertNodePropsToEventData(_this.dragNodeProps) : null,
|
|
335
|
+
dragNodesKeys: [_this.dragNodeProps.eventKey].concat(dragChildrenKeys),
|
|
288
336
|
dropToGap: dropPosition !== 0,
|
|
289
337
|
dropPosition: dropPosition + Number(posArr[posArr.length - 1])
|
|
290
338
|
};
|
|
291
339
|
if (!outsideTree) {
|
|
292
|
-
onDrop
|
|
340
|
+
onDrop === null || onDrop === void 0 || onDrop(dropResult);
|
|
293
341
|
}
|
|
294
|
-
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
|
|
342
|
+
_this.dragNodeProps = null;
|
|
343
|
+
});
|
|
344
|
+
_defineProperty(_assertThisInitialized(_this), "cleanDragState", function () {
|
|
345
|
+
var draggingNodeKey = _this.state.draggingNodeKey;
|
|
298
346
|
if (draggingNodeKey !== null) {
|
|
299
|
-
|
|
347
|
+
_this.setState({
|
|
300
348
|
draggingNodeKey: null,
|
|
301
349
|
dropPosition: null,
|
|
302
350
|
dropContainerKey: null,
|
|
@@ -306,186 +354,292 @@ var Tree = class extends React.Component {
|
|
|
306
354
|
dragOverNodeKey: null
|
|
307
355
|
});
|
|
308
356
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
357
|
+
_this.dragStartMousePosition = null;
|
|
358
|
+
_this.currentMouseOverDroppableNodeKey = null;
|
|
359
|
+
});
|
|
360
|
+
_defineProperty(_assertThisInitialized(_this), "triggerExpandActionExpand", function (e, treeNode) {
|
|
361
|
+
var _this$state5 = _this.state,
|
|
362
|
+
expandedKeys = _this$state5.expandedKeys,
|
|
363
|
+
flattenNodes = _this$state5.flattenNodes;
|
|
364
|
+
var expanded = treeNode.expanded,
|
|
365
|
+
key = treeNode.key,
|
|
366
|
+
isLeaf = treeNode.isLeaf;
|
|
315
367
|
if (isLeaf || e.shiftKey || e.metaKey || e.ctrlKey) {
|
|
316
368
|
return;
|
|
317
369
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
370
|
+
var node = flattenNodes.filter(function (nodeItem) {
|
|
371
|
+
return nodeItem.key === key;
|
|
372
|
+
})[0];
|
|
373
|
+
var eventNode = convertNodePropsToEventData(_objectSpread(_objectSpread({}, getTreeNodeProps(key, _this.getTreeNodeRequiredProps())), {}, {
|
|
321
374
|
data: node.data
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
375
|
+
}));
|
|
376
|
+
_this.setExpandedKeys(expanded ? arrDel(expandedKeys, key) : arrAdd(expandedKeys, key));
|
|
377
|
+
_this.onNodeExpand(e, eventNode);
|
|
378
|
+
});
|
|
379
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeClick", function (e, treeNode) {
|
|
380
|
+
var _this$props3 = _this.props,
|
|
381
|
+
onClick = _this$props3.onClick,
|
|
382
|
+
expandAction = _this$props3.expandAction;
|
|
383
|
+
if (expandAction === 'click') {
|
|
384
|
+
_this.triggerExpandActionExpand(e, treeNode);
|
|
385
|
+
}
|
|
386
|
+
onClick === null || onClick === void 0 || onClick(e, treeNode);
|
|
387
|
+
});
|
|
388
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeDoubleClick", function (e, treeNode) {
|
|
389
|
+
var _this$props4 = _this.props,
|
|
390
|
+
onDoubleClick = _this$props4.onDoubleClick,
|
|
391
|
+
expandAction = _this$props4.expandAction;
|
|
392
|
+
if (expandAction === 'doubleClick') {
|
|
393
|
+
_this.triggerExpandActionExpand(e, treeNode);
|
|
394
|
+
}
|
|
395
|
+
onDoubleClick === null || onDoubleClick === void 0 || onDoubleClick(e, treeNode);
|
|
396
|
+
});
|
|
397
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeSelect", function (e, treeNode) {
|
|
398
|
+
var selectedKeys = _this.state.selectedKeys;
|
|
399
|
+
var _this$state6 = _this.state,
|
|
400
|
+
keyEntities = _this$state6.keyEntities,
|
|
401
|
+
fieldNames = _this$state6.fieldNames;
|
|
402
|
+
var _this$props5 = _this.props,
|
|
403
|
+
onSelect = _this$props5.onSelect,
|
|
404
|
+
multiple = _this$props5.multiple;
|
|
405
|
+
var selected = treeNode.selected;
|
|
406
|
+
var key = treeNode[fieldNames.key];
|
|
407
|
+
var targetSelected = !selected;
|
|
408
|
+
|
|
409
|
+
// Update selected keys
|
|
347
410
|
if (!targetSelected) {
|
|
348
|
-
selectedKeys =
|
|
411
|
+
selectedKeys = arrDel(selectedKeys, key);
|
|
349
412
|
} else if (!multiple) {
|
|
350
413
|
selectedKeys = [key];
|
|
351
414
|
} else {
|
|
352
|
-
selectedKeys =
|
|
415
|
+
selectedKeys = arrAdd(selectedKeys, key);
|
|
353
416
|
}
|
|
354
|
-
|
|
355
|
-
|
|
417
|
+
|
|
418
|
+
// [Legacy] Not found related usage in doc or upper libs
|
|
419
|
+
var selectedNodes = selectedKeys.map(function (selectedKey) {
|
|
420
|
+
var entity = getEntity(keyEntities, selectedKey);
|
|
356
421
|
return entity ? entity.node : null;
|
|
357
422
|
}).filter(Boolean);
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
423
|
+
_this.setUncontrolledState({
|
|
424
|
+
selectedKeys: selectedKeys
|
|
425
|
+
});
|
|
426
|
+
onSelect === null || onSelect === void 0 || onSelect(selectedKeys, {
|
|
427
|
+
event: 'select',
|
|
361
428
|
selected: targetSelected,
|
|
362
429
|
node: treeNode,
|
|
363
|
-
selectedNodes,
|
|
430
|
+
selectedNodes: selectedNodes,
|
|
364
431
|
nativeEvent: e.nativeEvent
|
|
365
432
|
});
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
433
|
+
});
|
|
434
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeCheck", function (e, treeNode, checked) {
|
|
435
|
+
var _this$state7 = _this.state,
|
|
436
|
+
keyEntities = _this$state7.keyEntities,
|
|
437
|
+
oriCheckedKeys = _this$state7.checkedKeys,
|
|
438
|
+
oriHalfCheckedKeys = _this$state7.halfCheckedKeys;
|
|
439
|
+
var _this$props6 = _this.props,
|
|
440
|
+
checkStrictly = _this$props6.checkStrictly,
|
|
441
|
+
onCheck = _this$props6.onCheck;
|
|
442
|
+
var key = treeNode.key;
|
|
443
|
+
|
|
444
|
+
// Prepare trigger arguments
|
|
445
|
+
var checkedObj;
|
|
446
|
+
var eventObj = {
|
|
447
|
+
event: 'check',
|
|
374
448
|
node: treeNode,
|
|
375
|
-
checked,
|
|
449
|
+
checked: checked,
|
|
376
450
|
nativeEvent: e.nativeEvent
|
|
377
451
|
};
|
|
378
452
|
if (checkStrictly) {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
checkedObj = {
|
|
382
|
-
|
|
383
|
-
|
|
453
|
+
var checkedKeys = checked ? arrAdd(oriCheckedKeys, key) : arrDel(oriCheckedKeys, key);
|
|
454
|
+
var halfCheckedKeys = arrDel(oriHalfCheckedKeys, key);
|
|
455
|
+
checkedObj = {
|
|
456
|
+
checked: checkedKeys,
|
|
457
|
+
halfChecked: halfCheckedKeys
|
|
458
|
+
};
|
|
459
|
+
eventObj.checkedNodes = checkedKeys.map(function (checkedKey) {
|
|
460
|
+
return getEntity(keyEntities, checkedKey);
|
|
461
|
+
}).filter(Boolean).map(function (entity) {
|
|
462
|
+
return entity.node;
|
|
463
|
+
});
|
|
464
|
+
_this.setUncontrolledState({
|
|
465
|
+
checkedKeys: checkedKeys
|
|
466
|
+
});
|
|
384
467
|
} else {
|
|
385
|
-
|
|
468
|
+
// Always fill first
|
|
469
|
+
var _conductCheck = conductCheck([].concat(_toConsumableArray(oriCheckedKeys), [key]), true, keyEntities),
|
|
470
|
+
_checkedKeys = _conductCheck.checkedKeys,
|
|
471
|
+
_halfCheckedKeys = _conductCheck.halfCheckedKeys;
|
|
472
|
+
|
|
473
|
+
// If remove, we do it again to correction
|
|
386
474
|
if (!checked) {
|
|
387
|
-
|
|
475
|
+
var keySet = new Set(_checkedKeys);
|
|
388
476
|
keySet.delete(key);
|
|
389
|
-
|
|
477
|
+
var _conductCheck2 = conductCheck(Array.from(keySet), {
|
|
478
|
+
checked: false,
|
|
479
|
+
halfCheckedKeys: _halfCheckedKeys
|
|
480
|
+
}, keyEntities);
|
|
481
|
+
_checkedKeys = _conductCheck2.checkedKeys;
|
|
482
|
+
_halfCheckedKeys = _conductCheck2.halfCheckedKeys;
|
|
390
483
|
}
|
|
391
|
-
checkedObj =
|
|
484
|
+
checkedObj = _checkedKeys;
|
|
485
|
+
|
|
486
|
+
// [Legacy] This is used for `rc-tree-select`
|
|
392
487
|
eventObj.checkedNodes = [];
|
|
393
488
|
eventObj.checkedNodesPositions = [];
|
|
394
|
-
eventObj.halfCheckedKeys =
|
|
395
|
-
|
|
396
|
-
|
|
489
|
+
eventObj.halfCheckedKeys = _halfCheckedKeys;
|
|
490
|
+
_checkedKeys.forEach(function (checkedKey) {
|
|
491
|
+
var entity = getEntity(keyEntities, checkedKey);
|
|
397
492
|
if (!entity) {
|
|
398
493
|
return;
|
|
399
494
|
}
|
|
400
|
-
|
|
495
|
+
var node = entity.node,
|
|
496
|
+
pos = entity.pos;
|
|
401
497
|
eventObj.checkedNodes.push(node);
|
|
402
|
-
eventObj.checkedNodesPositions.push({
|
|
498
|
+
eventObj.checkedNodesPositions.push({
|
|
499
|
+
node: node,
|
|
500
|
+
pos: pos
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
_this.setUncontrolledState({
|
|
504
|
+
checkedKeys: _checkedKeys
|
|
505
|
+
}, false, {
|
|
506
|
+
halfCheckedKeys: _halfCheckedKeys
|
|
403
507
|
});
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
var
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
508
|
+
}
|
|
509
|
+
onCheck === null || onCheck === void 0 || onCheck(checkedObj, eventObj);
|
|
510
|
+
});
|
|
511
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeLoad", function (treeNode) {
|
|
512
|
+
var _entity$children;
|
|
513
|
+
var key = treeNode.key;
|
|
514
|
+
var keyEntities = _this.state.keyEntities;
|
|
515
|
+
|
|
516
|
+
// Skip if has children already
|
|
517
|
+
var entity = getEntity(keyEntities, key);
|
|
518
|
+
if (entity !== null && entity !== void 0 && (_entity$children = entity.children) !== null && _entity$children !== void 0 && _entity$children.length) {
|
|
414
519
|
return;
|
|
415
520
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
521
|
+
var loadPromise = new Promise(function (resolve, reject) {
|
|
522
|
+
// We need to get the latest state of loading/loaded keys
|
|
523
|
+
_this.setState(function (_ref) {
|
|
524
|
+
var _ref$loadedKeys = _ref.loadedKeys,
|
|
525
|
+
loadedKeys = _ref$loadedKeys === void 0 ? [] : _ref$loadedKeys,
|
|
526
|
+
_ref$loadingKeys = _ref.loadingKeys,
|
|
527
|
+
loadingKeys = _ref$loadingKeys === void 0 ? [] : _ref$loadingKeys;
|
|
528
|
+
var _this$props7 = _this.props,
|
|
529
|
+
loadData = _this$props7.loadData,
|
|
530
|
+
onLoad = _this$props7.onLoad;
|
|
419
531
|
if (!loadData || loadedKeys.includes(key) || loadingKeys.includes(key)) {
|
|
420
532
|
return null;
|
|
421
533
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
534
|
+
|
|
535
|
+
// Process load data
|
|
536
|
+
var promise = loadData(treeNode);
|
|
537
|
+
promise.then(function () {
|
|
538
|
+
var currentLoadedKeys = _this.state.loadedKeys;
|
|
539
|
+
var newLoadedKeys = arrAdd(currentLoadedKeys, key);
|
|
540
|
+
|
|
541
|
+
// onLoad should trigger before internal setState to avoid `loadData` trigger twice.
|
|
542
|
+
// https://github.com/ant-design/ant-design/issues/12464
|
|
543
|
+
onLoad === null || onLoad === void 0 || onLoad(newLoadedKeys, {
|
|
544
|
+
event: 'load',
|
|
428
545
|
node: treeNode
|
|
429
546
|
});
|
|
430
|
-
|
|
547
|
+
_this.setUncontrolledState({
|
|
431
548
|
loadedKeys: newLoadedKeys
|
|
432
549
|
});
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
550
|
+
_this.setState(function (prevState) {
|
|
551
|
+
return {
|
|
552
|
+
loadingKeys: arrDel(prevState.loadingKeys, key)
|
|
553
|
+
};
|
|
554
|
+
});
|
|
436
555
|
resolve();
|
|
437
|
-
}).catch((e)
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
556
|
+
}).catch(function (e) {
|
|
557
|
+
_this.setState(function (prevState) {
|
|
558
|
+
return {
|
|
559
|
+
loadingKeys: arrDel(prevState.loadingKeys, key)
|
|
560
|
+
};
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
// If exceed max retry times, we give up retry
|
|
564
|
+
_this.loadingRetryTimes[key] = (_this.loadingRetryTimes[key] || 0) + 1;
|
|
565
|
+
if (_this.loadingRetryTimes[key] >= MAX_RETRY_TIMES) {
|
|
566
|
+
var currentLoadedKeys = _this.state.loadedKeys;
|
|
567
|
+
warning(false, 'Retry for `loadData` many times but still failed. No more retry.');
|
|
568
|
+
_this.setUncontrolledState({
|
|
569
|
+
loadedKeys: arrAdd(currentLoadedKeys, key)
|
|
447
570
|
});
|
|
448
571
|
resolve();
|
|
449
572
|
}
|
|
450
573
|
reject(e);
|
|
451
574
|
});
|
|
452
575
|
return {
|
|
453
|
-
loadingKeys:
|
|
576
|
+
loadingKeys: arrAdd(loadingKeys, key)
|
|
454
577
|
};
|
|
455
578
|
});
|
|
456
579
|
});
|
|
457
|
-
|
|
580
|
+
|
|
581
|
+
// Not care warning if we ignore this
|
|
582
|
+
loadPromise.catch(function () {
|
|
583
|
+
//
|
|
458
584
|
});
|
|
459
585
|
return loadPromise;
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
onMouseEnter
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
586
|
+
});
|
|
587
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeMouseEnter", function (event, node) {
|
|
588
|
+
var onMouseEnter = _this.props.onMouseEnter;
|
|
589
|
+
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({
|
|
590
|
+
event: event,
|
|
591
|
+
node: node
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeMouseLeave", function (event, node) {
|
|
595
|
+
var onMouseLeave = _this.props.onMouseLeave;
|
|
596
|
+
onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({
|
|
597
|
+
event: event,
|
|
598
|
+
node: node
|
|
599
|
+
});
|
|
600
|
+
});
|
|
601
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeContextMenu", function (event, node) {
|
|
602
|
+
var onRightClick = _this.props.onRightClick;
|
|
471
603
|
if (onRightClick) {
|
|
472
604
|
event.preventDefault();
|
|
473
|
-
onRightClick({
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
605
|
+
onRightClick({
|
|
606
|
+
event: event,
|
|
607
|
+
node: node
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
_defineProperty(_assertThisInitialized(_this), "onFocus", function () {
|
|
612
|
+
var onFocus = _this.props.onFocus;
|
|
613
|
+
_this.setState({
|
|
614
|
+
focused: true
|
|
615
|
+
});
|
|
616
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
617
|
+
args[_key2] = arguments[_key2];
|
|
618
|
+
}
|
|
619
|
+
onFocus === null || onFocus === void 0 || onFocus.apply(void 0, args);
|
|
620
|
+
});
|
|
621
|
+
_defineProperty(_assertThisInitialized(_this), "onBlur", function () {
|
|
622
|
+
var onBlur = _this.props.onBlur;
|
|
623
|
+
_this.setState({
|
|
624
|
+
focused: false
|
|
625
|
+
});
|
|
626
|
+
_this.onActiveChange(null);
|
|
627
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
628
|
+
args[_key3] = arguments[_key3];
|
|
629
|
+
}
|
|
630
|
+
onBlur === null || onBlur === void 0 || onBlur.apply(void 0, args);
|
|
631
|
+
});
|
|
632
|
+
_defineProperty(_assertThisInitialized(_this), "getTreeNodeRequiredProps", function () {
|
|
633
|
+
var _this$state8 = _this.state,
|
|
634
|
+
expandedKeys = _this$state8.expandedKeys,
|
|
635
|
+
selectedKeys = _this$state8.selectedKeys,
|
|
636
|
+
loadedKeys = _this$state8.loadedKeys,
|
|
637
|
+
loadingKeys = _this$state8.loadingKeys,
|
|
638
|
+
checkedKeys = _this$state8.checkedKeys,
|
|
639
|
+
halfCheckedKeys = _this$state8.halfCheckedKeys,
|
|
640
|
+
dragOverNodeKey = _this$state8.dragOverNodeKey,
|
|
641
|
+
dropPosition = _this$state8.dropPosition,
|
|
642
|
+
keyEntities = _this$state8.keyEntities;
|
|
489
643
|
return {
|
|
490
644
|
expandedKeys: expandedKeys || [],
|
|
491
645
|
selectedKeys: selectedKeys || [],
|
|
@@ -493,164 +647,224 @@ var Tree = class extends React.Component {
|
|
|
493
647
|
loadingKeys: loadingKeys || [],
|
|
494
648
|
checkedKeys: checkedKeys || [],
|
|
495
649
|
halfCheckedKeys: halfCheckedKeys || [],
|
|
496
|
-
dragOverNodeKey,
|
|
497
|
-
dropPosition,
|
|
498
|
-
keyEntities
|
|
650
|
+
dragOverNodeKey: dragOverNodeKey,
|
|
651
|
+
dropPosition: dropPosition,
|
|
652
|
+
keyEntities: keyEntities
|
|
499
653
|
};
|
|
500
|
-
};
|
|
654
|
+
});
|
|
501
655
|
// =========================== Expanded ===========================
|
|
502
656
|
/** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
657
|
+
_defineProperty(_assertThisInitialized(_this), "setExpandedKeys", function (expandedKeys) {
|
|
658
|
+
var _this$state9 = _this.state,
|
|
659
|
+
treeData = _this$state9.treeData,
|
|
660
|
+
fieldNames = _this$state9.fieldNames;
|
|
661
|
+
var flattenNodes = flattenTreeData(treeData, expandedKeys, fieldNames);
|
|
662
|
+
_this.setUncontrolledState({
|
|
663
|
+
expandedKeys: expandedKeys,
|
|
664
|
+
flattenNodes: flattenNodes
|
|
665
|
+
}, true);
|
|
666
|
+
});
|
|
667
|
+
_defineProperty(_assertThisInitialized(_this), "onNodeExpand", function (e, treeNode) {
|
|
668
|
+
var expandedKeys = _this.state.expandedKeys;
|
|
669
|
+
var _this$state10 = _this.state,
|
|
670
|
+
listChanging = _this$state10.listChanging,
|
|
671
|
+
fieldNames = _this$state10.fieldNames;
|
|
672
|
+
var _this$props8 = _this.props,
|
|
673
|
+
onExpand = _this$props8.onExpand,
|
|
674
|
+
loadData = _this$props8.loadData;
|
|
675
|
+
var expanded = treeNode.expanded;
|
|
676
|
+
var key = treeNode[fieldNames.key];
|
|
677
|
+
|
|
678
|
+
// Do nothing when motion is in progress
|
|
514
679
|
if (listChanging) {
|
|
515
680
|
return;
|
|
516
681
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
682
|
+
|
|
683
|
+
// Update selected keys
|
|
684
|
+
var certain = expandedKeys.includes(key);
|
|
685
|
+
var targetExpanded = !expanded;
|
|
686
|
+
warning(expanded && certain || !expanded && !certain, 'Expand state not sync with index check');
|
|
687
|
+
expandedKeys = targetExpanded ? arrAdd(expandedKeys, key) : arrDel(expandedKeys, key);
|
|
688
|
+
_this.setExpandedKeys(expandedKeys);
|
|
689
|
+
onExpand === null || onExpand === void 0 || onExpand(expandedKeys, {
|
|
523
690
|
node: treeNode,
|
|
524
691
|
expanded: targetExpanded,
|
|
525
692
|
nativeEvent: e.nativeEvent
|
|
526
693
|
});
|
|
694
|
+
|
|
695
|
+
// Async Load data
|
|
527
696
|
if (targetExpanded && loadData) {
|
|
528
|
-
|
|
697
|
+
var loadPromise = _this.onNodeLoad(treeNode);
|
|
529
698
|
if (loadPromise) {
|
|
530
|
-
loadPromise.then(()
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
699
|
+
loadPromise.then(function () {
|
|
700
|
+
// [Legacy] Refresh logic
|
|
701
|
+
var newFlattenTreeData = flattenTreeData(_this.state.treeData, expandedKeys, fieldNames);
|
|
702
|
+
_this.setUncontrolledState({
|
|
703
|
+
flattenNodes: newFlattenTreeData
|
|
704
|
+
});
|
|
705
|
+
}).catch(function () {
|
|
706
|
+
var currentExpandedKeys = _this.state.expandedKeys;
|
|
707
|
+
var expandedKeysToRestore = arrDel(currentExpandedKeys, key);
|
|
708
|
+
_this.setExpandedKeys(expandedKeysToRestore);
|
|
537
709
|
});
|
|
538
710
|
}
|
|
539
711
|
}
|
|
540
|
-
};
|
|
541
|
-
|
|
542
|
-
|
|
712
|
+
});
|
|
713
|
+
_defineProperty(_assertThisInitialized(_this), "onListChangeStart", function () {
|
|
714
|
+
_this.setUncontrolledState({
|
|
543
715
|
listChanging: true
|
|
544
716
|
});
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
setTimeout(()
|
|
548
|
-
|
|
717
|
+
});
|
|
718
|
+
_defineProperty(_assertThisInitialized(_this), "onListChangeEnd", function () {
|
|
719
|
+
setTimeout(function () {
|
|
720
|
+
_this.setUncontrolledState({
|
|
549
721
|
listChanging: false
|
|
550
722
|
});
|
|
551
723
|
});
|
|
552
|
-
};
|
|
724
|
+
});
|
|
553
725
|
// =========================== Keyboard ===========================
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
726
|
+
_defineProperty(_assertThisInitialized(_this), "onActiveChange", function (newActiveKey) {
|
|
727
|
+
var activeKey = _this.state.activeKey;
|
|
728
|
+
var _this$props9 = _this.props,
|
|
729
|
+
onActiveChange = _this$props9.onActiveChange,
|
|
730
|
+
_this$props9$itemScro = _this$props9.itemScrollOffset,
|
|
731
|
+
itemScrollOffset = _this$props9$itemScro === void 0 ? 0 : _this$props9$itemScro;
|
|
557
732
|
if (activeKey === newActiveKey) {
|
|
558
733
|
return;
|
|
559
734
|
}
|
|
560
|
-
|
|
735
|
+
_this.setState({
|
|
736
|
+
activeKey: newActiveKey
|
|
737
|
+
});
|
|
561
738
|
if (newActiveKey !== null) {
|
|
562
|
-
|
|
739
|
+
_this.scrollTo({
|
|
740
|
+
key: newActiveKey,
|
|
741
|
+
offset: itemScrollOffset
|
|
742
|
+
});
|
|
563
743
|
}
|
|
564
|
-
onActiveChange
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
|
|
744
|
+
onActiveChange === null || onActiveChange === void 0 || onActiveChange(newActiveKey);
|
|
745
|
+
});
|
|
746
|
+
_defineProperty(_assertThisInitialized(_this), "getActiveItem", function () {
|
|
747
|
+
var _this$state11 = _this.state,
|
|
748
|
+
activeKey = _this$state11.activeKey,
|
|
749
|
+
flattenNodes = _this$state11.flattenNodes;
|
|
568
750
|
if (activeKey === null) {
|
|
569
751
|
return null;
|
|
570
752
|
}
|
|
571
|
-
return flattenNodes.find((
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
753
|
+
return flattenNodes.find(function (_ref2) {
|
|
754
|
+
var key = _ref2.key;
|
|
755
|
+
return key === activeKey;
|
|
756
|
+
}) || null;
|
|
757
|
+
});
|
|
758
|
+
_defineProperty(_assertThisInitialized(_this), "offsetActiveKey", function (offset) {
|
|
759
|
+
var _this$state12 = _this.state,
|
|
760
|
+
flattenNodes = _this$state12.flattenNodes,
|
|
761
|
+
activeKey = _this$state12.activeKey;
|
|
762
|
+
var index = flattenNodes.findIndex(function (_ref3) {
|
|
763
|
+
var key = _ref3.key;
|
|
764
|
+
return key === activeKey;
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
// Align with index
|
|
576
768
|
if (index === -1 && offset < 0) {
|
|
577
769
|
index = flattenNodes.length;
|
|
578
770
|
}
|
|
579
771
|
index = (index + offset + flattenNodes.length) % flattenNodes.length;
|
|
580
|
-
|
|
772
|
+
var item = flattenNodes[index];
|
|
581
773
|
if (item) {
|
|
582
|
-
|
|
583
|
-
|
|
774
|
+
var _key4 = item.key;
|
|
775
|
+
_this.onActiveChange(_key4);
|
|
584
776
|
} else {
|
|
585
|
-
|
|
777
|
+
_this.onActiveChange(null);
|
|
586
778
|
}
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
779
|
+
});
|
|
780
|
+
_defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
|
|
781
|
+
var _this$state13 = _this.state,
|
|
782
|
+
activeKey = _this$state13.activeKey,
|
|
783
|
+
expandedKeys = _this$state13.expandedKeys,
|
|
784
|
+
checkedKeys = _this$state13.checkedKeys,
|
|
785
|
+
fieldNames = _this$state13.fieldNames;
|
|
786
|
+
var _this$props10 = _this.props,
|
|
787
|
+
onKeyDown = _this$props10.onKeyDown,
|
|
788
|
+
checkable = _this$props10.checkable,
|
|
789
|
+
selectable = _this$props10.selectable;
|
|
790
|
+
|
|
791
|
+
// >>>>>>>>>> Direction
|
|
591
792
|
switch (event.which) {
|
|
592
|
-
case
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
793
|
+
case KeyCode.UP:
|
|
794
|
+
{
|
|
795
|
+
_this.offsetActiveKey(-1);
|
|
796
|
+
event.preventDefault();
|
|
797
|
+
break;
|
|
798
|
+
}
|
|
799
|
+
case KeyCode.DOWN:
|
|
800
|
+
{
|
|
801
|
+
_this.offsetActiveKey(1);
|
|
802
|
+
event.preventDefault();
|
|
803
|
+
break;
|
|
804
|
+
}
|
|
602
805
|
}
|
|
603
|
-
|
|
806
|
+
|
|
807
|
+
// >>>>>>>>>> Expand & Selection
|
|
808
|
+
var activeItem = _this.getActiveItem();
|
|
604
809
|
if (activeItem && activeItem.data) {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
...(0, import_treeUtil.getTreeNodeProps)(activeKey, treeNodeRequiredProps),
|
|
810
|
+
var treeNodeRequiredProps = _this.getTreeNodeRequiredProps();
|
|
811
|
+
var expandable = activeItem.data.isLeaf === false || !!(activeItem.data[fieldNames.children] || []).length;
|
|
812
|
+
var eventNode = convertNodePropsToEventData(_objectSpread(_objectSpread({}, getTreeNodeProps(activeKey, treeNodeRequiredProps)), {}, {
|
|
609
813
|
data: activeItem.data,
|
|
610
814
|
active: true
|
|
611
|
-
});
|
|
815
|
+
}));
|
|
612
816
|
switch (event.which) {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
817
|
+
// >>> Expand
|
|
818
|
+
case KeyCode.LEFT:
|
|
819
|
+
{
|
|
820
|
+
// Collapse if possible
|
|
821
|
+
if (expandable && expandedKeys.includes(activeKey)) {
|
|
822
|
+
_this.onNodeExpand({}, eventNode);
|
|
823
|
+
} else if (activeItem.parent) {
|
|
824
|
+
_this.onActiveChange(activeItem.parent.key);
|
|
825
|
+
}
|
|
826
|
+
event.preventDefault();
|
|
827
|
+
break;
|
|
618
828
|
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
829
|
+
case KeyCode.RIGHT:
|
|
830
|
+
{
|
|
831
|
+
// Expand if possible
|
|
832
|
+
if (expandable && !expandedKeys.includes(activeKey)) {
|
|
833
|
+
_this.onNodeExpand({}, eventNode);
|
|
834
|
+
} else if (activeItem.children && activeItem.children.length) {
|
|
835
|
+
_this.onActiveChange(activeItem.children[0].key);
|
|
836
|
+
}
|
|
837
|
+
event.preventDefault();
|
|
838
|
+
break;
|
|
627
839
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
case
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
840
|
+
|
|
841
|
+
// Selection
|
|
842
|
+
case KeyCode.ENTER:
|
|
843
|
+
case KeyCode.SPACE:
|
|
844
|
+
{
|
|
845
|
+
if (checkable && !eventNode.disabled && eventNode.checkable !== false && !eventNode.disableCheckbox) {
|
|
846
|
+
_this.onNodeCheck({}, eventNode, !checkedKeys.includes(activeKey));
|
|
847
|
+
} else if (!checkable && selectable && !eventNode.disabled && eventNode.selectable !== false) {
|
|
848
|
+
_this.onNodeSelect({}, eventNode);
|
|
849
|
+
}
|
|
850
|
+
break;
|
|
637
851
|
}
|
|
638
|
-
break;
|
|
639
|
-
}
|
|
640
852
|
}
|
|
641
853
|
}
|
|
642
|
-
onKeyDown
|
|
643
|
-
};
|
|
644
|
-
/**
|
|
645
|
-
* Only update the value which is not in props
|
|
854
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
|
|
855
|
+
});
|
|
856
|
+
/**
|
|
857
|
+
* Only update the value which is not in props
|
|
646
858
|
*/
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
859
|
+
_defineProperty(_assertThisInitialized(_this), "setUncontrolledState", function (state) {
|
|
860
|
+
var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
861
|
+
var forceState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
862
|
+
if (!_this.destroyed) {
|
|
863
|
+
var needSync = false;
|
|
864
|
+
var allPassed = true;
|
|
865
|
+
var newState = {};
|
|
866
|
+
Object.keys(state).forEach(function (name) {
|
|
867
|
+
if (Object.prototype.hasOwnProperty.call(_this.props, name)) {
|
|
654
868
|
allPassed = false;
|
|
655
869
|
return;
|
|
656
870
|
}
|
|
@@ -658,275 +872,326 @@ var Tree = class extends React.Component {
|
|
|
658
872
|
newState[name] = state[name];
|
|
659
873
|
});
|
|
660
874
|
if (needSync && (!atomic || allPassed)) {
|
|
661
|
-
|
|
662
|
-
...newState,
|
|
663
|
-
...forceState
|
|
664
|
-
});
|
|
875
|
+
_this.setState(_objectSpread(_objectSpread({}, newState), forceState));
|
|
665
876
|
}
|
|
666
877
|
}
|
|
667
|
-
};
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
};
|
|
671
|
-
|
|
672
|
-
componentDidMount() {
|
|
673
|
-
this.destroyed = false;
|
|
674
|
-
this.onUpdated();
|
|
675
|
-
}
|
|
676
|
-
componentDidUpdate() {
|
|
677
|
-
this.onUpdated();
|
|
878
|
+
});
|
|
879
|
+
_defineProperty(_assertThisInitialized(_this), "scrollTo", function (scroll) {
|
|
880
|
+
_this.listRef.current.scrollTo(scroll);
|
|
881
|
+
});
|
|
882
|
+
return _this;
|
|
678
883
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
this.
|
|
683
|
-
|
|
684
|
-
|
|
884
|
+
_createClass(Tree, [{
|
|
885
|
+
key: "componentDidMount",
|
|
886
|
+
value: function componentDidMount() {
|
|
887
|
+
this.destroyed = false;
|
|
888
|
+
this.onUpdated();
|
|
889
|
+
}
|
|
890
|
+
}, {
|
|
891
|
+
key: "componentDidUpdate",
|
|
892
|
+
value: function componentDidUpdate() {
|
|
893
|
+
this.onUpdated();
|
|
894
|
+
}
|
|
895
|
+
}, {
|
|
896
|
+
key: "onUpdated",
|
|
897
|
+
value: function onUpdated() {
|
|
898
|
+
var _this$props11 = this.props,
|
|
899
|
+
activeKey = _this$props11.activeKey,
|
|
900
|
+
_this$props11$itemScr = _this$props11.itemScrollOffset,
|
|
901
|
+
itemScrollOffset = _this$props11$itemScr === void 0 ? 0 : _this$props11$itemScr;
|
|
902
|
+
if (activeKey !== undefined && activeKey !== this.state.activeKey) {
|
|
903
|
+
this.setState({
|
|
904
|
+
activeKey: activeKey
|
|
905
|
+
});
|
|
906
|
+
if (activeKey !== null) {
|
|
907
|
+
this.scrollTo({
|
|
908
|
+
key: activeKey,
|
|
909
|
+
offset: itemScrollOffset
|
|
910
|
+
});
|
|
911
|
+
}
|
|
685
912
|
}
|
|
686
913
|
}
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
static getDerivedStateFromProps(props, prevState) {
|
|
693
|
-
const { prevProps } = prevState;
|
|
694
|
-
const newState = {
|
|
695
|
-
prevProps: props
|
|
696
|
-
};
|
|
697
|
-
function needSync(name) {
|
|
698
|
-
return !prevProps && Object.prototype.hasOwnProperty.call(props, name) || prevProps && prevProps[name] !== props[name];
|
|
914
|
+
}, {
|
|
915
|
+
key: "componentWillUnmount",
|
|
916
|
+
value: function componentWillUnmount() {
|
|
917
|
+
window.removeEventListener('dragend', this.onWindowDragEnd);
|
|
918
|
+
this.destroyed = true;
|
|
699
919
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
920
|
+
}, {
|
|
921
|
+
key: "resetDragState",
|
|
922
|
+
value: function resetDragState() {
|
|
923
|
+
this.setState({
|
|
924
|
+
dragOverNodeKey: null,
|
|
925
|
+
dropPosition: null,
|
|
926
|
+
dropLevelOffset: null,
|
|
927
|
+
dropTargetKey: null,
|
|
928
|
+
dropContainerKey: null,
|
|
929
|
+
dropTargetPos: null,
|
|
930
|
+
dropAllowed: false
|
|
931
|
+
});
|
|
705
932
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
933
|
+
}, {
|
|
934
|
+
key: "render",
|
|
935
|
+
value: function render() {
|
|
936
|
+
var _this$state14 = this.state,
|
|
937
|
+
focused = _this$state14.focused,
|
|
938
|
+
flattenNodes = _this$state14.flattenNodes,
|
|
939
|
+
keyEntities = _this$state14.keyEntities,
|
|
940
|
+
draggingNodeKey = _this$state14.draggingNodeKey,
|
|
941
|
+
activeKey = _this$state14.activeKey,
|
|
942
|
+
dropLevelOffset = _this$state14.dropLevelOffset,
|
|
943
|
+
dropContainerKey = _this$state14.dropContainerKey,
|
|
944
|
+
dropTargetKey = _this$state14.dropTargetKey,
|
|
945
|
+
dropPosition = _this$state14.dropPosition,
|
|
946
|
+
dragOverNodeKey = _this$state14.dragOverNodeKey,
|
|
947
|
+
indent = _this$state14.indent;
|
|
948
|
+
var _this$props12 = this.props,
|
|
949
|
+
prefixCls = _this$props12.prefixCls,
|
|
950
|
+
className = _this$props12.className,
|
|
951
|
+
style = _this$props12.style,
|
|
952
|
+
styles = _this$props12.styles,
|
|
953
|
+
treeClassNames = _this$props12.classNames,
|
|
954
|
+
showLine = _this$props12.showLine,
|
|
955
|
+
focusable = _this$props12.focusable,
|
|
956
|
+
_this$props12$tabInde = _this$props12.tabIndex,
|
|
957
|
+
tabIndex = _this$props12$tabInde === void 0 ? 0 : _this$props12$tabInde,
|
|
958
|
+
selectable = _this$props12.selectable,
|
|
959
|
+
showIcon = _this$props12.showIcon,
|
|
960
|
+
icon = _this$props12.icon,
|
|
961
|
+
switcherIcon = _this$props12.switcherIcon,
|
|
962
|
+
draggable = _this$props12.draggable,
|
|
963
|
+
checkable = _this$props12.checkable,
|
|
964
|
+
checkStrictly = _this$props12.checkStrictly,
|
|
965
|
+
disabled = _this$props12.disabled,
|
|
966
|
+
motion = _this$props12.motion,
|
|
967
|
+
loadData = _this$props12.loadData,
|
|
968
|
+
filterTreeNode = _this$props12.filterTreeNode,
|
|
969
|
+
height = _this$props12.height,
|
|
970
|
+
itemHeight = _this$props12.itemHeight,
|
|
971
|
+
scrollWidth = _this$props12.scrollWidth,
|
|
972
|
+
virtual = _this$props12.virtual,
|
|
973
|
+
titleRender = _this$props12.titleRender,
|
|
974
|
+
dropIndicatorRender = _this$props12.dropIndicatorRender,
|
|
975
|
+
onContextMenu = _this$props12.onContextMenu,
|
|
976
|
+
onScroll = _this$props12.onScroll,
|
|
977
|
+
direction = _this$props12.direction,
|
|
978
|
+
rootClassName = _this$props12.rootClassName,
|
|
979
|
+
rootStyle = _this$props12.rootStyle;
|
|
980
|
+
var domProps = pickAttrs(this.props, {
|
|
981
|
+
aria: true,
|
|
982
|
+
data: true
|
|
983
|
+
});
|
|
984
|
+
|
|
985
|
+
// It's better move to hooks but we just simply keep here
|
|
986
|
+
var draggableConfig;
|
|
987
|
+
if (draggable) {
|
|
988
|
+
if (_typeof(draggable) === 'object') {
|
|
989
|
+
draggableConfig = draggable;
|
|
990
|
+
} else if (typeof draggable === 'function') {
|
|
991
|
+
draggableConfig = {
|
|
992
|
+
nodeDraggable: draggable
|
|
993
|
+
};
|
|
994
|
+
} else {
|
|
995
|
+
draggableConfig = {};
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
var contextValue = {
|
|
999
|
+
styles: styles,
|
|
1000
|
+
classNames: treeClassNames,
|
|
1001
|
+
prefixCls: prefixCls,
|
|
1002
|
+
selectable: selectable,
|
|
1003
|
+
showIcon: showIcon,
|
|
1004
|
+
icon: icon,
|
|
1005
|
+
switcherIcon: switcherIcon,
|
|
1006
|
+
draggable: draggableConfig,
|
|
1007
|
+
draggingNodeKey: draggingNodeKey,
|
|
1008
|
+
checkable: checkable,
|
|
1009
|
+
checkStrictly: checkStrictly,
|
|
1010
|
+
disabled: disabled,
|
|
1011
|
+
keyEntities: keyEntities,
|
|
1012
|
+
dropLevelOffset: dropLevelOffset,
|
|
1013
|
+
dropContainerKey: dropContainerKey,
|
|
1014
|
+
dropTargetKey: dropTargetKey,
|
|
1015
|
+
dropPosition: dropPosition,
|
|
1016
|
+
dragOverNodeKey: dragOverNodeKey,
|
|
1017
|
+
indent: indent,
|
|
1018
|
+
direction: direction,
|
|
1019
|
+
dropIndicatorRender: dropIndicatorRender,
|
|
1020
|
+
loadData: loadData,
|
|
1021
|
+
filterTreeNode: filterTreeNode,
|
|
1022
|
+
titleRender: titleRender,
|
|
1023
|
+
onNodeClick: this.onNodeClick,
|
|
1024
|
+
onNodeDoubleClick: this.onNodeDoubleClick,
|
|
1025
|
+
onNodeExpand: this.onNodeExpand,
|
|
1026
|
+
onNodeSelect: this.onNodeSelect,
|
|
1027
|
+
onNodeCheck: this.onNodeCheck,
|
|
1028
|
+
onNodeLoad: this.onNodeLoad,
|
|
1029
|
+
onNodeMouseEnter: this.onNodeMouseEnter,
|
|
1030
|
+
onNodeMouseLeave: this.onNodeMouseLeave,
|
|
1031
|
+
onNodeContextMenu: this.onNodeContextMenu,
|
|
1032
|
+
onNodeDragStart: this.onNodeDragStart,
|
|
1033
|
+
onNodeDragEnter: this.onNodeDragEnter,
|
|
1034
|
+
onNodeDragOver: this.onNodeDragOver,
|
|
1035
|
+
onNodeDragLeave: this.onNodeDragLeave,
|
|
1036
|
+
onNodeDragEnd: this.onNodeDragEnd,
|
|
1037
|
+
onNodeDrop: this.onNodeDrop
|
|
1038
|
+
};
|
|
1039
|
+
return /*#__PURE__*/React.createElement(TreeContext.Provider, {
|
|
1040
|
+
value: contextValue
|
|
1041
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1042
|
+
className: classNames(prefixCls, className, rootClassName, _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-show-line"), showLine), "".concat(prefixCls, "-focused"), focused), "".concat(prefixCls, "-active-focused"), activeKey !== null)),
|
|
1043
|
+
style: rootStyle
|
|
1044
|
+
}, /*#__PURE__*/React.createElement(NodeList, _extends({
|
|
1045
|
+
ref: this.listRef,
|
|
1046
|
+
prefixCls: prefixCls,
|
|
1047
|
+
style: style,
|
|
1048
|
+
data: flattenNodes,
|
|
1049
|
+
disabled: disabled,
|
|
1050
|
+
selectable: selectable,
|
|
1051
|
+
checkable: !!checkable,
|
|
1052
|
+
motion: motion,
|
|
1053
|
+
dragging: draggingNodeKey !== null,
|
|
1054
|
+
height: height,
|
|
1055
|
+
itemHeight: itemHeight,
|
|
1056
|
+
virtual: virtual,
|
|
1057
|
+
focusable: focusable,
|
|
1058
|
+
focused: focused,
|
|
1059
|
+
tabIndex: tabIndex,
|
|
1060
|
+
activeItem: this.getActiveItem(),
|
|
1061
|
+
onFocus: this.onFocus,
|
|
1062
|
+
onBlur: this.onBlur,
|
|
1063
|
+
onKeyDown: this.onKeyDown,
|
|
1064
|
+
onActiveChange: this.onActiveChange,
|
|
1065
|
+
onListChangeStart: this.onListChangeStart,
|
|
1066
|
+
onListChangeEnd: this.onListChangeEnd,
|
|
1067
|
+
onContextMenu: onContextMenu,
|
|
1068
|
+
onScroll: onScroll,
|
|
1069
|
+
scrollWidth: scrollWidth
|
|
1070
|
+
}, this.getTreeNodeRequiredProps(), domProps))));
|
|
711
1071
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
1072
|
+
}], [{
|
|
1073
|
+
key: "getDerivedStateFromProps",
|
|
1074
|
+
value: function getDerivedStateFromProps(props, prevState) {
|
|
1075
|
+
var prevProps = prevState.prevProps;
|
|
1076
|
+
var newState = {
|
|
1077
|
+
prevProps: props
|
|
718
1078
|
};
|
|
719
|
-
|
|
720
|
-
|
|
1079
|
+
function needSync(name) {
|
|
1080
|
+
return !prevProps && Object.prototype.hasOwnProperty.call(props, name) || prevProps && prevProps[name] !== props[name];
|
|
721
1081
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
1082
|
+
|
|
1083
|
+
// ================== Tree Node ==================
|
|
1084
|
+
var treeData;
|
|
1085
|
+
|
|
1086
|
+
// fieldNames
|
|
1087
|
+
var fieldNames = prevState.fieldNames;
|
|
1088
|
+
if (needSync('fieldNames')) {
|
|
1089
|
+
fieldNames = fillFieldNames(props.fieldNames);
|
|
1090
|
+
newState.fieldNames = fieldNames;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
// Check if `treeData` or `children` changed and save into the state.
|
|
1094
|
+
if (needSync('treeData')) {
|
|
1095
|
+
treeData = props.treeData;
|
|
1096
|
+
} else if (needSync('children')) {
|
|
1097
|
+
warning(false, '`children` of Tree is deprecated. Please use `treeData` instead.');
|
|
1098
|
+
treeData = convertTreeToData(props.children);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
// Save flatten nodes info and convert `treeData` into keyEntities
|
|
1102
|
+
if (treeData) {
|
|
1103
|
+
newState.treeData = treeData;
|
|
1104
|
+
var entitiesMap = convertDataToEntities(treeData, {
|
|
1105
|
+
fieldNames: fieldNames
|
|
1106
|
+
});
|
|
1107
|
+
newState.keyEntities = _objectSpread(_defineProperty({}, MOTION_KEY, MotionEntity), entitiesMap.keyEntities);
|
|
1108
|
+
|
|
1109
|
+
// Warning if treeNode not provide key
|
|
1110
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1111
|
+
warningWithoutKey(treeData, fieldNames);
|
|
734
1112
|
}
|
|
735
|
-
});
|
|
736
|
-
newState.expandedKeys = nextExpandedKeys;
|
|
737
|
-
} else if (!prevProps && props.defaultExpandedKeys) {
|
|
738
|
-
newState.expandedKeys = props.autoExpandParent || props.defaultExpandParent ? (0, import_util.conductExpandParent)(props.defaultExpandedKeys, keyEntities) : props.defaultExpandedKeys;
|
|
739
|
-
}
|
|
740
|
-
if (!newState.expandedKeys) {
|
|
741
|
-
delete newState.expandedKeys;
|
|
742
|
-
}
|
|
743
|
-
if (treeData || newState.expandedKeys) {
|
|
744
|
-
const flattenNodes = (0, import_treeUtil.flattenTreeData)(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, fieldNames);
|
|
745
|
-
newState.flattenNodes = flattenNodes;
|
|
746
|
-
}
|
|
747
|
-
if (props.selectable) {
|
|
748
|
-
if (needSync("selectedKeys")) {
|
|
749
|
-
newState.selectedKeys = (0, import_util.calcSelectedKeys)(props.selectedKeys, props);
|
|
750
|
-
} else if (!prevProps && props.defaultSelectedKeys) {
|
|
751
|
-
newState.selectedKeys = (0, import_util.calcSelectedKeys)(props.defaultSelectedKeys, props);
|
|
752
1113
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
if (needSync(
|
|
757
|
-
|
|
758
|
-
} else if (!prevProps && props.
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
1114
|
+
var keyEntities = newState.keyEntities || prevState.keyEntities;
|
|
1115
|
+
|
|
1116
|
+
// ================ expandedKeys =================
|
|
1117
|
+
if (needSync('expandedKeys') || prevProps && needSync('autoExpandParent')) {
|
|
1118
|
+
newState.expandedKeys = props.autoExpandParent || !prevProps && props.defaultExpandParent ? conductExpandParent(props.expandedKeys, keyEntities) : props.expandedKeys;
|
|
1119
|
+
} else if (!prevProps && props.defaultExpandAll) {
|
|
1120
|
+
var cloneKeyEntities = _objectSpread({}, keyEntities);
|
|
1121
|
+
delete cloneKeyEntities[MOTION_KEY];
|
|
1122
|
+
|
|
1123
|
+
// Only take the key who has the children to enhance the performance
|
|
1124
|
+
var nextExpandedKeys = [];
|
|
1125
|
+
Object.keys(cloneKeyEntities).forEach(function (key) {
|
|
1126
|
+
var entity = cloneKeyEntities[key];
|
|
1127
|
+
if (entity.children && entity.children.length) {
|
|
1128
|
+
nextExpandedKeys.push(entity.key);
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
newState.expandedKeys = nextExpandedKeys;
|
|
1132
|
+
} else if (!prevProps && props.defaultExpandedKeys) {
|
|
1133
|
+
newState.expandedKeys = props.autoExpandParent || props.defaultExpandParent ? conductExpandParent(props.defaultExpandedKeys, keyEntities) : props.defaultExpandedKeys;
|
|
1134
|
+
}
|
|
1135
|
+
if (!newState.expandedKeys) {
|
|
1136
|
+
delete newState.expandedKeys;
|
|
765
1137
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
1138
|
+
|
|
1139
|
+
// ================ flattenNodes =================
|
|
1140
|
+
if (treeData || newState.expandedKeys) {
|
|
1141
|
+
var flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, fieldNames);
|
|
1142
|
+
newState.flattenNodes = flattenNodes;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
// ================ selectedKeys =================
|
|
1146
|
+
if (props.selectable) {
|
|
1147
|
+
if (needSync('selectedKeys')) {
|
|
1148
|
+
newState.selectedKeys = calcSelectedKeys(props.selectedKeys, props);
|
|
1149
|
+
} else if (!prevProps && props.defaultSelectedKeys) {
|
|
1150
|
+
newState.selectedKeys = calcSelectedKeys(props.defaultSelectedKeys, props);
|
|
771
1151
|
}
|
|
772
|
-
newState.checkedKeys = checkedKeys;
|
|
773
|
-
newState.halfCheckedKeys = halfCheckedKeys;
|
|
774
1152
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
showIcon,
|
|
805
|
-
icon,
|
|
806
|
-
switcherIcon,
|
|
807
|
-
draggable,
|
|
808
|
-
checkable,
|
|
809
|
-
checkStrictly,
|
|
810
|
-
disabled,
|
|
811
|
-
motion,
|
|
812
|
-
loadData,
|
|
813
|
-
filterTreeNode,
|
|
814
|
-
height,
|
|
815
|
-
itemHeight,
|
|
816
|
-
scrollWidth,
|
|
817
|
-
virtual,
|
|
818
|
-
titleRender,
|
|
819
|
-
dropIndicatorRender,
|
|
820
|
-
onContextMenu,
|
|
821
|
-
onScroll,
|
|
822
|
-
direction,
|
|
823
|
-
rootClassName,
|
|
824
|
-
rootStyle
|
|
825
|
-
} = this.props;
|
|
826
|
-
const domProps = (0, import_pickAttrs.default)(this.props, {
|
|
827
|
-
aria: true,
|
|
828
|
-
data: true
|
|
829
|
-
});
|
|
830
|
-
let draggableConfig;
|
|
831
|
-
if (draggable) {
|
|
832
|
-
if (typeof draggable === "object") {
|
|
833
|
-
draggableConfig = draggable;
|
|
834
|
-
} else if (typeof draggable === "function") {
|
|
835
|
-
draggableConfig = {
|
|
836
|
-
nodeDraggable: draggable
|
|
837
|
-
};
|
|
838
|
-
} else {
|
|
839
|
-
draggableConfig = {};
|
|
1153
|
+
|
|
1154
|
+
// ================= checkedKeys =================
|
|
1155
|
+
if (props.checkable) {
|
|
1156
|
+
var checkedKeyEntity;
|
|
1157
|
+
if (needSync('checkedKeys')) {
|
|
1158
|
+
checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {};
|
|
1159
|
+
} else if (!prevProps && props.defaultCheckedKeys) {
|
|
1160
|
+
checkedKeyEntity = parseCheckedKeys(props.defaultCheckedKeys) || {};
|
|
1161
|
+
} else if (treeData) {
|
|
1162
|
+
// If `treeData` changed, we also need check it
|
|
1163
|
+
checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {
|
|
1164
|
+
checkedKeys: prevState.checkedKeys,
|
|
1165
|
+
halfCheckedKeys: prevState.halfCheckedKeys
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
if (checkedKeyEntity) {
|
|
1169
|
+
var _checkedKeyEntity = checkedKeyEntity,
|
|
1170
|
+
_checkedKeyEntity$che = _checkedKeyEntity.checkedKeys,
|
|
1171
|
+
checkedKeys = _checkedKeyEntity$che === void 0 ? [] : _checkedKeyEntity$che,
|
|
1172
|
+
_checkedKeyEntity$hal = _checkedKeyEntity.halfCheckedKeys,
|
|
1173
|
+
halfCheckedKeys = _checkedKeyEntity$hal === void 0 ? [] : _checkedKeyEntity$hal;
|
|
1174
|
+
if (!props.checkStrictly) {
|
|
1175
|
+
var conductKeys = conductCheck(checkedKeys, true, keyEntities);
|
|
1176
|
+
checkedKeys = conductKeys.checkedKeys;
|
|
1177
|
+
halfCheckedKeys = conductKeys.halfCheckedKeys;
|
|
1178
|
+
}
|
|
1179
|
+
newState.checkedKeys = checkedKeys;
|
|
1180
|
+
newState.halfCheckedKeys = halfCheckedKeys;
|
|
1181
|
+
}
|
|
840
1182
|
}
|
|
1183
|
+
|
|
1184
|
+
// ================= loadedKeys ==================
|
|
1185
|
+
if (needSync('loadedKeys')) {
|
|
1186
|
+
newState.loadedKeys = props.loadedKeys;
|
|
1187
|
+
}
|
|
1188
|
+
return newState;
|
|
841
1189
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
showIcon,
|
|
848
|
-
icon,
|
|
849
|
-
switcherIcon,
|
|
850
|
-
draggable: draggableConfig,
|
|
851
|
-
draggingNodeKey,
|
|
852
|
-
checkable,
|
|
853
|
-
checkStrictly,
|
|
854
|
-
disabled,
|
|
855
|
-
keyEntities,
|
|
856
|
-
dropLevelOffset,
|
|
857
|
-
dropContainerKey,
|
|
858
|
-
dropTargetKey,
|
|
859
|
-
dropPosition,
|
|
860
|
-
dragOverNodeKey,
|
|
861
|
-
indent,
|
|
862
|
-
direction,
|
|
863
|
-
dropIndicatorRender,
|
|
864
|
-
loadData,
|
|
865
|
-
filterTreeNode,
|
|
866
|
-
titleRender,
|
|
867
|
-
onNodeClick: this.onNodeClick,
|
|
868
|
-
onNodeDoubleClick: this.onNodeDoubleClick,
|
|
869
|
-
onNodeExpand: this.onNodeExpand,
|
|
870
|
-
onNodeSelect: this.onNodeSelect,
|
|
871
|
-
onNodeCheck: this.onNodeCheck,
|
|
872
|
-
onNodeLoad: this.onNodeLoad,
|
|
873
|
-
onNodeMouseEnter: this.onNodeMouseEnter,
|
|
874
|
-
onNodeMouseLeave: this.onNodeMouseLeave,
|
|
875
|
-
onNodeContextMenu: this.onNodeContextMenu,
|
|
876
|
-
onNodeDragStart: this.onNodeDragStart,
|
|
877
|
-
onNodeDragEnter: this.onNodeDragEnter,
|
|
878
|
-
onNodeDragOver: this.onNodeDragOver,
|
|
879
|
-
onNodeDragLeave: this.onNodeDragLeave,
|
|
880
|
-
onNodeDragEnd: this.onNodeDragEnd,
|
|
881
|
-
onNodeDrop: this.onNodeDrop
|
|
882
|
-
};
|
|
883
|
-
return /* @__PURE__ */ React.createElement(import_contextTypes.TreeContext.Provider, { value: contextValue }, /* @__PURE__ */ React.createElement(
|
|
884
|
-
"div",
|
|
885
|
-
{
|
|
886
|
-
className: (0, import_classnames.default)(prefixCls, className, rootClassName, {
|
|
887
|
-
[`${prefixCls}-show-line`]: showLine,
|
|
888
|
-
[`${prefixCls}-focused`]: focused,
|
|
889
|
-
[`${prefixCls}-active-focused`]: activeKey !== null
|
|
890
|
-
}),
|
|
891
|
-
style: rootStyle
|
|
892
|
-
},
|
|
893
|
-
/* @__PURE__ */ React.createElement(
|
|
894
|
-
import_NodeList.default,
|
|
895
|
-
{
|
|
896
|
-
ref: this.listRef,
|
|
897
|
-
prefixCls,
|
|
898
|
-
style,
|
|
899
|
-
data: flattenNodes,
|
|
900
|
-
disabled,
|
|
901
|
-
selectable,
|
|
902
|
-
checkable: !!checkable,
|
|
903
|
-
motion,
|
|
904
|
-
dragging: draggingNodeKey !== null,
|
|
905
|
-
height,
|
|
906
|
-
itemHeight,
|
|
907
|
-
virtual,
|
|
908
|
-
focusable,
|
|
909
|
-
focused,
|
|
910
|
-
tabIndex,
|
|
911
|
-
activeItem: this.getActiveItem(),
|
|
912
|
-
onFocus: this.onFocus,
|
|
913
|
-
onBlur: this.onBlur,
|
|
914
|
-
onKeyDown: this.onKeyDown,
|
|
915
|
-
onActiveChange: this.onActiveChange,
|
|
916
|
-
onListChangeStart: this.onListChangeStart,
|
|
917
|
-
onListChangeEnd: this.onListChangeEnd,
|
|
918
|
-
onContextMenu,
|
|
919
|
-
onScroll,
|
|
920
|
-
scrollWidth,
|
|
921
|
-
...this.getTreeNodeRequiredProps(),
|
|
922
|
-
...domProps
|
|
923
|
-
}
|
|
924
|
-
)
|
|
925
|
-
));
|
|
926
|
-
}
|
|
927
|
-
};
|
|
928
|
-
Tree.defaultProps = {
|
|
929
|
-
prefixCls: "el-tree",
|
|
1190
|
+
}]);
|
|
1191
|
+
return Tree;
|
|
1192
|
+
}(React.Component);
|
|
1193
|
+
_defineProperty(Tree, "defaultProps", {
|
|
1194
|
+
prefixCls: 'el-tree',
|
|
930
1195
|
showLine: false,
|
|
931
1196
|
showIcon: true,
|
|
932
1197
|
selectable: true,
|
|
@@ -941,9 +1206,11 @@ Tree.defaultProps = {
|
|
|
941
1206
|
defaultExpandedKeys: [],
|
|
942
1207
|
defaultCheckedKeys: [],
|
|
943
1208
|
defaultSelectedKeys: [],
|
|
944
|
-
dropIndicatorRender:
|
|
945
|
-
allowDrop: ()
|
|
1209
|
+
dropIndicatorRender: DropIndicator,
|
|
1210
|
+
allowDrop: function allowDrop() {
|
|
1211
|
+
return true;
|
|
1212
|
+
},
|
|
946
1213
|
expandAction: false
|
|
947
|
-
};
|
|
948
|
-
Tree
|
|
949
|
-
|
|
1214
|
+
});
|
|
1215
|
+
_defineProperty(Tree, "TreeNode", TreeNode);
|
|
1216
|
+
export default Tree;
|