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