@pantograph/vue 0.8.1 → 0.8.3
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/Menu/index.js.js +1 -1
- package/dist/Menu/index.umd.cjs.js +1 -1
- package/dist/Menu.vue_vue_type_style_index_0_lang-C_lbO09l.js +1 -0
- package/dist/Menu.vue_vue_type_style_index_0_lang-oedL61ps.js +521 -0
- package/dist/MenuItem/index.js.js +1 -1
- package/dist/MenuItem/index.umd.cjs.js +1 -1
- package/dist/Tree/TreeNode.d.ts +19 -3
- package/dist/Tree/index.js.js +1 -1
- package/dist/Tree/index.umd.cjs.js +1 -1
- package/dist/Tree.vue_vue_type_style_index_0_lang-D2iXdFbM.js +1 -0
- package/dist/Tree.vue_vue_type_style_index_0_lang-D9EB0NE_.js +573 -0
- package/dist/index.js.js +2 -2
- package/dist/index.umd.cjs.js +1 -1
- package/dist/style/index.css +1 -1
- package/package.json +1 -1
- package/dist/Menu.vue_vue_type_style_index_0_lang-BJqJJOUC.js +0 -1
- package/dist/Menu.vue_vue_type_style_index_0_lang-CfK6q5lj.js +0 -510
- package/dist/Tree.vue_vue_type_style_index_0_lang-Ds7jrgdN.js +0 -1
- package/dist/Tree.vue_vue_type_style_index_0_lang-WOtMzGCH.js +0 -575
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
import { defineComponent as xe, useSlots as Ce, computed as u, inject as Be, ref as b, watch as Y, provide as Ee, resolveComponent as Fe, createBlock as Q, openBlock as N, unref as c, normalizeClass as P, withCtx as W, createElementVNode as me, withDirectives as Le, createCommentVNode as ne, createElementBlock as G, createVNode as Te, renderSlot as X, normalizeProps as ue, guardReactiveProps as ve, withModifiers as ye, Fragment as fe, toDisplayString as $e, renderList as ae, createSlots as Ne, mergeProps as Se, vShow as Ae, normalizeStyle as Re, onMounted as Pe, onBeforeUnmount as Me } from "vue";
|
|
2
|
+
import { a as M, b as O, g as Oe, c as Ue } from "./class-DziTeW9B.js";
|
|
3
|
+
import { cva as we } from "class-variance-authority";
|
|
4
|
+
import { c as L } from "./cloneDeep-DIRSbAoF.js";
|
|
5
|
+
import { createContext as Ge, Primitive as He, useId as Ve } from "radix-vue";
|
|
6
|
+
import { M as je, S as ge, e as qe, q as Ye } from "./omit-wqhC12f_.js";
|
|
7
|
+
import Ze from "sortablejs";
|
|
8
|
+
import { g as Ke } from "./options-JBqnVZUl.js";
|
|
9
|
+
import { _ as Je } from "./IndentLevel.vue_vue_type_style_index_0_lang-Bs9k7yZP.js";
|
|
10
|
+
import { _ as Qe } from "./Icon.vue_vue_type_style_index_0_lang-BfPcw6PU.js";
|
|
11
|
+
import { _ as We } from "./Checkbox.vue_vue_type_style_index_0_lang-DPxsdfde.js";
|
|
12
|
+
var Xe = "__lodash_hash_undefined__";
|
|
13
|
+
function De(s) {
|
|
14
|
+
return this.__data__.set(s, Xe), this;
|
|
15
|
+
}
|
|
16
|
+
function et(s) {
|
|
17
|
+
return this.__data__.has(s);
|
|
18
|
+
}
|
|
19
|
+
function se(s) {
|
|
20
|
+
var l = -1, t = s == null ? 0 : s.length;
|
|
21
|
+
for (this.__data__ = new je(); ++l < t; )
|
|
22
|
+
this.add(s[l]);
|
|
23
|
+
}
|
|
24
|
+
se.prototype.add = se.prototype.push = De;
|
|
25
|
+
se.prototype.has = et;
|
|
26
|
+
function tt(s, l, t, e) {
|
|
27
|
+
for (var w = s.length, v = t + -1; ++v < w; )
|
|
28
|
+
if (l(s[v], v, s))
|
|
29
|
+
return v;
|
|
30
|
+
return -1;
|
|
31
|
+
}
|
|
32
|
+
function nt(s) {
|
|
33
|
+
return s !== s;
|
|
34
|
+
}
|
|
35
|
+
function at(s, l, t) {
|
|
36
|
+
for (var e = t - 1, w = s.length; ++e < w; )
|
|
37
|
+
if (s[e] === l)
|
|
38
|
+
return e;
|
|
39
|
+
return -1;
|
|
40
|
+
}
|
|
41
|
+
function st(s, l, t) {
|
|
42
|
+
return l === l ? at(s, l, t) : tt(s, nt, t);
|
|
43
|
+
}
|
|
44
|
+
function lt(s, l) {
|
|
45
|
+
var t = s == null ? 0 : s.length;
|
|
46
|
+
return !!t && st(s, l, 0) > -1;
|
|
47
|
+
}
|
|
48
|
+
function ot(s, l) {
|
|
49
|
+
return s.has(l);
|
|
50
|
+
}
|
|
51
|
+
function rt() {
|
|
52
|
+
}
|
|
53
|
+
function _e(s) {
|
|
54
|
+
var l = -1, t = Array(s.size);
|
|
55
|
+
return s.forEach(function(e) {
|
|
56
|
+
t[++l] = e;
|
|
57
|
+
}), t;
|
|
58
|
+
}
|
|
59
|
+
var it = 1 / 0, dt = ge && 1 / _e(new ge([, -0]))[1] == it ? function(s) {
|
|
60
|
+
return new ge(s);
|
|
61
|
+
} : rt, ct = 200;
|
|
62
|
+
function ut(s, l, t) {
|
|
63
|
+
var e = -1, w = lt, v = s.length, T = !0, p = [], h = p;
|
|
64
|
+
if (v >= ct) {
|
|
65
|
+
var K = dt(s);
|
|
66
|
+
if (K)
|
|
67
|
+
return _e(K);
|
|
68
|
+
T = !1, w = ot, h = new se();
|
|
69
|
+
} else
|
|
70
|
+
h = p;
|
|
71
|
+
e:
|
|
72
|
+
for (; ++e < v; ) {
|
|
73
|
+
var _ = s[e], x = _;
|
|
74
|
+
if (_ = _ !== 0 ? _ : 0, T && x === x) {
|
|
75
|
+
for (var C = h.length; C--; )
|
|
76
|
+
if (h[C] === x)
|
|
77
|
+
continue e;
|
|
78
|
+
p.push(_);
|
|
79
|
+
} else w(h, x, t) || (h !== p && h.push(x), p.push(_));
|
|
80
|
+
}
|
|
81
|
+
return p;
|
|
82
|
+
}
|
|
83
|
+
function vt(s) {
|
|
84
|
+
return s && s.length ? ut(s) : [];
|
|
85
|
+
}
|
|
86
|
+
function ke(s, l, t) {
|
|
87
|
+
var e = s == null ? void 0 : qe(s, l);
|
|
88
|
+
return e === void 0 ? t : e;
|
|
89
|
+
}
|
|
90
|
+
const gt = ["sm", "md", "lg"], be = { none: "gap-none", sm: "gap-sm", md: "gap-md", lg: "gap-lg" }, [ft, pt] = Ge("CheckboxGroup"), ht = ["tabindex"], mt = ["data-parents", "data-level"], yt = /* @__PURE__ */ xe({
|
|
91
|
+
...Ke("TreeNode"),
|
|
92
|
+
__name: "TreeNode",
|
|
93
|
+
props: {
|
|
94
|
+
item: {},
|
|
95
|
+
level: { default: 1 },
|
|
96
|
+
hovered: { type: Boolean },
|
|
97
|
+
parentKeys: {}
|
|
98
|
+
},
|
|
99
|
+
setup(s) {
|
|
100
|
+
const l = s, t = Ce(), e = ft(), w = we(e.prefixes.node, {
|
|
101
|
+
variants: {
|
|
102
|
+
disabled: M("disabled", e.prefixes.node),
|
|
103
|
+
active: M("active", e.prefixes.node)
|
|
104
|
+
}
|
|
105
|
+
}), v = u(() => {
|
|
106
|
+
switch (e.size.value) {
|
|
107
|
+
case "sm":
|
|
108
|
+
return "2xsm";
|
|
109
|
+
case "md":
|
|
110
|
+
case "lg":
|
|
111
|
+
return "xsm";
|
|
112
|
+
}
|
|
113
|
+
}), T = u(() => {
|
|
114
|
+
switch (e.size.value) {
|
|
115
|
+
case "sm":
|
|
116
|
+
return "2xsm";
|
|
117
|
+
default:
|
|
118
|
+
return "xsm";
|
|
119
|
+
}
|
|
120
|
+
}), p = (o) => e.getNodeField(o, "children"), h = (o) => e.getNodeField(o, "key"), K = u(() => p(l.item)), _ = u(() => e.getNodeField(l.item, "leaf")), x = u(() => e.draggable.value ? e.getNodeField(l.item, "draggable") ?? !0 : !1), C = u(() => h(l.item)), S = u(
|
|
121
|
+
() => !!(e.disabled.value || e.getNodeField(l.item, "disabled"))
|
|
122
|
+
), $ = u(
|
|
123
|
+
() => {
|
|
124
|
+
var o;
|
|
125
|
+
return !!((o = K.value) != null && o.some((a) => e.expandedKeys.value.includes(h(a))));
|
|
126
|
+
}
|
|
127
|
+
), m = Be("tree-node-context", {
|
|
128
|
+
hovered: b(l.hovered ?? !1),
|
|
129
|
+
expanded: b(!1),
|
|
130
|
+
childExpanded: $
|
|
131
|
+
}), B = u(
|
|
132
|
+
() => !(l.item.dragging ?? !1) && e.expandedKeys.value.includes(C.value)
|
|
133
|
+
), z = b(!1), A = (o) => {
|
|
134
|
+
z.value = o;
|
|
135
|
+
};
|
|
136
|
+
Y(z, (o) => {
|
|
137
|
+
e.showLine.value && m.hovered && (m.hovered.value = o);
|
|
138
|
+
}), Ee("tree-node-context", {
|
|
139
|
+
expanded: B,
|
|
140
|
+
childExpanded: $,
|
|
141
|
+
hovered: z
|
|
142
|
+
});
|
|
143
|
+
const Z = u(() => {
|
|
144
|
+
var o, a, n;
|
|
145
|
+
if (e.dragging.value) return !1;
|
|
146
|
+
if (e.showLine.value) {
|
|
147
|
+
if (l.hovered || (o = m.hovered) != null && o.value || z.value) return "all";
|
|
148
|
+
if (B.value && !$.value) return "self";
|
|
149
|
+
if ((a = m.expanded) != null && a.value && !((n = m.childExpanded) != null && n.value)) return "last";
|
|
150
|
+
}
|
|
151
|
+
}), I = u(() => {
|
|
152
|
+
var o;
|
|
153
|
+
return !((o = K.value) != null && o.length);
|
|
154
|
+
}), le = () => {
|
|
155
|
+
S.value || e.onSelect(l.item);
|
|
156
|
+
}, R = u(() => !!e.model.value.includes(C.value)), k = u(() => {
|
|
157
|
+
const o = (i = l.item) => {
|
|
158
|
+
const d = p(i);
|
|
159
|
+
return (d == null ? void 0 : d.length) && d.every((g) => e.checked.value.includes(h(g)));
|
|
160
|
+
}, a = (i = l.item) => {
|
|
161
|
+
const d = p(i);
|
|
162
|
+
return d != null && d.length ? !!(d != null && d.some(
|
|
163
|
+
(g) => e.checked.value.includes(h(g)) || a(g)
|
|
164
|
+
)) : !1;
|
|
165
|
+
}, n = e.checked.value.includes(C.value);
|
|
166
|
+
return o() ? (n || e.onCheck(l.item), !0) : a() ? (n && e.onCheck(l.item), "indeterminate") : !!n;
|
|
167
|
+
}), oe = () => {
|
|
168
|
+
var n;
|
|
169
|
+
if (!((n = K.value) != null && n.length)) return e.onCheck(l.item);
|
|
170
|
+
const o = (r = l.item) => {
|
|
171
|
+
const i = p(r);
|
|
172
|
+
return i != null && i.length ? i.reduce((d, g) => {
|
|
173
|
+
const E = p(g), j = h(g);
|
|
174
|
+
return E != null && E.length ? [...d, j, ...o(g)] : [...d, j];
|
|
175
|
+
}, []) : [];
|
|
176
|
+
}, a = o();
|
|
177
|
+
return e.onCheck(l.item, {
|
|
178
|
+
keys: [C.value, ...a],
|
|
179
|
+
value: !e.checked.value.includes(C.value)
|
|
180
|
+
});
|
|
181
|
+
}, D = u(() => [...l.parentKeys ?? [], C.value]), re = () => {
|
|
182
|
+
e.onExpandKey(l.item);
|
|
183
|
+
}, H = u(() => l.item.dragging_level ?? l.level), V = u(() => H.value + 1), U = b(), ee = b();
|
|
184
|
+
e.useSortable({
|
|
185
|
+
root: U,
|
|
186
|
+
instance: ee,
|
|
187
|
+
node: l.item
|
|
188
|
+
});
|
|
189
|
+
const ie = u(() => {
|
|
190
|
+
switch (e.size.value) {
|
|
191
|
+
case "sm":
|
|
192
|
+
return "2xsm";
|
|
193
|
+
case "md":
|
|
194
|
+
return "xsm";
|
|
195
|
+
case "lg":
|
|
196
|
+
return "sm";
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
return (o, a) => {
|
|
200
|
+
const n = Fe("TreeNode", !0);
|
|
201
|
+
return N(), Q(c(He), {
|
|
202
|
+
asChild: I.value,
|
|
203
|
+
key: I.value,
|
|
204
|
+
"data-parents": c(e).draggable.value ? o.parentKeys : void 0,
|
|
205
|
+
"data-key": c(e).draggable.value ? C.value : void 0,
|
|
206
|
+
"data-draggable": c(e).draggable.value ? !S.value && x.value : void 0,
|
|
207
|
+
class: P([{ [c(e).prefixes.group]: !I.value }, c(e).getNodeField(o.item, "class")])
|
|
208
|
+
}, {
|
|
209
|
+
default: W(() => {
|
|
210
|
+
var r, i;
|
|
211
|
+
return [
|
|
212
|
+
me("div", {
|
|
213
|
+
tabindex: S.value ? void 0 : 0,
|
|
214
|
+
class: P([
|
|
215
|
+
c(w)({
|
|
216
|
+
disabled: S.value,
|
|
217
|
+
active: R.value
|
|
218
|
+
}),
|
|
219
|
+
c(e).getNodeField(o.item, "class")
|
|
220
|
+
]),
|
|
221
|
+
onMouseenter: a[1] || (a[1] = (d) => A(!0)),
|
|
222
|
+
onMouseleave: a[2] || (a[2] = (d) => A(!1)),
|
|
223
|
+
onClick: le
|
|
224
|
+
}, [
|
|
225
|
+
c(e).draggable.value ? (N(), G("span", {
|
|
226
|
+
key: 0,
|
|
227
|
+
class: P(c(e).prefixes.draggable)
|
|
228
|
+
}, [
|
|
229
|
+
!o.item.dragging && !c(e).dragging.value ? (N(), Q(Qe, {
|
|
230
|
+
key: 0,
|
|
231
|
+
icon: "tabler:grip-vertical",
|
|
232
|
+
size: T.value,
|
|
233
|
+
class: P(c(e).prefixes.draggableIcon)
|
|
234
|
+
}, {
|
|
235
|
+
default: W(() => [
|
|
236
|
+
X(o.$slots, "dragTrigger", ue(ve({ ...o.item, selected: R.value, checked: k.value, disabled: S.value, unFocusable: !0 })))
|
|
237
|
+
]),
|
|
238
|
+
_: 3
|
|
239
|
+
}, 8, ["size", "class"])) : ne("", !0)
|
|
240
|
+
], 2)) : ne("", !0),
|
|
241
|
+
Te(Je, {
|
|
242
|
+
level: H.value,
|
|
243
|
+
children: !!((r = K.value) != null && r.length || c(e).lazyLoad.value && !_.value),
|
|
244
|
+
size: ie.value,
|
|
245
|
+
expanded: B.value,
|
|
246
|
+
showLine: Z.value,
|
|
247
|
+
loading: c(e).getNodeField(o.item, "loading"),
|
|
248
|
+
"branch-icon": c(e).getNodeField(o.item, "switcherIcon") ?? c(e).switcherIcon.value,
|
|
249
|
+
"no-rotate-branch": c(e).getNodeField(o.item, "noRotateSwitcherIcon") ?? c(e).noRotateSwitcherIcon.value,
|
|
250
|
+
onToggleExpand: ye(re, ["stop"])
|
|
251
|
+
}, {
|
|
252
|
+
default: W(() => [
|
|
253
|
+
X(o.$slots, "switcherIcon", ue(ve({ ...o.item, selected: R.value, checked: k.value, expanded: B.value, disabled: S.value, unFocusable: !0 })))
|
|
254
|
+
]),
|
|
255
|
+
_: 3
|
|
256
|
+
}, 8, ["level", "children", "size", "expanded", "showLine", "loading", "branch-icon", "no-rotate-branch"]),
|
|
257
|
+
!o.item.dragging || !c(e).dragging.value ? (N(), G(fe, { key: 1 }, [
|
|
258
|
+
c(e).checkbox.value ? (N(), Q(We, {
|
|
259
|
+
key: 0,
|
|
260
|
+
size: v.value,
|
|
261
|
+
onClick: a[0] || (a[0] = ye(() => {
|
|
262
|
+
}, ["stop"])),
|
|
263
|
+
checked: k.value,
|
|
264
|
+
"onUpdate:checked": oe,
|
|
265
|
+
disabled: S.value
|
|
266
|
+
}, null, 8, ["size", "checked", "disabled"])) : ne("", !0),
|
|
267
|
+
X(o.$slots, "title", ue(ve({ ...o.item, selected: R.value, checked: k.value, disabled: S.value, unFocusable: !0 })), () => [
|
|
268
|
+
me("div", {
|
|
269
|
+
class: P(c(O)(c(e).prefixes.node, "title"))
|
|
270
|
+
}, $e(c(e).getNodeField(o.item, "title")), 3)
|
|
271
|
+
])
|
|
272
|
+
], 64)) : (N(), G("div", {
|
|
273
|
+
key: 2,
|
|
274
|
+
class: P(c(O)(c(e).prefixes.node, "slot"))
|
|
275
|
+
}, null, 2))
|
|
276
|
+
], 42, ht),
|
|
277
|
+
(i = K.value) != null && i.length ? Le((N(), G("div", {
|
|
278
|
+
key: 0,
|
|
279
|
+
class: P(c(e).prefixes.groupList),
|
|
280
|
+
ref_key: "root",
|
|
281
|
+
ref: U,
|
|
282
|
+
"data-parents": c(e).draggable.value ? D.value : void 0,
|
|
283
|
+
"data-level": c(e).draggable.value ? V.value : void 0
|
|
284
|
+
}, [
|
|
285
|
+
(N(!0), G(fe, null, ae(p(o.item), (d) => {
|
|
286
|
+
var g;
|
|
287
|
+
return N(), Q(n, {
|
|
288
|
+
key: c(e).getNodeField(d, "key"),
|
|
289
|
+
parentKeys: D.value,
|
|
290
|
+
item: d,
|
|
291
|
+
level: V.value,
|
|
292
|
+
hovered: l.hovered || z.value || ((g = c(m).hovered) == null ? void 0 : g.value)
|
|
293
|
+
}, Ne({ _: 2 }, [
|
|
294
|
+
ae(Object.keys(t), (E) => ({
|
|
295
|
+
name: E,
|
|
296
|
+
fn: W((j) => [
|
|
297
|
+
X(o.$slots, E, Se({ ref_for: !0 }, j))
|
|
298
|
+
])
|
|
299
|
+
}))
|
|
300
|
+
]), 1032, ["parentKeys", "item", "level", "hovered"]);
|
|
301
|
+
}), 128))
|
|
302
|
+
], 10, mt)), [
|
|
303
|
+
[Ae, B.value]
|
|
304
|
+
]) : ne("", !0)
|
|
305
|
+
];
|
|
306
|
+
}),
|
|
307
|
+
_: 3
|
|
308
|
+
}, 8, ["asChild", "data-parents", "data-key", "data-draggable", "class"]);
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
}), Bt = /* @__PURE__ */ xe({
|
|
312
|
+
...Ke("Tree"),
|
|
313
|
+
__name: "Tree",
|
|
314
|
+
props: {
|
|
315
|
+
class: {},
|
|
316
|
+
size: { default: "md" },
|
|
317
|
+
gap: {},
|
|
318
|
+
data: {},
|
|
319
|
+
value: {},
|
|
320
|
+
checkedKeys: {},
|
|
321
|
+
expandedKeys: {},
|
|
322
|
+
multiple: { type: Boolean },
|
|
323
|
+
checkbox: { type: Boolean },
|
|
324
|
+
defaultExpandAll: { type: Boolean },
|
|
325
|
+
selectable: { type: Boolean },
|
|
326
|
+
showLine: { type: Boolean },
|
|
327
|
+
inlineNode: { type: Boolean },
|
|
328
|
+
lazyLoad: { type: Boolean },
|
|
329
|
+
fieldNames: {},
|
|
330
|
+
groupName: {},
|
|
331
|
+
switcherIcon: {},
|
|
332
|
+
noRotateSwitcherIcon: { type: Boolean },
|
|
333
|
+
draggable: { type: Boolean },
|
|
334
|
+
disabled: { type: Boolean }
|
|
335
|
+
},
|
|
336
|
+
emits: ["update:value", "update:expandedKeys", "update:checkedKeys", "expand", "select", "check", "dragStart", "dragEnd"],
|
|
337
|
+
setup(s, { emit: l }) {
|
|
338
|
+
const t = s, e = l, w = Ce(), v = Oe("tree"), T = O(v, "node"), p = O(T, "group"), h = O(T, "draggable"), K = O(h, "icon"), _ = O(p, "list"), x = {
|
|
339
|
+
node: T,
|
|
340
|
+
group: p,
|
|
341
|
+
draggable: h,
|
|
342
|
+
draggableIcon: K,
|
|
343
|
+
groupList: _
|
|
344
|
+
}, C = we(v, {
|
|
345
|
+
variants: {
|
|
346
|
+
size: M(gt, v),
|
|
347
|
+
gap: M(be, v),
|
|
348
|
+
selectable: M("selectable", v),
|
|
349
|
+
disabled: M("disabled", v),
|
|
350
|
+
inlineNode: M("inline-node", v),
|
|
351
|
+
dragging: M("dragging", v)
|
|
352
|
+
}
|
|
353
|
+
}), S = u(() => L(t.data)), $ = b(S.value), m = (a, n) => {
|
|
354
|
+
var i;
|
|
355
|
+
const r = ke(a, n);
|
|
356
|
+
return (i = t.fieldNames) != null && i[n] ? ke(a, t.fieldNames[n], r) : r;
|
|
357
|
+
}, B = () => {
|
|
358
|
+
if (!t.lazyLoad) {
|
|
359
|
+
const a = [], n = (r) => {
|
|
360
|
+
for (const i of r) {
|
|
361
|
+
const d = m(i, "children");
|
|
362
|
+
d != null && d.length && (a.push(m(i, "key")), n(d));
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
return n($.value), a;
|
|
366
|
+
}
|
|
367
|
+
return [];
|
|
368
|
+
}, z = b(
|
|
369
|
+
t.expandedKeys ?? (t.defaultExpandAll ? B() : [])
|
|
370
|
+
);
|
|
371
|
+
Y(
|
|
372
|
+
() => [t.defaultExpandAll, t.expandedKeys],
|
|
373
|
+
([a, n], [r, i]) => {
|
|
374
|
+
n !== i ? z.value = t.expandedKeys ?? [] : a && !r && (z.value = B());
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
const A = u({
|
|
378
|
+
get() {
|
|
379
|
+
return t.expandedKeys ? t.expandedKeys : z.value;
|
|
380
|
+
},
|
|
381
|
+
set(a) {
|
|
382
|
+
t.expandedKeys || (z.value = a), e("update:expandedKeys", a);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
Y(
|
|
386
|
+
S,
|
|
387
|
+
(a) => {
|
|
388
|
+
$.value = a;
|
|
389
|
+
const n = B();
|
|
390
|
+
A.value = A.value.filter((r) => n.includes(r)), V.value++;
|
|
391
|
+
},
|
|
392
|
+
{ deep: !0 }
|
|
393
|
+
);
|
|
394
|
+
const Z = b(t.value ?? []);
|
|
395
|
+
Y(
|
|
396
|
+
() => t.value,
|
|
397
|
+
() => {
|
|
398
|
+
Z.value = t.value ?? [];
|
|
399
|
+
}
|
|
400
|
+
);
|
|
401
|
+
const I = u({
|
|
402
|
+
get() {
|
|
403
|
+
return t.value ? t.value : Z.value;
|
|
404
|
+
},
|
|
405
|
+
set(a) {
|
|
406
|
+
t.value || (Z.value = a), e("update:value", a);
|
|
407
|
+
}
|
|
408
|
+
}), le = (a) => {
|
|
409
|
+
if (t.selectable && !t.disabled) {
|
|
410
|
+
let n = L(I.value);
|
|
411
|
+
const r = m(a, "key");
|
|
412
|
+
t.multiple ? I.value.includes(r) ? n = L(I.value.filter((i) => i !== r)) : n = L([...I.value, r]) : n.includes(r) ? n = [] : n = [r], I.value = n, e("select", a, n.includes(r));
|
|
413
|
+
}
|
|
414
|
+
}, R = b(t.checkedKeys ?? []);
|
|
415
|
+
Y(
|
|
416
|
+
() => t.checkedKeys,
|
|
417
|
+
() => {
|
|
418
|
+
R.value = t.checkedKeys ?? [];
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
const k = u({
|
|
422
|
+
get() {
|
|
423
|
+
return t.checkedKeys ? t.checkedKeys : R.value;
|
|
424
|
+
},
|
|
425
|
+
set(a) {
|
|
426
|
+
t.checkedKeys || (R.value = a), e("update:checkedKeys", a);
|
|
427
|
+
}
|
|
428
|
+
}), oe = (a, n) => {
|
|
429
|
+
if (t.checkbox && !t.disabled) {
|
|
430
|
+
let r = L(k.value);
|
|
431
|
+
const i = m(a, "key");
|
|
432
|
+
n != null && n.keys.length ? n.value ? r = vt([...n.keys, ...r]) : r = L(k.value.filter((g) => !n.keys.includes(g))) : k.value.includes(i) ? r = L(k.value.filter((g) => g !== i)) : r = L([...k.value, i]), k.value = r;
|
|
433
|
+
const d = (n == null ? void 0 : n.value) ?? k.value.includes(i);
|
|
434
|
+
e("check", a, d, (n == null ? void 0 : n.keys) ?? i);
|
|
435
|
+
}
|
|
436
|
+
}, D = (a) => {
|
|
437
|
+
let n = !0;
|
|
438
|
+
const r = m(a, "key");
|
|
439
|
+
let i = L(A.value);
|
|
440
|
+
i.includes(r) ? (i = i.filter((d) => d !== r), n = !1) : i = [...i, r], A.value = i, e("expand", a, n);
|
|
441
|
+
}, re = u(() => {
|
|
442
|
+
if (t.gap) {
|
|
443
|
+
if (typeof t.gap == "number") return `${t.gap}px`;
|
|
444
|
+
if (!Object.keys(be).includes(t.gap)) return t.gap;
|
|
445
|
+
}
|
|
446
|
+
}), H = t.groupName ?? Ve(void 0, v), V = b(1), U = b(!1), ee = b(), ie = b(), o = (a) => {
|
|
447
|
+
const { root: n, instance: r, node: i } = a, d = (F) => {
|
|
448
|
+
var f;
|
|
449
|
+
return (f = F.getAttribute("data-parents")) == null ? void 0 : f.split(",");
|
|
450
|
+
}, g = (F) => {
|
|
451
|
+
const f = (J, ze = $.value) => {
|
|
452
|
+
const { parents: de, self: Ie } = J;
|
|
453
|
+
for (let ce of ze) {
|
|
454
|
+
const he = m(ce, "key").toString();
|
|
455
|
+
if (he === Ie) return ce;
|
|
456
|
+
const te = m(ce, "children");
|
|
457
|
+
if (de != null && de.includes(he) && (te != null && te.length)) return f(J, te);
|
|
458
|
+
}
|
|
459
|
+
}, y = d(F), q = F.getAttribute("data-key") ?? "";
|
|
460
|
+
return f({ parents: y, self: q });
|
|
461
|
+
}, E = Ue(O(v, "dragging_item"), t.size), j = (F = n.value) => new Ze(F, {
|
|
462
|
+
group: Ye(H) ? H(i) : H,
|
|
463
|
+
animation: 150,
|
|
464
|
+
forceFallback: !0,
|
|
465
|
+
fallbackOnBody: !0,
|
|
466
|
+
filter: "[data-draggable=false]",
|
|
467
|
+
handle: `.${x.node} .${x.draggable} .${x.draggableIcon}`,
|
|
468
|
+
// swapThreshold: 0.65,
|
|
469
|
+
dataIdAttr: "data-key",
|
|
470
|
+
dragClass: E,
|
|
471
|
+
onChoose(f) {
|
|
472
|
+
const y = g(f.item);
|
|
473
|
+
y && (y.dragging = !0);
|
|
474
|
+
},
|
|
475
|
+
onStart(f) {
|
|
476
|
+
var J;
|
|
477
|
+
const y = document.querySelector(`.${E}`), q = (J = getComputedStyle(n.value)) == null ? void 0 : J.direction;
|
|
478
|
+
y != null && y.style && (y.style.direction = q), U.value = !0, e("dragStart", f);
|
|
479
|
+
},
|
|
480
|
+
onUnchoose(f) {
|
|
481
|
+
const y = g(f.item);
|
|
482
|
+
y && (y.dragging = !1);
|
|
483
|
+
},
|
|
484
|
+
onEnd(f) {
|
|
485
|
+
U.value = !1, e("dragEnd", {
|
|
486
|
+
...f,
|
|
487
|
+
node: g(f.item),
|
|
488
|
+
oldParents: d(f.item),
|
|
489
|
+
newParents: d(f.to)
|
|
490
|
+
});
|
|
491
|
+
},
|
|
492
|
+
onMove(f) {
|
|
493
|
+
const y = Number(f.to.getAttribute("data-level") ?? "1"), q = g(f.dragged);
|
|
494
|
+
q && (q.dragging_level = y);
|
|
495
|
+
}
|
|
496
|
+
}), pe = () => {
|
|
497
|
+
var F;
|
|
498
|
+
(F = r.value) == null || F.destroy(), r.value = void 0;
|
|
499
|
+
};
|
|
500
|
+
Pe(() => {
|
|
501
|
+
Y(
|
|
502
|
+
() => [n.value, t.draggable, V.value],
|
|
503
|
+
() => {
|
|
504
|
+
r.value ? pe() : n.value && t.draggable && (r.value = j());
|
|
505
|
+
},
|
|
506
|
+
{ immediate: !0 }
|
|
507
|
+
);
|
|
508
|
+
}), Me(() => {
|
|
509
|
+
r.value && pe();
|
|
510
|
+
});
|
|
511
|
+
};
|
|
512
|
+
return o({
|
|
513
|
+
root: ee,
|
|
514
|
+
instance: ie
|
|
515
|
+
}), pt({
|
|
516
|
+
size: u(() => t.size),
|
|
517
|
+
draggable: u(() => t.draggable),
|
|
518
|
+
lazyLoad: u(() => t.lazyLoad),
|
|
519
|
+
checkbox: u(() => t.checkbox),
|
|
520
|
+
showLine: u(() => t.showLine),
|
|
521
|
+
disabled: u(() => t.disabled),
|
|
522
|
+
switcherIcon: u(() => t.switcherIcon),
|
|
523
|
+
noRotateSwitcherIcon: u(() => t.noRotateSwitcherIcon),
|
|
524
|
+
expandedKeys: A,
|
|
525
|
+
model: I,
|
|
526
|
+
checked: k,
|
|
527
|
+
onExpandKey: D,
|
|
528
|
+
onSelect: le,
|
|
529
|
+
onCheck: oe,
|
|
530
|
+
getNodeField: m,
|
|
531
|
+
useSortable: o,
|
|
532
|
+
dragging: U,
|
|
533
|
+
prefixes: x
|
|
534
|
+
}), (a, n) => (N(), G("div", {
|
|
535
|
+
key: V.value,
|
|
536
|
+
class: P([
|
|
537
|
+
c(C)({
|
|
538
|
+
size: t.size,
|
|
539
|
+
gap: t.gap ?? t.size,
|
|
540
|
+
selectable: t.selectable,
|
|
541
|
+
disabled: t.disabled,
|
|
542
|
+
inlineNode: t.inlineNode,
|
|
543
|
+
dragging: U.value
|
|
544
|
+
}),
|
|
545
|
+
t.class
|
|
546
|
+
]),
|
|
547
|
+
style: Re({
|
|
548
|
+
"--ptc-tree-gap": re.value
|
|
549
|
+
}),
|
|
550
|
+
ref_key: "root",
|
|
551
|
+
ref: ee
|
|
552
|
+
}, [
|
|
553
|
+
(N(!0), G(fe, null, ae($.value, (r) => (N(), Q(yt, {
|
|
554
|
+
key: m(r, "key"),
|
|
555
|
+
item: r
|
|
556
|
+
}, Ne({ _: 2 }, [
|
|
557
|
+
ae(Object.keys(w), (i) => ({
|
|
558
|
+
name: i,
|
|
559
|
+
fn: W((d) => [
|
|
560
|
+
X(a.$slots, i, Se({ ref_for: !0 }, d))
|
|
561
|
+
])
|
|
562
|
+
}))
|
|
563
|
+
]), 1032, ["item"]))), 128))
|
|
564
|
+
], 6));
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
export {
|
|
568
|
+
gt as T,
|
|
569
|
+
Bt as _,
|
|
570
|
+
be as a,
|
|
571
|
+
ft as i,
|
|
572
|
+
pt as p
|
|
573
|
+
};
|
package/dist/index.js.js
CHANGED
|
@@ -15,14 +15,14 @@ import { _ as ee, a as oe, I as ae, b as te } from "./Image.vue_vue_type_style_i
|
|
|
15
15
|
import { _ as re, a as ne, I as pe } from "./IndentLevel.vue_vue_type_style_index_0_lang-Bs9k7yZP.js";
|
|
16
16
|
import { _ as xe } from "./Indicator.vue_vue_type_script_setup_true_lang-CHuo9sYF.js";
|
|
17
17
|
import { _ as ce } from "./Kbd.vue_vue_type_style_index_0_lang-DbtLbpq-.js";
|
|
18
|
-
import { M as ue, a as Ce, b as Se, i as de, p as le } from "./Menu.vue_vue_type_style_index_0_lang-
|
|
18
|
+
import { M as ue, a as Ce, b as Se, i as de, p as le } from "./Menu.vue_vue_type_style_index_0_lang-oedL61ps.js";
|
|
19
19
|
import { _ as _e, a as ge, P as Ie } from "./Popover.vue_vue_type_style_index_0_lang-MJjv8Cvt.js";
|
|
20
20
|
import { _ as Be, a as he } from "./RadioGroup.vue_vue_type_script_setup_true_lang-DWC7_LXA.js";
|
|
21
21
|
import { _ as ze } from "./Shortcut.vue_vue_type_style_index_0_lang-BQb7DjFe.js";
|
|
22
22
|
import { _ as ke, a as Te, S as Pe } from "./Skeleton.vue_vue_type_style_index_0_lang-B6bCkLlD.js";
|
|
23
23
|
import { _ as ye, S as Me } from "./Spinner.vue_vue_type_style_index_0_lang-D6nB06Z8.js";
|
|
24
24
|
import { _ as Ee, S as Re } from "./Switch.vue_vue_type_style_index_0_lang-B4DpjGcF.js";
|
|
25
|
-
import { _ as De, a as Oe, T as Fe, i as Ve, p as Ke } from "./Tree.vue_vue_type_style_index_0_lang-
|
|
25
|
+
import { _ as De, a as Oe, T as Fe, i as Ve, p as Ke } from "./Tree.vue_vue_type_style_index_0_lang-D9EB0NE_.js";
|
|
26
26
|
import { f as He, i as Je, a as Ne, b as Qe } from "./element-CddU1vUY.js";
|
|
27
27
|
import { c as We, g as Xe } from "./options-JBqnVZUl.js";
|
|
28
28
|
import { _ as Ze, I as $e } from "./Icon.vue_vue_type_style_index_0_lang-BfPcw6PU.js";
|
package/dist/index.umd.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./ActionButton.vue_vue_type_script_setup_true_lang-2X340gYi.js"),e=require("./Avatar.vue_vue_type_style_index_0_lang-BiEWBKYn.js"),S=require("./Badge.vue_vue_type_script_setup_true_lang-D7hKm2YM.js"),i=require("./BaseBadge.vue_vue_type_style_index_0_lang-OEeJw0Sy.js"),t=require("./ButtonGroup.vue_vue_type_script_setup_true_lang-BSj1Y1j2.js"),f=require("./Button.vue_vue_type_script_setup_true_lang-687jBefr.js"),n=require("./Checkbox.vue_vue_type_style_index_0_lang-Bvk3KN2L.js"),u=require("./index-JUGW3BX8.js"),v=require("./Divider.vue_vue_type_style_index_0_lang-C6Suy0tD.js"),B=require("./FloatButton.vue_vue_type_script_setup_true_lang-CQIk1UgJ.js"),h=require("./GraphicalObject.vue_vue_type_script_setup_true_lang-8ZXdETpQ.js"),l=require("./Icon/index.umd.cjs.js"),I=require("./IconButton.vue_vue_type_script_setup_true_lang-BMbK9bu3.js"),r=require("./Image.vue_vue_type_style_index_0_lang-DbqKKOAs.js"),a=require("./IndentLevel.vue_vue_type_style_index_0_lang-C0p5Alem.js"),q=require("./Indicator.vue_vue_type_script_setup_true_lang-DzKJMO-h.js"),G=require("./Kbd.vue_vue_type_style_index_0_lang-BqEaW_kJ.js"),o=require("./Menu.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./ActionButton.vue_vue_type_script_setup_true_lang-2X340gYi.js"),e=require("./Avatar.vue_vue_type_style_index_0_lang-BiEWBKYn.js"),S=require("./Badge.vue_vue_type_script_setup_true_lang-D7hKm2YM.js"),i=require("./BaseBadge.vue_vue_type_style_index_0_lang-OEeJw0Sy.js"),t=require("./ButtonGroup.vue_vue_type_script_setup_true_lang-BSj1Y1j2.js"),f=require("./Button.vue_vue_type_script_setup_true_lang-687jBefr.js"),n=require("./Checkbox.vue_vue_type_style_index_0_lang-Bvk3KN2L.js"),u=require("./index-JUGW3BX8.js"),v=require("./Divider.vue_vue_type_style_index_0_lang-C6Suy0tD.js"),B=require("./FloatButton.vue_vue_type_script_setup_true_lang-CQIk1UgJ.js"),h=require("./GraphicalObject.vue_vue_type_script_setup_true_lang-8ZXdETpQ.js"),l=require("./Icon/index.umd.cjs.js"),I=require("./IconButton.vue_vue_type_script_setup_true_lang-BMbK9bu3.js"),r=require("./Image.vue_vue_type_style_index_0_lang-DbqKKOAs.js"),a=require("./IndentLevel.vue_vue_type_style_index_0_lang-C0p5Alem.js"),q=require("./Indicator.vue_vue_type_script_setup_true_lang-DzKJMO-h.js"),G=require("./Kbd.vue_vue_type_style_index_0_lang-BqEaW_kJ.js"),o=require("./Menu.vue_vue_type_style_index_0_lang-C_lbO09l.js"),c=require("./Popover.vue_vue_type_style_index_0_lang-TwQPMDMD.js"),d=require("./RadioGroup.vue_vue_type_script_setup_true_lang-c3UZIDsE.js"),z=require("./Shortcut.vue_vue_type_style_index_0_lang-C49ZdQFd.js"),p=require("./Skeleton.vue_vue_type_style_index_0_lang-PNNUgKOq.js"),g=require("./Spinner.vue_vue_type_style_index_0_lang-CxNO28J7.js"),C=require("./Switch.vue_vue_type_style_index_0_lang-LcwRXYSm.js"),_=require("./Tree.vue_vue_type_style_index_0_lang-D2iXdFbM.js"),s=require("./element-uBbpeYVo.js"),m=require("./options-B4iSAKol.js"),y=require("./Icon.vue_vue_type_style_index_0_lang-BvHCdzZP.js");exports.ActionButton=x._sfc_main;exports.Avatar=e._sfc_main;exports.AvatarGroup=e._sfc_main$1;exports.AvatarOnlineAlignments=e.AvatarOnlineAlignments;exports.AvatarShapes=e.AvatarShapes;exports.AvatarSizes=e.AvatarSizes;exports.AvatarStrokes=e.AvatarStrokes;exports.injectAvatarGroupContext=e.injectAvatarGroupContext;exports.provideAvatarGroupContext=e.provideAvatarGroupContext;exports.Badge=S._sfc_main;exports.BadgeColors=i.BadgeColors;exports.BadgeColorsSubtle=i.BadgeColorsSubtle;exports.BadgeSizes=i.BadgeSizes;exports.BadgeTypes=i.BadgeTypes;exports.ButtonColors=t.ButtonColors;exports.ButtonGroup=t._sfc_main;exports.ButtonSizes=t.ButtonSizes;exports.ButtonTypes=t.ButtonTypes;exports.ButtonVariants=t.ButtonVariants;exports.injectButtonGroupContext=t.injectButtonGroupContext;exports.provideButtonGroupContext=t.provideButtonGroupContext;exports.Button=f._sfc_main;exports.Checkbox=n._sfc_main;exports.CheckboxGroup=n._sfc_main$1;exports.CheckboxSizes=n.CheckboxSizes;exports.injectCheckboxGroupContext=n.injectCheckboxGroupContext;exports.provideCheckboxGroupContext=n.provideCheckboxGroupContext;exports.useColoredPantographCheckbox=n.useColoredPantographCheckbox;exports.useColoredPantographCheckboxGroup=n.useColoredPantographCheckboxGroup;exports.ConfigProvider=u.ConfigProvider;exports.injectConfigContext=u.injectConfigContext;exports.provideConfigContext=u.provideConfigContext;exports.Divider=v._sfc_main;exports.DividerTypes=v.DividerTypes;exports.FloatButton=B._sfc_main;exports.GraphicalObject=h._sfc_main;exports.defineLocaleIconCollection=l.defineLocaleIconCollection;exports.disableIconCache=l.disableIconCache;exports.IconButton=I._sfc_main;exports.Image=r._sfc_main;exports.ImageAspectRatios=r.ImageAspectRatios;exports.ImageSizeRanges=r.ImageSizeRanges;exports.ImageTypes=r.ImageTypes;exports.IndentLevel=a._sfc_main;exports.IndentLevelShowLines=a.IndentLevelShowLines;exports.IndentLevelSizes=a.IndentLevelSizes;exports.Indicator=q._sfc_main;exports.Kbd=G._sfc_main;exports.MenuGaps=o.MenuGaps;exports.MenuItem=o._sfc_main$1;exports.MenuItemSizes=o.MenuItemSizes;exports.injectMenuContext=o.injectMenuContext;exports.provideMenuContext=o.provideMenuContext;exports.Popover=c._sfc_main;exports.PopoverPlacements=c.PopoverPlacements;exports.PopoverSizes=c.PopoverSizes;exports.RadioGroup=d._sfc_main;exports.RadioGroupItem=d._sfc_main$1;exports.Shortcut=z._sfc_main;exports.Skeleton=p._sfc_main;exports.SkeletonSizes=p.SkeletonSizes;exports.SkeletonTypes=p.SkeletonTypes;exports.Spinner=g._sfc_main;exports.SpinnerSizes=g.SpinnerSizes;exports.Switch=C._sfc_main;exports.SwitchSizes=C.SwitchSizes;exports.Tree=_._sfc_main;exports.TreeGaps=_.TreeGaps;exports.TreeSizes=_.TreeSizes;exports.injectTreeContext=_.injectTreeContext;exports.provideTreeContext=_.provideTreeContext;exports.filterEmpty=s.filterEmpty;exports.isEmptyElement=s.isEmptyElement;exports.isFragment=s.isFragment;exports.isValidElement=s.isValidElement;exports.componentPrefix=m.componentPrefix;exports.getComponentOptions=m.getComponentOptions;exports.Icon=y._sfc_main;exports.IconSizes=y.IconSizes;
|