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