@web-utils/component 3.0.6 → 3.1.0
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/address-input/index.mjs +20 -57
- package/affix/index.mjs +26 -47
- package/aside-menu/index.mjs +18 -43
- package/avatar/index.mjs +27 -49
- package/awesome-button/index.mjs +35 -43
- package/capsule-tab/index.mjs +16 -34
- package/card/index.mjs +21 -76
- package/carousel/index.mjs +14 -49
- package/chat/index.mjs +104 -414
- package/chunk-file-uploader/index.mjs +21 -38
- package/chunks/FormTemp.aa57efb4.mjs +125 -0
- package/code-mirror-editor/index.mjs +69 -79
- package/color-picker/index.mjs +29 -60
- package/comment/index.mjs +17 -48
- package/confirm-button/index.mjs +11 -19
- package/confirmable/index.mjs +12 -20
- package/context-menu/index.mjs +42 -144
- package/count-up/index.mjs +18 -25
- package/custom-scrollbar/index.mjs +13 -22
- package/data-box/index.mjs +15 -66
- package/data-card/index.mjs +16 -65
- package/data-cardtext/index.mjs +16 -52
- package/data-display/index.mjs +18 -62
- package/data-icons/index.mjs +16 -68
- package/data-imgtext/index.mjs +18 -79
- package/data-operatext/index.mjs +18 -75
- package/data-panel/index.mjs +16 -63
- package/data-pay/index.mjs +20 -122
- package/data-price/index.mjs +18 -60
- package/data-progress/index.mjs +16 -67
- package/data-rotate/index.mjs +16 -66
- package/data-table-picker/index.mjs +25 -88
- package/data-tabs/index.mjs +16 -64
- package/dialog-form/index.mjs +48 -94
- package/dynamic-table/index.mjs +43 -127
- package/e-charts/index.mjs +21 -34
- package/easy-popup/index.mjs +35 -61
- package/editable-progress/index.mjs +22 -77
- package/editable-tree/index.mjs +235 -546
- package/egd-collapse/index.mjs +13 -26
- package/egd-collapse-item/index.mjs +27 -87
- package/element-dialog/index.mjs +69 -133
- package/empty-view/index.mjs +13 -33
- package/error-view/index.mjs +14 -34
- package/flex-column/index.mjs +15 -23
- package/flex-item/index.mjs +18 -26
- package/flex-row/index.mjs +23 -31
- package/flex-scroller/index.mjs +16 -27
- package/flow/index.mjs +70 -110
- package/flow-designer/index.mjs +1215 -4804
- package/flow-node/index.mjs +15 -51
- package/flow-viewer/index.mjs +64 -89
- package/form-block/index.mjs +43 -62
- package/form-button/index.mjs +10 -18
- package/form-cascader/index.mjs +49 -100
- package/form-checkbox-group/index.mjs +43 -110
- package/form-date-picker/index.mjs +51 -97
- package/form-holder/index.mjs +25 -42
- package/form-input/index.mjs +40 -90
- package/form-input-email/index.mjs +35 -79
- package/form-input-id-card/index.mjs +40 -87
- package/form-input-number/index.mjs +42 -102
- package/form-input-phone-number/index.mjs +34 -75
- package/form-input-tag/index.mjs +31 -73
- package/form-input-time/index.mjs +42 -87
- package/form-item/index.mjs +70 -89
- package/form-item-config-provider/index.mjs +12 -20
- package/form-item-group/index.mjs +46 -65
- package/form-radio-group/index.mjs +50 -108
- package/form-select/index.mjs +44 -95
- package/form-switch/index.mjs +38 -85
- package/form-textarea/index.mjs +31 -75
- package/form-view/index.mjs +112 -260
- package/fy-array/index.mjs +35 -121
- package/fy-article/index.mjs +12 -43
- package/fy-cascader/index.mjs +26 -67
- package/fy-checkbox/index.mjs +27 -77
- package/fy-code/index.mjs +19 -33
- package/fy-curd/index.mjs +810 -2017
- package/fy-date/index.mjs +18 -59
- package/fy-draggable/index.mjs +81 -140
- package/fy-dynamic/index.mjs +85 -204
- package/fy-empty/index.mjs +14 -35
- package/fy-form/index.mjs +254 -571
- package/fy-form-design/index.mjs +1489 -6084
- package/fy-form-design/style.css +1 -1
- package/fy-input/index.mjs +34 -104
- package/fy-input-color/index.mjs +22 -67
- package/fy-input-icon/index.mjs +37 -122
- package/fy-input-map/index.mjs +57 -149
- package/fy-input-number/index.mjs +18 -53
- package/fy-input-table/index.mjs +36 -102
- package/fy-input-tree/index.mjs +51 -138
- package/fy-progress/index.mjs +12 -31
- package/fy-radio/index.mjs +20 -51
- package/fy-rate/index.mjs +18 -51
- package/fy-select/index.mjs +49 -134
- package/fy-slider/index.mjs +19 -52
- package/fy-switch/index.mjs +18 -48
- package/fy-tabs/index.mjs +19 -51
- package/fy-time/index.mjs +22 -62
- package/fy-title/index.mjs +14 -25
- package/fy-tree/index.mjs +74 -216
- package/fy-u-editor/index.mjs +50 -64
- package/fy-upload/index.mjs +167 -338
- package/guide-steps/index.mjs +33 -53
- package/highlight-j-s/index.mjs +13 -27
- package/icon-card/index.mjs +12 -36
- package/icon-temp/index.mjs +12 -34
- package/iframe-window/index.mjs +13 -40
- package/image-cropper/index.mjs +46 -171
- package/image-preview/index.mjs +54 -168
- package/image-viewer/index.mjs +24 -50
- package/index.css +1 -0
- package/index.mjs +3973 -501
- package/input-number/index.mjs +84 -173
- package/input-number-range/index.mjs +20 -70
- package/j-s-x-component/index.mjs +3 -3
- package/keep-view-alive/index.mjs +47 -55
- package/keyboard/index.mjs +100 -113
- package/license/index.mjs +34 -51
- package/loading-view/index.mjs +14 -34
- package/login/index.mjs +33 -161
- package/monaco-editor/index.mjs +13 -21
- package/name-avatar/index.mjs +13 -32
- package/nav-bar/index.mjs +12 -31
- package/not-implement/index.mjs +14 -25
- package/notice/index.mjs +32 -80
- package/package.json +1 -1
- package/page/index.mjs +11 -23
- package/page-header/index.mjs +16 -37
- package/page-index/index.mjs +42 -93
- package/page-index-top/index.mjs +42 -84
- package/page-skeleton/index.mjs +24 -39
- package/page-skeleton-new/index.mjs +21 -68
- package/pageable-table/index.mjs +105 -227
- package/pageable-view/index.mjs +30 -83
- package/photo-swipe/index.mjs +62 -87
- package/present-view/index.mjs +114 -267
- package/queue/index.mjs +14 -29
- package/record-video/index.mjs +29 -66
- package/resize-observer/index.mjs +18 -30
- package/search/index.mjs +47 -81
- package/search-popover/index.mjs +57 -329
- package/sign/index.mjs +43 -60
- package/sign-panel/index.mjs +40 -151
- package/skeleton/index.mjs +18 -44
- package/split-pane/index.mjs +45 -129
- package/stateful/index.mjs +18 -26
- package/static-pageable-table/index.mjs +18 -44
- package/swiper/index.mjs +53 -94
- package/tab/index.mjs +13 -39
- package/tab-item/index.mjs +23 -37
- package/table-column/index.mjs +27 -35
- package/table-view/index.mjs +89 -209
- package/tag-render/index.mjs +34 -69
- package/text-ellipsis/index.mjs +22 -47
- package/tinymce-editor/index.mjs +174 -285
- package/toolbar/index.mjs +21 -42
- package/toolbar-button/index.mjs +25 -54
- package/verify/index.mjs +16 -29
- package/vue-cron/index.mjs +272 -1089
- package/vue-qr-code/index.mjs +19 -27
- package/vue-quill-editor/index.mjs +15 -27
- package/vue-tags-input/index.mjs +104 -224
- package/vue-tree-select/index.mjs +595 -742
- package/vue-video-player/index.mjs +42 -57
- package/watermark/index.mjs +27 -35
- package/web-types.json +1 -1
- package/x-input-tag/index.mjs +50 -112
- package/chunks/FormTemp.7f91629d.mjs +0 -165
- /package/chunks/{vueComponentNormalizer.446f5dc4.mjs → _plugin-vue2_normalizer.446f5dc4.mjs} +0 -0
package/editable-tree/index.mjs
CHANGED
|
@@ -1,385 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var $ = Object.defineProperty, b = Object.defineProperties;
|
|
2
|
+
var _ = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var x = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var w = (e, i
|
|
6
|
-
for (var
|
|
7
|
-
|
|
4
|
+
var k = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var w = (t, e, i) => e in t ? $(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, c = (t, e) => {
|
|
6
|
+
for (var i in e || (e = {}))
|
|
7
|
+
k.call(e, i) && w(t, i, e[i]);
|
|
8
8
|
if (x)
|
|
9
|
-
for (var
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
}, h = (
|
|
13
|
-
var
|
|
14
|
-
var
|
|
9
|
+
for (var i of x(e))
|
|
10
|
+
B.call(e, i) && w(t, i, e[i]);
|
|
11
|
+
return t;
|
|
12
|
+
}, h = (t, e) => b(t, _(e));
|
|
13
|
+
var a = (t, e, i) => new Promise((s, n) => {
|
|
14
|
+
var o = (d) => {
|
|
15
15
|
try {
|
|
16
|
-
l(
|
|
16
|
+
l(i.next(d));
|
|
17
17
|
} catch (f) {
|
|
18
|
-
|
|
18
|
+
n(f);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, r = (d) => {
|
|
21
21
|
try {
|
|
22
|
-
l(
|
|
22
|
+
l(i.throw(d));
|
|
23
23
|
} catch (f) {
|
|
24
|
-
|
|
24
|
+
n(f);
|
|
25
25
|
}
|
|
26
|
-
}, l = (d) => d.done ? s(d.value) : Promise.resolve(d.value).then(
|
|
27
|
-
l((
|
|
26
|
+
}, l = (d) => d.done ? s(d.value) : Promise.resolve(d.value).then(o, r);
|
|
27
|
+
l((i = i.apply(t, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import { hasOwn as m, isVerticalScrollbarVisible as
|
|
30
|
-
import { addResizeListener as C, removeResizeListener as
|
|
31
|
-
import { cloneDeep as
|
|
32
|
-
import { a as
|
|
33
|
-
import { n as
|
|
34
|
-
|
|
35
|
-
var e = this, i = e.$createElement, t = e._self._c || i;
|
|
36
|
-
return t("div", {
|
|
37
|
-
staticClass: "editable-tree"
|
|
38
|
-
}, [!e.readonly && e.addRootNodeButtonStyle === "top-right" ? t("ElButton", {
|
|
39
|
-
staticStyle: {
|
|
40
|
-
position: "absolute",
|
|
41
|
-
top: "4px",
|
|
42
|
-
"z-index": "1"
|
|
43
|
-
},
|
|
44
|
-
style: {
|
|
45
|
-
right: `${e.right}px`
|
|
46
|
-
},
|
|
47
|
-
attrs: {
|
|
48
|
-
type: "primary",
|
|
49
|
-
size: "mini",
|
|
50
|
-
icon: "el-icon-plus",
|
|
51
|
-
circle: "",
|
|
52
|
-
plain: ""
|
|
53
|
-
},
|
|
54
|
-
on: {
|
|
55
|
-
click: function(s) {
|
|
56
|
-
return s.stopPropagation(), e.$emit("add-root-node");
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}) : e._e(), t("div", {
|
|
60
|
-
ref: "treeWrapper",
|
|
61
|
-
staticClass: "et-tree-wrapper"
|
|
62
|
-
}, [!e.readonly && e.addRootNodeButtonStyle === "top" ? t("div", {
|
|
63
|
-
staticStyle: {
|
|
64
|
-
"padding-left": "24px"
|
|
65
|
-
}
|
|
66
|
-
}, [t("ElButton", {
|
|
67
|
-
attrs: {
|
|
68
|
-
disabled: e.loading,
|
|
69
|
-
size: "mini",
|
|
70
|
-
type: "text"
|
|
71
|
-
},
|
|
72
|
-
on: {
|
|
73
|
-
click: e.appendRootNode
|
|
74
|
-
}
|
|
75
|
-
}, [t("i", {
|
|
76
|
-
staticClass: "el-icon-lx-add"
|
|
77
|
-
}), e._v(" " + e._s(e.addRootNodeLabel ? e.addRootNodeLabel : `添加${e.label}`) + " ")])], 1) : e._e(), t("ElTree", e._g(e._b({
|
|
78
|
-
key: e.treeKey,
|
|
79
|
-
ref: "tree",
|
|
80
|
-
staticClass: "flex-item",
|
|
81
|
-
attrs: {
|
|
82
|
-
"default-expanded-keys": e.expandedKeys,
|
|
83
|
-
"expand-on-click-node": !1,
|
|
84
|
-
"highlight-current": "",
|
|
85
|
-
load: e.loadNode,
|
|
86
|
-
data: e.innerTreeData,
|
|
87
|
-
props: e.treeProps,
|
|
88
|
-
lazy: e.lazy,
|
|
89
|
-
"node-key": e.nodeKey
|
|
90
|
-
},
|
|
91
|
-
on: {
|
|
92
|
-
"node-click": e.nodeClick,
|
|
93
|
-
"node-contextmenu": e.showContextMenu,
|
|
94
|
-
"node-expand": e.addExpandKey,
|
|
95
|
-
"node-collapse": e.removeExpandKey
|
|
96
|
-
},
|
|
97
|
-
scopedSlots: e._u([{
|
|
98
|
-
key: "default",
|
|
99
|
-
fn: function(s) {
|
|
100
|
-
var o = s.node, n = s.data;
|
|
101
|
-
return [e._t("default", function() {
|
|
102
|
-
return [n.edit ? [t("span", {
|
|
103
|
-
staticClass: "custom-tree-node flex-row flex-item oh",
|
|
104
|
-
attrs: {
|
|
105
|
-
"data-id": n.id
|
|
106
|
-
}
|
|
107
|
-
}, [e.icon ? t("i", {
|
|
108
|
-
staticClass: "node-icon shrink-0",
|
|
109
|
-
class: n.loading ? "el-icon-loading" : "el-icon-edit-outline"
|
|
110
|
-
}) : e._e(), t("ElInput", {
|
|
111
|
-
ref: "labelTxt",
|
|
112
|
-
staticClass: "node-input flex-item",
|
|
113
|
-
attrs: {
|
|
114
|
-
size: "mini",
|
|
115
|
-
placeholder: e.defaultOptions.inputPlaceholder
|
|
116
|
-
},
|
|
117
|
-
on: {
|
|
118
|
-
blur: function(a) {
|
|
119
|
-
return e.inputBlur(a, o, n);
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
nativeOn: {
|
|
123
|
-
keyup: function(a) {
|
|
124
|
-
return function(l) {
|
|
125
|
-
return e.inputKeyup(l, o, n);
|
|
126
|
-
}.apply(null, arguments);
|
|
127
|
-
},
|
|
128
|
-
click: function(a) {
|
|
129
|
-
a.stopPropagation();
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
model: {
|
|
133
|
-
value: e.text,
|
|
134
|
-
callback: function(a) {
|
|
135
|
-
e.text = a;
|
|
136
|
-
},
|
|
137
|
-
expression: "text"
|
|
138
|
-
}
|
|
139
|
-
}), e.confirmButton ? [t("ElButton", {
|
|
140
|
-
directives: [{
|
|
141
|
-
name: "show",
|
|
142
|
-
rawName: "v-show",
|
|
143
|
-
value: !n.loading,
|
|
144
|
-
expression: "!data.loading"
|
|
145
|
-
}],
|
|
146
|
-
staticClass: "shrink-0",
|
|
147
|
-
attrs: {
|
|
148
|
-
size: "mini",
|
|
149
|
-
type: "text"
|
|
150
|
-
},
|
|
151
|
-
on: {
|
|
152
|
-
click: function(a) {
|
|
153
|
-
return a.stopPropagation(), e.onConfirm(o, n);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}, [e._v("确定")]), t("ElButton", {
|
|
157
|
-
directives: [{
|
|
158
|
-
name: "show",
|
|
159
|
-
rawName: "v-show",
|
|
160
|
-
value: !n.loading,
|
|
161
|
-
expression: "!data.loading"
|
|
162
|
-
}],
|
|
163
|
-
staticClass: "shrink-0",
|
|
164
|
-
attrs: {
|
|
165
|
-
size: "mini",
|
|
166
|
-
type: "text"
|
|
167
|
-
},
|
|
168
|
-
on: {
|
|
169
|
-
click: function(a) {
|
|
170
|
-
return a.stopPropagation(), e.onCancel(o, n);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}, [e._v("取消")])] : e._e()], 2)] : [t("span", {
|
|
174
|
-
staticClass: "custom-tree-node",
|
|
175
|
-
attrs: {
|
|
176
|
-
"data-id": n.id
|
|
177
|
-
}
|
|
178
|
-
}, [t("span", {
|
|
179
|
-
staticClass: "node-label flex-row flex-item oh ellipsis-1"
|
|
180
|
-
}, [e.icon ? t("i", {
|
|
181
|
-
staticClass: "node-icon",
|
|
182
|
-
class: n.loading ? "el-icon-loading" : e.icon(n, o)
|
|
183
|
-
}) : e._e(), t("span", {
|
|
184
|
-
staticClass: "flex-item-relative",
|
|
185
|
-
staticStyle: {
|
|
186
|
-
height: "21px"
|
|
187
|
-
}
|
|
188
|
-
}, [t("span", {
|
|
189
|
-
staticClass: "ellipsis-1 absolute-box et-tree-label",
|
|
190
|
-
attrs: {
|
|
191
|
-
title: o.label
|
|
192
|
-
}
|
|
193
|
-
}, [e._t("label", function() {
|
|
194
|
-
return [e._v(e._s(o.label))];
|
|
195
|
-
}, {
|
|
196
|
-
data: n,
|
|
197
|
-
node: o
|
|
198
|
-
})], 2)]), e._t("label-suffix", null, {
|
|
199
|
-
node: o,
|
|
200
|
-
data: n
|
|
201
|
-
})], 2), !e.contextMenu && !e.readonly ? t("span", {
|
|
202
|
-
directives: [{
|
|
203
|
-
name: "show",
|
|
204
|
-
rawName: "v-show",
|
|
205
|
-
value: !n.loading && !e.loading,
|
|
206
|
-
expression: "!data.loading && !loading"
|
|
207
|
-
}],
|
|
208
|
-
staticClass: "handle-actions"
|
|
209
|
-
}, [t("ElButton", {
|
|
210
|
-
attrs: {
|
|
211
|
-
size: "mini",
|
|
212
|
-
type: "text"
|
|
213
|
-
},
|
|
214
|
-
on: {
|
|
215
|
-
click: function(a) {
|
|
216
|
-
return a.stopPropagation(), e.appendChildNode(o, n);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}, [e._v("添加")]), t("ElButton", {
|
|
220
|
-
attrs: {
|
|
221
|
-
size: "mini",
|
|
222
|
-
type: "text"
|
|
223
|
-
},
|
|
224
|
-
on: {
|
|
225
|
-
click: function(a) {
|
|
226
|
-
return a.stopPropagation(), e.editNode(o, n);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}, [e._v("修改")]), t("ElPopconfirm", {
|
|
230
|
-
staticClass: "pop-confirm",
|
|
231
|
-
attrs: {
|
|
232
|
-
"icon-color": "red",
|
|
233
|
-
title: "你确定要删除吗?"
|
|
234
|
-
},
|
|
235
|
-
on: {
|
|
236
|
-
confirm: function(a) {
|
|
237
|
-
return e.removeNode(o, n);
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
scopedSlots: e._u([{
|
|
241
|
-
key: "reference",
|
|
242
|
-
fn: function() {
|
|
243
|
-
return [t("ElButton", {
|
|
244
|
-
directives: [{
|
|
245
|
-
name: "show",
|
|
246
|
-
rawName: "v-show",
|
|
247
|
-
value: o.isLeaf,
|
|
248
|
-
expression: "node.isLeaf"
|
|
249
|
-
}],
|
|
250
|
-
staticStyle: {
|
|
251
|
-
"margin-left": "4px"
|
|
252
|
-
},
|
|
253
|
-
attrs: {
|
|
254
|
-
size: "mini",
|
|
255
|
-
type: "text"
|
|
256
|
-
},
|
|
257
|
-
on: {
|
|
258
|
-
click: function(a) {
|
|
259
|
-
a.stopPropagation();
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}, [e._v("删除")])];
|
|
263
|
-
},
|
|
264
|
-
proxy: !0
|
|
265
|
-
}], null, !0)
|
|
266
|
-
})], 1) : e._e(), e.contextMenuIcon && e.contextMenu && !e.readonly ? t("span", {
|
|
267
|
-
directives: [{
|
|
268
|
-
name: "show",
|
|
269
|
-
rawName: "v-show",
|
|
270
|
-
value: !n.loading && !e.loading,
|
|
271
|
-
expression: "!data.loading && !loading"
|
|
272
|
-
}],
|
|
273
|
-
staticClass: "handle-actions",
|
|
274
|
-
staticStyle: {
|
|
275
|
-
display: "inline-block"
|
|
276
|
-
}
|
|
277
|
-
}, [t("ElButton", {
|
|
278
|
-
staticStyle: {
|
|
279
|
-
padding: "6px 10px 0"
|
|
280
|
-
},
|
|
281
|
-
attrs: {
|
|
282
|
-
size: "mini",
|
|
283
|
-
type: "text"
|
|
284
|
-
},
|
|
285
|
-
on: {
|
|
286
|
-
click: function(a) {
|
|
287
|
-
return a.stopPropagation(), e.showContextMenu(a, n, o);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}, [e._v(". . .")])], 1) : e._e()])]];
|
|
291
|
-
}, {
|
|
292
|
-
node: o,
|
|
293
|
-
data: n
|
|
294
|
-
})];
|
|
295
|
-
}
|
|
296
|
-
}], null, !0)
|
|
297
|
-
}, "ElTree", e.filterTreeProperties(e.$attrs), !1), e.filterTreeEvents(e.$listeners))), e.contextMenu && !e.readonly ? t("div", {
|
|
298
|
-
directives: [{
|
|
299
|
-
name: "show",
|
|
300
|
-
rawName: "v-show",
|
|
301
|
-
value: e.showMenu,
|
|
302
|
-
expression: "showMenu"
|
|
303
|
-
}],
|
|
304
|
-
ref: "contextMenu",
|
|
305
|
-
staticClass: "menu",
|
|
306
|
-
style: e.position
|
|
307
|
-
}, [t("ul", {
|
|
308
|
-
staticClass: "menu-list"
|
|
309
|
-
}, [e._t("context-menu", function() {
|
|
310
|
-
return [t("li", {
|
|
311
|
-
directives: [{
|
|
312
|
-
name: "show",
|
|
313
|
-
rawName: "v-show",
|
|
314
|
-
value: e.curData.id > -1,
|
|
315
|
-
expression: "curData.id > -1"
|
|
316
|
-
}],
|
|
317
|
-
staticClass: "menu-item",
|
|
318
|
-
on: {
|
|
319
|
-
click: function(s) {
|
|
320
|
-
return e.appendPeerNode(e.curNode, e.curData);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}, [t("i", {
|
|
324
|
-
staticClass: "menu-item-icon el-icon-lx-add",
|
|
325
|
-
staticStyle: {
|
|
326
|
-
color: "#228b22"
|
|
327
|
-
}
|
|
328
|
-
}), e._v(e._s(e.menuLabel.appendPeer) + " ")]), t("li", {
|
|
329
|
-
staticClass: "menu-item",
|
|
330
|
-
on: {
|
|
331
|
-
click: function(s) {
|
|
332
|
-
return e.appendChildNode(e.curNode, e.curData);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}, [t("i", {
|
|
336
|
-
staticClass: "menu-item-icon el-icon-lx-add",
|
|
337
|
-
staticStyle: {
|
|
338
|
-
color: "#228b22"
|
|
339
|
-
}
|
|
340
|
-
}), e._v(e._s(e.menuLabel.appendChild) + " ")]), t("li", {
|
|
341
|
-
directives: [{
|
|
342
|
-
name: "show",
|
|
343
|
-
rawName: "v-show",
|
|
344
|
-
value: e.curData.id > -1,
|
|
345
|
-
expression: "curData.id > -1"
|
|
346
|
-
}],
|
|
347
|
-
staticClass: "menu-item",
|
|
348
|
-
on: {
|
|
349
|
-
click: function(s) {
|
|
350
|
-
return e.editNode(e.curNode, e.curData);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}, [t("i", {
|
|
354
|
-
staticClass: "menu-item-icon el-icon-edit-outline",
|
|
355
|
-
staticStyle: {
|
|
356
|
-
color: "#ffa500"
|
|
357
|
-
}
|
|
358
|
-
}), e._v(e._s(e.menuLabel.editNode) + " ")]), t("li", {
|
|
359
|
-
directives: [{
|
|
360
|
-
name: "show",
|
|
361
|
-
rawName: "v-show",
|
|
362
|
-
value: e.curNode.isLeaf,
|
|
363
|
-
expression: "curNode.isLeaf"
|
|
364
|
-
}],
|
|
365
|
-
staticClass: "menu-item",
|
|
366
|
-
on: {
|
|
367
|
-
click: function(s) {
|
|
368
|
-
return e.removeNodeModal(e.curNode, e.curData);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}, [t("i", {
|
|
372
|
-
staticClass: "menu-item-icon el-icon-delete",
|
|
373
|
-
staticStyle: {
|
|
374
|
-
color: "#f00"
|
|
375
|
-
}
|
|
376
|
-
}), e._v(e._s(e.menuLabel.removeNode) + " ")])];
|
|
377
|
-
}, {
|
|
378
|
-
curNode: e.curNode,
|
|
379
|
-
curData: e.curData
|
|
380
|
-
})], 2)]) : e._e()], 1)], 1);
|
|
381
|
-
}, I = [];
|
|
382
|
-
const O = {
|
|
29
|
+
import { hasOwn as m, isVerticalScrollbarVisible as T, scrollbarWidth as M, computePosition as K, isPlainObject as u, isFunction as N, isUndefined as p, isNotEmpty as P, fastClone as E, delay as D, findTreeChildren as L } from "@web-utils/core";
|
|
30
|
+
import { addResizeListener as C, removeResizeListener as g } from "@web-utils/integrations/resize";
|
|
31
|
+
import { cloneDeep as v } from "@web-utils/integrations/lodash";
|
|
32
|
+
import { a as R, b as z, c as y } from "../chunks/index.57f871af.mjs";
|
|
33
|
+
import { n as S } from "../chunks/_plugin-vue2_normalizer.446f5dc4.mjs";
|
|
34
|
+
const V = {
|
|
383
35
|
name: "EditableTree",
|
|
384
36
|
props: {
|
|
385
37
|
label: {
|
|
@@ -395,9 +47,9 @@ const O = {
|
|
|
395
47
|
},
|
|
396
48
|
newNodeBuilder: {
|
|
397
49
|
type: Function,
|
|
398
|
-
default: (
|
|
399
|
-
name:
|
|
400
|
-
parentId:
|
|
50
|
+
default: (t, e) => ({
|
|
51
|
+
name: t,
|
|
52
|
+
parentId: e.id
|
|
401
53
|
})
|
|
402
54
|
},
|
|
403
55
|
contextMenu: Boolean,
|
|
@@ -438,7 +90,7 @@ const O = {
|
|
|
438
90
|
default: () => ({
|
|
439
91
|
children: "children",
|
|
440
92
|
label: "name",
|
|
441
|
-
isLeaf: (
|
|
93
|
+
isLeaf: (t) => m(t, "hasChildren") ? !t.hasChildren : m(t, "hasChild") ? !t.hasChild : m(t, "children") && t.children ? t.children.length === 0 : !0
|
|
442
94
|
})
|
|
443
95
|
},
|
|
444
96
|
menuLabel: {
|
|
@@ -492,19 +144,19 @@ const O = {
|
|
|
492
144
|
modal: !0,
|
|
493
145
|
inputErrorMessage: `${this.label}名不能为空!`,
|
|
494
146
|
inputPlaceholder: `请输入${this.label}名...`,
|
|
495
|
-
inputValidator: (
|
|
147
|
+
inputValidator: (t) => t != null && t.trim().length > 0
|
|
496
148
|
};
|
|
497
149
|
},
|
|
498
150
|
innerTreeData() {
|
|
499
|
-
var
|
|
500
|
-
return (
|
|
151
|
+
var t;
|
|
152
|
+
return (t = this.$attrs.data) != null && t.length ? this.$attrs.data : this.treeData;
|
|
501
153
|
}
|
|
502
154
|
},
|
|
503
155
|
watch: {
|
|
504
156
|
defaultExpandedKeys: {
|
|
505
157
|
immediate: !0,
|
|
506
|
-
handler(
|
|
507
|
-
this.expandedKeys = [...
|
|
158
|
+
handler(t) {
|
|
159
|
+
this.expandedKeys = [...t];
|
|
508
160
|
}
|
|
509
161
|
}
|
|
510
162
|
},
|
|
@@ -515,63 +167,63 @@ const O = {
|
|
|
515
167
|
C(this.$refs.tree.$el, this.resize), C(this.$refs.treeWrapper, this.resize);
|
|
516
168
|
},
|
|
517
169
|
beforeDestroy() {
|
|
518
|
-
|
|
170
|
+
g(this.$refs.tree.$el, this.resize), g(this.$refs.treeWrapper, this.resize);
|
|
519
171
|
},
|
|
520
172
|
methods: {
|
|
521
|
-
filterTreeProperties:
|
|
522
|
-
filterTreeEvents:
|
|
523
|
-
addExpandKey(
|
|
524
|
-
this.reserveExpandKey && this.expandedKeys.push(
|
|
173
|
+
filterTreeProperties: R,
|
|
174
|
+
filterTreeEvents: z,
|
|
175
|
+
addExpandKey(t) {
|
|
176
|
+
this.reserveExpandKey && this.expandedKeys.push(t[this.nodeKey]);
|
|
525
177
|
},
|
|
526
|
-
removeExpandKey(
|
|
527
|
-
this.reserveExpandKey && (this.expandedKeys = this.expandedKeys.filter((
|
|
178
|
+
removeExpandKey(t) {
|
|
179
|
+
this.reserveExpandKey && (this.expandedKeys = this.expandedKeys.filter((e) => e !== t[this.nodeKey]));
|
|
528
180
|
},
|
|
529
181
|
resize() {
|
|
530
|
-
|
|
182
|
+
T(this.$refs.treeWrapper) ? this.right = 4 + M : this.right = 4;
|
|
531
183
|
},
|
|
532
|
-
showContextMenu(e, i
|
|
533
|
-
return
|
|
534
|
-
|
|
184
|
+
showContextMenu(t, e, i) {
|
|
185
|
+
return a(this, null, function* () {
|
|
186
|
+
e.contextmenu === !1 || e.id === -1 || e.id === 0 || e.edit === !0 || this.contextMenu && (this.curNode = i, this.curData = e, this.showMenu = !0, this.$refs.tree.setCurrentKey(e.id), yield this.$nextTick(), this.position = K(t, this.$refs.contextMenu), window.addEventListener("click", this.hideContextMenu));
|
|
535
187
|
});
|
|
536
188
|
},
|
|
537
189
|
hideContextMenu() {
|
|
538
190
|
this.showMenu = !1, window.removeEventListener("click", this.hideContextMenu);
|
|
539
191
|
},
|
|
540
192
|
tryFetch() {
|
|
541
|
-
return
|
|
542
|
-
var
|
|
193
|
+
return a(this, null, function* () {
|
|
194
|
+
var t, e;
|
|
543
195
|
if (this.lazy === !1 && this.fetchApi) {
|
|
544
|
-
const
|
|
545
|
-
if (u(
|
|
546
|
-
const s =
|
|
547
|
-
s[this.treeProps.children || "children"] =
|
|
196
|
+
const i = yield this.fetchApi((e = (t = this.rootNode) == null ? void 0 : t.id) != null ? e : -1, {});
|
|
197
|
+
if (u(i.data) && (i.data = [i.data]), i.data = i.data || [], this.empty = i.data.length === 0, u(this.customRootNode)) {
|
|
198
|
+
const s = v(this.customRootNode);
|
|
199
|
+
s[this.treeProps.children || "children"] = i.data, this.treeData = [s];
|
|
548
200
|
} else if (N(this.customRootNode)) {
|
|
549
|
-
const s = this.customRootNode(
|
|
550
|
-
s[this.treeProps.children || "children"] =
|
|
201
|
+
const s = this.customRootNode(i.data);
|
|
202
|
+
s[this.treeProps.children || "children"] = i.data, this.treeData = u(s) ? [s] : s;
|
|
551
203
|
} else
|
|
552
|
-
this.treeData =
|
|
204
|
+
this.treeData = i.data;
|
|
553
205
|
}
|
|
554
206
|
});
|
|
555
207
|
},
|
|
556
|
-
loadNode(
|
|
557
|
-
return
|
|
558
|
-
var
|
|
559
|
-
if (
|
|
560
|
-
const
|
|
561
|
-
if (this.empty =
|
|
562
|
-
const l =
|
|
563
|
-
l[this.treeProps.children || "children"] =
|
|
208
|
+
loadNode(t, e) {
|
|
209
|
+
return a(this, null, function* () {
|
|
210
|
+
var i, s, n, o;
|
|
211
|
+
if (t.level === 0) {
|
|
212
|
+
const r = yield this.fetchApi((s = (i = this.rootNode) == null ? void 0 : i.id) != null ? s : -1, t);
|
|
213
|
+
if (this.empty = r.data.length === 0, u(this.customRootNode)) {
|
|
214
|
+
const l = v(this.customRootNode);
|
|
215
|
+
l[this.treeProps.children || "children"] = r.data, e([l]);
|
|
564
216
|
} else if (N(this.customRootNode)) {
|
|
565
|
-
const l = this.customRootNode(
|
|
566
|
-
l[this.treeProps.children || "children"] =
|
|
217
|
+
const l = this.customRootNode(r.data);
|
|
218
|
+
l[this.treeProps.children || "children"] = r.data, this.treeData = u(l) ? [l] : l;
|
|
567
219
|
} else
|
|
568
|
-
|
|
569
|
-
yield this.$nextTick(), this.$emit("root-node-loaded",
|
|
220
|
+
e(r.data);
|
|
221
|
+
yield this.$nextTick(), this.$emit("root-node-loaded", r.data), this.defaultExpandedKeys ? this.expandedKeys = [(n = r == null ? void 0 : r.data[0]) == null ? void 0 : n.id, ...this.defaultExpandedKeys] : this.expandFirstNode && (this.expandedKeys = [(o = r == null ? void 0 : r.data[0]) == null ? void 0 : o.id]);
|
|
570
222
|
} else {
|
|
571
|
-
if (
|
|
572
|
-
return
|
|
573
|
-
const
|
|
574
|
-
|
|
223
|
+
if (t.leaf || t.data.isTempNode)
|
|
224
|
+
return e([]);
|
|
225
|
+
const r = yield this.fetchApi(t.data.id, t);
|
|
226
|
+
e(r.data), yield this.$nextTick(), this.$emit("node-loaded", r.data);
|
|
575
227
|
}
|
|
576
228
|
});
|
|
577
229
|
},
|
|
@@ -587,121 +239,121 @@ const O = {
|
|
|
587
239
|
cancelEdit() {
|
|
588
240
|
this.editData && (p(this.editData.edit) ? this.$set(this.editData, "edit", !0) : this.editData.edit = !1);
|
|
589
241
|
},
|
|
590
|
-
editNode(
|
|
591
|
-
return
|
|
592
|
-
!this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.editData =
|
|
593
|
-
inputValue:
|
|
594
|
-
beforeClose: (
|
|
595
|
-
if (
|
|
242
|
+
editNode(t, e) {
|
|
243
|
+
return a(this, null, function* () {
|
|
244
|
+
!this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.editData = e, this.text = e[this.treeProps.label], p(e.edit) ? this.$set(e, "edit", !0) : e.edit = !0, yield this.$nextTick(), this.$refs.labelTxt.focus()) : yield this.$prompt(`请输入新的${this.label}名:`, h(c({}, this.defaultOptions), {
|
|
245
|
+
inputValue: e[this.treeProps.label],
|
|
246
|
+
beforeClose: (i, s, n) => a(this, null, function* () {
|
|
247
|
+
if (i === "confirm") {
|
|
596
248
|
try {
|
|
597
|
-
s.confirmButtonLoading = !0, s.confirmButtonText = "处理中...", this.text = s.inputValue, yield this.onConfirm(this.curNode, this.curData),
|
|
598
|
-
} catch (
|
|
249
|
+
s.confirmButtonLoading = !0, s.confirmButtonText = "处理中...", this.text = s.inputValue, yield this.onConfirm(this.curNode, this.curData), n();
|
|
250
|
+
} catch (o) {
|
|
599
251
|
s.confirmButtonText = "确定";
|
|
600
252
|
}
|
|
601
253
|
s.confirmButtonLoading = !1;
|
|
602
254
|
} else
|
|
603
|
-
|
|
255
|
+
n();
|
|
604
256
|
})
|
|
605
|
-
})).catch((
|
|
257
|
+
})).catch((i) => i);
|
|
606
258
|
});
|
|
607
259
|
},
|
|
608
260
|
appendRootNode() {
|
|
609
|
-
return
|
|
261
|
+
return a(this, null, function* () {
|
|
610
262
|
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), yield this.scrollIntoView(!0)) : yield this.$prompt(`请输入${this.label}名:`, h(c({}, this.defaultOptions), {
|
|
611
|
-
beforeClose: (e, i
|
|
612
|
-
if (
|
|
263
|
+
beforeClose: (t, e, i) => a(this, null, function* () {
|
|
264
|
+
if (t === "confirm") {
|
|
613
265
|
try {
|
|
614
|
-
this.createNewChild(-1),
|
|
615
|
-
const s = yield this.saveApi(this.newNodeBuilder(
|
|
616
|
-
this.newChild[this.treeProps.label] =
|
|
266
|
+
this.createNewChild(-1), e.confirmButtonLoading = !0, e.confirmButtonText = "处理中...";
|
|
267
|
+
const s = yield this.saveApi(this.newNodeBuilder(e.inputValue, { id: -1 }));
|
|
268
|
+
this.newChild[this.treeProps.label] = e.inputValue, this.newChild.edit = !1, y(this.newChild, s.data), this.$refs.tree.root.insertChild({ data: this.newChild }, void 0, !0), yield this.locateView(), i();
|
|
617
269
|
} catch (s) {
|
|
618
|
-
|
|
270
|
+
e.confirmButtonText = "确定";
|
|
619
271
|
}
|
|
620
|
-
|
|
272
|
+
e.confirmButtonLoading = !1;
|
|
621
273
|
} else
|
|
622
|
-
|
|
274
|
+
i();
|
|
623
275
|
})
|
|
624
|
-
})).catch((
|
|
276
|
+
})).catch((t) => t);
|
|
625
277
|
});
|
|
626
278
|
},
|
|
627
|
-
appendChildNode(
|
|
279
|
+
appendChildNode(t) {
|
|
628
280
|
this.text = "";
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
-
!this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.createNewChild(
|
|
632
|
-
beforeClose: (
|
|
633
|
-
if (
|
|
281
|
+
const e = t.expanded;
|
|
282
|
+
t.expand(() => a(this, null, function* () {
|
|
283
|
+
!this.contextMenu || this.contextMenuIcon || this.contextMenuInline ? (this.clear(), this.createNewChild(t.data.id), this.$refs.tree.append(this.newChild, t), yield this.scrollIntoView(e)) : yield this.$prompt(`请输入${this.label}名:`, h(c({}, this.defaultOptions), {
|
|
284
|
+
beforeClose: (i, s, n) => a(this, null, function* () {
|
|
285
|
+
if (i === "confirm") {
|
|
634
286
|
try {
|
|
635
|
-
this.createNewChild(
|
|
636
|
-
const
|
|
637
|
-
this.newChild[this.treeProps.label] = s.inputValue, this.newChild.edit = !1, y(this.newChild,
|
|
638
|
-
} catch (
|
|
287
|
+
this.createNewChild(t.data.id), s.confirmButtonLoading = !0, s.confirmButtonText = "处理中...";
|
|
288
|
+
const o = yield this.saveApi(this.newNodeBuilder(s.inputValue, t.data));
|
|
289
|
+
this.newChild[this.treeProps.label] = s.inputValue, this.newChild.edit = !1, y(this.newChild, o.data), this.$refs.tree.append(this.newChild, t), yield this.locateView(), n();
|
|
290
|
+
} catch (o) {
|
|
639
291
|
s.confirmButtonText = "确定";
|
|
640
292
|
}
|
|
641
293
|
s.confirmButtonLoading = !1;
|
|
642
294
|
} else
|
|
643
|
-
|
|
295
|
+
n();
|
|
644
296
|
})
|
|
645
|
-
})).catch((
|
|
297
|
+
})).catch((i) => i);
|
|
646
298
|
}));
|
|
647
299
|
},
|
|
648
|
-
appendChildNodeWithData(e, i
|
|
300
|
+
appendChildNodeWithData(t, e, i) {
|
|
649
301
|
this.text = "";
|
|
650
|
-
const s =
|
|
651
|
-
|
|
302
|
+
const s = t.expanded;
|
|
303
|
+
t.expand(() => a(this, null, function* () {
|
|
652
304
|
this.clear(), this.newChild = {
|
|
653
305
|
id: -1,
|
|
654
|
-
parentId:
|
|
655
|
-
[this.treeProps.label]:
|
|
306
|
+
parentId: e,
|
|
307
|
+
[this.treeProps.label]: i,
|
|
656
308
|
edit: !1,
|
|
657
309
|
isTempNode: !0,
|
|
658
310
|
hasChildren: !1
|
|
659
|
-
}, this.$refs.tree.append(this.newChild,
|
|
311
|
+
}, this.$refs.tree.append(this.newChild, t), yield this.scrollIntoView(s);
|
|
660
312
|
}));
|
|
661
313
|
},
|
|
662
|
-
appendPeerNode(
|
|
663
|
-
|
|
314
|
+
appendPeerNode(t) {
|
|
315
|
+
t.parent && t.parent.level !== 0 ? this.appendChildNode(t.parent) : this.appendRootNode();
|
|
664
316
|
},
|
|
665
|
-
addRootNode(
|
|
666
|
-
return
|
|
667
|
-
this.$refs.tree.remove(
|
|
317
|
+
addRootNode(t) {
|
|
318
|
+
return a(this, null, function* () {
|
|
319
|
+
this.$refs.tree.remove(t), yield this.$nextTick(), this.$refs.tree.root.insertChild({ data: t }, void 0, !0);
|
|
668
320
|
});
|
|
669
321
|
},
|
|
670
|
-
addChildNode(
|
|
671
|
-
return
|
|
672
|
-
this.curNode && this.curNode.level !== 0 ? this.curNode.expand(() =>
|
|
673
|
-
this.$refs.tree.remove(
|
|
674
|
-
})) : yield this.addRootNode(
|
|
322
|
+
addChildNode(t) {
|
|
323
|
+
return a(this, null, function* () {
|
|
324
|
+
this.curNode && this.curNode.level !== 0 ? this.curNode.expand(() => a(this, null, function* () {
|
|
325
|
+
this.$refs.tree.remove(t), yield this.$nextTick(), this.$refs.tree.append(t, this.curNode);
|
|
326
|
+
})) : yield this.addRootNode(t);
|
|
675
327
|
});
|
|
676
328
|
},
|
|
677
|
-
addPeerNode(
|
|
678
|
-
return
|
|
679
|
-
this.curNode && this.curNode.parent && this.curNode.parent.level !== 0 ? this.curNode.parent.expand(() =>
|
|
680
|
-
this.$refs.tree.remove(
|
|
681
|
-
})) : yield this.addRootNode(
|
|
329
|
+
addPeerNode(t) {
|
|
330
|
+
return a(this, null, function* () {
|
|
331
|
+
this.curNode && this.curNode.parent && this.curNode.parent.level !== 0 ? this.curNode.parent.expand(() => a(this, null, function* () {
|
|
332
|
+
this.$refs.tree.remove(t), yield this.$nextTick(), this.$refs.tree.append(t, this.curNode.parent);
|
|
333
|
+
})) : yield this.addRootNode(t);
|
|
682
334
|
});
|
|
683
335
|
},
|
|
684
|
-
updateNode(
|
|
685
|
-
const
|
|
686
|
-
|
|
336
|
+
updateNode(t) {
|
|
337
|
+
const e = this.$refs.tree.getNode(t);
|
|
338
|
+
e && (e.data = t);
|
|
687
339
|
},
|
|
688
|
-
setCurrentKey(
|
|
689
|
-
this.$refs.tree && this.$refs.tree.setCurrentKey(
|
|
340
|
+
setCurrentKey(t) {
|
|
341
|
+
this.$refs.tree && this.$refs.tree.setCurrentKey(t);
|
|
690
342
|
},
|
|
691
|
-
createNewChild(
|
|
343
|
+
createNewChild(t) {
|
|
692
344
|
this.newChild = {
|
|
693
345
|
id: -1,
|
|
694
|
-
parentId:
|
|
346
|
+
parentId: t,
|
|
695
347
|
[this.treeProps.label]: "",
|
|
696
348
|
edit: !0,
|
|
697
349
|
isTempNode: !0,
|
|
698
350
|
hasChildren: !1
|
|
699
351
|
}, this.$emit("create-new-node", this.newChild);
|
|
700
352
|
},
|
|
701
|
-
removeNodeModal(
|
|
702
|
-
return
|
|
353
|
+
removeNodeModal(t) {
|
|
354
|
+
return a(this, null, function* () {
|
|
703
355
|
yield this.$confirm(
|
|
704
|
-
`你确定要删除${this.label}[<span class="break-word" style="color: orange">${
|
|
356
|
+
`你确定要删除${this.label}[<span class="break-word" style="color: orange">${t.data[this.treeProps.label]}</span>]吗?`,
|
|
705
357
|
"系统提示",
|
|
706
358
|
{
|
|
707
359
|
type: "warning",
|
|
@@ -711,134 +363,171 @@ const O = {
|
|
|
711
363
|
closeOnClickModal: !1,
|
|
712
364
|
confirmButtonClass: "el-button--danger",
|
|
713
365
|
cancelButtonClass: "el-button--primary is-plain",
|
|
714
|
-
beforeClose: (
|
|
715
|
-
if (
|
|
366
|
+
beforeClose: (e, i, s) => a(this, null, function* () {
|
|
367
|
+
if (e === "confirm") {
|
|
716
368
|
try {
|
|
717
|
-
|
|
718
|
-
const
|
|
719
|
-
|
|
720
|
-
} catch (
|
|
369
|
+
i.confirmButtonLoading = !0, i.confirmButtonText = "删除...";
|
|
370
|
+
const n = t.parent, o = yield this.deleteApi(t.data.id);
|
|
371
|
+
o.code === 0 ? (this.$message.success("删除成功!"), this.$refs.tree.remove(t), this.$emit("node-deleted", n, t.data), s()) : this.$message.error(o.message);
|
|
372
|
+
} catch (n) {
|
|
721
373
|
}
|
|
722
|
-
|
|
374
|
+
i.confirmButtonText = "确定", i.confirmButtonLoading = !1;
|
|
723
375
|
} else
|
|
724
376
|
s();
|
|
725
377
|
})
|
|
726
378
|
}
|
|
727
|
-
).catch((
|
|
379
|
+
).catch((e) => e);
|
|
728
380
|
});
|
|
729
381
|
},
|
|
730
|
-
removeNode(
|
|
731
|
-
return
|
|
382
|
+
removeNode(t) {
|
|
383
|
+
return a(this, null, function* () {
|
|
732
384
|
try {
|
|
733
|
-
const
|
|
385
|
+
const e = t.parent;
|
|
734
386
|
if (this.deleteApi) {
|
|
735
|
-
const
|
|
736
|
-
|
|
387
|
+
const i = yield this.deleteApi(t.data.id);
|
|
388
|
+
i.code === 0 ? (this.$message.success("删除成功!"), this.$refs.tree.remove(t), this.$emit("node-deleted", e, t.data)) : this.$message.error(i.message);
|
|
737
389
|
} else
|
|
738
|
-
this.$refs.tree.remove(
|
|
739
|
-
} catch (
|
|
390
|
+
this.$refs.tree.remove(t);
|
|
391
|
+
} catch (e) {
|
|
740
392
|
}
|
|
741
393
|
});
|
|
742
394
|
},
|
|
743
|
-
onConfirm(
|
|
744
|
-
return
|
|
745
|
-
if (
|
|
395
|
+
onConfirm(t, e) {
|
|
396
|
+
return a(this, null, function* () {
|
|
397
|
+
if (e[this.treeProps.label] === this.text || !P(this.text)) {
|
|
746
398
|
this.clear();
|
|
747
399
|
return;
|
|
748
400
|
}
|
|
749
|
-
p(
|
|
401
|
+
p(e.loading) ? this.$set(e, "loading", !0) : e.loading = !0;
|
|
750
402
|
try {
|
|
751
|
-
if (this.loading = !0,
|
|
752
|
-
const
|
|
753
|
-
y(
|
|
403
|
+
if (this.loading = !0, e.id === -1) {
|
|
404
|
+
const i = yield this.saveApi(this.newNodeBuilder(this.text, t.parent.data || { id: -1 })), s = E(e);
|
|
405
|
+
y(e, h(c({}, i.data), { isTempNode: !1 })), this.$emit("node-added", e, s, t), this.registerNode(t);
|
|
754
406
|
} else
|
|
755
|
-
yield this.updateApi(h(c({},
|
|
756
|
-
|
|
757
|
-
} catch (
|
|
407
|
+
yield this.updateApi(h(c({}, e), { [this.treeProps.label]: this.text }));
|
|
408
|
+
e[this.treeProps.label] = this.text, e.edit = !1, this.$emit("node-updated", e, t), this.text = "";
|
|
409
|
+
} catch (i) {
|
|
758
410
|
}
|
|
759
|
-
|
|
411
|
+
e.loading = !1, this.loading = !1;
|
|
760
412
|
});
|
|
761
413
|
},
|
|
762
|
-
onCancel(
|
|
763
|
-
|
|
414
|
+
onCancel(t, e) {
|
|
415
|
+
e.id === -1 ? this.$refs.tree.remove(t) : e.edit = !1, this.text = "";
|
|
764
416
|
},
|
|
765
|
-
nodeClick(e, i
|
|
766
|
-
this.hideContextMenu(), (p(
|
|
417
|
+
nodeClick(t, e, i) {
|
|
418
|
+
this.hideContextMenu(), (p(t.loading) || !t.loading) && (this.curNode = e, this.curData = t, this.$emit("on-node-click", t, e, i));
|
|
767
419
|
},
|
|
768
420
|
getCurrentNode() {
|
|
769
421
|
return this.$refs.tree.getCurrentNode();
|
|
770
422
|
},
|
|
771
423
|
locateView() {
|
|
772
|
-
return
|
|
424
|
+
return a(this, null, function* () {
|
|
773
425
|
yield this.$nextTick();
|
|
774
|
-
const
|
|
775
|
-
|
|
426
|
+
const t = this.$el.querySelector(`[data-id="${this.newChild.id}"]`);
|
|
427
|
+
t && t.scrollIntoView();
|
|
776
428
|
});
|
|
777
429
|
},
|
|
778
|
-
scrollIntoView(
|
|
779
|
-
return
|
|
780
|
-
var
|
|
781
|
-
yield this.$nextTick(),
|
|
430
|
+
scrollIntoView(t) {
|
|
431
|
+
return a(this, null, function* () {
|
|
432
|
+
var e, i;
|
|
433
|
+
yield this.$nextTick(), t || (yield D(300)), (i = (e = this.$refs) == null ? void 0 : e.labelTxt) == null || i.focus();
|
|
782
434
|
});
|
|
783
435
|
},
|
|
784
|
-
inputKeyup(e, i
|
|
785
|
-
|
|
436
|
+
inputKeyup(t, e, i) {
|
|
437
|
+
t.keyCode === 13 && this.onConfirm(e, i), t.keyCode === 27 && this.clear();
|
|
786
438
|
},
|
|
787
|
-
inputBlur(e, i
|
|
788
|
-
this.confirmButton || this.onConfirm(
|
|
439
|
+
inputBlur(t, e, i) {
|
|
440
|
+
this.confirmButton || this.onConfirm(e, i);
|
|
789
441
|
},
|
|
790
442
|
getCheckedKeys() {
|
|
791
443
|
return this.$refs.tree.getCheckedKeys();
|
|
792
444
|
},
|
|
793
|
-
setCheckedKeys(
|
|
794
|
-
this.$refs.tree.setCheckedKeys(
|
|
445
|
+
setCheckedKeys(t) {
|
|
446
|
+
this.$refs.tree.setCheckedKeys(t);
|
|
795
447
|
},
|
|
796
448
|
getCheckedNodes() {
|
|
797
449
|
return this.$refs.tree.getCheckedNodes();
|
|
798
450
|
},
|
|
799
|
-
setCheckedNodes(
|
|
800
|
-
this.$refs.tree.setCheckedNodes(
|
|
451
|
+
setCheckedNodes(t) {
|
|
452
|
+
this.$refs.tree.setCheckedNodes(t);
|
|
801
453
|
},
|
|
802
|
-
getNode(
|
|
803
|
-
return this.$refs.tree.getNode(
|
|
454
|
+
getNode(t) {
|
|
455
|
+
return this.$refs.tree.getNode(t);
|
|
804
456
|
},
|
|
805
457
|
getRootNode() {
|
|
806
458
|
return this.$refs.tree.root;
|
|
807
459
|
},
|
|
808
|
-
findTreeNode(
|
|
809
|
-
return
|
|
460
|
+
findTreeNode(t) {
|
|
461
|
+
return L(
|
|
810
462
|
this.$refs.tree.root.childNodes,
|
|
811
|
-
(
|
|
463
|
+
(e) => e.data === t || e.data.id === t,
|
|
812
464
|
"childNodes"
|
|
813
465
|
);
|
|
814
466
|
},
|
|
815
|
-
registerNode(
|
|
816
|
-
|
|
467
|
+
registerNode(t) {
|
|
468
|
+
t.store.registerNode(t), delete t.store.nodesMap[-1];
|
|
817
469
|
},
|
|
818
470
|
reloadTree() {
|
|
819
|
-
return
|
|
471
|
+
return a(this, null, function* () {
|
|
820
472
|
this.lazy ? this.treeKey = Date.now() : yield this.tryFetch();
|
|
821
473
|
});
|
|
822
474
|
}
|
|
823
475
|
}
|
|
824
|
-
}
|
|
825
|
-
var
|
|
826
|
-
|
|
476
|
+
};
|
|
477
|
+
var A = function() {
|
|
478
|
+
var e = this, i = e._self._c;
|
|
479
|
+
return i("div", { staticClass: "editable-tree" }, [!e.readonly && e.addRootNodeButtonStyle === "top-right" ? i("ElButton", { staticStyle: { position: "absolute", top: "4px", "z-index": "1" }, style: { right: `${e.right}px` }, attrs: { type: "primary", size: "mini", icon: "el-icon-plus", circle: "", plain: "" }, on: { click: function(s) {
|
|
480
|
+
return s.stopPropagation(), e.$emit("add-root-node");
|
|
481
|
+
} } }) : e._e(), i("div", { ref: "treeWrapper", staticClass: "et-tree-wrapper" }, [!e.readonly && e.addRootNodeButtonStyle === "top" ? i("div", { staticStyle: { "padding-left": "24px" } }, [i("ElButton", { attrs: { disabled: e.loading, size: "mini", type: "text" }, on: { click: e.appendRootNode } }, [i("i", { staticClass: "el-icon-lx-add" }), e._v(" " + e._s(e.addRootNodeLabel ? e.addRootNodeLabel : `添加${e.label}`) + " ")])], 1) : e._e(), i("ElTree", e._g(e._b({ key: e.treeKey, ref: "tree", staticClass: "flex-item", attrs: { "default-expanded-keys": e.expandedKeys, "expand-on-click-node": !1, "highlight-current": "", load: e.loadNode, data: e.innerTreeData, props: e.treeProps, lazy: e.lazy, "node-key": e.nodeKey }, on: { "node-click": e.nodeClick, "node-contextmenu": e.showContextMenu, "node-expand": e.addExpandKey, "node-collapse": e.removeExpandKey }, scopedSlots: e._u([{ key: "default", fn: function({ node: s, data: n }) {
|
|
482
|
+
return [e._t("default", function() {
|
|
483
|
+
return [n.edit ? [i("span", { staticClass: "custom-tree-node flex-row flex-item oh", attrs: { "data-id": n.id } }, [e.icon ? i("i", { staticClass: "node-icon shrink-0", class: n.loading ? "el-icon-loading" : "el-icon-edit-outline" }) : e._e(), i("ElInput", { ref: "labelTxt", staticClass: "node-input flex-item", attrs: { size: "mini", placeholder: e.defaultOptions.inputPlaceholder }, on: { blur: (o) => e.inputBlur(o, s, n) }, nativeOn: { keyup: function(o) {
|
|
484
|
+
return ((r) => e.inputKeyup(r, s, n)).apply(null, arguments);
|
|
485
|
+
}, click: function(o) {
|
|
486
|
+
o.stopPropagation();
|
|
487
|
+
} }, model: { value: e.text, callback: function(o) {
|
|
488
|
+
e.text = o;
|
|
489
|
+
}, expression: "text" } }), e.confirmButton ? [i("ElButton", { directives: [{ name: "show", rawName: "v-show", value: !n.loading, expression: "!data.loading" }], staticClass: "shrink-0", attrs: { size: "mini", type: "text" }, on: { click: function(o) {
|
|
490
|
+
return o.stopPropagation(), e.onConfirm(s, n);
|
|
491
|
+
} } }, [e._v("确定")]), i("ElButton", { directives: [{ name: "show", rawName: "v-show", value: !n.loading, expression: "!data.loading" }], staticClass: "shrink-0", attrs: { size: "mini", type: "text" }, on: { click: function(o) {
|
|
492
|
+
return o.stopPropagation(), e.onCancel(s, n);
|
|
493
|
+
} } }, [e._v("取消")])] : e._e()], 2)] : [i("span", { staticClass: "custom-tree-node", attrs: { "data-id": n.id } }, [i("span", { staticClass: "node-label flex-row flex-item oh ellipsis-1" }, [e.icon ? i("i", { staticClass: "node-icon", class: n.loading ? "el-icon-loading" : e.icon(n, s) }) : e._e(), i("span", { staticClass: "flex-item-relative", staticStyle: { height: "21px" } }, [i("span", { staticClass: "ellipsis-1 absolute-box et-tree-label", attrs: { title: s.label } }, [e._t("label", function() {
|
|
494
|
+
return [e._v(e._s(s.label))];
|
|
495
|
+
}, { data: n, node: s })], 2)]), e._t("label-suffix", null, { node: s, data: n })], 2), !e.contextMenu && !e.readonly ? i("span", { directives: [{ name: "show", rawName: "v-show", value: !n.loading && !e.loading, expression: "!data.loading && !loading" }], staticClass: "handle-actions" }, [i("ElButton", { attrs: { size: "mini", type: "text" }, on: { click: function(o) {
|
|
496
|
+
return o.stopPropagation(), e.appendChildNode(s, n);
|
|
497
|
+
} } }, [e._v("添加")]), i("ElButton", { attrs: { size: "mini", type: "text" }, on: { click: function(o) {
|
|
498
|
+
return o.stopPropagation(), e.editNode(s, n);
|
|
499
|
+
} } }, [e._v("修改")]), i("ElPopconfirm", { staticClass: "pop-confirm", attrs: { "icon-color": "red", title: "你确定要删除吗?" }, on: { confirm: function(o) {
|
|
500
|
+
return e.removeNode(s, n);
|
|
501
|
+
} }, scopedSlots: e._u([{ key: "reference", fn: function() {
|
|
502
|
+
return [i("ElButton", { directives: [{ name: "show", rawName: "v-show", value: s.isLeaf, expression: "node.isLeaf" }], staticStyle: { "margin-left": "4px" }, attrs: { size: "mini", type: "text" }, on: { click: function(o) {
|
|
503
|
+
o.stopPropagation();
|
|
504
|
+
} } }, [e._v("删除")])];
|
|
505
|
+
}, proxy: !0 }], null, !0) })], 1) : e._e(), e.contextMenuIcon && e.contextMenu && !e.readonly ? i("span", { directives: [{ name: "show", rawName: "v-show", value: !n.loading && !e.loading, expression: "!data.loading && !loading" }], staticClass: "handle-actions", staticStyle: { display: "inline-block" } }, [i("ElButton", { staticStyle: { padding: "6px 10px 0" }, attrs: { size: "mini", type: "text" }, on: { click: function(o) {
|
|
506
|
+
return o.stopPropagation(), e.showContextMenu(o, n, s);
|
|
507
|
+
} } }, [e._v(". . .")])], 1) : e._e()])]];
|
|
508
|
+
}, { node: s, data: n })];
|
|
509
|
+
} }], null, !0) }, "ElTree", e.filterTreeProperties(e.$attrs), !1), e.filterTreeEvents(e.$listeners))), e.contextMenu && !e.readonly ? i("div", { directives: [{ name: "show", rawName: "v-show", value: e.showMenu, expression: "showMenu" }], ref: "contextMenu", staticClass: "menu", style: e.position }, [i("ul", { staticClass: "menu-list" }, [e._t("context-menu", function() {
|
|
510
|
+
return [i("li", { directives: [{ name: "show", rawName: "v-show", value: e.curData.id > -1, expression: "curData.id > -1" }], staticClass: "menu-item", on: { click: function(s) {
|
|
511
|
+
return e.appendPeerNode(e.curNode, e.curData);
|
|
512
|
+
} } }, [i("i", { staticClass: "menu-item-icon el-icon-lx-add", staticStyle: { color: "#228b22" } }), e._v(e._s(e.menuLabel.appendPeer) + " ")]), i("li", { staticClass: "menu-item", on: { click: function(s) {
|
|
513
|
+
return e.appendChildNode(e.curNode, e.curData);
|
|
514
|
+
} } }, [i("i", { staticClass: "menu-item-icon el-icon-lx-add", staticStyle: { color: "#228b22" } }), e._v(e._s(e.menuLabel.appendChild) + " ")]), i("li", { directives: [{ name: "show", rawName: "v-show", value: e.curData.id > -1, expression: "curData.id > -1" }], staticClass: "menu-item", on: { click: function(s) {
|
|
515
|
+
return e.editNode(e.curNode, e.curData);
|
|
516
|
+
} } }, [i("i", { staticClass: "menu-item-icon el-icon-edit-outline", staticStyle: { color: "#ffa500" } }), e._v(e._s(e.menuLabel.editNode) + " ")]), i("li", { directives: [{ name: "show", rawName: "v-show", value: e.curNode.isLeaf, expression: "curNode.isLeaf" }], staticClass: "menu-item", on: { click: function(s) {
|
|
517
|
+
return e.removeNodeModal(e.curNode, e.curData);
|
|
518
|
+
} } }, [i("i", { staticClass: "menu-item-icon el-icon-delete", staticStyle: { color: "#f00" } }), e._v(e._s(e.menuLabel.removeNode) + " ")])];
|
|
519
|
+
}, { curNode: e.curNode, curData: e.curData })], 2)]) : e._e()], 1)], 1);
|
|
520
|
+
}, I = [], O = /* @__PURE__ */ S(
|
|
521
|
+
V,
|
|
827
522
|
A,
|
|
828
523
|
I,
|
|
829
524
|
!1,
|
|
830
|
-
|
|
525
|
+
null,
|
|
831
526
|
null,
|
|
832
527
|
null,
|
|
833
528
|
null
|
|
834
529
|
);
|
|
835
|
-
|
|
836
|
-
for (let i in $)
|
|
837
|
-
this[i] = $[i];
|
|
838
|
-
}
|
|
839
|
-
const Q = /* @__PURE__ */ function() {
|
|
840
|
-
return F.exports;
|
|
841
|
-
}();
|
|
530
|
+
const G = O.exports;
|
|
842
531
|
export {
|
|
843
|
-
|
|
532
|
+
G as default
|
|
844
533
|
};
|