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