@web-utils/component 2.0.13 → 2.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/dist/chunks/3a79781b.js +75 -0
  2. package/dist/chunks/{44b78389.js → 41a066be.js} +8 -8
  3. package/dist/chunks/{e1939731.js → 5a78e0db.js} +5 -6
  4. package/dist/chunks/5d4282fb.js +30 -0
  5. package/dist/chunks/{822300f3.js → 61ad06b2.js} +3 -3
  6. package/dist/chunks/76680a03.js +24 -0
  7. package/dist/chunks/8c0142e0.js +81 -0
  8. package/dist/chunks/97652d86.js +26 -0
  9. package/dist/chunks/b4acd3a6.js +126 -0
  10. package/dist/chunks/f71045fc.js +184 -0
  11. package/dist/components/address-input/index.js +43 -56
  12. package/dist/components/address-input/style.css +1 -15
  13. package/dist/components/aside-menu/index.js +30 -36
  14. package/dist/components/aside-menu/style.css +1 -9
  15. package/dist/components/awesome-button/index.js +32 -35
  16. package/dist/components/base.css +1 -66
  17. package/dist/components/capsule-tab/index.js +27 -33
  18. package/dist/components/capsule-tab/style.css +1 -32
  19. package/dist/components/chunk-file-uploader/index.js +54 -88
  20. package/dist/components/chunk-file-uploader/style.css +1 -4
  21. package/dist/components/chunk-file-uploader-button/index.js +25 -31
  22. package/dist/components/chunk-file-uploader-button/style.css +1 -17
  23. package/dist/components/chunk-file-uploader-drop/index.js +28 -42
  24. package/dist/components/chunk-file-uploader-drop/style.css +1 -12
  25. package/dist/components/chunk-file-uploader-file/index.js +134 -211
  26. package/dist/components/chunk-file-uploader-file/style.css +1 -125
  27. package/dist/components/chunk-file-uploader-files/index.js +28 -34
  28. package/dist/components/chunk-file-uploader-files/style.css +1 -9
  29. package/dist/components/chunk-file-uploader-list/index.js +29 -35
  30. package/dist/components/chunk-file-uploader-list/style.css +1 -9
  31. package/dist/components/chunk-file-uploader-un-support/index.js +30 -38
  32. package/dist/components/chunk-file-uploader-un-support/style.css +1 -6
  33. package/dist/components/code-mirror-editor/index.js +153 -181
  34. package/dist/components/code-mirror-editor/style.css +1 -17
  35. package/dist/components/color-picker/index.js +49 -68
  36. package/dist/components/confirm-button/index.js +19 -21
  37. package/dist/components/confirmable/index.js +18 -19
  38. package/dist/components/context-menu/index.js +108 -130
  39. package/dist/components/context-menu/style.css +1 -88
  40. package/dist/components/custom-scrollbar/index.js +49 -67
  41. package/dist/components/data-table-picker/index.js +62 -81
  42. package/dist/components/dynamic-table/index.js +89 -113
  43. package/dist/components/dynamic-table/style.css +1 -30
  44. package/dist/components/e-charts/index.js +120 -201
  45. package/dist/components/e-charts/style.css +1 -10
  46. package/dist/components/editable-progress/index.js +60 -93
  47. package/dist/components/editable-progress/style.css +1 -37
  48. package/dist/components/editable-tree/index.js +423 -638
  49. package/dist/components/editable-tree/style.css +1 -82
  50. package/dist/components/egd-collapse/index.js +33 -46
  51. package/dist/components/egd-collapse-item/index.js +60 -76
  52. package/dist/components/element-dialog/index.js +95 -147
  53. package/dist/components/element-dialog/style.css +1 -102
  54. package/dist/components/empty-view/index.js +28 -34
  55. package/dist/components/empty-view/style.css +1 -17
  56. package/dist/components/error-view/index.js +26 -32
  57. package/dist/components/error-view/style.css +1 -17
  58. package/dist/components/flex-column/index.js +25 -40
  59. package/dist/components/flex-item/index.js +29 -57
  60. package/dist/components/flex-row/index.js +25 -40
  61. package/dist/components/flex-scroller/index.js +26 -32
  62. package/dist/components/flex-scroller/style.css +1 -20
  63. package/dist/components/form-button/index.js +34 -38
  64. package/dist/components/form-cascader/index.js +71 -81
  65. package/dist/components/form-checkbox-group/index.js +88 -113
  66. package/dist/components/form-checkbox-group/style.css +1 -51
  67. package/dist/components/form-date-picker/index.js +70 -132
  68. package/dist/components/form-holder/index.js +32 -39
  69. package/dist/components/form-input/index.js +56 -62
  70. package/dist/components/form-input-email/index.js +48 -60
  71. package/dist/components/form-input-id-card/index.js +53 -59
  72. package/dist/components/form-input-number/index.js +61 -68
  73. package/dist/components/form-input-number/style.css +1 -12
  74. package/dist/components/form-input-phone-number/index.js +49 -55
  75. package/dist/components/form-input-time/index.js +53 -59
  76. package/dist/components/form-item/index.js +80 -123
  77. package/dist/components/form-item/style.css +1 -11
  78. package/dist/components/form-item-config-provider/index.js +25 -26
  79. package/dist/components/form-item-group/index.js +85 -111
  80. package/dist/components/form-item-group/style.css +1 -30
  81. package/dist/components/form-radio-group/index.js +85 -104
  82. package/dist/components/form-radio-group/style.css +1 -53
  83. package/dist/components/form-select/index.js +76 -91
  84. package/dist/components/form-switch/index.js +51 -57
  85. package/dist/components/form-textarea/index.js +51 -57
  86. package/dist/components/form-view/index.js +165 -232
  87. package/dist/components/form-view/style.css +1 -158
  88. package/dist/components/guide-steps/index.js +44 -58
  89. package/dist/components/guide-steps/style.css +1 -34
  90. package/dist/components/icon-card/index.js +29 -35
  91. package/dist/components/icon-card/style.css +1 -56
  92. package/dist/components/iframe-window/index.js +29 -35
  93. package/dist/components/iframe-window/style.css +1 -20
  94. package/dist/components/image-viewer/index.js +48 -66
  95. package/dist/components/image-viewer/style.css +1 -21
  96. package/dist/components/input-number/index.js +127 -193
  97. package/dist/components/input-number/style.css +1 -15
  98. package/dist/components/input-number-range/index.js +45 -57
  99. package/dist/components/input-number-range/style.css +1 -12
  100. package/dist/components/j-s-x-component/index.js +4 -4
  101. package/dist/components/keep-view-alive/index.js +73 -120
  102. package/dist/components/loading-view/index.js +26 -32
  103. package/dist/components/loading-view/style.css +1 -17
  104. package/dist/components/nav-bar/index.js +27 -37
  105. package/dist/components/nav-bar/style.css +1 -17
  106. package/dist/components/not-implement/index.js +23 -31
  107. package/dist/components/not-implement/style.css +1 -15
  108. package/dist/components/page/index.js +22 -28
  109. package/dist/components/page/style.css +1 -12
  110. package/dist/components/page-header/index.js +30 -36
  111. package/dist/components/page-header/style.css +1 -14
  112. package/dist/components/page-index/index.js +62 -83
  113. package/dist/components/page-index/style.css +1 -23
  114. package/dist/components/page-index-top/index.js +53 -68
  115. package/dist/components/page-skeleton/index.js +31 -37
  116. package/dist/components/page-skeleton/style.css +1 -23
  117. package/dist/components/page-skeleton-new/index.js +42 -48
  118. package/dist/components/page-skeleton-new/style.css +1 -42
  119. package/dist/components/pageable-table/index.js +186 -253
  120. package/dist/components/pageable-table/style.css +1 -72
  121. package/dist/components/pageable-view/index.js +129 -199
  122. package/dist/components/pageable-view/style.css +1 -69
  123. package/dist/components/photo-swipe/index.js +110 -151
  124. package/dist/components/photo-swipe/style.css +1 -20
  125. package/dist/components/resize-observer/index.js +34 -68
  126. package/dist/components/resize-observer/style.css +1 -31
  127. package/dist/components/search-popover/index.js +153 -211
  128. package/dist/components/search-popover/style.css +1 -93
  129. package/dist/components/sign-panel/index.js +92 -142
  130. package/dist/components/sign-panel/style.css +1 -97
  131. package/dist/components/split-pane/index.js +101 -162
  132. package/dist/components/split-pane/style.css +1 -100
  133. package/dist/components/stateful/index.js +31 -34
  134. package/dist/components/stateful/style.css +1 -33
  135. package/dist/components/static-pageable-table/index.js +37 -44
  136. package/dist/components/static-pageable-table/style.css +1 -9
  137. package/dist/components/swiper/index.js +85 -150
  138. package/dist/components/swiper/style.css +1 -43
  139. package/dist/components/tab/index.js +54 -72
  140. package/dist/components/tab/style.css +1 -122
  141. package/dist/components/tab-item/index.js +30 -35
  142. package/dist/components/table-column/index.js +30 -32
  143. package/dist/components/table-view/index.js +156 -227
  144. package/dist/components/table-view/style.css +1 -95
  145. package/dist/components/tag-render/index.js +44 -58
  146. package/dist/components/tag-render/style.css +1 -33
  147. package/dist/components/tinymce-editor/index.js +79 -95
  148. package/dist/components/tinymce-editor/style.css +1 -43
  149. package/dist/components/tinymce-wrapper/index.js +92 -121
  150. package/dist/components/tinymce-wrapper/style.css +1 -36
  151. package/dist/components/toolbar/index.js +63 -84
  152. package/dist/components/toolbar/style.css +1 -39
  153. package/dist/components/toolbar-button/index.js +41 -48
  154. package/dist/components/toolbar-button/style.css +1 -21
  155. package/dist/components/trigger/index.js +29 -36
  156. package/dist/components/vue-tags-input/index.js +188 -308
  157. package/dist/components/vue-tags-input/style.css +1 -682
  158. package/dist/components/watermark/index.js +25 -37
  159. package/dist/components/watermark/style.css +1 -11
  160. package/dist/components/x-dialog/index.js +67 -93
  161. package/dist/components/x-dialog/style.css +1 -15
  162. package/dist/index.css +193 -1105
  163. package/dist/index.es.js +4790 -7243
  164. package/package.json +1 -1
  165. package/web-types.json +1 -1
  166. package/dist/chunks/3d28cc08.js +0 -57
  167. package/dist/chunks/5d33812d.js +0 -147
  168. package/dist/chunks/9d848bf6.js +0 -99
  169. package/dist/chunks/a0bb327b.js +0 -96
  170. package/dist/chunks/a8891d2c.js +0 -30
  171. package/dist/chunks/c69d5628.js +0 -248
  172. package/dist/chunks/de9fe802.js +0 -24
@@ -1,365 +1,355 @@
1
- import { hasOwn, addResizeListener, removeResizeListener, isVerticalScrollbarVisible, scrollbarWidth, computePosition, isPlainObject, cloneDeep, isFunction, isUndefined, isNotEmpty, fastClone, delay, findTreeChildren } from "@web-utils/core";
2
- import { a as filterTreeProperties, b as filterTreeEvents, c as assignReactiveProperties } from "../../chunks/c69d5628.js";
3
- import { n as normalizeComponent } from "../../chunks/3d28cc08.js";
4
- var render = function() {
5
- var _vm = this;
6
- var _h = _vm.$createElement;
7
- var _c = _vm._self._c || _h;
8
- return _c("div", {
1
+ import { hasOwn as d, addResizeListener as h, removeResizeListener as u, isVerticalScrollbarVisible as x, scrollbarWidth as w, computePosition as N, isPlainObject as r, cloneDeep as p, isFunction as f, isUndefined as l, isNotEmpty as C, fastClone as v, delay as g, findTreeChildren as $ } from "@web-utils/core";
2
+ import { a as b, b as _, c } from "../../chunks/f71045fc.js";
3
+ import { n as k } from "../../chunks/5d4282fb.js";
4
+ var B = function() {
5
+ var e = this, t = e.$createElement, i = e._self._c || t;
6
+ return i("div", {
9
7
  staticClass: "editable-tree"
10
- }, [!_vm.readonly && _vm.addRootNodeButtonStyle === "top-right" ? _c("ElButton", {
8
+ }, [!e.readonly && e.addRootNodeButtonStyle === "top-right" ? i("ElButton", {
11
9
  staticStyle: {
12
- "position": "absolute",
13
- "top": "4px",
10
+ position: "absolute",
11
+ top: "4px",
14
12
  "z-index": "1"
15
13
  },
16
14
  style: {
17
- right: `${_vm.right}px`
15
+ right: `${e.right}px`
18
16
  },
19
17
  attrs: {
20
- "type": "primary",
21
- "size": "mini",
22
- "icon": "el-icon-plus",
23
- "circle": "",
24
- "plain": ""
18
+ type: "primary",
19
+ size: "mini",
20
+ icon: "el-icon-plus",
21
+ circle: "",
22
+ plain: ""
25
23
  },
26
24
  on: {
27
- "click": function($event) {
28
- $event.stopPropagation();
29
- return _vm.$emit("add-root-node");
25
+ click: function(a) {
26
+ return a.stopPropagation(), e.$emit("add-root-node");
30
27
  }
31
28
  }
32
- }) : _vm._e(), _c("div", {
29
+ }) : e._e(), i("div", {
33
30
  ref: "treeWrapper",
34
31
  staticClass: "et-tree-wrapper"
35
- }, [!_vm.readonly && _vm.addRootNodeButtonStyle === "top" ? _c("div", {
32
+ }, [!e.readonly && e.addRootNodeButtonStyle === "top" ? i("div", {
36
33
  staticStyle: {
37
34
  "padding-left": "24px"
38
35
  }
39
- }, [_c("ElButton", {
36
+ }, [i("ElButton", {
40
37
  attrs: {
41
- "disabled": _vm.loading,
42
- "size": "mini",
43
- "type": "text"
38
+ disabled: e.loading,
39
+ size: "mini",
40
+ type: "text"
44
41
  },
45
42
  on: {
46
- "click": _vm.appendRootNode
43
+ click: e.appendRootNode
47
44
  }
48
- }, [_c("i", {
45
+ }, [i("i", {
49
46
  staticClass: "el-icon-lx-add"
50
- }), _vm._v(" " + _vm._s(_vm.addRootNodeLabel ? _vm.addRootNodeLabel : `添加${_vm.label}`) + " ")])], 1) : _vm._e(), _c("ElTree", _vm._g(_vm._b({
51
- key: _vm.treeKey,
47
+ }), e._v(" " + e._s(e.addRootNodeLabel ? e.addRootNodeLabel : `添加${e.label}`) + " ")])], 1) : e._e(), i("ElTree", e._g(e._b({
48
+ key: e.treeKey,
52
49
  ref: "tree",
53
50
  staticClass: "flex-item",
54
51
  attrs: {
55
- "default-expanded-keys": _vm.expandedKeys,
56
- "expand-on-click-node": false,
52
+ "default-expanded-keys": e.expandedKeys,
53
+ "expand-on-click-node": !1,
57
54
  "highlight-current": "",
58
- "load": _vm.loadNode,
59
- "data": _vm.innerTreeData,
60
- "props": _vm.treeProps,
61
- "lazy": _vm.lazy,
62
- "node-key": _vm.nodeKey
55
+ load: e.loadNode,
56
+ data: e.innerTreeData,
57
+ props: e.treeProps,
58
+ lazy: e.lazy,
59
+ "node-key": e.nodeKey
63
60
  },
64
61
  on: {
65
- "node-click": _vm.nodeClick,
66
- "node-contextmenu": _vm.showContextMenu,
67
- "node-expand": _vm.addExpandKey,
68
- "node-collapse": _vm.removeExpandKey
62
+ "node-click": e.nodeClick,
63
+ "node-contextmenu": e.showContextMenu,
64
+ "node-expand": e.addExpandKey,
65
+ "node-collapse": e.removeExpandKey
69
66
  },
70
- scopedSlots: _vm._u([{
67
+ scopedSlots: e._u([{
71
68
  key: "default",
72
- fn: function(_ref) {
73
- var node = _ref.node, data = _ref.data;
74
- return [_vm._t("default", function() {
75
- return [!data.edit ? [_c("span", {
69
+ fn: function(a) {
70
+ var o = a.node, s = a.data;
71
+ return [e._t("default", function() {
72
+ return [s.edit ? [i("span", {
73
+ staticClass: "custom-tree-node flex-row flex-item oh",
74
+ attrs: {
75
+ "data-id": s.id
76
+ }
77
+ }, [e.icon ? i("i", {
78
+ staticClass: "node-icon shrink-0",
79
+ class: s.loading ? "el-icon-loading" : "el-icon-edit-outline"
80
+ }) : e._e(), i("ElInput", {
81
+ ref: "labelTxt",
82
+ staticClass: "node-input flex-item",
83
+ attrs: {
84
+ size: "mini",
85
+ placeholder: e.defaultOptions.inputPlaceholder
86
+ },
87
+ on: {
88
+ blur: function(n) {
89
+ return e.inputBlur(n, o, s);
90
+ }
91
+ },
92
+ nativeOn: {
93
+ keyup: function(n) {
94
+ return function(y) {
95
+ return e.inputKeyup(y, o, s);
96
+ }.apply(null, arguments);
97
+ },
98
+ click: function(n) {
99
+ n.stopPropagation();
100
+ }
101
+ },
102
+ model: {
103
+ value: e.text,
104
+ callback: function(n) {
105
+ e.text = n;
106
+ },
107
+ expression: "text"
108
+ }
109
+ }), e.confirmButton ? [i("ElButton", {
110
+ directives: [{
111
+ name: "show",
112
+ rawName: "v-show",
113
+ value: !s.loading,
114
+ expression: "!data.loading"
115
+ }],
116
+ staticClass: "shrink-0",
117
+ attrs: {
118
+ size: "mini",
119
+ type: "text"
120
+ },
121
+ on: {
122
+ click: function(n) {
123
+ return n.stopPropagation(), e.onConfirm(o, s);
124
+ }
125
+ }
126
+ }, [e._v("确定")]), i("ElButton", {
127
+ directives: [{
128
+ name: "show",
129
+ rawName: "v-show",
130
+ value: !s.loading,
131
+ expression: "!data.loading"
132
+ }],
133
+ staticClass: "shrink-0",
134
+ attrs: {
135
+ size: "mini",
136
+ type: "text"
137
+ },
138
+ on: {
139
+ click: function(n) {
140
+ return n.stopPropagation(), e.onCancel(o, s);
141
+ }
142
+ }
143
+ }, [e._v("取消")])] : e._e()], 2)] : [i("span", {
76
144
  staticClass: "custom-tree-node",
77
145
  attrs: {
78
- "data-id": data.id
146
+ "data-id": s.id
79
147
  }
80
- }, [_c("span", {
148
+ }, [i("span", {
81
149
  staticClass: "node-label flex-row flex-item oh ellipsis-1"
82
- }, [_vm.icon ? _c("i", {
150
+ }, [e.icon ? i("i", {
83
151
  staticClass: "node-icon",
84
- class: data.loading ? "el-icon-loading" : _vm.icon(data, node)
85
- }) : _vm._e(), _c("span", {
152
+ class: s.loading ? "el-icon-loading" : e.icon(s, o)
153
+ }) : e._e(), i("span", {
86
154
  staticClass: "flex-item-relative",
87
155
  staticStyle: {
88
- "height": "21px"
156
+ height: "21px"
89
157
  }
90
- }, [_c("span", {
158
+ }, [i("span", {
91
159
  staticClass: "ellipsis-1 absolute-box et-tree-label",
92
160
  attrs: {
93
- "title": node.label
161
+ title: o.label
94
162
  }
95
- }, [_vm._t("label", function() {
96
- return [_vm._v(_vm._s(node.label))];
163
+ }, [e._t("label", function() {
164
+ return [e._v(e._s(o.label))];
97
165
  }, {
98
- "data": data,
99
- "node": node
100
- })], 2)]), _vm._t("label-suffix", null, {
101
- "node": node,
102
- "data": data
103
- })], 2), !_vm.contextMenu && !_vm.readonly ? _c("span", {
166
+ data: s,
167
+ node: o
168
+ })], 2)]), e._t("label-suffix", null, {
169
+ node: o,
170
+ data: s
171
+ })], 2), !e.contextMenu && !e.readonly ? i("span", {
104
172
  directives: [{
105
173
  name: "show",
106
174
  rawName: "v-show",
107
- value: !data.loading && !_vm.loading,
175
+ value: !s.loading && !e.loading,
108
176
  expression: "!data.loading && !loading"
109
177
  }],
110
178
  staticClass: "handle-actions"
111
- }, [_c("ElButton", {
179
+ }, [i("ElButton", {
112
180
  attrs: {
113
- "size": "mini",
114
- "type": "text"
181
+ size: "mini",
182
+ type: "text"
115
183
  },
116
184
  on: {
117
- "click": function($event) {
118
- $event.stopPropagation();
119
- return _vm.appendChildNode(node, data);
185
+ click: function(n) {
186
+ return n.stopPropagation(), e.appendChildNode(o, s);
120
187
  }
121
188
  }
122
- }, [_vm._v("添加")]), _c("ElButton", {
189
+ }, [e._v("添加")]), i("ElButton", {
123
190
  attrs: {
124
- "size": "mini",
125
- "type": "text"
191
+ size: "mini",
192
+ type: "text"
126
193
  },
127
194
  on: {
128
- "click": function($event) {
129
- $event.stopPropagation();
130
- return _vm.editNode(node, data);
195
+ click: function(n) {
196
+ return n.stopPropagation(), e.editNode(o, s);
131
197
  }
132
198
  }
133
- }, [_vm._v("修改")]), _c("ElPopconfirm", {
199
+ }, [e._v("修改")]), i("ElPopconfirm", {
134
200
  staticClass: "pop-confirm",
135
201
  attrs: {
136
202
  "icon-color": "red",
137
- "title": "你确定要删除吗?"
203
+ title: "你确定要删除吗?"
138
204
  },
139
205
  on: {
140
- "confirm": function($event) {
141
- return _vm.removeNode(node, data);
206
+ confirm: function(n) {
207
+ return e.removeNode(o, s);
142
208
  }
143
209
  },
144
- scopedSlots: _vm._u([{
210
+ scopedSlots: e._u([{
145
211
  key: "reference",
146
212
  fn: function() {
147
- return [_c("ElButton", {
213
+ return [i("ElButton", {
148
214
  directives: [{
149
215
  name: "show",
150
216
  rawName: "v-show",
151
- value: node.isLeaf,
217
+ value: o.isLeaf,
152
218
  expression: "node.isLeaf"
153
219
  }],
154
220
  staticStyle: {
155
221
  "margin-left": "4px"
156
222
  },
157
223
  attrs: {
158
- "size": "mini",
159
- "type": "text"
224
+ size: "mini",
225
+ type: "text"
160
226
  },
161
227
  on: {
162
- "click": function($event) {
163
- $event.stopPropagation();
228
+ click: function(n) {
229
+ n.stopPropagation();
164
230
  }
165
231
  }
166
- }, [_vm._v("删除")])];
232
+ }, [e._v("删除")])];
167
233
  },
168
- proxy: true
169
- }], null, true)
170
- })], 1) : _vm._e(), _vm.contextMenuIcon && _vm.contextMenu && !_vm.readonly ? _c("span", {
234
+ proxy: !0
235
+ }], null, !0)
236
+ })], 1) : e._e(), e.contextMenuIcon && e.contextMenu && !e.readonly ? i("span", {
171
237
  directives: [{
172
238
  name: "show",
173
239
  rawName: "v-show",
174
- value: !data.loading && !_vm.loading,
240
+ value: !s.loading && !e.loading,
175
241
  expression: "!data.loading && !loading"
176
242
  }],
177
243
  staticClass: "handle-actions",
178
244
  staticStyle: {
179
- "display": "inline-block"
245
+ display: "inline-block"
180
246
  }
181
- }, [_c("ElButton", {
247
+ }, [i("ElButton", {
182
248
  staticStyle: {
183
- "padding": "6px 10px 0"
249
+ padding: "6px 10px 0"
184
250
  },
185
251
  attrs: {
186
- "size": "mini",
187
- "type": "text"
252
+ size: "mini",
253
+ type: "text"
188
254
  },
189
255
  on: {
190
- "click": function($event) {
191
- $event.stopPropagation();
192
- return _vm.showContextMenu($event, data, node);
256
+ click: function(n) {
257
+ return n.stopPropagation(), e.showContextMenu(n, s, o);
193
258
  }
194
259
  }
195
- }, [_vm._v(". . .")])], 1) : _vm._e()])] : [_c("span", {
196
- staticClass: "custom-tree-node flex-row flex-item oh",
197
- attrs: {
198
- "data-id": data.id
199
- }
200
- }, [_vm.icon ? _c("i", {
201
- staticClass: "node-icon shrink-0",
202
- class: data.loading ? "el-icon-loading" : "el-icon-edit-outline"
203
- }) : _vm._e(), _c("ElInput", {
204
- ref: "labelTxt",
205
- staticClass: "node-input flex-item",
206
- attrs: {
207
- "size": "mini",
208
- "placeholder": _vm.defaultOptions.inputPlaceholder
209
- },
210
- on: {
211
- "blur": function(event) {
212
- return _vm.inputBlur(event, node, data);
213
- }
214
- },
215
- nativeOn: {
216
- "keyup": function($event) {
217
- return function(event) {
218
- return _vm.inputKeyup(event, node, data);
219
- }.apply(null, arguments);
220
- },
221
- "click": function($event) {
222
- $event.stopPropagation();
223
- }
224
- },
225
- model: {
226
- value: _vm.text,
227
- callback: function($$v) {
228
- _vm.text = $$v;
229
- },
230
- expression: "text"
231
- }
232
- }), _vm.confirmButton ? [_c("ElButton", {
233
- directives: [{
234
- name: "show",
235
- rawName: "v-show",
236
- value: !data.loading,
237
- expression: "!data.loading"
238
- }],
239
- staticClass: "shrink-0",
240
- attrs: {
241
- "size": "mini",
242
- "type": "text"
243
- },
244
- on: {
245
- "click": function($event) {
246
- $event.stopPropagation();
247
- return _vm.onConfirm(node, data);
248
- }
249
- }
250
- }, [_vm._v("确定")]), _c("ElButton", {
251
- directives: [{
252
- name: "show",
253
- rawName: "v-show",
254
- value: !data.loading,
255
- expression: "!data.loading"
256
- }],
257
- staticClass: "shrink-0",
258
- attrs: {
259
- "size": "mini",
260
- "type": "text"
261
- },
262
- on: {
263
- "click": function($event) {
264
- $event.stopPropagation();
265
- return _vm.onCancel(node, data);
266
- }
267
- }
268
- }, [_vm._v("取消")])] : _vm._e()], 2)]];
260
+ }, [e._v(". . .")])], 1) : e._e()])]];
269
261
  }, {
270
- "node": node,
271
- "data": data
262
+ node: o,
263
+ data: s
272
264
  })];
273
265
  }
274
- }], null, true)
275
- }, "ElTree", _vm.filterTreeProperties(_vm.$attrs), false), _vm.filterTreeEvents(_vm.$listeners))), _vm.contextMenu && !_vm.readonly ? _c("div", {
266
+ }], null, !0)
267
+ }, "ElTree", e.filterTreeProperties(e.$attrs), !1), e.filterTreeEvents(e.$listeners))), e.contextMenu && !e.readonly ? i("div", {
276
268
  directives: [{
277
269
  name: "show",
278
270
  rawName: "v-show",
279
- value: _vm.showMenu,
271
+ value: e.showMenu,
280
272
  expression: "showMenu"
281
273
  }],
282
274
  ref: "contextMenu",
283
275
  staticClass: "menu",
284
- style: _vm.position
285
- }, [_c("ul", {
276
+ style: e.position
277
+ }, [i("ul", {
286
278
  staticClass: "menu-list"
287
- }, [_vm._t("context-menu", function() {
288
- return [_c("li", {
279
+ }, [e._t("context-menu", function() {
280
+ return [i("li", {
289
281
  directives: [{
290
282
  name: "show",
291
283
  rawName: "v-show",
292
- value: _vm.curData.id > -1,
284
+ value: e.curData.id > -1,
293
285
  expression: "curData.id > -1"
294
286
  }],
295
287
  staticClass: "menu-item",
296
288
  on: {
297
- "click": function($event) {
298
- return _vm.appendPeerNode(_vm.curNode, _vm.curData);
289
+ click: function(a) {
290
+ return e.appendPeerNode(e.curNode, e.curData);
299
291
  }
300
292
  }
301
- }, [_c("i", {
293
+ }, [i("i", {
302
294
  staticClass: "menu-item-icon el-icon-lx-add",
303
295
  staticStyle: {
304
- "color": "#228b22"
296
+ color: "#228b22"
305
297
  }
306
- }), _vm._v(_vm._s(_vm.menuLabel.appendPeer) + " ")]), _c("li", {
298
+ }), e._v(e._s(e.menuLabel.appendPeer) + " ")]), i("li", {
307
299
  staticClass: "menu-item",
308
300
  on: {
309
- "click": function($event) {
310
- return _vm.appendChildNode(_vm.curNode, _vm.curData);
301
+ click: function(a) {
302
+ return e.appendChildNode(e.curNode, e.curData);
311
303
  }
312
304
  }
313
- }, [_c("i", {
305
+ }, [i("i", {
314
306
  staticClass: "menu-item-icon el-icon-lx-add",
315
307
  staticStyle: {
316
- "color": "#228b22"
308
+ color: "#228b22"
317
309
  }
318
- }), _vm._v(_vm._s(_vm.menuLabel.appendChild) + " ")]), _c("li", {
310
+ }), e._v(e._s(e.menuLabel.appendChild) + " ")]), i("li", {
319
311
  directives: [{
320
312
  name: "show",
321
313
  rawName: "v-show",
322
- value: _vm.curData.id > -1,
314
+ value: e.curData.id > -1,
323
315
  expression: "curData.id > -1"
324
316
  }],
325
317
  staticClass: "menu-item",
326
318
  on: {
327
- "click": function($event) {
328
- return _vm.editNode(_vm.curNode, _vm.curData);
319
+ click: function(a) {
320
+ return e.editNode(e.curNode, e.curData);
329
321
  }
330
322
  }
331
- }, [_c("i", {
323
+ }, [i("i", {
332
324
  staticClass: "menu-item-icon el-icon-edit-outline",
333
325
  staticStyle: {
334
- "color": "#ffa500"
326
+ color: "#ffa500"
335
327
  }
336
- }), _vm._v(_vm._s(_vm.menuLabel.editNode) + " ")]), _c("li", {
328
+ }), e._v(e._s(e.menuLabel.editNode) + " ")]), i("li", {
337
329
  directives: [{
338
330
  name: "show",
339
331
  rawName: "v-show",
340
- value: _vm.curNode.isLeaf,
332
+ value: e.curNode.isLeaf,
341
333
  expression: "curNode.isLeaf"
342
334
  }],
343
335
  staticClass: "menu-item",
344
336
  on: {
345
- "click": function($event) {
346
- return _vm.removeNodeModal(_vm.curNode, _vm.curData);
337
+ click: function(a) {
338
+ return e.removeNodeModal(e.curNode, e.curData);
347
339
  }
348
340
  }
349
- }, [_c("i", {
341
+ }, [i("i", {
350
342
  staticClass: "menu-item-icon el-icon-delete",
351
343
  staticStyle: {
352
- "color": "#f00"
344
+ color: "#f00"
353
345
  }
354
- }), _vm._v(_vm._s(_vm.menuLabel.removeNode) + " ")])];
346
+ }), e._v(e._s(e.menuLabel.removeNode) + " ")])];
355
347
  }, {
356
- "curNode": _vm.curNode,
357
- "curData": _vm.curData
358
- })], 2)]) : _vm._e()], 1)], 1);
359
- };
360
- var staticRenderFns = [];
361
- const EditableTree_vue_vue_type_style_index_0_lang = "";
362
- const __vue2_script = {
348
+ curNode: e.curNode,
349
+ curData: e.curData
350
+ })], 2)]) : e._e()], 1)], 1);
351
+ }, T = [];
352
+ const M = {
363
353
  name: "EditableTree",
364
354
  props: {
365
355
  label: {
@@ -375,21 +365,19 @@ const __vue2_script = {
375
365
  },
376
366
  newNodeBuilder: {
377
367
  type: Function,
378
- default: (name, parent) => {
379
- return {
380
- name,
381
- parentId: parent.id
382
- };
383
- }
368
+ default: (e, t) => ({
369
+ name: e,
370
+ parentId: t.id
371
+ })
384
372
  },
385
373
  contextMenu: Boolean,
386
374
  lazy: {
387
375
  type: Boolean,
388
- default: true
376
+ default: !0
389
377
  },
390
378
  expandFirstNode: {
391
379
  type: Boolean,
392
- default: true
380
+ default: !0
393
381
  },
394
382
  readonly: Boolean,
395
383
  saveApi: {
@@ -417,23 +405,11 @@ const __vue2_script = {
417
405
  contextMenuInline: Boolean,
418
406
  treeProps: {
419
407
  type: Object,
420
- default: () => {
421
- return {
422
- children: "children",
423
- label: "name",
424
- isLeaf: (data) => {
425
- if (hasOwn(data, "hasChildren")) {
426
- return !data.hasChildren;
427
- } else if (hasOwn(data, "hasChild")) {
428
- return !data.hasChild;
429
- } else if (hasOwn(data, "children") && data.children) {
430
- return data.children.length === 0;
431
- } else {
432
- return true;
433
- }
434
- }
435
- };
436
- }
408
+ default: () => ({
409
+ children: "children",
410
+ label: "name",
411
+ isLeaf: (e) => d(e, "hasChildren") ? !e.hasChildren : d(e, "hasChild") ? !e.hasChild : d(e, "children") && e.children ? e.children.length === 0 : !0
412
+ })
437
413
  },
438
414
  menuLabel: {
439
415
  type: Object,
@@ -446,13 +422,11 @@ const __vue2_script = {
446
422
  },
447
423
  icon: {
448
424
  type: [Function, Boolean],
449
- default: () => {
450
- return "el-icon-collection-tag";
451
- }
425
+ default: () => "el-icon-collection-tag"
452
426
  },
453
427
  confirmButton: {
454
428
  type: Boolean,
455
- default: true
429
+ default: !0
456
430
  },
457
431
  addRootNodeButtonStyle: {
458
432
  type: String,
@@ -466,9 +440,9 @@ const __vue2_script = {
466
440
  },
467
441
  data() {
468
442
  return {
469
- loading: false,
470
- showMenu: false,
471
- empty: true,
443
+ loading: !1,
444
+ showMenu: !1,
445
+ empty: !0,
472
446
  expandedKeys: this.lazy ? [] : this.defaultExpandedKeys,
473
447
  treeData: [],
474
448
  curNode: {},
@@ -484,23 +458,23 @@ const __vue2_script = {
484
458
  return {
485
459
  confirmButtonText: "确定",
486
460
  cancelButtonText: "取消",
487
- closeOnClickModal: false,
488
- modal: true,
461
+ closeOnClickModal: !1,
462
+ modal: !0,
489
463
  inputErrorMessage: `${this.label}名不能为空!`,
490
464
  inputPlaceholder: `请输入${this.label}名...`,
491
- inputValidator: (value) => value != null && value.trim().length > 0
465
+ inputValidator: (e) => e != null && e.trim().length > 0
492
466
  };
493
467
  },
494
468
  innerTreeData() {
495
- var _a;
496
- return ((_a = this.$attrs.data) == null ? void 0 : _a.length) ? this.$attrs.data : this.treeData;
469
+ var e;
470
+ return (e = this.$attrs.data) != null && e.length ? this.$attrs.data : this.treeData;
497
471
  }
498
472
  },
499
473
  watch: {
500
474
  defaultExpandedKeys: {
501
- immediate: true,
502
- handler(newVal) {
503
- this.expandedKeys = [...newVal];
475
+ immediate: !0,
476
+ handler(e) {
477
+ this.expandedKeys = [...e];
504
478
  }
505
479
  }
506
480
  },
@@ -508,497 +482,308 @@ const __vue2_script = {
508
482
  this.tryFetch();
509
483
  },
510
484
  mounted() {
511
- addResizeListener(this.$refs.tree.$el, this.resize);
512
- addResizeListener(this.$refs.treeWrapper, this.resize);
485
+ h(this.$refs.tree.$el, this.resize), h(this.$refs.treeWrapper, this.resize);
513
486
  },
514
487
  beforeDestroy() {
515
- removeResizeListener(this.$refs.tree.$el, this.resize);
516
- removeResizeListener(this.$refs.treeWrapper, this.resize);
488
+ u(this.$refs.tree.$el, this.resize), u(this.$refs.treeWrapper, this.resize);
517
489
  },
518
490
  methods: {
519
- filterTreeProperties,
520
- filterTreeEvents,
521
- addExpandKey(data) {
522
- if (this.reserveExpandKey) {
523
- this.expandedKeys.push(data[this.nodeKey]);
524
- }
491
+ filterTreeProperties: b,
492
+ filterTreeEvents: _,
493
+ addExpandKey(e) {
494
+ this.reserveExpandKey && this.expandedKeys.push(e[this.nodeKey]);
525
495
  },
526
- removeExpandKey(data) {
527
- if (this.reserveExpandKey) {
528
- this.expandedKeys = this.expandedKeys.filter((key) => key !== data[this.nodeKey]);
529
- }
496
+ removeExpandKey(e) {
497
+ this.reserveExpandKey && (this.expandedKeys = this.expandedKeys.filter((t) => t !== e[this.nodeKey]));
530
498
  },
531
499
  resize() {
532
- if (isVerticalScrollbarVisible(this.$refs.treeWrapper)) {
533
- this.right = 4 + scrollbarWidth;
534
- } else {
535
- this.right = 4;
536
- }
500
+ x(this.$refs.treeWrapper) ? this.right = 4 + w : this.right = 4;
537
501
  },
538
- async showContextMenu(event, data, node) {
539
- if (data.contextmenu === false || data.id === -1 || data.id === 0 || data.edit === true) {
540
- return;
541
- }
542
- if (this.contextMenu) {
543
- this.curNode = node;
544
- this.curData = data;
545
- this.showMenu = true;
546
- this.$refs.tree.setCurrentKey(data.id);
547
- await this.$nextTick();
548
- this.position = computePosition(event, this.$refs.contextMenu);
549
- window.addEventListener("click", this.hideContextMenu);
550
- }
502
+ async showContextMenu(e, t, i) {
503
+ t.contextmenu === !1 || t.id === -1 || t.id === 0 || t.edit === !0 || this.contextMenu && (this.curNode = i, this.curData = t, this.showMenu = !0, this.$refs.tree.setCurrentKey(t.id), await this.$nextTick(), this.position = N(e, this.$refs.contextMenu), window.addEventListener("click", this.hideContextMenu));
551
504
  },
552
505
  hideContextMenu() {
553
- this.showMenu = false;
554
- window.removeEventListener("click", this.hideContextMenu);
506
+ this.showMenu = !1, window.removeEventListener("click", this.hideContextMenu);
555
507
  },
556
508
  async tryFetch() {
557
- var _a;
558
- if (this.lazy === false && this.fetchApi) {
559
- const res = await this.fetchApi(((_a = this.rootNode) == null ? void 0 : _a.id) ?? -1, {});
560
- if (isPlainObject(res.data)) {
561
- res.data = [res.data];
562
- }
563
- res.data = res.data || [];
564
- this.empty = res.data.length === 0;
565
- if (isPlainObject(this.customRootNode)) {
566
- const data = cloneDeep(this.customRootNode);
567
- data[this.treeProps.children || "children"] = res.data;
568
- this.treeData = [data];
569
- } else if (isFunction(this.customRootNode)) {
570
- const data = this.customRootNode(res.data);
571
- data[this.treeProps.children || "children"] = res.data;
572
- this.treeData = isPlainObject(data) ? [data] : data;
573
- } else {
574
- this.treeData = res.data;
575
- }
576
- }
577
- },
578
- async loadNode(node, resolve) {
579
- var _a, _b, _c;
580
- if (node.level === 0) {
581
- const res = await this.fetchApi(((_a = this.rootNode) == null ? void 0 : _a.id) ?? -1, node);
582
- this.empty = res.data.length === 0;
583
- if (isPlainObject(this.customRootNode)) {
584
- const data = cloneDeep(this.customRootNode);
585
- data[this.treeProps.children || "children"] = res.data;
586
- resolve([data]);
587
- } else if (isFunction(this.customRootNode)) {
588
- const data = this.customRootNode(res.data);
589
- data[this.treeProps.children || "children"] = res.data;
590
- this.treeData = isPlainObject(data) ? [data] : data;
591
- } else {
592
- resolve(res.data);
593
- }
594
- await this.$nextTick();
595
- this.$emit("root-node-loaded", res.data);
596
- if (this.defaultExpandedKeys) {
597
- this.expandedKeys = [(_b = res == null ? void 0 : res.data[0]) == null ? void 0 : _b.id, ...this.defaultExpandedKeys];
598
- } else {
599
- if (this.expandFirstNode) {
600
- this.expandedKeys = [(_c = res == null ? void 0 : res.data[0]) == null ? void 0 : _c.id];
601
- }
602
- }
509
+ var e;
510
+ if (this.lazy === !1 && this.fetchApi) {
511
+ const t = await this.fetchApi(((e = this.rootNode) == null ? void 0 : e.id) ?? -1, {});
512
+ if (r(t.data) && (t.data = [t.data]), t.data = t.data || [], this.empty = t.data.length === 0, r(this.customRootNode)) {
513
+ const i = p(this.customRootNode);
514
+ i[this.treeProps.children || "children"] = t.data, this.treeData = [i];
515
+ } else if (f(this.customRootNode)) {
516
+ const i = this.customRootNode(t.data);
517
+ i[this.treeProps.children || "children"] = t.data, this.treeData = r(i) ? [i] : i;
518
+ } else
519
+ this.treeData = t.data;
520
+ }
521
+ },
522
+ async loadNode(e, t) {
523
+ var i, a, o;
524
+ if (e.level === 0) {
525
+ const s = await this.fetchApi(((i = this.rootNode) == null ? void 0 : i.id) ?? -1, e);
526
+ if (this.empty = s.data.length === 0, r(this.customRootNode)) {
527
+ const n = p(this.customRootNode);
528
+ n[this.treeProps.children || "children"] = s.data, t([n]);
529
+ } else if (f(this.customRootNode)) {
530
+ const n = this.customRootNode(s.data);
531
+ n[this.treeProps.children || "children"] = s.data, this.treeData = r(n) ? [n] : n;
532
+ } else
533
+ t(s.data);
534
+ await this.$nextTick(), this.$emit("root-node-loaded", s.data), this.defaultExpandedKeys ? this.expandedKeys = [(a = s == null ? void 0 : s.data[0]) == null ? void 0 : a.id, ...this.defaultExpandedKeys] : this.expandFirstNode && (this.expandedKeys = [(o = s == null ? void 0 : s.data[0]) == null ? void 0 : o.id]);
603
535
  } else {
604
- if (node.leaf || node.data.isTempNode) {
605
- return resolve([]);
606
- }
607
- const res = await this.fetchApi(node.data.id, node);
608
- resolve(res.data);
609
- await this.$nextTick();
610
- this.$emit("node-loaded", res.data);
536
+ if (e.leaf || e.data.isTempNode)
537
+ return t([]);
538
+ const s = await this.fetchApi(e.data.id, e);
539
+ t(s.data), await this.$nextTick(), this.$emit("node-loaded", s.data);
611
540
  }
612
541
  },
613
542
  clear() {
614
- this.cancelEdit();
615
- this.removeNewNode();
543
+ this.cancelEdit(), this.removeNewNode();
616
544
  },
617
545
  clearChecked() {
618
546
  this.$refs.tree.setCheckedKeys([]);
619
547
  },
620
548
  removeNewNode() {
621
- if (this.newChild && this.newChild.id === -1) {
622
- console.log(this.newChild);
623
- this.$refs.tree.remove(this.newChild);
624
- this.$emit("remove-new-node");
625
- }
549
+ this.newChild && this.newChild.id === -1 && (console.log(this.newChild), this.$refs.tree.remove(this.newChild), this.$emit("remove-new-node"));
626
550
  },
627
551
  cancelEdit() {
628
- if (this.editData) {
629
- if (isUndefined(this.editData.edit)) {
630
- this.$set(this.editData, "edit", true);
631
- } else {
632
- this.editData.edit = false;
552
+ this.editData && (l(this.editData.edit) ? this.$set(this.editData, "edit", !0) : this.editData.edit = !1);
553
+ },
554
+ async editNode(e, t) {
555
+ !this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.editData = t, this.text = t[this.treeProps.label], l(t.edit) ? this.$set(t, "edit", !0) : t.edit = !0, await this.$nextTick(), this.$refs.labelTxt.focus()) : await this.$prompt(`请输入新的${this.label}名:`, {
556
+ ...this.defaultOptions,
557
+ inputValue: t[this.treeProps.label],
558
+ beforeClose: async (i, a, o) => {
559
+ if (i === "confirm") {
560
+ try {
561
+ a.confirmButtonLoading = !0, a.confirmButtonText = "处理中...", this.text = a.inputValue, await this.onConfirm(this.curNode, this.curData), o();
562
+ } catch {
563
+ a.confirmButtonText = "确定";
564
+ }
565
+ a.confirmButtonLoading = !1;
566
+ } else
567
+ o();
633
568
  }
634
- }
569
+ }).catch((i) => i);
635
570
  },
636
- async editNode(node, data) {
637
- if (!this.contextMenu || this.contextMenuIcon || this.contextMenuInline) {
638
- this.clear();
639
- this.editData = data;
640
- this.text = data[this.treeProps.label];
641
- if (isUndefined(data.edit)) {
642
- this.$set(data, "edit", true);
643
- } else {
644
- data.edit = true;
645
- }
646
- await this.$nextTick();
647
- this.$refs.labelTxt.focus();
648
- } else {
649
- await this.$prompt(`请输入新的${this.label}名:`, {
650
- ...this.defaultOptions,
651
- inputValue: data[this.treeProps.label],
652
- beforeClose: async (action, instance, done) => {
653
- if (action === "confirm") {
654
- try {
655
- instance.confirmButtonLoading = true;
656
- instance.confirmButtonText = "处理中...";
657
- this.text = instance.inputValue;
658
- await this.onConfirm(this.curNode, this.curData);
659
- done();
660
- } catch (e) {
661
- instance.confirmButtonText = "确定";
662
- }
663
- instance.confirmButtonLoading = false;
664
- } else {
665
- done();
571
+ async appendRootNode() {
572
+ this.text = "", !this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.createNewChild(void 0), this.$refs.tree.root.insertChild({ data: this.newChild }, void 0, !0), await this.scrollIntoView(!0)) : await this.$prompt(`请输入${this.label}名:`, {
573
+ ...this.defaultOptions,
574
+ beforeClose: async (e, t, i) => {
575
+ if (e === "confirm") {
576
+ try {
577
+ this.createNewChild(-1), t.confirmButtonLoading = !0, t.confirmButtonText = "处理中...";
578
+ const a = await this.saveApi(this.newNodeBuilder(t.inputValue, { id: -1 }));
579
+ this.newChild[this.treeProps.label] = t.inputValue, this.newChild.edit = !1, c(this.newChild, a.data), this.$refs.tree.root.insertChild({ data: this.newChild }, void 0, !0), await this.locateView(), i();
580
+ } catch {
581
+ t.confirmButtonText = "确定";
666
582
  }
667
- }
668
- }).catch((_) => _);
669
- }
583
+ t.confirmButtonLoading = !1;
584
+ } else
585
+ i();
586
+ }
587
+ }).catch((e) => e);
670
588
  },
671
- async appendRootNode() {
589
+ appendChildNode(e) {
672
590
  this.text = "";
673
- if (!this.contextMenu || this.contextMenuIcon || this.contextMenuInline) {
674
- this.clear();
675
- this.createNewChild(void 0);
676
- this.$refs.tree.root.insertChild({ data: this.newChild }, void 0, true);
677
- await this.scrollIntoView(true);
678
- } else {
679
- await this.$prompt(`请输入${this.label}名:`, {
591
+ const t = e.expanded;
592
+ e.expand(async () => {
593
+ !this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.createNewChild(e.data.id), this.$refs.tree.append(this.newChild, e), await this.scrollIntoView(t)) : await this.$prompt(`请输入${this.label}名:`, {
680
594
  ...this.defaultOptions,
681
- beforeClose: async (action, instance, done) => {
682
- if (action === "confirm") {
595
+ beforeClose: async (i, a, o) => {
596
+ if (i === "confirm") {
683
597
  try {
684
- this.createNewChild(-1);
685
- instance.confirmButtonLoading = true;
686
- instance.confirmButtonText = "处理中...";
687
- const res = await this.saveApi(this.newNodeBuilder(instance.inputValue, { id: -1 }));
688
- this.newChild[this.treeProps.label] = instance.inputValue;
689
- this.newChild.edit = false;
690
- assignReactiveProperties(this.newChild, res.data);
691
- this.$refs.tree.root.insertChild({ data: this.newChild }, void 0, true);
692
- await this.locateView();
693
- done();
694
- } catch (e) {
695
- instance.confirmButtonText = "确定";
598
+ this.createNewChild(e.data.id), a.confirmButtonLoading = !0, a.confirmButtonText = "处理中...";
599
+ const s = await this.saveApi(this.newNodeBuilder(a.inputValue, e.data));
600
+ this.newChild[this.treeProps.label] = a.inputValue, this.newChild.edit = !1, c(this.newChild, s.data), this.$refs.tree.append(this.newChild, e), await this.locateView(), o();
601
+ } catch {
602
+ a.confirmButtonText = "确定";
696
603
  }
697
- instance.confirmButtonLoading = false;
698
- } else {
699
- done();
700
- }
604
+ a.confirmButtonLoading = !1;
605
+ } else
606
+ o();
701
607
  }
702
- }).catch((_) => _);
703
- }
704
- },
705
- appendChildNode(node) {
706
- this.text = "";
707
- const expanded = node.expanded;
708
- node.expand(async () => {
709
- if (!this.contextMenu || this.contextMenuIcon || this.contextMenuInline) {
710
- this.clear();
711
- this.createNewChild(node.data.id);
712
- this.$refs.tree.append(this.newChild, node);
713
- await this.scrollIntoView(expanded);
714
- } else {
715
- await this.$prompt(`请输入${this.label}名:`, {
716
- ...this.defaultOptions,
717
- beforeClose: async (action, instance, done) => {
718
- if (action === "confirm") {
719
- try {
720
- this.createNewChild(node.data.id);
721
- instance.confirmButtonLoading = true;
722
- instance.confirmButtonText = "处理中...";
723
- const res = await this.saveApi(this.newNodeBuilder(instance.inputValue, node.data));
724
- this.newChild[this.treeProps.label] = instance.inputValue;
725
- this.newChild.edit = false;
726
- assignReactiveProperties(this.newChild, res.data);
727
- this.$refs.tree.append(this.newChild, node);
728
- await this.locateView();
729
- done();
730
- } catch (e) {
731
- instance.confirmButtonText = "确定";
732
- }
733
- instance.confirmButtonLoading = false;
734
- } else {
735
- done();
736
- }
737
- }
738
- }).catch((_) => _);
739
- }
608
+ }).catch((i) => i);
740
609
  });
741
610
  },
742
- appendChildNodeWithData(node, parentId, label) {
611
+ appendChildNodeWithData(e, t, i) {
743
612
  this.text = "";
744
- const expanded = node.expanded;
745
- node.expand(async () => {
746
- this.clear();
747
- this.newChild = {
613
+ const a = e.expanded;
614
+ e.expand(async () => {
615
+ this.clear(), this.newChild = {
748
616
  id: -1,
749
- parentId,
750
- [this.treeProps.label]: label,
751
- edit: false,
752
- isTempNode: true,
753
- hasChildren: false
754
- };
755
- this.$refs.tree.append(this.newChild, node);
756
- await this.scrollIntoView(expanded);
617
+ parentId: t,
618
+ [this.treeProps.label]: i,
619
+ edit: !1,
620
+ isTempNode: !0,
621
+ hasChildren: !1
622
+ }, this.$refs.tree.append(this.newChild, e), await this.scrollIntoView(a);
757
623
  });
758
624
  },
759
- appendPeerNode(node) {
760
- if (node.parent && node.parent.level !== 0) {
761
- this.appendChildNode(node.parent);
762
- } else {
763
- this.appendRootNode();
764
- }
625
+ appendPeerNode(e) {
626
+ e.parent && e.parent.level !== 0 ? this.appendChildNode(e.parent) : this.appendRootNode();
765
627
  },
766
- async addRootNode(data) {
767
- this.$refs.tree.remove(data);
768
- await this.$nextTick();
769
- this.$refs.tree.root.insertChild({ data }, void 0, true);
770
- },
771
- async addChildNode(data) {
772
- if (this.curNode && this.curNode.level !== 0) {
773
- this.curNode.expand(async () => {
774
- this.$refs.tree.remove(data);
775
- await this.$nextTick();
776
- this.$refs.tree.append(data, this.curNode);
777
- });
778
- } else {
779
- await this.addRootNode(data);
780
- }
628
+ async addRootNode(e) {
629
+ this.$refs.tree.remove(e), await this.$nextTick(), this.$refs.tree.root.insertChild({ data: e }, void 0, !0);
781
630
  },
782
- async addPeerNode(data) {
783
- if (this.curNode && this.curNode.parent && this.curNode.parent.level !== 0) {
784
- this.curNode.parent.expand(async () => {
785
- this.$refs.tree.remove(data);
786
- await this.$nextTick();
787
- this.$refs.tree.append(data, this.curNode.parent);
788
- });
789
- } else {
790
- await this.addRootNode(data);
791
- }
631
+ async addChildNode(e) {
632
+ this.curNode && this.curNode.level !== 0 ? this.curNode.expand(async () => {
633
+ this.$refs.tree.remove(e), await this.$nextTick(), this.$refs.tree.append(e, this.curNode);
634
+ }) : await this.addRootNode(e);
635
+ },
636
+ async addPeerNode(e) {
637
+ this.curNode && this.curNode.parent && this.curNode.parent.level !== 0 ? this.curNode.parent.expand(async () => {
638
+ this.$refs.tree.remove(e), await this.$nextTick(), this.$refs.tree.append(e, this.curNode.parent);
639
+ }) : await this.addRootNode(e);
792
640
  },
793
- updateNode(data) {
794
- const node = this.$refs.tree.getNode(data);
795
- node && (node.data = data);
641
+ updateNode(e) {
642
+ const t = this.$refs.tree.getNode(e);
643
+ t && (t.data = e);
796
644
  },
797
- setCurrentKey(key) {
798
- this.$refs.tree && this.$refs.tree.setCurrentKey(key);
645
+ setCurrentKey(e) {
646
+ this.$refs.tree && this.$refs.tree.setCurrentKey(e);
799
647
  },
800
- createNewChild(parentId) {
648
+ createNewChild(e) {
801
649
  this.newChild = {
802
650
  id: -1,
803
- parentId,
651
+ parentId: e,
804
652
  [this.treeProps.label]: "",
805
- edit: true,
806
- isTempNode: true,
807
- hasChildren: false
808
- };
809
- this.$emit("create-new-node", this.newChild);
653
+ edit: !0,
654
+ isTempNode: !0,
655
+ hasChildren: !1
656
+ }, this.$emit("create-new-node", this.newChild);
810
657
  },
811
- async removeNodeModal(node) {
658
+ async removeNodeModal(e) {
812
659
  await this.$confirm(
813
- `你确定要删除${this.label}[<span class="break-word" style="color: orange">${node.data[this.treeProps.label]}</span>]吗?`,
660
+ `你确定要删除${this.label}[<span class="break-word" style="color: orange">${e.data[this.treeProps.label]}</span>]吗?`,
814
661
  "系统提示",
815
662
  {
816
663
  type: "warning",
817
- modal: true,
818
- dangerouslyUseHTMLString: true,
664
+ modal: !0,
665
+ dangerouslyUseHTMLString: !0,
819
666
  iconClass: "el-icon-question",
820
- closeOnClickModal: false,
667
+ closeOnClickModal: !1,
821
668
  confirmButtonClass: "el-button--danger",
822
669
  cancelButtonClass: "el-button--primary is-plain",
823
- beforeClose: async (action, instance, done) => {
824
- if (action === "confirm") {
670
+ beforeClose: async (t, i, a) => {
671
+ if (t === "confirm") {
825
672
  try {
826
- instance.confirmButtonLoading = true;
827
- instance.confirmButtonText = "删除...";
828
- const parentNode = node.parent;
829
- const res = await this.deleteApi(node.data.id);
830
- if (res.code === 0) {
831
- this.$message.success("删除成功!");
832
- this.$refs.tree.remove(node);
833
- this.$emit("node-deleted", parentNode, node.data);
834
- done();
835
- } else {
836
- this.$message.error(res.message);
837
- }
838
- } catch (_) {
673
+ i.confirmButtonLoading = !0, i.confirmButtonText = "删除...";
674
+ const o = e.parent, s = await this.deleteApi(e.data.id);
675
+ s.code === 0 ? (this.$message.success("删除成功!"), this.$refs.tree.remove(e), this.$emit("node-deleted", o, e.data), a()) : this.$message.error(s.message);
676
+ } catch {
839
677
  }
840
- instance.confirmButtonText = "确定";
841
- instance.confirmButtonLoading = false;
842
- } else {
843
- done();
844
- }
678
+ i.confirmButtonText = "确定", i.confirmButtonLoading = !1;
679
+ } else
680
+ a();
845
681
  }
846
682
  }
847
- ).catch((_) => _);
683
+ ).catch((t) => t);
848
684
  },
849
- async removeNode(node) {
685
+ async removeNode(e) {
850
686
  try {
851
- const parentNode = node.parent;
687
+ const t = e.parent;
852
688
  if (this.deleteApi) {
853
- const res = await this.deleteApi(node.data.id);
854
- if (res.code === 0) {
855
- this.$message.success("删除成功!");
856
- this.$refs.tree.remove(node);
857
- this.$emit("node-deleted", parentNode, node.data);
858
- } else {
859
- this.$message.error(res.message);
860
- }
861
- } else {
862
- this.$refs.tree.remove(node);
863
- }
864
- } catch (e) {
689
+ const i = await this.deleteApi(e.data.id);
690
+ i.code === 0 ? (this.$message.success("删除成功!"), this.$refs.tree.remove(e), this.$emit("node-deleted", t, e.data)) : this.$message.error(i.message);
691
+ } else
692
+ this.$refs.tree.remove(e);
693
+ } catch {
865
694
  }
866
695
  },
867
- async onConfirm(node, data) {
868
- if (data[this.treeProps.label] === this.text || !isNotEmpty(this.text)) {
696
+ async onConfirm(e, t) {
697
+ if (t[this.treeProps.label] === this.text || !C(this.text)) {
869
698
  this.clear();
870
699
  return;
871
700
  }
872
- if (isUndefined(data.loading)) {
873
- this.$set(data, "loading", true);
874
- } else {
875
- data.loading = true;
876
- }
701
+ l(t.loading) ? this.$set(t, "loading", !0) : t.loading = !0;
877
702
  try {
878
- this.loading = true;
879
- if (data.id === -1) {
880
- const res = await this.saveApi(this.newNodeBuilder(this.text, node.parent.data || { id: -1 }));
881
- const old = fastClone(data);
882
- assignReactiveProperties(data, { ...res.data, isTempNode: false });
883
- this.$emit("node-added", data, old, node);
884
- this.registerNode(node);
885
- } else {
886
- await this.updateApi({ ...data, [this.treeProps.label]: this.text });
887
- }
888
- data[this.treeProps.label] = this.text;
889
- data.edit = false;
890
- this.$emit("node-updated", data, node);
891
- this.text = "";
892
- } catch (e) {
703
+ if (this.loading = !0, t.id === -1) {
704
+ const i = await this.saveApi(this.newNodeBuilder(this.text, e.parent.data || { id: -1 })), a = v(t);
705
+ c(t, { ...i.data, isTempNode: !1 }), this.$emit("node-added", t, a, e), this.registerNode(e);
706
+ } else
707
+ await this.updateApi({ ...t, [this.treeProps.label]: this.text });
708
+ t[this.treeProps.label] = this.text, t.edit = !1, this.$emit("node-updated", t, e), this.text = "";
709
+ } catch {
893
710
  }
894
- data.loading = false;
895
- this.loading = false;
711
+ t.loading = !1, this.loading = !1;
896
712
  },
897
- onCancel(node, data) {
898
- if (data.id === -1) {
899
- this.$refs.tree.remove(node);
900
- } else {
901
- data.edit = false;
902
- }
903
- this.text = "";
713
+ onCancel(e, t) {
714
+ t.id === -1 ? this.$refs.tree.remove(e) : t.edit = !1, this.text = "";
904
715
  },
905
- nodeClick(data, node, tree) {
906
- this.hideContextMenu();
907
- if (isUndefined(data.loading) || !data.loading) {
908
- this.curNode = node;
909
- this.curData = data;
910
- this.$emit("on-node-click", data, node, tree);
911
- }
716
+ nodeClick(e, t, i) {
717
+ this.hideContextMenu(), (l(e.loading) || !e.loading) && (this.curNode = t, this.curData = e, this.$emit("on-node-click", e, t, i));
912
718
  },
913
719
  getCurrentNode() {
914
720
  return this.$refs.tree.getCurrentNode();
915
721
  },
916
722
  async locateView() {
917
723
  await this.$nextTick();
918
- const el = this.$el.querySelector(`[data-id="${this.newChild.id}"]`);
919
- if (el) {
920
- el.scrollIntoView();
921
- }
724
+ const e = this.$el.querySelector(`[data-id="${this.newChild.id}"]`);
725
+ e && e.scrollIntoView();
922
726
  },
923
- async scrollIntoView(expanded) {
924
- var _a, _b;
925
- await this.$nextTick();
926
- if (!expanded) {
927
- await delay(300);
928
- }
929
- (_b = (_a = this.$refs) == null ? void 0 : _a.labelTxt) == null ? void 0 : _b.focus();
727
+ async scrollIntoView(e) {
728
+ var t, i;
729
+ await this.$nextTick(), e || await g(300), (i = (t = this.$refs) == null ? void 0 : t.labelTxt) == null || i.focus();
930
730
  },
931
- inputKeyup(event, node, data) {
932
- if (event.keyCode === 13) {
933
- this.onConfirm(node, data);
934
- }
935
- if (event.keyCode === 27) {
936
- this.clear();
937
- }
731
+ inputKeyup(e, t, i) {
732
+ e.keyCode === 13 && this.onConfirm(t, i), e.keyCode === 27 && this.clear();
938
733
  },
939
- inputBlur(event, node, data) {
940
- if (this.confirmButton) {
941
- return;
942
- }
943
- this.onConfirm(node, data);
734
+ inputBlur(e, t, i) {
735
+ this.confirmButton || this.onConfirm(t, i);
944
736
  },
945
737
  getCheckedKeys() {
946
738
  return this.$refs.tree.getCheckedKeys();
947
739
  },
948
- setCheckedKeys(keys) {
949
- this.$refs.tree.setCheckedKeys(keys);
740
+ setCheckedKeys(e) {
741
+ this.$refs.tree.setCheckedKeys(e);
950
742
  },
951
743
  getCheckedNodes() {
952
744
  return this.$refs.tree.getCheckedNodes();
953
745
  },
954
- setCheckedNodes(nodes) {
955
- this.$refs.tree.setCheckedNodes(nodes);
746
+ setCheckedNodes(e) {
747
+ this.$refs.tree.setCheckedNodes(e);
956
748
  },
957
- getNode(data) {
958
- return this.$refs.tree.getNode(data);
749
+ getNode(e) {
750
+ return this.$refs.tree.getNode(e);
959
751
  },
960
752
  getRootNode() {
961
753
  return this.$refs.tree.root;
962
754
  },
963
- findTreeNode(data) {
964
- return findTreeChildren(
755
+ findTreeNode(e) {
756
+ return $(
965
757
  this.$refs.tree.root.childNodes,
966
- (node) => node.data === data || node.data.id === data,
758
+ (t) => t.data === e || t.data.id === e,
967
759
  "childNodes"
968
760
  );
969
761
  },
970
- registerNode(node) {
971
- node.store.registerNode(node);
972
- delete node.store.nodesMap[-1];
762
+ registerNode(e) {
763
+ e.store.registerNode(e), delete e.store.nodesMap[-1];
973
764
  },
974
765
  async reloadTree() {
975
- if (this.lazy) {
976
- this.treeKey = Date.now();
977
- } else {
978
- await this.tryFetch();
979
- }
766
+ this.lazy ? this.treeKey = Date.now() : await this.tryFetch();
980
767
  }
981
768
  }
982
- };
983
- const __cssModules = {};
984
- var __component__ = /* @__PURE__ */ normalizeComponent(
985
- __vue2_script,
986
- render,
987
- staticRenderFns,
988
- false,
989
- __vue2_injectStyles,
769
+ }, m = {};
770
+ var K = /* @__PURE__ */ k(
771
+ M,
772
+ B,
773
+ T,
774
+ !1,
775
+ P,
990
776
  null,
991
777
  null,
992
778
  null
993
779
  );
994
- function __vue2_injectStyles(context) {
995
- for (let o in __cssModules) {
996
- this[o] = __cssModules[o];
997
- }
780
+ function P(e) {
781
+ for (let t in m)
782
+ this[t] = m[t];
998
783
  }
999
- const EditableTree = /* @__PURE__ */ function() {
1000
- return __component__.exports;
784
+ const R = /* @__PURE__ */ function() {
785
+ return K.exports;
1001
786
  }();
1002
787
  export {
1003
- EditableTree as default
788
+ R as default
1004
789
  };