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