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