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