@vunk/graph 0.0.7 → 0.0.8
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/components/context-menu/index.mjs +724 -662
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent, toRefs, inject, ref, h, computed, provide, onMounted, nextTick, onBeforeUnmount, createCommentVNode, createElementBlock, unref, openBlock, createBlock, renderSlot, normalizeClass, createElementVNode, mergeProps, createVNode, toDisplayString, watch, resolveComponent, Teleport, Transition, withCtx, Fragment, renderList, createSlots, reactive, normalizeStyle, useSlots, normalizeProps, guardReactiveProps, render } from 'vue';
|
|
1
|
+
import { defineComponent, toRefs, inject, ref, h, computed, provide, onMounted, nextTick, onBeforeUnmount, createCommentVNode, createElementBlock, unref, openBlock, createBlock, renderSlot, normalizeClass, createElementVNode, mergeProps, createVNode, toDisplayString, watch, resolveComponent, Teleport, Transition, withCtx, withDirectives, Fragment, renderList, createSlots, vShow, reactive, normalizeStyle, useSlots, normalizeProps, guardReactiveProps, render } from 'vue';
|
|
2
2
|
|
|
3
|
-
let
|
|
4
|
-
function
|
|
5
|
-
return
|
|
3
|
+
let se = null;
|
|
4
|
+
function gt() {
|
|
5
|
+
return se !== null;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
7
|
+
function bt(e) {
|
|
8
|
+
se && lt(), se = e;
|
|
9
9
|
}
|
|
10
10
|
function Ye(e) {
|
|
11
|
-
e ===
|
|
11
|
+
e === se && (se = null);
|
|
12
12
|
}
|
|
13
13
|
function lt() {
|
|
14
|
-
|
|
14
|
+
se && (se.closeMenu(), se = null);
|
|
15
15
|
}
|
|
16
16
|
const ee = {
|
|
17
17
|
defaultDirection: "br",
|
|
@@ -24,54 +24,54 @@ const ee = {
|
|
|
24
24
|
y: 10
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
function
|
|
28
|
-
let
|
|
29
|
-
return e.offsetParent != null && e.offsetParent !=
|
|
27
|
+
function ue(e, n) {
|
|
28
|
+
let u = e.offsetTop;
|
|
29
|
+
return e.offsetParent != null && e.offsetParent != n && (u -= e.offsetParent.scrollTop, u += ue(e.offsetParent, n)), u;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
let
|
|
33
|
-
return e.offsetParent != null && e.offsetParent !=
|
|
31
|
+
function ae(e, n) {
|
|
32
|
+
let u = e.offsetLeft;
|
|
33
|
+
return e.offsetParent != null && e.offsetParent != n && (u -= e.offsetParent.scrollLeft, u += ae(e.offsetParent, n)), u;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function yt(e, n, u, s) {
|
|
36
36
|
return {
|
|
37
|
-
x:
|
|
38
|
-
y:
|
|
37
|
+
x: ae(e, s) + n,
|
|
38
|
+
y: ue(e, s) + u
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
const He = "mx-menu-default-container",
|
|
42
|
-
let
|
|
41
|
+
const He = "mx-menu-default-container", Ct = "mx-menu-container-";
|
|
42
|
+
let xt = 0;
|
|
43
43
|
function st(e) {
|
|
44
|
-
const { getContainer:
|
|
45
|
-
if (
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
let
|
|
49
|
-
return
|
|
50
|
-
eleId:
|
|
51
|
-
container:
|
|
44
|
+
const { getContainer: n, zIndex: u } = e;
|
|
45
|
+
if (n) {
|
|
46
|
+
const f = typeof n == "function" ? n() : n;
|
|
47
|
+
if (f) {
|
|
48
|
+
let t = f.getAttribute("id");
|
|
49
|
+
return t || (t = Ct + xt++, f.setAttribute("id", t)), {
|
|
50
|
+
eleId: t,
|
|
51
|
+
container: f,
|
|
52
52
|
isNew: false
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
let
|
|
57
|
-
return
|
|
56
|
+
let s = document.getElementById(He);
|
|
57
|
+
return s || (s = document.createElement("div"), s.setAttribute("id", He), s.setAttribute("class", "mx-menu-ghost-host fullscreen"), document.body.appendChild(s)), s.style.zIndex = (u == null ? void 0 : u.toString()) || ee.defaultZindex.toString(), {
|
|
58
58
|
eleId: He,
|
|
59
|
-
container:
|
|
59
|
+
container: s,
|
|
60
60
|
isNew: true
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
let
|
|
65
|
-
for (let
|
|
66
|
-
const
|
|
67
|
-
|
|
63
|
+
function Mt(e) {
|
|
64
|
+
let n = 0;
|
|
65
|
+
for (let u = 0; u < e.length; u++) {
|
|
66
|
+
const s = e.charCodeAt(u);
|
|
67
|
+
n = (n << 5) - n + s, n |= 0;
|
|
68
68
|
}
|
|
69
|
-
return
|
|
69
|
+
return n;
|
|
70
70
|
}
|
|
71
71
|
function Ve(e) {
|
|
72
72
|
return typeof e == "number" ? `${e}px` : e;
|
|
73
73
|
}
|
|
74
|
-
const
|
|
74
|
+
const J = defineComponent({
|
|
75
75
|
props: {
|
|
76
76
|
/**
|
|
77
77
|
* Can be VNode or (data: unknown) => VNode
|
|
@@ -89,70 +89,79 @@ const q = defineComponent({
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
setup(e) {
|
|
92
|
-
const { vnode:
|
|
93
|
-
return () => typeof
|
|
92
|
+
const { vnode: n, data: u } = toRefs(e);
|
|
93
|
+
return () => typeof n.value == "function" ? n.value(u.value) : n.value;
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
|
-
function
|
|
97
|
-
const
|
|
98
|
-
return delete
|
|
96
|
+
function St(e, n) {
|
|
97
|
+
const u = { ...e };
|
|
98
|
+
return delete u[n], u;
|
|
99
99
|
}
|
|
100
|
-
var
|
|
100
|
+
var kt = Object.defineProperty, wt = (e, n, u) => n in e ? kt(e, n, { enumerable: true, configurable: true, writable: true, value: u }) : e[n] = u, Ue = (e, n, u) => wt(e, typeof n != "symbol" ? n + "" : n, u);
|
|
101
101
|
class Xe {
|
|
102
|
-
constructor(
|
|
103
|
-
Ue(this, "x", 0), Ue(this, "y", 0), this.x =
|
|
102
|
+
constructor(n, u) {
|
|
103
|
+
Ue(this, "x", 0), Ue(this, "y", 0), this.x = n || 0, this.y = u || 0;
|
|
104
104
|
}
|
|
105
|
-
set(
|
|
106
|
-
this.x =
|
|
105
|
+
set(n, u) {
|
|
106
|
+
this.x = n, this.y = u;
|
|
107
107
|
}
|
|
108
|
-
substract(
|
|
109
|
-
this.x -=
|
|
108
|
+
substract(n) {
|
|
109
|
+
this.x -= n.x, this.y -= n.y;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
function Ze(e) {
|
|
113
|
-
const { onDown:
|
|
114
|
-
let
|
|
115
|
-
function d(
|
|
116
|
-
|
|
113
|
+
const { onDown: n, onMove: u, onUp: s } = e, f = new Xe(), t = new Xe();
|
|
114
|
+
let w;
|
|
115
|
+
function d(m) {
|
|
116
|
+
m.stopPropagation(), t.set(m.x, m.y), t.substract(f), u(f, t, m, w);
|
|
117
117
|
}
|
|
118
|
-
function p(
|
|
119
|
-
|
|
118
|
+
function p(m) {
|
|
119
|
+
s(m, w), f.set(0, 0), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", p);
|
|
120
120
|
}
|
|
121
|
-
return (
|
|
121
|
+
return (m, x) => n(m, x) ? (w = x, f.set(m.x, m.y), document.addEventListener("mousemove", d), document.addEventListener("mouseup", p), m.stopPropagation(), true) : false;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
let
|
|
123
|
+
function It(e, n) {
|
|
124
|
+
let u = 0;
|
|
125
125
|
return {
|
|
126
126
|
start() {
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
u > 0 && clearInterval(u), u = setInterval(() => {
|
|
128
|
+
u = 0, n();
|
|
129
129
|
}, e);
|
|
130
130
|
},
|
|
131
131
|
stop() {
|
|
132
|
-
|
|
132
|
+
u > 0 && (clearInterval(u), u = 0);
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
function Ge(e, n) {
|
|
137
|
+
let u = null, s = 0;
|
|
138
|
+
return function(...f) {
|
|
139
|
+
const t = Date.now(), w = t - s, d = n - w;
|
|
140
|
+
d <= 0 ? (s = t, e.apply(this, f)) : (u !== null && window.clearTimeout(u), u = window.setTimeout(() => {
|
|
141
|
+
s = Date.now(), u = null, e.apply(this, f);
|
|
142
|
+
}, d));
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
const pe = [], Qe = It(100, () => {
|
|
146
|
+
for (const e of pe)
|
|
138
147
|
e();
|
|
139
148
|
});
|
|
140
|
-
function
|
|
141
|
-
let
|
|
142
|
-
function
|
|
143
|
-
e.value && (
|
|
149
|
+
function Wt(e, n, u, s) {
|
|
150
|
+
let f = 0, t = 0;
|
|
151
|
+
function w() {
|
|
152
|
+
e.value && (n && f !== e.value.offsetWidth && n(e.value.offsetWidth), u && t !== e.value.offsetHeight && u(e.value.offsetHeight), f = e.value.offsetWidth, t = e.value.offsetHeight);
|
|
144
153
|
}
|
|
145
154
|
return {
|
|
146
155
|
startResizeChecker() {
|
|
147
|
-
|
|
156
|
+
Qe.start(), pe.push(w);
|
|
148
157
|
},
|
|
149
158
|
stopResizeChecker() {
|
|
150
|
-
const d =
|
|
151
|
-
d >= 0 &&
|
|
159
|
+
const d = pe.indexOf(w);
|
|
160
|
+
d >= 0 && pe.splice(d, 1), pe.length === 0 && Qe.stop();
|
|
152
161
|
}
|
|
153
162
|
};
|
|
154
163
|
}
|
|
155
|
-
const
|
|
164
|
+
const Ot = 140, Ht = 120, Rt = /* @__PURE__ */ defineComponent({
|
|
156
165
|
__name: "ScrollRect",
|
|
157
166
|
props: {
|
|
158
167
|
/**
|
|
@@ -185,21 +194,30 @@ const Je = 140, It = 70, Wt = /* @__PURE__ */ defineComponent({
|
|
|
185
194
|
type: Boolean,
|
|
186
195
|
default: false
|
|
187
196
|
},
|
|
197
|
+
/**
|
|
198
|
+
* Height of scroll rect
|
|
199
|
+
*/
|
|
188
200
|
height: {
|
|
189
201
|
type: Number,
|
|
190
202
|
default: void 0
|
|
191
203
|
},
|
|
204
|
+
/**
|
|
205
|
+
* Width of scroll rect
|
|
206
|
+
*/
|
|
192
207
|
width: {
|
|
193
208
|
type: Number,
|
|
194
209
|
default: void 0
|
|
195
210
|
},
|
|
196
211
|
/**
|
|
197
|
-
*
|
|
212
|
+
* Max height of inner container
|
|
198
213
|
*/
|
|
199
214
|
maxHeight: {
|
|
200
215
|
type: Number,
|
|
201
216
|
default: void 0
|
|
202
217
|
},
|
|
218
|
+
/**
|
|
219
|
+
* Max width of inner container
|
|
220
|
+
*/
|
|
203
221
|
maxWidth: {
|
|
204
222
|
type: Number,
|
|
205
223
|
default: void 0
|
|
@@ -216,246 +234,263 @@ const Je = 140, It = 70, Wt = /* @__PURE__ */ defineComponent({
|
|
|
216
234
|
*/
|
|
217
235
|
containerStyle: {
|
|
218
236
|
type: null
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* Specify how many pixels of scroll distance trigger `scrollToStart` event.
|
|
240
|
+
* @default 50
|
|
241
|
+
*/
|
|
242
|
+
scrollToStartThreshold: {
|
|
243
|
+
type: Number,
|
|
244
|
+
default: 50
|
|
245
|
+
},
|
|
246
|
+
/**
|
|
247
|
+
* Specify how many pixels of scroll distance trigger `scrollToEnd` event.
|
|
248
|
+
* @default 50
|
|
249
|
+
*/
|
|
250
|
+
scrollToEndThreshold: {
|
|
251
|
+
type: Number,
|
|
252
|
+
default: 50
|
|
219
253
|
}
|
|
220
254
|
},
|
|
221
|
-
emits: ["scroll", "resized"],
|
|
222
|
-
setup(e, { expose:
|
|
223
|
-
const
|
|
255
|
+
emits: ["scroll", "resized", "scrollToStart", "scrollToEnd"],
|
|
256
|
+
setup(e, { expose: n, emit: u }) {
|
|
257
|
+
const s = e, f = u, t = ref(), w = ref(), d = ref(), p = ref(), m = ref(), x = ref(), H = ref(false), F = computed(() => s.scroll === "horizontal" || s.scroll === "both"), P = computed(() => s.scroll === "vertical" || s.scroll === "both"), v = reactive({
|
|
224
258
|
show: false,
|
|
225
259
|
size: 0,
|
|
226
260
|
sizeRaw: 0,
|
|
227
261
|
pos: 0
|
|
228
|
-
}),
|
|
262
|
+
}), M = reactive({
|
|
229
263
|
show: false,
|
|
230
264
|
size: 0,
|
|
231
265
|
sizeRaw: 0,
|
|
232
266
|
pos: 0
|
|
233
267
|
});
|
|
234
|
-
let
|
|
235
|
-
const
|
|
236
|
-
function
|
|
237
|
-
if (
|
|
238
|
-
if (
|
|
239
|
-
const
|
|
240
|
-
|
|
268
|
+
let R = 0, h = 0, i = 0, y = 0, C = null;
|
|
269
|
+
const S = { attributes: true, childList: true };
|
|
270
|
+
function k() {
|
|
271
|
+
if (t.value) {
|
|
272
|
+
if (v.show) {
|
|
273
|
+
const o = t.value.offsetWidth / t.value.scrollWidth;
|
|
274
|
+
v.sizeRaw = o * t.value.offsetWidth, v.size = o * 100, v.pos = t.value.scrollLeft / (t.value.scrollWidth - t.value.offsetWidth) * (100 - v.size), o >= 1 && (v.show = false);
|
|
241
275
|
}
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
-
|
|
276
|
+
if (M.show) {
|
|
277
|
+
const o = t.value.offsetHeight / t.value.scrollHeight;
|
|
278
|
+
M.sizeRaw = o * t.value.offsetHeight, M.size = o * 100, M.pos = t.value.scrollTop / (t.value.scrollHeight - t.value.offsetHeight) * (100 - M.size), o >= 1 && (M.show = false);
|
|
245
279
|
}
|
|
246
|
-
|
|
280
|
+
s.scroll === "vertical" ? (s.scrollToStartThreshold && t.value.scrollTop <= s.scrollToStartThreshold && f("scrollToStart"), s.scrollToEndThreshold && t.value.scrollTop >= t.value.scrollHeight - s.scrollToEndThreshold - t.value.offsetHeight && f("scrollToEnd")) : s.scroll === "horizontal" && (s.scrollToStartThreshold && t.value.scrollLeft <= s.scrollToStartThreshold && f("scrollToStart"), s.scrollToEndThreshold && t.value.scrollLeft >= t.value.scrollWidth - s.scrollToEndThreshold - t.value.offsetWidth && f("scrollToEnd")), f("scroll", t.value.scrollLeft, t.value.scrollTop);
|
|
247
281
|
}
|
|
248
282
|
}
|
|
249
|
-
function
|
|
250
|
-
if (!
|
|
283
|
+
function c(o = false) {
|
|
284
|
+
if (!t.value)
|
|
251
285
|
return;
|
|
252
|
-
let
|
|
253
|
-
const
|
|
254
|
-
if (!
|
|
286
|
+
let l = F.value, T = P.value;
|
|
287
|
+
const Q = l && (R !== t.value.scrollWidth || i !== t.value.offsetWidth), Z = P && (h !== t.value.scrollHeight || y !== t.value.offsetHeight);
|
|
288
|
+
if (!o && !Q && !Z)
|
|
255
289
|
return;
|
|
256
|
-
const
|
|
257
|
-
(
|
|
290
|
+
const ne = window.getComputedStyle(t.value);
|
|
291
|
+
(ne.overflow === "hidden" || ne.overflowX === "hidden") && (l = false), (ne.overflow === "hidden" || ne.overflowY === "hidden") && (T = false), v.show = l, M.show = T, k(), i = t.value.offsetWidth, y = t.value.offsetHeight, R = t.value.scrollWidth, h = t.value.scrollHeight, f("resized", R, h);
|
|
258
292
|
}
|
|
259
|
-
|
|
260
|
-
var
|
|
261
|
-
|
|
262
|
-
left:
|
|
293
|
+
const _ = Ge((o) => {
|
|
294
|
+
var l;
|
|
295
|
+
(l = t.value) == null || l.scrollTo({
|
|
296
|
+
left: t.value.scrollLeft + (o ? Ot : -140),
|
|
263
297
|
behavior: "smooth"
|
|
264
|
-
})
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
left: n.value.scrollLeft + (t.deltaY > 0 ? Je : -140),
|
|
298
|
+
});
|
|
299
|
+
}, 120), B = Ge((o) => {
|
|
300
|
+
var l;
|
|
301
|
+
(l = t.value) == null || l.scrollTo({
|
|
302
|
+
top: t.value.scrollTop + (o ? Ht : -120),
|
|
270
303
|
behavior: "smooth"
|
|
271
|
-
})
|
|
304
|
+
});
|
|
305
|
+
}, 20);
|
|
306
|
+
function z(o) {
|
|
307
|
+
s.scroll == "horizontal" && (o.deltaMode == 0 && _(o.deltaY > 0), o.preventDefault(), o.stopPropagation());
|
|
272
308
|
}
|
|
273
|
-
function
|
|
274
|
-
|
|
275
|
-
t.deltaMode == 0 && ((c = n.value) == null || c.scrollTo({
|
|
276
|
-
top: n.value.scrollTop + (t.deltaY > 0 ? It : -70),
|
|
277
|
-
behavior: "smooth"
|
|
278
|
-
}), t.preventDefault(), t.stopPropagation());
|
|
309
|
+
function V(o) {
|
|
310
|
+
o.deltaMode == 0 && (_(o.deltaY > 0), o.preventDefault(), o.stopPropagation());
|
|
279
311
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
312
|
+
function U(o) {
|
|
313
|
+
o.deltaMode == 0 && (B(o.deltaY > 0), o.preventDefault(), o.stopPropagation());
|
|
314
|
+
}
|
|
315
|
+
let E = 0, I = 0, A = 0, G = 0;
|
|
316
|
+
const Y = Ze({
|
|
317
|
+
onDown(o) {
|
|
318
|
+
return !d.value || !m.value ? false : (E = o.offsetX, I = o.x - o.offsetX - m.value.offsetLeft, o.preventDefault(), H.value = true, true);
|
|
284
319
|
},
|
|
285
|
-
onMove(
|
|
286
|
-
|
|
320
|
+
onMove(o, l, T) {
|
|
321
|
+
t.value && d.value && (W(T.x - E - I), T.preventDefault(), T.stopPropagation());
|
|
287
322
|
},
|
|
288
323
|
onUp() {
|
|
289
|
-
|
|
324
|
+
H.value = false;
|
|
290
325
|
}
|
|
291
326
|
}), X = Ze({
|
|
292
|
-
onDown(
|
|
293
|
-
return !p.value || !x.value ? false : (A =
|
|
327
|
+
onDown(o) {
|
|
328
|
+
return !p.value || !x.value ? false : (A = o.offsetY, G = o.y - o.offsetY - x.value.offsetTop, o.preventDefault(), H.value = true, true);
|
|
294
329
|
},
|
|
295
|
-
onMove(
|
|
296
|
-
|
|
330
|
+
onMove(o, l, T) {
|
|
331
|
+
t.value && p.value && (de(T.y - A - G), T.preventDefault(), T.stopPropagation());
|
|
297
332
|
},
|
|
298
333
|
onUp() {
|
|
299
|
-
|
|
334
|
+
H.value = false;
|
|
300
335
|
}
|
|
301
336
|
});
|
|
302
|
-
function
|
|
303
|
-
|
|
337
|
+
function te(o) {
|
|
338
|
+
t.value && (t.value.scrollLeft = o / 100 * (t.value.scrollWidth - t.value.offsetWidth));
|
|
304
339
|
}
|
|
305
|
-
function
|
|
306
|
-
|
|
340
|
+
function re(o) {
|
|
341
|
+
t.value && (t.value.scrollLeft = o / 100 * (t.value.scrollHeight - t.value.offsetHeight));
|
|
307
342
|
}
|
|
308
|
-
function
|
|
309
|
-
|
|
343
|
+
function W(o) {
|
|
344
|
+
t.value && (t.value.scrollLeft = o / (t.value.offsetWidth - v.sizeRaw) * (t.value.scrollWidth - t.value.offsetWidth));
|
|
310
345
|
}
|
|
311
|
-
function
|
|
312
|
-
|
|
346
|
+
function de(o) {
|
|
347
|
+
t.value && (t.value.scrollTop = o / (t.value.offsetHeight - M.sizeRaw) * (t.value.scrollHeight - t.value.offsetHeight));
|
|
313
348
|
}
|
|
314
|
-
function
|
|
315
|
-
|
|
349
|
+
function Le(o) {
|
|
350
|
+
s.scrollBarBackgroundClickable && W(o.offsetX - v.sizeRaw / 2);
|
|
316
351
|
}
|
|
317
|
-
function
|
|
318
|
-
|
|
352
|
+
function Ce(o) {
|
|
353
|
+
s.scrollBarBackgroundClickable && de(o.offsetY - M.sizeRaw / 2);
|
|
319
354
|
}
|
|
320
355
|
const {
|
|
321
|
-
startResizeChecker:
|
|
322
|
-
stopResizeChecker:
|
|
323
|
-
} =
|
|
324
|
-
|
|
325
|
-
() =>
|
|
326
|
-
() =>
|
|
356
|
+
startResizeChecker: r,
|
|
357
|
+
stopResizeChecker: b
|
|
358
|
+
} = Wt(
|
|
359
|
+
t,
|
|
360
|
+
() => c(),
|
|
361
|
+
() => c()
|
|
327
362
|
);
|
|
328
363
|
return onMounted(() => {
|
|
329
364
|
nextTick(() => {
|
|
330
|
-
setTimeout(() =>
|
|
365
|
+
setTimeout(() => c(true), 200), c(true), r(), C = new MutationObserver(() => c()), C.observe(t.value, S);
|
|
331
366
|
});
|
|
332
367
|
}), onBeforeUnmount(() => {
|
|
333
|
-
|
|
334
|
-
}),
|
|
368
|
+
b(), C && (C.disconnect(), C = null);
|
|
369
|
+
}), n({
|
|
335
370
|
refreshScrollState() {
|
|
336
|
-
|
|
371
|
+
c(true);
|
|
337
372
|
},
|
|
338
373
|
getScrollContainer() {
|
|
339
|
-
return
|
|
374
|
+
return t.value;
|
|
340
375
|
},
|
|
341
|
-
scrollTo(
|
|
342
|
-
var
|
|
343
|
-
(
|
|
376
|
+
scrollTo(o, l) {
|
|
377
|
+
var T;
|
|
378
|
+
(T = t.value) == null || T.scrollTo(o, l);
|
|
344
379
|
},
|
|
345
380
|
scrollToTop() {
|
|
346
|
-
var
|
|
347
|
-
(
|
|
381
|
+
var o;
|
|
382
|
+
(o = t.value) == null || o.scrollTo(0, 0);
|
|
348
383
|
},
|
|
349
384
|
scrollToBottom() {
|
|
350
|
-
var
|
|
351
|
-
(
|
|
385
|
+
var o;
|
|
386
|
+
(o = t.value) == null || o.scrollTo(t.value.scrollWidth, t.value.scrollHeight);
|
|
352
387
|
}
|
|
353
|
-
}), (
|
|
388
|
+
}), (o, l) => (openBlock(), createElementBlock("div", {
|
|
354
389
|
ref_key: "scrollrect",
|
|
355
|
-
ref:
|
|
390
|
+
ref: w,
|
|
356
391
|
class: normalizeClass([
|
|
357
392
|
"vue-scroll-rect",
|
|
358
393
|
e.scrollBarAlwaysShow ? "always-show-scrollbar" : "",
|
|
359
394
|
e.scrollBarBackgroundClickable ? "background-clickable" : "",
|
|
360
|
-
|
|
395
|
+
H.value ? "dragging" : ""
|
|
361
396
|
]),
|
|
362
397
|
style: normalizeStyle({
|
|
363
398
|
width: e.width ? `${e.width}px` : void 0,
|
|
364
399
|
height: e.height ? `${e.height}px` : void 0
|
|
365
400
|
}),
|
|
366
|
-
onWheel:
|
|
401
|
+
onWheel: z
|
|
367
402
|
}, [
|
|
368
403
|
createElementVNode("div", {
|
|
369
404
|
ref_key: "container",
|
|
370
|
-
ref:
|
|
405
|
+
ref: t,
|
|
371
406
|
class: normalizeClass(["scroll-content", e.scroll, e.containerClass]),
|
|
372
407
|
style: normalizeStyle({
|
|
373
408
|
maxWidth: e.maxWidth ? `${e.maxWidth}px` : void 0,
|
|
374
409
|
maxHeight: e.maxHeight ? `${e.maxHeight}px` : void 0,
|
|
375
410
|
...e.containerStyle
|
|
376
411
|
}),
|
|
377
|
-
onScroll:
|
|
412
|
+
onScroll: k
|
|
378
413
|
}, [
|
|
379
|
-
renderSlot(
|
|
414
|
+
renderSlot(o.$slots, "default")
|
|
380
415
|
], 38),
|
|
381
|
-
|
|
416
|
+
v.show ? renderSlot(o.$slots, "scrollBarX", {
|
|
382
417
|
key: 0,
|
|
383
|
-
scrollBarValue:
|
|
384
|
-
onScroll:
|
|
418
|
+
scrollBarValue: v,
|
|
419
|
+
onScroll: te
|
|
385
420
|
}, () => [
|
|
386
421
|
createElementVNode("div", {
|
|
387
422
|
ref_key: "scrollBarRefX",
|
|
388
423
|
ref: d,
|
|
389
424
|
class: "scrollbar horizontal",
|
|
390
|
-
onClick:
|
|
391
|
-
onWheel:
|
|
425
|
+
onClick: Le,
|
|
426
|
+
onWheel: V
|
|
392
427
|
}, [
|
|
393
428
|
createElementVNode("div", {
|
|
394
429
|
class: "thumb",
|
|
395
430
|
ref_key: "scrollBarThumbRefX",
|
|
396
|
-
ref:
|
|
397
|
-
style: normalizeStyle({ left: `${
|
|
398
|
-
onMousedown:
|
|
399
|
-
(...
|
|
400
|
-
onWheel:
|
|
431
|
+
ref: m,
|
|
432
|
+
style: normalizeStyle({ left: `${v.pos}%`, width: `${v.size}%` }),
|
|
433
|
+
onMousedown: l[0] || (l[0] = //@ts-ignore
|
|
434
|
+
(...T) => unref(Y) && unref(Y)(...T)),
|
|
435
|
+
onWheel: V
|
|
401
436
|
}, null, 36)
|
|
402
437
|
], 544)
|
|
403
438
|
]) : createCommentVNode("", true),
|
|
404
|
-
|
|
439
|
+
M.show ? renderSlot(o.$slots, "scrollBarY", {
|
|
405
440
|
key: 1,
|
|
406
|
-
scrollBarValue:
|
|
407
|
-
onScroll:
|
|
441
|
+
scrollBarValue: M,
|
|
442
|
+
onScroll: re
|
|
408
443
|
}, () => [
|
|
409
|
-
|
|
444
|
+
M.show ? (openBlock(), createElementBlock("div", {
|
|
410
445
|
key: 0,
|
|
411
446
|
ref_key: "scrollBarRefY",
|
|
412
447
|
ref: p,
|
|
413
448
|
class: "scrollbar vertical",
|
|
414
|
-
onClick:
|
|
415
|
-
onWheel:
|
|
449
|
+
onClick: Ce,
|
|
450
|
+
onWheel: U
|
|
416
451
|
}, [
|
|
417
452
|
createElementVNode("div", {
|
|
418
453
|
class: "thumb",
|
|
419
454
|
ref_key: "scrollBarThumbRefY",
|
|
420
455
|
ref: x,
|
|
421
|
-
style: normalizeStyle({ top: `${
|
|
422
|
-
onMousedown:
|
|
423
|
-
(...
|
|
424
|
-
onWheel:
|
|
456
|
+
style: normalizeStyle({ top: `${M.pos}%`, height: `${M.size}%` }),
|
|
457
|
+
onMousedown: l[1] || (l[1] = //@ts-ignore
|
|
458
|
+
(...T) => unref(X) && unref(X)(...T)),
|
|
459
|
+
onWheel: U
|
|
425
460
|
}, null, 36)
|
|
426
461
|
], 544)) : createCommentVNode("", true)
|
|
427
462
|
]) : createCommentVNode("", true)
|
|
428
463
|
], 38));
|
|
429
464
|
}
|
|
430
|
-
}), we = (e,
|
|
431
|
-
const
|
|
432
|
-
for (const [
|
|
433
|
-
s
|
|
434
|
-
return
|
|
435
|
-
},
|
|
465
|
+
}), we = (e, n) => {
|
|
466
|
+
const u = e.__vccOpts || e;
|
|
467
|
+
for (const [s, f] of n)
|
|
468
|
+
u[s] = f;
|
|
469
|
+
return u;
|
|
470
|
+
}, Bt = {}, Tt = {
|
|
436
471
|
class: "mx-checked-mark",
|
|
437
472
|
"aria-hidden": "true",
|
|
438
473
|
viewBox: "0 0 1024 1024"
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
]
|
|
442
|
-
|
|
443
|
-
|
|
474
|
+
};
|
|
475
|
+
function Pt(e, n) {
|
|
476
|
+
return openBlock(), createElementBlock("svg", Tt, [...n[0] || (n[0] = [
|
|
477
|
+
createElementVNode("path", { d: "M129.3,428.6L52,512l345,372.5l575-620.8l-69.5-75L400.4,718.2L129.3,428.6z" }, null, -1)
|
|
478
|
+
])]);
|
|
444
479
|
}
|
|
445
|
-
const
|
|
480
|
+
const $t = /* @__PURE__ */ we(Bt, [["render", Pt]]), _t = {}, At = {
|
|
446
481
|
class: "mx-right-arrow",
|
|
447
482
|
"aria-hidden": "true",
|
|
448
483
|
viewBox: "0 0 1024 1024"
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
]
|
|
452
|
-
|
|
453
|
-
|
|
484
|
+
};
|
|
485
|
+
function Et(e, n) {
|
|
486
|
+
return openBlock(), createElementBlock("svg", At, [...n[0] || (n[0] = [
|
|
487
|
+
createElementVNode("path", { d: "M307.018 49.445c11.517 0 23.032 4.394 31.819 13.18L756.404 480.18c8.439 8.438 13.181 19.885 13.181 31.82s-4.741 23.38-13.181 31.82L338.838 961.376c-17.574 17.573-46.065 17.573-63.64-0.001-17.573-17.573-17.573-46.065 0.001-63.64L660.944 512 275.198 126.265c-17.574-17.573-17.574-46.066-0.001-63.64C283.985 53.839 295.501 49.445 307.018 49.445z" }, null, -1)
|
|
488
|
+
])]);
|
|
454
489
|
}
|
|
455
|
-
const
|
|
490
|
+
const Lt = /* @__PURE__ */ we(_t, [["render", Et]]), Ft = { class: "mx-item-row" }, zt = ["xlink:href"], Dt = {
|
|
456
491
|
key: 1,
|
|
457
492
|
class: "label"
|
|
458
|
-
},
|
|
493
|
+
}, jt = { class: "mx-item-row" }, Nt = { class: "mx-shortcut" }, Ae = /* @__PURE__ */ defineComponent({
|
|
459
494
|
__name: "ContextMenuItem",
|
|
460
495
|
props: {
|
|
461
496
|
/**
|
|
@@ -588,213 +623,213 @@ const Et = /* @__PURE__ */ we($t, [["render", Tt]]), zt = { class: "mx-item-row"
|
|
|
588
623
|
"subMenuOpen",
|
|
589
624
|
"subMenuClose"
|
|
590
625
|
],
|
|
591
|
-
setup(e, { expose:
|
|
592
|
-
const
|
|
593
|
-
clickHandler:
|
|
594
|
-
clickClose:
|
|
626
|
+
setup(e, { expose: n, emit: u }) {
|
|
627
|
+
const s = e, f = u, {
|
|
628
|
+
clickHandler: t,
|
|
629
|
+
clickClose: w,
|
|
595
630
|
clickableWhenHasChildren: d,
|
|
596
631
|
disabled: p,
|
|
597
|
-
hidden:
|
|
632
|
+
hidden: m,
|
|
598
633
|
label: x,
|
|
599
|
-
icon:
|
|
600
|
-
iconFontClass:
|
|
601
|
-
showRightArrow:
|
|
602
|
-
shortcut:
|
|
603
|
-
hasChildren:
|
|
604
|
-
} = toRefs(
|
|
605
|
-
provide("MenuItemName",
|
|
606
|
-
const
|
|
634
|
+
icon: H,
|
|
635
|
+
iconFontClass: F,
|
|
636
|
+
showRightArrow: P,
|
|
637
|
+
shortcut: v,
|
|
638
|
+
hasChildren: M
|
|
639
|
+
} = toRefs(s), R = ref(false), h = ref(false), i = ref(), y = inject("globalOptions"), C = inject("globalHasSlot"), S = inject("globalRenderSlot"), k = inject("globalCloseMenu"), c = inject("menuContext"), _ = computed(() => typeof x.value == "string" ? x.value : typeof x.value == "function" ? Mt(x.value.toString()) : "MenuItem[unknow]");
|
|
640
|
+
provide("MenuItemName", _);
|
|
641
|
+
const B = {
|
|
607
642
|
getSubMenuInstance: () => {
|
|
608
643
|
},
|
|
609
|
-
showSubMenu: () =>
|
|
644
|
+
showSubMenu: () => R.value ? (c.markActiveMenuItem(B, true), true) : M.value ? (V(), true) : false,
|
|
610
645
|
hideSubMenu: () => {
|
|
611
|
-
|
|
646
|
+
c.closeOtherSubMenu();
|
|
612
647
|
},
|
|
613
|
-
isDisabledOrHidden: () => p.value ||
|
|
614
|
-
getElement: () =>
|
|
615
|
-
focus: () =>
|
|
616
|
-
blur: () =>
|
|
617
|
-
click:
|
|
648
|
+
isDisabledOrHidden: () => p.value || m.value,
|
|
649
|
+
getElement: () => i.value,
|
|
650
|
+
focus: () => h.value = true,
|
|
651
|
+
blur: () => h.value = false,
|
|
652
|
+
click: z
|
|
618
653
|
};
|
|
619
|
-
provide("menuItemInstance",
|
|
620
|
-
|
|
621
|
-
let
|
|
622
|
-
const
|
|
623
|
-
if (
|
|
624
|
-
let
|
|
625
|
-
for (let Y = 0; Y <
|
|
626
|
-
const
|
|
627
|
-
if (
|
|
628
|
-
if (
|
|
629
|
-
|
|
654
|
+
provide("menuItemInstance", B), onMounted(() => {
|
|
655
|
+
c.isMenuItemDataCollectedFlag() ? nextTick(() => {
|
|
656
|
+
let I = 0;
|
|
657
|
+
const A = c.getElement();
|
|
658
|
+
if (A) {
|
|
659
|
+
let G = 0;
|
|
660
|
+
for (let Y = 0; Y < A.children.length; Y++) {
|
|
661
|
+
const X = A.children[Y];
|
|
662
|
+
if (X.getAttribute("data-type") === "ContextMenuItem") {
|
|
663
|
+
if (X === i.value) {
|
|
664
|
+
I = G;
|
|
630
665
|
break;
|
|
631
666
|
}
|
|
632
|
-
|
|
667
|
+
G++;
|
|
633
668
|
}
|
|
634
669
|
}
|
|
635
670
|
}
|
|
636
|
-
|
|
637
|
-
}) :
|
|
671
|
+
c.addChildMenuItem(B, I);
|
|
672
|
+
}) : c.addChildMenuItem(B);
|
|
638
673
|
}), onBeforeUnmount(() => {
|
|
639
|
-
|
|
674
|
+
c.removeChildMenuItem(B);
|
|
640
675
|
});
|
|
641
|
-
function
|
|
676
|
+
function z(I) {
|
|
642
677
|
if (!p.value) {
|
|
643
|
-
if (
|
|
644
|
-
const
|
|
645
|
-
if (
|
|
678
|
+
if (I) {
|
|
679
|
+
const A = I.target;
|
|
680
|
+
if (A.classList.contains("mx-context-no-clickable") || y.value.ignoreClickClassName && A.classList.contains(y.value.ignoreClickClassName))
|
|
646
681
|
return;
|
|
647
|
-
if (
|
|
648
|
-
|
|
682
|
+
if (y.value.clickCloseClassName && A.classList.contains(y.value.clickCloseClassName)) {
|
|
683
|
+
I.stopPropagation(), k(s.rawMenuItem);
|
|
649
684
|
return;
|
|
650
685
|
}
|
|
651
686
|
}
|
|
652
|
-
|
|
687
|
+
M.value ? d.value ? (typeof t.value == "function" && t.value(I), f("click", I)) : R.value || V() : (typeof t.value == "function" && t.value(I), f("click", I), w.value && k(s.rawMenuItem));
|
|
653
688
|
}
|
|
654
689
|
}
|
|
655
|
-
function V(
|
|
656
|
-
|
|
690
|
+
function V(I) {
|
|
691
|
+
h.value = false, c.checkCloseOtherSubMenuTimeOut() || c.closeOtherSubMenu(), p.value || (c.markActiveMenuItem(B), M.value && (I || c.markThisOpenedByKeyBoard(), c.addOpenedSubMenu(U), R.value = true, nextTick(() => f("subMenuOpen", B))));
|
|
657
692
|
}
|
|
658
693
|
function U() {
|
|
659
|
-
|
|
694
|
+
h.value = false, R.value = false, f("subMenuClose", B);
|
|
660
695
|
}
|
|
661
|
-
function
|
|
696
|
+
function E() {
|
|
662
697
|
return {
|
|
663
698
|
disabled: p.value,
|
|
664
699
|
label: x.value,
|
|
665
|
-
icon:
|
|
666
|
-
iconFontClass:
|
|
667
|
-
showRightArrow:
|
|
668
|
-
clickClose:
|
|
700
|
+
icon: H.value,
|
|
701
|
+
iconFontClass: F.value,
|
|
702
|
+
showRightArrow: P.value,
|
|
703
|
+
clickClose: w.value,
|
|
669
704
|
clickableWhenHasChildren: d.value,
|
|
670
|
-
shortcut:
|
|
671
|
-
theme:
|
|
672
|
-
isOpen:
|
|
673
|
-
hasChildren:
|
|
674
|
-
onClick:
|
|
705
|
+
shortcut: v.value,
|
|
706
|
+
theme: y.value.theme,
|
|
707
|
+
isOpen: R,
|
|
708
|
+
hasChildren: M,
|
|
709
|
+
onClick: z,
|
|
675
710
|
onMouseEnter: V,
|
|
676
|
-
closeMenu:
|
|
711
|
+
closeMenu: k
|
|
677
712
|
};
|
|
678
713
|
}
|
|
679
|
-
return
|
|
714
|
+
return n(B), (I, A) => unref(m) ? createCommentVNode("", true) : (openBlock(), createElementBlock("div", {
|
|
680
715
|
key: 0,
|
|
681
716
|
class: "mx-context-menu-item-wrapper",
|
|
682
717
|
ref_key: "menuItemRef",
|
|
683
|
-
ref:
|
|
718
|
+
ref: i,
|
|
684
719
|
"data-type": "ContextMenuItem"
|
|
685
720
|
}, [
|
|
686
|
-
unref(
|
|
721
|
+
unref(C)("itemRender") ? (openBlock(), createBlock(unref(J), {
|
|
687
722
|
key: 0,
|
|
688
|
-
vnode: () => unref(
|
|
689
|
-
}, null, 8, ["vnode"])) : e.customRender ? (openBlock(), createBlock(unref(
|
|
723
|
+
vnode: () => unref(S)("itemRender", E())
|
|
724
|
+
}, null, 8, ["vnode"])) : e.customRender ? (openBlock(), createBlock(unref(J), {
|
|
690
725
|
key: 1,
|
|
691
726
|
vnode: e.customRender,
|
|
692
|
-
data:
|
|
727
|
+
data: E()
|
|
693
728
|
}, null, 8, ["vnode", "data"])) : (openBlock(), createElementBlock("div", {
|
|
694
729
|
key: 2,
|
|
695
730
|
class: normalizeClass([
|
|
696
731
|
"mx-context-menu-item",
|
|
697
732
|
unref(p) ? "disabled" : "",
|
|
698
|
-
|
|
733
|
+
h.value ? "keyboard-focus" : "",
|
|
699
734
|
e.customClass ? " " + e.customClass : "",
|
|
700
|
-
|
|
735
|
+
R.value ? "open" : ""
|
|
701
736
|
]),
|
|
702
|
-
onClick:
|
|
737
|
+
onClick: z,
|
|
703
738
|
onMouseenter: V
|
|
704
739
|
}, [
|
|
705
|
-
renderSlot(
|
|
706
|
-
createElementVNode("div",
|
|
740
|
+
renderSlot(I.$slots, "default", {}, () => [
|
|
741
|
+
createElementVNode("div", Ft, [
|
|
707
742
|
createElementVNode("div", {
|
|
708
743
|
class: normalizeClass([
|
|
709
744
|
"mx-icon-placeholder",
|
|
710
745
|
e.preserveIconWidth ? "preserve-width" : ""
|
|
711
746
|
])
|
|
712
747
|
}, [
|
|
713
|
-
renderSlot(
|
|
714
|
-
unref(
|
|
748
|
+
renderSlot(I.$slots, "icon", {}, () => [
|
|
749
|
+
unref(C)("itemIconRender") ? (openBlock(), createBlock(unref(J), {
|
|
715
750
|
key: 0,
|
|
716
|
-
vnode: () => unref(
|
|
751
|
+
vnode: () => unref(S)("itemIconRender", E())
|
|
717
752
|
}, null, 8, ["vnode"])) : typeof e.svgIcon == "string" && e.svgIcon ? (openBlock(), createElementBlock("svg", mergeProps({
|
|
718
753
|
key: 1,
|
|
719
754
|
class: "icon svg"
|
|
720
755
|
}, e.svgProps), [
|
|
721
|
-
createElementVNode("use", { "xlink:href": e.svgIcon }, null, 8,
|
|
722
|
-
], 16)) : typeof unref(
|
|
756
|
+
createElementVNode("use", { "xlink:href": e.svgIcon }, null, 8, zt)
|
|
757
|
+
], 16)) : typeof unref(H) != "string" ? (openBlock(), createBlock(unref(J), {
|
|
723
758
|
key: 2,
|
|
724
|
-
vnode: unref(
|
|
725
|
-
data: unref(
|
|
726
|
-
}, null, 8, ["vnode", "data"])) : typeof unref(
|
|
759
|
+
vnode: unref(H),
|
|
760
|
+
data: unref(H)
|
|
761
|
+
}, null, 8, ["vnode", "data"])) : typeof unref(H) == "string" && unref(H) !== "" ? (openBlock(), createElementBlock("i", {
|
|
727
762
|
key: 3,
|
|
728
|
-
class: normalizeClass(unref(
|
|
763
|
+
class: normalizeClass(unref(H) + " icon " + unref(F) + " " + unref(y).iconFontClass)
|
|
729
764
|
}, null, 2)) : createCommentVNode("", true)
|
|
730
765
|
]),
|
|
731
|
-
e.checked ? renderSlot(
|
|
732
|
-
unref(
|
|
766
|
+
e.checked ? renderSlot(I.$slots, "check", { key: 0 }, () => [
|
|
767
|
+
unref(C)("itemCheckRender") ? (openBlock(), createBlock(unref(J), {
|
|
733
768
|
key: 0,
|
|
734
|
-
vnode: () => unref(
|
|
769
|
+
vnode: () => unref(S)("itemCheckRender", E())
|
|
735
770
|
}, null, 8, ["vnode"])) : createCommentVNode("", true),
|
|
736
|
-
createVNode(
|
|
771
|
+
createVNode($t)
|
|
737
772
|
]) : createCommentVNode("", true)
|
|
738
773
|
], 2),
|
|
739
|
-
renderSlot(
|
|
740
|
-
unref(
|
|
774
|
+
renderSlot(I.$slots, "label", {}, () => [
|
|
775
|
+
unref(C)("itemLabelRender") ? (openBlock(), createBlock(unref(J), {
|
|
741
776
|
key: 0,
|
|
742
|
-
vnode: () => unref(
|
|
743
|
-
}, null, 8, ["vnode"])) : typeof unref(x) == "string" ? (openBlock(), createElementBlock("span", Dt, toDisplayString(unref(x)), 1)) : (openBlock(), createBlock(unref(
|
|
777
|
+
vnode: () => unref(S)("itemLabelRender", E())
|
|
778
|
+
}, null, 8, ["vnode"])) : typeof unref(x) == "string" ? (openBlock(), createElementBlock("span", Dt, toDisplayString(unref(x)), 1)) : (openBlock(), createBlock(unref(J), {
|
|
744
779
|
key: 2,
|
|
745
780
|
vnode: unref(x),
|
|
746
781
|
data: unref(x)
|
|
747
782
|
}, null, 8, ["vnode", "data"]))
|
|
748
783
|
])
|
|
749
784
|
]),
|
|
750
|
-
createElementVNode("div",
|
|
751
|
-
unref(
|
|
752
|
-
unref(
|
|
785
|
+
createElementVNode("div", jt, [
|
|
786
|
+
unref(v) || I.$slots.shortcut ? renderSlot(I.$slots, "shortcut", { key: 0 }, () => [
|
|
787
|
+
unref(C)("itemShortcutRender") ? (openBlock(), createBlock(unref(J), {
|
|
753
788
|
key: 0,
|
|
754
|
-
vnode: () => unref(
|
|
789
|
+
vnode: () => unref(S)("itemShortcutRender", E())
|
|
755
790
|
}, null, 8, ["vnode"])) : createCommentVNode("", true),
|
|
756
|
-
createElementVNode("span",
|
|
791
|
+
createElementVNode("span", Nt, toDisplayString(unref(v)), 1)
|
|
757
792
|
]) : createCommentVNode("", true),
|
|
758
|
-
unref(
|
|
759
|
-
unref(
|
|
793
|
+
unref(P) ? renderSlot(I.$slots, "rightArrow", { key: 1 }, () => [
|
|
794
|
+
unref(C)("itemRightArrowRender") ? (openBlock(), createBlock(unref(J), {
|
|
760
795
|
key: 0,
|
|
761
|
-
vnode: () => unref(
|
|
796
|
+
vnode: () => unref(S)("itemRightArrowRender", E())
|
|
762
797
|
}, null, 8, ["vnode"])) : createCommentVNode("", true),
|
|
763
|
-
createVNode(
|
|
798
|
+
createVNode(Lt)
|
|
764
799
|
]) : createCommentVNode("", true)
|
|
765
800
|
])
|
|
766
801
|
])
|
|
767
802
|
], 34)),
|
|
768
|
-
renderSlot(
|
|
769
|
-
context:
|
|
770
|
-
show:
|
|
803
|
+
renderSlot(I.$slots, "submenu", {
|
|
804
|
+
context: B,
|
|
805
|
+
show: R.value
|
|
771
806
|
})
|
|
772
807
|
], 512));
|
|
773
808
|
}
|
|
774
|
-
}),
|
|
809
|
+
}), Kt = defineComponent({
|
|
775
810
|
name: "ContextMenuSperator",
|
|
776
811
|
components: {
|
|
777
|
-
VNodeRender:
|
|
812
|
+
VNodeRender: J
|
|
778
813
|
},
|
|
779
814
|
setup() {
|
|
780
|
-
const e = inject("globalHasSlot"),
|
|
815
|
+
const e = inject("globalHasSlot"), n = inject("globalRenderSlot");
|
|
781
816
|
return {
|
|
782
817
|
globalHasSlot: e,
|
|
783
|
-
globalRenderSlot:
|
|
818
|
+
globalRenderSlot: n
|
|
784
819
|
};
|
|
785
820
|
}
|
|
786
|
-
}),
|
|
821
|
+
}), Yt = {
|
|
787
822
|
key: 1,
|
|
788
823
|
class: "mx-context-menu-item-sperator mx-context-no-clickable"
|
|
789
824
|
};
|
|
790
|
-
function
|
|
791
|
-
const
|
|
792
|
-
return e.globalHasSlot("separatorRender") ? (openBlock(), createBlock(
|
|
825
|
+
function Vt(e, n, u, s, f, t) {
|
|
826
|
+
const w = resolveComponent("VNodeRender");
|
|
827
|
+
return e.globalHasSlot("separatorRender") ? (openBlock(), createBlock(w, {
|
|
793
828
|
key: 0,
|
|
794
829
|
vnode: () => e.globalRenderSlot("separatorRender", {})
|
|
795
|
-
}, null, 8, ["vnode"])) : (openBlock(), createElementBlock("div",
|
|
830
|
+
}, null, 8, ["vnode"])) : (openBlock(), createElementBlock("div", Yt));
|
|
796
831
|
}
|
|
797
|
-
const
|
|
832
|
+
const be = /* @__PURE__ */ we(Kt, [["render", Vt]]), Ee = /* @__PURE__ */ defineComponent({
|
|
798
833
|
__name: "ContextSubMenu",
|
|
799
834
|
props: {
|
|
800
835
|
/**
|
|
@@ -811,6 +846,13 @@ const ge = /* @__PURE__ */ we(Yt, [["render", Ut]]), Le = /* @__PURE__ */ define
|
|
|
811
846
|
type: Boolean,
|
|
812
847
|
default: false
|
|
813
848
|
},
|
|
849
|
+
/**
|
|
850
|
+
* Should the menu be destroyed when it is closed?
|
|
851
|
+
*/
|
|
852
|
+
destroyOnClose: {
|
|
853
|
+
type: Boolean,
|
|
854
|
+
default: true
|
|
855
|
+
},
|
|
814
856
|
/**
|
|
815
857
|
* Max height for this submenu
|
|
816
858
|
*/
|
|
@@ -853,218 +895,218 @@ const ge = /* @__PURE__ */ we(Yt, [["render", Ut]]), Le = /* @__PURE__ */ define
|
|
|
853
895
|
}
|
|
854
896
|
},
|
|
855
897
|
emits: ["closeAnimFinished"],
|
|
856
|
-
setup(e, { expose:
|
|
857
|
-
const
|
|
898
|
+
setup(e, { expose: n, emit: u }) {
|
|
899
|
+
const s = e, f = u, t = ref(false), w = inject("globalGetMenuHostId", ""), d = inject("menuContext"), p = inject("globalOptions");
|
|
858
900
|
inject("globalHasSlot"), inject("globalRenderSlot");
|
|
859
|
-
const
|
|
860
|
-
let
|
|
861
|
-
function
|
|
862
|
-
|
|
901
|
+
const m = ref("UnknowOrRoot"), x = inject("MenuItemName", m), { zIndex: H, getParentWidth: F, getParentHeight: P, getZoom: v } = d, { adjustPosition: M } = toRefs(s), R = ref(), h = ref(), i = ref(), y = [], C = inject("globalSetCurrentSubMenu"), S = [];
|
|
902
|
+
let k = null, c = 0;
|
|
903
|
+
function _() {
|
|
904
|
+
k && k.blur();
|
|
863
905
|
}
|
|
864
|
-
function
|
|
865
|
-
if (
|
|
866
|
-
for (let
|
|
867
|
-
if (!
|
|
868
|
-
|
|
906
|
+
function B(r, b) {
|
|
907
|
+
if (r) {
|
|
908
|
+
for (let o = b !== void 0 ? b : 0; o < S.length; o++)
|
|
909
|
+
if (!S[o].isDisabledOrHidden()) {
|
|
910
|
+
z(o);
|
|
869
911
|
break;
|
|
870
912
|
}
|
|
871
913
|
} else
|
|
872
|
-
for (let
|
|
873
|
-
if (!
|
|
874
|
-
|
|
914
|
+
for (let o = b !== void 0 ? b : S.length - 1; o >= 0; o--)
|
|
915
|
+
if (!S[o].isDisabledOrHidden()) {
|
|
916
|
+
z(o);
|
|
875
917
|
break;
|
|
876
918
|
}
|
|
877
919
|
}
|
|
878
|
-
function
|
|
879
|
-
if (
|
|
920
|
+
function z(r) {
|
|
921
|
+
if (k && _(), r !== void 0 && (k = S[Math.max(0, Math.min(r, S.length - 1))]), !k)
|
|
880
922
|
return;
|
|
881
|
-
|
|
882
|
-
const
|
|
883
|
-
|
|
923
|
+
k.focus();
|
|
924
|
+
const b = k.getElement();
|
|
925
|
+
b && b.scrollIntoView({
|
|
884
926
|
behavior: "auto",
|
|
885
927
|
block: "nearest",
|
|
886
928
|
inline: "nearest"
|
|
887
929
|
});
|
|
888
930
|
}
|
|
889
931
|
function V() {
|
|
890
|
-
|
|
932
|
+
C(U);
|
|
891
933
|
}
|
|
892
934
|
const U = {
|
|
893
|
-
el:
|
|
935
|
+
el: i,
|
|
894
936
|
name: x,
|
|
895
937
|
isTopLevel: () => d.getParentContext() === null,
|
|
896
938
|
closeSelfAndActiveParent: () => {
|
|
897
|
-
const
|
|
898
|
-
if (
|
|
899
|
-
|
|
900
|
-
const
|
|
901
|
-
if (
|
|
902
|
-
return
|
|
939
|
+
const r = A.getParentContext();
|
|
940
|
+
if (r) {
|
|
941
|
+
r.closeOtherSubMenu();
|
|
942
|
+
const b = r.getSubMenuInstanceContext();
|
|
943
|
+
if (b)
|
|
944
|
+
return b.focusCurrentItem(), true;
|
|
903
945
|
}
|
|
904
946
|
return false;
|
|
905
947
|
},
|
|
906
948
|
closeCurrentSubMenu: () => {
|
|
907
|
-
var
|
|
908
|
-
return (
|
|
949
|
+
var r;
|
|
950
|
+
return (r = A.getParentContext()) == null ? void 0 : r.closeOtherSubMenu();
|
|
909
951
|
},
|
|
910
|
-
moveCurrentItemFirst: () =>
|
|
911
|
-
moveCurrentItemLast: () =>
|
|
912
|
-
moveCurrentItemDown: () =>
|
|
913
|
-
moveCurrentItemUp: () =>
|
|
914
|
-
focusCurrentItem: () =>
|
|
915
|
-
openCurrentItemSubMenu: () =>
|
|
916
|
-
triggerCurrentItemClick: (
|
|
952
|
+
moveCurrentItemFirst: () => B(true),
|
|
953
|
+
moveCurrentItemLast: () => B(false),
|
|
954
|
+
moveCurrentItemDown: () => B(true, k ? S.indexOf(k) + 1 : 0),
|
|
955
|
+
moveCurrentItemUp: () => B(false, k ? S.indexOf(k) - 1 : 0),
|
|
956
|
+
focusCurrentItem: () => z(),
|
|
957
|
+
openCurrentItemSubMenu: () => k ? k == null ? void 0 : k.showSubMenu() : false,
|
|
958
|
+
triggerCurrentItemClick: (r) => k == null ? void 0 : k.click(r)
|
|
917
959
|
};
|
|
918
|
-
let
|
|
919
|
-
const
|
|
920
|
-
zIndex:
|
|
960
|
+
let E = false, I = false;
|
|
961
|
+
const A = {
|
|
962
|
+
zIndex: H + 1,
|
|
921
963
|
container: d.container,
|
|
922
964
|
adjustPadding: p.value.adjustPadding || ee.defaultAdjustPadding,
|
|
923
965
|
getParentWidth: () => {
|
|
924
|
-
var
|
|
925
|
-
return ((
|
|
966
|
+
var r;
|
|
967
|
+
return ((r = i.value) == null ? void 0 : r.offsetWidth) || 0;
|
|
926
968
|
},
|
|
927
969
|
getParentHeight: () => {
|
|
928
|
-
var
|
|
929
|
-
return ((
|
|
970
|
+
var r;
|
|
971
|
+
return ((r = i.value) == null ? void 0 : r.offsetHeight) || 0;
|
|
930
972
|
},
|
|
931
|
-
getPositon: () => [
|
|
973
|
+
getPositon: () => [W.value.x, W.value.y],
|
|
932
974
|
getZoom: () => p.value.zoom || ee.defaultZoom,
|
|
933
|
-
addOpenedSubMenu(
|
|
934
|
-
|
|
975
|
+
addOpenedSubMenu(r) {
|
|
976
|
+
y.push(r);
|
|
935
977
|
},
|
|
936
978
|
closeOtherSubMenu() {
|
|
937
|
-
|
|
979
|
+
y.forEach((r) => r()), y.splice(0, y.length), C(U);
|
|
938
980
|
},
|
|
939
981
|
checkCloseOtherSubMenuTimeOut() {
|
|
940
|
-
return
|
|
982
|
+
return c ? (clearTimeout(c), c = 0, true) : false;
|
|
941
983
|
},
|
|
942
984
|
closeOtherSubMenuWithTimeOut() {
|
|
943
|
-
|
|
944
|
-
|
|
985
|
+
c = setTimeout(() => {
|
|
986
|
+
c = 0, this.closeOtherSubMenu();
|
|
945
987
|
}, 200);
|
|
946
988
|
},
|
|
947
|
-
addChildMenuItem: (
|
|
948
|
-
|
|
989
|
+
addChildMenuItem: (r, b) => {
|
|
990
|
+
b === void 0 ? S.push(r) : S.splice(b, 0, r);
|
|
949
991
|
},
|
|
950
|
-
removeChildMenuItem: (
|
|
951
|
-
|
|
992
|
+
removeChildMenuItem: (r) => {
|
|
993
|
+
S.splice(S.indexOf(r), 1), r.getSubMenuInstance = () => {
|
|
952
994
|
};
|
|
953
995
|
},
|
|
954
|
-
markActiveMenuItem: (
|
|
955
|
-
|
|
996
|
+
markActiveMenuItem: (r, b = false) => {
|
|
997
|
+
_(), k = r, b && z();
|
|
956
998
|
},
|
|
957
999
|
markThisOpenedByKeyBoard: () => {
|
|
958
|
-
|
|
1000
|
+
E = true;
|
|
959
1001
|
},
|
|
960
|
-
isOpenedByKeyBoardFlag: () =>
|
|
961
|
-
isMenuItemDataCollectedFlag: () =>
|
|
962
|
-
getElement: () =>
|
|
1002
|
+
isOpenedByKeyBoardFlag: () => E ? (E = false, true) : false,
|
|
1003
|
+
isMenuItemDataCollectedFlag: () => I,
|
|
1004
|
+
getElement: () => i.value || null,
|
|
963
1005
|
getParentContext: () => d,
|
|
964
1006
|
getSubMenuInstanceContext: () => U
|
|
965
1007
|
};
|
|
966
|
-
provide("menuContext",
|
|
967
|
-
const
|
|
968
|
-
getChildItem: (
|
|
969
|
-
getMenuDimensions: () =>
|
|
970
|
-
width:
|
|
971
|
-
height:
|
|
1008
|
+
provide("menuContext", A);
|
|
1009
|
+
const G = {
|
|
1010
|
+
getChildItem: (r) => S[r],
|
|
1011
|
+
getMenuDimensions: () => h.value ? {
|
|
1012
|
+
width: h.value.offsetWidth,
|
|
1013
|
+
height: h.value.offsetHeight
|
|
972
1014
|
} : { width: 0, height: 0 },
|
|
973
|
-
getSubmenuRoot: () =>
|
|
974
|
-
getMenu: () =>
|
|
1015
|
+
getSubmenuRoot: () => h.value,
|
|
1016
|
+
getMenu: () => i.value,
|
|
975
1017
|
getScrollValue: () => {
|
|
976
|
-
var
|
|
977
|
-
return ((
|
|
1018
|
+
var r, b;
|
|
1019
|
+
return ((b = (r = R.value) == null ? void 0 : r.getScrollContainer()) == null ? void 0 : b.scrollTop) || 0;
|
|
978
1020
|
},
|
|
979
|
-
setScrollValue: (
|
|
980
|
-
var
|
|
981
|
-
return (
|
|
1021
|
+
setScrollValue: (r) => {
|
|
1022
|
+
var b;
|
|
1023
|
+
return (b = R.value) == null ? void 0 : b.scrollTo(0, r);
|
|
982
1024
|
},
|
|
983
|
-
getScrollHeight: () =>
|
|
1025
|
+
getScrollHeight: () => X.value,
|
|
984
1026
|
adjustPosition: () => {
|
|
985
1027
|
de();
|
|
986
1028
|
},
|
|
987
|
-
getMaxHeight: () =>
|
|
988
|
-
getPosition: () =>
|
|
989
|
-
setPosition: (
|
|
990
|
-
|
|
1029
|
+
getMaxHeight: () => te.value,
|
|
1030
|
+
getPosition: () => W.value,
|
|
1031
|
+
setPosition: (r, b) => {
|
|
1032
|
+
W.value.x = r, W.value.y = b;
|
|
991
1033
|
}
|
|
992
1034
|
}, Y = inject("menuItemInstance", void 0);
|
|
993
|
-
Y && (Y.getSubMenuInstance = () =>
|
|
994
|
-
const
|
|
1035
|
+
Y && (Y.getSubMenuInstance = () => G);
|
|
1036
|
+
const X = ref(0), te = ref(0), re = ref(false), W = ref({ x: 0, y: 0 });
|
|
995
1037
|
function de() {
|
|
996
1038
|
nextTick(() => {
|
|
997
|
-
var
|
|
998
|
-
const
|
|
999
|
-
if (
|
|
1000
|
-
const { container:
|
|
1001
|
-
let We =
|
|
1002
|
-
if (
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1039
|
+
var o;
|
|
1040
|
+
const r = i.value, b = h.value;
|
|
1041
|
+
if (r && b && R.value) {
|
|
1042
|
+
const { container: l } = d, T = (F == null ? void 0 : F()) ?? 0, Q = (P == null ? void 0 : P()) ?? 0, Z = getComputedStyle(b), ne = parseFloat(Z.paddingLeft), xe = parseFloat(Z.paddingTop), Ie = Q > 0 ? xe : 0, at = document.documentElement.scrollHeight / v(), rt = document.documentElement.scrollWidth / v(), it = Math.min(rt, l.offsetWidth), Fe = Math.min(at, l.offsetHeight);
|
|
1043
|
+
let We = ae(r, l), Oe = ue(r, l);
|
|
1044
|
+
if (s.direction.includes("l") ? W.value.x -= r.offsetWidth + ne : s.direction.includes("r") ? W.value.x += T + ne : (W.value.x += T / 2, W.value.x -= (r.offsetWidth + ne) / 2), s.direction.includes("t")) {
|
|
1045
|
+
const he = (o = s.parentMenuItemContext) == null ? void 0 : o.getElement();
|
|
1046
|
+
he && (W.value.y += he.offsetHeight), W.value.y -= (r.offsetHeight + xe) / v();
|
|
1005
1047
|
} else
|
|
1006
|
-
|
|
1048
|
+
s.direction.includes("b") ? W.value.y -= xe / v() : W.value.y -= r.offsetHeight / 2 / v();
|
|
1007
1049
|
nextTick(() => {
|
|
1008
|
-
var
|
|
1009
|
-
We =
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1012
|
-
const dt = We +
|
|
1013
|
-
if (
|
|
1014
|
-
const ve =
|
|
1015
|
-
ve >
|
|
1050
|
+
var De, je;
|
|
1051
|
+
We = ae(r, l), Oe = ue(r, l);
|
|
1052
|
+
const he = ((je = (De = R.value) == null ? void 0 : De.getScrollContainer()) == null ? void 0 : je.scrollHeight) || 0, ct = s.maxHeight;
|
|
1053
|
+
X.value = s.maxHeight ? Math.min(he, s.maxHeight) : he;
|
|
1054
|
+
const dt = We + r.offsetWidth - it, ze = Oe + X.value + Ie * 2 - Fe;
|
|
1055
|
+
if (re.value = ze > 0, M.value && dt > 0) {
|
|
1056
|
+
const ve = T + r.offsetWidth - ne, me = We;
|
|
1057
|
+
ve > me ? W.value.x -= me : W.value.x -= ve;
|
|
1016
1058
|
}
|
|
1017
|
-
if (
|
|
1018
|
-
if (
|
|
1019
|
-
const ve = ze,
|
|
1020
|
-
ve >
|
|
1059
|
+
if (re.value) {
|
|
1060
|
+
if (M.value) {
|
|
1061
|
+
const ve = ze, me = Oe;
|
|
1062
|
+
ve > me ? W.value.y -= me - Ie : W.value.y -= ve - Ie;
|
|
1021
1063
|
}
|
|
1022
|
-
|
|
1064
|
+
te.value = Fe - (W.value.y + xe);
|
|
1023
1065
|
} else
|
|
1024
|
-
|
|
1066
|
+
te.value = ct || 0;
|
|
1025
1067
|
});
|
|
1026
1068
|
}
|
|
1027
1069
|
});
|
|
1028
1070
|
}
|
|
1029
1071
|
function Ce() {
|
|
1030
|
-
var
|
|
1031
|
-
const
|
|
1032
|
-
if (
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1072
|
+
var b;
|
|
1073
|
+
const r = (b = s.parentMenuItemContext) == null ? void 0 : b.getElement();
|
|
1074
|
+
if (r) {
|
|
1075
|
+
const o = ae(r, d.container), l = ue(r, d.container);
|
|
1076
|
+
W.value.x = o, W.value.y = l;
|
|
1035
1077
|
} else {
|
|
1036
|
-
const [
|
|
1037
|
-
|
|
1078
|
+
const [o, l] = d.getPositon();
|
|
1079
|
+
W.value.x = o, W.value.y = l;
|
|
1038
1080
|
}
|
|
1039
1081
|
nextTick(() => {
|
|
1040
|
-
var
|
|
1041
|
-
|
|
1082
|
+
var o;
|
|
1083
|
+
C(U), (o = i.value) == null || o.focus({ preventScroll: true }), d.isOpenedByKeyBoardFlag() && nextTick(() => B(true)), I = true;
|
|
1042
1084
|
}), de();
|
|
1043
1085
|
}
|
|
1044
|
-
return watch(() =>
|
|
1045
|
-
|
|
1086
|
+
return watch(() => s.show, (r) => {
|
|
1087
|
+
r ? Ce() : void 0;
|
|
1046
1088
|
}), onMounted(() => {
|
|
1047
|
-
|
|
1089
|
+
t.value = true, s.show ? Ce() : de();
|
|
1048
1090
|
}), onBeforeUnmount(() => {
|
|
1049
|
-
|
|
1091
|
+
t.value = false, Y && (Y.getSubMenuInstance = () => {
|
|
1050
1092
|
});
|
|
1051
|
-
}),
|
|
1052
|
-
const
|
|
1053
|
-
return
|
|
1093
|
+
}), n(G), (r, b) => {
|
|
1094
|
+
const o = resolveComponent("ContextSubMenu", true);
|
|
1095
|
+
return t.value ? (openBlock(), createBlock(Teleport, {
|
|
1054
1096
|
key: 0,
|
|
1055
|
-
to: `#${unref(
|
|
1097
|
+
to: `#${unref(w)}`
|
|
1056
1098
|
}, [
|
|
1057
1099
|
createVNode(Transition, mergeProps({ appear: "" }, unref(p).menuTransitionProps || {
|
|
1058
1100
|
duration: 10
|
|
1059
1101
|
}, {
|
|
1060
|
-
onAfterLeave:
|
|
1102
|
+
onAfterLeave: b[0] || (b[0] = (l) => f("closeAnimFinished"))
|
|
1061
1103
|
}), {
|
|
1062
1104
|
default: withCtx(() => [
|
|
1063
|
-
e.show ? (openBlock(), createElementBlock("div", mergeProps({
|
|
1105
|
+
!e.destroyOnClose || e.show ? withDirectives((openBlock(), createElementBlock("div", mergeProps({
|
|
1064
1106
|
key: 0,
|
|
1065
1107
|
ref_key: "submenuRoot",
|
|
1066
|
-
ref:
|
|
1067
|
-
},
|
|
1108
|
+
ref: h
|
|
1109
|
+
}, r.$attrs, {
|
|
1068
1110
|
class: [
|
|
1069
1111
|
"mx-context-menu",
|
|
1070
1112
|
unref(p).customClass ? unref(p).customClass : "",
|
|
@@ -1073,83 +1115,86 @@ const ge = /* @__PURE__ */ we(Yt, [["render", Ut]]), Le = /* @__PURE__ */ define
|
|
|
1073
1115
|
style: {
|
|
1074
1116
|
maxWidth: e.maxWidth ? unref(Ve)(e.maxWidth) : `${unref(ee).defaultMaxWidth}px`,
|
|
1075
1117
|
minWidth: e.minWidth ? unref(Ve)(e.minWidth) : `${unref(ee).defaultMinWidth}px`,
|
|
1076
|
-
zIndex: unref(
|
|
1077
|
-
left: `${
|
|
1078
|
-
top: `${
|
|
1118
|
+
zIndex: unref(H),
|
|
1119
|
+
left: `${W.value.x}px`,
|
|
1120
|
+
top: `${W.value.y}px`
|
|
1079
1121
|
},
|
|
1080
1122
|
"data-type": "ContextSubMenu",
|
|
1081
1123
|
onClick: V
|
|
1082
1124
|
}), [
|
|
1083
|
-
createVNode(unref(
|
|
1125
|
+
createVNode(unref(Rt), {
|
|
1084
1126
|
ref_key: "scrollRectRef",
|
|
1085
|
-
ref:
|
|
1127
|
+
ref: R,
|
|
1086
1128
|
scroll: "vertical",
|
|
1087
|
-
maxHeight:
|
|
1129
|
+
maxHeight: te.value,
|
|
1088
1130
|
containerClass: "mx-context-menu-scroll"
|
|
1089
1131
|
}, {
|
|
1090
1132
|
default: withCtx(() => [
|
|
1091
1133
|
createElementVNode("div", {
|
|
1092
1134
|
class: normalizeClass(["mx-context-menu-items"]),
|
|
1093
1135
|
ref_key: "menu",
|
|
1094
|
-
ref:
|
|
1136
|
+
ref: i
|
|
1095
1137
|
}, [
|
|
1096
|
-
renderSlot(
|
|
1097
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(e.items, (
|
|
1098
|
-
|
|
1099
|
-
|
|
1138
|
+
renderSlot(r.$slots, "default", {}, () => [
|
|
1139
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(e.items, (l, T) => (openBlock(), createElementBlock(Fragment, { key: T }, [
|
|
1140
|
+
l.hidden !== true && l.divided === "up" ? (openBlock(), createBlock(be, { key: 0 })) : createCommentVNode("", true),
|
|
1141
|
+
l.hidden !== true && l.divided === "self" ? (openBlock(), createBlock(be, { key: 1 })) : (openBlock(), createBlock(Ae, {
|
|
1100
1142
|
key: 2,
|
|
1101
|
-
clickHandler:
|
|
1102
|
-
disabled: typeof
|
|
1103
|
-
hidden: typeof
|
|
1104
|
-
icon:
|
|
1105
|
-
iconFontClass:
|
|
1106
|
-
svgIcon:
|
|
1107
|
-
svgProps:
|
|
1108
|
-
label:
|
|
1109
|
-
customRender:
|
|
1110
|
-
customClass:
|
|
1111
|
-
checked: typeof
|
|
1112
|
-
shortcut:
|
|
1113
|
-
clickClose:
|
|
1114
|
-
clickableWhenHasChildren:
|
|
1115
|
-
preserveIconWidth:
|
|
1116
|
-
showRightArrow:
|
|
1117
|
-
hasChildren:
|
|
1118
|
-
rawMenuItem:
|
|
1119
|
-
onSubMenuOpen: (
|
|
1120
|
-
var
|
|
1121
|
-
return (
|
|
1143
|
+
clickHandler: l.onClick ? (Q) => l.onClick(Q) : void 0,
|
|
1144
|
+
disabled: typeof l.disabled == "object" ? l.disabled.value : l.disabled,
|
|
1145
|
+
hidden: typeof l.hidden == "object" ? l.hidden.value : l.hidden,
|
|
1146
|
+
icon: l.icon,
|
|
1147
|
+
iconFontClass: l.iconFontClass,
|
|
1148
|
+
svgIcon: l.svgIcon,
|
|
1149
|
+
svgProps: l.svgProps,
|
|
1150
|
+
label: l.label,
|
|
1151
|
+
customRender: l.customRender,
|
|
1152
|
+
customClass: l.customClass,
|
|
1153
|
+
checked: typeof l.checked == "object" ? l.checked.value : l.checked,
|
|
1154
|
+
shortcut: l.shortcut,
|
|
1155
|
+
clickClose: l.clickClose,
|
|
1156
|
+
clickableWhenHasChildren: l.clickableWhenHasChildren,
|
|
1157
|
+
preserveIconWidth: l.preserveIconWidth !== void 0 ? l.preserveIconWidth : unref(p).preserveIconWidth,
|
|
1158
|
+
showRightArrow: l.children && l.children.length > 0,
|
|
1159
|
+
hasChildren: l.children && l.children.length > 0,
|
|
1160
|
+
rawMenuItem: l,
|
|
1161
|
+
onSubMenuOpen: (Q) => {
|
|
1162
|
+
var Z;
|
|
1163
|
+
return (Z = l.onSubMenuOpen) == null ? void 0 : Z.call(l, Q);
|
|
1122
1164
|
},
|
|
1123
|
-
onSubMenuClose: (
|
|
1124
|
-
var
|
|
1125
|
-
return (
|
|
1165
|
+
onSubMenuClose: (Q) => {
|
|
1166
|
+
var Z;
|
|
1167
|
+
return (Z = l.onSubMenuClose) == null ? void 0 : Z.call(l, Q);
|
|
1126
1168
|
}
|
|
1127
1169
|
}, createSlots({ _: 2 }, [
|
|
1128
|
-
|
|
1170
|
+
l.children && l.children.length > 0 ? {
|
|
1129
1171
|
name: "submenu",
|
|
1130
|
-
fn: withCtx(({ context:
|
|
1131
|
-
createVNode(
|
|
1132
|
-
show:
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1172
|
+
fn: withCtx(({ context: Q, show: Z }) => [
|
|
1173
|
+
createVNode(o, {
|
|
1174
|
+
show: Z,
|
|
1175
|
+
destroyOnClose: e.destroyOnClose,
|
|
1176
|
+
parentMenuItemContext: Q,
|
|
1177
|
+
items: l.children,
|
|
1178
|
+
maxWidth: l.maxWidth,
|
|
1179
|
+
minWidth: l.minWidth,
|
|
1180
|
+
maxHeight: l.maxHeight,
|
|
1181
|
+
adjustPosition: l.adjustSubMenuPosition !== void 0 ? l.adjustSubMenuPosition : unref(p).adjustPosition,
|
|
1182
|
+
direction: l.direction !== void 0 ? l.direction : unref(p).direction
|
|
1183
|
+
}, null, 8, ["show", "destroyOnClose", "parentMenuItemContext", "items", "maxWidth", "minWidth", "maxHeight", "adjustPosition", "direction"])
|
|
1141
1184
|
]),
|
|
1142
1185
|
key: "0"
|
|
1143
1186
|
} : void 0
|
|
1144
1187
|
]), 1032, ["clickHandler", "disabled", "hidden", "icon", "iconFontClass", "svgIcon", "svgProps", "label", "customRender", "customClass", "checked", "shortcut", "clickClose", "clickableWhenHasChildren", "preserveIconWidth", "showRightArrow", "hasChildren", "rawMenuItem", "onSubMenuOpen", "onSubMenuClose"])),
|
|
1145
|
-
|
|
1188
|
+
l.hidden !== true && (l.divided === "down" || l.divided === true) ? (openBlock(), createBlock(be, { key: 3 })) : createCommentVNode("", true)
|
|
1146
1189
|
], 64))), 128))
|
|
1147
1190
|
])
|
|
1148
1191
|
], 512)
|
|
1149
1192
|
]),
|
|
1150
1193
|
_: 3
|
|
1151
1194
|
}, 8, ["maxHeight"])
|
|
1152
|
-
], 16))
|
|
1195
|
+
], 16)), [
|
|
1196
|
+
[vShow, e.show]
|
|
1197
|
+
]) : createCommentVNode("", true)
|
|
1153
1198
|
]),
|
|
1154
1199
|
_: 3
|
|
1155
1200
|
}, 16)
|
|
@@ -1174,6 +1219,13 @@ const ut = /* @__PURE__ */ defineComponent({
|
|
|
1174
1219
|
type: null,
|
|
1175
1220
|
default: null
|
|
1176
1221
|
},
|
|
1222
|
+
/**
|
|
1223
|
+
* Should the menu be destroyed when it is closed?
|
|
1224
|
+
*/
|
|
1225
|
+
destroyOnClose: {
|
|
1226
|
+
type: Boolean,
|
|
1227
|
+
default: true
|
|
1228
|
+
},
|
|
1177
1229
|
/**
|
|
1178
1230
|
* Current container, For calculation only
|
|
1179
1231
|
*/
|
|
@@ -1190,102 +1242,103 @@ const ut = /* @__PURE__ */ defineComponent({
|
|
|
1190
1242
|
}
|
|
1191
1243
|
},
|
|
1192
1244
|
emits: ["close", "closeAnimFinished"],
|
|
1193
|
-
setup(e, { expose:
|
|
1194
|
-
const
|
|
1245
|
+
setup(e, { expose: n, emit: u }) {
|
|
1246
|
+
const s = e, f = u, t = useSlots(), w = ref(), {
|
|
1195
1247
|
options: d,
|
|
1196
1248
|
show: p,
|
|
1197
|
-
|
|
1198
|
-
|
|
1249
|
+
destroyOnClose: m,
|
|
1250
|
+
container: x
|
|
1251
|
+
} = toRefs(s);
|
|
1199
1252
|
onMounted(() => {
|
|
1200
|
-
p.value &&
|
|
1253
|
+
p.value && P();
|
|
1201
1254
|
}), onBeforeUnmount(() => {
|
|
1202
|
-
|
|
1203
|
-
}), watch(p, (
|
|
1204
|
-
|
|
1255
|
+
h$1();
|
|
1256
|
+
}), watch(p, (c) => {
|
|
1257
|
+
c ? P() : (Ye(H), h$1());
|
|
1205
1258
|
});
|
|
1206
|
-
const
|
|
1207
|
-
closeMenu:
|
|
1259
|
+
const H = {
|
|
1260
|
+
closeMenu: v,
|
|
1208
1261
|
isClosed: M,
|
|
1209
|
-
getMenuRef: () =>
|
|
1262
|
+
getMenuRef: () => w.value,
|
|
1210
1263
|
getMenuDimensions: () => {
|
|
1211
|
-
var
|
|
1212
|
-
return ((
|
|
1264
|
+
var c;
|
|
1265
|
+
return ((c = w.value) == null ? void 0 : c.getMenuDimensions()) ?? { width: 0, height: 0 };
|
|
1213
1266
|
}
|
|
1214
1267
|
};
|
|
1215
|
-
let
|
|
1216
|
-
function
|
|
1217
|
-
|
|
1268
|
+
let F = false;
|
|
1269
|
+
function P() {
|
|
1270
|
+
R(), bt(H);
|
|
1218
1271
|
}
|
|
1219
|
-
function
|
|
1220
|
-
|
|
1272
|
+
function v(c) {
|
|
1273
|
+
F = true, f("close", c), d.value.menuTransitionProps || f("closeAnimFinished"), Ye(H);
|
|
1221
1274
|
}
|
|
1222
1275
|
function M() {
|
|
1223
|
-
return
|
|
1276
|
+
return F;
|
|
1224
1277
|
}
|
|
1225
|
-
function
|
|
1278
|
+
function R() {
|
|
1226
1279
|
setTimeout(() => {
|
|
1227
|
-
document.addEventListener("click",
|
|
1280
|
+
document.addEventListener("click", S, true), document.addEventListener("contextmenu", S, true), document.addEventListener("scroll", C, true), !s.isFullScreenContainer && x.value && x.value.addEventListener("scroll", C, true), d.value.keyboardControl !== false && document.addEventListener("keydown", y, true);
|
|
1228
1281
|
}, 50);
|
|
1229
1282
|
}
|
|
1230
|
-
function
|
|
1231
|
-
document.removeEventListener("contextmenu",
|
|
1283
|
+
function h$1() {
|
|
1284
|
+
document.removeEventListener("contextmenu", S, true), document.removeEventListener("click", S, true), document.removeEventListener("scroll", C, true), !s.isFullScreenContainer && x.value && x.value.removeEventListener("scroll", C, true), d.value.keyboardControl !== false && document.removeEventListener("keydown", y, true);
|
|
1232
1285
|
}
|
|
1233
|
-
const
|
|
1234
|
-
provide("globalSetCurrentSubMenu", (
|
|
1235
|
-
function
|
|
1236
|
-
var
|
|
1237
|
-
let
|
|
1238
|
-
switch (
|
|
1286
|
+
const i = ref();
|
|
1287
|
+
provide("globalSetCurrentSubMenu", (c) => i.value = c), provide("globalGetMenuHostId", x.value.id);
|
|
1288
|
+
function y(c) {
|
|
1289
|
+
var B, z, V, U, E, I, A, G, Y, X, te, re, W;
|
|
1290
|
+
let _ = true;
|
|
1291
|
+
switch (c.key) {
|
|
1239
1292
|
case "Escape": {
|
|
1240
|
-
((
|
|
1293
|
+
((B = i.value) == null ? void 0 : B.isTopLevel()) === false ? (z = i.value) == null || z.closeCurrentSubMenu() : v();
|
|
1241
1294
|
break;
|
|
1242
1295
|
}
|
|
1243
1296
|
case "ArrowDown":
|
|
1244
|
-
(
|
|
1297
|
+
(V = i.value) == null || V.moveCurrentItemDown();
|
|
1245
1298
|
break;
|
|
1246
1299
|
case "ArrowUp":
|
|
1247
|
-
(
|
|
1300
|
+
(U = i.value) == null || U.moveCurrentItemUp();
|
|
1248
1301
|
break;
|
|
1249
1302
|
case "Home":
|
|
1250
|
-
(
|
|
1303
|
+
(E = i.value) == null || E.moveCurrentItemFirst();
|
|
1251
1304
|
break;
|
|
1252
1305
|
case "End":
|
|
1253
|
-
(
|
|
1306
|
+
(I = i.value) == null || I.moveCurrentItemLast();
|
|
1254
1307
|
break;
|
|
1255
1308
|
case "ArrowLeft": {
|
|
1256
|
-
(
|
|
1309
|
+
(A = i.value) != null && A.closeSelfAndActiveParent() || (Y = (G = d.value).onKeyFocusMoveLeft) == null || Y.call(G);
|
|
1257
1310
|
break;
|
|
1258
1311
|
}
|
|
1259
1312
|
case "ArrowRight":
|
|
1260
|
-
(
|
|
1313
|
+
(X = i.value) != null && X.openCurrentItemSubMenu() || (re = (te = d.value).onKeyFocusMoveRight) == null || re.call(te);
|
|
1261
1314
|
break;
|
|
1262
1315
|
case "Enter":
|
|
1263
|
-
(
|
|
1316
|
+
(W = i.value) == null || W.triggerCurrentItemClick(c);
|
|
1264
1317
|
break;
|
|
1265
1318
|
default:
|
|
1266
|
-
|
|
1319
|
+
_ = false;
|
|
1267
1320
|
break;
|
|
1268
1321
|
}
|
|
1269
|
-
|
|
1322
|
+
_ && i.value && (c.stopPropagation(), c.preventDefault());
|
|
1270
1323
|
}
|
|
1271
|
-
function C(
|
|
1272
|
-
d.value.closeWhenScroll !== false &&
|
|
1324
|
+
function C(c) {
|
|
1325
|
+
d.value.closeWhenScroll !== false && k(c.target, null);
|
|
1273
1326
|
}
|
|
1274
|
-
function
|
|
1275
|
-
|
|
1327
|
+
function S(c) {
|
|
1328
|
+
k(c.target, c);
|
|
1276
1329
|
}
|
|
1277
|
-
function
|
|
1278
|
-
var
|
|
1279
|
-
for (;
|
|
1280
|
-
if (
|
|
1330
|
+
function k(c, _) {
|
|
1331
|
+
var B, z;
|
|
1332
|
+
for (; c; ) {
|
|
1333
|
+
if (c.classList && c.classList.contains("mx-context-menu"))
|
|
1281
1334
|
return;
|
|
1282
|
-
|
|
1335
|
+
c = c.parentNode;
|
|
1283
1336
|
}
|
|
1284
|
-
|
|
1337
|
+
_ ? d.value.clickCloseOnOutside !== false ? (h$1(), v()) : (z = (B = d.value).onClickOnOutside) == null || z.call(B, _) : (h$1(), v());
|
|
1285
1338
|
}
|
|
1286
|
-
return provide("globalOptions", d), provide("globalCloseMenu",
|
|
1339
|
+
return provide("globalOptions", d), provide("globalCloseMenu", v), provide("globalIsFullScreenContainer", s.isFullScreenContainer), provide("globalHasSlot", (c) => t[c] !== void 0), provide("globalRenderSlot", (c, _) => renderSlot(t, c, { ..._ }, () => [h("span", "Render slot failed")], false)), provide("menuContext", {
|
|
1287
1340
|
zIndex: d.value.zIndex || ee.defaultZindex,
|
|
1288
|
-
container:
|
|
1341
|
+
container: x.value,
|
|
1289
1342
|
adjustPadding: { x: 0, y: 0 },
|
|
1290
1343
|
getZoom: () => d.value.zoom || ee.defaultZoom,
|
|
1291
1344
|
getParentWidth: () => 0,
|
|
@@ -1311,26 +1364,27 @@ const ut = /* @__PURE__ */ defineComponent({
|
|
|
1311
1364
|
},
|
|
1312
1365
|
isOpenedByKeyBoardFlag: () => false,
|
|
1313
1366
|
isMenuItemDataCollectedFlag: () => false
|
|
1314
|
-
}),
|
|
1367
|
+
}), n(H), (c, _) => (openBlock(), createBlock(Ee, {
|
|
1315
1368
|
ref_key: "submenuInstance",
|
|
1316
|
-
ref:
|
|
1369
|
+
ref: w,
|
|
1317
1370
|
show: unref(p),
|
|
1371
|
+
destroyOnClose: unref(m),
|
|
1318
1372
|
items: unref(d).items,
|
|
1319
1373
|
adjustPosition: unref(d).adjustPosition,
|
|
1320
1374
|
maxWidth: unref(d).maxWidth || unref(ee).defaultMaxWidth,
|
|
1321
1375
|
minWidth: unref(d).minWidth || unref(ee).defaultMinWidth,
|
|
1322
1376
|
maxHeight: unref(d).maxHeight,
|
|
1323
1377
|
direction: unref(d).direction || unref(ee).defaultDirection,
|
|
1324
|
-
onCloseAnimFinished:
|
|
1378
|
+
onCloseAnimFinished: _[0] || (_[0] = (B) => f("closeAnimFinished"))
|
|
1325
1379
|
}, {
|
|
1326
1380
|
default: withCtx(() => [
|
|
1327
|
-
renderSlot(
|
|
1381
|
+
renderSlot(c.$slots, "default")
|
|
1328
1382
|
]),
|
|
1329
1383
|
_: 3
|
|
1330
|
-
}, 8, ["show", "items", "adjustPosition", "maxWidth", "minWidth", "maxHeight", "direction"]));
|
|
1384
|
+
}, 8, ["show", "destroyOnClose", "items", "adjustPosition", "maxWidth", "minWidth", "maxHeight", "direction"]));
|
|
1331
1385
|
}
|
|
1332
1386
|
});
|
|
1333
|
-
const
|
|
1387
|
+
const Ut = /* @__PURE__ */ defineComponent({
|
|
1334
1388
|
__name: "ContextMenu",
|
|
1335
1389
|
props: {
|
|
1336
1390
|
/**
|
|
@@ -1346,48 +1400,56 @@ const Xt = /* @__PURE__ */ defineComponent({
|
|
|
1346
1400
|
show: {
|
|
1347
1401
|
type: Boolean,
|
|
1348
1402
|
default: false
|
|
1403
|
+
},
|
|
1404
|
+
/**
|
|
1405
|
+
* Should the menu be destroyed when it is closed?
|
|
1406
|
+
*/
|
|
1407
|
+
destroyOnClose: {
|
|
1408
|
+
type: Boolean,
|
|
1409
|
+
default: true
|
|
1349
1410
|
}
|
|
1350
1411
|
},
|
|
1351
1412
|
emits: ["update:show", "close"],
|
|
1352
|
-
setup(e, { expose:
|
|
1353
|
-
const
|
|
1354
|
-
function
|
|
1355
|
-
var M,
|
|
1356
|
-
|
|
1413
|
+
setup(e, { expose: n, emit: u }) {
|
|
1414
|
+
const s = u, f = e, { options: t, show: w, destroyOnClose: d } = toRefs(f), { isNew: p, container: m, eleId: x } = st(t.value), H = ref(null), F = useSlots();
|
|
1415
|
+
function P(v) {
|
|
1416
|
+
var M, R;
|
|
1417
|
+
s("update:show", false), s("close"), (R = (M = t.value).onClose) == null || R.call(M, v);
|
|
1357
1418
|
}
|
|
1358
|
-
return
|
|
1359
|
-
closeMenu: () =>
|
|
1360
|
-
isClosed: () => !
|
|
1419
|
+
return n({
|
|
1420
|
+
closeMenu: () => s("update:show", false),
|
|
1421
|
+
isClosed: () => !w.value,
|
|
1361
1422
|
getMenuRef: () => {
|
|
1362
|
-
var
|
|
1363
|
-
return (
|
|
1423
|
+
var v;
|
|
1424
|
+
return (v = H.value) == null ? void 0 : v.getMenuRef();
|
|
1364
1425
|
},
|
|
1365
1426
|
getMenuDimensions: () => {
|
|
1366
|
-
var
|
|
1367
|
-
return ((
|
|
1427
|
+
var v;
|
|
1428
|
+
return ((v = H.value) == null ? void 0 : v.getMenuDimensions()) ?? { width: 0, height: 0 };
|
|
1368
1429
|
}
|
|
1369
|
-
}), (
|
|
1370
|
-
to: `#${unref(
|
|
1430
|
+
}), (v, M) => (openBlock(), createBlock(Teleport, {
|
|
1431
|
+
to: `#${unref(x)}`
|
|
1371
1432
|
}, [
|
|
1372
1433
|
createVNode(ut, {
|
|
1373
1434
|
ref_key: "menuRef",
|
|
1374
|
-
ref:
|
|
1375
|
-
options: unref(
|
|
1376
|
-
show: unref(
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1435
|
+
ref: H,
|
|
1436
|
+
options: unref(t),
|
|
1437
|
+
show: unref(w),
|
|
1438
|
+
destroyOnClose: unref(d),
|
|
1439
|
+
container: unref(m),
|
|
1440
|
+
isFullScreenContainer: !unref(p),
|
|
1441
|
+
onClose: P
|
|
1380
1442
|
}, createSlots({ _: 2 }, [
|
|
1381
|
-
renderList(unref(
|
|
1382
|
-
name:
|
|
1383
|
-
fn: withCtx((
|
|
1384
|
-
renderSlot(
|
|
1443
|
+
renderList(unref(F), (R, h) => ({
|
|
1444
|
+
name: h,
|
|
1445
|
+
fn: withCtx((i) => [
|
|
1446
|
+
renderSlot(v.$slots, h, normalizeProps(guardReactiveProps(i)))
|
|
1385
1447
|
])
|
|
1386
1448
|
}))
|
|
1387
|
-
]), 1032, ["options", "show", "container", "isFullScreenContainer"])
|
|
1449
|
+
]), 1032, ["options", "show", "destroyOnClose", "container", "isFullScreenContainer"])
|
|
1388
1450
|
], 8, ["to"]));
|
|
1389
1451
|
}
|
|
1390
|
-
}),
|
|
1452
|
+
}), Xt = defineComponent({
|
|
1391
1453
|
name: "ContextMenuGroup",
|
|
1392
1454
|
props: {
|
|
1393
1455
|
/**
|
|
@@ -1524,65 +1586,65 @@ const Xt = /* @__PURE__ */ defineComponent({
|
|
|
1524
1586
|
default: 0
|
|
1525
1587
|
}
|
|
1526
1588
|
},
|
|
1527
|
-
setup(e,
|
|
1528
|
-
const
|
|
1529
|
-
return
|
|
1589
|
+
setup(e, n) {
|
|
1590
|
+
const u = inject("globalOptions"), { adjustSubMenuPosition: s, maxWidth: f, minWidth: t, maxHeight: w } = toRefs(e), d = typeof s.value < "u" ? s.value : u.value.adjustPosition, p = ref(), m = ref();
|
|
1591
|
+
return n.expose({
|
|
1530
1592
|
getSubMenuRef: () => p.value,
|
|
1531
|
-
getMenuItemRef: () =>
|
|
1532
|
-
}), () => h(
|
|
1593
|
+
getMenuItemRef: () => m.value
|
|
1594
|
+
}), () => h(Ae, {
|
|
1533
1595
|
...e,
|
|
1534
|
-
ref:
|
|
1596
|
+
ref: m,
|
|
1535
1597
|
showRightArrow: true,
|
|
1536
1598
|
maxWidth: void 0,
|
|
1537
1599
|
minWidth: void 0,
|
|
1538
1600
|
maxHeight: void 0,
|
|
1539
1601
|
adjustSubMenuPosition: void 0,
|
|
1540
|
-
hasChildren: typeof
|
|
1541
|
-
},
|
|
1602
|
+
hasChildren: typeof n.slots.default !== void 0
|
|
1603
|
+
}, n.slots.default ? {
|
|
1542
1604
|
//Create SubMenu
|
|
1543
|
-
submenu: (x) => h(
|
|
1605
|
+
submenu: (x) => h(Ee, {
|
|
1544
1606
|
ref: p,
|
|
1545
1607
|
show: x.show,
|
|
1546
|
-
maxWidth:
|
|
1547
|
-
minWidth:
|
|
1548
|
-
maxHeight:
|
|
1608
|
+
maxWidth: f.value,
|
|
1609
|
+
minWidth: t.value,
|
|
1610
|
+
maxHeight: w.value,
|
|
1549
1611
|
adjustPosition: d,
|
|
1550
1612
|
parentMenuItemContext: x.context
|
|
1551
1613
|
}, {
|
|
1552
|
-
default:
|
|
1614
|
+
default: n.slots.default
|
|
1553
1615
|
}),
|
|
1554
1616
|
//Add other slots
|
|
1555
|
-
...
|
|
1556
|
-
} :
|
|
1617
|
+
...St(n.slots, "default")
|
|
1618
|
+
} : n.slots);
|
|
1557
1619
|
}
|
|
1558
1620
|
});
|
|
1559
|
-
function
|
|
1560
|
-
const
|
|
1621
|
+
function Zt(e, n, u, s) {
|
|
1622
|
+
const f = ref(true), t = h(ut, {
|
|
1561
1623
|
options: e,
|
|
1562
|
-
show:
|
|
1563
|
-
container:
|
|
1564
|
-
isFullScreenContainer: !
|
|
1624
|
+
show: f,
|
|
1625
|
+
container: n,
|
|
1626
|
+
isFullScreenContainer: !u,
|
|
1565
1627
|
onCloseAnimFinished: () => {
|
|
1566
|
-
render(null,
|
|
1628
|
+
render(null, n);
|
|
1567
1629
|
},
|
|
1568
|
-
onClose: (
|
|
1630
|
+
onClose: (w) => {
|
|
1569
1631
|
var d;
|
|
1570
|
-
(d = e.onClose) == null || d.call(e,
|
|
1632
|
+
(d = e.onClose) == null || d.call(e, w), f.value = false;
|
|
1571
1633
|
}
|
|
1572
|
-
},
|
|
1573
|
-
return render(
|
|
1634
|
+
}, s);
|
|
1635
|
+
return render(t, n), t.component;
|
|
1574
1636
|
}
|
|
1575
|
-
function
|
|
1576
|
-
const
|
|
1577
|
-
return
|
|
1637
|
+
function qe(e, n) {
|
|
1638
|
+
const u = st(e);
|
|
1639
|
+
return Zt(e, u.container, u.isNew, n).exposed;
|
|
1578
1640
|
}
|
|
1579
|
-
const
|
|
1641
|
+
const Je = {
|
|
1580
1642
|
/**
|
|
1581
1643
|
* For Vue install
|
|
1582
1644
|
* @param app
|
|
1583
1645
|
*/
|
|
1584
1646
|
install(e) {
|
|
1585
|
-
e.config.globalProperties.$contextmenu =
|
|
1647
|
+
e.config.globalProperties.$contextmenu = qe, e.component("ContextMenu", Ut), e.component("ContextMenuItem", Ae), e.component("ContextMenuGroup", Xt), e.component("ContextMenuSperator", be), e.component("ContextMenuSeparator", be), e.component("ContextSubMenu", Ee);
|
|
1586
1648
|
},
|
|
1587
1649
|
/**
|
|
1588
1650
|
* Show a ContextMenu in page, same as `this.$contextmenu`
|
|
@@ -1642,37 +1704,37 @@ const qe = {
|
|
|
1642
1704
|
* @param customSlots You can provide some custom slots to customize the rendering style of the menu. These slots are the same as the slots of component ContextMenu.
|
|
1643
1705
|
* @returns Menu instance
|
|
1644
1706
|
*/
|
|
1645
|
-
showContextMenu(e,
|
|
1646
|
-
return
|
|
1707
|
+
showContextMenu(e, n) {
|
|
1708
|
+
return qe(e, n);
|
|
1647
1709
|
},
|
|
1648
1710
|
/**
|
|
1649
1711
|
* Get if there is a menu open now.
|
|
1650
1712
|
*/
|
|
1651
1713
|
isAnyContextMenuOpen() {
|
|
1652
|
-
return
|
|
1714
|
+
return gt();
|
|
1653
1715
|
},
|
|
1654
1716
|
/**
|
|
1655
1717
|
* Close the currently open menu
|
|
1656
1718
|
*/
|
|
1657
1719
|
closeContextMenu: lt,
|
|
1658
1720
|
//Tools
|
|
1659
|
-
transformMenuPosition:
|
|
1660
|
-
},
|
|
1721
|
+
transformMenuPosition: yt
|
|
1722
|
+
}, Gt = {}, Qt = {
|
|
1661
1723
|
class: "mx-menu-bar-icon-menu",
|
|
1662
1724
|
viewBox: "0 0 1024 1024",
|
|
1663
1725
|
version: "1.1",
|
|
1664
1726
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1665
1727
|
width: "200",
|
|
1666
1728
|
height: "200"
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1729
|
+
};
|
|
1730
|
+
function qt(e, n) {
|
|
1731
|
+
return openBlock(), createElementBlock("svg", Qt, [...n[0] || (n[0] = [
|
|
1732
|
+
createElementVNode("path", { d: "M133.310936 296.552327l757.206115 0c19.781623 0 35.950949-16.169326 35.950949-35.950949 0-19.781623-15.997312-35.950949-35.950949-35.950949L133.310936 224.650428c-19.781623 0-35.950949 16.169326-35.950949 35.950949C97.359987 280.383 113.529313 296.552327 133.310936 296.552327z" }, null, -1),
|
|
1733
|
+
createElementVNode("path", { d: "M890.51705 476.135058 133.310936 476.135058c-19.781623 0-35.950949 16.169326-35.950949 35.950949 0 19.781623 16.169326 35.950949 35.950949 35.950949l757.206115 0c19.781623 0 35.950949-16.169326 35.950949-35.950949C926.467999 492.304384 910.298673 476.135058 890.51705 476.135058z" }, null, -1),
|
|
1734
|
+
createElementVNode("path", { d: "M890.51705 727.447673 133.310936 727.447673c-19.781623 0-35.950949 15.997312-35.950949 35.950949s16.169326 35.950949 35.950949 35.950949l757.206115 0c19.781623 0 35.950949-15.997312 35.950949-35.950949S910.298673 727.447673 890.51705 727.447673z" }, null, -1)
|
|
1735
|
+
])]);
|
|
1674
1736
|
}
|
|
1675
|
-
const
|
|
1737
|
+
const Jt = /* @__PURE__ */ we(Gt, [["render", qt]]), en = ["onClick", "onMouseenter"], nn = /* @__PURE__ */ defineComponent({
|
|
1676
1738
|
__name: "MenuBar",
|
|
1677
1739
|
props: {
|
|
1678
1740
|
/**
|
|
@@ -1684,114 +1746,114 @@ const ln = /* @__PURE__ */ we(Jt, [["render", on]]), sn = ["onClick", "onMouseen
|
|
|
1684
1746
|
}
|
|
1685
1747
|
},
|
|
1686
1748
|
setup(e) {
|
|
1687
|
-
const
|
|
1688
|
-
function
|
|
1689
|
-
|
|
1749
|
+
const n = e, u = ref(), s = ref(false), f = ref([]), t = ref(null);
|
|
1750
|
+
function w() {
|
|
1751
|
+
s.value = true;
|
|
1690
1752
|
}
|
|
1691
1753
|
function d() {
|
|
1692
|
-
|
|
1754
|
+
s.value = false;
|
|
1693
1755
|
}
|
|
1694
1756
|
onMounted(() => {
|
|
1695
|
-
|
|
1696
|
-
}), watch(() =>
|
|
1697
|
-
|
|
1757
|
+
f.value = n.options.items || [];
|
|
1758
|
+
}), watch(() => n.options, () => {
|
|
1759
|
+
f.value = n.options.items || [];
|
|
1698
1760
|
});
|
|
1699
|
-
let p = null,
|
|
1761
|
+
let p = null, m = -1;
|
|
1700
1762
|
function x() {
|
|
1701
|
-
|
|
1763
|
+
m < f.value.length - 1 ? m++ : m = 0, P(m, f.value[m]);
|
|
1702
1764
|
}
|
|
1703
|
-
function
|
|
1704
|
-
|
|
1765
|
+
function H() {
|
|
1766
|
+
m > 0 ? m-- : m = f.value.length - 1, P(m, f.value[m]);
|
|
1705
1767
|
}
|
|
1706
|
-
function
|
|
1707
|
-
const
|
|
1708
|
-
let
|
|
1709
|
-
return
|
|
1768
|
+
function F(h) {
|
|
1769
|
+
const i = n.options.barPopDirection ?? "bl";
|
|
1770
|
+
let y = 0, C = 0;
|
|
1771
|
+
return i.startsWith("b") ? C = ue(h) + h.offsetHeight : i.startsWith("t") ? C = ue(h) : C = ue(h) + h.offsetHeight / 2, i.endsWith("l") ? y = ae(h) : i.startsWith("r") ? y = ae(h) + h.offsetWidth : y = ae(h) + h.offsetWidth / 2, { x: y, y: C + 5 };
|
|
1710
1772
|
}
|
|
1711
|
-
function
|
|
1712
|
-
var
|
|
1713
|
-
if (
|
|
1773
|
+
function P(h, i) {
|
|
1774
|
+
var C;
|
|
1775
|
+
if (m = h, !i.children)
|
|
1714
1776
|
return;
|
|
1715
|
-
p && (p.closeMenu(), p = null,
|
|
1716
|
-
const
|
|
1717
|
-
if (
|
|
1718
|
-
const { x:
|
|
1719
|
-
p =
|
|
1720
|
-
...
|
|
1721
|
-
items:
|
|
1722
|
-
x:
|
|
1723
|
-
y:
|
|
1777
|
+
p && (p.closeMenu(), p = null, s.value = true), t.value = i;
|
|
1778
|
+
const y = (C = u.value) == null ? void 0 : C.children[h];
|
|
1779
|
+
if (y) {
|
|
1780
|
+
const { x: S, y: k } = F(y);
|
|
1781
|
+
p = Je.showContextMenu({
|
|
1782
|
+
...n.options,
|
|
1783
|
+
items: i.children,
|
|
1784
|
+
x: S,
|
|
1785
|
+
y: k,
|
|
1724
1786
|
onKeyFocusMoveLeft() {
|
|
1725
|
-
|
|
1787
|
+
H();
|
|
1726
1788
|
},
|
|
1727
1789
|
onKeyFocusMoveRight() {
|
|
1728
1790
|
x();
|
|
1729
1791
|
},
|
|
1730
1792
|
onClose() {
|
|
1731
|
-
|
|
1793
|
+
t.value == i && (s.value = false, t.value = null), typeof i.onSubMenuClose == "function" && i.onSubMenuClose(void 0);
|
|
1732
1794
|
}
|
|
1733
|
-
}), p && typeof
|
|
1795
|
+
}), p && typeof i.onSubMenuOpen == "function" && i.onSubMenuOpen(void 0);
|
|
1734
1796
|
}
|
|
1735
1797
|
}
|
|
1736
|
-
function
|
|
1737
|
-
|
|
1738
|
-
const
|
|
1739
|
-
if (
|
|
1740
|
-
const { x:
|
|
1741
|
-
p =
|
|
1742
|
-
...
|
|
1743
|
-
x:
|
|
1744
|
-
y
|
|
1798
|
+
function v() {
|
|
1799
|
+
m = 0;
|
|
1800
|
+
const h = u.value;
|
|
1801
|
+
if (h) {
|
|
1802
|
+
const { x: i, y } = F(h);
|
|
1803
|
+
p = Je.showContextMenu({
|
|
1804
|
+
...n.options,
|
|
1805
|
+
x: i,
|
|
1806
|
+
y
|
|
1745
1807
|
});
|
|
1746
1808
|
}
|
|
1747
1809
|
}
|
|
1748
|
-
function
|
|
1749
|
-
|
|
1810
|
+
function M(h, i) {
|
|
1811
|
+
i ? (s.value = true, P(h, i), i.onClick && (i.clickableWhenHasChildren === true && i.children && i.children.length > 0 || !i.children || i.children.length === 0) && i.onClick()) : v();
|
|
1750
1812
|
}
|
|
1751
|
-
function
|
|
1752
|
-
|
|
1813
|
+
function R(h, i) {
|
|
1814
|
+
s.value && P(h, i);
|
|
1753
1815
|
}
|
|
1754
|
-
return (
|
|
1816
|
+
return (h, i) => (openBlock(), createElementBlock("div", {
|
|
1755
1817
|
class: normalizeClass([
|
|
1756
1818
|
"mx-menu-bar",
|
|
1757
1819
|
e.options.theme ?? "",
|
|
1758
1820
|
e.options.mini ? "mini" : ""
|
|
1759
1821
|
]),
|
|
1760
|
-
onFocus:
|
|
1822
|
+
onFocus: w,
|
|
1761
1823
|
onBlur: d
|
|
1762
1824
|
}, [
|
|
1763
|
-
renderSlot(
|
|
1825
|
+
renderSlot(h.$slots, "prefix"),
|
|
1764
1826
|
e.options.mini ? (openBlock(), createElementBlock("div", {
|
|
1765
1827
|
key: 0,
|
|
1766
1828
|
ref_key: "menuBarContent",
|
|
1767
|
-
ref:
|
|
1829
|
+
ref: u,
|
|
1768
1830
|
class: "mx-menu-bar-content"
|
|
1769
1831
|
}, [
|
|
1770
1832
|
createElementVNode("div", {
|
|
1771
1833
|
class: "mx-menu-bar-item",
|
|
1772
|
-
onClick:
|
|
1834
|
+
onClick: i[0] || (i[0] = (y) => M(0, null))
|
|
1773
1835
|
}, [
|
|
1774
|
-
createVNode(
|
|
1836
|
+
createVNode(Jt)
|
|
1775
1837
|
])
|
|
1776
1838
|
], 512)) : (openBlock(), createElementBlock("div", {
|
|
1777
1839
|
key: 1,
|
|
1778
1840
|
ref_key: "menuBarContent",
|
|
1779
|
-
ref:
|
|
1841
|
+
ref: u,
|
|
1780
1842
|
class: "mx-menu-bar-content"
|
|
1781
1843
|
}, [
|
|
1782
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
1783
|
-
key:
|
|
1844
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(f.value, (y, C) => (openBlock(), createElementBlock("div", {
|
|
1845
|
+
key: C,
|
|
1784
1846
|
class: normalizeClass([
|
|
1785
1847
|
"mx-menu-bar-item",
|
|
1786
|
-
|
|
1848
|
+
y == t.value ? "active" : ""
|
|
1787
1849
|
]),
|
|
1788
|
-
onClick: (
|
|
1789
|
-
onMouseenter: (
|
|
1790
|
-
}, toDisplayString(
|
|
1850
|
+
onClick: (S) => M(C, y),
|
|
1851
|
+
onMouseenter: (S) => R(C, y)
|
|
1852
|
+
}, toDisplayString(y.label), 43, en))), 128))
|
|
1791
1853
|
], 512)),
|
|
1792
|
-
renderSlot(
|
|
1854
|
+
renderSlot(h.$slots, "suffix")
|
|
1793
1855
|
], 34));
|
|
1794
1856
|
}
|
|
1795
1857
|
});
|
|
1796
1858
|
|
|
1797
|
-
export {
|
|
1859
|
+
export { Ut as ContextMenu, Xt as ContextMenuGroup, Ae as ContextMenuItem, be as ContextMenuSeparator, nn as MenuBar };
|