@hi-ui/hiui 2.15.10 → 2.15.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/CHANGELOG.md +3 -0
- package/es/_util/warning.js +2 -2
- package/es/alert/__test__/index.test.js +67 -0
- package/es/alert/index.js +147 -6
- package/es/alert/style/index.css +1 -1
- package/es/badge/index.js +87 -9
- package/es/badge/style/index.css +1 -1
- package/es/badge/style/index.js +0 -0
- package/es/button/Button.js +51 -59
- package/es/button/ButtonGroup.js +31 -23
- package/es/button/IconLoading.js +2 -2
- package/es/button/__test__/index.test.js +29 -0
- package/es/button/index.js +2 -3
- package/es/button/style/index.css +1 -1
- package/es/card/index.js +42 -54
- package/es/card/style/index.css +1 -1
- package/es/cascader/Cascader.js +116 -181
- package/es/cascader/__test__/index.test.js +283 -0
- package/es/cascader/index.js +2 -5
- package/es/cascader/menu.js +155 -0
- package/es/cascader/style/cascader.css +1 -1
- package/es/cascader/style/menu.css +1 -1
- package/es/checkbox/{checkbox-legacy/Base.js → Base.js} +31 -46
- package/es/checkbox/CheckBox.js +185 -0
- package/es/checkbox/index.js +4 -13
- package/es/checkbox/style/index.css +1 -1
- package/es/collapse/__test__/index.test.js +58 -0
- package/es/collapse/index.js +93 -79
- package/es/collapse/style/index.css +1 -1
- package/es/confirm/index.js +50 -37
- package/es/context/index.js +37 -39
- package/es/counter/__test__/index.test.js +52 -0
- package/es/counter/index.js +270 -6
- package/es/counter/style/index.css +1 -1
- package/es/date-picker/BasePicker.js +288 -374
- package/es/date-picker/Calender.js +90 -326
- package/es/date-picker/DatePanel.js +186 -175
- package/es/date-picker/DatePicker.js +51 -151
- package/es/date-picker/DateRangePanel.js +181 -253
- package/es/date-picker/Modal.js +25 -15
- package/es/date-picker/Time.js +336 -230
- package/es/date-picker/TimePanel.js +32 -27
- package/es/date-picker/TimePeriodPanel.js +32 -21
- package/es/date-picker/TimePicker.js +40 -42
- package/es/date-picker/TimeRangePanel.js +42 -32
- package/es/date-picker/Type.js +1 -5
- package/es/date-picker/WeekRangePanel.js +150 -237
- package/es/date-picker/constants.js +28 -14
- package/es/date-picker/dateUtil.js +52 -221
- package/es/date-picker/index.js +2 -5
- package/es/date-picker/style/index.css +1 -1
- package/es/date-picker/util.js +8 -101
- package/es/dropdown/Dropdown.js +199 -193
- package/es/dropdown/{tests → __test__}/index.test.js +2 -2
- package/es/dropdown/index.js +4 -73
- package/es/dropdown/style/index.css +1 -1
- package/es/dropdown/style/index.js +2 -0
- package/es/ficon/index.js +23 -13
- package/es/form/index.js +171 -6
- package/es/form/{Item.js → item.js} +53 -53
- package/es/form/style/index.css +1 -1
- package/es/grid/index.js +37 -25
- package/es/icon/index.js +32 -21
- package/es/index.js +9 -61
- package/es/input/index.js +345 -28
- package/es/input/style/index.css +1 -1
- package/es/input/util.js +18 -26
- package/es/lib/withDragDropContext.js +2 -2
- package/es/loading/index.js +129 -5
- package/es/loading/style/index.css +0 -0
- package/es/loading/style/index.js +0 -0
- package/es/locales/en-US.js +11 -45
- package/es/locales/index.js +2 -16
- package/es/locales/zh-CN.js +12 -46
- package/es/menu/Item.js +41 -32
- package/es/menu/ItemGroup.js +81 -0
- package/es/menu/SubMenu.js +74 -55
- package/es/menu/Title.js +42 -36
- package/es/menu/index.js +419 -12
- package/es/menu/style/index.css +1 -1
- package/es/modal/__test__/index.test.js +123 -0
- package/es/modal/index.js +61 -77
- package/es/modal/style/index.css +1 -1
- package/es/nav-menu/NavMenu.js +45 -31
- package/es/nav-menu/__test__/index.test.js +2 -2
- package/es/nav-menu/index.js +2 -2
- package/es/notification/__test__/index.test.js +56 -0
- package/es/notification/index.js +231 -68
- package/es/notification/style/index.css +1 -1
- package/es/notification/style/index.js +0 -0
- package/es/pagination/Pager.js +8 -6
- package/es/pagination/Pagination.js +115 -124
- package/es/pagination/__test__/index.test.js +140 -0
- package/es/pagination/index.js +8 -9
- package/es/pagination/style/index.css +1 -1
- package/es/panel/index.js +33 -23
- package/es/popover/__test__/index.test.js +2 -2
- package/es/popover/index.js +69 -71
- package/es/popper/index.js +54 -64
- package/es/popper/style/index.css +1 -1
- package/es/progress/BarProgress.js +43 -109
- package/es/progress/CircleProgress.js +10 -9
- package/es/progress/DashboardProgress.js +9 -7
- package/es/progress/index.js +100 -8
- package/es/progress/style/index.css +1 -1
- package/es/radio/{radio-legacy/__test__ → __test__}/index.test.js +10 -10
- package/es/radio/index.js +216 -10
- package/es/radio/style/index.css +1 -1
- package/es/rate/Icons.js +2 -2
- package/es/rate/Rate.js +90 -65
- package/es/rate/__test__/index.test.js +54 -0
- package/es/rate/index.js +2 -5
- package/es/rate/style/index.css +1 -1
- package/es/select/Option.js +93 -0
- package/es/select/Select.js +253 -325
- package/es/select/SelectDropdown.js +63 -215
- package/es/select/SelectInput.js +54 -88
- package/es/select/__test__/index.test.js +429 -0
- package/es/select/index.js +4 -6
- package/es/select/style/select-dropdown.css +1 -1
- package/es/select/style/select-input.css +1 -1
- package/es/stepper/index.js +127 -21
- package/es/stepper/style/index.css +1 -1
- package/es/style/color/colors.css +0 -0
- package/es/style/icon/diyIcon.css +1 -1
- package/es/style/icon/index.css +1 -1
- package/es/style/index.css +0 -0
- package/es/style/mixins/colors.css +0 -0
- package/es/style/mixins/index.css +0 -0
- package/es/style/theme/dark.css +0 -0
- package/es/style/theme/default.css +0 -0
- package/es/switch/{__tests__ → __test__}/index.test.js +2 -31
- package/es/switch/index.js +36 -24
- package/es/switch/style/index.css +1 -1
- package/es/table/__test__/index.test.js +73 -0
- package/es/table/{Body.js → body.js} +52 -36
- package/es/table/checkbox/index.js +36 -33
- package/es/table/clickOuterside.js +115 -0
- package/es/table/{Footer.js → footer.js} +41 -24
- package/es/table/{Header.js → header.js} +54 -41
- package/es/table/index.js +300 -262
- package/es/table/menu/index.js +34 -32
- package/es/table/pover.js +154 -0
- package/es/table/prefix.js +2 -2
- package/es/table/style/Table.css +1 -1
- package/es/table/style/index.css +1 -1
- package/es/table/tableContent.js +120 -0
- package/es/tabs/ItemDropdown.js +51 -39
- package/es/tabs/TabPane.js +35 -25
- package/es/tabs/Tabs.js +91 -98
- package/es/tabs/index.js +3 -9
- package/es/tabs/style/index.css +1 -1
- package/es/timeline/__test__/index.test.js +49 -0
- package/es/timeline/foldingItem.js +82 -0
- package/es/timeline/index.js +127 -203
- package/es/timeline/style/index.css +1 -1
- package/es/tooltip/__test__/index.test.js +67 -0
- package/es/tooltip/index.js +39 -86
- package/es/tooltip/style/index.css +1 -1
- package/es/transfer/Item.js +44 -53
- package/es/transfer/__test__/index.test.js +11 -0
- package/es/transfer/index.js +443 -4
- package/es/transfer/style/index.css +1 -1
- package/es/tree/Tree.js +86 -76
- package/es/tree/TreeDivider.js +3 -3
- package/es/tree/TreeItem.js +108 -204
- package/es/tree/TreeNode.js +318 -457
- package/es/tree/index.js +2 -9
- package/es/tree/style/index.css +1 -1
- package/es/tree/util.js +257 -9
- package/es/upload/{upload-legacy/Preview.js → Preview.js} +39 -33
- package/es/upload/Upload.js +193 -289
- package/es/upload/UploadAvatar.js +58 -44
- package/es/upload/UploadClick.js +45 -49
- package/es/upload/UploadDrag.js +43 -44
- package/es/upload/UploadPhoto.js +55 -70
- package/es/upload/UploadPictureCard.js +44 -39
- package/es/upload/index.js +71 -8
- package/es/upload/style/index.css +1 -1
- package/es/upload/tool.js +1 -0
- package/package.json +4 -1
- package/es/_util/SwitchVersion.js +0 -44
- package/es/_util/depreactedPropsCompat.js +0 -58
- package/es/_util/index.js +0 -32
- package/es/alert/Alert.js +0 -134
- package/es/alert/__tests__/index.test.js +0 -88
- package/es/badge/Badge.js +0 -90
- package/es/badge/__tests__/index.test.js +0 -82
- package/es/breadcrumb/__tests__/index.test.js +0 -61
- package/es/breadcrumb/index.js +0 -93
- package/es/breadcrumb/style/index.css +0 -1
- package/es/button/__tests__/index.test.js +0 -219
- package/es/card/__tests__/index.test.js +0 -169
- package/es/carousel/__tests__/index.test.js +0 -104
- package/es/carousel/index.js +0 -227
- package/es/carousel/style/index.css +0 -1
- package/es/carousel/style/index.js +0 -3
- package/es/cascader/Menu.js +0 -174
- package/es/cascader/__tests__/index.test.js +0 -389
- package/es/checkbox/Checkbox.js +0 -144
- package/es/checkbox/Group.js +0 -202
- package/es/checkbox/__tests__/index.test.js +0 -226
- package/es/checkbox/checkbox-legacy/CheckBox.js +0 -165
- package/es/checkbox/checkbox-legacy/index.js +0 -15
- package/es/checkbox/checkbox-legacy/style/index.css +0 -1
- package/es/checkbox/checkbox-legacy/style/index.js +0 -3
- package/es/collapse/__tests__/index.test.js +0 -111
- package/es/counter/Counter.js +0 -343
- package/es/counter/__tests__/index.test.js +0 -134
- package/es/counter/counter-legacy/index.js +0 -271
- package/es/date-picker/TimeList.js +0 -254
- package/es/date-picker/YMRangePanel.js +0 -372
- package/es/date-picker/__tests__/index.test.js +0 -961
- package/es/date-picker/datepicker-legacy/BasePicker.js +0 -519
- package/es/date-picker/datepicker-legacy/Calender.js +0 -430
- package/es/date-picker/datepicker-legacy/DatePanel.js +0 -463
- package/es/date-picker/datepicker-legacy/DatePicker.js +0 -107
- package/es/date-picker/datepicker-legacy/DateRangePanel.js +0 -496
- package/es/date-picker/datepicker-legacy/Modal.js +0 -71
- package/es/date-picker/datepicker-legacy/Time.js +0 -413
- package/es/date-picker/datepicker-legacy/TimePanel.js +0 -93
- package/es/date-picker/datepicker-legacy/TimePeriodPanel.js +0 -126
- package/es/date-picker/datepicker-legacy/TimePicker.js +0 -82
- package/es/date-picker/datepicker-legacy/TimeRangePanel.js +0 -98
- package/es/date-picker/datepicker-legacy/Type.js +0 -31
- package/es/date-picker/datepicker-legacy/WeekRangePanel.js +0 -345
- package/es/date-picker/datepicker-legacy/constants.js +0 -79
- package/es/date-picker/datepicker-legacy/dateUtil.js +0 -258
- package/es/date-picker/datepicker-legacy/index.js +0 -15
- package/es/date-picker/datepicker-legacy/local.js +0 -11
- package/es/date-picker/datepicker-legacy/style/index.css +0 -1
- package/es/date-picker/datepicker-legacy/style/index.js +0 -3
- package/es/date-picker/datepicker-legacy/style/timepicker.css +0 -1
- package/es/date-picker/datepicker-legacy/util.js +0 -60
- package/es/date-picker/toLunar.js +0 -172
- package/es/dropdown/DropdownButton.js +0 -106
- package/es/dropdown/DropdownMenu.js +0 -111
- package/es/dropdown/DropdownMenuItem.js +0 -178
- package/es/dropdown/__tests__/index.test.js +0 -317
- package/es/dropdown/utils.js +0 -35
- package/es/form/Form.js +0 -184
- package/es/form/__tests__/index.test.js +0 -575
- package/es/grid/__tests__/index.test.js +0 -104
- package/es/input/Input.js +0 -412
- package/es/input/__tests__/index.test.js +0 -381
- package/es/input/input-legacy/index.js +0 -353
- package/es/input/input-legacy/util.js +0 -176
- package/es/loading/Loading.js +0 -181
- package/es/loading/__tests__/index.test.js +0 -110
- package/es/locales/zh-Hant-HK.js +0 -121
- package/es/locales/zh-Hant-TW.js +0 -123
- package/es/menu/Menu.js +0 -422
- package/es/menu/__tests__/index.test.js +0 -279
- package/es/message/__tests__/index.test.js +0 -75
- package/es/message/index.js +0 -58
- package/es/message/style/index.css +0 -1
- package/es/message/style/index.js +0 -5
- package/es/modal/__tests__/index.test.js +0 -178
- package/es/nav-menu/__tests__/index.test.js +0 -27
- package/es/notice/Notice.js +0 -142
- package/es/notice/NoticeContainer.js +0 -113
- package/es/notice/__tests__/index.test.js +0 -174
- package/es/notice/index.js +0 -66
- package/es/notice/style/index.css +0 -1
- package/es/notice/style/index.js +0 -5
- package/es/notification/HandleNotification/index.js +0 -224
- package/es/notification/HandleNotification/style/index.css +0 -1
- package/es/notification/HandleNotification/style/index.js +0 -5
- package/es/notification/__tests__/index.test.js +0 -118
- package/es/pagination/__tests__/index.test.js +0 -248
- package/es/popover/__tests__/index.test.js +0 -152
- package/es/preview/index.js +0 -527
- package/es/preview/style/index.css +0 -1
- package/es/preview/style/index.js +0 -3
- package/es/progress/Progress.js +0 -110
- package/es/progress/__tests__/index.test.js +0 -131
- package/es/radio/Group.js +0 -203
- package/es/radio/Radio.js +0 -151
- package/es/radio/__tests__/index.test.js +0 -128
- package/es/radio/radio-legacy/index.js +0 -222
- package/es/radio/radio-legacy/style/index.css +0 -1
- package/es/radio/radio-legacy/style/index.js +0 -3
- package/es/rate/__tests__/index.test.js +0 -124
- package/es/select/__tests__/index.test.js +0 -505
- package/es/select/select-legacy/Option.js +0 -81
- package/es/select/select-legacy/Select.js +0 -710
- package/es/select/select-legacy/SelectDropdown.js +0 -164
- package/es/select/select-legacy/SelectInput.js +0 -312
- package/es/select/select-legacy/common.js +0 -19
- package/es/select/select-legacy/index.js +0 -16
- package/es/stepper/Stepper.js +0 -151
- package/es/stepper/__tests__/index.test.js +0 -161
- package/es/table/ClickOuterside.js +0 -103
- package/es/table/TableContent.js +0 -109
- package/es/table/__tests__/index.test.js +0 -133
- package/es/table/checkbox/style/index.css +0 -1
- package/es/table/checkbox/style/index.js +0 -3
- package/es/tabs/__tests__/index.test.js +0 -333
- package/es/tabs/tabs-legacy/ItemDropdown.js +0 -170
- package/es/tabs/tabs-legacy/TabPane.js +0 -78
- package/es/tabs/tabs-legacy/Tabs.js +0 -299
- package/es/tabs/tabs-legacy/index.js +0 -18
- package/es/tabs/tabs-legacy/style/index.css +0 -1
- package/es/tabs/tabs-legacy/style/index.js +0 -3
- package/es/tag/__tests__/index.test.js +0 -46
- package/es/tag/index.js +0 -94
- package/es/tag/style/index.css +0 -1
- package/es/tag/style/index.js +0 -3
- package/es/timeline/__tests__/index.test.js +0 -198
- package/es/tooltip/__tests__/index.test.js +0 -170
- package/es/transfer/Transfer.js +0 -566
- package/es/transfer/__tests__/index.test.js +0 -210
- package/es/tree/IconLoading.js +0 -38
- package/es/tree/__tests__/index.test.js +0 -603
- package/es/tree/tree-legacy/Tree.js +0 -337
- package/es/tree/tree-legacy/TreeDivider.js +0 -25
- package/es/tree/tree-legacy/TreeItem.js +0 -333
- package/es/tree/tree-legacy/TreeNode.js +0 -719
- package/es/tree/tree-legacy/index.js +0 -13
- package/es/tree/tree-legacy/style/index.css +0 -1
- package/es/tree/tree-legacy/style/index.js +0 -3
- package/es/tree/tree-legacy/util.js +0 -434
- package/es/upload/__tests__/index.test.js +0 -760
- package/es/upload/main.js +0 -91
- package/es/upload/upload-legacy/Upload.js +0 -435
- package/es/upload/upload-legacy/UploadAvatar.js +0 -322
- package/es/upload/upload-legacy/UploadClick.js +0 -125
- package/es/upload/upload-legacy/UploadDrag.js +0 -180
- package/es/upload/upload-legacy/UploadPhoto.js +0 -183
- package/es/upload/upload-legacy/UploadPictureCard.js +0 -126
- package/es/upload/upload-legacy/index.js +0 -75
- package/es/upload/upload-legacy/style/index.css +0 -1
- package/es/upload/upload-legacy/style/index.js +0 -5
- package/es/upload/upload-legacy/tool.js +0 -84
- package/es/watermark/index.js +0 -101
- package/es/watermark/watermark.js +0 -252
- /package/es/checkbox/{checkbox-legacy/common.js → common.js} +0 -0
- /package/es/{breadcrumb/style → style}/index.js +0 -0
- /package/es/upload/{upload-legacy/style → style}/preview.css +0 -0
- /package/es/upload/{upload-legacy/style → style}/preview.js +0 -0
package/es/tree/TreeNode.js
CHANGED
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
3
|
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
6
|
exports["default"] = void 0;
|
|
11
7
|
|
|
12
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
-
|
|
14
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
-
|
|
16
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
|
-
|
|
18
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
-
|
|
20
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
-
|
|
22
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
23
|
-
|
|
24
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
25
|
-
|
|
26
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
-
|
|
28
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
-
|
|
30
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
|
-
|
|
32
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
33
9
|
|
|
34
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -49,46 +25,90 @@ var _modal = _interopRequireDefault(require("../modal"));
|
|
|
49
25
|
|
|
50
26
|
var _util = require("./util");
|
|
51
27
|
|
|
28
|
+
var _notification = require("../notification");
|
|
29
|
+
|
|
52
30
|
var _axios = _interopRequireDefault(require("axios"));
|
|
53
31
|
|
|
54
32
|
var _qs = _interopRequireDefault(require("qs"));
|
|
55
33
|
|
|
56
|
-
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
35
|
+
|
|
36
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
37
|
+
|
|
38
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
|
+
|
|
40
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
41
|
+
|
|
42
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
43
|
+
|
|
44
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
45
|
+
|
|
46
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
47
|
+
|
|
48
|
+
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."); }
|
|
49
|
+
|
|
50
|
+
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); }
|
|
51
|
+
|
|
52
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
53
|
+
|
|
54
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
55
|
+
|
|
56
|
+
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; }
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
59
59
|
|
|
60
|
-
function
|
|
60
|
+
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, descriptor.key, descriptor); } }
|
|
61
61
|
|
|
62
|
-
function
|
|
62
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
63
63
|
|
|
64
|
-
function
|
|
64
|
+
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
65
65
|
|
|
66
|
-
function
|
|
66
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
67
67
|
|
|
68
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (
|
|
68
|
+
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); }; }
|
|
69
69
|
|
|
70
|
-
function
|
|
70
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
71
|
+
|
|
72
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
73
|
+
|
|
74
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
75
|
+
|
|
76
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
77
|
+
|
|
78
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
71
79
|
|
|
72
80
|
var TreeNode = /*#__PURE__*/function (_Component) {
|
|
73
|
-
(
|
|
81
|
+
_inherits(TreeNode, _Component);
|
|
74
82
|
|
|
75
83
|
var _super = _createSuper(TreeNode);
|
|
76
84
|
|
|
77
85
|
function TreeNode(props) {
|
|
78
86
|
var _this;
|
|
79
87
|
|
|
80
|
-
(
|
|
88
|
+
_classCallCheck(this, TreeNode);
|
|
89
|
+
|
|
81
90
|
_this = _super.call(this, props);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
|
|
92
|
+
_defineProperty(_assertThisInitialized(_this), "setPosition", function (x, y) {
|
|
93
|
+
var _this$state = _this.state,
|
|
94
|
+
positionX = _this$state.positionX,
|
|
95
|
+
positionY = _this$state.positionY;
|
|
96
|
+
|
|
97
|
+
if (!(x === positionX && y === positionY)) {
|
|
98
|
+
_this.setState({
|
|
99
|
+
positionX: x,
|
|
100
|
+
positionY: y
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
_defineProperty(_assertThisInitialized(_this), "setHighlightNum", function () {
|
|
106
|
+
_this.setState({
|
|
107
|
+
highlightNum: _this.state.highlightNum + 1
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
_defineProperty(_assertThisInitialized(_this), "highlightData", function (data, highlightValue) {
|
|
92
112
|
return data.map(function (item) {
|
|
93
113
|
if (typeof item.title === 'string' && item.title.includes(highlightValue)) {
|
|
94
114
|
var index = item.title.indexOf(highlightValue);
|
|
@@ -96,7 +116,7 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
96
116
|
var afterStr = item.title.substr(index + highlightValue.length);
|
|
97
117
|
item.title = /*#__PURE__*/_react["default"].createElement("span", null, beforeStr, /*#__PURE__*/_react["default"].createElement("span", {
|
|
98
118
|
style: {
|
|
99
|
-
color:
|
|
119
|
+
color: '#4284f5'
|
|
100
120
|
}
|
|
101
121
|
}, highlightValue), afterStr);
|
|
102
122
|
}
|
|
@@ -108,11 +128,11 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
108
128
|
return item;
|
|
109
129
|
});
|
|
110
130
|
});
|
|
111
|
-
|
|
112
|
-
|
|
131
|
+
|
|
132
|
+
_defineProperty(_assertThisInitialized(_this), "recordHighlight", function (data, highlightValue, count) {
|
|
113
133
|
data.forEach(function (item) {
|
|
114
134
|
if (typeof item.title === 'string' && item.title.includes(highlightValue)) {
|
|
115
|
-
count
|
|
135
|
+
count = count + 1;
|
|
116
136
|
}
|
|
117
137
|
|
|
118
138
|
if (item.children) {
|
|
@@ -121,19 +141,38 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
121
141
|
});
|
|
122
142
|
return count;
|
|
123
143
|
});
|
|
124
|
-
|
|
144
|
+
|
|
145
|
+
_defineProperty(_assertThisInitialized(_this), "renderSwitcher", function (expanded) {
|
|
146
|
+
var prefixCls = _this.props.prefixCls;
|
|
147
|
+
var switcherClsName = (0, _classnames["default"])("".concat(prefixCls, "-switcher"), 'hi-icon', "icon-".concat(expanded ? 'down' : 'right'));
|
|
148
|
+
return /*#__PURE__*/_react["default"].createElement("i", {
|
|
149
|
+
className: switcherClsName
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
_defineProperty(_assertThisInitialized(_this), "renderItemIcon", function () {
|
|
125
154
|
var _this$props = _this.props,
|
|
126
155
|
prefixCls = _this$props.prefixCls,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
showLine = _this$props.showLine,
|
|
130
|
-
apperance = _this$props.apperance;
|
|
131
|
-
var switcherClsName = (0, _classnames["default"])("".concat(prefixCls, "-switcher"), 'hi-icon', "icon-".concat(expanded ? openIcon || showLine && 'TreeMinus' || apperance === 'folder' && 'Folder-open' || 'open' : closeIcon || showLine && 'TreePlus' || apperance === 'folder' && 'folder' || 'packup'));
|
|
156
|
+
itemIcon = _this$props.itemIcon;
|
|
157
|
+
var switcherClsName = (0, _classnames["default"])("".concat(prefixCls, "-switcher"), 'hi-icon', "icon-".concat(itemIcon || 'document'));
|
|
132
158
|
return /*#__PURE__*/_react["default"].createElement("i", {
|
|
133
159
|
className: switcherClsName
|
|
134
160
|
});
|
|
135
161
|
});
|
|
136
|
-
|
|
162
|
+
|
|
163
|
+
_defineProperty(_assertThisInitialized(_this), "setDraggingNode", function (itemId) {
|
|
164
|
+
_this.setState({
|
|
165
|
+
draggingNode: itemId
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
_defineProperty(_assertThisInitialized(_this), "removeDraggingNode", function () {
|
|
170
|
+
_this.setState({
|
|
171
|
+
draggingNode: null
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
_defineProperty(_assertThisInitialized(_this), "_addSibNode", function (itemId, data, editingNodes) {
|
|
137
176
|
data.forEach(function (d, index) {
|
|
138
177
|
if (d.id === itemId) {
|
|
139
178
|
var addNode = {
|
|
@@ -150,14 +189,15 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
150
189
|
}
|
|
151
190
|
});
|
|
152
191
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
192
|
+
|
|
193
|
+
_defineProperty(_assertThisInitialized(_this), "addSiblingNode", function (itemId) {
|
|
194
|
+
var _this$state2 = _this.state,
|
|
195
|
+
dataCache = _this$state2.dataCache,
|
|
196
|
+
editingNodes = _this$state2.editingNodes;
|
|
157
197
|
|
|
158
198
|
var _dataCache = (0, _cloneDeep["default"])(dataCache);
|
|
159
199
|
|
|
160
|
-
var _editingNodes = (
|
|
200
|
+
var _editingNodes = _toConsumableArray(editingNodes);
|
|
161
201
|
|
|
162
202
|
_this._addSibNode(itemId, _dataCache, _editingNodes);
|
|
163
203
|
|
|
@@ -166,7 +206,8 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
166
206
|
editingNodes: _editingNodes
|
|
167
207
|
});
|
|
168
208
|
});
|
|
169
|
-
|
|
209
|
+
|
|
210
|
+
_defineProperty(_assertThisInitialized(_this), "_cancelAddSiblingNode", function (itemId, data) {
|
|
170
211
|
data.forEach(function (d, index) {
|
|
171
212
|
if (d.id === itemId) {
|
|
172
213
|
data.splice(index, 1);
|
|
@@ -177,7 +218,8 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
177
218
|
}
|
|
178
219
|
});
|
|
179
220
|
});
|
|
180
|
-
|
|
221
|
+
|
|
222
|
+
_defineProperty(_assertThisInitialized(_this), "cancelAddSiblingNode", function (itemId) {
|
|
181
223
|
var dataCache = _this.state.dataCache;
|
|
182
224
|
|
|
183
225
|
var _dataCache = (0, _cloneDeep["default"])(dataCache);
|
|
@@ -188,7 +230,8 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
188
230
|
dataCache: _dataCache
|
|
189
231
|
});
|
|
190
232
|
});
|
|
191
|
-
|
|
233
|
+
|
|
234
|
+
_defineProperty(_assertThisInitialized(_this), "_addChildNode", function (itemId, data, editingNodes) {
|
|
192
235
|
data.forEach(function (d, index) {
|
|
193
236
|
if (d.id === itemId) {
|
|
194
237
|
if (!d.children) {
|
|
@@ -209,16 +252,17 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
209
252
|
}
|
|
210
253
|
});
|
|
211
254
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
255
|
+
|
|
256
|
+
_defineProperty(_assertThisInitialized(_this), "addChildNode", function (item) {
|
|
257
|
+
var _this$state3 = _this.state,
|
|
258
|
+
dataCache = _this$state3.dataCache,
|
|
259
|
+
editingNodes = _this$state3.editingNodes;
|
|
216
260
|
var expandTreeNode = _this.props.expandTreeNode;
|
|
217
261
|
expandTreeNode(item.id);
|
|
218
262
|
|
|
219
263
|
var _dataCache = (0, _cloneDeep["default"])(dataCache);
|
|
220
264
|
|
|
221
|
-
var _editingNodes = (
|
|
265
|
+
var _editingNodes = _toConsumableArray(editingNodes);
|
|
222
266
|
|
|
223
267
|
_this._addChildNode(item.id, _dataCache, _editingNodes);
|
|
224
268
|
|
|
@@ -227,18 +271,11 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
227
271
|
editingNodes: _editingNodes
|
|
228
272
|
});
|
|
229
273
|
});
|
|
230
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "deleteNode", function (item, level) {
|
|
231
|
-
_this.setCurrentDeleteNode({
|
|
232
|
-
id: item.id,
|
|
233
|
-
level: level
|
|
234
|
-
});
|
|
235
274
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "editNode", function (item) {
|
|
239
|
-
var _editNodes = (0, _toConsumableArray2["default"])(_this.state.editNodes);
|
|
275
|
+
_defineProperty(_assertThisInitialized(_this), "editNode", function (item) {
|
|
276
|
+
var _editNodes = _toConsumableArray(_this.state.editNodes);
|
|
240
277
|
|
|
241
|
-
var _editingNodes = (
|
|
278
|
+
var _editingNodes = _toConsumableArray(_this.state.editingNodes);
|
|
242
279
|
|
|
243
280
|
_editNodes.push(item);
|
|
244
281
|
|
|
@@ -249,7 +286,8 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
249
286
|
editingNodes: _editingNodes
|
|
250
287
|
});
|
|
251
288
|
});
|
|
252
|
-
|
|
289
|
+
|
|
290
|
+
_defineProperty(_assertThisInitialized(_this), "onValueChange", function (value, itemId) {
|
|
253
291
|
_this.setState({
|
|
254
292
|
editingNodes: _this.state.editingNodes.filter(function (item) {
|
|
255
293
|
return item.id !== itemId;
|
|
@@ -260,7 +298,8 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
260
298
|
}))
|
|
261
299
|
});
|
|
262
300
|
});
|
|
263
|
-
|
|
301
|
+
|
|
302
|
+
_defineProperty(_assertThisInitialized(_this), "_cancelEditNode", function (itemId, data, nodeBeforeEdit) {
|
|
264
303
|
data.forEach(function (d, index) {
|
|
265
304
|
if (d.id === itemId) {
|
|
266
305
|
d.title = nodeBeforeEdit.title;
|
|
@@ -271,11 +310,12 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
271
310
|
}
|
|
272
311
|
});
|
|
273
312
|
});
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
313
|
+
|
|
314
|
+
_defineProperty(_assertThisInitialized(_this), "cancelEditNode", function (itemId) {
|
|
315
|
+
var _this$state4 = _this.state,
|
|
316
|
+
editNodes = _this$state4.editNodes,
|
|
317
|
+
dataCache = _this$state4.dataCache,
|
|
318
|
+
editingNodes = _this$state4.editingNodes;
|
|
279
319
|
var nodeBeforeEdit = editNodes.find(function (node) {
|
|
280
320
|
return node.id === itemId;
|
|
281
321
|
});
|
|
@@ -294,7 +334,8 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
294
334
|
})
|
|
295
335
|
});
|
|
296
336
|
});
|
|
297
|
-
|
|
337
|
+
|
|
338
|
+
_defineProperty(_assertThisInitialized(_this), "_saveEditNode", function (itemId, data, nodeEdited) {
|
|
298
339
|
data.forEach(function (d, index) {
|
|
299
340
|
if (d.id === itemId) {
|
|
300
341
|
d.title = nodeEdited.title;
|
|
@@ -306,88 +347,36 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
306
347
|
}
|
|
307
348
|
});
|
|
308
349
|
});
|
|
309
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "saveEditNode", /*#__PURE__*/function () {
|
|
310
|
-
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(itemId, level) {
|
|
311
|
-
var _this$state4, editNodes, dataCache, editingNodes, nodeEdited, _dataCache, result;
|
|
312
|
-
|
|
313
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
314
|
-
while (1) {
|
|
315
|
-
switch (_context.prev = _context.next) {
|
|
316
|
-
case 0:
|
|
317
|
-
_this$state4 = _this.state, editNodes = _this$state4.editNodes, dataCache = _this$state4.dataCache, editingNodes = _this$state4.editingNodes;
|
|
318
|
-
nodeEdited = editingNodes.find(function (node) {
|
|
319
|
-
return node.id === itemId;
|
|
320
|
-
});
|
|
321
|
-
_dataCache = (0, _cloneDeep["default"])(dataCache);
|
|
322
|
-
|
|
323
|
-
_this._saveEditNode(itemId, _dataCache, nodeEdited);
|
|
324
|
-
|
|
325
|
-
if (!_this.props.onBeforeSave) {
|
|
326
|
-
_context.next = 12;
|
|
327
|
-
break;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
result = _this.props.onBeforeSave(nodeEdited, {
|
|
331
|
-
before: dataCache,
|
|
332
|
-
after: _dataCache
|
|
333
|
-
}, level);
|
|
334
|
-
|
|
335
|
-
if (!(result.toString() === '[object Promise]')) {
|
|
336
|
-
_context.next = 9;
|
|
337
|
-
break;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
_context.next = 9;
|
|
341
|
-
return result.then(function (res) {
|
|
342
|
-
result = res;
|
|
343
|
-
})["catch"](function () {
|
|
344
|
-
result = false;
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
case 9:
|
|
348
|
-
if (result === true) {
|
|
349
|
-
_this.setState({
|
|
350
|
-
dataCache: _dataCache,
|
|
351
|
-
editNodes: editNodes.filter(function (node) {
|
|
352
|
-
return node.id !== itemId;
|
|
353
|
-
}),
|
|
354
|
-
editingNodes: editingNodes.filter(function (node) {
|
|
355
|
-
return node.id !== itemId;
|
|
356
|
-
})
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
_this.props.onSave(nodeEdited, _dataCache);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
_context.next = 14;
|
|
363
|
-
break;
|
|
364
|
-
|
|
365
|
-
case 12:
|
|
366
|
-
_this.setState({
|
|
367
|
-
dataCache: _dataCache,
|
|
368
|
-
editNodes: editNodes.filter(function (node) {
|
|
369
|
-
return node.id !== itemId;
|
|
370
|
-
}),
|
|
371
|
-
editingNodes: editingNodes.filter(function (node) {
|
|
372
|
-
return node.id !== itemId;
|
|
373
|
-
})
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
_this.props.onSave(nodeEdited, _dataCache);
|
|
377
|
-
|
|
378
|
-
case 14:
|
|
379
|
-
case "end":
|
|
380
|
-
return _context.stop();
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}, _callee);
|
|
384
|
-
}));
|
|
385
350
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
351
|
+
_defineProperty(_assertThisInitialized(_this), "saveEditNode", function (itemId) {
|
|
352
|
+
var _this$state5 = _this.state,
|
|
353
|
+
editNodes = _this$state5.editNodes,
|
|
354
|
+
dataCache = _this$state5.dataCache,
|
|
355
|
+
editingNodes = _this$state5.editingNodes;
|
|
356
|
+
var nodeEdited = editingNodes.find(function (node) {
|
|
357
|
+
return node.id === itemId;
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
var _dataCache = (0, _cloneDeep["default"])(dataCache);
|
|
361
|
+
|
|
362
|
+
_this._saveEditNode(itemId, _dataCache, nodeEdited);
|
|
363
|
+
|
|
364
|
+
_this.setState({
|
|
365
|
+
dataCache: _dataCache,
|
|
366
|
+
editNodes: editNodes.filter(function (node) {
|
|
367
|
+
return node.id !== itemId;
|
|
368
|
+
}),
|
|
369
|
+
editingNodes: editingNodes.filter(function (node) {
|
|
370
|
+
return node.id !== itemId;
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
var node = (0, _util.findNode)(itemId, dataCache);
|
|
375
|
+
|
|
376
|
+
_this.props.onSave(node, _dataCache);
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
_defineProperty(_assertThisInitialized(_this), "_delDragNode", function (itemId, data) {
|
|
391
380
|
data.forEach(function (d, index) {
|
|
392
381
|
if (d.id === itemId) {
|
|
393
382
|
data.splice(index, 1);
|
|
@@ -398,7 +387,8 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
398
387
|
}
|
|
399
388
|
});
|
|
400
389
|
});
|
|
401
|
-
|
|
390
|
+
|
|
391
|
+
_defineProperty(_assertThisInitialized(_this), "_addDropNode", function (targetItemId, sourceItemId, data, allData) {
|
|
402
392
|
data.forEach(function (d, index) {
|
|
403
393
|
if (d.id === targetItemId) {
|
|
404
394
|
var sourceNode = (0, _util.findNode)(sourceItemId, allData);
|
|
@@ -415,20 +405,21 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
415
405
|
}
|
|
416
406
|
});
|
|
417
407
|
});
|
|
418
|
-
|
|
408
|
+
|
|
409
|
+
_defineProperty(_assertThisInitialized(_this), "loadChildren", function (itemId) {
|
|
419
410
|
var origin = _this.props.origin;
|
|
411
|
+
var method = origin.method,
|
|
412
|
+
url = origin.url,
|
|
413
|
+
headers = origin.headers,
|
|
414
|
+
data = origin.data,
|
|
415
|
+
params = origin.params,
|
|
416
|
+
func = origin.func,
|
|
417
|
+
errorHandler = origin.errorHandler;
|
|
418
|
+
var dataCache = _this.state.dataCache;
|
|
420
419
|
|
|
421
|
-
var
|
|
420
|
+
var that = _assertThisInitialized(_this);
|
|
422
421
|
|
|
423
|
-
|
|
424
|
-
url = _orgin.url,
|
|
425
|
-
headers = _orgin.headers,
|
|
426
|
-
data = _orgin.data,
|
|
427
|
-
params = _orgin.params,
|
|
428
|
-
transformResponse = _orgin.transformResponse;
|
|
429
|
-
var dataCache = _this.state.dataCache;
|
|
430
|
-
var that = (0, _assertThisInitialized2["default"])(_this);
|
|
431
|
-
return (0, _axios["default"])({
|
|
422
|
+
(0, _axios["default"])({
|
|
432
423
|
method: method,
|
|
433
424
|
url: url,
|
|
434
425
|
headers: headers,
|
|
@@ -445,46 +436,46 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
445
436
|
var node = (0, _util.findNode)(itemId, _dataCache);
|
|
446
437
|
|
|
447
438
|
if (!node.children) {
|
|
448
|
-
node.children =
|
|
439
|
+
node.children = func(res.data);
|
|
449
440
|
that.setState({
|
|
450
441
|
dataCache: _dataCache
|
|
451
442
|
});
|
|
452
443
|
}
|
|
453
444
|
})["catch"](function (error) {
|
|
454
|
-
|
|
445
|
+
if (errorHandler) {
|
|
446
|
+
errorHandler(error);
|
|
447
|
+
} else {
|
|
448
|
+
(0, _notification.handleNotificate)({
|
|
449
|
+
type: 'error',
|
|
450
|
+
showClose: true,
|
|
451
|
+
autoClose: true,
|
|
452
|
+
title: 'Error',
|
|
453
|
+
duration: 5000,
|
|
454
|
+
message: error
|
|
455
|
+
});
|
|
456
|
+
}
|
|
455
457
|
});
|
|
456
458
|
});
|
|
457
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "switchDropNode", function (targetItemId, sourceItemId, data, allData, dropDividerPosition) {
|
|
458
|
-
var sourceNode = (0, _util.findNode)(sourceItemId, allData);
|
|
459
|
-
|
|
460
|
-
var _data = (0, _toConsumableArray2["default"])(data);
|
|
461
459
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
return
|
|
470
|
-
})
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
var _position = dropDividerPosition === 'down' ? index + 1 : index;
|
|
476
|
-
|
|
477
|
-
item.children.splice(_position, 0, sourceNode);
|
|
478
|
-
} else {
|
|
479
|
-
_this.switchDropNode(targetItemId, sourceItemId, item.children, allData, dropDividerPosition);
|
|
480
|
-
}
|
|
460
|
+
_defineProperty(_assertThisInitialized(_this), "switchDropNode", function (targetItemId, sourceItemId, data, allData) {
|
|
461
|
+
data.forEach(function (item) {
|
|
462
|
+
if (item.children) {
|
|
463
|
+
if (item.children.some(function (e) {
|
|
464
|
+
return e.id === targetItemId;
|
|
465
|
+
})) {
|
|
466
|
+
var index = item.children.findIndex(function (i) {
|
|
467
|
+
return i.id === targetItemId;
|
|
468
|
+
});
|
|
469
|
+
var sourceNode = (0, _util.findNode)(sourceItemId, allData);
|
|
470
|
+
item.children.splice(index + 1, 0, sourceNode);
|
|
471
|
+
} else {
|
|
472
|
+
_this.switchDropNode(targetItemId, sourceItemId, item.children, allData);
|
|
481
473
|
}
|
|
482
474
|
}
|
|
483
475
|
});
|
|
484
476
|
});
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
after = _ref2.after;
|
|
477
|
+
|
|
478
|
+
_defineProperty(_assertThisInitialized(_this), "dropNode", function (sourceItem, targetItem, dropDividerPosition) {
|
|
488
479
|
var dataCache = _this.state.dataCache;
|
|
489
480
|
|
|
490
481
|
var _dataCache = (0, _cloneDeep["default"])(dataCache);
|
|
@@ -495,199 +486,124 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
495
486
|
// 这里为什么用 sourceItem.id不用 sourceItem 是因为 sourceItem 有可能是 highlight 过得
|
|
496
487
|
_this._addDropNode(targetItem.id, sourceItem.id, _dataCache, dataCache);
|
|
497
488
|
} else {
|
|
498
|
-
_this.switchDropNode(targetItem.id, sourceItem.id, _dataCache, dataCache
|
|
489
|
+
_this.switchDropNode(targetItem.id, sourceItem.id, _dataCache, dataCache);
|
|
499
490
|
}
|
|
500
491
|
|
|
501
492
|
var _sourceItem = (0, _util.findNode)(sourceItem.id, dataCache);
|
|
502
493
|
|
|
503
494
|
var _targetItem = (0, _util.findNode)(targetItem.id, dataCache);
|
|
504
495
|
|
|
505
|
-
|
|
506
|
-
if (_this.props.onDrop(_sourceItem, _targetItem, {
|
|
507
|
-
before: dataCache,
|
|
508
|
-
after: _dataCache
|
|
509
|
-
}, {
|
|
510
|
-
before: before,
|
|
511
|
-
after: dropDividerPosition === 'sub' ? after + 1 : after
|
|
512
|
-
})) {
|
|
513
|
-
_this.props.onDropEnd(_sourceItem, _targetItem, dropDividerPosition);
|
|
514
|
-
|
|
515
|
-
_this.setState({
|
|
516
|
-
dataCache: _dataCache
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
} else {
|
|
520
|
-
_this.props.onDropEnd(_sourceItem, _targetItem, dropDividerPosition);
|
|
496
|
+
_this.props.onDrop(_sourceItem, _targetItem);
|
|
521
497
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
}
|
|
498
|
+
_this.setState({
|
|
499
|
+
dataCache: _dataCache
|
|
500
|
+
});
|
|
526
501
|
});
|
|
527
|
-
|
|
502
|
+
|
|
503
|
+
_defineProperty(_assertThisInitialized(_this), "_deleteNode", function (itemId, data) {
|
|
528
504
|
data.forEach(function (d, index) {
|
|
529
505
|
if (d.id === itemId) {
|
|
530
506
|
data.splice(index, 1);
|
|
531
507
|
} else {
|
|
532
508
|
if (d.children) {
|
|
533
|
-
_this.
|
|
509
|
+
_this._deleteNode(itemId, d.children);
|
|
534
510
|
}
|
|
535
511
|
}
|
|
536
512
|
});
|
|
537
513
|
});
|
|
538
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_deleteNode", /*#__PURE__*/function () {
|
|
539
|
-
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(delNode) {
|
|
540
|
-
var dataCache, _dataCache, node, result;
|
|
541
|
-
|
|
542
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
543
|
-
while (1) {
|
|
544
|
-
switch (_context2.prev = _context2.next) {
|
|
545
|
-
case 0:
|
|
546
|
-
dataCache = _this.state.dataCache;
|
|
547
|
-
_dataCache = (0, _cloneDeep["default"])(dataCache);
|
|
548
|
-
node = (0, _util.findNode)(delNode.id, dataCache);
|
|
549
|
-
|
|
550
|
-
_this.__deleteNode(delNode.id, _dataCache);
|
|
551
|
-
|
|
552
|
-
if (!_this.props.onBeforeDelete) {
|
|
553
|
-
_context2.next = 12;
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
result = _this.props.onBeforeDelete(node, {
|
|
558
|
-
before: dataCache,
|
|
559
|
-
after: _dataCache
|
|
560
|
-
}, delNode.level);
|
|
561
|
-
|
|
562
|
-
if (!(result.toString() === '[object Promise]')) {
|
|
563
|
-
_context2.next = 9;
|
|
564
|
-
break;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
_context2.next = 9;
|
|
568
|
-
return result.then(function (res) {
|
|
569
|
-
result = res;
|
|
570
|
-
})["catch"](function () {
|
|
571
|
-
result = false;
|
|
572
|
-
});
|
|
573
|
-
|
|
574
|
-
case 9:
|
|
575
|
-
if (result === true) {
|
|
576
|
-
_this.setState({
|
|
577
|
-
dataCache: _dataCache
|
|
578
|
-
});
|
|
579
|
-
|
|
580
|
-
_this.props.onDelete(node, _dataCache);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
_context2.next = 14;
|
|
584
|
-
break;
|
|
585
|
-
|
|
586
|
-
case 12:
|
|
587
|
-
_this.setState({
|
|
588
|
-
dataCache: _dataCache
|
|
589
|
-
});
|
|
590
|
-
|
|
591
|
-
_this.props.onDelete(node, _dataCache);
|
|
592
|
-
|
|
593
|
-
case 14:
|
|
594
|
-
case "end":
|
|
595
|
-
return _context2.stop();
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
}, _callee2);
|
|
599
|
-
}));
|
|
600
514
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
};
|
|
604
|
-
}());
|
|
605
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSetHighlight", function (item) {
|
|
606
|
-
_this.setState({
|
|
607
|
-
highlight: item.id
|
|
608
|
-
});
|
|
609
|
-
});
|
|
610
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "showRightClickMenu", function (item, e, level) {
|
|
611
|
-
var rect = e.target ? e.target.getBoundingClientRect() : {
|
|
612
|
-
left: 0,
|
|
613
|
-
top: 0,
|
|
614
|
-
width: 0
|
|
615
|
-
};
|
|
616
|
-
|
|
617
|
-
var _st = document.documentElement.scrollTop || document.body.scrollTop;
|
|
515
|
+
_defineProperty(_assertThisInitialized(_this), "deleteNode", function (itemId) {
|
|
516
|
+
var dataCache = _this.state.dataCache;
|
|
618
517
|
|
|
619
|
-
var
|
|
518
|
+
var _dataCache = (0, _cloneDeep["default"])(dataCache);
|
|
620
519
|
|
|
621
|
-
|
|
622
|
-
return;
|
|
623
|
-
}
|
|
520
|
+
_this._deleteNode(itemId, _dataCache);
|
|
624
521
|
|
|
625
|
-
|
|
626
|
-
|
|
522
|
+
_this.setState({
|
|
523
|
+
dataCache: _dataCache
|
|
524
|
+
});
|
|
627
525
|
|
|
628
|
-
|
|
629
|
-
_cm = contextMenu;
|
|
630
|
-
}
|
|
526
|
+
var node = (0, _util.findNode)(itemId, dataCache);
|
|
631
527
|
|
|
632
|
-
|
|
633
|
-
|
|
528
|
+
_this.props.onDelete(node, _dataCache);
|
|
529
|
+
});
|
|
634
530
|
|
|
635
|
-
|
|
636
|
-
|
|
531
|
+
_defineProperty(_assertThisInitialized(_this), "renderRightClickMenu", function (item) {
|
|
532
|
+
return item.id === _this.state.showRightClickMenu && /*#__PURE__*/_react["default"].createElement("ul", {
|
|
533
|
+
className: "right-click-menu"
|
|
534
|
+
}, /*#__PURE__*/_react["default"].createElement("li", {
|
|
535
|
+
onClick: function onClick() {
|
|
536
|
+
return _this.addSiblingNode(item.id);
|
|
637
537
|
}
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
className: "right-click-menu theme__".concat(_this.props.theme),
|
|
642
|
-
style: {
|
|
643
|
-
left: rect.left + rect.width + 5,
|
|
644
|
-
top: rect.top + _st
|
|
538
|
+
}, "\u6DFB\u52A0\u8282\u70B9"), /*#__PURE__*/_react["default"].createElement("li", {
|
|
539
|
+
onClick: function onClick() {
|
|
540
|
+
return _this.addChildNode(item);
|
|
645
541
|
}
|
|
646
|
-
},
|
|
647
|
-
|
|
648
|
-
return _this.
|
|
649
|
-
} else {
|
|
650
|
-
return _this.defaultEditNodeMenu['customer'](item, cm, index, level);
|
|
542
|
+
}, "\u6DFB\u52A0\u5B50\u8282\u70B9"), /*#__PURE__*/_react["default"].createElement("li", {
|
|
543
|
+
onClick: function onClick() {
|
|
544
|
+
return _this.editNode(item);
|
|
651
545
|
}
|
|
652
|
-
})
|
|
653
|
-
|
|
654
|
-
|
|
546
|
+
}, "\u7F16\u8F91"), /*#__PURE__*/_react["default"].createElement("li", {
|
|
547
|
+
onClick: function onClick() {
|
|
548
|
+
_this.setCurrentDeleteNode(item.id);
|
|
549
|
+
|
|
550
|
+
_this.openModal();
|
|
655
551
|
}
|
|
552
|
+
}, "\u5220\u9664"));
|
|
553
|
+
});
|
|
656
554
|
|
|
657
|
-
|
|
658
|
-
|
|
555
|
+
_defineProperty(_assertThisInitialized(_this), "onSetHighlight", function (item) {
|
|
556
|
+
_this.setState({
|
|
557
|
+
highlight: item.id
|
|
558
|
+
});
|
|
559
|
+
});
|
|
659
560
|
|
|
561
|
+
_defineProperty(_assertThisInitialized(_this), "showRightClickMenu", function (item) {
|
|
660
562
|
_this.setState({
|
|
661
|
-
|
|
563
|
+
showRightClickMenu: item.id,
|
|
662
564
|
highlight: item.id
|
|
663
565
|
});
|
|
664
566
|
});
|
|
665
|
-
|
|
567
|
+
|
|
568
|
+
_defineProperty(_assertThisInitialized(_this), "closeRightClickMenu", function () {
|
|
666
569
|
_this.setState({
|
|
667
|
-
contextMenuPanel: null,
|
|
668
570
|
showRightClickMenu: null
|
|
669
571
|
});
|
|
670
572
|
});
|
|
671
|
-
|
|
573
|
+
|
|
574
|
+
_defineProperty(_assertThisInitialized(_this), "setTargetNode", function (id, position) {
|
|
575
|
+
_this.setState({
|
|
576
|
+
targetNode: id,
|
|
577
|
+
dropDividerPosition: position
|
|
578
|
+
});
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
_defineProperty(_assertThisInitialized(_this), "removeTargetNode", function () {
|
|
582
|
+
_this.setState({
|
|
583
|
+
targetNode: null
|
|
584
|
+
});
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
_defineProperty(_assertThisInitialized(_this), "openModal", function () {
|
|
672
588
|
_this.setState({
|
|
673
589
|
showModal: true
|
|
674
590
|
});
|
|
675
591
|
});
|
|
676
|
-
|
|
592
|
+
|
|
593
|
+
_defineProperty(_assertThisInitialized(_this), "setCurrentDeleteNode", function (nodeId) {
|
|
677
594
|
_this.setState({
|
|
678
|
-
currentDeleteNode:
|
|
595
|
+
currentDeleteNode: nodeId
|
|
679
596
|
});
|
|
680
597
|
});
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
var level = arguments.length > 2 ? arguments[2] : undefined;
|
|
598
|
+
|
|
599
|
+
_defineProperty(_assertThisInitialized(_this), "renderTree", function (data) {
|
|
684
600
|
var _this$props2 = _this.props,
|
|
685
601
|
draggable = _this$props2.draggable,
|
|
686
602
|
prefixCls = _this$props2.prefixCls,
|
|
687
603
|
semiChecked = _this$props2.semiChecked,
|
|
604
|
+
onNodeClick = _this$props2.onNodeClick,
|
|
688
605
|
onClick = _this$props2.onClick,
|
|
689
606
|
highlightable = _this$props2.highlightable,
|
|
690
|
-
defaultHighlightId = _this$props2.defaultHighlightId,
|
|
691
607
|
checkable = _this$props2.checkable,
|
|
692
608
|
closeExpandedTreeNode = _this$props2.closeExpandedTreeNode,
|
|
693
609
|
expandTreeNode = _this$props2.expandTreeNode,
|
|
@@ -697,29 +613,28 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
697
613
|
checked = _this$props2.checked,
|
|
698
614
|
expanded = _this$props2.expanded,
|
|
699
615
|
origin = _this$props2.origin,
|
|
700
|
-
onDragStart = _this$props2.onDragStart
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
616
|
+
onDragStart = _this$props2.onDragStart;
|
|
617
|
+
var _this$state6 = _this.state,
|
|
618
|
+
highlight = _this$state6.highlight,
|
|
619
|
+
editNodes = _this$state6.editNodes,
|
|
620
|
+
editingNodes = _this$state6.editingNodes,
|
|
621
|
+
draggingNode = _this$state6.draggingNode,
|
|
622
|
+
targetNode = _this$state6.targetNode,
|
|
623
|
+
dropDividerPosition = _this$state6.dropDividerPosition,
|
|
624
|
+
positionX = _this$state6.positionX,
|
|
625
|
+
positionY = _this$state6.positionY;
|
|
626
|
+
return /*#__PURE__*/_react["default"].createElement("ul", null, data.map(function (item) {
|
|
708
627
|
return /*#__PURE__*/_react["default"].createElement(_TreeItem["default"], {
|
|
709
628
|
origin: origin,
|
|
710
|
-
showLine: showLine,
|
|
711
629
|
key: item.id,
|
|
712
|
-
level: level,
|
|
713
|
-
isRoot: allData.some(function (d) {
|
|
714
|
-
return d.id === item.id;
|
|
715
|
-
}),
|
|
716
|
-
isLevelLast: index === data.length - 1,
|
|
717
630
|
editable: editable,
|
|
631
|
+
dropDividerPosition: dropDividerPosition,
|
|
718
632
|
prefixCls: prefixCls,
|
|
719
633
|
draggable: draggable,
|
|
720
|
-
onDragStart: onDragStart
|
|
634
|
+
onDragStart: onDragStart // onDrop={onDrop}
|
|
635
|
+
,
|
|
721
636
|
checked: !!checked.includes(item.id),
|
|
722
|
-
highlight: highlight
|
|
637
|
+
highlight: highlight,
|
|
723
638
|
highlightable: highlightable,
|
|
724
639
|
editNodes: editNodes,
|
|
725
640
|
editingNodes: editingNodes,
|
|
@@ -727,28 +642,39 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
727
642
|
expandTreeNode: expandTreeNode,
|
|
728
643
|
itemStyle: (0, _classnames["default"])(checkable && 'has_checkbox'),
|
|
729
644
|
semiChecked: semiChecked,
|
|
730
|
-
theme: _this.props.theme,
|
|
731
645
|
checkable: checkable,
|
|
732
646
|
onExpanded: onExpanded,
|
|
733
647
|
onValueChange: _this.onValueChange,
|
|
734
648
|
renderTree: _this.renderTree,
|
|
649
|
+
setPosition: _this.setPosition,
|
|
650
|
+
positionX: positionX,
|
|
651
|
+
positionY: positionY,
|
|
735
652
|
renderSwitcher: _this.renderSwitcher,
|
|
736
653
|
cancelAddSiblingNode: _this.cancelAddSiblingNode,
|
|
737
|
-
|
|
654
|
+
renderRightClickMenu: _this.renderRightClickMenu,
|
|
738
655
|
onCheckChange: onCheckChange,
|
|
739
656
|
saveEditNode: _this.saveEditNode,
|
|
657
|
+
renderItemIcon: _this.renderItemIcon,
|
|
658
|
+
onNodeClick: onNodeClick,
|
|
740
659
|
onClick: onClick,
|
|
741
660
|
onSetHighlight: _this.onSetHighlight,
|
|
742
661
|
showRightClickMenu: _this.showRightClickMenu,
|
|
743
662
|
closeRightClickMenu: _this.closeRightClickMenu,
|
|
744
663
|
dropNode: _this.dropNode,
|
|
664
|
+
setDraggingNode: _this.setDraggingNode,
|
|
665
|
+
removeDraggingNode: _this.removeDraggingNode,
|
|
666
|
+
draggingNode: draggingNode,
|
|
745
667
|
closeExpandedTreeNode: closeExpandedTreeNode,
|
|
668
|
+
setTargetNode: _this.setTargetNode,
|
|
669
|
+
targetNode: targetNode,
|
|
670
|
+
removeTargetNode: _this.removeTargetNode,
|
|
746
671
|
cancelEditNode: _this.cancelEditNode,
|
|
747
672
|
item: item,
|
|
748
673
|
loadChildren: _this.loadChildren
|
|
749
674
|
});
|
|
750
675
|
}));
|
|
751
676
|
});
|
|
677
|
+
|
|
752
678
|
_this.state = {
|
|
753
679
|
highlight: null,
|
|
754
680
|
showRightClickMenu: null,
|
|
@@ -758,101 +684,43 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
758
684
|
editNodes: [],
|
|
759
685
|
// 存储编辑节点的状态
|
|
760
686
|
editingNodes: [],
|
|
687
|
+
// 处于拖拽状态的节点
|
|
688
|
+
draggingNode: null,
|
|
689
|
+
// 处于目标状态的节点
|
|
690
|
+
targetNode: null,
|
|
691
|
+
// 放置线的位置,分为下线和子线,下线则放置在该节点下侧,子线为放置在该节点内部
|
|
692
|
+
dropDividerPosition: null,
|
|
761
693
|
searchValue: '',
|
|
762
694
|
showModal: false,
|
|
763
695
|
currentDeleteNode: null,
|
|
764
696
|
// 总共高亮的项
|
|
765
697
|
highlightNum: 0,
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
var _props$localeDatas$tr = props.localeDatas.tree,
|
|
769
|
-
_addNode = _props$localeDatas$tr.addNode,
|
|
770
|
-
_addChildNode = _props$localeDatas$tr.addChildNode,
|
|
771
|
-
edit = _props$localeDatas$tr.edit,
|
|
772
|
-
del = _props$localeDatas$tr.del;
|
|
773
|
-
_this.defaultEditNodeMenu = {
|
|
774
|
-
'editNode': function editNode(item, menu, index, level) {
|
|
775
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
776
|
-
key: index,
|
|
777
|
-
onClick: function onClick() {
|
|
778
|
-
var node = (0, _util.findNode)(item.id, _this.state.dataCache);
|
|
779
|
-
menu.onClick ? menu.onClick(node, (0, _assertThisInitialized2["default"])(_this)) : _this.editNode(node);
|
|
780
|
-
|
|
781
|
-
_this.closeRightClickMenu();
|
|
782
|
-
}
|
|
783
|
-
}, menu.title || edit);
|
|
784
|
-
},
|
|
785
|
-
'addChildNode': function addChildNode(item, menu, index, level) {
|
|
786
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
787
|
-
key: index,
|
|
788
|
-
onClick: function onClick() {
|
|
789
|
-
menu.onClick ? menu.onClick(item, (0, _assertThisInitialized2["default"])(_this)) : _this.addChildNode(item);
|
|
790
|
-
|
|
791
|
-
_this.closeRightClickMenu();
|
|
792
|
-
}
|
|
793
|
-
}, menu.title || _addChildNode);
|
|
794
|
-
},
|
|
795
|
-
'addSiblingNode': function addSiblingNode(item, menu, index, level) {
|
|
796
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
797
|
-
key: index,
|
|
798
|
-
onClick: function onClick() {
|
|
799
|
-
menu.onClick ? menu.onClick(item, (0, _assertThisInitialized2["default"])(_this)) : _this.addSiblingNode(item.id);
|
|
800
|
-
|
|
801
|
-
_this.closeRightClickMenu();
|
|
802
|
-
}
|
|
803
|
-
}, menu.title || _addNode);
|
|
804
|
-
},
|
|
805
|
-
'deleteNode': function deleteNode(item, menu, index, level) {
|
|
806
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
807
|
-
key: index,
|
|
808
|
-
onClick: function onClick() {
|
|
809
|
-
menu.onClick ? menu.onClick(item, (0, _assertThisInitialized2["default"])(_this)) : _this.deleteNode(item, level);
|
|
810
|
-
|
|
811
|
-
_this.closeRightClickMenu();
|
|
812
|
-
}
|
|
813
|
-
}, menu.title || del);
|
|
814
|
-
},
|
|
815
|
-
'customer': function customer(item, menu, index) {
|
|
816
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
817
|
-
key: index,
|
|
818
|
-
onClick: function onClick() {
|
|
819
|
-
menu.onClick && menu.onClick(item);
|
|
820
|
-
|
|
821
|
-
_this.closeRightClickMenu();
|
|
822
|
-
}
|
|
823
|
-
}, menu.title);
|
|
824
|
-
}
|
|
698
|
+
positionX: null,
|
|
699
|
+
positionY: null
|
|
825
700
|
};
|
|
826
701
|
return _this;
|
|
827
702
|
}
|
|
828
703
|
|
|
829
|
-
(
|
|
704
|
+
_createClass(TreeNode, [{
|
|
830
705
|
key: "render",
|
|
831
706
|
value: function render() {
|
|
832
707
|
var _this2 = this;
|
|
833
708
|
|
|
834
|
-
var _this$
|
|
835
|
-
dataCache = _this$
|
|
836
|
-
searchValue = _this$
|
|
837
|
-
highlightNum = _this$
|
|
838
|
-
var
|
|
839
|
-
searchable = _this$props3.searchable,
|
|
840
|
-
localeDatas = _this$props3.localeDatas;
|
|
841
|
-
var _localeDatas$tree = localeDatas.tree,
|
|
842
|
-
searchPlaceholder = _localeDatas$tree.searchPlaceholder,
|
|
843
|
-
searchEmptyResult = _localeDatas$tree.searchEmptyResult,
|
|
844
|
-
modalTitle = _localeDatas$tree.modalTitle,
|
|
845
|
-
delTips = _localeDatas$tree.delTips;
|
|
709
|
+
var _this$state7 = this.state,
|
|
710
|
+
dataCache = _this$state7.dataCache,
|
|
711
|
+
searchValue = _this$state7.searchValue,
|
|
712
|
+
highlightNum = _this$state7.highlightNum;
|
|
713
|
+
var searchable = this.props.searchable;
|
|
846
714
|
return /*#__PURE__*/_react["default"].createElement("div", null, searchable && /*#__PURE__*/_react["default"].createElement("div", {
|
|
847
715
|
className: "hi-tree__searcher"
|
|
848
716
|
}, /*#__PURE__*/_react["default"].createElement(_input["default"], {
|
|
849
717
|
value: this.state.searchValue,
|
|
850
718
|
type: "text",
|
|
851
|
-
placeholder:
|
|
719
|
+
placeholder: "\u5173\u952E\u8BCD\u641C\u7D22",
|
|
852
720
|
onChange: function onChange(e) {
|
|
853
721
|
_this2.setState({
|
|
854
722
|
searchValue: e.target.value,
|
|
855
|
-
highlightNum: _this2.recordHighlight(dataCache, e.target.value,
|
|
723
|
+
highlightNum: _this2.recordHighlight(dataCache, e.target.value, 0)
|
|
856
724
|
});
|
|
857
725
|
|
|
858
726
|
_this2.props.setExpandTreeNodes((0, _util.collectExpandId)(dataCache, e.target.value, [], dataCache));
|
|
@@ -860,7 +728,8 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
860
728
|
append: /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
861
729
|
name: "search",
|
|
862
730
|
style: {
|
|
863
|
-
|
|
731
|
+
color: '#4284F5',
|
|
732
|
+
fontSize: '24px'
|
|
864
733
|
}
|
|
865
734
|
}),
|
|
866
735
|
style: {
|
|
@@ -868,11 +737,11 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
868
737
|
}
|
|
869
738
|
}), highlightNum === 0 && searchValue !== '' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
870
739
|
className: "hi-tree__searcher--empty"
|
|
871
|
-
},
|
|
872
|
-
title:
|
|
740
|
+
}, "\u672A\u627E\u5230\u641C\u7D22\u7ED3\u679C")), searchable ? this.renderTree(this.highlightData((0, _cloneDeep["default"])(dataCache), searchValue)) : this.renderTree((0, _cloneDeep["default"])(dataCache)), /*#__PURE__*/_react["default"].createElement(_modal["default"], {
|
|
741
|
+
title: "\u63D0\u793A",
|
|
873
742
|
show: this.state.showModal,
|
|
874
743
|
onConfirm: function onConfirm() {
|
|
875
|
-
_this2.
|
|
744
|
+
_this2.deleteNode(_this2.state.currentDeleteNode);
|
|
876
745
|
|
|
877
746
|
_this2.setState({
|
|
878
747
|
showModal: false
|
|
@@ -883,13 +752,7 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
883
752
|
showModal: false
|
|
884
753
|
});
|
|
885
754
|
}
|
|
886
|
-
}, /*#__PURE__*/_react["default"].createElement("span", null,
|
|
887
|
-
clickOutSide: function clickOutSide() {
|
|
888
|
-
_this2.setState({
|
|
889
|
-
contextMenuPanel: null
|
|
890
|
-
});
|
|
891
|
-
}
|
|
892
|
-
}, this.state.contextMenuPanel));
|
|
755
|
+
}, /*#__PURE__*/_react["default"].createElement("span", null, "\u5220\u9664\u8282\u70B9\u5C06\u5220\u9664\u6240\u6709\u5B50\u8282\u70B9\uFF0C\u786E\u5B9A\u5220\u9664\u5417\uFF1F")));
|
|
893
756
|
}
|
|
894
757
|
}], [{
|
|
895
758
|
key: "getDerivedStateFromProps",
|
|
@@ -902,12 +765,10 @@ var TreeNode = /*#__PURE__*/function (_Component) {
|
|
|
902
765
|
}
|
|
903
766
|
|
|
904
767
|
return state;
|
|
905
|
-
}
|
|
906
|
-
|
|
768
|
+
}
|
|
907
769
|
}]);
|
|
770
|
+
|
|
908
771
|
return TreeNode;
|
|
909
772
|
}(_react.Component);
|
|
910
773
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
exports["default"] = _default;
|
|
774
|
+
exports["default"] = TreeNode;
|