@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.
@@ -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 le = null;
4
- function mt() {
5
- return le !== null;
3
+ let se = null;
4
+ function gt() {
5
+ return se !== null;
6
6
  }
7
- function pt(e) {
8
- le && lt(), le = e;
7
+ function bt(e) {
8
+ se && lt(), se = e;
9
9
  }
10
10
  function Ye(e) {
11
- e === le && (le = null);
11
+ e === se && (se = null);
12
12
  }
13
13
  function lt() {
14
- le && (le.closeMenu(), le = null);
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 se(e, o) {
28
- let s = e.offsetTop;
29
- return e.offsetParent != null && e.offsetParent != o && (s -= e.offsetParent.scrollTop, s += se(e.offsetParent, o)), s;
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 ue(e, o) {
32
- let s = e.offsetLeft;
33
- return e.offsetParent != null && e.offsetParent != o && (s -= e.offsetParent.scrollLeft, s += ue(e.offsetParent, o)), s;
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 gt(e, o, s, u) {
35
+ function yt(e, n, u, s) {
36
36
  return {
37
- x: ue(e, u) + o,
38
- y: se(e, u) + s
37
+ x: ae(e, s) + n,
38
+ y: ue(e, s) + u
39
39
  };
40
40
  }
41
- const He = "mx-menu-default-container", bt = "mx-menu-container-";
42
- let Ct = 0;
41
+ const He = "mx-menu-default-container", Ct = "mx-menu-container-";
42
+ let xt = 0;
43
43
  function st(e) {
44
- const { getContainer: o, zIndex: s } = e;
45
- if (o) {
46
- const v = typeof o == "function" ? o() : o;
47
- if (v) {
48
- let n = v.getAttribute("id");
49
- return n || (n = bt + Ct++, v.setAttribute("id", n)), {
50
- eleId: n,
51
- container: v,
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 u = document.getElementById(He);
57
- return u || (u = document.createElement("div"), u.setAttribute("id", He), u.setAttribute("class", "mx-menu-ghost-host fullscreen"), document.body.appendChild(u)), u.style.zIndex = (s == null ? void 0 : s.toString()) || ee.defaultZindex.toString(), {
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: u,
59
+ container: s,
60
60
  isNew: true
61
61
  };
62
62
  }
63
- function yt(e) {
64
- let o = 0;
65
- for (let s = 0; s < e.length; s++) {
66
- const u = e.charCodeAt(s);
67
- o = (o << 5) - o + u, o |= 0;
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 o;
69
+ return n;
70
70
  }
71
71
  function Ve(e) {
72
72
  return typeof e == "number" ? `${e}px` : e;
73
73
  }
74
- const q = defineComponent({
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: o, data: s } = toRefs(e);
93
- return () => typeof o.value == "function" ? o.value(s.value) : o.value;
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 xt(e, o) {
97
- const s = { ...e };
98
- return delete s[o], s;
96
+ function St(e, n) {
97
+ const u = { ...e };
98
+ return delete u[n], u;
99
99
  }
100
- var Mt = Object.defineProperty, kt = (e, o, s) => o in e ? Mt(e, o, { enumerable: true, configurable: true, writable: true, value: s }) : e[o] = s, Ue = (e, o, s) => kt(e, typeof o != "symbol" ? o + "" : o, s);
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(o, s) {
103
- Ue(this, "x", 0), Ue(this, "y", 0), this.x = o || 0, this.y = s || 0;
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(o, s) {
106
- this.x = o, this.y = s;
105
+ set(n, u) {
106
+ this.x = n, this.y = u;
107
107
  }
108
- substract(o) {
109
- this.x -= o.x, this.y -= o.y;
108
+ substract(n) {
109
+ this.x -= n.x, this.y -= n.y;
110
110
  }
111
111
  }
112
112
  function Ze(e) {
113
- const { onDown: o, onMove: s, onUp: u } = e, v = new Xe(), n = new Xe();
114
- let _;
115
- function d(h) {
116
- h.stopPropagation(), n.set(h.x, h.y), n.substract(v), s(v, n, h, _);
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(h) {
119
- u(h, _), v.set(0, 0), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", p);
118
+ function p(m) {
119
+ s(m, w), f.set(0, 0), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", p);
120
120
  }
121
- return (h, x) => o(h, x) ? (_ = x, v.set(h.x, h.y), document.addEventListener("mousemove", d), document.addEventListener("mouseup", p), h.stopPropagation(), true) : false;
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 St(e, o) {
124
- let s = 0;
123
+ function It(e, n) {
124
+ let u = 0;
125
125
  return {
126
126
  start() {
127
- s > 0 && clearInterval(s), s = setInterval(() => {
128
- s = 0, o();
127
+ u > 0 && clearInterval(u), u = setInterval(() => {
128
+ u = 0, n();
129
129
  }, e);
130
130
  },
131
131
  stop() {
132
- s > 0 && (clearInterval(s), s = 0);
132
+ u > 0 && (clearInterval(u), u = 0);
133
133
  }
134
134
  };
135
135
  }
136
- const me = [], Ge = St(100, () => {
137
- for (const e of me)
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 wt(e, o, s, u) {
141
- let v = 0, n = 0;
142
- function _() {
143
- e.value && (o && v !== e.value.offsetWidth && o(e.value.offsetWidth), s && n !== e.value.offsetHeight && s(e.value.offsetHeight), v = e.value.offsetWidth, n = e.value.offsetHeight);
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
- Ge.start(), me.push(_);
156
+ Qe.start(), pe.push(w);
148
157
  },
149
158
  stopResizeChecker() {
150
- const d = me.indexOf(_);
151
- d >= 0 && me.splice(d, 1), me.length === 0 && Ge.stop();
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 Je = 140, It = 70, Wt = /* @__PURE__ */ defineComponent({
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: o, emit: s }) {
223
- const u = e, v = s, n = ref(), _ = ref(), d = ref(), p = ref(), h = ref(), x = ref(), B = ref(false), L = computed(() => u.scroll === "horizontal" || u.scroll === "both"), S = computed(() => u.scroll === "vertical" || u.scroll === "both"), M = reactive({
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
- }), k = reactive({
262
+ }), M = reactive({
229
263
  show: false,
230
264
  size: 0,
231
265
  sizeRaw: 0,
232
266
  pos: 0
233
267
  });
234
- let H = 0, r = 0, f = 0, C = 0, y = null;
235
- const I = { attributes: true, childList: true };
236
- function i() {
237
- if (n.value) {
238
- if (M.show) {
239
- const t = n.value.offsetWidth / n.value.scrollWidth;
240
- M.sizeRaw = t * n.value.offsetWidth, M.size = t * 100, M.pos = n.value.scrollLeft / (n.value.scrollWidth - n.value.offsetWidth) * (100 - M.size), t >= 1 && (M.show = false);
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 (k.show) {
243
- const t = n.value.offsetHeight / n.value.scrollHeight;
244
- k.sizeRaw = t * n.value.offsetHeight, k.size = t * 100, k.pos = n.value.scrollTop / (n.value.scrollHeight - n.value.offsetHeight) * (100 - k.size), t >= 1 && (k.show = false);
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
- v("scroll", n.value.scrollLeft, n.value.scrollTop);
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 g(t = false) {
250
- if (!n.value)
283
+ function c(o = false) {
284
+ if (!t.value)
251
285
  return;
252
- let c = L.value, m = S.value;
253
- const a = c && (H !== n.value.scrollWidth || f !== n.value.offsetWidth), ae = S && (r !== n.value.scrollHeight || C !== n.value.offsetHeight);
254
- if (!t && !a && !ae)
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 N = window.getComputedStyle(n.value);
257
- (N.overflow === "hidden" || N.overflowX === "hidden") && (c = false), (N.overflow === "hidden" || N.overflowY === "hidden") && (m = false), M.show = c, k.show = m, i(), f = n.value.offsetWidth, C = n.value.offsetHeight, H = n.value.scrollWidth, r = n.value.scrollHeight, v("resized", H, r);
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
- function K(t) {
260
- var c;
261
- u.scroll == "horizontal" && (t.deltaMode == 0 && ((c = n.value) == null || c.scrollTo({
262
- left: n.value.scrollLeft + (t.deltaY > 0 ? Je : -140),
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
- })), t.preventDefault(), t.stopPropagation());
265
- }
266
- function O(t) {
267
- var c;
268
- t.deltaMode == 0 && ((c = n.value) == null || c.scrollTo({
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
- }), t.preventDefault(), t.stopPropagation());
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 D(t) {
274
- var c;
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
- let V = 0, U = 0, A = 0, w = 0;
281
- const $ = Ze({
282
- onDown(t) {
283
- return !d.value || !h.value ? false : (V = t.offsetX, U = t.x - t.offsetX - h.value.offsetLeft, t.preventDefault(), B.value = true, true);
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(t, c, m) {
286
- n.value && d.value && (J(m.x - V - U), m.preventDefault(), m.stopPropagation());
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
- B.value = false;
324
+ H.value = false;
290
325
  }
291
326
  }), X = Ze({
292
- onDown(t) {
293
- return !p.value || !x.value ? false : (A = t.offsetY, w = t.y - t.offsetY - x.value.offsetTop, t.preventDefault(), B.value = true, true);
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(t, c, m) {
296
- n.value && p.value && (ne(m.y - A - w), m.preventDefault(), m.stopPropagation());
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
- B.value = false;
334
+ H.value = false;
300
335
  }
301
336
  });
302
- function Y(t) {
303
- n.value && (n.value.scrollLeft = t / 100 * (n.value.scrollWidth - n.value.offsetWidth));
337
+ function te(o) {
338
+ t.value && (t.value.scrollLeft = o / 100 * (t.value.scrollWidth - t.value.offsetWidth));
304
339
  }
305
- function Z(t) {
306
- n.value && (n.value.scrollLeft = t / 100 * (n.value.scrollHeight - n.value.offsetHeight));
340
+ function re(o) {
341
+ t.value && (t.value.scrollLeft = o / 100 * (t.value.scrollHeight - t.value.offsetHeight));
307
342
  }
308
- function J(t) {
309
- n.value && (n.value.scrollLeft = t / (n.value.offsetWidth - M.sizeRaw) * (n.value.scrollWidth - n.value.offsetWidth));
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 ne(t) {
312
- n.value && (n.value.scrollTop = t / (n.value.offsetHeight - k.sizeRaw) * (n.value.scrollHeight - n.value.offsetHeight));
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 R(t) {
315
- u.scrollBarBackgroundClickable && J(t.offsetX - M.sizeRaw / 2);
349
+ function Le(o) {
350
+ s.scrollBarBackgroundClickable && W(o.offsetX - v.sizeRaw / 2);
316
351
  }
317
- function de(t) {
318
- u.scrollBarBackgroundClickable && ne(t.offsetY - k.sizeRaw / 2);
352
+ function Ce(o) {
353
+ s.scrollBarBackgroundClickable && de(o.offsetY - M.sizeRaw / 2);
319
354
  }
320
355
  const {
321
- startResizeChecker: Te,
322
- stopResizeChecker: Ce
323
- } = wt(
324
- n,
325
- () => g(),
326
- () => g()
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(() => g(true), 200), g(true), Te(), y = new MutationObserver(() => g()), y.observe(n.value, I);
365
+ setTimeout(() => c(true), 200), c(true), r(), C = new MutationObserver(() => c()), C.observe(t.value, S);
331
366
  });
332
367
  }), onBeforeUnmount(() => {
333
- Ce(), y && (y.disconnect(), y = null);
334
- }), o({
368
+ b(), C && (C.disconnect(), C = null);
369
+ }), n({
335
370
  refreshScrollState() {
336
- g(true);
371
+ c(true);
337
372
  },
338
373
  getScrollContainer() {
339
- return n.value;
374
+ return t.value;
340
375
  },
341
- scrollTo(t, c) {
342
- var m;
343
- (m = n.value) == null || m.scrollTo(t, c);
376
+ scrollTo(o, l) {
377
+ var T;
378
+ (T = t.value) == null || T.scrollTo(o, l);
344
379
  },
345
380
  scrollToTop() {
346
- var t;
347
- (t = n.value) == null || t.scrollTo(0, 0);
381
+ var o;
382
+ (o = t.value) == null || o.scrollTo(0, 0);
348
383
  },
349
384
  scrollToBottom() {
350
- var t;
351
- (t = n.value) == null || t.scrollTo(n.value.scrollWidth, n.value.scrollHeight);
385
+ var o;
386
+ (o = t.value) == null || o.scrollTo(t.value.scrollWidth, t.value.scrollHeight);
352
387
  }
353
- }), (t, c) => (openBlock(), createElementBlock("div", {
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
- B.value ? "dragging" : ""
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: K
401
+ onWheel: z
367
402
  }, [
368
403
  createElementVNode("div", {
369
404
  ref_key: "container",
370
- ref: n,
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: i
412
+ onScroll: k
378
413
  }, [
379
- renderSlot(t.$slots, "default")
414
+ renderSlot(o.$slots, "default")
380
415
  ], 38),
381
- M.show ? renderSlot(t.$slots, "scrollBarX", {
416
+ v.show ? renderSlot(o.$slots, "scrollBarX", {
382
417
  key: 0,
383
- scrollBarValue: M,
384
- onScroll: Y
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: R,
391
- onWheel: O
425
+ onClick: Le,
426
+ onWheel: V
392
427
  }, [
393
428
  createElementVNode("div", {
394
429
  class: "thumb",
395
430
  ref_key: "scrollBarThumbRefX",
396
- ref: h,
397
- style: normalizeStyle({ left: `${M.pos}%`, width: `${M.size}%` }),
398
- onMousedown: c[0] || (c[0] = //@ts-ignore
399
- (...m) => unref($) && unref($)(...m)),
400
- onWheel: O
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
- k.show ? renderSlot(t.$slots, "scrollBarY", {
439
+ M.show ? renderSlot(o.$slots, "scrollBarY", {
405
440
  key: 1,
406
- scrollBarValue: k,
407
- onScroll: Z
441
+ scrollBarValue: M,
442
+ onScroll: re
408
443
  }, () => [
409
- k.show ? (openBlock(), createElementBlock("div", {
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: de,
415
- onWheel: D
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: `${k.pos}%`, height: `${k.size}%` }),
422
- onMousedown: c[1] || (c[1] = //@ts-ignore
423
- (...m) => unref(X) && unref(X)(...m)),
424
- onWheel: D
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, o) => {
431
- const s = e.__vccOpts || e;
432
- for (const [u, v] of o)
433
- s[u] = v;
434
- return s;
435
- }, _t = {}, Ht = {
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
- }, Rt = /* @__PURE__ */ createElementVNode("path", { d: "M129.3,428.6L52,512l345,372.5l575-620.8l-69.5-75L400.4,718.2L129.3,428.6z" }, null, -1), Ot = [
440
- Rt
441
- ];
442
- function Bt(e, o) {
443
- return openBlock(), createElementBlock("svg", Ht, Ot);
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 Pt = /* @__PURE__ */ we(_t, [["render", Bt]]), $t = {}, At = {
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
- }, Ft = /* @__PURE__ */ 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), Lt = [
450
- Ft
451
- ];
452
- function Tt(e, o) {
453
- return openBlock(), createElementBlock("svg", At, Lt);
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 Et = /* @__PURE__ */ we($t, [["render", Tt]]), zt = { class: "mx-item-row" }, jt = ["xlink:href"], Dt = {
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
- }, Nt = { class: "mx-item-row" }, Kt = { class: "mx-shortcut" }, Fe = /* @__PURE__ */ defineComponent({
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: o, emit: s }) {
592
- const u = e, v = s, {
593
- clickHandler: n,
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: h,
632
+ hidden: m,
598
633
  label: x,
599
- icon: B,
600
- iconFontClass: L,
601
- showRightArrow: S,
602
- shortcut: M,
603
- hasChildren: k
604
- } = toRefs(u), H = ref(false), r = ref(false), f = ref(), C = inject("globalOptions"), y = inject("globalHasSlot"), I = inject("globalRenderSlot"), i = inject("globalCloseMenu"), g = inject("menuContext"), K = computed(() => typeof x.value == "string" ? x.value : typeof x.value == "function" ? yt(x.value.toString()) : "MenuItem[unknow]");
605
- provide("MenuItemName", K);
606
- const O = {
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: () => H.value ? (g.markActiveMenuItem(O, true), true) : k.value ? (V(), true) : false,
644
+ showSubMenu: () => R.value ? (c.markActiveMenuItem(B, true), true) : M.value ? (V(), true) : false,
610
645
  hideSubMenu: () => {
611
- g.closeOtherSubMenu();
646
+ c.closeOtherSubMenu();
612
647
  },
613
- isDisabledOrHidden: () => p.value || h.value,
614
- getElement: () => f.value,
615
- focus: () => r.value = true,
616
- blur: () => r.value = false,
617
- click: D
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", O), onMounted(() => {
620
- g.isMenuItemDataCollectedFlag() ? nextTick(() => {
621
- let w = 0;
622
- const $ = g.getElement();
623
- if ($) {
624
- let X = 0;
625
- for (let Y = 0; Y < $.children.length; Y++) {
626
- const Z = $.children[Y];
627
- if (Z.getAttribute("data-type") === "ContextMenuItem") {
628
- if (Z === f.value) {
629
- w = X;
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
- X++;
667
+ G++;
633
668
  }
634
669
  }
635
670
  }
636
- g.addChildMenuItem(O, w);
637
- }) : g.addChildMenuItem(O);
671
+ c.addChildMenuItem(B, I);
672
+ }) : c.addChildMenuItem(B);
638
673
  }), onBeforeUnmount(() => {
639
- g.removeChildMenuItem(O);
674
+ c.removeChildMenuItem(B);
640
675
  });
641
- function D(w) {
676
+ function z(I) {
642
677
  if (!p.value) {
643
- if (w) {
644
- const $ = w.target;
645
- if ($.classList.contains("mx-context-no-clickable") || C.value.ignoreClickClassName && $.classList.contains(C.value.ignoreClickClassName))
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 (C.value.clickCloseClassName && $.classList.contains(C.value.clickCloseClassName)) {
648
- w.stopPropagation(), i(u.rawMenuItem);
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
- k.value ? d.value ? (typeof n.value == "function" && n.value(w), v("click", w)) : H.value || V() : (typeof n.value == "function" && n.value(w), v("click", w), _.value && i(u.rawMenuItem));
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(w) {
656
- r.value = false, g.checkCloseOtherSubMenuTimeOut() || g.closeOtherSubMenu(), p.value || (g.markActiveMenuItem(O), k.value && (w || g.markThisOpenedByKeyBoard(), g.addOpenedSubMenu(U), H.value = true, nextTick(() => v("subMenuOpen", O))));
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
- r.value = false, H.value = false, v("subMenuClose", O);
694
+ h.value = false, R.value = false, f("subMenuClose", B);
660
695
  }
661
- function A() {
696
+ function E() {
662
697
  return {
663
698
  disabled: p.value,
664
699
  label: x.value,
665
- icon: B.value,
666
- iconFontClass: L.value,
667
- showRightArrow: S.value,
668
- clickClose: _.value,
700
+ icon: H.value,
701
+ iconFontClass: F.value,
702
+ showRightArrow: P.value,
703
+ clickClose: w.value,
669
704
  clickableWhenHasChildren: d.value,
670
- shortcut: M.value,
671
- theme: C.value.theme,
672
- isOpen: H,
673
- hasChildren: k,
674
- onClick: D,
705
+ shortcut: v.value,
706
+ theme: y.value.theme,
707
+ isOpen: R,
708
+ hasChildren: M,
709
+ onClick: z,
675
710
  onMouseEnter: V,
676
- closeMenu: i
711
+ closeMenu: k
677
712
  };
678
713
  }
679
- return o(O), (w, $) => unref(h) ? createCommentVNode("", true) : (openBlock(), createElementBlock("div", {
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: f,
718
+ ref: i,
684
719
  "data-type": "ContextMenuItem"
685
720
  }, [
686
- unref(y)("itemRender") ? (openBlock(), createBlock(unref(q), {
721
+ unref(C)("itemRender") ? (openBlock(), createBlock(unref(J), {
687
722
  key: 0,
688
- vnode: () => unref(I)("itemRender", A())
689
- }, null, 8, ["vnode"])) : e.customRender ? (openBlock(), createBlock(unref(q), {
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: A()
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
- r.value ? "keyboard-focus" : "",
733
+ h.value ? "keyboard-focus" : "",
699
734
  e.customClass ? " " + e.customClass : "",
700
- H.value ? "open" : ""
735
+ R.value ? "open" : ""
701
736
  ]),
702
- onClick: D,
737
+ onClick: z,
703
738
  onMouseenter: V
704
739
  }, [
705
- renderSlot(w.$slots, "default", {}, () => [
706
- createElementVNode("div", zt, [
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(w.$slots, "icon", {}, () => [
714
- unref(y)("itemIconRender") ? (openBlock(), createBlock(unref(q), {
748
+ renderSlot(I.$slots, "icon", {}, () => [
749
+ unref(C)("itemIconRender") ? (openBlock(), createBlock(unref(J), {
715
750
  key: 0,
716
- vnode: () => unref(I)("itemIconRender", A())
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, jt)
722
- ], 16)) : typeof unref(B) != "string" ? (openBlock(), createBlock(unref(q), {
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(B),
725
- data: unref(B)
726
- }, null, 8, ["vnode", "data"])) : typeof unref(B) == "string" && unref(B) !== "" ? (openBlock(), createElementBlock("i", {
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(B) + " icon " + unref(L) + " " + unref(C).iconFontClass)
763
+ class: normalizeClass(unref(H) + " icon " + unref(F) + " " + unref(y).iconFontClass)
729
764
  }, null, 2)) : createCommentVNode("", true)
730
765
  ]),
731
- e.checked ? renderSlot(w.$slots, "check", { key: 0 }, () => [
732
- unref(y)("itemCheckRender") ? (openBlock(), createBlock(unref(q), {
766
+ e.checked ? renderSlot(I.$slots, "check", { key: 0 }, () => [
767
+ unref(C)("itemCheckRender") ? (openBlock(), createBlock(unref(J), {
733
768
  key: 0,
734
- vnode: () => unref(I)("itemCheckRender", A())
769
+ vnode: () => unref(S)("itemCheckRender", E())
735
770
  }, null, 8, ["vnode"])) : createCommentVNode("", true),
736
- createVNode(Pt)
771
+ createVNode($t)
737
772
  ]) : createCommentVNode("", true)
738
773
  ], 2),
739
- renderSlot(w.$slots, "label", {}, () => [
740
- unref(y)("itemLabelRender") ? (openBlock(), createBlock(unref(q), {
774
+ renderSlot(I.$slots, "label", {}, () => [
775
+ unref(C)("itemLabelRender") ? (openBlock(), createBlock(unref(J), {
741
776
  key: 0,
742
- vnode: () => unref(I)("itemLabelRender", A())
743
- }, null, 8, ["vnode"])) : typeof unref(x) == "string" ? (openBlock(), createElementBlock("span", Dt, toDisplayString(unref(x)), 1)) : (openBlock(), createBlock(unref(q), {
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", Nt, [
751
- unref(M) || w.$slots.shortcut ? renderSlot(w.$slots, "shortcut", { key: 0 }, () => [
752
- unref(y)("itemShortcutRender") ? (openBlock(), createBlock(unref(q), {
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(I)("itemShortcutRender", A())
789
+ vnode: () => unref(S)("itemShortcutRender", E())
755
790
  }, null, 8, ["vnode"])) : createCommentVNode("", true),
756
- createElementVNode("span", Kt, toDisplayString(unref(M)), 1)
791
+ createElementVNode("span", Nt, toDisplayString(unref(v)), 1)
757
792
  ]) : createCommentVNode("", true),
758
- unref(S) ? renderSlot(w.$slots, "rightArrow", { key: 1 }, () => [
759
- unref(y)("itemRightArrowRender") ? (openBlock(), createBlock(unref(q), {
793
+ unref(P) ? renderSlot(I.$slots, "rightArrow", { key: 1 }, () => [
794
+ unref(C)("itemRightArrowRender") ? (openBlock(), createBlock(unref(J), {
760
795
  key: 0,
761
- vnode: () => unref(I)("itemRightArrowRender", A())
796
+ vnode: () => unref(S)("itemRightArrowRender", E())
762
797
  }, null, 8, ["vnode"])) : createCommentVNode("", true),
763
- createVNode(Et)
798
+ createVNode(Lt)
764
799
  ]) : createCommentVNode("", true)
765
800
  ])
766
801
  ])
767
802
  ], 34)),
768
- renderSlot(w.$slots, "submenu", {
769
- context: O,
770
- show: H.value
803
+ renderSlot(I.$slots, "submenu", {
804
+ context: B,
805
+ show: R.value
771
806
  })
772
807
  ], 512));
773
808
  }
774
- }), Yt = defineComponent({
809
+ }), Kt = defineComponent({
775
810
  name: "ContextMenuSperator",
776
811
  components: {
777
- VNodeRender: q
812
+ VNodeRender: J
778
813
  },
779
814
  setup() {
780
- const e = inject("globalHasSlot"), o = inject("globalRenderSlot");
815
+ const e = inject("globalHasSlot"), n = inject("globalRenderSlot");
781
816
  return {
782
817
  globalHasSlot: e,
783
- globalRenderSlot: o
818
+ globalRenderSlot: n
784
819
  };
785
820
  }
786
- }), Vt = {
821
+ }), Yt = {
787
822
  key: 1,
788
823
  class: "mx-context-menu-item-sperator mx-context-no-clickable"
789
824
  };
790
- function Ut(e, o, s, u, v, n) {
791
- const _ = resolveComponent("VNodeRender");
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", Vt));
830
+ }, null, 8, ["vnode"])) : (openBlock(), createElementBlock("div", Yt));
796
831
  }
797
- const ge = /* @__PURE__ */ we(Yt, [["render", Ut]]), Le = /* @__PURE__ */ defineComponent({
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: o, emit: s }) {
857
- const u = e, v = s, n = ref(false), _ = inject("globalGetMenuHostId", ""), d = inject("menuContext"), p = inject("globalOptions");
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 h = ref("UnknowOrRoot"), x = inject("MenuItemName", h), { zIndex: B, getParentWidth: L, getParentHeight: S, getZoom: M } = d, { adjustPosition: k } = toRefs(u), H = ref(), r = ref(), f = ref(), C = [], y = inject("globalSetCurrentSubMenu"), I = [];
860
- let i = null, g = 0;
861
- function K() {
862
- i && i.blur();
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 O(t, c) {
865
- if (t) {
866
- for (let m = c !== void 0 ? c : 0; m < I.length; m++)
867
- if (!I[m].isDisabledOrHidden()) {
868
- D(m);
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 m = c !== void 0 ? c : I.length - 1; m >= 0; m--)
873
- if (!I[m].isDisabledOrHidden()) {
874
- D(m);
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 D(t) {
879
- if (i && K(), t !== void 0 && (i = I[Math.max(0, Math.min(t, I.length - 1))]), !i)
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
- i.focus();
882
- const c = i.getElement();
883
- c && c.scrollIntoView({
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
- y(U);
932
+ C(U);
891
933
  }
892
934
  const U = {
893
- el: f,
935
+ el: i,
894
936
  name: x,
895
937
  isTopLevel: () => d.getParentContext() === null,
896
938
  closeSelfAndActiveParent: () => {
897
- const t = $.getParentContext();
898
- if (t) {
899
- t.closeOtherSubMenu();
900
- const c = t.getSubMenuInstanceContext();
901
- if (c)
902
- return c.focusCurrentItem(), true;
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 t;
908
- return (t = $.getParentContext()) == null ? void 0 : t.closeOtherSubMenu();
949
+ var r;
950
+ return (r = A.getParentContext()) == null ? void 0 : r.closeOtherSubMenu();
909
951
  },
910
- moveCurrentItemFirst: () => O(true),
911
- moveCurrentItemLast: () => O(false),
912
- moveCurrentItemDown: () => O(true, i ? I.indexOf(i) + 1 : 0),
913
- moveCurrentItemUp: () => O(false, i ? I.indexOf(i) - 1 : 0),
914
- focusCurrentItem: () => D(),
915
- openCurrentItemSubMenu: () => i ? i == null ? void 0 : i.showSubMenu() : false,
916
- triggerCurrentItemClick: (t) => i == null ? void 0 : i.click(t)
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 A = false, w = false;
919
- const $ = {
920
- zIndex: B + 1,
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 t;
925
- return ((t = f.value) == null ? void 0 : t.offsetWidth) || 0;
966
+ var r;
967
+ return ((r = i.value) == null ? void 0 : r.offsetWidth) || 0;
926
968
  },
927
969
  getParentHeight: () => {
928
- var t;
929
- return ((t = f.value) == null ? void 0 : t.offsetHeight) || 0;
970
+ var r;
971
+ return ((r = i.value) == null ? void 0 : r.offsetHeight) || 0;
930
972
  },
931
- getPositon: () => [R.value.x, R.value.y],
973
+ getPositon: () => [W.value.x, W.value.y],
932
974
  getZoom: () => p.value.zoom || ee.defaultZoom,
933
- addOpenedSubMenu(t) {
934
- C.push(t);
975
+ addOpenedSubMenu(r) {
976
+ y.push(r);
935
977
  },
936
978
  closeOtherSubMenu() {
937
- C.forEach((t) => t()), C.splice(0, C.length), y(U);
979
+ y.forEach((r) => r()), y.splice(0, y.length), C(U);
938
980
  },
939
981
  checkCloseOtherSubMenuTimeOut() {
940
- return g ? (clearTimeout(g), g = 0, true) : false;
982
+ return c ? (clearTimeout(c), c = 0, true) : false;
941
983
  },
942
984
  closeOtherSubMenuWithTimeOut() {
943
- g = setTimeout(() => {
944
- g = 0, this.closeOtherSubMenu();
985
+ c = setTimeout(() => {
986
+ c = 0, this.closeOtherSubMenu();
945
987
  }, 200);
946
988
  },
947
- addChildMenuItem: (t, c) => {
948
- c === void 0 ? I.push(t) : I.splice(c, 0, t);
989
+ addChildMenuItem: (r, b) => {
990
+ b === void 0 ? S.push(r) : S.splice(b, 0, r);
949
991
  },
950
- removeChildMenuItem: (t) => {
951
- I.splice(I.indexOf(t), 1), t.getSubMenuInstance = () => {
992
+ removeChildMenuItem: (r) => {
993
+ S.splice(S.indexOf(r), 1), r.getSubMenuInstance = () => {
952
994
  };
953
995
  },
954
- markActiveMenuItem: (t, c = false) => {
955
- K(), i = t, c && D();
996
+ markActiveMenuItem: (r, b = false) => {
997
+ _(), k = r, b && z();
956
998
  },
957
999
  markThisOpenedByKeyBoard: () => {
958
- A = true;
1000
+ E = true;
959
1001
  },
960
- isOpenedByKeyBoardFlag: () => A ? (A = false, true) : false,
961
- isMenuItemDataCollectedFlag: () => w,
962
- getElement: () => f.value || null,
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 X = {
968
- getChildItem: (t) => I[t],
969
- getMenuDimensions: () => r.value ? {
970
- width: r.value.offsetWidth,
971
- height: r.value.offsetHeight
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: () => r.value,
974
- getMenu: () => f.value,
1015
+ getSubmenuRoot: () => h.value,
1016
+ getMenu: () => i.value,
975
1017
  getScrollValue: () => {
976
- var t, c;
977
- return ((c = (t = H.value) == null ? void 0 : t.getScrollContainer()) == null ? void 0 : c.scrollTop) || 0;
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: (t) => {
980
- var c;
981
- return (c = H.value) == null ? void 0 : c.scrollTo(0, t);
1021
+ setScrollValue: (r) => {
1022
+ var b;
1023
+ return (b = R.value) == null ? void 0 : b.scrollTo(0, r);
982
1024
  },
983
- getScrollHeight: () => Z.value,
1025
+ getScrollHeight: () => X.value,
984
1026
  adjustPosition: () => {
985
1027
  de();
986
1028
  },
987
- getMaxHeight: () => J.value,
988
- getPosition: () => R.value,
989
- setPosition: (t, c) => {
990
- R.value.x = t, R.value.y = c;
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 = () => X);
994
- const Z = ref(0), J = ref(0), ne = ref(false), R = ref({ x: 0, y: 0 });
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 m;
998
- const t = f.value, c = r.value;
999
- if (t && c && H.value) {
1000
- const { container: a } = d, ae = (L == null ? void 0 : L()) ?? 0, N = (S == null ? void 0 : S()) ?? 0, Q = getComputedStyle(c), ye = parseFloat(Q.paddingLeft), xe = parseFloat(Q.paddingTop), Ie = N > 0 ? xe : 0, at = document.documentElement.scrollHeight / M(), it = document.documentElement.scrollWidth / M(), rt = Math.min(it, a.offsetWidth), Ee = Math.min(at, a.offsetHeight);
1001
- let We = ue(t, a), _e = se(t, a);
1002
- if (u.direction.includes("l") ? R.value.x -= t.offsetWidth + ye : u.direction.includes("r") ? R.value.x += ae + ye : (R.value.x += ae / 2, R.value.x -= (t.offsetWidth + ye) / 2), u.direction.includes("t")) {
1003
- const fe = (m = u.parentMenuItemContext) == null ? void 0 : m.getElement();
1004
- fe && (R.value.y += fe.offsetHeight), R.value.y -= (t.offsetHeight + xe) / M();
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
- u.direction.includes("b") ? R.value.y -= xe / M() : R.value.y -= t.offsetHeight / 2 / M();
1048
+ s.direction.includes("b") ? W.value.y -= xe / v() : W.value.y -= r.offsetHeight / 2 / v();
1007
1049
  nextTick(() => {
1008
- var je, De;
1009
- We = ue(t, a), _e = se(t, a);
1010
- const fe = ((De = (je = H.value) == null ? void 0 : je.getScrollContainer()) == null ? void 0 : De.scrollHeight) || 0, ct = u.maxHeight;
1011
- Z.value = u.maxHeight ? Math.min(fe, u.maxHeight) : fe;
1012
- const dt = We + t.offsetWidth - rt, ze = _e + Z.value + Ie * 2 - Ee;
1013
- if (ne.value = ze > 0, k.value && dt > 0) {
1014
- const ve = ae + t.offsetWidth - ye, he = We;
1015
- ve > he ? R.value.x -= he : R.value.x -= 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 (ne.value) {
1018
- if (k.value) {
1019
- const ve = ze, he = _e;
1020
- ve > he ? R.value.y -= he - Ie : R.value.y -= ve - Ie;
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
- J.value = Ee - (R.value.y + xe);
1064
+ te.value = Fe - (W.value.y + xe);
1023
1065
  } else
1024
- J.value = ct || 0;
1066
+ te.value = ct || 0;
1025
1067
  });
1026
1068
  }
1027
1069
  });
1028
1070
  }
1029
1071
  function Ce() {
1030
- var c;
1031
- const t = (c = u.parentMenuItemContext) == null ? void 0 : c.getElement();
1032
- if (t) {
1033
- const m = ue(t, d.container), a = se(t, d.container);
1034
- R.value.x = m, R.value.y = a;
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 [m, a] = d.getPositon();
1037
- R.value.x = m, R.value.y = a;
1078
+ const [o, l] = d.getPositon();
1079
+ W.value.x = o, W.value.y = l;
1038
1080
  }
1039
1081
  nextTick(() => {
1040
- var m;
1041
- y(U), (m = f.value) == null || m.focus({ preventScroll: true }), d.isOpenedByKeyBoardFlag() && nextTick(() => O(true)), w = true;
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(() => u.show, (t) => {
1045
- t ? Ce() : void 0;
1086
+ return watch(() => s.show, (r) => {
1087
+ r ? Ce() : void 0;
1046
1088
  }), onMounted(() => {
1047
- n.value = true, u.show ? Ce() : de();
1089
+ t.value = true, s.show ? Ce() : de();
1048
1090
  }), onBeforeUnmount(() => {
1049
- n.value = false, Y && (Y.getSubMenuInstance = () => {
1091
+ t.value = false, Y && (Y.getSubMenuInstance = () => {
1050
1092
  });
1051
- }), o(X), (t, c) => {
1052
- const m = resolveComponent("ContextSubMenu", true);
1053
- return n.value ? (openBlock(), createBlock(Teleport, {
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: c[0] || (c[0] = (a) => v("closeAnimFinished"))
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: r
1067
- }, t.$attrs, {
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(B),
1077
- left: `${R.value.x}px`,
1078
- top: `${R.value.y}px`
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(Wt), {
1125
+ createVNode(unref(Rt), {
1084
1126
  ref_key: "scrollRectRef",
1085
- ref: H,
1127
+ ref: R,
1086
1128
  scroll: "vertical",
1087
- maxHeight: J.value,
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: f
1136
+ ref: i
1095
1137
  }, [
1096
- renderSlot(t.$slots, "default", {}, () => [
1097
- (openBlock(true), createElementBlock(Fragment, null, renderList(e.items, (a, ae) => (openBlock(), createElementBlock(Fragment, { key: ae }, [
1098
- a.hidden !== true && a.divided === "up" ? (openBlock(), createBlock(ge, { key: 0 })) : createCommentVNode("", true),
1099
- a.hidden !== true && a.divided === "self" ? (openBlock(), createBlock(ge, { key: 1 })) : (openBlock(), createBlock(Fe, {
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: a.onClick ? (N) => a.onClick(N) : void 0,
1102
- disabled: typeof a.disabled == "object" ? a.disabled.value : a.disabled,
1103
- hidden: typeof a.hidden == "object" ? a.hidden.value : a.hidden,
1104
- icon: a.icon,
1105
- iconFontClass: a.iconFontClass,
1106
- svgIcon: a.svgIcon,
1107
- svgProps: a.svgProps,
1108
- label: a.label,
1109
- customRender: a.customRender,
1110
- customClass: a.customClass,
1111
- checked: typeof a.checked == "object" ? a.checked.value : a.checked,
1112
- shortcut: a.shortcut,
1113
- clickClose: a.clickClose,
1114
- clickableWhenHasChildren: a.clickableWhenHasChildren,
1115
- preserveIconWidth: a.preserveIconWidth !== void 0 ? a.preserveIconWidth : unref(p).preserveIconWidth,
1116
- showRightArrow: a.children && a.children.length > 0,
1117
- hasChildren: a.children && a.children.length > 0,
1118
- rawMenuItem: a,
1119
- onSubMenuOpen: (N) => {
1120
- var Q;
1121
- return (Q = a.onSubMenuOpen) == null ? void 0 : Q.call(a, N);
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: (N) => {
1124
- var Q;
1125
- return (Q = a.onSubMenuClose) == null ? void 0 : Q.call(a, N);
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
- a.children && a.children.length > 0 ? {
1170
+ l.children && l.children.length > 0 ? {
1129
1171
  name: "submenu",
1130
- fn: withCtx(({ context: N, show: Q }) => [
1131
- createVNode(m, {
1132
- show: Q,
1133
- parentMenuItemContext: N,
1134
- items: a.children,
1135
- maxWidth: a.maxWidth,
1136
- minWidth: a.minWidth,
1137
- maxHeight: a.maxHeight,
1138
- adjustPosition: a.adjustSubMenuPosition !== void 0 ? a.adjustSubMenuPosition : unref(p).adjustPosition,
1139
- direction: a.direction !== void 0 ? a.direction : unref(p).direction
1140
- }, null, 8, ["show", "parentMenuItemContext", "items", "maxWidth", "minWidth", "maxHeight", "adjustPosition", "direction"])
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
- a.hidden !== true && (a.divided === "down" || a.divided === true) ? (openBlock(), createBlock(ge, { key: 3 })) : createCommentVNode("", true)
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)) : createCommentVNode("", true)
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: o, emit: s }) {
1194
- const u = e, v = s, n = useSlots(), _ = ref(), {
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
- container: h$1
1198
- } = toRefs(u);
1249
+ destroyOnClose: m,
1250
+ container: x
1251
+ } = toRefs(s);
1199
1252
  onMounted(() => {
1200
- p.value && L();
1253
+ p.value && P();
1201
1254
  }), onBeforeUnmount(() => {
1202
- H();
1203
- }), watch(p, (i) => {
1204
- i ? L() : (Ye(x), H());
1255
+ h$1();
1256
+ }), watch(p, (c) => {
1257
+ c ? P() : (Ye(H), h$1());
1205
1258
  });
1206
- const x = {
1207
- closeMenu: S,
1259
+ const H = {
1260
+ closeMenu: v,
1208
1261
  isClosed: M,
1209
- getMenuRef: () => _.value,
1262
+ getMenuRef: () => w.value,
1210
1263
  getMenuDimensions: () => {
1211
- var i;
1212
- return ((i = _.value) == null ? void 0 : i.getMenuDimensions()) ?? { width: 0, height: 0 };
1264
+ var c;
1265
+ return ((c = w.value) == null ? void 0 : c.getMenuDimensions()) ?? { width: 0, height: 0 };
1213
1266
  }
1214
1267
  };
1215
- let B = false;
1216
- function L() {
1217
- k(), pt(x);
1268
+ let F = false;
1269
+ function P() {
1270
+ R(), bt(H);
1218
1271
  }
1219
- function S(i) {
1220
- B = true, v("close", i), d.value.menuTransitionProps || v("closeAnimFinished"), Ye(x);
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 B;
1276
+ return F;
1224
1277
  }
1225
- function k() {
1278
+ function R() {
1226
1279
  setTimeout(() => {
1227
- document.addEventListener("click", y, true), document.addEventListener("contextmenu", y, true), document.addEventListener("scroll", C, true), !u.isFullScreenContainer && h$1.value && h$1.value.addEventListener("scroll", C, true), d.value.keyboardControl !== false && document.addEventListener("keydown", f, true);
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 H() {
1231
- document.removeEventListener("contextmenu", y, true), document.removeEventListener("click", y, true), document.removeEventListener("scroll", C, true), !u.isFullScreenContainer && h$1.value && h$1.value.removeEventListener("scroll", C, true), d.value.keyboardControl !== false && document.removeEventListener("keydown", f, true);
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 r = ref();
1234
- provide("globalSetCurrentSubMenu", (i) => r.value = i), provide("globalGetMenuHostId", h$1.value.id);
1235
- function f(i) {
1236
- var K, O, D, V, U, A, w, $, X, Y, Z, J, ne;
1237
- let g = true;
1238
- switch (i.key) {
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
- ((K = r.value) == null ? void 0 : K.isTopLevel()) === false ? (O = r.value) == null || O.closeCurrentSubMenu() : S();
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
- (D = r.value) == null || D.moveCurrentItemDown();
1297
+ (V = i.value) == null || V.moveCurrentItemDown();
1245
1298
  break;
1246
1299
  case "ArrowUp":
1247
- (V = r.value) == null || V.moveCurrentItemUp();
1300
+ (U = i.value) == null || U.moveCurrentItemUp();
1248
1301
  break;
1249
1302
  case "Home":
1250
- (U = r.value) == null || U.moveCurrentItemFirst();
1303
+ (E = i.value) == null || E.moveCurrentItemFirst();
1251
1304
  break;
1252
1305
  case "End":
1253
- (A = r.value) == null || A.moveCurrentItemLast();
1306
+ (I = i.value) == null || I.moveCurrentItemLast();
1254
1307
  break;
1255
1308
  case "ArrowLeft": {
1256
- (w = r.value) != null && w.closeSelfAndActiveParent() || (X = ($ = d.value).onKeyFocusMoveLeft) == null || X.call($);
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
- (Y = r.value) != null && Y.openCurrentItemSubMenu() || (J = (Z = d.value).onKeyFocusMoveRight) == null || J.call(Z);
1313
+ (X = i.value) != null && X.openCurrentItemSubMenu() || (re = (te = d.value).onKeyFocusMoveRight) == null || re.call(te);
1261
1314
  break;
1262
1315
  case "Enter":
1263
- (ne = r.value) == null || ne.triggerCurrentItemClick(i);
1316
+ (W = i.value) == null || W.triggerCurrentItemClick(c);
1264
1317
  break;
1265
1318
  default:
1266
- g = false;
1319
+ _ = false;
1267
1320
  break;
1268
1321
  }
1269
- g && r.value && (i.stopPropagation(), i.preventDefault());
1322
+ _ && i.value && (c.stopPropagation(), c.preventDefault());
1270
1323
  }
1271
- function C(i) {
1272
- d.value.closeWhenScroll !== false && I(i.target, null);
1324
+ function C(c) {
1325
+ d.value.closeWhenScroll !== false && k(c.target, null);
1273
1326
  }
1274
- function y(i) {
1275
- I(i.target, i);
1327
+ function S(c) {
1328
+ k(c.target, c);
1276
1329
  }
1277
- function I(i, g) {
1278
- var K, O;
1279
- for (; i; ) {
1280
- if (i.classList && i.classList.contains("mx-context-menu"))
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
- i = i.parentNode;
1335
+ c = c.parentNode;
1283
1336
  }
1284
- g ? d.value.clickCloseOnOutside !== false ? (H(), S()) : (O = (K = d.value).onClickOnOutside) == null || O.call(K, g) : (H(), S());
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", S), provide("globalIsFullScreenContainer", u.isFullScreenContainer), provide("globalHasSlot", (i) => n[i] !== void 0), provide("globalRenderSlot", (i, g) => renderSlot(n, i, { ...g }, () => [h("span", "Render slot failed")], false)), provide("menuContext", {
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: h$1.value,
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
- }), o(x), (i, g) => (openBlock(), createBlock(Le, {
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: g[0] || (g[0] = (K) => v("closeAnimFinished"))
1378
+ onCloseAnimFinished: _[0] || (_[0] = (B) => f("closeAnimFinished"))
1325
1379
  }, {
1326
1380
  default: withCtx(() => [
1327
- renderSlot(i.$slots, "default")
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 Xt = /* @__PURE__ */ defineComponent({
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: o, emit: s }) {
1353
- const u = s, v = e, { options: n, show: _ } = toRefs(v), { isNew: d, container: p, eleId: h } = st(n.value), x = ref(null), B = useSlots();
1354
- function L(S) {
1355
- var M, k;
1356
- u("update:show", false), u("close"), (k = (M = n.value).onClose) == null || k.call(M, S);
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 o({
1359
- closeMenu: () => u("update:show", false),
1360
- isClosed: () => !_.value,
1419
+ return n({
1420
+ closeMenu: () => s("update:show", false),
1421
+ isClosed: () => !w.value,
1361
1422
  getMenuRef: () => {
1362
- var S;
1363
- return (S = x.value) == null ? void 0 : S.getMenuRef();
1423
+ var v;
1424
+ return (v = H.value) == null ? void 0 : v.getMenuRef();
1364
1425
  },
1365
1426
  getMenuDimensions: () => {
1366
- var S;
1367
- return ((S = x.value) == null ? void 0 : S.getMenuDimensions()) ?? { width: 0, height: 0 };
1427
+ var v;
1428
+ return ((v = H.value) == null ? void 0 : v.getMenuDimensions()) ?? { width: 0, height: 0 };
1368
1429
  }
1369
- }), (S, M) => (openBlock(), createBlock(Teleport, {
1370
- to: `#${unref(h)}`
1430
+ }), (v, M) => (openBlock(), createBlock(Teleport, {
1431
+ to: `#${unref(x)}`
1371
1432
  }, [
1372
1433
  createVNode(ut, {
1373
1434
  ref_key: "menuRef",
1374
- ref: x,
1375
- options: unref(n),
1376
- show: unref(_),
1377
- container: unref(p),
1378
- isFullScreenContainer: !unref(d),
1379
- onClose: L
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(B), (k, H) => ({
1382
- name: H,
1383
- fn: withCtx((r) => [
1384
- renderSlot(S.$slots, H, normalizeProps(guardReactiveProps(r)))
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
- }), Zt = defineComponent({
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, o) {
1528
- const s = inject("globalOptions"), { adjustSubMenuPosition: u, maxWidth: v, minWidth: n, maxHeight: _ } = toRefs(e), d = typeof u.value < "u" ? u.value : s.value.adjustPosition, p = ref(), h$1 = ref();
1529
- return o.expose({
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: () => h$1.value
1532
- }), () => h(Fe, {
1593
+ getMenuItemRef: () => m.value
1594
+ }), () => h(Ae, {
1533
1595
  ...e,
1534
- ref: h$1,
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 o.slots.default !== void 0
1541
- }, o.slots.default ? {
1602
+ hasChildren: typeof n.slots.default !== void 0
1603
+ }, n.slots.default ? {
1542
1604
  //Create SubMenu
1543
- submenu: (x) => h(Le, {
1605
+ submenu: (x) => h(Ee, {
1544
1606
  ref: p,
1545
1607
  show: x.show,
1546
- maxWidth: v.value,
1547
- minWidth: n.value,
1548
- maxHeight: _.value,
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: o.slots.default
1614
+ default: n.slots.default
1553
1615
  }),
1554
1616
  //Add other slots
1555
- ...xt(o.slots, "default")
1556
- } : o.slots);
1617
+ ...St(n.slots, "default")
1618
+ } : n.slots);
1557
1619
  }
1558
1620
  });
1559
- function Gt(e, o, s, u) {
1560
- const v = ref(true), n = h(ut, {
1621
+ function Zt(e, n, u, s) {
1622
+ const f = ref(true), t = h(ut, {
1561
1623
  options: e,
1562
- show: v,
1563
- container: o,
1564
- isFullScreenContainer: !s,
1624
+ show: f,
1625
+ container: n,
1626
+ isFullScreenContainer: !u,
1565
1627
  onCloseAnimFinished: () => {
1566
- render(null, o);
1628
+ render(null, n);
1567
1629
  },
1568
- onClose: (_) => {
1630
+ onClose: (w) => {
1569
1631
  var d;
1570
- (d = e.onClose) == null || d.call(e, _), v.value = false;
1632
+ (d = e.onClose) == null || d.call(e, w), f.value = false;
1571
1633
  }
1572
- }, u);
1573
- return render(n, o), n.component;
1634
+ }, s);
1635
+ return render(t, n), t.component;
1574
1636
  }
1575
- function Qe(e, o) {
1576
- const s = st(e);
1577
- return Gt(e, s.container, s.isNew, o).exposed;
1637
+ function qe(e, n) {
1638
+ const u = st(e);
1639
+ return Zt(e, u.container, u.isNew, n).exposed;
1578
1640
  }
1579
- const qe = {
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 = Qe, e.component("ContextMenu", Xt), e.component("ContextMenuItem", Fe), e.component("ContextMenuGroup", Zt), e.component("ContextMenuSperator", ge), e.component("ContextMenuSeparator", ge), e.component("ContextSubMenu", Le);
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, o) {
1646
- return Qe(e, o);
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 mt();
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: gt
1660
- }, Jt = {}, Qt = {
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
- }, qt = /* @__PURE__ */ 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), en = /* @__PURE__ */ 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), tn = /* @__PURE__ */ 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), nn = [
1668
- qt,
1669
- en,
1670
- tn
1671
- ];
1672
- function on(e, o) {
1673
- return openBlock(), createElementBlock("svg", Qt, nn);
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 ln = /* @__PURE__ */ we(Jt, [["render", on]]), sn = ["onClick", "onMouseenter"], an = /* @__PURE__ */ defineComponent({
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 o = e, s = ref(), u = ref(false), v = ref([]), n = ref(null);
1688
- function _() {
1689
- u.value = true;
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
- u.value = false;
1754
+ s.value = false;
1693
1755
  }
1694
1756
  onMounted(() => {
1695
- v.value = o.options.items || [];
1696
- }), watch(() => o.options, () => {
1697
- v.value = o.options.items || [];
1757
+ f.value = n.options.items || [];
1758
+ }), watch(() => n.options, () => {
1759
+ f.value = n.options.items || [];
1698
1760
  });
1699
- let p = null, h = -1;
1761
+ let p = null, m = -1;
1700
1762
  function x() {
1701
- h < v.value.length - 1 ? h++ : h = 0, S(h, v.value[h]);
1763
+ m < f.value.length - 1 ? m++ : m = 0, P(m, f.value[m]);
1702
1764
  }
1703
- function B() {
1704
- h > 0 ? h-- : h = v.value.length - 1, S(h, v.value[h]);
1765
+ function H() {
1766
+ m > 0 ? m-- : m = f.value.length - 1, P(m, f.value[m]);
1705
1767
  }
1706
- function L(r) {
1707
- const f = o.options.barPopDirection ?? "bl";
1708
- let C = 0, y = 0;
1709
- return f.startsWith("b") ? y = se(r) + r.offsetHeight : f.startsWith("t") ? y = se(r) : y = se(r) + r.offsetHeight / 2, f.endsWith("l") ? C = ue(r) : f.startsWith("r") ? C = ue(r) + r.offsetWidth : C = ue(r) + r.offsetWidth / 2, { x: C, y: y + 5 };
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 S(r, f) {
1712
- var y;
1713
- if (h = r, !f.children)
1773
+ function P(h, i) {
1774
+ var C;
1775
+ if (m = h, !i.children)
1714
1776
  return;
1715
- p && (p.closeMenu(), p = null, u.value = true), n.value = f;
1716
- const C = (y = s.value) == null ? void 0 : y.children[r];
1717
- if (C) {
1718
- const { x: I, y: i } = L(C);
1719
- p = qe.showContextMenu({
1720
- ...o.options,
1721
- items: f.children,
1722
- x: I,
1723
- y: i,
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
- B();
1787
+ H();
1726
1788
  },
1727
1789
  onKeyFocusMoveRight() {
1728
1790
  x();
1729
1791
  },
1730
1792
  onClose() {
1731
- n.value == f && (u.value = false, n.value = null), typeof f.onSubMenuClose == "function" && f.onSubMenuClose(void 0);
1793
+ t.value == i && (s.value = false, t.value = null), typeof i.onSubMenuClose == "function" && i.onSubMenuClose(void 0);
1732
1794
  }
1733
- }), p && typeof f.onSubMenuOpen == "function" && f.onSubMenuOpen(void 0);
1795
+ }), p && typeof i.onSubMenuOpen == "function" && i.onSubMenuOpen(void 0);
1734
1796
  }
1735
1797
  }
1736
- function M() {
1737
- h = 0;
1738
- const r = s.value;
1739
- if (r) {
1740
- const { x: f, y: C } = L(r);
1741
- p = qe.showContextMenu({
1742
- ...o.options,
1743
- x: f,
1744
- y: C
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 k(r, f) {
1749
- f ? (u.value = true, S(r, f), f.onClick && (f.clickableWhenHasChildren === true && f.children && f.children.length > 0 || !f.children || f.children.length === 0) && f.onClick()) : M();
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 H(r, f) {
1752
- u.value && S(r, f);
1813
+ function R(h, i) {
1814
+ s.value && P(h, i);
1753
1815
  }
1754
- return (r, f) => (openBlock(), createElementBlock("div", {
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(r.$slots, "prefix"),
1825
+ renderSlot(h.$slots, "prefix"),
1764
1826
  e.options.mini ? (openBlock(), createElementBlock("div", {
1765
1827
  key: 0,
1766
1828
  ref_key: "menuBarContent",
1767
- ref: s,
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: f[0] || (f[0] = (C) => k(0, null))
1834
+ onClick: i[0] || (i[0] = (y) => M(0, null))
1773
1835
  }, [
1774
- createVNode(ln)
1836
+ createVNode(Jt)
1775
1837
  ])
1776
1838
  ], 512)) : (openBlock(), createElementBlock("div", {
1777
1839
  key: 1,
1778
1840
  ref_key: "menuBarContent",
1779
- ref: s,
1841
+ ref: u,
1780
1842
  class: "mx-menu-bar-content"
1781
1843
  }, [
1782
- (openBlock(true), createElementBlock(Fragment, null, renderList(v.value, (C, y) => (openBlock(), createElementBlock("div", {
1783
- key: y,
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
- C == n.value ? "active" : ""
1848
+ y == t.value ? "active" : ""
1787
1849
  ]),
1788
- onClick: (I) => k(y, C),
1789
- onMouseenter: (I) => H(y, C)
1790
- }, toDisplayString(C.label), 43, sn))), 128))
1850
+ onClick: (S) => M(C, y),
1851
+ onMouseenter: (S) => R(C, y)
1852
+ }, toDisplayString(y.label), 43, en))), 128))
1791
1853
  ], 512)),
1792
- renderSlot(r.$slots, "suffix")
1854
+ renderSlot(h.$slots, "suffix")
1793
1855
  ], 34));
1794
1856
  }
1795
1857
  });
1796
1858
 
1797
- export { Xt as ContextMenu, Zt as ContextMenuGroup, Fe as ContextMenuItem, ge as ContextMenuSeparator, an as MenuBar };
1859
+ export { Ut as ContextMenu, Xt as ContextMenuGroup, Ae as ContextMenuItem, be as ContextMenuSeparator, nn as MenuBar };