vue3-router-tab 1.3.9 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/dist/vue3-router-tab.css +1 -1
- package/dist/vue3-router-tab.js +555 -553
- package/dist/vue3-router-tab.umd.cjs +1 -1
- package/lib/components/RouterTab.vue +18 -2
- package/lib/core/createRouterTabs.ts +11 -23
- package/lib/scss/index.scss +1 -2
- package/package.json +1 -1
package/dist/vue3-router-tab.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './vue3-router-tab.css';
|
|
2
|
-
import { reactive as
|
|
3
|
-
import { RouterView as
|
|
2
|
+
import { reactive as ie, ref as S, shallowRef as Kt, computed as k, watch as A, nextTick as B, inject as Le, getCurrentInstance as We, onMounted as ke, defineComponent as Ke, provide as Et, onErrorCaptured as $t, onBeforeUnmount as At, h as Pt, resolveComponent as St, createElementBlock as x, openBlock as $, createElementVNode as j, withDirectives as It, normalizeClass as q, renderSlot as ve, createVNode as Oe, TransitionGroup as xt, mergeProps as he, withCtx as me, Fragment as ye, renderList as je, withModifiers as Te, createCommentVNode as te, toDisplayString as Ue, normalizeProps as Dt, createBlock as ne, KeepAlive as Bt, resolveDynamicComponent as Ve, Transition as Mt, normalizeStyle as Lt, vShow as Ot, isRef as jt, isReadonly as Ut } from "vue";
|
|
3
|
+
import { RouterView as Vt } from "vue-router";
|
|
4
4
|
function Nt(e = {}) {
|
|
5
5
|
return {
|
|
6
6
|
initialTabs: e.initialTabs ?? [],
|
|
@@ -11,83 +11,83 @@ function Nt(e = {}) {
|
|
|
11
11
|
defaultRoute: e.defaultRoute ?? "/"
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function _(e, r) {
|
|
15
15
|
const o = e.resolve(r);
|
|
16
16
|
if (!o || !o.matched.length)
|
|
17
17
|
throw new Error(`[RouterTabs] Unable to resolve route: ${String(r)}`);
|
|
18
18
|
return o;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const _t = {
|
|
21
21
|
path: (e) => e.path,
|
|
22
22
|
fullpath: (e) => e.fullPath,
|
|
23
23
|
fullname: (e) => e.fullPath,
|
|
24
24
|
full: (e) => e.fullPath,
|
|
25
25
|
name: (e) => e.name ? String(e.name) : e.fullPath
|
|
26
26
|
};
|
|
27
|
-
function
|
|
27
|
+
function z(e) {
|
|
28
28
|
const r = e.meta?.key;
|
|
29
29
|
if (typeof r == "function") {
|
|
30
30
|
const o = r(e);
|
|
31
31
|
if (typeof o == "string" && o.length) return o;
|
|
32
32
|
} else if (typeof r == "string" && r.length) {
|
|
33
|
-
const o =
|
|
33
|
+
const o = _t[r.toLowerCase()];
|
|
34
34
|
return o ? o(e) : r;
|
|
35
35
|
}
|
|
36
36
|
return e.fullPath;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Ee(e, r) {
|
|
39
39
|
const o = e.meta?.keepAlive;
|
|
40
40
|
return typeof o == "boolean" ? o : r;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function $e(e, r) {
|
|
43
43
|
const o = e.meta?.reuse;
|
|
44
44
|
return typeof o == "boolean" ? o : r;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Je(e) {
|
|
47
47
|
const r = e.meta ?? {}, o = {};
|
|
48
48
|
return "title" in r && (o.title = r.title), "tips" in r && (o.tips = r.tips), "icon" in r && (o.icon = r.icon), "closable" in r && (o.closable = r.closable), "tabClass" in r && (o.tabClass = r.tabClass), "target" in r && (o.target = r.target), "href" in r && (o.href = r.href), o;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const s =
|
|
50
|
+
function oe(e, r, o) {
|
|
51
|
+
const s = Je(e);
|
|
52
52
|
return {
|
|
53
|
-
id:
|
|
53
|
+
id: z(e),
|
|
54
54
|
to: e.fullPath,
|
|
55
55
|
fullPath: e.fullPath,
|
|
56
56
|
matched: e,
|
|
57
|
-
alive:
|
|
58
|
-
reusable:
|
|
57
|
+
alive: Ee(e, o),
|
|
58
|
+
reusable: $e(e, !1),
|
|
59
59
|
closable: s.closable ?? !0,
|
|
60
60
|
renderKey: typeof r.renderKey == "number" ? r.renderKey : 0,
|
|
61
61
|
...s,
|
|
62
62
|
...r
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
if (!e.find((
|
|
65
|
+
function Re(e, r, o, s) {
|
|
66
|
+
if (!e.find((v) => v.id === r.id)) {
|
|
67
67
|
if (o === "next" && s) {
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
e.splice(
|
|
68
|
+
const v = e.findIndex((T) => T.id === s);
|
|
69
|
+
if (v !== -1) {
|
|
70
|
+
e.splice(v + 1, 0, r);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
e.push(r);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function we(e, r, o, s) {
|
|
78
78
|
if (!r || r <= 0) return;
|
|
79
|
-
const a = e.filter((
|
|
79
|
+
const a = e.filter((v) => v.alive);
|
|
80
80
|
for (; a.length > r; ) {
|
|
81
|
-
const
|
|
82
|
-
if (!
|
|
83
|
-
const T = e.findIndex((
|
|
81
|
+
const v = a.shift();
|
|
82
|
+
if (!v || v.id === o) continue;
|
|
83
|
+
const T = e.findIndex((l) => l.id === v.id);
|
|
84
84
|
if (T > -1) {
|
|
85
|
-
const
|
|
86
|
-
s.delete(
|
|
85
|
+
const l = e[T], d = `${l.id}::${l.renderKey ?? 0}`;
|
|
86
|
+
s.delete(d), l.alive = !1;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function zt(e) {
|
|
91
91
|
return {
|
|
92
92
|
to: e.to,
|
|
93
93
|
title: e.title,
|
|
@@ -98,193 +98,187 @@ function Vt(e) {
|
|
|
98
98
|
renderKey: e.renderKey
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function Yt(e) {
|
|
102
102
|
const r = {};
|
|
103
103
|
return "title" in e && (r.title = e.title), "tips" in e && (r.tips = e.tips), "icon" in e && (r.icon = e.icon), "tabClass" in e && (r.tabClass = e.tabClass), "closable" in e && (r.closable = e.closable), "renderKey" in e && typeof e.renderKey == "number" && (r.renderKey = e.renderKey), r;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
const o = Nt(r), s =
|
|
105
|
+
function Ft(e, r = {}) {
|
|
106
|
+
const o = Nt(r), s = ie([]), a = S(null), v = Kt(), T = S(null), l = ie(/* @__PURE__ */ new Set()), d = k(() => Array.from(l));
|
|
107
107
|
let h = !1;
|
|
108
108
|
function E(u) {
|
|
109
|
-
const
|
|
109
|
+
const b = typeof u.matched == "object" ? u : _(e, u);
|
|
110
110
|
return {
|
|
111
|
-
key:
|
|
112
|
-
fullPath:
|
|
113
|
-
alive:
|
|
114
|
-
reusable:
|
|
115
|
-
matched:
|
|
111
|
+
key: z(b),
|
|
112
|
+
fullPath: b.fullPath,
|
|
113
|
+
alive: Ee(b, o.keepAlive),
|
|
114
|
+
reusable: $e(b, !1),
|
|
115
|
+
matched: b
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
function P(u) {
|
|
119
|
-
const
|
|
120
|
-
let
|
|
121
|
-
const m =
|
|
122
|
-
if (
|
|
123
|
-
|
|
124
|
-
const y = `${
|
|
125
|
-
return
|
|
126
|
-
key: c,
|
|
127
|
-
shouldBeAlive: m,
|
|
128
|
-
currentRenderKey: f.renderKey,
|
|
129
|
-
currentCacheKey: y,
|
|
130
|
-
isInCache: i.has(y),
|
|
131
|
-
aliveCacheSize: i.size,
|
|
132
|
-
cacheContents: Array.from(i)
|
|
133
|
-
}), m && (i.has(y) ? f.alive || (f.alive = !0, (c.includes("students") || c.includes("classroom") || c.includes("quiz")) && console.log(`[ensureTab] ✅ Reactivated: ${y}`)) : (i.add(y), f.alive = !0, (c.includes("students") || c.includes("classroom") || c.includes("quiz")) && console.log(`[ensureTab] ✅ Added to cache: ${y}`))), Object.assign(f, qe(u)), f;
|
|
119
|
+
const b = z(u);
|
|
120
|
+
let c = s.find((y) => y.id === b);
|
|
121
|
+
const m = Ee(u, o.keepAlive);
|
|
122
|
+
if (c) {
|
|
123
|
+
c.fullPath = u.fullPath, c.to = u.fullPath, c.matched = u, c.reusable = $e(u, c.reusable), typeof c.renderKey != "number" && (c.renderKey = 0);
|
|
124
|
+
const y = `${b}::${c.renderKey}`;
|
|
125
|
+
return m ? l.has(y) ? c.alive || (c.alive = !0) : (l.add(y), c.alive = !0) : c.alive && (l.delete(y), c.alive = !1), Object.assign(c, Je(u)), c;
|
|
134
126
|
}
|
|
135
|
-
if (
|
|
136
|
-
const y = `${
|
|
137
|
-
|
|
127
|
+
if (c = oe(u, {}, o.keepAlive), c.alive) {
|
|
128
|
+
const y = `${b}::${c.renderKey ?? 0}`;
|
|
129
|
+
l.add(y);
|
|
138
130
|
}
|
|
139
|
-
return
|
|
131
|
+
return Re(s, c, o.appendPosition, a.value), we(s, o.maxAlive, a.value, l), c;
|
|
140
132
|
}
|
|
141
|
-
async function M(u,
|
|
142
|
-
const m =
|
|
143
|
-
|
|
133
|
+
async function M(u, b = !1, c = "sameTab") {
|
|
134
|
+
const m = _(e, u), y = z(m), w = a.value === y;
|
|
135
|
+
c === "sameTab" && (c = w), c && await U(y, !0), await e[b ? "replace" : "push"](m), w && await V();
|
|
144
136
|
}
|
|
145
137
|
function Y(u) {
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
const
|
|
149
|
-
return
|
|
138
|
+
const b = s.findIndex((I) => I.id === u);
|
|
139
|
+
if (b === -1) return o.defaultRoute;
|
|
140
|
+
const c = s[b + 1], m = s[b - 1], y = s.find((I) => I.id !== u), w = c || m || y;
|
|
141
|
+
return w ? w.to : o.defaultRoute;
|
|
150
142
|
}
|
|
151
|
-
async function L(u = a.value,
|
|
143
|
+
async function L(u = a.value, b = {}) {
|
|
152
144
|
if (!u) return;
|
|
153
|
-
if (!
|
|
145
|
+
if (!b.force && o.keepLastTab && s.length === 1)
|
|
154
146
|
throw new Error("[RouterTabs] Unable to close the final tab when keepLastTab is true.");
|
|
155
|
-
const m = a.value === u &&
|
|
156
|
-
await F(u, { force:
|
|
147
|
+
const m = a.value === u && b.redirect !== null, y = m ? b.redirect ?? Y(u) : null;
|
|
148
|
+
await F(u, { force: b.force }), b.redirect !== null && m && y && await e.replace(y);
|
|
157
149
|
}
|
|
158
|
-
async function F(u,
|
|
159
|
-
const
|
|
160
|
-
|
|
150
|
+
async function F(u, b = {}) {
|
|
151
|
+
const c = s.findIndex((w) => w.id === u);
|
|
152
|
+
if (c === -1) return;
|
|
153
|
+
const m = s[c], y = `${u}::${m.renderKey ?? 0}`;
|
|
154
|
+
l.delete(y), m.alive = !1, s.splice(c, 1), T.value === u && (T.value = null), a.value === u && (a.value = null, v.value = void 0);
|
|
161
155
|
}
|
|
162
|
-
async function
|
|
156
|
+
async function U(u = a.value ?? void 0, b = !1) {
|
|
163
157
|
if (!u) return;
|
|
164
|
-
const
|
|
165
|
-
if (!
|
|
166
|
-
const m = o.keepAlive &&
|
|
167
|
-
m && (
|
|
168
|
-
const
|
|
169
|
-
m && (
|
|
170
|
-
}
|
|
171
|
-
async function le(u = !1) {
|
|
172
|
-
for (const c of s)
|
|
173
|
-
await z(c.id, u);
|
|
158
|
+
const c = s.find((I) => I.id === u);
|
|
159
|
+
if (!c) return;
|
|
160
|
+
const m = o.keepAlive && c.alive, y = `${u}::${c.renderKey ?? 0}`;
|
|
161
|
+
m && (l.delete(y), c.alive = !1, await B()), c.renderKey = (c.renderKey ?? 0) + 1;
|
|
162
|
+
const w = `${u}::${c.renderKey}`;
|
|
163
|
+
m && (l.add(w), c.alive = !0), T.value = u, await B(), b || await B(), T.value = null;
|
|
174
164
|
}
|
|
175
|
-
function
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
const m = `${u}::${f.renderKey ?? 0}`;
|
|
179
|
-
c ? (i.add(m), f.alive = !0, Re(s, o.maxAlive, a.value, i)) : (i.delete(m), f.alive = !1);
|
|
165
|
+
async function se(u = !1) {
|
|
166
|
+
for (const b of s)
|
|
167
|
+
await U(b.id, u);
|
|
180
168
|
}
|
|
181
|
-
function
|
|
182
|
-
const c = s.find((
|
|
169
|
+
function R(u, b) {
|
|
170
|
+
const c = s.find((y) => y.id === u);
|
|
183
171
|
if (!c) return;
|
|
184
|
-
const
|
|
185
|
-
|
|
172
|
+
const m = `${u}::${c.renderKey ?? 0}`;
|
|
173
|
+
b ? (l.add(m), c.alive = !0, we(s, o.maxAlive, a.value, l)) : (l.delete(m), c.alive = !1);
|
|
174
|
+
}
|
|
175
|
+
function Q(u) {
|
|
176
|
+
const b = s.find((m) => m.id === u);
|
|
177
|
+
if (!b) return;
|
|
178
|
+
const c = `${u}::${b.renderKey ?? 0}`;
|
|
179
|
+
l.delete(c), b.alive = !1, b.renderKey = (b.renderKey ?? 0) + 1;
|
|
186
180
|
}
|
|
187
181
|
function O() {
|
|
188
|
-
|
|
182
|
+
l.clear(), s.forEach((u) => {
|
|
189
183
|
u.alive = !1;
|
|
190
184
|
});
|
|
191
185
|
}
|
|
192
186
|
function D() {
|
|
193
|
-
return
|
|
187
|
+
return d.value.slice();
|
|
194
188
|
}
|
|
195
|
-
async function
|
|
196
|
-
s.splice(0, s.length), a.value = null,
|
|
197
|
-
for (const
|
|
198
|
-
const
|
|
189
|
+
async function Z(u = o.defaultRoute) {
|
|
190
|
+
s.splice(0, s.length), a.value = null, v.value = void 0;
|
|
191
|
+
for (const b of o.initialTabs) {
|
|
192
|
+
const c = _(e, b.to), m = oe(c, b, o.keepAlive);
|
|
199
193
|
s.push(m);
|
|
200
194
|
}
|
|
201
195
|
await e.replace(u);
|
|
202
196
|
}
|
|
203
|
-
async function
|
|
197
|
+
async function V() {
|
|
204
198
|
const u = a.value;
|
|
205
|
-
u && await
|
|
199
|
+
u && await U(u, !0);
|
|
206
200
|
}
|
|
207
|
-
function
|
|
208
|
-
return typeof u.matched == "object" ?
|
|
201
|
+
function C(u) {
|
|
202
|
+
return typeof u.matched == "object" ? z(u) : z(_(e, u));
|
|
209
203
|
}
|
|
210
|
-
function
|
|
211
|
-
const u = s.find((
|
|
204
|
+
function ue() {
|
|
205
|
+
const u = s.find((b) => b.id === a.value);
|
|
212
206
|
return {
|
|
213
|
-
tabs: s.map(
|
|
207
|
+
tabs: s.map(zt),
|
|
214
208
|
active: u ? u.to : null
|
|
215
209
|
};
|
|
216
210
|
}
|
|
217
|
-
async function
|
|
218
|
-
h = !0, s.splice(0, s.length), a.value = null,
|
|
219
|
-
const
|
|
220
|
-
for (const m of
|
|
211
|
+
async function H(u) {
|
|
212
|
+
h = !0, s.splice(0, s.length), a.value = null, v.value = void 0;
|
|
213
|
+
const b = u?.tabs ?? [];
|
|
214
|
+
for (const m of b)
|
|
221
215
|
try {
|
|
222
|
-
const y =
|
|
223
|
-
|
|
216
|
+
const y = _(e, m.to), w = Yt(m), I = oe(y, w, o.keepAlive);
|
|
217
|
+
Re(s, I, "last", null);
|
|
224
218
|
} catch (y) {
|
|
225
219
|
console.warn("[RouterTabs] Failed to restore tab", m, y);
|
|
226
220
|
}
|
|
227
221
|
h = !1;
|
|
228
|
-
const
|
|
229
|
-
if (
|
|
222
|
+
const c = u?.active ?? b[b.length - 1]?.to ?? o.defaultRoute;
|
|
223
|
+
if (c)
|
|
230
224
|
try {
|
|
231
|
-
await e.replace(
|
|
225
|
+
await e.replace(c);
|
|
232
226
|
} catch (m) {
|
|
233
|
-
console.warn("[RouterTabs] Failed to navigate to restored route",
|
|
227
|
+
console.warn("[RouterTabs] Failed to navigate to restored route", c, m);
|
|
234
228
|
}
|
|
235
229
|
}
|
|
236
230
|
return A(
|
|
237
231
|
() => e.currentRoute.value,
|
|
238
232
|
(u) => {
|
|
239
233
|
if (h) return;
|
|
240
|
-
const
|
|
241
|
-
a.value =
|
|
234
|
+
const b = P(u);
|
|
235
|
+
a.value = b.id, v.value = b, we(s, o.maxAlive, a.value, l);
|
|
242
236
|
},
|
|
243
237
|
{ immediate: !0 }
|
|
244
238
|
), o.initialTabs.length && o.initialTabs.forEach((u) => {
|
|
245
|
-
const
|
|
246
|
-
|
|
239
|
+
const b = _(e, u.to), c = oe(b, u, o.keepAlive);
|
|
240
|
+
Re(s, c, "last", null);
|
|
247
241
|
}), {
|
|
248
242
|
options: o,
|
|
249
243
|
tabs: s,
|
|
250
244
|
activeId: a,
|
|
251
|
-
current:
|
|
252
|
-
includeKeys:
|
|
245
|
+
current: v,
|
|
246
|
+
includeKeys: d,
|
|
253
247
|
refreshingKey: T,
|
|
254
248
|
openTab: M,
|
|
255
249
|
closeTab: L,
|
|
256
250
|
removeTab: F,
|
|
257
|
-
refreshTab:
|
|
258
|
-
refreshAll:
|
|
251
|
+
refreshTab: U,
|
|
252
|
+
refreshAll: se,
|
|
259
253
|
setTabAlive: R,
|
|
260
|
-
evictCache:
|
|
254
|
+
evictCache: Q,
|
|
261
255
|
clearCache: O,
|
|
262
256
|
getCacheKeys: D,
|
|
263
|
-
reset:
|
|
264
|
-
reload:
|
|
265
|
-
getRouteKey:
|
|
257
|
+
reset: Z,
|
|
258
|
+
reload: V,
|
|
259
|
+
getRouteKey: C,
|
|
266
260
|
matchRoute: E,
|
|
267
|
-
snapshot:
|
|
268
|
-
hydrate:
|
|
261
|
+
snapshot: ue,
|
|
262
|
+
hydrate: H,
|
|
269
263
|
ensureTab: P
|
|
270
264
|
};
|
|
271
265
|
}
|
|
272
266
|
function Ne(e) {
|
|
273
267
|
return e ? typeof e == "string" ? { name: e } : e : {};
|
|
274
268
|
}
|
|
275
|
-
const
|
|
276
|
-
function
|
|
277
|
-
const { optional: r = !1 } = e, o =
|
|
269
|
+
const le = Symbol("RouterTabsContext"), ae = "router-tabs:snapshot";
|
|
270
|
+
function _e(e = {}) {
|
|
271
|
+
const { optional: r = !1 } = e, o = Le(le, null);
|
|
278
272
|
if (o) return o;
|
|
279
|
-
const s =
|
|
273
|
+
const s = Le("$tabs", null);
|
|
280
274
|
if (s) return s;
|
|
281
|
-
const
|
|
282
|
-
if (
|
|
275
|
+
const v = We()?.appContext.config.globalProperties.$tabs;
|
|
276
|
+
if (v) return v;
|
|
283
277
|
if (!r)
|
|
284
278
|
throw new Error("[RouterTabs] useRouterTabs must be used within <router-tab>.");
|
|
285
279
|
return null;
|
|
286
280
|
}
|
|
287
|
-
const
|
|
281
|
+
const Ht = 864e5;
|
|
288
282
|
function Wt(e) {
|
|
289
283
|
if (typeof document > "u") return null;
|
|
290
284
|
const r = `${encodeURIComponent(e)}=`, o = document.cookie ? document.cookie.split("; ") : [];
|
|
@@ -293,27 +287,27 @@ function Wt(e) {
|
|
|
293
287
|
return decodeURIComponent(s.slice(r.length));
|
|
294
288
|
return null;
|
|
295
289
|
}
|
|
296
|
-
function
|
|
290
|
+
function ze(e, r, o) {
|
|
297
291
|
if (typeof document > "u") return;
|
|
298
292
|
const {
|
|
299
293
|
expiresInDays: s = 7,
|
|
300
294
|
path: a = "/",
|
|
301
|
-
domain:
|
|
295
|
+
domain: v,
|
|
302
296
|
secure: T,
|
|
303
|
-
sameSite:
|
|
304
|
-
} = o,
|
|
297
|
+
sameSite: l = "lax"
|
|
298
|
+
} = o, d = [`${encodeURIComponent(e)}=${encodeURIComponent(r)}`];
|
|
305
299
|
if (s !== 1 / 0) {
|
|
306
|
-
const h = new Date(Date.now() + s *
|
|
307
|
-
|
|
300
|
+
const h = new Date(Date.now() + s * Ht).toUTCString();
|
|
301
|
+
d.push(`Expires=${h}`);
|
|
308
302
|
}
|
|
309
|
-
a &&
|
|
303
|
+
a && d.push(`Path=${a}`), v && d.push(`Domain=${v}`), T && d.push("Secure"), l && d.push(`SameSite=${l.charAt(0).toUpperCase()}${l.slice(1)}`), document.cookie = d.join("; ");
|
|
310
304
|
}
|
|
311
|
-
function
|
|
305
|
+
function Ye(e, r) {
|
|
312
306
|
if (typeof document > "u") return;
|
|
313
307
|
const { path: o = "/", domain: s } = r, a = [`${encodeURIComponent(e)}=`];
|
|
314
308
|
a.push("Expires=Thu, 01 Jan 1970 00:00:01 GMT"), o && a.push(`Path=${o}`), s && a.push(`Domain=${s}`), document.cookie = a.join("; ");
|
|
315
309
|
}
|
|
316
|
-
const
|
|
310
|
+
const Jt = (e) => JSON.stringify(e ?? null), Gt = (e) => {
|
|
317
311
|
if (!e) return null;
|
|
318
312
|
try {
|
|
319
313
|
return JSON.parse(e);
|
|
@@ -321,65 +315,65 @@ const qt = (e) => JSON.stringify(e ?? null), Ht = (e) => {
|
|
|
321
315
|
return null;
|
|
322
316
|
}
|
|
323
317
|
};
|
|
324
|
-
function
|
|
318
|
+
function Ge(e = {}) {
|
|
325
319
|
const {
|
|
326
|
-
cookieKey: r =
|
|
327
|
-
serialize: o =
|
|
328
|
-
deserialize: s =
|
|
329
|
-
} = e, a =
|
|
320
|
+
cookieKey: r = ae,
|
|
321
|
+
serialize: o = Jt,
|
|
322
|
+
deserialize: s = Gt
|
|
323
|
+
} = e, a = _e({ optional: !0 }), v = S(!0), T = (l) => {
|
|
330
324
|
ke(async () => {
|
|
331
|
-
const
|
|
332
|
-
if (
|
|
325
|
+
const d = s(Wt(r));
|
|
326
|
+
if (d && d.tabs?.length)
|
|
333
327
|
try {
|
|
334
|
-
if (
|
|
328
|
+
if (v.value = !0, await l.hydrate(d), d.active) {
|
|
335
329
|
await B();
|
|
336
|
-
const E =
|
|
337
|
-
E && (
|
|
330
|
+
const E = l.tabs.find((P) => P.to === d.active);
|
|
331
|
+
E && (l.activeId.value = E.id, l.current.value = E);
|
|
338
332
|
}
|
|
339
333
|
} finally {
|
|
340
|
-
|
|
334
|
+
v.value = !1;
|
|
341
335
|
}
|
|
342
336
|
else if (Object.prototype.hasOwnProperty.call(e, "fallbackRoute"))
|
|
343
337
|
try {
|
|
344
|
-
|
|
345
|
-
const E = e.fallbackRoute ??
|
|
346
|
-
await
|
|
338
|
+
v.value = !0;
|
|
339
|
+
const E = e.fallbackRoute ?? l.options.defaultRoute;
|
|
340
|
+
await l.reset(E);
|
|
347
341
|
} finally {
|
|
348
|
-
|
|
342
|
+
v.value = !1;
|
|
349
343
|
}
|
|
350
344
|
else
|
|
351
|
-
|
|
352
|
-
const h =
|
|
353
|
-
h.tabs.length ?
|
|
345
|
+
v.value = !1;
|
|
346
|
+
const h = l.snapshot();
|
|
347
|
+
h.tabs.length ? ze(r, o(h), e) : Ye(r, e), v.value = !1;
|
|
354
348
|
}), A(
|
|
355
349
|
() => ({
|
|
356
|
-
tabs:
|
|
357
|
-
to:
|
|
358
|
-
title:
|
|
359
|
-
tips:
|
|
360
|
-
icon:
|
|
361
|
-
tabClass:
|
|
362
|
-
closable:
|
|
363
|
-
renderKey:
|
|
350
|
+
tabs: l.tabs.map((d) => ({
|
|
351
|
+
to: d.to,
|
|
352
|
+
title: d.title,
|
|
353
|
+
tips: d.tips,
|
|
354
|
+
icon: d.icon,
|
|
355
|
+
tabClass: d.tabClass,
|
|
356
|
+
closable: d.closable,
|
|
357
|
+
renderKey: d.renderKey
|
|
364
358
|
})),
|
|
365
|
-
active:
|
|
359
|
+
active: l.activeId.value
|
|
366
360
|
}),
|
|
367
361
|
() => {
|
|
368
|
-
if (
|
|
369
|
-
const
|
|
370
|
-
|
|
362
|
+
if (v.value) return;
|
|
363
|
+
const d = l.snapshot();
|
|
364
|
+
d.tabs.length ? ze(r, o(d), e) : Ye(r, e);
|
|
371
365
|
},
|
|
372
366
|
{ deep: !0 }
|
|
373
367
|
);
|
|
374
368
|
};
|
|
375
369
|
a ? T(a) : ke(() => {
|
|
376
|
-
const
|
|
377
|
-
|
|
370
|
+
const l = _e({ optional: !0 });
|
|
371
|
+
l && T(l);
|
|
378
372
|
});
|
|
379
373
|
}
|
|
380
|
-
const
|
|
374
|
+
const qt = Ke({
|
|
381
375
|
name: "RouterTab",
|
|
382
|
-
components: { RouterView:
|
|
376
|
+
components: { RouterView: Vt },
|
|
383
377
|
props: {
|
|
384
378
|
tabs: {
|
|
385
379
|
type: Array,
|
|
@@ -419,7 +413,7 @@ const Jt = Ce({
|
|
|
419
413
|
},
|
|
420
414
|
cookieKey: {
|
|
421
415
|
type: String,
|
|
422
|
-
default:
|
|
416
|
+
default: ae
|
|
423
417
|
},
|
|
424
418
|
persistence: {
|
|
425
419
|
type: Object,
|
|
@@ -438,7 +432,7 @@ const Jt = Ce({
|
|
|
438
432
|
const s = o.appContext.app.config.globalProperties.$router;
|
|
439
433
|
if (!s)
|
|
440
434
|
throw new Error("[RouterTab] Vue Router is required. Make sure to call app.use(router) before RouterTab.");
|
|
441
|
-
const a =
|
|
435
|
+
const a = Ft(s, {
|
|
442
436
|
initialTabs: e.tabs,
|
|
443
437
|
keepAlive: e.keepAlive,
|
|
444
438
|
maxAlive: e.maxAlive,
|
|
@@ -446,109 +440,109 @@ const Jt = Ce({
|
|
|
446
440
|
appendPosition: e.append,
|
|
447
441
|
defaultRoute: e.defaultPage
|
|
448
442
|
});
|
|
449
|
-
|
|
450
|
-
const
|
|
451
|
-
|
|
443
|
+
Et(le, a), o.appContext.config.globalProperties.$tabs = a;
|
|
444
|
+
const v = k(() => !!o?.slots?.default), T = k(() => !!o?.slots?.start), l = k(() => !!o?.slots?.end), d = S(0), h = k(() => {
|
|
445
|
+
d.value;
|
|
452
446
|
const t = {};
|
|
453
447
|
return a.tabs.forEach((n) => {
|
|
454
|
-
const
|
|
455
|
-
t[n.id] =
|
|
448
|
+
const i = typeof n.title == "string" ? n.title : String(n.title || ce(n));
|
|
449
|
+
t[n.id] = i;
|
|
456
450
|
}), t;
|
|
457
451
|
});
|
|
458
452
|
function E() {
|
|
459
|
-
|
|
453
|
+
d.value++;
|
|
460
454
|
}
|
|
461
455
|
const P = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map();
|
|
462
456
|
function Y(t, n) {
|
|
463
457
|
if (!(!n || P.has(t)))
|
|
464
458
|
try {
|
|
465
459
|
P.set(t, n);
|
|
466
|
-
const
|
|
467
|
-
if (!
|
|
460
|
+
const i = a.tabs.find((p) => a.getRouteKey(p.to) === t);
|
|
461
|
+
if (!i) {
|
|
468
462
|
console.warn(`[RouterTab] Cannot setup watching: tab not found for ${t}`);
|
|
469
463
|
return;
|
|
470
464
|
}
|
|
471
|
-
const
|
|
465
|
+
const g = [];
|
|
472
466
|
if (n.routeTabTitle !== void 0)
|
|
473
467
|
try {
|
|
474
|
-
const
|
|
468
|
+
const p = A(
|
|
475
469
|
() => {
|
|
476
|
-
const
|
|
477
|
-
return
|
|
470
|
+
const f = n.routeTabTitle;
|
|
471
|
+
return f && typeof f == "object" && "value" in f ? f.value : f;
|
|
478
472
|
},
|
|
479
|
-
(
|
|
480
|
-
if (
|
|
481
|
-
const
|
|
482
|
-
|
|
473
|
+
(f) => {
|
|
474
|
+
if (f != null) {
|
|
475
|
+
const N = String(f);
|
|
476
|
+
i.title = N, E();
|
|
483
477
|
}
|
|
484
478
|
},
|
|
485
479
|
{ immediate: !0 }
|
|
486
480
|
);
|
|
487
|
-
|
|
488
|
-
} catch (
|
|
489
|
-
console.error(`[RouterTab] Error watching routeTabTitle for ${t}:`,
|
|
481
|
+
g.push(p);
|
|
482
|
+
} catch (p) {
|
|
483
|
+
console.error(`[RouterTab] Error watching routeTabTitle for ${t}:`, p);
|
|
490
484
|
}
|
|
491
485
|
if (n.routeTabIcon !== void 0)
|
|
492
486
|
try {
|
|
493
|
-
const
|
|
487
|
+
const p = A(
|
|
494
488
|
() => {
|
|
495
|
-
const
|
|
496
|
-
return
|
|
489
|
+
const f = n.routeTabIcon;
|
|
490
|
+
return f && typeof f == "object" && "value" in f ? f.value : f;
|
|
497
491
|
},
|
|
498
|
-
(
|
|
499
|
-
|
|
492
|
+
(f) => {
|
|
493
|
+
f != null && (i.icon = String(f), E());
|
|
500
494
|
},
|
|
501
495
|
{ immediate: !0 }
|
|
502
496
|
);
|
|
503
|
-
|
|
504
|
-
} catch (
|
|
505
|
-
console.error(`[RouterTab] Error watching routeTabIcon for ${t}:`,
|
|
497
|
+
g.push(p);
|
|
498
|
+
} catch (p) {
|
|
499
|
+
console.error(`[RouterTab] Error watching routeTabIcon for ${t}:`, p);
|
|
506
500
|
}
|
|
507
501
|
if (n.routeTabClosable !== void 0)
|
|
508
502
|
try {
|
|
509
|
-
const
|
|
503
|
+
const p = A(
|
|
510
504
|
() => {
|
|
511
|
-
const
|
|
512
|
-
return
|
|
505
|
+
const f = n.routeTabClosable;
|
|
506
|
+
return f && typeof f == "object" && "value" in f ? f.value : f;
|
|
513
507
|
},
|
|
514
|
-
(
|
|
515
|
-
|
|
508
|
+
(f) => {
|
|
509
|
+
f != null && (i.closable = !!f, E());
|
|
516
510
|
},
|
|
517
511
|
{ immediate: !0 }
|
|
518
512
|
);
|
|
519
|
-
|
|
520
|
-
} catch (
|
|
521
|
-
console.error(`[RouterTab] Error watching routeTabClosable for ${t}:`,
|
|
513
|
+
g.push(p);
|
|
514
|
+
} catch (p) {
|
|
515
|
+
console.error(`[RouterTab] Error watching routeTabClosable for ${t}:`, p);
|
|
522
516
|
}
|
|
523
517
|
if (n.routeTabMeta !== void 0)
|
|
524
518
|
try {
|
|
525
|
-
const
|
|
519
|
+
const p = A(
|
|
526
520
|
() => {
|
|
527
|
-
const
|
|
528
|
-
return
|
|
521
|
+
const f = n.routeTabMeta;
|
|
522
|
+
return f && typeof f == "object" && "value" in f ? f.value : f;
|
|
529
523
|
},
|
|
530
|
-
(
|
|
531
|
-
|
|
524
|
+
(f) => {
|
|
525
|
+
f && typeof f == "object" && (Object.assign(i, f), E());
|
|
532
526
|
},
|
|
533
527
|
{ immediate: !0, deep: !0 }
|
|
534
528
|
);
|
|
535
|
-
|
|
536
|
-
} catch (
|
|
537
|
-
console.error(`[RouterTab] Error watching routeTabMeta for ${t}:`,
|
|
529
|
+
g.push(p);
|
|
530
|
+
} catch (p) {
|
|
531
|
+
console.error(`[RouterTab] Error watching routeTabMeta for ${t}:`, p);
|
|
538
532
|
}
|
|
539
|
-
M.set(t,
|
|
540
|
-
} catch (
|
|
541
|
-
console.error(`[RouterTab] Error in setupComponentWatching for ${t}:`,
|
|
533
|
+
M.set(t, g);
|
|
534
|
+
} catch (i) {
|
|
535
|
+
console.error(`[RouterTab] Error in setupComponentWatching for ${t}:`, i), L(t);
|
|
542
536
|
}
|
|
543
537
|
}
|
|
544
538
|
function L(t) {
|
|
545
539
|
try {
|
|
546
540
|
const n = M.get(t);
|
|
547
|
-
n && (n.forEach((
|
|
541
|
+
n && (n.forEach((i) => {
|
|
548
542
|
try {
|
|
549
|
-
|
|
550
|
-
} catch (
|
|
551
|
-
console.error(`[RouterTab] Error cleaning up watcher for ${t}:`,
|
|
543
|
+
i();
|
|
544
|
+
} catch (g) {
|
|
545
|
+
console.error(`[RouterTab] Error cleaning up watcher for ${t}:`, g);
|
|
552
546
|
}
|
|
553
547
|
}), M.delete(t)), P.delete(t);
|
|
554
548
|
} catch (n) {
|
|
@@ -558,26 +552,26 @@ const Jt = Ce({
|
|
|
558
552
|
function F(t, n) {
|
|
559
553
|
try {
|
|
560
554
|
t ? t.routeTabTitle !== void 0 || t.routeTabIcon !== void 0 || t.routeTabClosable !== void 0 ? Y(n, t) : t.$ && (t.$.routeTabTitle !== void 0 || t.$.routeTabIcon !== void 0 || t.$.routeTabClosable !== void 0) && Y(n, t.$) : t === null && L(n);
|
|
561
|
-
} catch (
|
|
562
|
-
console.error(`[RouterTab] Error handling component ref for ${n}:`,
|
|
555
|
+
} catch (i) {
|
|
556
|
+
console.error(`[RouterTab] Error handling component ref for ${n}:`, i), L(n);
|
|
563
557
|
}
|
|
564
558
|
}
|
|
565
|
-
if (
|
|
559
|
+
if ($t((t, n, i) => (console.error("[RouterTab] Error captured from component:", t, i), !1)), e.cookieKey !== null || e.persistence) {
|
|
566
560
|
const t = {
|
|
567
561
|
...e.persistence ?? {}
|
|
568
562
|
};
|
|
569
|
-
e.cookieKey !== null ? t.cookieKey = e.cookieKey ||
|
|
563
|
+
e.cookieKey !== null ? t.cookieKey = e.cookieKey || ae : t.cookieKey || (t.cookieKey = ae), Ge(t);
|
|
570
564
|
}
|
|
571
|
-
const
|
|
565
|
+
const U = k(() => Ne(e.tabTransition)), se = k(() => Ne(e.pageTransition)), R = ie({
|
|
572
566
|
visible: !1,
|
|
573
567
|
target: null,
|
|
574
568
|
position: { x: 0, y: 0 }
|
|
575
|
-
}),
|
|
569
|
+
}), Q = S(null), O = S([]), D = S(-1), Z = S(null), V = /* @__PURE__ */ new Map(), C = ie({
|
|
576
570
|
dragging: !1,
|
|
577
571
|
dragIndex: -1,
|
|
578
572
|
dropIndex: -1,
|
|
579
573
|
dragTab: null
|
|
580
|
-
}),
|
|
574
|
+
}), ue = [
|
|
581
575
|
"refresh",
|
|
582
576
|
"refreshAll",
|
|
583
577
|
"close",
|
|
@@ -585,25 +579,25 @@ const Jt = Ce({
|
|
|
585
579
|
"closeRights",
|
|
586
580
|
"closeOthers"
|
|
587
581
|
];
|
|
588
|
-
function
|
|
582
|
+
function H(t) {
|
|
589
583
|
return a.tabs.findIndex((n) => n.id === t);
|
|
590
584
|
}
|
|
591
585
|
function u(t) {
|
|
592
|
-
const n =
|
|
586
|
+
const n = H(t.id);
|
|
593
587
|
return n > 0 ? a.tabs.slice(0, n) : [];
|
|
594
588
|
}
|
|
595
|
-
function
|
|
596
|
-
const n =
|
|
589
|
+
function b(t) {
|
|
590
|
+
const n = H(t.id);
|
|
597
591
|
return n > -1 ? a.tabs.slice(n + 1) : [];
|
|
598
592
|
}
|
|
599
|
-
function
|
|
593
|
+
function c(t) {
|
|
600
594
|
return a.tabs.filter((n) => n.id !== t.id);
|
|
601
595
|
}
|
|
602
596
|
async function m(t, n) {
|
|
603
|
-
const
|
|
604
|
-
if (
|
|
605
|
-
for (const
|
|
606
|
-
a.activeId.value ===
|
|
597
|
+
const i = t.filter((g) => g.closable !== !1);
|
|
598
|
+
if (i.length) {
|
|
599
|
+
for (const g of i)
|
|
600
|
+
a.activeId.value === g.id ? await a.closeTab(g.id, { redirect: n.to, force: !0 }) : await a.removeTab(g.id, { force: !0 });
|
|
607
601
|
a.activeId.value !== n.id && await a.openTab(n.to, !0, !1);
|
|
608
602
|
}
|
|
609
603
|
}
|
|
@@ -625,7 +619,7 @@ const Jt = Ce({
|
|
|
625
619
|
handler: async ({ target: t }) => {
|
|
626
620
|
await a.closeTab(t.id);
|
|
627
621
|
},
|
|
628
|
-
enable: ({ target: t }) =>
|
|
622
|
+
enable: ({ target: t }) => de(t)
|
|
629
623
|
},
|
|
630
624
|
closeLefts: {
|
|
631
625
|
label: "Close to the Left",
|
|
@@ -637,83 +631,83 @@ const Jt = Ce({
|
|
|
637
631
|
closeRights: {
|
|
638
632
|
label: "Close to the Right",
|
|
639
633
|
handler: async ({ target: t }) => {
|
|
640
|
-
await m(
|
|
634
|
+
await m(b(t), t);
|
|
641
635
|
},
|
|
642
|
-
enable: ({ target: t }) =>
|
|
636
|
+
enable: ({ target: t }) => b(t).some((n) => n.closable !== !1)
|
|
643
637
|
},
|
|
644
638
|
closeOthers: {
|
|
645
639
|
label: "Close Others",
|
|
646
640
|
handler: async ({ target: t }) => {
|
|
647
|
-
await m(
|
|
641
|
+
await m(c(t), t);
|
|
648
642
|
},
|
|
649
|
-
enable: ({ target: t }) =>
|
|
643
|
+
enable: ({ target: t }) => c(t).some((n) => n.closable !== !1)
|
|
650
644
|
}
|
|
651
645
|
};
|
|
652
|
-
function
|
|
646
|
+
function w() {
|
|
653
647
|
R.visible = !1, R.target = null, D.value = -1, O.value = [];
|
|
654
648
|
}
|
|
655
649
|
function I(t, n) {
|
|
656
650
|
e.contextmenu && (R.target = t, R.position.x = n.clientX, R.position.y = n.clientY, B(() => {
|
|
657
|
-
R.visible = !0, document.addEventListener("click",
|
|
658
|
-
|
|
651
|
+
R.visible = !0, document.addEventListener("click", w, { once: !0 }), B(() => {
|
|
652
|
+
tt();
|
|
659
653
|
});
|
|
660
654
|
}));
|
|
661
655
|
}
|
|
662
|
-
function
|
|
663
|
-
const
|
|
664
|
-
if (!(typeof
|
|
665
|
-
const
|
|
666
|
-
if (!
|
|
656
|
+
function et(t, n) {
|
|
657
|
+
const i = typeof t == "string" ? { id: t } : t, g = y[i.id], p = i.label ?? g?.label ?? String(i.id), f = i.visible ?? g?.visible ?? !0;
|
|
658
|
+
if (!(typeof f == "function" ? f(n) : f !== !1)) return null;
|
|
659
|
+
const pe = i.enable ?? g?.enable ?? !0, Ct = typeof pe == "function" ? pe(n) : pe !== !1, Me = i.handler ?? g?.handler;
|
|
660
|
+
if (!Me) return null;
|
|
667
661
|
const kt = async () => {
|
|
668
|
-
await Promise.resolve(
|
|
662
|
+
await Promise.resolve(Me(n));
|
|
669
663
|
};
|
|
670
664
|
return {
|
|
671
|
-
id: String(
|
|
672
|
-
label:
|
|
673
|
-
disabled: !
|
|
665
|
+
id: String(i.id),
|
|
666
|
+
label: p,
|
|
667
|
+
disabled: !Ct,
|
|
674
668
|
action: kt
|
|
675
669
|
};
|
|
676
670
|
}
|
|
677
|
-
const
|
|
671
|
+
const W = k(() => {
|
|
678
672
|
if (!R.visible || !R.target || e.contextmenu === !1) return [];
|
|
679
|
-
const t = Array.isArray(e.contextmenu) ? e.contextmenu :
|
|
680
|
-
return t.map((
|
|
673
|
+
const t = Array.isArray(e.contextmenu) ? e.contextmenu : ue, n = { target: R.target, controller: a };
|
|
674
|
+
return t.map((i) => et(i, n)).filter((i) => !!i);
|
|
681
675
|
});
|
|
682
|
-
function
|
|
683
|
-
const t =
|
|
676
|
+
function tt() {
|
|
677
|
+
const t = Q.value;
|
|
684
678
|
if (!t) return;
|
|
685
|
-
const n = 8, { innerWidth:
|
|
686
|
-
let
|
|
687
|
-
|
|
679
|
+
const n = 8, { innerWidth: i, innerHeight: g } = window, p = t.getBoundingClientRect();
|
|
680
|
+
let f = R.position.x, N = R.position.y;
|
|
681
|
+
p.right > i - n && (f = Math.max(n, i - p.width - n)), p.bottom > g - n && (N = Math.max(n, g - p.height - n)), (f !== R.position.x || N !== R.position.y) && (R.position.x = f, R.position.y = N);
|
|
688
682
|
}
|
|
689
|
-
function
|
|
683
|
+
function nt(t, n) {
|
|
690
684
|
O.value[n] = t ?? null;
|
|
691
685
|
}
|
|
692
|
-
function
|
|
686
|
+
function ot(t) {
|
|
693
687
|
if (t < 0) return;
|
|
694
688
|
O.value[t]?.focus({ preventScroll: !0 });
|
|
695
689
|
}
|
|
696
|
-
function
|
|
697
|
-
if (!
|
|
698
|
-
const
|
|
699
|
-
let
|
|
700
|
-
for (let
|
|
701
|
-
if (
|
|
690
|
+
function ee(t, n, i = W.value) {
|
|
691
|
+
if (!i.length) return -1;
|
|
692
|
+
const g = i.length;
|
|
693
|
+
let p = t;
|
|
694
|
+
for (let f = 0; f < g; f++)
|
|
695
|
+
if (p = (p + n + g) % g, !i[p].disabled) return p;
|
|
702
696
|
return -1;
|
|
703
697
|
}
|
|
704
|
-
function
|
|
705
|
-
D.value = t, !(t < 0) && B(() =>
|
|
698
|
+
function J(t) {
|
|
699
|
+
D.value = t, !(t < 0) && B(() => ot(t));
|
|
706
700
|
}
|
|
707
|
-
function
|
|
708
|
-
const n =
|
|
709
|
-
n !== -1 &&
|
|
701
|
+
function Se(t) {
|
|
702
|
+
const n = ee(D.value, t);
|
|
703
|
+
n !== -1 && J(n);
|
|
710
704
|
}
|
|
711
|
-
function
|
|
705
|
+
function rt(t) {
|
|
712
706
|
if (!R.visible) return;
|
|
713
|
-
const n = t.key,
|
|
714
|
-
if (!
|
|
707
|
+
const n = t.key, i = W.value;
|
|
708
|
+
if (!i.length) return;
|
|
715
709
|
if (n === "Tab") {
|
|
716
|
-
|
|
710
|
+
w();
|
|
717
711
|
return;
|
|
718
712
|
}
|
|
719
713
|
if ([
|
|
@@ -731,93 +725,100 @@ const Jt = Ce({
|
|
|
731
725
|
switch (t.preventDefault(), n) {
|
|
732
726
|
case "ArrowDown":
|
|
733
727
|
case "ArrowRight":
|
|
734
|
-
|
|
728
|
+
Se(1);
|
|
735
729
|
break;
|
|
736
730
|
case "ArrowUp":
|
|
737
731
|
case "ArrowLeft":
|
|
738
|
-
|
|
732
|
+
Se(-1);
|
|
739
733
|
break;
|
|
740
734
|
case "Home":
|
|
741
|
-
|
|
735
|
+
J(ee(-1, 1));
|
|
742
736
|
break;
|
|
743
737
|
case "End":
|
|
744
|
-
|
|
738
|
+
J(ee(i.length, -1));
|
|
745
739
|
break;
|
|
746
740
|
case "Enter":
|
|
747
741
|
case " ":
|
|
748
742
|
case "Spacebar": {
|
|
749
|
-
const
|
|
750
|
-
if (
|
|
751
|
-
const
|
|
752
|
-
|
|
743
|
+
const p = D.value;
|
|
744
|
+
if (p > -1) {
|
|
745
|
+
const f = i[p];
|
|
746
|
+
f.disabled || Ie(f);
|
|
753
747
|
}
|
|
754
748
|
break;
|
|
755
749
|
}
|
|
756
750
|
case "Escape":
|
|
757
|
-
|
|
751
|
+
w();
|
|
758
752
|
break;
|
|
759
753
|
}
|
|
760
754
|
}
|
|
761
|
-
async function
|
|
762
|
-
t.disabled || (
|
|
755
|
+
async function Ie(t) {
|
|
756
|
+
t.disabled || (w(), await t.action());
|
|
763
757
|
}
|
|
764
|
-
function
|
|
758
|
+
function ce(t) {
|
|
765
759
|
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";
|
|
766
760
|
}
|
|
767
|
-
function
|
|
768
|
-
return h.value[t.id] ||
|
|
761
|
+
function at(t) {
|
|
762
|
+
return h.value[t.id] || ce(t);
|
|
769
763
|
}
|
|
770
|
-
function
|
|
771
|
-
return
|
|
764
|
+
function xe(t, n) {
|
|
765
|
+
return Ke({
|
|
772
766
|
name: n,
|
|
773
|
-
setup(
|
|
774
|
-
return () =>
|
|
767
|
+
setup(i, { attrs: g, slots: p }) {
|
|
768
|
+
return () => Pt(t, g, p);
|
|
775
769
|
}
|
|
776
770
|
});
|
|
777
771
|
}
|
|
778
|
-
const
|
|
779
|
-
function it(t, n,
|
|
780
|
-
|
|
772
|
+
const G = /* @__PURE__ */ new Map(), fe = S(0);
|
|
773
|
+
function it(t, n, i) {
|
|
774
|
+
G.has(i) || (G.set(i, n), fe.value++), t && F(t, i);
|
|
781
775
|
}
|
|
782
776
|
function lt(t, n) {
|
|
783
777
|
return t && ((!t.name || t.name !== n) && (t.name = n), t);
|
|
784
778
|
}
|
|
785
|
-
function st(t) {
|
|
786
|
-
|
|
787
|
-
|
|
779
|
+
function st(t, n) {
|
|
780
|
+
if (!t) return t;
|
|
781
|
+
const i = G.get(n);
|
|
782
|
+
if (i) return i;
|
|
783
|
+
const g = xe(t, n);
|
|
784
|
+
return G.set(n, g), fe.value++, g;
|
|
788
785
|
}
|
|
789
|
-
function
|
|
790
|
-
const n = a.getRouteKey(t),
|
|
791
|
-
|
|
786
|
+
function ut(t) {
|
|
787
|
+
const n = a.getRouteKey(t), i = s.currentRoute.value, g = a.getRouteKey(i);
|
|
788
|
+
return n === g;
|
|
789
|
+
}
|
|
790
|
+
function De(t) {
|
|
791
|
+
const n = a.getRouteKey(t), i = a.tabs.find((f) => f.id === n);
|
|
792
|
+
if (!i)
|
|
792
793
|
return console.warn("[RouterTab] Tab not found for route:", n), `${n}::0`;
|
|
793
|
-
const
|
|
794
|
+
const g = i.renderKey ?? 0, p = `${n}::${g}`;
|
|
794
795
|
return (n.includes("students") || n.includes("classroom") || n.includes("quiz")) && console.log(`[getComponentCacheKey] Route: ${t.fullPath}`, {
|
|
795
796
|
routeKey: n,
|
|
796
|
-
renderKey:
|
|
797
|
-
cacheKey:
|
|
798
|
-
tabAlive:
|
|
799
|
-
includeKeys:
|
|
800
|
-
isIncluded:
|
|
801
|
-
}),
|
|
797
|
+
renderKey: g,
|
|
798
|
+
cacheKey: p,
|
|
799
|
+
tabAlive: i.alive,
|
|
800
|
+
includeKeys: ge.value,
|
|
801
|
+
isIncluded: ge.value.includes(p)
|
|
802
|
+
}), p;
|
|
802
803
|
}
|
|
803
|
-
function
|
|
804
|
-
return `${
|
|
804
|
+
function ct(t) {
|
|
805
|
+
return `${De(t)}::refresh`;
|
|
805
806
|
}
|
|
806
|
-
function
|
|
807
|
+
function de(t) {
|
|
807
808
|
return !(t.closable === !1 || a.options.keepLastTab && a.tabs.length <= 1);
|
|
808
809
|
}
|
|
809
|
-
async function
|
|
810
|
+
async function ft(t) {
|
|
810
811
|
await a.closeTab(t.id);
|
|
811
812
|
}
|
|
812
|
-
function
|
|
813
|
-
n ?
|
|
813
|
+
function dt(t, n) {
|
|
814
|
+
n ? V.set(t, n) : V.delete(t);
|
|
814
815
|
}
|
|
815
|
-
function
|
|
816
|
+
function be(t) {
|
|
816
817
|
B(() => {
|
|
817
|
-
const n =
|
|
818
|
-
if (n &&
|
|
819
|
-
const
|
|
820
|
-
(
|
|
818
|
+
const n = V.get(t), i = Z.value;
|
|
819
|
+
if (n && i) {
|
|
820
|
+
const g = n.getBoundingClientRect(), p = i.getBoundingClientRect();
|
|
821
|
+
(g.left < p.left || g.right > p.right) && n.scrollIntoView({
|
|
821
822
|
behavior: "smooth",
|
|
822
823
|
block: "nearest",
|
|
823
824
|
inline: "nearest"
|
|
@@ -825,73 +826,73 @@ const Jt = Ce({
|
|
|
825
826
|
}
|
|
826
827
|
});
|
|
827
828
|
}
|
|
828
|
-
function
|
|
829
|
+
function bt(t) {
|
|
829
830
|
if (t.href && typeof window < "u") {
|
|
830
831
|
t.target && t.target !== "_self" ? window.open(t.href, t.target) : window.location.assign(t.href);
|
|
831
832
|
return;
|
|
832
833
|
}
|
|
833
|
-
a.activeId.value !== t.id && (a.openTab(t.to, !1),
|
|
834
|
+
a.activeId.value !== t.id && (a.openTab(t.to, !1), be(t.id));
|
|
834
835
|
}
|
|
835
|
-
function
|
|
836
|
+
function gt(t) {
|
|
836
837
|
return [
|
|
837
838
|
"router-tab__item",
|
|
838
839
|
{
|
|
839
840
|
"is-active": a.activeId.value === t.id,
|
|
840
|
-
"is-closable":
|
|
841
|
-
"is-dragging":
|
|
842
|
-
"is-drag-over":
|
|
841
|
+
"is-closable": de(t),
|
|
842
|
+
"is-dragging": C.dragging && C.dragTab?.id === t.id,
|
|
843
|
+
"is-drag-over": C.dropIndex === H(t.id)
|
|
843
844
|
},
|
|
844
845
|
t.tabClass
|
|
845
846
|
];
|
|
846
847
|
}
|
|
847
|
-
function gt(t) {
|
|
848
|
-
return a.refreshingKey.value === a.getRouteKey(t);
|
|
849
|
-
}
|
|
850
848
|
function pt(t) {
|
|
851
|
-
|
|
852
|
-
return l ? l.alive : !1;
|
|
849
|
+
return a.refreshingKey.value === a.getRouteKey(t);
|
|
853
850
|
}
|
|
854
851
|
function vt(t) {
|
|
852
|
+
const n = a.getRouteKey(t), i = a.tabs.find((g) => g.id === n);
|
|
853
|
+
return i ? i.alive : !1;
|
|
854
|
+
}
|
|
855
|
+
function ht(t) {
|
|
855
856
|
const n = a.getRouteKey(t);
|
|
856
|
-
return !!a.tabs.find((
|
|
857
|
+
return !!a.tabs.find((g) => g.id === n);
|
|
857
858
|
}
|
|
858
|
-
function
|
|
859
|
-
e.sortable && (
|
|
859
|
+
function mt(t, n, i) {
|
|
860
|
+
e.sortable && (C.dragging = !0, C.dragIndex = n, C.dragTab = t, i.dataTransfer && (i.dataTransfer.effectAllowed = "move", i.dataTransfer.setData("text/plain", t.id)), r("tab-sort", { tab: t, index: n }));
|
|
860
861
|
}
|
|
861
|
-
function
|
|
862
|
-
!e.sortable || !
|
|
862
|
+
function yt(t, n) {
|
|
863
|
+
!e.sortable || !C.dragging || (n.preventDefault(), n.dataTransfer && (n.dataTransfer.dropEffect = "move"));
|
|
863
864
|
}
|
|
864
|
-
function
|
|
865
|
-
!e.sortable || !
|
|
865
|
+
function Tt(t) {
|
|
866
|
+
!e.sortable || !C.dragging || (C.dropIndex = t);
|
|
866
867
|
}
|
|
867
|
-
function
|
|
868
|
-
!e.sortable ||
|
|
868
|
+
function Rt() {
|
|
869
|
+
!e.sortable || C.dragging;
|
|
869
870
|
}
|
|
870
|
-
function
|
|
871
|
-
if (!(!e.sortable || !
|
|
872
|
-
if (n.preventDefault(),
|
|
873
|
-
const
|
|
874
|
-
a.tabs.splice(t, 0,
|
|
875
|
-
tab:
|
|
876
|
-
fromIndex:
|
|
871
|
+
function wt(t, n) {
|
|
872
|
+
if (!(!e.sortable || !C.dragging)) {
|
|
873
|
+
if (n.preventDefault(), C.dragIndex !== -1 && C.dragIndex !== t) {
|
|
874
|
+
const i = a.tabs.splice(C.dragIndex, 1)[0];
|
|
875
|
+
a.tabs.splice(t, 0, i), r("tab-sorted", {
|
|
876
|
+
tab: i,
|
|
877
|
+
fromIndex: C.dragIndex,
|
|
877
878
|
toIndex: t
|
|
878
879
|
});
|
|
879
880
|
}
|
|
880
|
-
|
|
881
|
+
Be();
|
|
881
882
|
}
|
|
882
883
|
}
|
|
883
|
-
function
|
|
884
|
-
|
|
884
|
+
function Be() {
|
|
885
|
+
C.dragging = !1, C.dragIndex = -1, C.dropIndex = -1, C.dragTab = null;
|
|
885
886
|
}
|
|
886
887
|
ke(() => {
|
|
887
|
-
document.addEventListener("keydown",
|
|
888
|
-
}),
|
|
889
|
-
document.removeEventListener("keydown",
|
|
888
|
+
document.addEventListener("keydown", w);
|
|
889
|
+
}), At(() => {
|
|
890
|
+
document.removeEventListener("keydown", w), o.appContext.config.globalProperties.$tabs = null, M.forEach((t) => {
|
|
890
891
|
t.forEach((n) => {
|
|
891
892
|
try {
|
|
892
893
|
n();
|
|
893
|
-
} catch (
|
|
894
|
-
console.error("[RouterTab] Error during cleanup:",
|
|
894
|
+
} catch (i) {
|
|
895
|
+
console.error("[RouterTab] Error during cleanup:", i);
|
|
895
896
|
}
|
|
896
897
|
});
|
|
897
898
|
}), M.clear(), P.clear();
|
|
@@ -903,181 +904,182 @@ const Jt = Ce({
|
|
|
903
904
|
), A(
|
|
904
905
|
() => a.activeId.value,
|
|
905
906
|
(t) => {
|
|
906
|
-
t &&
|
|
907
|
+
t && be(t), w();
|
|
907
908
|
}
|
|
908
909
|
), A(
|
|
909
910
|
() => a.tabs.length,
|
|
910
911
|
() => {
|
|
911
|
-
const t = new Set(a.tabs.map((
|
|
912
|
-
Array.from(P.keys()).forEach((
|
|
913
|
-
t.has(
|
|
912
|
+
const t = new Set(a.tabs.map((i) => i.id));
|
|
913
|
+
Array.from(P.keys()).forEach((i) => {
|
|
914
|
+
t.has(i) || (console.log(`[RouterTab] Cleaning up stale component instance: ${i}`), L(i));
|
|
914
915
|
});
|
|
915
916
|
}
|
|
916
917
|
), A(
|
|
917
918
|
() => e.contextmenu,
|
|
918
919
|
(t) => {
|
|
919
|
-
t ||
|
|
920
|
+
t || w();
|
|
920
921
|
}
|
|
921
922
|
), A(
|
|
922
|
-
() =>
|
|
923
|
+
() => W.value.length,
|
|
923
924
|
(t) => {
|
|
924
|
-
R.visible && t === 0 &&
|
|
925
|
+
R.visible && t === 0 && w();
|
|
925
926
|
},
|
|
926
927
|
{ flush: "post" }
|
|
927
928
|
// Run after component updates to prevent blocking render
|
|
928
|
-
), A(
|
|
929
|
+
), A(W, (t) => {
|
|
929
930
|
if (!R.visible) return;
|
|
930
931
|
O.value = new Array(t.length).fill(null);
|
|
931
|
-
const n =
|
|
932
|
-
|
|
932
|
+
const n = ee(-1, 1, t);
|
|
933
|
+
J(n);
|
|
933
934
|
}, { flush: "post" }), A(
|
|
934
935
|
() => R.visible,
|
|
935
936
|
(t) => {
|
|
936
937
|
t || (D.value = -1, O.value = []);
|
|
937
938
|
}
|
|
938
939
|
);
|
|
939
|
-
const
|
|
940
|
+
const ge = a.includeKeys;
|
|
940
941
|
return {
|
|
941
942
|
controller: a,
|
|
942
943
|
tabs: a.tabs,
|
|
943
|
-
includeKeys:
|
|
944
|
-
componentCache:
|
|
945
|
-
componentCacheTrigger:
|
|
944
|
+
includeKeys: ge,
|
|
945
|
+
componentCache: G,
|
|
946
|
+
componentCacheTrigger: fe,
|
|
946
947
|
cacheCurrentComponent: it,
|
|
947
|
-
tabTransitionProps:
|
|
948
|
-
pageTransitionProps:
|
|
949
|
-
buildTabClass:
|
|
950
|
-
activate:
|
|
951
|
-
close:
|
|
948
|
+
tabTransitionProps: U,
|
|
949
|
+
pageTransitionProps: se,
|
|
950
|
+
buildTabClass: gt,
|
|
951
|
+
activate: bt,
|
|
952
|
+
close: ft,
|
|
952
953
|
context: R,
|
|
953
|
-
menuItems:
|
|
954
|
-
handleMenuAction:
|
|
954
|
+
menuItems: W,
|
|
955
|
+
handleMenuAction: Ie,
|
|
955
956
|
showContextMenu: I,
|
|
956
|
-
hideContextMenu:
|
|
957
|
-
getTabTitle:
|
|
958
|
-
isClosable:
|
|
959
|
-
isRefreshing:
|
|
960
|
-
isTabCached:
|
|
961
|
-
isTabReady:
|
|
962
|
-
hasCustomSlot:
|
|
957
|
+
hideContextMenu: w,
|
|
958
|
+
getTabTitle: ce,
|
|
959
|
+
isClosable: de,
|
|
960
|
+
isRefreshing: pt,
|
|
961
|
+
isTabCached: vt,
|
|
962
|
+
isTabReady: ht,
|
|
963
|
+
hasCustomSlot: v,
|
|
963
964
|
hasStartSlot: T,
|
|
964
|
-
hasEndSlot:
|
|
965
|
-
onDragStart:
|
|
966
|
-
onDragOver:
|
|
967
|
-
onDragEnter:
|
|
968
|
-
onDragLeave:
|
|
969
|
-
onDrop:
|
|
970
|
-
onDragEnd:
|
|
965
|
+
hasEndSlot: l,
|
|
966
|
+
onDragStart: mt,
|
|
967
|
+
onDragOver: yt,
|
|
968
|
+
onDragEnter: Tt,
|
|
969
|
+
onDragLeave: Rt,
|
|
970
|
+
onDrop: wt,
|
|
971
|
+
onDragEnd: Be,
|
|
971
972
|
setupComponentWatching: Y,
|
|
972
973
|
cleanupComponentWatching: L,
|
|
973
974
|
handleComponentRef: F,
|
|
974
|
-
getReactiveTabTitle:
|
|
975
|
-
getComponentCacheKey:
|
|
976
|
-
getRefreshComponentKey:
|
|
977
|
-
createNamedComponent:
|
|
975
|
+
getReactiveTabTitle: at,
|
|
976
|
+
getComponentCacheKey: De,
|
|
977
|
+
getRefreshComponentKey: ct,
|
|
978
|
+
createNamedComponent: xe,
|
|
978
979
|
ensureNamedComponent: lt,
|
|
979
|
-
|
|
980
|
+
getNamedComponent: st,
|
|
981
|
+
shouldRenderRoute: ut,
|
|
980
982
|
triggerTabUpdate: E,
|
|
981
|
-
menuRef:
|
|
983
|
+
menuRef: Q,
|
|
982
984
|
highlightedIndex: D,
|
|
983
|
-
setMenuItemRef:
|
|
984
|
-
onMenuKeydown:
|
|
985
|
-
highlightMenuIndex:
|
|
986
|
-
scrollContainer:
|
|
987
|
-
setTabRef:
|
|
988
|
-
scrollTabIntoView:
|
|
985
|
+
setMenuItemRef: nt,
|
|
986
|
+
onMenuKeydown: rt,
|
|
987
|
+
highlightMenuIndex: J,
|
|
988
|
+
scrollContainer: Z,
|
|
989
|
+
setTabRef: dt,
|
|
990
|
+
scrollTabIntoView: be
|
|
989
991
|
};
|
|
990
992
|
}
|
|
991
|
-
}),
|
|
993
|
+
}), Xt = (e, r) => {
|
|
992
994
|
const o = e.__vccOpts || e;
|
|
993
995
|
for (const [s, a] of r)
|
|
994
996
|
o[s] = a;
|
|
995
997
|
return o;
|
|
996
|
-
},
|
|
998
|
+
}, Qt = { class: "router-tab" }, Zt = { class: "router-tab__header" }, en = {
|
|
997
999
|
class: "router-tab__scroll",
|
|
998
1000
|
ref: "scrollContainer"
|
|
999
|
-
},
|
|
1000
|
-
function
|
|
1001
|
-
const T =
|
|
1002
|
-
return $(), x("div",
|
|
1003
|
-
j("header",
|
|
1001
|
+
}, tn = ["data-title", "draggable", "onClick", "onAuxclick", "onContextmenu", "onDragstart", "onDragover", "onDragenter", "onDrop"], nn = ["title"], on = ["onClick"], rn = { class: "router-tab__container" }, an = ["aria-disabled", "disabled", "tabindex", "onMouseenter", "onClick"];
|
|
1002
|
+
function ln(e, r, o, s, a, v) {
|
|
1003
|
+
const T = St("RouterView");
|
|
1004
|
+
return $(), x("div", Qt, [
|
|
1005
|
+
j("header", Zt, [
|
|
1004
1006
|
j("div", {
|
|
1005
|
-
class:
|
|
1007
|
+
class: q(["router-tab__slot-start", { "has-content": e.hasStartSlot }])
|
|
1006
1008
|
}, [
|
|
1007
|
-
|
|
1009
|
+
ve(e.$slots, "start")
|
|
1008
1010
|
], 2),
|
|
1009
|
-
j("div",
|
|
1010
|
-
|
|
1011
|
+
j("div", en, [
|
|
1012
|
+
Oe(xt, he({
|
|
1011
1013
|
tag: "ul",
|
|
1012
1014
|
class: "router-tab__nav"
|
|
1013
1015
|
}, e.tabTransitionProps), {
|
|
1014
|
-
default:
|
|
1015
|
-
($(!0), x(
|
|
1016
|
-
key:
|
|
1017
|
-
class:
|
|
1018
|
-
"data-title": e.getTabTitle(
|
|
1016
|
+
default: me(() => [
|
|
1017
|
+
($(!0), x(ye, null, je(e.tabs, (l, d) => ($(), x("li", {
|
|
1018
|
+
key: l.id,
|
|
1019
|
+
class: q(e.buildTabClass(l)),
|
|
1020
|
+
"data-title": e.getTabTitle(l),
|
|
1019
1021
|
draggable: e.sortable,
|
|
1020
1022
|
ref_for: !0,
|
|
1021
|
-
ref: (h) => e.setTabRef(
|
|
1022
|
-
onClick: (h) => e.activate(
|
|
1023
|
-
onAuxclick:
|
|
1024
|
-
onContextmenu:
|
|
1025
|
-
onDragstart: (h) => e.onDragStart(
|
|
1026
|
-
onDragover: (h) => e.onDragOver(
|
|
1027
|
-
onDragenter: (h) => e.onDragEnter(
|
|
1023
|
+
ref: (h) => e.setTabRef(l.id, h),
|
|
1024
|
+
onClick: (h) => e.activate(l),
|
|
1025
|
+
onAuxclick: Te((h) => e.close(l), ["middle", "prevent"]),
|
|
1026
|
+
onContextmenu: Te((h) => e.showContextMenu(l, h), ["prevent"]),
|
|
1027
|
+
onDragstart: (h) => e.onDragStart(l, d, h),
|
|
1028
|
+
onDragover: (h) => e.onDragOver(d, h),
|
|
1029
|
+
onDragenter: (h) => e.onDragEnter(d),
|
|
1028
1030
|
onDragleave: r[0] || (r[0] = (...h) => e.onDragLeave && e.onDragLeave(...h)),
|
|
1029
|
-
onDrop: (h) => e.onDrop(
|
|
1031
|
+
onDrop: (h) => e.onDrop(d, h),
|
|
1030
1032
|
onDragend: r[1] || (r[1] = (...h) => e.onDragEnd && e.onDragEnd(...h))
|
|
1031
1033
|
}, [
|
|
1032
|
-
|
|
1034
|
+
l.icon ? ($(), x("i", {
|
|
1033
1035
|
key: 0,
|
|
1034
|
-
class:
|
|
1035
|
-
}, null, 2)) :
|
|
1036
|
+
class: q(["router-tab__item-icon", l.icon])
|
|
1037
|
+
}, null, 2)) : te("", !0),
|
|
1036
1038
|
j("span", {
|
|
1037
1039
|
class: "router-tab__item-title",
|
|
1038
|
-
title: e.getReactiveTabTitle(
|
|
1039
|
-
},
|
|
1040
|
-
e.isClosable(
|
|
1040
|
+
title: e.getReactiveTabTitle(l)
|
|
1041
|
+
}, Ue(e.getReactiveTabTitle(l)), 9, nn),
|
|
1042
|
+
e.isClosable(l) ? ($(), x("a", {
|
|
1041
1043
|
key: 1,
|
|
1042
1044
|
class: "router-tab__item-close",
|
|
1043
|
-
onClick:
|
|
1044
|
-
}, null, 8,
|
|
1045
|
-
], 42,
|
|
1045
|
+
onClick: Te((h) => e.close(l), ["stop"])
|
|
1046
|
+
}, null, 8, on)) : te("", !0)
|
|
1047
|
+
], 42, tn))), 128))
|
|
1046
1048
|
]),
|
|
1047
1049
|
_: 1
|
|
1048
1050
|
}, 16)
|
|
1049
1051
|
], 512),
|
|
1050
1052
|
j("div", {
|
|
1051
|
-
class:
|
|
1053
|
+
class: q(["router-tab__slot-end", { "has-content": e.hasEndSlot }])
|
|
1052
1054
|
}, [
|
|
1053
|
-
|
|
1055
|
+
ve(e.$slots, "end")
|
|
1054
1056
|
], 2)
|
|
1055
1057
|
]),
|
|
1056
|
-
j("div",
|
|
1057
|
-
|
|
1058
|
-
default:
|
|
1059
|
-
e.hasCustomSlot ?
|
|
1060
|
-
Component:
|
|
1061
|
-
route:
|
|
1058
|
+
j("div", rn, [
|
|
1059
|
+
Oe(T, null, {
|
|
1060
|
+
default: me(({ Component: l, route: d }) => [
|
|
1061
|
+
e.hasCustomSlot ? ve(e.$slots, "default", Dt(he({ key: 0 }, {
|
|
1062
|
+
Component: l,
|
|
1063
|
+
route: d,
|
|
1062
1064
|
controller: e.controller,
|
|
1063
|
-
pageRef: (h) => e.handleComponentRef(h, e.controller.getRouteKey(
|
|
1064
|
-
}))) : ($(), x(
|
|
1065
|
-
e.controller.options.keepAlive ? ($(),
|
|
1065
|
+
pageRef: (h) => e.handleComponentRef(h, e.controller.getRouteKey(d))
|
|
1066
|
+
}))) : ($(), x(ye, { key: 1 }, [
|
|
1067
|
+
e.controller.options.keepAlive ? ($(), ne(Bt, {
|
|
1066
1068
|
key: 0,
|
|
1067
1069
|
include: e.includeKeys
|
|
1068
1070
|
}, [
|
|
1069
|
-
|
|
1070
|
-
key: e.
|
|
1071
|
-
ref: (h) => e.handleComponentRef(h, e.controller.getRouteKey(
|
|
1071
|
+
l ? ($(), ne(Ve(e.getNamedComponent(l, e.getComponentCacheKey(d))), {
|
|
1072
|
+
key: e.isRefreshing(d) ? e.getRefreshComponentKey(d) : e.getComponentCacheKey(d),
|
|
1073
|
+
ref: (h) => e.handleComponentRef(h, e.controller.getRouteKey(d)),
|
|
1072
1074
|
class: "router-tab-page"
|
|
1073
|
-
})) :
|
|
1074
|
-
], 1032, ["include"])) : ($(),
|
|
1075
|
-
default:
|
|
1076
|
-
|
|
1077
|
-
key: e.controller.getRouteKey(
|
|
1078
|
-
ref: (h) => e.handleComponentRef(h, e.controller.getRouteKey(
|
|
1075
|
+
})) : te("", !0)
|
|
1076
|
+
], 1032, ["include"])) : ($(), ne(Mt, he({ key: 1 }, e.pageTransitionProps, { appear: "" }), {
|
|
1077
|
+
default: me(() => [
|
|
1078
|
+
l ? ($(), ne(Ve(l), {
|
|
1079
|
+
key: e.controller.getRouteKey(d),
|
|
1080
|
+
ref: (h) => e.handleComponentRef(h, e.controller.getRouteKey(d)),
|
|
1079
1081
|
class: "router-tab-page"
|
|
1080
|
-
})) :
|
|
1082
|
+
})) : te("", !0)
|
|
1081
1083
|
]),
|
|
1082
1084
|
_: 2
|
|
1083
1085
|
}, 1040))
|
|
@@ -1086,34 +1088,34 @@ function an(e, r, o, s, a, p) {
|
|
|
1086
1088
|
_: 3
|
|
1087
1089
|
})
|
|
1088
1090
|
]),
|
|
1089
|
-
|
|
1091
|
+
It(j("div", {
|
|
1090
1092
|
ref: "menuRef",
|
|
1091
1093
|
class: "router-tab__contextmenu",
|
|
1092
1094
|
role: "menu",
|
|
1093
|
-
onKeydown: r[2] || (r[2] = (...
|
|
1094
|
-
style:
|
|
1095
|
+
onKeydown: r[2] || (r[2] = (...l) => e.onMenuKeydown && e.onMenuKeydown(...l)),
|
|
1096
|
+
style: Lt({ left: e.context.position.x + "px", top: e.context.position.y + "px" })
|
|
1095
1097
|
}, [
|
|
1096
|
-
($(!0), x(
|
|
1097
|
-
key:
|
|
1098
|
+
($(!0), x(ye, null, je(e.menuItems, (l, d) => ($(), x("a", {
|
|
1099
|
+
key: l.id,
|
|
1098
1100
|
role: "menuitem",
|
|
1099
|
-
class:
|
|
1100
|
-
"aria-disabled":
|
|
1101
|
-
disabled:
|
|
1102
|
-
tabindex:
|
|
1101
|
+
class: q(["router-tab__contextmenu-item", { "is-focused": d === e.highlightedIndex }]),
|
|
1102
|
+
"aria-disabled": l.disabled,
|
|
1103
|
+
disabled: l.disabled,
|
|
1104
|
+
tabindex: l.disabled ? -1 : d === e.highlightedIndex ? 0 : -1,
|
|
1103
1105
|
ref_for: !0,
|
|
1104
|
-
ref: (h) => e.setMenuItemRef(h,
|
|
1105
|
-
onMouseenter: (h) => !
|
|
1106
|
-
onClick: (h) => e.handleMenuAction(
|
|
1107
|
-
},
|
|
1106
|
+
ref: (h) => e.setMenuItemRef(h, d),
|
|
1107
|
+
onMouseenter: (h) => !l.disabled && e.highlightMenuIndex(d),
|
|
1108
|
+
onClick: (h) => e.handleMenuAction(l)
|
|
1109
|
+
}, Ue(l.label), 43, an))), 128))
|
|
1108
1110
|
], 36), [
|
|
1109
|
-
[
|
|
1111
|
+
[Ot, e.context.visible && e.context.target]
|
|
1110
1112
|
])
|
|
1111
1113
|
]);
|
|
1112
1114
|
}
|
|
1113
|
-
const
|
|
1115
|
+
const Fe = /* @__PURE__ */ Xt(qt, [["render", ln]]), sn = {
|
|
1114
1116
|
class: "router-tabs",
|
|
1115
1117
|
"aria-hidden": "true"
|
|
1116
|
-
},
|
|
1118
|
+
}, Ce = /* @__PURE__ */ Ke({
|
|
1117
1119
|
name: "RouterTabs",
|
|
1118
1120
|
__name: "RouterTabs",
|
|
1119
1121
|
props: {
|
|
@@ -1128,10 +1130,10 @@ const Ye = /* @__PURE__ */ Gt(Jt, [["render", an]]), ln = {
|
|
|
1128
1130
|
fallbackRoute: {}
|
|
1129
1131
|
},
|
|
1130
1132
|
setup(e) {
|
|
1131
|
-
return
|
|
1133
|
+
return Ge(e), (o, s) => ($(), x("span", sn));
|
|
1132
1134
|
}
|
|
1133
|
-
}),
|
|
1134
|
-
let
|
|
1135
|
+
}), qe = "tab-theme-style", Xe = "tab-theme-primary-color", un = "system", Qe = "(prefers-color-scheme: dark)";
|
|
1136
|
+
let X = null;
|
|
1135
1137
|
const K = {
|
|
1136
1138
|
primary: "#034960",
|
|
1137
1139
|
background: "#ffffff",
|
|
@@ -1146,7 +1148,7 @@ const K = {
|
|
|
1146
1148
|
activeButtonBackground: "#034960",
|
|
1147
1149
|
activeButtonColor: "#ffffff",
|
|
1148
1150
|
iconColor: "#475569"
|
|
1149
|
-
},
|
|
1151
|
+
}, cn = {
|
|
1150
1152
|
primary: "#38bdf8",
|
|
1151
1153
|
background: "#0f172a",
|
|
1152
1154
|
text: "#f1f5f9",
|
|
@@ -1162,7 +1164,7 @@ const K = {
|
|
|
1162
1164
|
activeButtonColor: "#0f172a",
|
|
1163
1165
|
iconColor: "#cbd5e1"
|
|
1164
1166
|
};
|
|
1165
|
-
function
|
|
1167
|
+
function fn(e) {
|
|
1166
1168
|
if (typeof window > "u") return null;
|
|
1167
1169
|
const r = window.localStorage.getItem(e);
|
|
1168
1170
|
if (!r) return null;
|
|
@@ -1173,46 +1175,46 @@ function cn(e) {
|
|
|
1173
1175
|
return null;
|
|
1174
1176
|
}
|
|
1175
1177
|
}
|
|
1176
|
-
function
|
|
1178
|
+
function Ae(e) {
|
|
1177
1179
|
typeof document > "u" || (document.documentElement.style.setProperty("--router-tab-primary", e.primary ?? K.primary), document.documentElement.style.setProperty("--router-tab-header-bg", e.headerBackground ?? K.headerBackground), document.documentElement.style.setProperty("--router-tab-background", e.background ?? K.background), document.documentElement.style.setProperty("--router-tab-active-background", e.activeBackground ?? K.activeBackground), document.documentElement.style.setProperty("--router-tab-text", e.text ?? K.text), document.documentElement.style.setProperty("--router-tab-active-text", e.activeText ?? K.activeText), document.documentElement.style.setProperty("--router-tab-border", e.border ?? K.border), document.documentElement.style.setProperty("--router-tab-active-border", e.activeBorder ?? K.activeBorder), document.documentElement.style.setProperty("--router-tab-button-color", e.buttonColor ?? K.buttonColor), document.documentElement.style.setProperty("--router-tab-active-button-color", e.activeButtonColor ?? K.activeButtonColor), document.documentElement.style.setProperty("--router-tab-button-background", e.buttonBackground ?? K.buttonBackground), document.documentElement.style.setProperty("--router-tab-active-button-background", e.activeButtonBackground ?? K.activeButtonBackground), document.documentElement.style.setProperty("--router-tab-icon-color", e.iconColor ?? K.iconColor));
|
|
1178
1180
|
}
|
|
1179
|
-
function
|
|
1181
|
+
function Ze(e) {
|
|
1180
1182
|
if (typeof document > "u") return;
|
|
1181
|
-
const r = document.documentElement, o = window.matchMedia(
|
|
1183
|
+
const r = document.documentElement, o = window.matchMedia(Qe), s = () => {
|
|
1182
1184
|
r.dataset.theme = o.matches ? "dark" : "light";
|
|
1183
1185
|
};
|
|
1184
|
-
|
|
1186
|
+
X && (o.removeEventListener("change", X), X = null), e === "system" ? (s(), X = () => s(), o.addEventListener("change", X)) : r.dataset.theme = e;
|
|
1185
1187
|
}
|
|
1186
|
-
function
|
|
1188
|
+
function dn(e = {}) {
|
|
1187
1189
|
if (typeof window > "u") return;
|
|
1188
1190
|
const {
|
|
1189
|
-
styleKey: r =
|
|
1190
|
-
primaryKey: o =
|
|
1191
|
-
defaultStyle: s =
|
|
1191
|
+
styleKey: r = qe,
|
|
1192
|
+
primaryKey: o = Xe,
|
|
1193
|
+
defaultStyle: s = un,
|
|
1192
1194
|
defaultPrimary: a
|
|
1193
|
-
} = e,
|
|
1194
|
-
|
|
1195
|
-
const
|
|
1196
|
-
a && (
|
|
1197
|
-
const
|
|
1198
|
-
|
|
1199
|
-
...
|
|
1200
|
-
...
|
|
1201
|
-
} :
|
|
1195
|
+
} = e, v = window.localStorage.getItem(r) ?? s;
|
|
1196
|
+
Ze(v);
|
|
1197
|
+
const l = v === "dark" || v === "system" && window.matchMedia(Qe).matches ? { ...cn } : { ...K };
|
|
1198
|
+
a && (l.primary = a);
|
|
1199
|
+
const d = fn(o);
|
|
1200
|
+
Ae(d ? {
|
|
1201
|
+
...l,
|
|
1202
|
+
...d
|
|
1203
|
+
} : l);
|
|
1202
1204
|
}
|
|
1203
|
-
function
|
|
1205
|
+
function pn(e, r) {
|
|
1204
1206
|
if (typeof window > "u") return;
|
|
1205
|
-
const o = r?.styleKey ??
|
|
1206
|
-
window.localStorage.setItem(o, e),
|
|
1207
|
+
const o = r?.styleKey ?? qe;
|
|
1208
|
+
window.localStorage.setItem(o, e), Ze(e);
|
|
1207
1209
|
}
|
|
1208
|
-
function
|
|
1210
|
+
function vn(e, r) {
|
|
1209
1211
|
if (typeof window > "u") return;
|
|
1210
|
-
const o = r?.primaryKey ??
|
|
1211
|
-
window.localStorage.setItem(o, JSON.stringify(e)),
|
|
1212
|
+
const o = r?.primaryKey ?? Xe;
|
|
1213
|
+
window.localStorage.setItem(o, JSON.stringify(e)), Ae(e);
|
|
1212
1214
|
}
|
|
1213
|
-
function
|
|
1214
|
-
if (
|
|
1215
|
-
const s = !
|
|
1215
|
+
function re(e, r) {
|
|
1216
|
+
if (jt(e)) {
|
|
1217
|
+
const s = !Ut(e);
|
|
1216
1218
|
return {
|
|
1217
1219
|
value: e,
|
|
1218
1220
|
update: s ? (a) => {
|
|
@@ -1223,7 +1225,7 @@ function oe(e, r) {
|
|
|
1223
1225
|
}
|
|
1224
1226
|
if (typeof e == "function")
|
|
1225
1227
|
return {
|
|
1226
|
-
value:
|
|
1228
|
+
value: k(e),
|
|
1227
1229
|
update: () => {
|
|
1228
1230
|
}
|
|
1229
1231
|
};
|
|
@@ -1237,8 +1239,8 @@ function oe(e, r) {
|
|
|
1237
1239
|
}
|
|
1238
1240
|
};
|
|
1239
1241
|
}
|
|
1240
|
-
function
|
|
1241
|
-
const r =
|
|
1242
|
+
function Pe(e = {}) {
|
|
1243
|
+
const r = re(e.title, "Untitled"), o = re(e.icon, ""), s = re(e.closable, !0), a = re(e.meta, {});
|
|
1242
1244
|
return {
|
|
1243
1245
|
routeTabTitle: r.value,
|
|
1244
1246
|
routeTabIcon: o.value,
|
|
@@ -1250,67 +1252,67 @@ function Ae(e = {}) {
|
|
|
1250
1252
|
updateMeta: a.update
|
|
1251
1253
|
};
|
|
1252
1254
|
}
|
|
1253
|
-
function
|
|
1254
|
-
return
|
|
1255
|
-
title:
|
|
1256
|
-
icon:
|
|
1257
|
-
closable:
|
|
1255
|
+
function hn(e, r = "Page") {
|
|
1256
|
+
return Pe({
|
|
1257
|
+
title: k(() => e.value ? "Loading..." : r),
|
|
1258
|
+
icon: k(() => e.value ? "mdi-loading mdi-spin" : "mdi-page"),
|
|
1259
|
+
closable: k(() => !e.value)
|
|
1258
1260
|
});
|
|
1259
1261
|
}
|
|
1260
|
-
function
|
|
1261
|
-
return
|
|
1262
|
-
title:
|
|
1263
|
-
icon:
|
|
1262
|
+
function mn(e, r = "Page", o = "mdi-page") {
|
|
1263
|
+
return Pe({
|
|
1264
|
+
title: k(() => e.value > 0 ? `${r} (${e.value})` : r),
|
|
1265
|
+
icon: k(() => e.value > 0 ? "mdi-bell-badge" : o)
|
|
1264
1266
|
});
|
|
1265
1267
|
}
|
|
1266
|
-
function
|
|
1268
|
+
function yn(e, r = "Page") {
|
|
1267
1269
|
const o = {
|
|
1268
1270
|
normal: { suffix: "", icon: "mdi-page" },
|
|
1269
1271
|
loading: { suffix: " - Loading", icon: "mdi-loading mdi-spin" },
|
|
1270
1272
|
error: { suffix: " - Error", icon: "mdi-alert" },
|
|
1271
1273
|
success: { suffix: " - Success", icon: "mdi-check-circle" }
|
|
1272
1274
|
};
|
|
1273
|
-
return
|
|
1274
|
-
title:
|
|
1275
|
-
icon:
|
|
1276
|
-
closable:
|
|
1275
|
+
return Pe({
|
|
1276
|
+
title: k(() => r + o[e.value].suffix),
|
|
1277
|
+
icon: k(() => o[e.value].icon),
|
|
1278
|
+
closable: k(() => e.value !== "loading")
|
|
1277
1279
|
});
|
|
1278
1280
|
}
|
|
1279
|
-
let
|
|
1280
|
-
const
|
|
1281
|
+
let He = !1;
|
|
1282
|
+
const Tn = {
|
|
1281
1283
|
install(e, r) {
|
|
1282
|
-
if (
|
|
1283
|
-
|
|
1284
|
+
if (He) return;
|
|
1285
|
+
He = !0;
|
|
1284
1286
|
const {
|
|
1285
1287
|
initTheme: o = !0,
|
|
1286
1288
|
themeOptions: s,
|
|
1287
|
-
componentName: a =
|
|
1288
|
-
tabsComponentName:
|
|
1289
|
+
componentName: a = Fe.name || "RouterTab",
|
|
1290
|
+
tabsComponentName: v = Ce.name || "RouterTabs"
|
|
1289
1291
|
} = r ?? {};
|
|
1290
|
-
o &&
|
|
1292
|
+
o && dn(s ?? {}), e.component(a, Fe), e.component(v, Ce), v.toLowerCase() !== "router-tabs" && e.component("router-tabs", Ce), Object.defineProperty(e.config.globalProperties, "$tabs", {
|
|
1291
1293
|
configurable: !0,
|
|
1292
1294
|
enumerable: !1,
|
|
1293
1295
|
get() {
|
|
1294
|
-
return e._context.provides[
|
|
1296
|
+
return e._context.provides[le];
|
|
1295
1297
|
},
|
|
1296
1298
|
set(T) {
|
|
1297
|
-
T && e.provide(
|
|
1299
|
+
T && e.provide(le, T);
|
|
1298
1300
|
}
|
|
1299
1301
|
});
|
|
1300
1302
|
}
|
|
1301
1303
|
};
|
|
1302
1304
|
export {
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1305
|
+
Fe as RouterTab,
|
|
1306
|
+
Ce as RouterTabs,
|
|
1307
|
+
Tn as default,
|
|
1308
|
+
dn as initRouterTabsTheme,
|
|
1309
|
+
le as routerTabsKey,
|
|
1310
|
+
vn as setRouterTabsPrimary,
|
|
1311
|
+
pn as setRouterTabsTheme,
|
|
1312
|
+
hn as useLoadingTab,
|
|
1313
|
+
mn as useNotificationTab,
|
|
1314
|
+
Pe as useReactiveTab,
|
|
1315
|
+
_e as useRouterTabs,
|
|
1316
|
+
Ge as useRouterTabsPersistence,
|
|
1317
|
+
yn as useStatusTab
|
|
1316
1318
|
};
|