vue3-router-tab 1.2.9 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue3-router-tab.js +283 -287
- package/dist/vue3-router-tab.umd.cjs +1 -1
- package/lib/components/RouterTab.vue +10 -10
- package/lib/core/createRouterTabs.ts +16 -2
- package/package.json +1 -1
package/dist/vue3-router-tab.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './vue3-router-tab.css';
|
|
2
|
-
import { reactive as
|
|
2
|
+
import { reactive as pe, ref as $, shallowRef as dt, computed as k, watch as A, nextTick as N, inject as Pe, getCurrentInstance as je, onMounted as ge, defineComponent as Oe, provide as bt, onBeforeUnmount as pt, resolveComponent as gt, createElementBlock as x, openBlock as C, createElementVNode as O, createCommentVNode as ie, normalizeClass as H, renderSlot as le, createVNode as Ae, TransitionGroup as mt, mergeProps as se, withCtx as ue, Fragment as Ke, renderList as Ee, withModifiers as ce, toDisplayString as Ie, createBlock as J, normalizeProps as vt, Transition as yt, resolveDynamicComponent as fe, KeepAlive as ht, normalizeStyle as Tt, isRef as kt, isReadonly as wt } from "vue";
|
|
3
3
|
import { RouterView as Ct } from "vue-router";
|
|
4
4
|
function Rt(e = {}) {
|
|
5
5
|
return {
|
|
@@ -11,7 +11,7 @@ function Rt(e = {}) {
|
|
|
11
11
|
defaultRoute: e.defaultRoute ?? "/"
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function U(e, n) {
|
|
15
15
|
const o = e.resolve(n);
|
|
16
16
|
if (!o || !o.matched.length)
|
|
17
17
|
throw new Error(`[RouterTabs] Unable to resolve route: ${String(n)}`);
|
|
@@ -24,7 +24,7 @@ const Pt = {
|
|
|
24
24
|
full: (e) => e.fullPath,
|
|
25
25
|
name: (e) => e.name ? String(e.name) : e.fullPath
|
|
26
26
|
};
|
|
27
|
-
function
|
|
27
|
+
function V(e) {
|
|
28
28
|
const n = e.meta?.key;
|
|
29
29
|
if (typeof n == "function") {
|
|
30
30
|
const o = n(e);
|
|
@@ -35,34 +35,34 @@ function N(e) {
|
|
|
35
35
|
}
|
|
36
36
|
return e.fullPath;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function me(e, n) {
|
|
39
39
|
const o = e.meta?.keepAlive;
|
|
40
40
|
return typeof o == "boolean" ? o : n;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function ve(e, n) {
|
|
43
43
|
const o = e.meta?.reuse;
|
|
44
44
|
return typeof o == "boolean" ? o : n;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Ue(e) {
|
|
47
47
|
const n = e.meta ?? {}, o = {};
|
|
48
48
|
return "title" in n && (o.title = n.title), "tips" in n && (o.tips = n.tips), "icon" in n && (o.icon = n.icon), "closable" in n && (o.closable = n.closable), "tabClass" in n && (o.tabClass = n.tabClass), "target" in n && (o.target = n.target), "href" in n && (o.href = n.href), o;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const l =
|
|
50
|
+
function q(e, n, o) {
|
|
51
|
+
const l = Ue(e);
|
|
52
52
|
return {
|
|
53
|
-
id:
|
|
53
|
+
id: V(e),
|
|
54
54
|
to: e.fullPath,
|
|
55
55
|
fullPath: e.fullPath,
|
|
56
56
|
matched: e,
|
|
57
|
-
alive:
|
|
58
|
-
reusable:
|
|
57
|
+
alive: me(e, o),
|
|
58
|
+
reusable: ve(e, !1),
|
|
59
59
|
closable: l.closable ?? !0,
|
|
60
60
|
renderKey: typeof n.renderKey == "number" ? n.renderKey : 0,
|
|
61
61
|
...l,
|
|
62
62
|
...n
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function de(e, n, o, l) {
|
|
66
66
|
if (!e.find((p) => p.id === n.id)) {
|
|
67
67
|
if (o === "next" && l) {
|
|
68
68
|
const p = e.findIndex((T) => T.id === l);
|
|
@@ -74,7 +74,7 @@ function be(e, n, o, l) {
|
|
|
74
74
|
e.push(n);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function xe(e, n, o) {
|
|
78
78
|
if (!n || n <= 0) return;
|
|
79
79
|
const l = e.filter((r) => r.alive);
|
|
80
80
|
for (; l.length > n; ) {
|
|
@@ -95,48 +95,48 @@ function At(e) {
|
|
|
95
95
|
renderKey: e.renderKey
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function Kt(e) {
|
|
99
99
|
const n = {};
|
|
100
100
|
return "title" in e && (n.title = e.title), "tips" in e && (n.tips = e.tips), "icon" in e && (n.icon = e.icon), "tabClass" in e && (n.tabClass = e.tabClass), "closable" in e && (n.closable = e.closable), "renderKey" in e && typeof e.renderKey == "number" && (n.renderKey = e.renderKey), n;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
const o = Rt(n), l =
|
|
104
|
-
() => l.filter((i) => i.alive).map((i) => `${i.id}::${i.renderKey}`)
|
|
102
|
+
function Et(e, n = {}) {
|
|
103
|
+
const o = Rt(n), l = pe([]), r = $(null), p = dt(), T = $(null), s = k(
|
|
104
|
+
() => l.filter((i) => i.alive).map((i) => `${i.id}::${i.renderKey ?? 0}`)
|
|
105
105
|
);
|
|
106
106
|
let c = !1;
|
|
107
107
|
function g(i) {
|
|
108
|
-
const b = typeof i.matched == "object" ? i :
|
|
108
|
+
const b = typeof i.matched == "object" ? i : U(e, i);
|
|
109
109
|
return {
|
|
110
|
-
key:
|
|
110
|
+
key: V(b),
|
|
111
111
|
fullPath: b.fullPath,
|
|
112
|
-
alive:
|
|
113
|
-
reusable:
|
|
112
|
+
alive: me(b, o.keepAlive),
|
|
113
|
+
reusable: ve(b, !1),
|
|
114
114
|
matched: b
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
const b =
|
|
117
|
+
function P(i) {
|
|
118
|
+
const b = V(i);
|
|
119
119
|
let d = l.find((h) => h.id === b);
|
|
120
|
-
return d ? (d.fullPath = i.fullPath, d.to = i.fullPath, d.matched = i, d.alive =
|
|
120
|
+
return d ? (d.fullPath = i.fullPath, d.to = i.fullPath, d.matched = i, d.alive = me(i, o.keepAlive), d.reusable = ve(i, d.reusable), typeof d.renderKey != "number" && (d.renderKey = 0), Object.assign(d, Ue(i)), d) : (d = q(i, {}, o.keepAlive), de(l, d, o.appendPosition, r.value), xe(l, o.maxAlive, r.value), d);
|
|
121
121
|
}
|
|
122
|
-
async function
|
|
123
|
-
const h =
|
|
124
|
-
d === "sameTab" && (d =
|
|
122
|
+
async function D(i, b = !1, d = !0) {
|
|
123
|
+
const h = U(e, i), w = V(h), K = r.value === w;
|
|
124
|
+
d === "sameTab" && (d = K), d && await L(w, !0), await e[b ? "replace" : "push"](h), K && await y();
|
|
125
125
|
}
|
|
126
126
|
function B(i) {
|
|
127
|
-
const b = l.findIndex((
|
|
127
|
+
const b = l.findIndex((I) => I.id === i);
|
|
128
128
|
if (b === -1) return o.defaultRoute;
|
|
129
|
-
const d = l[b + 1], h = l[b - 1], w = l.find((
|
|
130
|
-
return
|
|
129
|
+
const d = l[b + 1], h = l[b - 1], w = l.find((I) => I.id !== i), K = d || h || w;
|
|
130
|
+
return K ? K.to : o.defaultRoute;
|
|
131
131
|
}
|
|
132
132
|
async function z(i = r.value, b = {}) {
|
|
133
133
|
if (!i) return;
|
|
134
134
|
if (!b.force && o.keepLastTab && l.length === 1)
|
|
135
135
|
throw new Error("[RouterTabs] Unable to close the final tab when keepLastTab is true.");
|
|
136
136
|
const h = r.value === i && b.redirect !== null, w = h ? b.redirect ?? B(i) : null;
|
|
137
|
-
await
|
|
137
|
+
await _(i, { force: b.force }), b.redirect !== null && h && w && await e.replace(w);
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
139
|
+
async function _(i, b = {}) {
|
|
140
140
|
const d = l.findIndex((h) => h.id === i);
|
|
141
141
|
d !== -1 && (l.splice(d, 1), T.value === i && (T.value = null), r.value === i && (r.value = null, p.value = void 0));
|
|
142
142
|
}
|
|
@@ -145,16 +145,16 @@ function Kt(e, n = {}) {
|
|
|
145
145
|
const d = l.find((w) => w.id === i);
|
|
146
146
|
if (!d) return;
|
|
147
147
|
const h = o.keepAlive && d.alive;
|
|
148
|
-
h && (d.alive = !1, await
|
|
148
|
+
h && (d.alive = !1, await N()), d.renderKey = (d.renderKey ?? 0) + 1, h && (d.alive = !0), T.value = i, await N(), b || await N(), T.value = null;
|
|
149
149
|
}
|
|
150
|
-
async function
|
|
150
|
+
async function te(i = !1) {
|
|
151
151
|
for (const b of l)
|
|
152
152
|
await L(b.id, i);
|
|
153
153
|
}
|
|
154
|
-
async function
|
|
154
|
+
async function ne(i = o.defaultRoute) {
|
|
155
155
|
l.splice(0, l.length), r.value = null, p.value = void 0;
|
|
156
156
|
for (const b of o.initialTabs) {
|
|
157
|
-
const d =
|
|
157
|
+
const d = U(e, b.to), h = q(d, b, o.keepAlive);
|
|
158
158
|
l.push(h);
|
|
159
159
|
}
|
|
160
160
|
await e.replace(i);
|
|
@@ -164,7 +164,7 @@ function Kt(e, n = {}) {
|
|
|
164
164
|
i && await L(i, !0);
|
|
165
165
|
}
|
|
166
166
|
function G(i) {
|
|
167
|
-
return typeof i.matched == "object" ?
|
|
167
|
+
return typeof i.matched == "object" ? V(i) : V(U(e, i));
|
|
168
168
|
}
|
|
169
169
|
function M() {
|
|
170
170
|
const i = l.find((b) => b.id === r.value);
|
|
@@ -173,13 +173,13 @@ function Kt(e, n = {}) {
|
|
|
173
173
|
active: i ? i.to : null
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
-
async function
|
|
176
|
+
async function S(i) {
|
|
177
177
|
c = !0, l.splice(0, l.length), r.value = null, p.value = void 0;
|
|
178
178
|
const b = i?.tabs ?? [];
|
|
179
179
|
for (const h of b)
|
|
180
180
|
try {
|
|
181
|
-
const w =
|
|
182
|
-
|
|
181
|
+
const w = U(e, h.to), K = Kt(h), I = q(w, K, o.keepAlive);
|
|
182
|
+
de(l, I, "last", null);
|
|
183
183
|
} catch {
|
|
184
184
|
}
|
|
185
185
|
c = !1;
|
|
@@ -194,13 +194,13 @@ function Kt(e, n = {}) {
|
|
|
194
194
|
() => e.currentRoute.value,
|
|
195
195
|
(i) => {
|
|
196
196
|
if (c) return;
|
|
197
|
-
const b =
|
|
198
|
-
r.value = b.id, p.value = b,
|
|
197
|
+
const b = P(i);
|
|
198
|
+
r.value = b.id, p.value = b, xe(l, o.maxAlive, r.value);
|
|
199
199
|
},
|
|
200
200
|
{ immediate: !0 }
|
|
201
201
|
), o.initialTabs.length && o.initialTabs.forEach((i) => {
|
|
202
|
-
const b =
|
|
203
|
-
|
|
202
|
+
const b = U(e, i.to), d = q(b, i, o.keepAlive);
|
|
203
|
+
de(l, d, "last", null);
|
|
204
204
|
}), {
|
|
205
205
|
options: o,
|
|
206
206
|
tabs: l,
|
|
@@ -208,29 +208,29 @@ function Kt(e, n = {}) {
|
|
|
208
208
|
current: p,
|
|
209
209
|
includeKeys: s,
|
|
210
210
|
refreshingKey: T,
|
|
211
|
-
openTab:
|
|
211
|
+
openTab: D,
|
|
212
212
|
closeTab: z,
|
|
213
|
-
removeTab:
|
|
213
|
+
removeTab: _,
|
|
214
214
|
refreshTab: L,
|
|
215
|
-
refreshAll:
|
|
216
|
-
reset:
|
|
215
|
+
refreshAll: te,
|
|
216
|
+
reset: ne,
|
|
217
217
|
reload: y,
|
|
218
218
|
getRouteKey: G,
|
|
219
219
|
matchRoute: g,
|
|
220
220
|
snapshot: M,
|
|
221
|
-
hydrate:
|
|
221
|
+
hydrate: S
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
224
|
function De(e) {
|
|
225
225
|
return e ? typeof e == "string" ? { name: e } : e : {};
|
|
226
226
|
}
|
|
227
|
-
const
|
|
228
|
-
function
|
|
229
|
-
const { optional: n = !1 } = e, o =
|
|
227
|
+
const ee = Symbol("RouterTabsContext"), Z = "router-tabs:snapshot";
|
|
228
|
+
function Se(e = {}) {
|
|
229
|
+
const { optional: n = !1 } = e, o = Pe(ee, null);
|
|
230
230
|
if (o) return o;
|
|
231
|
-
const l =
|
|
231
|
+
const l = Pe("$tabs", null);
|
|
232
232
|
if (l) return l;
|
|
233
|
-
const p =
|
|
233
|
+
const p = je()?.appContext.config.globalProperties.$tabs;
|
|
234
234
|
if (p) return p;
|
|
235
235
|
if (!n)
|
|
236
236
|
throw new Error("[RouterTabs] useRouterTabs must be used within <router-tab>.");
|
|
@@ -245,7 +245,7 @@ function xt(e) {
|
|
|
245
245
|
return decodeURIComponent(l.slice(n.length));
|
|
246
246
|
return null;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function $e(e, n, o) {
|
|
249
249
|
if (typeof document > "u") return;
|
|
250
250
|
const {
|
|
251
251
|
expiresInDays: l = 7,
|
|
@@ -260,12 +260,12 @@ function Be(e, n, o) {
|
|
|
260
260
|
}
|
|
261
261
|
r && c.push(`Path=${r}`), p && c.push(`Domain=${p}`), T && c.push("Secure"), s && c.push(`SameSite=${s.charAt(0).toUpperCase()}${s.slice(1)}`), document.cookie = c.join("; ");
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function Be(e, n) {
|
|
264
264
|
if (typeof document > "u") return;
|
|
265
265
|
const { path: o = "/", domain: l } = n, r = [`${encodeURIComponent(e)}=`];
|
|
266
266
|
r.push("Expires=Thu, 01 Jan 1970 00:00:01 GMT"), o && r.push(`Path=${o}`), l && r.push(`Domain=${l}`), document.cookie = r.join("; ");
|
|
267
267
|
}
|
|
268
|
-
const
|
|
268
|
+
const Dt = (e) => JSON.stringify(e ?? null), St = (e) => {
|
|
269
269
|
if (!e) return null;
|
|
270
270
|
try {
|
|
271
271
|
return JSON.parse(e);
|
|
@@ -273,20 +273,20 @@ const St = (e) => JSON.stringify(e ?? null), Dt = (e) => {
|
|
|
273
273
|
return null;
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
-
function
|
|
276
|
+
function Ve(e = {}) {
|
|
277
277
|
const {
|
|
278
|
-
cookieKey: n =
|
|
279
|
-
serialize: o =
|
|
280
|
-
deserialize: l =
|
|
281
|
-
} = e, r =
|
|
282
|
-
|
|
278
|
+
cookieKey: n = Z,
|
|
279
|
+
serialize: o = Dt,
|
|
280
|
+
deserialize: l = St
|
|
281
|
+
} = e, r = Se({ optional: !0 }), p = $(!0), T = (s) => {
|
|
282
|
+
ge(async () => {
|
|
283
283
|
const c = l(xt(n));
|
|
284
284
|
if (c && c.tabs?.length)
|
|
285
285
|
try {
|
|
286
286
|
if (p.value = !0, await s.hydrate(c), c.active) {
|
|
287
|
-
await
|
|
288
|
-
const
|
|
289
|
-
|
|
287
|
+
await N();
|
|
288
|
+
const P = s.tabs.find((D) => D.to === c.active);
|
|
289
|
+
P && (s.activeId.value = P.id, s.current.value = P);
|
|
290
290
|
}
|
|
291
291
|
} finally {
|
|
292
292
|
p.value = !1;
|
|
@@ -294,15 +294,15 @@ function Ne(e = {}) {
|
|
|
294
294
|
else if (Object.prototype.hasOwnProperty.call(e, "fallbackRoute"))
|
|
295
295
|
try {
|
|
296
296
|
p.value = !0;
|
|
297
|
-
const
|
|
298
|
-
await s.reset(
|
|
297
|
+
const P = e.fallbackRoute ?? s.options.defaultRoute;
|
|
298
|
+
await s.reset(P);
|
|
299
299
|
} finally {
|
|
300
300
|
p.value = !1;
|
|
301
301
|
}
|
|
302
302
|
else
|
|
303
303
|
p.value = !1;
|
|
304
304
|
const g = s.snapshot();
|
|
305
|
-
g.tabs.length ?
|
|
305
|
+
g.tabs.length ? $e(n, o(g), e) : Be(n, e), p.value = !1;
|
|
306
306
|
}), A(
|
|
307
307
|
() => ({
|
|
308
308
|
tabs: s.tabs.map((c) => ({
|
|
@@ -319,17 +319,17 @@ function Ne(e = {}) {
|
|
|
319
319
|
() => {
|
|
320
320
|
if (p.value) return;
|
|
321
321
|
const c = s.snapshot();
|
|
322
|
-
c.tabs.length ?
|
|
322
|
+
c.tabs.length ? $e(n, o(c), e) : Be(n, e);
|
|
323
323
|
},
|
|
324
324
|
{ deep: !0 }
|
|
325
325
|
);
|
|
326
326
|
};
|
|
327
|
-
r ? T(r) :
|
|
328
|
-
const s =
|
|
327
|
+
r ? T(r) : ge(() => {
|
|
328
|
+
const s = Se({ optional: !0 });
|
|
329
329
|
s && T(s);
|
|
330
330
|
});
|
|
331
331
|
}
|
|
332
|
-
const $t =
|
|
332
|
+
const $t = Oe({
|
|
333
333
|
name: "RouterTab",
|
|
334
334
|
components: { RouterView: Ct },
|
|
335
335
|
props: {
|
|
@@ -371,7 +371,7 @@ const $t = Ue({
|
|
|
371
371
|
},
|
|
372
372
|
cookieKey: {
|
|
373
373
|
type: String,
|
|
374
|
-
default:
|
|
374
|
+
default: Z
|
|
375
375
|
},
|
|
376
376
|
persistence: {
|
|
377
377
|
type: Object,
|
|
@@ -384,13 +384,13 @@ const $t = Ue({
|
|
|
384
384
|
},
|
|
385
385
|
emits: ["tab-sort", "tab-sorted"],
|
|
386
386
|
setup(e, { emit: n }) {
|
|
387
|
-
const o =
|
|
387
|
+
const o = je();
|
|
388
388
|
if (!o)
|
|
389
389
|
throw new Error("[RouterTab] component must be used within a Vue application context.");
|
|
390
390
|
const l = o.appContext.app.config.globalProperties.$router;
|
|
391
391
|
if (!l)
|
|
392
392
|
throw new Error("[RouterTab] Vue Router is required. Make sure to call app.use(router) before RouterTab.");
|
|
393
|
-
const r =
|
|
393
|
+
const r = Et(l, {
|
|
394
394
|
initialTabs: e.tabs,
|
|
395
395
|
keepAlive: e.keepAlive,
|
|
396
396
|
maxAlive: e.maxAlive,
|
|
@@ -398,22 +398,22 @@ const $t = Ue({
|
|
|
398
398
|
appendPosition: e.append,
|
|
399
399
|
defaultRoute: e.defaultPage
|
|
400
400
|
});
|
|
401
|
-
|
|
401
|
+
bt(ee, r), o.appContext.config.globalProperties.$tabs = r;
|
|
402
402
|
const p = k(() => !!o?.slots?.default), T = k(() => !!o?.slots?.start), s = k(() => !!o?.slots?.end), c = $(0), g = k(() => {
|
|
403
403
|
c.value;
|
|
404
404
|
const t = {};
|
|
405
405
|
return r.tabs.forEach((a) => {
|
|
406
|
-
const f = typeof a.title == "string" ? a.title : String(a.title ||
|
|
406
|
+
const f = typeof a.title == "string" ? a.title : String(a.title || oe(a));
|
|
407
407
|
t[a.id] = f;
|
|
408
408
|
}), t;
|
|
409
409
|
});
|
|
410
|
-
function
|
|
410
|
+
function P() {
|
|
411
411
|
c.value++;
|
|
412
412
|
}
|
|
413
|
-
const
|
|
413
|
+
const D = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map();
|
|
414
414
|
function z(t, a) {
|
|
415
|
-
if (!a ||
|
|
416
|
-
|
|
415
|
+
if (!a || D.has(t)) return;
|
|
416
|
+
D.set(t, a);
|
|
417
417
|
const f = r.tabs.find((v) => r.getRouteKey(v.to) === t);
|
|
418
418
|
if (!f) return;
|
|
419
419
|
const m = [];
|
|
@@ -426,7 +426,7 @@ const $t = Ue({
|
|
|
426
426
|
(u) => {
|
|
427
427
|
if (u != null) {
|
|
428
428
|
const j = String(u);
|
|
429
|
-
f.title = j,
|
|
429
|
+
f.title = j, P();
|
|
430
430
|
}
|
|
431
431
|
},
|
|
432
432
|
{ immediate: !0 }
|
|
@@ -440,7 +440,7 @@ const $t = Ue({
|
|
|
440
440
|
return u && typeof u == "object" && "value" in u ? u.value : u;
|
|
441
441
|
},
|
|
442
442
|
(u) => {
|
|
443
|
-
u != null && (f.icon = String(u),
|
|
443
|
+
u != null && (f.icon = String(u), P());
|
|
444
444
|
},
|
|
445
445
|
{ immediate: !0 }
|
|
446
446
|
);
|
|
@@ -453,7 +453,7 @@ const $t = Ue({
|
|
|
453
453
|
return u && typeof u == "object" && "value" in u ? u.value : u;
|
|
454
454
|
},
|
|
455
455
|
(u) => {
|
|
456
|
-
u != null && (f.closable = !!u,
|
|
456
|
+
u != null && (f.closable = !!u, P());
|
|
457
457
|
},
|
|
458
458
|
{ immediate: !0 }
|
|
459
459
|
);
|
|
@@ -466,7 +466,7 @@ const $t = Ue({
|
|
|
466
466
|
return u && typeof u == "object" && "value" in u ? u.value : u;
|
|
467
467
|
},
|
|
468
468
|
(u) => {
|
|
469
|
-
u && typeof u == "object" && (Object.assign(f, u),
|
|
469
|
+
u && typeof u == "object" && (Object.assign(f, u), P());
|
|
470
470
|
},
|
|
471
471
|
{ immediate: !0, deep: !0 }
|
|
472
472
|
);
|
|
@@ -474,24 +474,24 @@ const $t = Ue({
|
|
|
474
474
|
}
|
|
475
475
|
B.set(t, m);
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function _(t) {
|
|
478
478
|
const a = B.get(t);
|
|
479
|
-
a && (a.forEach((f) => f()), B.delete(t)),
|
|
479
|
+
a && (a.forEach((f) => f()), B.delete(t)), D.delete(t);
|
|
480
480
|
}
|
|
481
481
|
function L(t, a) {
|
|
482
|
-
t ? t.routeTabTitle !== void 0 || t.routeTabIcon !== void 0 || t.routeTabClosable !== void 0 ? z(a, t) : t.$ && (t.$.routeTabTitle !== void 0 || t.$.routeTabIcon !== void 0 || t.$.routeTabClosable !== void 0) && z(a, t.$) : t === null &&
|
|
482
|
+
t ? t.routeTabTitle !== void 0 || t.routeTabIcon !== void 0 || t.routeTabClosable !== void 0 ? z(a, t) : t.$ && (t.$.routeTabTitle !== void 0 || t.$.routeTabIcon !== void 0 || t.$.routeTabClosable !== void 0) && z(a, t.$) : t === null && _(a);
|
|
483
483
|
}
|
|
484
484
|
if (e.cookieKey !== null || e.persistence) {
|
|
485
485
|
const t = {
|
|
486
486
|
...e.persistence ?? {}
|
|
487
487
|
};
|
|
488
|
-
e.cookieKey !== null ? t.cookieKey = e.cookieKey ||
|
|
488
|
+
e.cookieKey !== null ? t.cookieKey = e.cookieKey || Z : t.cookieKey || (t.cookieKey = Z), Ve(t);
|
|
489
489
|
}
|
|
490
|
-
const
|
|
490
|
+
const te = k(() => De(e.tabTransition)), ne = k(() => De(e.pageTransition)), y = pe({
|
|
491
491
|
visible: !1,
|
|
492
492
|
target: null,
|
|
493
493
|
position: { x: 0, y: 0 }
|
|
494
|
-
}), G = $(null), M = $([]),
|
|
494
|
+
}), G = $(null), M = $([]), S = $(-1), i = pe({
|
|
495
495
|
dragging: !1,
|
|
496
496
|
dragIndex: -1,
|
|
497
497
|
dropIndex: -1,
|
|
@@ -515,10 +515,10 @@ const $t = Ue({
|
|
|
515
515
|
const a = d(t.id);
|
|
516
516
|
return a > -1 ? r.tabs.slice(a + 1) : [];
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function K(t) {
|
|
519
519
|
return r.tabs.filter((a) => a.id !== t.id);
|
|
520
520
|
}
|
|
521
|
-
async function
|
|
521
|
+
async function I(t, a) {
|
|
522
522
|
const f = t.filter((m) => m.closable !== !1);
|
|
523
523
|
if (f.length) {
|
|
524
524
|
for (const m of f)
|
|
@@ -526,7 +526,7 @@ const $t = Ue({
|
|
|
526
526
|
r.activeId.value !== a.id && await r.openTab(a.to, !0, !1);
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
|
-
const
|
|
529
|
+
const Fe = {
|
|
530
530
|
refresh: {
|
|
531
531
|
label: "Refresh",
|
|
532
532
|
handler: async ({ target: t }) => {
|
|
@@ -544,73 +544,73 @@ const $t = Ue({
|
|
|
544
544
|
handler: async ({ target: t }) => {
|
|
545
545
|
await r.closeTab(t.id);
|
|
546
546
|
},
|
|
547
|
-
enable: ({ target: t }) =>
|
|
547
|
+
enable: ({ target: t }) => ae(t)
|
|
548
548
|
},
|
|
549
549
|
closeLefts: {
|
|
550
550
|
label: "Close to the Left",
|
|
551
551
|
handler: async ({ target: t }) => {
|
|
552
|
-
await
|
|
552
|
+
await I(h(t), t);
|
|
553
553
|
},
|
|
554
554
|
enable: ({ target: t }) => h(t).some((a) => a.closable !== !1)
|
|
555
555
|
},
|
|
556
556
|
closeRights: {
|
|
557
557
|
label: "Close to the Right",
|
|
558
558
|
handler: async ({ target: t }) => {
|
|
559
|
-
await
|
|
559
|
+
await I(w(t), t);
|
|
560
560
|
},
|
|
561
561
|
enable: ({ target: t }) => w(t).some((a) => a.closable !== !1)
|
|
562
562
|
},
|
|
563
563
|
closeOthers: {
|
|
564
564
|
label: "Close Others",
|
|
565
565
|
handler: async ({ target: t }) => {
|
|
566
|
-
await
|
|
566
|
+
await I(K(t), t);
|
|
567
567
|
},
|
|
568
|
-
enable: ({ target: t }) =>
|
|
568
|
+
enable: ({ target: t }) => K(t).some((a) => a.closable !== !1)
|
|
569
569
|
}
|
|
570
570
|
};
|
|
571
|
-
function
|
|
572
|
-
y.visible = !1, y.target = null,
|
|
571
|
+
function E() {
|
|
572
|
+
y.visible = !1, y.target = null, S.value = -1, M.value = [];
|
|
573
573
|
}
|
|
574
|
-
function
|
|
575
|
-
e.contextmenu && (y.visible = !0, y.target = t, y.position.x = a.clientX, y.position.y = a.clientY, document.addEventListener("click",
|
|
576
|
-
|
|
574
|
+
function He(t, a) {
|
|
575
|
+
e.contextmenu && (y.visible = !0, y.target = t, y.position.x = a.clientX, y.position.y = a.clientY, document.addEventListener("click", E, { once: !0 }), N(() => {
|
|
576
|
+
We();
|
|
577
577
|
}));
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
const f = typeof t == "string" ? { id: t } : t, m =
|
|
579
|
+
function Je(t, a) {
|
|
580
|
+
const f = typeof t == "string" ? { id: t } : t, m = Fe[f.id], v = f.label ?? m?.label ?? String(f.id), u = f.visible ?? m?.visible ?? !0;
|
|
581
581
|
if (!(typeof u == "function" ? u(a) : u !== !1)) return null;
|
|
582
|
-
const
|
|
583
|
-
if (!
|
|
584
|
-
const
|
|
585
|
-
await Promise.resolve(
|
|
582
|
+
const re = f.enable ?? m?.enable ?? !0, ct = typeof re == "function" ? re(a) : re !== !1, Re = f.handler ?? m?.handler;
|
|
583
|
+
if (!Re) return null;
|
|
584
|
+
const ft = async () => {
|
|
585
|
+
await Promise.resolve(Re(a));
|
|
586
586
|
};
|
|
587
587
|
return {
|
|
588
588
|
id: String(f.id),
|
|
589
589
|
label: v,
|
|
590
|
-
disabled: !
|
|
591
|
-
action:
|
|
590
|
+
disabled: !ct,
|
|
591
|
+
action: ft
|
|
592
592
|
};
|
|
593
593
|
}
|
|
594
|
-
const
|
|
594
|
+
const Y = k(() => {
|
|
595
595
|
if (!y.visible || !y.target || e.contextmenu === !1) return [];
|
|
596
596
|
const t = Array.isArray(e.contextmenu) ? e.contextmenu : b, a = { target: y.target, controller: r };
|
|
597
|
-
return t.map((f) =>
|
|
597
|
+
return t.map((f) => Je(f, a)).filter((f) => !!f);
|
|
598
598
|
});
|
|
599
|
-
function
|
|
599
|
+
function We() {
|
|
600
600
|
const t = G.value;
|
|
601
601
|
if (!t) return;
|
|
602
602
|
const a = 8, { innerWidth: f, innerHeight: m } = window, v = t.getBoundingClientRect();
|
|
603
603
|
let u = y.position.x, j = y.position.y;
|
|
604
604
|
v.right > f - a && (u = Math.max(a, f - v.width - a)), v.bottom > m - a && (j = Math.max(a, m - v.height - a)), (u !== y.position.x || j !== y.position.y) && (y.position.x = u, y.position.y = j);
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function Ge(t, a) {
|
|
607
607
|
M.value[a] = t ?? null;
|
|
608
608
|
}
|
|
609
|
-
function
|
|
609
|
+
function Xe(t) {
|
|
610
610
|
if (t < 0) return;
|
|
611
611
|
M.value[t]?.focus({ preventScroll: !0 });
|
|
612
612
|
}
|
|
613
|
-
function X(t, a, f =
|
|
613
|
+
function X(t, a, f = Y.value) {
|
|
614
614
|
if (!f.length) return -1;
|
|
615
615
|
const m = f.length;
|
|
616
616
|
let v = t;
|
|
@@ -618,19 +618,19 @@ const $t = Ue({
|
|
|
618
618
|
if (v = (v + a + m) % m, !f[v].disabled) return v;
|
|
619
619
|
return -1;
|
|
620
620
|
}
|
|
621
|
-
function
|
|
622
|
-
|
|
621
|
+
function F(t) {
|
|
622
|
+
S.value = t, !(t < 0) && N(() => Xe(t));
|
|
623
623
|
}
|
|
624
|
-
function
|
|
625
|
-
const a = X(
|
|
626
|
-
a !== -1 &&
|
|
624
|
+
function Te(t) {
|
|
625
|
+
const a = X(S.value, t);
|
|
626
|
+
a !== -1 && F(a);
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function qe(t) {
|
|
629
629
|
if (!y.visible) return;
|
|
630
|
-
const a = t.key, f =
|
|
630
|
+
const a = t.key, f = Y.value;
|
|
631
631
|
if (!f.length) return;
|
|
632
632
|
if (a === "Tab") {
|
|
633
|
-
|
|
633
|
+
E();
|
|
634
634
|
return;
|
|
635
635
|
}
|
|
636
636
|
if ([
|
|
@@ -648,90 +648,90 @@ const $t = Ue({
|
|
|
648
648
|
switch (t.preventDefault(), a) {
|
|
649
649
|
case "ArrowDown":
|
|
650
650
|
case "ArrowRight":
|
|
651
|
-
|
|
651
|
+
Te(1);
|
|
652
652
|
break;
|
|
653
653
|
case "ArrowUp":
|
|
654
654
|
case "ArrowLeft":
|
|
655
|
-
|
|
655
|
+
Te(-1);
|
|
656
656
|
break;
|
|
657
657
|
case "Home":
|
|
658
|
-
|
|
658
|
+
F(X(-1, 1));
|
|
659
659
|
break;
|
|
660
660
|
case "End":
|
|
661
|
-
|
|
661
|
+
F(X(f.length, -1));
|
|
662
662
|
break;
|
|
663
663
|
case "Enter":
|
|
664
664
|
case " ":
|
|
665
665
|
case "Spacebar": {
|
|
666
|
-
const v =
|
|
666
|
+
const v = S.value;
|
|
667
667
|
if (v > -1) {
|
|
668
668
|
const u = f[v];
|
|
669
|
-
u.disabled ||
|
|
669
|
+
u.disabled || ke(u);
|
|
670
670
|
}
|
|
671
671
|
break;
|
|
672
672
|
}
|
|
673
673
|
case "Escape":
|
|
674
|
-
|
|
674
|
+
E();
|
|
675
675
|
break;
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
|
-
async function
|
|
679
|
-
t.disabled || (
|
|
678
|
+
async function ke(t) {
|
|
679
|
+
t.disabled || (E(), await t.action());
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function oe(t) {
|
|
682
682
|
return typeof t.title == "string" && t.title.trim() ? t.title : Array.isArray(t.title) && t.title.length && String(t.title[0]).trim() ? String(t.title[0]) : "Untitled";
|
|
683
683
|
}
|
|
684
|
-
function
|
|
685
|
-
return g.value[t.id] ||
|
|
684
|
+
function Qe(t) {
|
|
685
|
+
return g.value[t.id] || oe(t);
|
|
686
686
|
}
|
|
687
|
-
function
|
|
687
|
+
function we(t) {
|
|
688
688
|
const a = r.getRouteKey(t), m = r.tabs.find((v) => v.id === a)?.renderKey ?? 0;
|
|
689
689
|
return `${a}::${m}`;
|
|
690
690
|
}
|
|
691
|
-
function
|
|
692
|
-
return `${
|
|
691
|
+
function Ze(t) {
|
|
692
|
+
return `${we(t)}::refresh`;
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function ae(t) {
|
|
695
695
|
return !(t.closable === !1 || r.options.keepLastTab && r.tabs.length <= 1);
|
|
696
696
|
}
|
|
697
|
-
async function
|
|
697
|
+
async function et(t) {
|
|
698
698
|
await r.closeTab(t.id);
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function tt(t) {
|
|
701
701
|
if (t.href && typeof window < "u") {
|
|
702
702
|
t.target && t.target !== "_self" ? window.open(t.href, t.target) : window.location.assign(t.href);
|
|
703
703
|
return;
|
|
704
704
|
}
|
|
705
705
|
r.activeId.value !== t.id && r.openTab(t.to, !1);
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function nt(t) {
|
|
708
708
|
return [
|
|
709
709
|
"router-tab__item",
|
|
710
710
|
{
|
|
711
711
|
"is-active": r.activeId.value === t.id,
|
|
712
|
-
"is-closable":
|
|
712
|
+
"is-closable": ae(t),
|
|
713
713
|
"is-dragging": i.dragging && i.dragTab?.id === t.id,
|
|
714
714
|
"is-drag-over": i.dropIndex === d(t.id)
|
|
715
715
|
},
|
|
716
716
|
t.tabClass
|
|
717
717
|
];
|
|
718
718
|
}
|
|
719
|
-
function
|
|
719
|
+
function ot(t) {
|
|
720
720
|
return r.refreshingKey.value === r.getRouteKey(t);
|
|
721
721
|
}
|
|
722
|
-
function
|
|
722
|
+
function at(t, a, f) {
|
|
723
723
|
e.sortable && (i.dragging = !0, i.dragIndex = a, i.dragTab = t, f.dataTransfer && (f.dataTransfer.effectAllowed = "move", f.dataTransfer.setData("text/plain", t.id)), n("tab-sort", { tab: t, index: a }));
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function rt(t, a) {
|
|
726
726
|
!e.sortable || !i.dragging || (a.preventDefault(), a.dataTransfer && (a.dataTransfer.dropEffect = "move"));
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function it(t) {
|
|
729
729
|
!e.sortable || !i.dragging || (i.dropIndex = t);
|
|
730
730
|
}
|
|
731
|
-
function
|
|
731
|
+
function lt() {
|
|
732
732
|
!e.sortable || i.dragging;
|
|
733
733
|
}
|
|
734
|
-
function
|
|
734
|
+
function st(t, a) {
|
|
735
735
|
if (!(!e.sortable || !i.dragging)) {
|
|
736
736
|
if (a.preventDefault(), i.dragIndex !== -1 && i.dragIndex !== t) {
|
|
737
737
|
const f = r.tabs.splice(i.dragIndex, 1)[0];
|
|
@@ -741,18 +741,18 @@ const $t = Ue({
|
|
|
741
741
|
toIndex: t
|
|
742
742
|
});
|
|
743
743
|
}
|
|
744
|
-
|
|
744
|
+
Ce();
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
|
-
function
|
|
747
|
+
function Ce() {
|
|
748
748
|
i.dragging = !1, i.dragIndex = -1, i.dropIndex = -1, i.dragTab = null;
|
|
749
749
|
}
|
|
750
|
-
|
|
751
|
-
document.addEventListener("keydown",
|
|
752
|
-
}),
|
|
753
|
-
document.removeEventListener("keydown",
|
|
750
|
+
ge(() => {
|
|
751
|
+
document.addEventListener("keydown", E);
|
|
752
|
+
}), pt(() => {
|
|
753
|
+
document.removeEventListener("keydown", E), o.appContext.config.globalProperties.$tabs = null, B.forEach((t) => {
|
|
754
754
|
t.forEach((a) => a());
|
|
755
|
-
}), B.clear(),
|
|
755
|
+
}), B.clear(), D.clear();
|
|
756
756
|
}), A(
|
|
757
757
|
() => e.keepAlive,
|
|
758
758
|
(t) => {
|
|
@@ -760,66 +760,66 @@ const $t = Ue({
|
|
|
760
760
|
}
|
|
761
761
|
), A(
|
|
762
762
|
() => r.activeId.value,
|
|
763
|
-
() =>
|
|
763
|
+
() => E()
|
|
764
764
|
), A(
|
|
765
765
|
() => e.contextmenu,
|
|
766
766
|
(t) => {
|
|
767
|
-
t ||
|
|
767
|
+
t || E();
|
|
768
768
|
}
|
|
769
769
|
), A(
|
|
770
|
-
() =>
|
|
770
|
+
() => Y.value.length,
|
|
771
771
|
(t) => {
|
|
772
|
-
y.visible && t === 0 &&
|
|
772
|
+
y.visible && t === 0 && E();
|
|
773
773
|
}
|
|
774
|
-
), A(
|
|
774
|
+
), A(Y, (t) => {
|
|
775
775
|
if (M.value = new Array(t.length).fill(null), !y.visible) return;
|
|
776
776
|
const a = X(-1, 1, t);
|
|
777
|
-
|
|
777
|
+
F(a);
|
|
778
778
|
}), A(
|
|
779
779
|
() => y.visible,
|
|
780
780
|
(t) => {
|
|
781
|
-
t || (
|
|
781
|
+
t || (S.value = -1, M.value = []);
|
|
782
782
|
}
|
|
783
783
|
);
|
|
784
|
-
const
|
|
784
|
+
const ut = r.includeKeys;
|
|
785
785
|
return {
|
|
786
786
|
controller: r,
|
|
787
787
|
tabs: r.tabs,
|
|
788
|
-
includeKeys:
|
|
789
|
-
tabTransitionProps:
|
|
790
|
-
pageTransitionProps:
|
|
791
|
-
buildTabClass:
|
|
792
|
-
activate:
|
|
793
|
-
close:
|
|
788
|
+
includeKeys: ut,
|
|
789
|
+
tabTransitionProps: te,
|
|
790
|
+
pageTransitionProps: ne,
|
|
791
|
+
buildTabClass: nt,
|
|
792
|
+
activate: tt,
|
|
793
|
+
close: et,
|
|
794
794
|
context: y,
|
|
795
|
-
menuItems:
|
|
796
|
-
handleMenuAction:
|
|
797
|
-
showContextMenu:
|
|
798
|
-
hideContextMenu:
|
|
799
|
-
getTabTitle:
|
|
800
|
-
isClosable:
|
|
801
|
-
isRefreshing:
|
|
795
|
+
menuItems: Y,
|
|
796
|
+
handleMenuAction: ke,
|
|
797
|
+
showContextMenu: He,
|
|
798
|
+
hideContextMenu: E,
|
|
799
|
+
getTabTitle: oe,
|
|
800
|
+
isClosable: ae,
|
|
801
|
+
isRefreshing: ot,
|
|
802
802
|
hasCustomSlot: p,
|
|
803
803
|
hasStartSlot: T,
|
|
804
804
|
hasEndSlot: s,
|
|
805
|
-
onDragStart:
|
|
806
|
-
onDragOver:
|
|
807
|
-
onDragEnter:
|
|
808
|
-
onDragLeave:
|
|
809
|
-
onDrop:
|
|
810
|
-
onDragEnd:
|
|
805
|
+
onDragStart: at,
|
|
806
|
+
onDragOver: rt,
|
|
807
|
+
onDragEnter: it,
|
|
808
|
+
onDragLeave: lt,
|
|
809
|
+
onDrop: st,
|
|
810
|
+
onDragEnd: Ce,
|
|
811
811
|
setupComponentWatching: z,
|
|
812
|
-
cleanupComponentWatching:
|
|
812
|
+
cleanupComponentWatching: _,
|
|
813
813
|
handleComponentRef: L,
|
|
814
|
-
getReactiveTabTitle:
|
|
815
|
-
getComponentCacheKey:
|
|
816
|
-
getRefreshComponentKey:
|
|
817
|
-
triggerTabUpdate:
|
|
814
|
+
getReactiveTabTitle: Qe,
|
|
815
|
+
getComponentCacheKey: we,
|
|
816
|
+
getRefreshComponentKey: Ze,
|
|
817
|
+
triggerTabUpdate: P,
|
|
818
818
|
menuRef: G,
|
|
819
|
-
highlightedIndex:
|
|
820
|
-
setMenuItemRef:
|
|
821
|
-
onMenuKeydown:
|
|
822
|
-
highlightMenuIndex:
|
|
819
|
+
highlightedIndex: S,
|
|
820
|
+
setMenuItemRef: Ge,
|
|
821
|
+
onMenuKeydown: qe,
|
|
822
|
+
highlightMenuIndex: F
|
|
823
823
|
};
|
|
824
824
|
}
|
|
825
825
|
}), Bt = (e, n) => {
|
|
@@ -827,30 +827,30 @@ const $t = Ue({
|
|
|
827
827
|
for (const [l, r] of n)
|
|
828
828
|
o[l] = r;
|
|
829
829
|
return o;
|
|
830
|
-
}, Mt = { class: "router-tab" }, Lt = { class: "router-tab__header" }, jt = { class: "router-tab__scroll" }, Ot = ["data-title", "draggable", "onClick", "onAuxclick", "onContextmenu", "onDragstart", "onDragover", "onDragenter", "onDrop"], Ut = ["title"], Vt = ["onClick"], Nt = { class: "router-tab__container" },
|
|
831
|
-
function
|
|
832
|
-
const T =
|
|
833
|
-
return
|
|
830
|
+
}, Mt = { class: "router-tab" }, Lt = { class: "router-tab__header" }, jt = { class: "router-tab__scroll" }, Ot = ["data-title", "draggable", "onClick", "onAuxclick", "onContextmenu", "onDragstart", "onDragover", "onDragenter", "onDrop"], Ut = ["title"], Vt = ["onClick"], Nt = { class: "router-tab__container" }, zt = ["aria-disabled", "disabled", "tabindex", "onMouseenter", "onClick"];
|
|
831
|
+
function _t(e, n, o, l, r, p) {
|
|
832
|
+
const T = gt("RouterView");
|
|
833
|
+
return C(), x("div", Mt, [
|
|
834
834
|
O("header", Lt, [
|
|
835
835
|
O("div", {
|
|
836
|
-
class:
|
|
836
|
+
class: H(["router-tab__slot-start", { "has-content": e.hasStartSlot }])
|
|
837
837
|
}, [
|
|
838
|
-
|
|
838
|
+
le(e.$slots, "start")
|
|
839
839
|
], 2),
|
|
840
840
|
O("div", jt, [
|
|
841
|
-
|
|
841
|
+
Ae(mt, se({
|
|
842
842
|
tag: "ul",
|
|
843
843
|
class: "router-tab__nav"
|
|
844
844
|
}, e.tabTransitionProps), {
|
|
845
|
-
default:
|
|
846
|
-
(
|
|
845
|
+
default: ue(() => [
|
|
846
|
+
(C(!0), x(Ke, null, Ee(e.tabs, (s, c) => (C(), x("li", {
|
|
847
847
|
key: s.id,
|
|
848
|
-
class:
|
|
848
|
+
class: H(e.buildTabClass(s)),
|
|
849
849
|
"data-title": e.getTabTitle(s),
|
|
850
850
|
draggable: e.sortable,
|
|
851
851
|
onClick: (g) => e.activate(s),
|
|
852
|
-
onAuxclick:
|
|
853
|
-
onContextmenu:
|
|
852
|
+
onAuxclick: ce((g) => e.close(s), ["middle", "prevent"]),
|
|
853
|
+
onContextmenu: ce((g) => e.showContextMenu(s, g), ["prevent"]),
|
|
854
854
|
onDragstart: (g) => e.onDragStart(s, c, g),
|
|
855
855
|
onDragover: (g) => e.onDragOver(c, g),
|
|
856
856
|
onDragenter: (g) => e.onDragEnter(c),
|
|
@@ -858,71 +858,67 @@ function zt(e, n, o, l, r, p) {
|
|
|
858
858
|
onDrop: (g) => e.onDrop(c, g),
|
|
859
859
|
onDragend: n[1] || (n[1] = (...g) => e.onDragEnd && e.onDragEnd(...g))
|
|
860
860
|
}, [
|
|
861
|
-
s.icon ? (
|
|
861
|
+
s.icon ? (C(), x("i", {
|
|
862
862
|
key: 0,
|
|
863
|
-
class:
|
|
864
|
-
}, null, 2)) :
|
|
863
|
+
class: H(["router-tab__item-icon", s.icon])
|
|
864
|
+
}, null, 2)) : ie("", !0),
|
|
865
865
|
O("span", {
|
|
866
866
|
class: "router-tab__item-title",
|
|
867
867
|
title: e.getReactiveTabTitle(s)
|
|
868
|
-
},
|
|
869
|
-
e.isClosable(s) ? (
|
|
868
|
+
}, Ie(e.getReactiveTabTitle(s)), 9, Ut),
|
|
869
|
+
e.isClosable(s) ? (C(), x("a", {
|
|
870
870
|
key: 1,
|
|
871
871
|
class: "router-tab__item-close",
|
|
872
|
-
onClick:
|
|
873
|
-
}, null, 8, Vt)) :
|
|
872
|
+
onClick: ce((g) => e.close(s), ["stop"])
|
|
873
|
+
}, null, 8, Vt)) : ie("", !0)
|
|
874
874
|
], 42, Ot))), 128))
|
|
875
875
|
]),
|
|
876
876
|
_: 1
|
|
877
877
|
}, 16)
|
|
878
878
|
]),
|
|
879
879
|
O("div", {
|
|
880
|
-
class:
|
|
880
|
+
class: H(["router-tab__slot-end", { "has-content": e.hasEndSlot }])
|
|
881
881
|
}, [
|
|
882
|
-
|
|
882
|
+
le(e.$slots, "end")
|
|
883
883
|
], 2)
|
|
884
884
|
]),
|
|
885
885
|
O("div", Nt, [
|
|
886
|
-
|
|
887
|
-
default:
|
|
888
|
-
e.hasCustomSlot ?
|
|
886
|
+
Ae(T, null, {
|
|
887
|
+
default: ue((s) => [
|
|
888
|
+
e.hasCustomSlot ? le(e.$slots, "default", vt(se({ key: 0 }, {
|
|
889
889
|
...s,
|
|
890
890
|
controller: e.controller,
|
|
891
891
|
// Expose a ref binder so custom slots can keep reactivity
|
|
892
892
|
pageRef: (c) => e.handleComponentRef(c, e.controller.getRouteKey(s.route))
|
|
893
|
-
}))) : (
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
e.
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
], 1032, ["include", "max"])) : U("", !0)
|
|
907
|
-
]),
|
|
908
|
-
_: 2
|
|
909
|
-
}, 1040),
|
|
910
|
-
q(Ie, Q(e.pageTransitionProps, { appear: "" }), {
|
|
911
|
-
default: Z(() => [
|
|
912
|
-
!e.controller.options.keepAlive || e.isRefreshing(s.route) ? (P(), de(xe(s.Component), {
|
|
913
|
-
key: e.getRefreshComponentKey(s.route),
|
|
893
|
+
}))) : (C(), J(yt, se({ key: 1 }, e.pageTransitionProps, { appear: "" }), {
|
|
894
|
+
default: ue(() => [
|
|
895
|
+
e.isRefreshing(s.route) ? (C(), J(fe(s.Component), {
|
|
896
|
+
key: e.getRefreshComponentKey(s.route),
|
|
897
|
+
ref: (c) => e.handleComponentRef(c, e.controller.getRouteKey(s.route)),
|
|
898
|
+
class: "router-tab-page"
|
|
899
|
+
})) : e.controller.options.keepAlive ? (C(), J(ht, {
|
|
900
|
+
key: 1,
|
|
901
|
+
include: e.includeKeys,
|
|
902
|
+
max: e.controller.options.maxAlive || void 0
|
|
903
|
+
}, [
|
|
904
|
+
(C(), J(fe(s.Component), {
|
|
905
|
+
key: e.getComponentCacheKey(s.route),
|
|
914
906
|
ref: (c) => e.handleComponentRef(c, e.controller.getRouteKey(s.route)),
|
|
915
907
|
class: "router-tab-page"
|
|
916
|
-
}))
|
|
917
|
-
]),
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
908
|
+
}))
|
|
909
|
+
], 1032, ["include", "max"])) : (C(), J(fe(s.Component), {
|
|
910
|
+
key: e.getComponentCacheKey(s.route),
|
|
911
|
+
ref: (c) => e.handleComponentRef(c, e.controller.getRouteKey(s.route)),
|
|
912
|
+
class: "router-tab-page"
|
|
913
|
+
}))
|
|
914
|
+
]),
|
|
915
|
+
_: 2
|
|
916
|
+
}, 1040))
|
|
921
917
|
]),
|
|
922
918
|
_: 3
|
|
923
919
|
})
|
|
924
920
|
]),
|
|
925
|
-
e.context.visible && e.context.target ? (
|
|
921
|
+
e.context.visible && e.context.target ? (C(), x("div", {
|
|
926
922
|
key: 0,
|
|
927
923
|
ref: "menuRef",
|
|
928
924
|
class: "router-tab__contextmenu",
|
|
@@ -930,10 +926,10 @@ function zt(e, n, o, l, r, p) {
|
|
|
930
926
|
onKeydown: n[2] || (n[2] = (...s) => e.onMenuKeydown && e.onMenuKeydown(...s)),
|
|
931
927
|
style: Tt({ left: e.context.position.x + "px", top: e.context.position.y + "px" })
|
|
932
928
|
}, [
|
|
933
|
-
(
|
|
929
|
+
(C(!0), x(Ke, null, Ee(e.menuItems, (s, c) => (C(), x("a", {
|
|
934
930
|
key: s.id,
|
|
935
931
|
role: "menuitem",
|
|
936
|
-
class:
|
|
932
|
+
class: H(["router-tab__contextmenu-item", { "is-focused": c === e.highlightedIndex }]),
|
|
937
933
|
"aria-disabled": s.disabled,
|
|
938
934
|
disabled: s.disabled,
|
|
939
935
|
tabindex: s.disabled ? -1 : c === e.highlightedIndex ? 0 : -1,
|
|
@@ -941,14 +937,14 @@ function zt(e, n, o, l, r, p) {
|
|
|
941
937
|
ref: (g) => e.setMenuItemRef(g, c),
|
|
942
938
|
onMouseenter: (g) => !s.disabled && e.highlightMenuIndex(c),
|
|
943
939
|
onClick: (g) => e.handleMenuAction(s)
|
|
944
|
-
},
|
|
945
|
-
], 36)) :
|
|
940
|
+
}, Ie(s.label), 43, zt))), 128))
|
|
941
|
+
], 36)) : ie("", !0)
|
|
946
942
|
]);
|
|
947
943
|
}
|
|
948
|
-
const
|
|
944
|
+
const Me = /* @__PURE__ */ Bt($t, [["render", _t]]), Yt = {
|
|
949
945
|
class: "router-tabs",
|
|
950
946
|
"aria-hidden": "true"
|
|
951
|
-
},
|
|
947
|
+
}, be = /* @__PURE__ */ Oe({
|
|
952
948
|
name: "RouterTabs",
|
|
953
949
|
__name: "RouterTabs",
|
|
954
950
|
props: {
|
|
@@ -963,11 +959,11 @@ const Le = /* @__PURE__ */ Bt($t, [["render", zt]]), Yt = {
|
|
|
963
959
|
fallbackRoute: {}
|
|
964
960
|
},
|
|
965
961
|
setup(e) {
|
|
966
|
-
return
|
|
962
|
+
return Ve(e), (o, l) => (C(), x("span", Yt));
|
|
967
963
|
}
|
|
968
|
-
}),
|
|
964
|
+
}), Ne = "tab-theme-style", ze = "tab-theme-primary-color", Ft = "system", _e = "(prefers-color-scheme: dark)";
|
|
969
965
|
let W = null;
|
|
970
|
-
const
|
|
966
|
+
const R = {
|
|
971
967
|
primary: "#034960",
|
|
972
968
|
background: "#ffffff",
|
|
973
969
|
text: "#1e293b",
|
|
@@ -1008,12 +1004,12 @@ function Jt(e) {
|
|
|
1008
1004
|
return null;
|
|
1009
1005
|
}
|
|
1010
1006
|
}
|
|
1011
|
-
function
|
|
1012
|
-
typeof document > "u" || (document.documentElement.style.setProperty("--router-tab-primary", e.primary ??
|
|
1007
|
+
function ye(e) {
|
|
1008
|
+
typeof document > "u" || (document.documentElement.style.setProperty("--router-tab-primary", e.primary ?? R.primary), document.documentElement.style.setProperty("--router-tab-header-bg", e.headerBackground ?? R.headerBackground), document.documentElement.style.setProperty("--router-tab-background", e.background ?? R.background), document.documentElement.style.setProperty("--router-tab-active-background", e.activeBackground ?? R.activeBackground), document.documentElement.style.setProperty("--router-tab-text", e.text ?? R.text), document.documentElement.style.setProperty("--router-tab-active-text", e.activeText ?? R.activeText), document.documentElement.style.setProperty("--router-tab-border", e.border ?? R.border), document.documentElement.style.setProperty("--router-tab-active-border", e.activeBorder ?? R.activeBorder), document.documentElement.style.setProperty("--router-tab-button-color", e.buttonColor ?? R.buttonColor), document.documentElement.style.setProperty("--router-tab-active-button-color", e.activeButtonColor ?? R.activeButtonColor), document.documentElement.style.setProperty("--router-tab-button-background", e.buttonBackground ?? R.buttonBackground), document.documentElement.style.setProperty("--router-tab-active-button-background", e.activeButtonBackground ?? R.activeButtonBackground), document.documentElement.style.setProperty("--router-tab-icon-color", e.iconColor ?? R.iconColor));
|
|
1013
1009
|
}
|
|
1014
|
-
function
|
|
1010
|
+
function Ye(e) {
|
|
1015
1011
|
if (typeof document > "u") return;
|
|
1016
|
-
const n = document.documentElement, o = window.matchMedia(
|
|
1012
|
+
const n = document.documentElement, o = window.matchMedia(_e), l = () => {
|
|
1017
1013
|
n.dataset.theme = o.matches ? "dark" : "light";
|
|
1018
1014
|
};
|
|
1019
1015
|
W && (o.removeEventListener("change", W), W = null), e === "system" ? (l(), W = () => l(), o.addEventListener("change", W)) : n.dataset.theme = e;
|
|
@@ -1021,31 +1017,31 @@ function Fe(e) {
|
|
|
1021
1017
|
function Wt(e = {}) {
|
|
1022
1018
|
if (typeof window > "u") return;
|
|
1023
1019
|
const {
|
|
1024
|
-
styleKey: n =
|
|
1020
|
+
styleKey: n = Ne,
|
|
1025
1021
|
primaryKey: o = ze,
|
|
1026
1022
|
defaultStyle: l = Ft,
|
|
1027
1023
|
defaultPrimary: r
|
|
1028
1024
|
} = e, p = window.localStorage.getItem(n) ?? l;
|
|
1029
|
-
|
|
1030
|
-
const s = p === "dark" || p === "system" && window.matchMedia(
|
|
1025
|
+
Ye(p);
|
|
1026
|
+
const s = p === "dark" || p === "system" && window.matchMedia(_e).matches ? { ...Ht } : { ...R };
|
|
1031
1027
|
r && (s.primary = r);
|
|
1032
1028
|
const c = Jt(o);
|
|
1033
|
-
|
|
1029
|
+
ye(c ? {
|
|
1034
1030
|
...s,
|
|
1035
1031
|
...c
|
|
1036
1032
|
} : s);
|
|
1037
1033
|
}
|
|
1038
1034
|
function qt(e, n) {
|
|
1039
1035
|
if (typeof window > "u") return;
|
|
1040
|
-
const o = n?.styleKey ??
|
|
1041
|
-
window.localStorage.setItem(o, e),
|
|
1036
|
+
const o = n?.styleKey ?? Ne;
|
|
1037
|
+
window.localStorage.setItem(o, e), Ye(e);
|
|
1042
1038
|
}
|
|
1043
1039
|
function Qt(e, n) {
|
|
1044
1040
|
if (typeof window > "u") return;
|
|
1045
1041
|
const o = n?.primaryKey ?? ze;
|
|
1046
|
-
window.localStorage.setItem(o, JSON.stringify(e)),
|
|
1042
|
+
window.localStorage.setItem(o, JSON.stringify(e)), ye(e);
|
|
1047
1043
|
}
|
|
1048
|
-
function
|
|
1044
|
+
function Q(e, n) {
|
|
1049
1045
|
if (kt(e)) {
|
|
1050
1046
|
const l = !wt(e);
|
|
1051
1047
|
return {
|
|
@@ -1072,8 +1068,8 @@ function te(e, n) {
|
|
|
1072
1068
|
}
|
|
1073
1069
|
};
|
|
1074
1070
|
}
|
|
1075
|
-
function
|
|
1076
|
-
const n =
|
|
1071
|
+
function he(e = {}) {
|
|
1072
|
+
const n = Q(e.title, "Untitled"), o = Q(e.icon, ""), l = Q(e.closable, !0), r = Q(e.meta, {});
|
|
1077
1073
|
return {
|
|
1078
1074
|
routeTabTitle: n.value,
|
|
1079
1075
|
routeTabIcon: o.value,
|
|
@@ -1086,14 +1082,14 @@ function Te(e = {}) {
|
|
|
1086
1082
|
};
|
|
1087
1083
|
}
|
|
1088
1084
|
function Zt(e, n = "Page") {
|
|
1089
|
-
return
|
|
1085
|
+
return he({
|
|
1090
1086
|
title: k(() => e.value ? "Loading..." : n),
|
|
1091
1087
|
icon: k(() => e.value ? "mdi-loading mdi-spin" : "mdi-page"),
|
|
1092
1088
|
closable: k(() => !e.value)
|
|
1093
1089
|
});
|
|
1094
1090
|
}
|
|
1095
1091
|
function en(e, n = "Page", o = "mdi-page") {
|
|
1096
|
-
return
|
|
1092
|
+
return he({
|
|
1097
1093
|
title: k(() => e.value > 0 ? `${n} (${e.value})` : n),
|
|
1098
1094
|
icon: k(() => e.value > 0 ? "mdi-bell-badge" : o)
|
|
1099
1095
|
});
|
|
@@ -1105,47 +1101,47 @@ function tn(e, n = "Page") {
|
|
|
1105
1101
|
error: { suffix: " - Error", icon: "mdi-alert" },
|
|
1106
1102
|
success: { suffix: " - Success", icon: "mdi-check-circle" }
|
|
1107
1103
|
};
|
|
1108
|
-
return
|
|
1104
|
+
return he({
|
|
1109
1105
|
title: k(() => n + o[e.value].suffix),
|
|
1110
1106
|
icon: k(() => o[e.value].icon),
|
|
1111
1107
|
closable: k(() => e.value !== "loading")
|
|
1112
1108
|
});
|
|
1113
1109
|
}
|
|
1114
|
-
let
|
|
1110
|
+
let Le = !1;
|
|
1115
1111
|
const nn = {
|
|
1116
1112
|
install(e, n) {
|
|
1117
|
-
if (
|
|
1118
|
-
|
|
1113
|
+
if (Le) return;
|
|
1114
|
+
Le = !0;
|
|
1119
1115
|
const {
|
|
1120
1116
|
initTheme: o = !0,
|
|
1121
1117
|
themeOptions: l,
|
|
1122
|
-
componentName: r =
|
|
1123
|
-
tabsComponentName: p =
|
|
1118
|
+
componentName: r = Me.name || "RouterTab",
|
|
1119
|
+
tabsComponentName: p = be.name || "RouterTabs"
|
|
1124
1120
|
} = n ?? {};
|
|
1125
|
-
o && Wt(l ?? {}), e.component(r,
|
|
1121
|
+
o && Wt(l ?? {}), e.component(r, Me), e.component(p, be), p.toLowerCase() !== "router-tabs" && e.component("router-tabs", be), Object.defineProperty(e.config.globalProperties, "$tabs", {
|
|
1126
1122
|
configurable: !0,
|
|
1127
1123
|
enumerable: !1,
|
|
1128
1124
|
get() {
|
|
1129
|
-
return e._context.provides[
|
|
1125
|
+
return e._context.provides[ee];
|
|
1130
1126
|
},
|
|
1131
1127
|
set(T) {
|
|
1132
|
-
T && e.provide(
|
|
1128
|
+
T && e.provide(ee, T);
|
|
1133
1129
|
}
|
|
1134
1130
|
});
|
|
1135
1131
|
}
|
|
1136
1132
|
};
|
|
1137
1133
|
export {
|
|
1138
|
-
|
|
1139
|
-
|
|
1134
|
+
Me as RouterTab,
|
|
1135
|
+
be as RouterTabs,
|
|
1140
1136
|
nn as default,
|
|
1141
1137
|
Wt as initRouterTabsTheme,
|
|
1142
|
-
|
|
1138
|
+
ee as routerTabsKey,
|
|
1143
1139
|
Qt as setRouterTabsPrimary,
|
|
1144
1140
|
qt as setRouterTabsTheme,
|
|
1145
1141
|
Zt as useLoadingTab,
|
|
1146
1142
|
en as useNotificationTab,
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1143
|
+
he as useReactiveTab,
|
|
1144
|
+
Se as useRouterTabs,
|
|
1145
|
+
Ve as useRouterTabsPersistence,
|
|
1150
1146
|
tn as useStatusTab
|
|
1151
1147
|
};
|