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