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