vue3-router-tab 1.1.2 → 1.1.4
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 +30 -0
- package/dist/vue3-router-tab.css +1 -1
- package/dist/vue3-router-tab.js +345 -310
- package/dist/vue3-router-tab.umd.cjs +1 -1
- package/index.d.ts +7 -1
- package/lib/index.ts +27 -3
- package/lib/scss/index.scss +82 -138
- package/lib/theme.ts +75 -0
- package/package.json +1 -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 ee, shallowRef as Se, computed as $, watch as P, nextTick as ae, inject as se, getCurrentInstance as Te, onMounted as te, defineComponent as ke, provide as $e, onBeforeUnmount as Ee, resolveComponent as Le, createElementBlock as g, openBlock as h, createElementVNode as R, createCommentVNode as C, renderSlot as q, createVNode as D, TransitionGroup as Me, mergeProps as U, withCtx as j, Fragment as Q, renderList as le, withModifiers as z, normalizeClass as re, createTextVNode as De, toDisplayString as ce, normalizeProps as Ue, Transition as ue, createBlock as W, KeepAlive as je, resolveDynamicComponent as fe, normalizeStyle as ze } from "vue";
|
|
3
|
+
import { RouterView as Oe } from "vue-router";
|
|
4
|
+
function Ve(e = {}) {
|
|
5
5
|
return {
|
|
6
6
|
initialTabs: e.initialTabs ?? [],
|
|
7
7
|
keepAlive: e.keepAlive ?? !0,
|
|
@@ -11,13 +11,13 @@ function je(e = {}) {
|
|
|
11
11
|
defaultRoute: e.defaultRoute ?? "/"
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function A(e,
|
|
15
|
-
const o = e.resolve(
|
|
14
|
+
function A(e, n) {
|
|
15
|
+
const o = e.resolve(n);
|
|
16
16
|
if (!o || !o.matched.length)
|
|
17
|
-
throw new Error(`[RouterTabs] Unable to resolve route: ${String(
|
|
17
|
+
throw new Error(`[RouterTabs] Unable to resolve route: ${String(n)}`);
|
|
18
18
|
return o;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const Ne = {
|
|
21
21
|
path: (e) => e.path,
|
|
22
22
|
fullpath: (e) => e.fullPath,
|
|
23
23
|
fullname: (e) => e.fullPath,
|
|
@@ -25,65 +25,65 @@ const ze = {
|
|
|
25
25
|
name: (e) => e.name ? String(e.name) : e.fullPath
|
|
26
26
|
};
|
|
27
27
|
function _(e) {
|
|
28
|
-
const
|
|
29
|
-
if (typeof
|
|
30
|
-
const o =
|
|
28
|
+
const n = e.meta?.key;
|
|
29
|
+
if (typeof n == "function") {
|
|
30
|
+
const o = n(e);
|
|
31
31
|
if (typeof o == "string" && o.length) return o;
|
|
32
|
-
} else if (typeof
|
|
33
|
-
const o =
|
|
34
|
-
return o ? o(e) :
|
|
32
|
+
} else if (typeof n == "string" && n.length) {
|
|
33
|
+
const o = Ne[n.toLowerCase()];
|
|
34
|
+
return o ? o(e) : n;
|
|
35
35
|
}
|
|
36
36
|
return e.fullPath;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function ne(e, n) {
|
|
39
39
|
const o = e.meta?.keepAlive;
|
|
40
|
-
return typeof o == "boolean" ? o :
|
|
40
|
+
return typeof o == "boolean" ? o : n;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function oe(e, n) {
|
|
43
43
|
const o = e.meta?.reuse;
|
|
44
|
-
return typeof o == "boolean" ? o :
|
|
44
|
+
return typeof o == "boolean" ? o : n;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const
|
|
48
|
-
return "title" in
|
|
46
|
+
function we(e) {
|
|
47
|
+
const n = e.meta ?? {}, o = {};
|
|
48
|
+
return "title" in n && (o.title = n.title), "tips" in n && (o.tips = n.tips), "icon" in n && (o.icon = n.icon), "closable" in n && (o.closable = n.closable), "tabClass" in n && (o.tabClass = n.tabClass), "target" in n && (o.target = n.target), "href" in n && (o.href = n.href), o;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const t =
|
|
50
|
+
function O(e, n, o) {
|
|
51
|
+
const t = we(e);
|
|
52
52
|
return {
|
|
53
53
|
id: _(e),
|
|
54
54
|
to: e.fullPath,
|
|
55
55
|
fullPath: e.fullPath,
|
|
56
56
|
matched: e,
|
|
57
|
-
alive:
|
|
58
|
-
reusable:
|
|
57
|
+
alive: ne(e, o),
|
|
58
|
+
reusable: oe(e, !1),
|
|
59
59
|
closable: t.closable ?? !0,
|
|
60
60
|
...t,
|
|
61
|
-
...
|
|
61
|
+
...n
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
function X(e,
|
|
65
|
-
if (!e.find((
|
|
64
|
+
function X(e, n, o, t) {
|
|
65
|
+
if (!e.find((f) => f.id === n.id)) {
|
|
66
66
|
if (o === "next" && t) {
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
e.splice(
|
|
67
|
+
const f = e.findIndex((b) => b.id === t);
|
|
68
|
+
if (f > -1) {
|
|
69
|
+
e.splice(f + 1, 0, n);
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
e.push(
|
|
73
|
+
e.push(n);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
if (!
|
|
78
|
-
const t = e.filter((
|
|
79
|
-
for (; t.length >
|
|
80
|
-
const
|
|
81
|
-
if (!
|
|
82
|
-
const
|
|
83
|
-
|
|
76
|
+
function de(e, n, o) {
|
|
77
|
+
if (!n || n <= 0) return;
|
|
78
|
+
const t = e.filter((l) => l.alive);
|
|
79
|
+
for (; t.length > n; ) {
|
|
80
|
+
const l = t.shift();
|
|
81
|
+
if (!l || l.id === o) continue;
|
|
82
|
+
const f = e.findIndex((b) => b.id === l.id);
|
|
83
|
+
f > -1 && (e[f].alive = !1);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function Be(e) {
|
|
87
87
|
return {
|
|
88
88
|
to: e.to,
|
|
89
89
|
title: e.title,
|
|
@@ -93,91 +93,91 @@ function Oe(e) {
|
|
|
93
93
|
closable: e.closable
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
const
|
|
98
|
-
return "title" in e && (
|
|
96
|
+
function Ye(e) {
|
|
97
|
+
const n = {};
|
|
98
|
+
return "title" in e && (n.title = e.title), "tips" in e && (n.tips = e.tips), "icon" in e && (n.icon = e.icon), "tabClass" in e && (n.tabClass = e.tabClass), "closable" in e && (n.closable = e.closable), n;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
const o =
|
|
100
|
+
function Fe(e, n = {}) {
|
|
101
|
+
const o = Ve(n), t = ge([]), l = ee(null), f = Se(), b = ee(null), s = $(() => t.filter((a) => a.alive).map((a) => a.id));
|
|
102
102
|
let u = !1;
|
|
103
103
|
function T(a) {
|
|
104
|
-
const
|
|
104
|
+
const r = typeof a.matched == "object" ? a : A(e, a);
|
|
105
105
|
return {
|
|
106
|
-
key: _(
|
|
107
|
-
fullPath:
|
|
108
|
-
alive:
|
|
109
|
-
reusable:
|
|
110
|
-
matched:
|
|
106
|
+
key: _(r),
|
|
107
|
+
fullPath: r.fullPath,
|
|
108
|
+
alive: ne(r, o.keepAlive),
|
|
109
|
+
reusable: oe(r, !1),
|
|
110
|
+
matched: r
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
const
|
|
115
|
-
let c = t.find((p) => p.id ===
|
|
116
|
-
return c ? (c.fullPath = a.fullPath, c.to = a.fullPath, c.matched = a, c.alive =
|
|
113
|
+
function w(a) {
|
|
114
|
+
const r = _(a);
|
|
115
|
+
let c = t.find((p) => p.id === r);
|
|
116
|
+
return c ? (c.fullPath = a.fullPath, c.to = a.fullPath, c.matched = a, c.alive = ne(a, o.keepAlive), c.reusable = oe(a, c.reusable), Object.assign(c, we(a)), c) : (c = O(a, {}, o.keepAlive), X(t, c, o.appendPosition, l.value), de(t, o.maxAlive, l.value), c);
|
|
117
117
|
}
|
|
118
|
-
async function
|
|
119
|
-
const p = A(e, a), k = _(p),
|
|
120
|
-
c === "sameTab" && (c =
|
|
118
|
+
async function E(a, r = !1, c = !0) {
|
|
119
|
+
const p = A(e, a), k = _(p), i = l.value === k;
|
|
120
|
+
c === "sameTab" && (c = i), c && await y(k, !0), await e[r ? "replace" : "push"](p), i && await K();
|
|
121
121
|
}
|
|
122
122
|
function L(a) {
|
|
123
|
-
const
|
|
123
|
+
const r = t.findIndex((p) => p.id === a), c = t[r] || t[r - 1] || t[0];
|
|
124
124
|
return c ? c.to : o.defaultRoute;
|
|
125
125
|
}
|
|
126
|
-
async function x(a =
|
|
126
|
+
async function x(a = l.value, r = {}) {
|
|
127
127
|
if (a) {
|
|
128
|
-
if (!
|
|
128
|
+
if (!r.force && o.keepLastTab && t.length === 1)
|
|
129
129
|
throw new Error("[RouterTabs] Unable to close the final tab when keepLastTab is true.");
|
|
130
|
-
if (await M(a, { force:
|
|
131
|
-
if (
|
|
132
|
-
const c =
|
|
130
|
+
if (await M(a, { force: r.force }), r.redirect !== null)
|
|
131
|
+
if (l.value === a) {
|
|
132
|
+
const c = r.redirect ?? L(a);
|
|
133
133
|
c && await e.replace(c);
|
|
134
|
-
} else
|
|
134
|
+
} else r.redirect && await e.replace(r.redirect);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
async function M(a,
|
|
137
|
+
async function M(a, r = {}) {
|
|
138
138
|
const c = t.findIndex((p) => p.id === a);
|
|
139
|
-
c !== -1 && (t.splice(c, 1), b.value === a && (b.value = null),
|
|
139
|
+
c !== -1 && (t.splice(c, 1), b.value === a && (b.value = null), l.value === a && (l.value = null, f.value = void 0));
|
|
140
140
|
}
|
|
141
|
-
async function
|
|
142
|
-
a && (b.value = a, await
|
|
141
|
+
async function y(a = l.value ?? void 0, r = !1) {
|
|
142
|
+
a && (b.value = a, await ae(), r || await ae(), b.value = null);
|
|
143
143
|
}
|
|
144
|
-
async function
|
|
145
|
-
for (const
|
|
146
|
-
await
|
|
144
|
+
async function B(a = !1) {
|
|
145
|
+
for (const r of t)
|
|
146
|
+
await y(r.id, a);
|
|
147
147
|
}
|
|
148
|
-
async function
|
|
149
|
-
t.splice(0, t.length),
|
|
150
|
-
for (const
|
|
151
|
-
const c = A(e,
|
|
148
|
+
async function Y(a = o.defaultRoute) {
|
|
149
|
+
t.splice(0, t.length), l.value = null, f.value = void 0;
|
|
150
|
+
for (const r of o.initialTabs) {
|
|
151
|
+
const c = A(e, r.to), p = O(c, r, o.keepAlive);
|
|
152
152
|
t.push(p);
|
|
153
153
|
}
|
|
154
154
|
await e.replace(a);
|
|
155
155
|
}
|
|
156
|
-
async function
|
|
157
|
-
const a =
|
|
158
|
-
a && await
|
|
156
|
+
async function K() {
|
|
157
|
+
const a = l.value;
|
|
158
|
+
a && await y(a, !0);
|
|
159
159
|
}
|
|
160
160
|
function F(a) {
|
|
161
161
|
return typeof a.matched == "object" ? _(a) : _(A(e, a));
|
|
162
162
|
}
|
|
163
163
|
function G() {
|
|
164
|
-
const a = t.find((
|
|
164
|
+
const a = t.find((r) => r.id === l.value);
|
|
165
165
|
return {
|
|
166
|
-
tabs: t.map(
|
|
166
|
+
tabs: t.map(Be),
|
|
167
167
|
active: a ? a.to : null
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
async function
|
|
171
|
-
u = !0, t.splice(0, t.length),
|
|
172
|
-
const
|
|
173
|
-
for (const p of
|
|
170
|
+
async function I(a) {
|
|
171
|
+
u = !0, t.splice(0, t.length), l.value = null, f.value = void 0;
|
|
172
|
+
const r = a?.tabs ?? [];
|
|
173
|
+
for (const p of r)
|
|
174
174
|
try {
|
|
175
|
-
const k = A(e, p.to),
|
|
176
|
-
X(t,
|
|
175
|
+
const k = A(e, p.to), i = Ye(p), d = O(k, i, o.keepAlive);
|
|
176
|
+
X(t, d, "last", null);
|
|
177
177
|
} catch {
|
|
178
178
|
}
|
|
179
179
|
u = !1;
|
|
180
|
-
const c = a?.active ??
|
|
180
|
+
const c = a?.active ?? r[r.length - 1]?.to ?? o.defaultRoute;
|
|
181
181
|
if (c)
|
|
182
182
|
try {
|
|
183
183
|
await e.replace(c);
|
|
@@ -188,78 +188,78 @@ function De(e, i = {}) {
|
|
|
188
188
|
() => e.currentRoute.value,
|
|
189
189
|
(a) => {
|
|
190
190
|
if (u) return;
|
|
191
|
-
const
|
|
192
|
-
|
|
191
|
+
const r = w(a);
|
|
192
|
+
l.value = r.id, f.value = r, de(t, o.maxAlive, l.value);
|
|
193
193
|
},
|
|
194
194
|
{ immediate: !0 }
|
|
195
195
|
), o.initialTabs.length && o.initialTabs.forEach((a) => {
|
|
196
|
-
const
|
|
196
|
+
const r = A(e, a.to), c = O(r, a, o.keepAlive);
|
|
197
197
|
X(t, c, "last", null);
|
|
198
198
|
}), {
|
|
199
199
|
options: o,
|
|
200
200
|
tabs: t,
|
|
201
|
-
activeId:
|
|
202
|
-
current:
|
|
203
|
-
includeKeys:
|
|
201
|
+
activeId: l,
|
|
202
|
+
current: f,
|
|
203
|
+
includeKeys: s,
|
|
204
204
|
refreshingKey: b,
|
|
205
|
-
openTab:
|
|
205
|
+
openTab: E,
|
|
206
206
|
closeTab: x,
|
|
207
207
|
removeTab: M,
|
|
208
|
-
refreshTab:
|
|
209
|
-
refreshAll:
|
|
210
|
-
reset:
|
|
211
|
-
reload:
|
|
208
|
+
refreshTab: y,
|
|
209
|
+
refreshAll: B,
|
|
210
|
+
reset: Y,
|
|
211
|
+
reload: K,
|
|
212
212
|
getRouteKey: F,
|
|
213
213
|
matchRoute: T,
|
|
214
214
|
snapshot: G,
|
|
215
|
-
hydrate:
|
|
215
|
+
hydrate: I
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function be(e) {
|
|
219
219
|
return e ? typeof e == "string" ? { name: e } : e : {};
|
|
220
220
|
}
|
|
221
|
-
const N = Symbol("RouterTabsContext"),
|
|
222
|
-
function
|
|
223
|
-
const { optional:
|
|
221
|
+
const N = Symbol("RouterTabsContext"), V = "router-tabs:snapshot";
|
|
222
|
+
function pe(e = {}) {
|
|
223
|
+
const { optional: n = !1 } = e, o = se(N, null);
|
|
224
224
|
if (o) return o;
|
|
225
|
-
const t =
|
|
225
|
+
const t = se("$tabs", null);
|
|
226
226
|
if (t) return t;
|
|
227
|
-
const
|
|
228
|
-
if (
|
|
229
|
-
if (!
|
|
227
|
+
const f = Te()?.appContext.config.globalProperties.$tabs;
|
|
228
|
+
if (f) return f;
|
|
229
|
+
if (!n)
|
|
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 Ge = 864e5;
|
|
234
|
+
function Je(e) {
|
|
235
235
|
if (typeof document > "u") return null;
|
|
236
|
-
const
|
|
236
|
+
const n = `${encodeURIComponent(e)}=`, o = document.cookie ? document.cookie.split("; ") : [];
|
|
237
237
|
for (const t of o)
|
|
238
|
-
if (t.startsWith(
|
|
239
|
-
return decodeURIComponent(t.slice(
|
|
238
|
+
if (t.startsWith(n))
|
|
239
|
+
return decodeURIComponent(t.slice(n.length));
|
|
240
240
|
return null;
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function me(e, n, o) {
|
|
243
243
|
if (typeof document > "u") return;
|
|
244
244
|
const {
|
|
245
245
|
expiresInDays: t = 7,
|
|
246
|
-
path:
|
|
247
|
-
domain:
|
|
246
|
+
path: l = "/",
|
|
247
|
+
domain: f,
|
|
248
248
|
secure: b,
|
|
249
|
-
sameSite:
|
|
250
|
-
} = o, u = [`${encodeURIComponent(e)}=${encodeURIComponent(
|
|
249
|
+
sameSite: s = "lax"
|
|
250
|
+
} = o, u = [`${encodeURIComponent(e)}=${encodeURIComponent(n)}`];
|
|
251
251
|
if (t !== 1 / 0) {
|
|
252
|
-
const T = new Date(Date.now() + t *
|
|
252
|
+
const T = new Date(Date.now() + t * Ge).toUTCString();
|
|
253
253
|
u.push(`Expires=${T}`);
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
l && u.push(`Path=${l}`), f && u.push(`Domain=${f}`), b && u.push("Secure"), s && u.push(`SameSite=${s.charAt(0).toUpperCase()}${s.slice(1)}`), document.cookie = u.join("; ");
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function ye(e, n) {
|
|
258
258
|
if (typeof document > "u") return;
|
|
259
|
-
const { path: o = "/", domain: t } =
|
|
260
|
-
|
|
259
|
+
const { path: o = "/", domain: t } = n, l = [`${encodeURIComponent(e)}=`];
|
|
260
|
+
l.push("Expires=Thu, 01 Jan 1970 00:00:01 GMT"), o && l.push(`Path=${o}`), t && l.push(`Domain=${t}`), document.cookie = l.join("; ");
|
|
261
261
|
}
|
|
262
|
-
const
|
|
262
|
+
const He = (e) => JSON.stringify(e ?? null), qe = (e) => {
|
|
263
263
|
if (!e) return null;
|
|
264
264
|
try {
|
|
265
265
|
return JSON.parse(e);
|
|
@@ -267,33 +267,33 @@ const Be = (e) => JSON.stringify(e ?? null), Fe = (e) => {
|
|
|
267
267
|
return null;
|
|
268
268
|
}
|
|
269
269
|
};
|
|
270
|
-
function
|
|
270
|
+
function Re(e = {}) {
|
|
271
271
|
const {
|
|
272
|
-
cookieKey:
|
|
273
|
-
serialize: o =
|
|
274
|
-
deserialize: t =
|
|
275
|
-
} = e,
|
|
276
|
-
|
|
277
|
-
const u = t(
|
|
272
|
+
cookieKey: n = V,
|
|
273
|
+
serialize: o = He,
|
|
274
|
+
deserialize: t = qe
|
|
275
|
+
} = e, l = pe({ optional: !0 }), f = ee(!0), b = (s) => {
|
|
276
|
+
te(async () => {
|
|
277
|
+
const u = t(Je(n));
|
|
278
278
|
if (u && u.tabs?.length)
|
|
279
279
|
try {
|
|
280
|
-
|
|
280
|
+
f.value = !0, await s.hydrate(u);
|
|
281
281
|
} finally {
|
|
282
|
-
|
|
282
|
+
f.value = !1;
|
|
283
283
|
}
|
|
284
284
|
else
|
|
285
285
|
try {
|
|
286
|
-
|
|
287
|
-
const
|
|
288
|
-
await
|
|
286
|
+
f.value = !0;
|
|
287
|
+
const w = e.fallbackRoute ?? s.options.defaultRoute;
|
|
288
|
+
await s.reset(w);
|
|
289
289
|
} finally {
|
|
290
|
-
|
|
290
|
+
f.value = !1;
|
|
291
291
|
}
|
|
292
|
-
const T =
|
|
293
|
-
T.tabs.length ?
|
|
292
|
+
const T = s.snapshot();
|
|
293
|
+
T.tabs.length ? me(n, o(T), e) : ye(n, e), f.value = !1;
|
|
294
294
|
}), P(
|
|
295
295
|
() => ({
|
|
296
|
-
tabs:
|
|
296
|
+
tabs: s.tabs.map((u) => ({
|
|
297
297
|
to: u.to,
|
|
298
298
|
title: u.title,
|
|
299
299
|
tips: u.tips,
|
|
@@ -301,24 +301,24 @@ function Ce(e = {}) {
|
|
|
301
301
|
tabClass: u.tabClass,
|
|
302
302
|
closable: u.closable
|
|
303
303
|
})),
|
|
304
|
-
active:
|
|
304
|
+
active: s.activeId.value
|
|
305
305
|
}),
|
|
306
306
|
() => {
|
|
307
|
-
if (
|
|
308
|
-
const u =
|
|
309
|
-
u.tabs.length ?
|
|
307
|
+
if (f.value) return;
|
|
308
|
+
const u = s.snapshot();
|
|
309
|
+
u.tabs.length ? me(n, o(u), e) : ye(n, e);
|
|
310
310
|
},
|
|
311
311
|
{ deep: !0 }
|
|
312
312
|
);
|
|
313
313
|
};
|
|
314
|
-
|
|
315
|
-
const
|
|
316
|
-
|
|
314
|
+
l ? b(l) : te(() => {
|
|
315
|
+
const s = pe({ optional: !0 });
|
|
316
|
+
s && b(s);
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
|
-
const
|
|
319
|
+
const Qe = ke({
|
|
320
320
|
name: "RouterTab",
|
|
321
|
-
components: { RouterView:
|
|
321
|
+
components: { RouterView: Oe },
|
|
322
322
|
props: {
|
|
323
323
|
tabs: {
|
|
324
324
|
type: Array,
|
|
@@ -358,7 +358,7 @@ const Ge = Te({
|
|
|
358
358
|
},
|
|
359
359
|
cookieKey: {
|
|
360
360
|
type: String,
|
|
361
|
-
default:
|
|
361
|
+
default: V
|
|
362
362
|
},
|
|
363
363
|
persistence: {
|
|
364
364
|
type: Object,
|
|
@@ -366,13 +366,13 @@ const Ge = Te({
|
|
|
366
366
|
}
|
|
367
367
|
},
|
|
368
368
|
setup(e) {
|
|
369
|
-
const
|
|
370
|
-
if (!
|
|
369
|
+
const n = Te();
|
|
370
|
+
if (!n)
|
|
371
371
|
throw new Error("[RouterTab] component must be used within a Vue application context.");
|
|
372
|
-
const o =
|
|
372
|
+
const o = n.appContext.app.config.globalProperties.$router;
|
|
373
373
|
if (!o)
|
|
374
374
|
throw new Error("[RouterTab] Vue Router is required. Make sure to call app.use(router) before RouterTab.");
|
|
375
|
-
const t =
|
|
375
|
+
const t = Fe(o, {
|
|
376
376
|
initialTabs: e.tabs,
|
|
377
377
|
keepAlive: e.keepAlive,
|
|
378
378
|
maxAlive: e.maxAlive,
|
|
@@ -380,15 +380,15 @@ const Ge = Te({
|
|
|
380
380
|
appendPosition: e.append,
|
|
381
381
|
defaultRoute: e.defaultPage
|
|
382
382
|
});
|
|
383
|
-
|
|
384
|
-
const
|
|
383
|
+
$e(N, t), n.appContext.config.globalProperties.$tabs = t;
|
|
384
|
+
const l = $(() => !!n?.slots?.default);
|
|
385
385
|
if (e.cookieKey !== null || e.persistence) {
|
|
386
|
-
const
|
|
386
|
+
const i = {
|
|
387
387
|
...e.persistence ?? {}
|
|
388
388
|
};
|
|
389
|
-
e.cookieKey !== null ?
|
|
389
|
+
e.cookieKey !== null ? i.cookieKey = e.cookieKey || V : i.cookieKey || (i.cookieKey = V), Re(i);
|
|
390
390
|
}
|
|
391
|
-
const
|
|
391
|
+
const f = $(() => be(e.tabTransition)), b = $(() => be(e.pageTransition)), s = ge({
|
|
392
392
|
visible: !1,
|
|
393
393
|
target: null,
|
|
394
394
|
position: { x: 0, y: 0 }
|
|
@@ -400,33 +400,33 @@ const Ge = Te({
|
|
|
400
400
|
"closeRights",
|
|
401
401
|
"closeOthers"
|
|
402
402
|
];
|
|
403
|
-
function T(
|
|
404
|
-
return t.tabs.findIndex((
|
|
403
|
+
function T(i) {
|
|
404
|
+
return t.tabs.findIndex((d) => d.id === i);
|
|
405
405
|
}
|
|
406
|
-
function
|
|
407
|
-
const
|
|
408
|
-
return
|
|
406
|
+
function w(i) {
|
|
407
|
+
const d = T(i.id);
|
|
408
|
+
return d > 0 ? t.tabs.slice(0, d) : [];
|
|
409
409
|
}
|
|
410
|
-
function
|
|
411
|
-
const
|
|
412
|
-
return
|
|
410
|
+
function E(i) {
|
|
411
|
+
const d = T(i.id);
|
|
412
|
+
return d > -1 ? t.tabs.slice(d + 1) : [];
|
|
413
413
|
}
|
|
414
|
-
function L(
|
|
415
|
-
return t.tabs.filter((
|
|
414
|
+
function L(i) {
|
|
415
|
+
return t.tabs.filter((d) => d.id !== i.id);
|
|
416
416
|
}
|
|
417
|
-
async function x(
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
420
|
-
for (const
|
|
421
|
-
t.activeId.value ===
|
|
422
|
-
t.activeId.value !==
|
|
417
|
+
async function x(i, d) {
|
|
418
|
+
const m = i.filter((v) => v.closable !== !1);
|
|
419
|
+
if (m.length) {
|
|
420
|
+
for (const v of m)
|
|
421
|
+
t.activeId.value === v.id ? await t.closeTab(v.id, { redirect: d.to, force: !0 }) : await t.removeTab(v.id, { force: !0 });
|
|
422
|
+
t.activeId.value !== d.id && await t.openTab(d.to, !0, !1);
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
const M = {
|
|
426
426
|
refresh: {
|
|
427
427
|
label: "Refresh",
|
|
428
|
-
handler: async ({ target:
|
|
429
|
-
await t.refreshTab(
|
|
428
|
+
handler: async ({ target: i }) => {
|
|
429
|
+
await t.refreshTab(i.id, !0);
|
|
430
430
|
}
|
|
431
431
|
},
|
|
432
432
|
refreshAll: {
|
|
@@ -437,108 +437,108 @@ const Ge = Te({
|
|
|
437
437
|
},
|
|
438
438
|
close: {
|
|
439
439
|
label: "Close",
|
|
440
|
-
handler: async ({ target:
|
|
441
|
-
await t.closeTab(
|
|
440
|
+
handler: async ({ target: i }) => {
|
|
441
|
+
await t.closeTab(i.id);
|
|
442
442
|
},
|
|
443
|
-
enable: ({ target:
|
|
443
|
+
enable: ({ target: i }) => I(i)
|
|
444
444
|
},
|
|
445
445
|
closeLefts: {
|
|
446
446
|
label: "Close to the Left",
|
|
447
|
-
handler: async ({ target:
|
|
448
|
-
await x(
|
|
447
|
+
handler: async ({ target: i }) => {
|
|
448
|
+
await x(w(i), i);
|
|
449
449
|
},
|
|
450
|
-
enable: ({ target:
|
|
450
|
+
enable: ({ target: i }) => w(i).some((d) => d.closable !== !1)
|
|
451
451
|
},
|
|
452
452
|
closeRights: {
|
|
453
453
|
label: "Close to the Right",
|
|
454
|
-
handler: async ({ target:
|
|
455
|
-
await x(
|
|
454
|
+
handler: async ({ target: i }) => {
|
|
455
|
+
await x(E(i), i);
|
|
456
456
|
},
|
|
457
|
-
enable: ({ target:
|
|
457
|
+
enable: ({ target: i }) => E(i).some((d) => d.closable !== !1)
|
|
458
458
|
},
|
|
459
459
|
closeOthers: {
|
|
460
460
|
label: "Close Others",
|
|
461
|
-
handler: async ({ target:
|
|
462
|
-
await x(L(
|
|
461
|
+
handler: async ({ target: i }) => {
|
|
462
|
+
await x(L(i), i);
|
|
463
463
|
},
|
|
464
|
-
enable: ({ target:
|
|
464
|
+
enable: ({ target: i }) => L(i).some((d) => d.closable !== !1)
|
|
465
465
|
}
|
|
466
466
|
};
|
|
467
|
-
function
|
|
468
|
-
|
|
467
|
+
function y() {
|
|
468
|
+
s.visible = !1, s.target = null;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
471
|
-
e.contextmenu && (
|
|
470
|
+
function B(i, d) {
|
|
471
|
+
e.contextmenu && (s.visible = !0, s.target = i, s.position.x = d.clientX, s.position.y = d.clientY, document.addEventListener("click", y, { once: !0 }));
|
|
472
472
|
}
|
|
473
|
-
function
|
|
474
|
-
const
|
|
475
|
-
if (!(typeof J == "function" ? J(
|
|
476
|
-
const H =
|
|
473
|
+
function Y(i, d) {
|
|
474
|
+
const m = typeof i == "string" ? { id: i } : i, v = M[m.id], xe = m.label ?? v?.label ?? String(m.id), J = m.visible ?? v?.visible ?? !0;
|
|
475
|
+
if (!(typeof J == "function" ? J(d) : J !== !1)) return null;
|
|
476
|
+
const H = m.enable ?? v?.enable ?? !0, Ke = typeof H == "function" ? H(d) : H !== !1, ie = m.handler ?? v?.handler;
|
|
477
477
|
if (!ie) return null;
|
|
478
|
-
const
|
|
479
|
-
await Promise.resolve(ie(
|
|
478
|
+
const Ie = async () => {
|
|
479
|
+
await Promise.resolve(ie(d));
|
|
480
480
|
};
|
|
481
481
|
return {
|
|
482
|
-
id: String(
|
|
483
|
-
label:
|
|
484
|
-
disabled: !
|
|
485
|
-
action:
|
|
482
|
+
id: String(m.id),
|
|
483
|
+
label: xe,
|
|
484
|
+
disabled: !Ke,
|
|
485
|
+
action: Ie
|
|
486
486
|
};
|
|
487
487
|
}
|
|
488
|
-
const
|
|
489
|
-
if (!
|
|
490
|
-
const
|
|
491
|
-
return
|
|
488
|
+
const K = $(() => {
|
|
489
|
+
if (!s.visible || !s.target || e.contextmenu === !1) return [];
|
|
490
|
+
const i = Array.isArray(e.contextmenu) ? e.contextmenu : u, d = { target: s.target, controller: t };
|
|
491
|
+
return i.map((m) => Y(m, d)).filter((m) => !!m);
|
|
492
492
|
});
|
|
493
|
-
async function F(
|
|
494
|
-
|
|
493
|
+
async function F(i) {
|
|
494
|
+
i.disabled || (y(), await i.action());
|
|
495
495
|
}
|
|
496
|
-
function G(
|
|
497
|
-
return typeof
|
|
496
|
+
function G(i) {
|
|
497
|
+
return typeof i.title == "string" ? i.title : Array.isArray(i.title) && i.title.length ? String(i.title[0]) : i.fullPath;
|
|
498
498
|
}
|
|
499
|
-
function
|
|
500
|
-
return !(
|
|
499
|
+
function I(i) {
|
|
500
|
+
return !(i.closable === !1 || t.options.keepLastTab && t.tabs.length <= 1);
|
|
501
501
|
}
|
|
502
|
-
async function a(
|
|
503
|
-
await t.closeTab(
|
|
502
|
+
async function a(i) {
|
|
503
|
+
await t.closeTab(i.id);
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
t.activeId.value !==
|
|
505
|
+
function r(i) {
|
|
506
|
+
t.activeId.value !== i.id && t.openTab(i.to, !1);
|
|
507
507
|
}
|
|
508
|
-
function c(
|
|
508
|
+
function c(i) {
|
|
509
509
|
return [
|
|
510
510
|
"router-tab__item",
|
|
511
511
|
{
|
|
512
|
-
"is-active": t.activeId.value ===
|
|
513
|
-
"is-closable":
|
|
512
|
+
"is-active": t.activeId.value === i.id,
|
|
513
|
+
"is-closable": I(i)
|
|
514
514
|
},
|
|
515
|
-
|
|
515
|
+
i.tabClass
|
|
516
516
|
];
|
|
517
517
|
}
|
|
518
|
-
function p(
|
|
519
|
-
return t.refreshingKey.value === t.getRouteKey(
|
|
518
|
+
function p(i) {
|
|
519
|
+
return t.refreshingKey.value === t.getRouteKey(i);
|
|
520
520
|
}
|
|
521
|
-
|
|
522
|
-
document.addEventListener("keydown",
|
|
523
|
-
}),
|
|
524
|
-
document.removeEventListener("keydown",
|
|
521
|
+
te(() => {
|
|
522
|
+
document.addEventListener("keydown", y);
|
|
523
|
+
}), Ee(() => {
|
|
524
|
+
document.removeEventListener("keydown", y), n.appContext.config.globalProperties.$tabs = null;
|
|
525
525
|
}), P(
|
|
526
526
|
() => e.keepAlive,
|
|
527
|
-
(
|
|
528
|
-
t.options.keepAlive =
|
|
527
|
+
(i) => {
|
|
528
|
+
t.options.keepAlive = i;
|
|
529
529
|
}
|
|
530
530
|
), P(
|
|
531
531
|
() => t.activeId.value,
|
|
532
|
-
() =>
|
|
532
|
+
() => y()
|
|
533
533
|
), P(
|
|
534
534
|
() => e.contextmenu,
|
|
535
|
-
(
|
|
536
|
-
|
|
535
|
+
(i) => {
|
|
536
|
+
i || y();
|
|
537
537
|
}
|
|
538
538
|
), P(
|
|
539
|
-
() =>
|
|
540
|
-
(
|
|
541
|
-
|
|
539
|
+
() => K.value.length,
|
|
540
|
+
(i) => {
|
|
541
|
+
s.visible && i === 0 && y();
|
|
542
542
|
}
|
|
543
543
|
);
|
|
544
544
|
const k = t.includeKeys;
|
|
@@ -546,98 +546,98 @@ const Ge = Te({
|
|
|
546
546
|
controller: t,
|
|
547
547
|
tabs: t.tabs,
|
|
548
548
|
includeKeys: k,
|
|
549
|
-
tabTransitionProps:
|
|
549
|
+
tabTransitionProps: f,
|
|
550
550
|
pageTransitionProps: b,
|
|
551
551
|
buildTabClass: c,
|
|
552
|
-
activate:
|
|
552
|
+
activate: r,
|
|
553
553
|
close: a,
|
|
554
|
-
context:
|
|
555
|
-
menuItems:
|
|
554
|
+
context: s,
|
|
555
|
+
menuItems: K,
|
|
556
556
|
handleMenuAction: F,
|
|
557
|
-
showContextMenu:
|
|
558
|
-
hideContextMenu:
|
|
557
|
+
showContextMenu: B,
|
|
558
|
+
hideContextMenu: y,
|
|
559
559
|
tabTitle: G,
|
|
560
|
-
isClosable:
|
|
560
|
+
isClosable: I,
|
|
561
561
|
isRefreshing: p,
|
|
562
|
-
hasCustomSlot:
|
|
562
|
+
hasCustomSlot: l
|
|
563
563
|
};
|
|
564
564
|
}
|
|
565
|
-
}),
|
|
565
|
+
}), We = (e, n) => {
|
|
566
566
|
const o = e.__vccOpts || e;
|
|
567
|
-
for (const [t,
|
|
568
|
-
o[t] =
|
|
567
|
+
for (const [t, l] of n)
|
|
568
|
+
o[t] = l;
|
|
569
569
|
return o;
|
|
570
|
-
},
|
|
571
|
-
function
|
|
572
|
-
const b =
|
|
573
|
-
return
|
|
574
|
-
R("header",
|
|
575
|
-
R("div",
|
|
576
|
-
|
|
570
|
+
}, Xe = { class: "router-tab" }, Ze = { class: "router-tab__header" }, et = { class: "router-tab__slot-start" }, tt = { class: "router-tab__scroll" }, nt = ["onClick", "onAuxclick", "onContextmenu"], ot = ["title"], it = ["onClick"], at = { class: "router-tab__slot-end" }, st = { class: "router-tab__container" }, lt = ["aria-disabled", "onClick"];
|
|
571
|
+
function rt(e, n, o, t, l, f) {
|
|
572
|
+
const b = Le("RouterView");
|
|
573
|
+
return h(), g("div", Xe, [
|
|
574
|
+
R("header", Ze, [
|
|
575
|
+
R("div", et, [
|
|
576
|
+
q(e.$slots, "start")
|
|
577
577
|
]),
|
|
578
|
-
R("div",
|
|
579
|
-
|
|
578
|
+
R("div", tt, [
|
|
579
|
+
D(Me, U({
|
|
580
580
|
tag: "ul",
|
|
581
581
|
class: "router-tab__nav"
|
|
582
582
|
}, e.tabTransitionProps), {
|
|
583
|
-
default:
|
|
584
|
-
(
|
|
585
|
-
key:
|
|
586
|
-
class:
|
|
587
|
-
onClick: (u) => e.activate(
|
|
588
|
-
onAuxclick:
|
|
589
|
-
onContextmenu:
|
|
583
|
+
default: j(() => [
|
|
584
|
+
(h(!0), g(Q, null, le(e.tabs, (s) => (h(), g("li", {
|
|
585
|
+
key: s.id,
|
|
586
|
+
class: re(e.buildTabClass(s)),
|
|
587
|
+
onClick: (u) => e.activate(s),
|
|
588
|
+
onAuxclick: z((u) => e.close(s), ["middle", "prevent"]),
|
|
589
|
+
onContextmenu: z((u) => e.showContextMenu(s, u), ["prevent"])
|
|
590
590
|
}, [
|
|
591
591
|
R("span", {
|
|
592
592
|
class: "router-tab__item-title",
|
|
593
|
-
title: e.tabTitle(
|
|
593
|
+
title: e.tabTitle(s)
|
|
594
594
|
}, [
|
|
595
|
-
|
|
595
|
+
s.icon ? (h(), g("i", {
|
|
596
596
|
key: 0,
|
|
597
|
-
class:
|
|
598
|
-
}, null, 2)) :
|
|
599
|
-
|
|
600
|
-
], 8,
|
|
601
|
-
e.isClosable(
|
|
597
|
+
class: re(["router-tab__item-icon", s.icon])
|
|
598
|
+
}, null, 2)) : C("", !0),
|
|
599
|
+
De(" " + ce(e.tabTitle(s)), 1)
|
|
600
|
+
], 8, ot),
|
|
601
|
+
e.isClosable(s) ? (h(), g("a", {
|
|
602
602
|
key: 0,
|
|
603
603
|
class: "router-tab__item-close",
|
|
604
604
|
type: "button",
|
|
605
|
-
onClick:
|
|
606
|
-
}, null, 8,
|
|
607
|
-
], 42,
|
|
605
|
+
onClick: z((u) => e.close(s), ["stop"])
|
|
606
|
+
}, null, 8, it)) : C("", !0)
|
|
607
|
+
], 42, nt))), 128))
|
|
608
608
|
]),
|
|
609
609
|
_: 1
|
|
610
610
|
}, 16)
|
|
611
611
|
]),
|
|
612
|
-
R("div",
|
|
613
|
-
|
|
612
|
+
R("div", at, [
|
|
613
|
+
q(e.$slots, "end")
|
|
614
614
|
])
|
|
615
615
|
]),
|
|
616
|
-
R("div",
|
|
617
|
-
|
|
618
|
-
default:
|
|
619
|
-
e.hasCustomSlot ?
|
|
620
|
-
|
|
621
|
-
default:
|
|
622
|
-
e.controller.options.keepAlive ? (
|
|
616
|
+
R("div", st, [
|
|
617
|
+
D(b, null, {
|
|
618
|
+
default: j((s) => [
|
|
619
|
+
e.hasCustomSlot ? q(e.$slots, "default", Ue(U({ key: 0 }, { ...s, controller: e.controller }))) : (h(), g(Q, { key: 1 }, [
|
|
620
|
+
D(ue, U(e.pageTransitionProps, { appear: "" }), {
|
|
621
|
+
default: j(() => [
|
|
622
|
+
e.controller.options.keepAlive ? (h(), W(je, {
|
|
623
623
|
key: 0,
|
|
624
624
|
include: e.includeKeys,
|
|
625
625
|
max: e.controller.options.maxAlive || void 0
|
|
626
626
|
}, [
|
|
627
|
-
e.isRefreshing(
|
|
628
|
-
key: e.controller.getRouteKey(
|
|
627
|
+
e.isRefreshing(s.route) ? C("", !0) : (h(), W(fe(s.Component), {
|
|
628
|
+
key: e.controller.getRouteKey(s.route),
|
|
629
629
|
class: "router-tab-page"
|
|
630
630
|
}))
|
|
631
|
-
], 1032, ["include", "max"])) :
|
|
631
|
+
], 1032, ["include", "max"])) : C("", !0)
|
|
632
632
|
]),
|
|
633
633
|
_: 2
|
|
634
634
|
}, 1040),
|
|
635
|
-
|
|
636
|
-
default:
|
|
637
|
-
!e.controller.options.keepAlive || e.isRefreshing(
|
|
638
|
-
key: e.controller.getRouteKey(
|
|
635
|
+
D(ue, U(e.pageTransitionProps, { appear: "" }), {
|
|
636
|
+
default: j(() => [
|
|
637
|
+
!e.controller.options.keepAlive || e.isRefreshing(s.route) ? (h(), W(fe(s.Component), {
|
|
638
|
+
key: e.controller.getRouteKey(s.route) + (e.isRefreshing(s.route) ? "-refresh" : ""),
|
|
639
639
|
class: "router-tab-page"
|
|
640
|
-
})) :
|
|
640
|
+
})) : C("", !0)
|
|
641
641
|
]),
|
|
642
642
|
_: 2
|
|
643
643
|
}, 1040)
|
|
@@ -646,24 +646,24 @@ function it(e, i, o, t, r, d) {
|
|
|
646
646
|
_: 3
|
|
647
647
|
})
|
|
648
648
|
]),
|
|
649
|
-
e.context.visible && e.context.target ? (
|
|
649
|
+
e.context.visible && e.context.target ? (h(), g("div", {
|
|
650
650
|
key: 0,
|
|
651
651
|
class: "router-tab__contextmenu",
|
|
652
|
-
style:
|
|
652
|
+
style: ze({ left: e.context.position.x + "px", top: e.context.position.y + "px" })
|
|
653
653
|
}, [
|
|
654
|
-
(
|
|
655
|
-
key:
|
|
654
|
+
(h(!0), g(Q, null, le(e.menuItems, (s) => (h(), g("a", {
|
|
655
|
+
key: s.id,
|
|
656
656
|
class: "router-tab__contextmenu-item",
|
|
657
|
-
"aria-disabled":
|
|
658
|
-
onClick:
|
|
659
|
-
},
|
|
660
|
-
], 4)) :
|
|
657
|
+
"aria-disabled": s.disabled,
|
|
658
|
+
onClick: z((u) => e.handleMenuAction(s), ["prevent"])
|
|
659
|
+
}, ce(s.label), 9, lt))), 128))
|
|
660
|
+
], 4)) : C("", !0)
|
|
661
661
|
]);
|
|
662
662
|
}
|
|
663
|
-
const
|
|
663
|
+
const he = /* @__PURE__ */ We(Qe, [["render", rt]]), ct = {
|
|
664
664
|
class: "router-tabs",
|
|
665
665
|
"aria-hidden": "true"
|
|
666
|
-
},
|
|
666
|
+
}, Z = /* @__PURE__ */ ke({
|
|
667
667
|
name: "RouterTabs",
|
|
668
668
|
__name: "RouterTabs",
|
|
669
669
|
props: {
|
|
@@ -678,14 +678,46 @@ const ve = /* @__PURE__ */ Je(Ge, [["render", it]]), ot = {
|
|
|
678
678
|
fallbackRoute: {}
|
|
679
679
|
},
|
|
680
680
|
setup(e) {
|
|
681
|
-
return
|
|
681
|
+
return Re(e), (o, t) => (h(), g("span", ct));
|
|
682
682
|
}
|
|
683
|
-
}),
|
|
683
|
+
}), Ce = "tab-theme-style", Ae = "tab-theme-primary-color", ut = "system", ft = "#635bff", dt = "(prefers-color-scheme: dark)";
|
|
684
|
+
let S = null;
|
|
685
|
+
function _e(e) {
|
|
686
|
+
typeof document > "u" || (document.documentElement.style.setProperty("--theme-primary", e), document.documentElement.style.setProperty("--router-tab-primary", e));
|
|
687
|
+
}
|
|
688
|
+
function Pe(e) {
|
|
689
|
+
if (typeof document > "u") return;
|
|
690
|
+
const n = document.documentElement, o = window.matchMedia(dt), t = () => {
|
|
691
|
+
n.dataset.theme = o.matches ? "dark" : "light";
|
|
692
|
+
};
|
|
693
|
+
S && (o.removeEventListener("change", S), S = null), e === "system" ? (t(), S = () => t(), o.addEventListener("change", S)) : n.dataset.theme = e;
|
|
694
|
+
}
|
|
695
|
+
function bt(e = {}) {
|
|
696
|
+
if (typeof window > "u") return;
|
|
697
|
+
const {
|
|
698
|
+
styleKey: n = Ce,
|
|
699
|
+
primaryKey: o = Ae,
|
|
700
|
+
defaultStyle: t = ut,
|
|
701
|
+
defaultPrimary: l = ft
|
|
702
|
+
} = e, f = window.localStorage.getItem(n) ?? t, b = window.localStorage.getItem(o) ?? l;
|
|
703
|
+
Pe(f), _e(b);
|
|
704
|
+
}
|
|
705
|
+
function ht(e, n) {
|
|
706
|
+
if (typeof window > "u") return;
|
|
707
|
+
const o = n?.styleKey ?? Ce;
|
|
708
|
+
window.localStorage.setItem(o, e), Pe(e);
|
|
709
|
+
}
|
|
710
|
+
function vt(e, n) {
|
|
711
|
+
if (typeof window > "u") return;
|
|
712
|
+
const o = n?.primaryKey ?? Ae;
|
|
713
|
+
window.localStorage.setItem(o, e), _e(e);
|
|
714
|
+
}
|
|
715
|
+
const ve = {
|
|
684
716
|
install(e) {
|
|
685
|
-
if (
|
|
686
|
-
|
|
687
|
-
const
|
|
688
|
-
e.component(
|
|
717
|
+
if (ve._installed) return;
|
|
718
|
+
ve._installed = !0, bt();
|
|
719
|
+
const n = he.name || "RouterTab", o = Z.name || "RouterTabs";
|
|
720
|
+
e.component(n, he), e.component(o, Z), o !== "router-tabs" && e.component("router-tabs", Z), Object.defineProperty(e.config.globalProperties, "$tabs", {
|
|
689
721
|
configurable: !0,
|
|
690
722
|
enumerable: !1,
|
|
691
723
|
get() {
|
|
@@ -698,10 +730,13 @@ const ve = /* @__PURE__ */ Je(Ge, [["render", it]]), ot = {
|
|
|
698
730
|
}
|
|
699
731
|
};
|
|
700
732
|
export {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
733
|
+
he as RouterTab,
|
|
734
|
+
Z as RouterTabs,
|
|
735
|
+
ve as default,
|
|
736
|
+
bt as initRouterTabsTheme,
|
|
704
737
|
N as routerTabsKey,
|
|
705
|
-
|
|
706
|
-
|
|
738
|
+
vt as setRouterTabsPrimary,
|
|
739
|
+
ht as setRouterTabsTheme,
|
|
740
|
+
pe as useRouterTabs,
|
|
741
|
+
Re as useRouterTabsPersistence
|
|
707
742
|
};
|