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