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