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