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