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