labull-framework 0.1.1 → 0.1.3

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.
@@ -0,0 +1,669 @@
1
+ import { defineComponent as z, ref as S, computed as C, watch as ae, onMounted as X, onBeforeUnmount as Y, openBlock as t, createElementBlock as l, normalizeClass as $, unref as d, createElementVNode as e, Fragment as T, withDirectives as te, withKeys as Q, withModifiers as H, vModelText as _e, createCommentVNode as _, renderList as D, toDisplayString as w, nextTick as me, createBlock as ue, resolveDynamicComponent as ke, normalizeProps as ye, mergeProps as we, createTextVNode as W, renderSlot as Z, createVNode as F, vShow as oe } from "vue";
2
+ import { useRouter as ne, useRoute as re, RouterView as $e } from "vue-router";
3
+ import { e as se, o as le, _ as J, d as ce, p as ge, f as Ce, i as ie } from "./chunk-ProductShell.vue_vue_type_style_index_0_scoped_0fb37099_lang-BpRKKThg.js";
4
+ import { u as Pe, e as q, g as xe, i as Le, d as Ee, l as Te, a as Se } from "./chunk-index-BWpDbB19.js";
5
+ const Me = ["onKeydown"], Ie = {
6
+ key: 2,
7
+ class: "labull-search-panel",
8
+ role: "listbox"
9
+ }, Oe = ["aria-selected", "onMouseenter", "onMousedown"], Ne = { class: "labull-search-path" }, Ae = {
10
+ key: 0,
11
+ class: "labull-search-empty"
12
+ }, Be = /* @__PURE__ */ z({
13
+ __name: "AppSearch",
14
+ setup(n) {
15
+ const i = (b) => typeof b == "string" && b.trim() ? b.trim() : "";
16
+ function m(b) {
17
+ const r = /* @__PURE__ */ new Set(), y = [];
18
+ for (const x of b) {
19
+ const a = i(x?.path);
20
+ !a || r.has(a) || a.includes(":") || a.includes("*") || x.redirect || !x.components?.default || x.meta?.tab === !1 || (r.add(a), y.push({ path: a, title: i(x.meta?.title) || i(x.meta?.sub) || a }));
21
+ }
22
+ return y;
23
+ }
24
+ const c = ne(), { portrait: h } = se(), p = S(""), o = S(!1), g = S(0), L = S(null), k = S(null), P = C(() => m(c.getRoutes())), u = C(() => {
25
+ const b = p.value.trim().toLowerCase();
26
+ return b ? P.value.filter((r) => `${r.title} ${r.path}`.toLowerCase().includes(b)).slice(0, 8) : P.value.slice(0, 8);
27
+ });
28
+ ae(u, () => {
29
+ g.value = 0;
30
+ });
31
+ function E(b) {
32
+ b && (le(b.path), p.value = "", o.value = !1, k.value?.blur());
33
+ }
34
+ function U(b) {
35
+ const r = u.value.length;
36
+ r > 0 && (g.value = (g.value + b + r) % r), o.value = !0;
37
+ }
38
+ function M() {
39
+ o.value = !0, G();
40
+ }
41
+ function K() {
42
+ p.value = "", o.value = !1, k.value?.blur();
43
+ }
44
+ function G() {
45
+ me(() => k.value?.focus());
46
+ }
47
+ function I() {
48
+ if (p.value) {
49
+ p.value = "";
50
+ return;
51
+ }
52
+ o.value = !1, k.value?.blur();
53
+ }
54
+ function R(b) {
55
+ (b.ctrlKey || b.metaKey) && b.key.toLowerCase() === "k" && (b.preventDefault(), o.value = !0, G());
56
+ }
57
+ function V(b) {
58
+ o.value && !L.value?.contains(b.target) && (o.value = !1);
59
+ }
60
+ return X(() => {
61
+ document.addEventListener("mousedown", V), window.addEventListener("keydown", R);
62
+ }), Y(() => {
63
+ document.removeEventListener("mousedown", V), window.removeEventListener("keydown", R);
64
+ }), ae(h, () => {
65
+ K();
66
+ }), (b, r) => (t(), l("div", {
67
+ ref_key: "box",
68
+ ref: L,
69
+ class: $(["labull-search-box", { "is-open": d(h) && o.value }])
70
+ }, [
71
+ d(h) && !o.value ? (t(), l("button", {
72
+ key: 0,
73
+ class: "labull-search-toggle",
74
+ type: "button",
75
+ "aria-label": "搜索页面",
76
+ onClick: M
77
+ }, [...r[6] || (r[6] = [
78
+ e("i", { class: "pi pi-search" }, null, -1)
79
+ ])])) : (t(), l(T, { key: 1 }, [
80
+ r[8] || (r[8] = e("i", { class: "pi pi-search" }, null, -1)),
81
+ te(e("input", {
82
+ ref_key: "input",
83
+ ref: k,
84
+ "onUpdate:modelValue": r[0] || (r[0] = (y) => p.value = y),
85
+ class: "p-inputtext p-component labull-search-input",
86
+ type: "search",
87
+ placeholder: "搜索… [Ctrl+K]",
88
+ "aria-label": "搜索页面",
89
+ autocomplete: "off",
90
+ onFocus: r[1] || (r[1] = (y) => o.value = !0),
91
+ onInput: r[2] || (r[2] = (y) => o.value = !0),
92
+ onKeydown: [
93
+ r[3] || (r[3] = Q(H((y) => U(1), ["prevent"]), ["down"])),
94
+ r[4] || (r[4] = Q(H((y) => U(-1), ["prevent"]), ["up"])),
95
+ r[5] || (r[5] = Q(H((y) => E(u.value[g.value]), ["prevent"]), ["enter"])),
96
+ Q(H(I, ["prevent"]), ["esc"])
97
+ ]
98
+ }, null, 40, Me), [
99
+ [_e, p.value]
100
+ ]),
101
+ d(h) ? (t(), l("button", {
102
+ key: 0,
103
+ class: "labull-search-cancel",
104
+ type: "button",
105
+ "aria-label": "取消搜索",
106
+ onClick: K
107
+ }, [...r[7] || (r[7] = [
108
+ e("i", { class: "pi pi-times" }, null, -1)
109
+ ])])) : _("", !0)
110
+ ], 64)),
111
+ o.value && (p.value || d(h)) ? (t(), l("div", Ie, [
112
+ (t(!0), l(T, null, D(u.value, (y, x) => (t(), l("button", {
113
+ key: y.path,
114
+ class: "labull-search-item",
115
+ type: "button",
116
+ role: "option",
117
+ "aria-selected": x === g.value,
118
+ onMouseenter: (a) => g.value = x,
119
+ onMousedown: H((a) => E(y), ["prevent"])
120
+ }, [
121
+ r[9] || (r[9] = e("i", { class: "pi pi-file" }, null, -1)),
122
+ e("span", null, w(y.title), 1),
123
+ e("small", Ne, w(y.path), 1)
124
+ ], 40, Oe))), 128)),
125
+ u.value.length === 0 ? (t(), l("p", Ae, "未找到匹配项")) : _("", !0)
126
+ ])) : _("", !0)
127
+ ], 2));
128
+ }
129
+ }), de = /* @__PURE__ */ J(Be, [["__scopeId", "data-v-1af7a3a4"]]), Ue = { class: "labull-rail" }, Ke = { class: "labull-rail__group" }, Ve = ["title"], De = { class: "labull-rail__label" }, Ge = {
130
+ key: 1,
131
+ class: "labull-rail__divider"
132
+ }, Re = ["title", "aria-expanded", "onClick", "onMouseenter"], je = { class: "labull-rail__label" }, He = ["title"], We = { class: "labull-rail__brand-name" }, ze = ["aria-hidden"], Fe = { class: "labull-menu__header" }, qe = { class: "labull-menu__title" }, Je = { class: "labull-menu__list" }, Qe = ["onClick"], Xe = ["aria-hidden"], Ye = { class: "labull-navsheet__head" }, Ze = { class: "labull-navsheet__title" }, et = { class: "labull-navsheet__body" }, tt = ["onClick"], lt = ["onClick"], nt = /* @__PURE__ */ z({
133
+ __name: "ProductSide",
134
+ props: {
135
+ items: {},
136
+ brand: {},
137
+ home: {},
138
+ homeTitle: {},
139
+ homeIcon: {}
140
+ },
141
+ setup(n) {
142
+ const i = n, m = re(), { portrait: c, navOpen: h, closeNav: p } = se();
143
+ function o(s) {
144
+ return s.path || s.title;
145
+ }
146
+ function g() {
147
+ return !!i.home && m.path === i.home;
148
+ }
149
+ const L = S(!1), k = S(!1), P = S(null);
150
+ function u(s) {
151
+ return s.path ? m.path === s.path ? !0 : m.path.startsWith(`${s.path}/`) && s.path !== "/" : !1;
152
+ }
153
+ function E(s) {
154
+ return s.children?.length ? s.children.some((B) => u(B)) : u(s);
155
+ }
156
+ const U = C(() => i.items.find((s) => E(s)) ?? i.items[0]), M = C(() => (P.value ? i.items.find((B) => o(B) === P.value) : void 0) ?? U.value), K = C(() => I.value ? M.value : U.value), G = C(() => {
157
+ const s = M.value;
158
+ return s ? s.children?.length ? s.children : [s] : [];
159
+ }), I = C(() => i.items.length > 0 && (k.value || L.value));
160
+ function R() {
161
+ L.value = !0;
162
+ }
163
+ function V() {
164
+ L.value = !1, P.value = null, k.value = !1;
165
+ }
166
+ function b(s) {
167
+ P.value = o(s);
168
+ }
169
+ function r(s) {
170
+ k.value = !0, P.value = o(s), s.onClick?.(s);
171
+ }
172
+ function y(s) {
173
+ if (k.value = !1, s.onClick) {
174
+ s.onClick(s);
175
+ return;
176
+ }
177
+ s.path && le(s.path, { title: s.title, icon: s.icon });
178
+ }
179
+ function x() {
180
+ k.value = !1, P.value = null, i.home && le(i.home);
181
+ }
182
+ function a(s) {
183
+ y(s), p();
184
+ }
185
+ function f(s) {
186
+ if (s.children?.length) {
187
+ s.onClick?.(s), p();
188
+ return;
189
+ }
190
+ a(s);
191
+ }
192
+ function N() {
193
+ x(), p();
194
+ }
195
+ function A(s) {
196
+ s.key === "Escape" && h.value && p();
197
+ }
198
+ return X(() => window.addEventListener("keydown", A)), Y(() => window.removeEventListener("keydown", A)), (s, B) => (t(), l("nav", {
199
+ class: "labull-nav",
200
+ "aria-label": "主导航",
201
+ onMouseenter: R,
202
+ onMouseleave: V
203
+ }, [
204
+ e("div", Ue, [
205
+ e("div", Ke, [
206
+ n.home ? (t(), l("button", {
207
+ key: 0,
208
+ class: $(["labull-rail__btn", { "is-active": g() }]),
209
+ type: "button",
210
+ title: n.homeTitle || "首页",
211
+ onClick: x
212
+ }, [
213
+ e("i", {
214
+ class: $(n.homeIcon || "pi pi-home")
215
+ }, null, 2),
216
+ e("span", De, w(n.homeTitle || "首页"), 1)
217
+ ], 10, Ve)) : _("", !0),
218
+ n.home && n.items.length > 0 ? (t(), l("span", Ge)) : _("", !0),
219
+ (t(!0), l(T, null, D(n.items, (v) => (t(), l("button", {
220
+ key: o(v),
221
+ class: $(["labull-rail__btn", { "is-active": v === K.value }]),
222
+ type: "button",
223
+ title: v.title,
224
+ "aria-expanded": I.value && v === M.value,
225
+ onClick: (O) => r(v),
226
+ onMouseenter: (O) => b(v)
227
+ }, [
228
+ e("i", {
229
+ class: $(v.icon || "pi pi-folder")
230
+ }, null, 2),
231
+ e("span", je, w(v.title), 1)
232
+ ], 42, Re))), 128))
233
+ ]),
234
+ n.brand ? (t(), l("div", {
235
+ key: 0,
236
+ class: "labull-rail__brand",
237
+ title: n.brand
238
+ }, [
239
+ e("span", We, w(n.brand), 1)
240
+ ], 8, He)) : _("", !0)
241
+ ]),
242
+ e("aside", {
243
+ class: $(["labull-menu", { "is-open": I.value }]),
244
+ "aria-hidden": !I.value
245
+ }, [
246
+ e("div", Fe, [
247
+ e("div", qe, w(M.value?.title), 1)
248
+ ]),
249
+ e("div", Je, [
250
+ (t(!0), l(T, null, D(G.value, (v) => (t(), l("button", {
251
+ key: o(v),
252
+ class: $(["labull-menu__item", { "is-active": u(v) }]),
253
+ type: "button",
254
+ onClick: (O) => y(v)
255
+ }, [
256
+ e("i", {
257
+ class: $(v.icon || "pi pi-file")
258
+ }, null, 2),
259
+ e("span", null, w(v.title), 1)
260
+ ], 10, Qe))), 128))
261
+ ])
262
+ ], 10, ze),
263
+ d(c) ? (t(), l("div", {
264
+ key: 0,
265
+ class: $(["labull-navsheet", { "is-open": d(h) }]),
266
+ "aria-hidden": !d(h),
267
+ role: "dialog",
268
+ "aria-modal": "true",
269
+ "aria-label": "主导航"
270
+ }, [
271
+ e("div", Ye, [
272
+ e("span", Ze, w(n.brand || "导航"), 1),
273
+ e("button", {
274
+ class: "labull-navsheet__close",
275
+ type: "button",
276
+ "aria-label": "关闭导航",
277
+ onClick: B[0] || (B[0] = //@ts-ignore
278
+ (...v) => d(p) && d(p)(...v))
279
+ }, [...B[1] || (B[1] = [
280
+ e("i", { class: "pi pi-times" }, null, -1)
281
+ ])])
282
+ ]),
283
+ e("div", et, [
284
+ n.home ? (t(), l("button", {
285
+ key: 0,
286
+ class: $(["labull-navsheet__row labull-navsheet__row--home", { "is-active": g() }]),
287
+ type: "button",
288
+ onClick: N
289
+ }, [
290
+ e("i", {
291
+ class: $(n.homeIcon || "pi pi-home")
292
+ }, null, 2),
293
+ e("span", null, w(n.homeTitle || "首页"), 1)
294
+ ], 2)) : _("", !0),
295
+ (t(!0), l(T, null, D(n.items, (v) => (t(), l("div", {
296
+ key: o(v),
297
+ class: "labull-navsheet__section"
298
+ }, [
299
+ !v.children?.length || v.onClick ? (t(), l("button", {
300
+ key: 0,
301
+ class: $(["labull-navsheet__row labull-navsheet__row--group", { "is-current": E(v) }]),
302
+ type: "button",
303
+ onClick: (O) => f(v)
304
+ }, [
305
+ e("i", {
306
+ class: $(v.icon || "pi pi-folder")
307
+ }, null, 2),
308
+ e("span", null, w(v.title), 1)
309
+ ], 10, tt)) : (t(), l("div", {
310
+ key: 1,
311
+ class: $(["labull-navsheet__row labull-navsheet__row--group is-static", { "is-current": E(v) }])
312
+ }, [
313
+ e("i", {
314
+ class: $(v.icon || "pi pi-folder")
315
+ }, null, 2),
316
+ e("span", null, w(v.title), 1)
317
+ ], 2)),
318
+ (t(!0), l(T, null, D(v.children || [], (O) => (t(), l("button", {
319
+ key: o(O),
320
+ class: $(["labull-navsheet__row labull-navsheet__row--page", { "is-active": u(O) }]),
321
+ type: "button",
322
+ onClick: (Gt) => a(O)
323
+ }, [
324
+ e("i", {
325
+ class: $(O.icon || "pi pi-file")
326
+ }, null, 2),
327
+ e("span", null, w(O.title), 1)
328
+ ], 10, lt))), 128))
329
+ ]))), 128))
330
+ ])
331
+ ], 10, Xe)) : _("", !0)
332
+ ], 32));
333
+ }
334
+ }), ve = /* @__PURE__ */ J(nt, [["__scopeId", "data-v-c3bdb098"]]), st = {
335
+ key: 0,
336
+ class: "labull-tabbar",
337
+ role: "tablist"
338
+ }, at = ["aria-selected", "title", "onClick"], ot = ["onClick"], it = /* @__PURE__ */ z({
339
+ __name: "ProductTabs",
340
+ props: {
341
+ home: { default: "/" }
342
+ },
343
+ setup(n) {
344
+ const i = n, { tabs: m, active: c, activateTab: h, closeTab: p, openTab: o } = ce();
345
+ function g(k) {
346
+ h(k);
347
+ }
348
+ function L(k) {
349
+ p(k) || m.value.length === 0 && o(i.home);
350
+ }
351
+ return (k, P) => d(m).length > 0 ? (t(), l("div", st, [
352
+ (t(!0), l(T, null, D(d(m), (u) => (t(), l("button", {
353
+ key: u.key,
354
+ class: $(["labull-tab", { "is-active": u.key === d(c) }]),
355
+ type: "button",
356
+ role: "tab",
357
+ "aria-selected": u.key === d(c),
358
+ title: u.title,
359
+ onClick: (E) => g(u.key)
360
+ }, [
361
+ u.icon ? (t(), l("i", {
362
+ key: 0,
363
+ class: $(u.icon)
364
+ }, null, 2)) : _("", !0),
365
+ e("span", null, w(u.title), 1),
366
+ e("i", {
367
+ class: "pi pi-times labull-tab__close",
368
+ title: "关闭",
369
+ onClick: H((E) => L(u.key), ["stop"])
370
+ }, null, 8, ot)
371
+ ], 10, at))), 128))
372
+ ])) : _("", !0);
373
+ }
374
+ }), be = /* @__PURE__ */ J(it, [["__scopeId", "data-v-02d7624f"]]), ut = /* @__PURE__ */ z({
375
+ __name: "TabPage",
376
+ props: {
377
+ tab: {}
378
+ },
379
+ setup(n) {
380
+ const i = n;
381
+ ge(i.tab);
382
+ const m = ne();
383
+ function c() {
384
+ return m.resolve(i.tab.key);
385
+ }
386
+ const h = C(() => {
387
+ const o = c().matched;
388
+ return o[o.length - 1]?.components?.default ?? null;
389
+ }), p = C(() => {
390
+ const o = c().matched[c().matched.length - 1]?.props?.default;
391
+ return o === !0 ? c().params : typeof o == "function" ? o(m.resolve(i.tab.key)) : o && typeof o == "object" ? o : {};
392
+ });
393
+ return (o, g) => h.value ? (t(), ue(ke(h.value), ye(we({ key: 0 }, p.value)), null, 16)) : _("", !0);
394
+ }
395
+ }), rt = ["aria-expanded"], ct = { class: "labull-avatar" }, dt = { class: "labull-topbar__username" }, vt = {
396
+ key: 0,
397
+ class: "labull-user__panel"
398
+ }, bt = { class: "labull-user__who" }, pt = { class: "labull-user__title" }, ht = {
399
+ key: 0,
400
+ class: "labull-user__work"
401
+ }, ft = {
402
+ key: 0,
403
+ class: "labull-user__groups"
404
+ }, _t = { class: "labull-user__row" }, mt = /* @__PURE__ */ z({
405
+ __name: "UserMenu",
406
+ setup(n) {
407
+ const { user: i, logout: m } = Pe(), c = S(!1), h = S(!1), p = S(null), o = C(() => i.value?.name || "当前用户"), g = C(() => o.value.slice(0, 1));
408
+ function L() {
409
+ c.value = !1, h.value = !1;
410
+ }
411
+ function k(P) {
412
+ c.value && !p.value?.contains(P.target) && L();
413
+ }
414
+ return X(() => document.addEventListener("mousedown", k)), Y(() => document.removeEventListener("mousedown", k)), (P, u) => (t(), l("div", {
415
+ ref_key: "box",
416
+ ref: p,
417
+ class: "labull-user"
418
+ }, [
419
+ e("button", {
420
+ class: "p-button p-button-text p-button-sm labull-topbar__user",
421
+ type: "button",
422
+ "aria-expanded": c.value,
423
+ onClick: u[0] || (u[0] = (E) => c.value ? L() : c.value = !0)
424
+ }, [
425
+ e("span", ct, w(g.value), 1),
426
+ e("span", dt, w(o.value), 1),
427
+ u[4] || (u[4] = e("i", { class: "pi pi-chevron-down labull-user__caret" }, null, -1))
428
+ ], 8, rt),
429
+ c.value ? (t(), l("div", vt, [
430
+ e("div", bt, [
431
+ e("span", pt, [
432
+ W(w(o.value), 1),
433
+ d(i)?.workId ? (t(), l("span", ht, "(工号 " + w(d(i).workId) + ")", 1)) : _("", !0)
434
+ ]),
435
+ d(i)?.groups?.length ? (t(), l("small", ft, w(d(i).groups.join(" / ")), 1)) : _("", !0)
436
+ ]),
437
+ h.value ? (t(), l(T, { key: 1 }, [
438
+ u[5] || (u[5] = e("p", { class: "labull-user__ask" }, "退出后要重新登录,未保存的输入会丢。", -1)),
439
+ e("div", _t, [
440
+ e("button", {
441
+ class: "p-button p-button-sm p-button-text",
442
+ type: "button",
443
+ onClick: u[2] || (u[2] = (E) => h.value = !1)
444
+ }, "取消"),
445
+ e("button", {
446
+ class: "p-button p-button-sm p-button-danger",
447
+ type: "button",
448
+ onClick: u[3] || (u[3] = (E) => d(m)())
449
+ }, "确定退出")
450
+ ])
451
+ ], 64)) : (t(), l("button", {
452
+ key: 0,
453
+ class: "labull-user__item",
454
+ type: "button",
455
+ onClick: u[1] || (u[1] = (E) => h.value = !0)
456
+ }, "退出登录"))
457
+ ])) : _("", !0)
458
+ ], 512));
459
+ }
460
+ }), pe = /* @__PURE__ */ J(mt, [["__scopeId", "data-v-27408f31"]]);
461
+ let ee = !1, j = null;
462
+ const he = {
463
+ pass(n) {
464
+ return ee ? Promise.resolve(!0) : j || (j = (async () => {
465
+ const i = await xe();
466
+ return i !== "timeout" && i ? (ee = !0, !0) : (i !== "timeout" && Le(n), !1);
467
+ })().finally(() => {
468
+ j = null;
469
+ }), j);
470
+ },
471
+ reset() {
472
+ ee = !1, j = null;
473
+ }
474
+ };
475
+ function fe() {
476
+ return he.pass(q());
477
+ }
478
+ function kt() {
479
+ he.reset();
480
+ }
481
+ const yt = {
482
+ key: 0,
483
+ class: "labull-gate"
484
+ }, wt = {
485
+ key: 0,
486
+ class: "labull-gate__hint"
487
+ }, $t = ["href"], gt = ["href"], Ct = {
488
+ key: 1,
489
+ class: "labull-shell"
490
+ }, Pt = {
491
+ key: 0,
492
+ class: "labull-shell__bar"
493
+ }, xt = {
494
+ key: 1,
495
+ class: "labull-topbar"
496
+ }, Lt = ["aria-expanded"], Et = { class: "labull-topbar__brand" }, Tt = ["src"], St = {
497
+ key: 1,
498
+ class: "labull-topbar__caption"
499
+ }, Mt = {
500
+ key: 1,
501
+ class: "labull-topbar__actions"
502
+ }, It = { class: "labull-body" }, Ot = { class: "labull-main" }, Nt = { class: "labull-viewport" }, At = {
503
+ key: 0,
504
+ class: "labull-tabpage"
505
+ }, Bt = { class: "labull-tabpages" }, Ut = /* @__PURE__ */ z({
506
+ __name: "ProductShell",
507
+ props: {
508
+ actions: { type: Boolean, default: !0 },
509
+ side: {},
510
+ logo: {},
511
+ caption: { default: "Labull" },
512
+ home: { default: "/" },
513
+ brand: {}
514
+ },
515
+ setup(n) {
516
+ const i = n, m = re(), c = ne(), { tabs: h, active: p } = ce(), { portrait: o, navOpen: g, toggleNav: L } = se(), { open: k, denied: P, unreachable: u, pass: E, recheck: U } = Ee(), M = C(() => m.path === "/login" || q() === "/login"), K = C(() => Te(q()));
517
+ C(() => !!i.logo || !!i.caption);
518
+ const G = C(() => !!(i.side && i.side.length > 0)), I = C(() => m.meta.tab === !1);
519
+ ie({
520
+ resolve: (a) => {
521
+ const f = R(c.resolve(a));
522
+ return { fullPath: f.fullPath, path: f.path, matched: f.matched.length > 0 };
523
+ },
524
+ current: () => m.fullPath,
525
+ go: (a) => {
526
+ c.push(a);
527
+ }
528
+ });
529
+ function R(a) {
530
+ for (let f = 0; f < 8; f += 1) {
531
+ const A = a.matched[a.matched.length - 1]?.redirect;
532
+ if (typeof A == "string") {
533
+ a = c.resolve(A);
534
+ continue;
535
+ }
536
+ if (A && typeof A == "object") {
537
+ a = c.resolve(A);
538
+ continue;
539
+ }
540
+ return a;
541
+ }
542
+ return a;
543
+ }
544
+ function V(a) {
545
+ a.meta.tab !== !1 && Ce(a.fullPath, a.path, { title: a.meta.title, icon: a.meta.icon });
546
+ }
547
+ async function b() {
548
+ if (M.value) return;
549
+ await fe() && await E(q());
550
+ }
551
+ function r() {
552
+ window.location.reload();
553
+ }
554
+ function y(a) {
555
+ a.persisted && (kt(), U(q()));
556
+ }
557
+ let x;
558
+ return X(() => {
559
+ window.addEventListener("pageshow", y), b().then(() => {
560
+ k.value && (V(m), x = c.afterEach((a) => V(a)));
561
+ });
562
+ }), Y(() => {
563
+ window.removeEventListener("pageshow", y), x?.(), ie(null);
564
+ }), (a, f) => !d(k) && !M.value ? (t(), l("div", yt, [
565
+ f[5] || (f[5] = e("p", { class: "labull-gate__title" }, "正在确认登录状态…", -1)),
566
+ d(P) ? (t(), l("p", wt, [
567
+ d(u) ? (t(), l(T, { key: 0 }, [
568
+ W("连不上后端(等了 " + w(Math.round(d(Se) / 1e3)) + " 秒也没有回音)。确认后端起来之后 ", 1),
569
+ e("button", {
570
+ class: "labull-gate__link",
571
+ type: "button",
572
+ onClick: r
573
+ }, "重试"),
574
+ f[1] || (f[1] = W(",或者", -1)),
575
+ e("a", {
576
+ class: "labull-gate__link",
577
+ href: K.value
578
+ }, "直接去登录", 8, $t),
579
+ f[2] || (f[2] = W("。", -1))
580
+ ], 64)) : (t(), l(T, { key: 1 }, [
581
+ f[3] || (f[3] = W("没有登录(或会话已失效),正在跳登录页 —— 没跳过去就", -1)),
582
+ e("a", {
583
+ class: "labull-gate__link",
584
+ href: K.value
585
+ }, "点这里登录", 8, gt),
586
+ f[4] || (f[4] = W("。", -1))
587
+ ], 64))
588
+ ])) : _("", !0)
589
+ ])) : (t(), l("div", Ct, [
590
+ a.$slots.bar ? (t(), l("div", Pt, [
591
+ Z(a.$slots, "bar", {}, void 0, !0)
592
+ ])) : a.$slots.appbar || n.logo || n.caption || a.$slots.actions || n.actions ? (t(), l("header", xt, [
593
+ d(o) && G.value ? (t(), l("button", {
594
+ key: 0,
595
+ class: "labull-topbar__nav",
596
+ type: "button",
597
+ "aria-label": "打开导航",
598
+ "aria-expanded": d(g),
599
+ onClick: f[0] || (f[0] = //@ts-ignore
600
+ (...N) => d(L) && d(L)(...N))
601
+ }, [...f[6] || (f[6] = [
602
+ e("i", { class: "pi pi-bars" }, null, -1)
603
+ ])], 8, Lt)) : _("", !0),
604
+ e("div", Et, [
605
+ n.logo ? (t(), l("img", {
606
+ key: 0,
607
+ class: "labull-topbar__logo",
608
+ src: n.logo,
609
+ alt: ""
610
+ }, null, 8, Tt)) : _("", !0),
611
+ n.caption ? (t(), l("span", St, w(n.caption), 1)) : _("", !0),
612
+ Z(a.$slots, "appbar", {}, void 0, !0)
613
+ ]),
614
+ n.actions || a.$slots.actions ? (t(), l("div", Mt, [
615
+ Z(a.$slots, "actions", {}, void 0, !0),
616
+ n.actions ? (t(), l(T, { key: 0 }, [
617
+ F(de),
618
+ F(pe)
619
+ ], 64)) : _("", !0)
620
+ ])) : _("", !0)
621
+ ])) : _("", !0),
622
+ e("div", It, [
623
+ n.side && n.side.length > 0 ? (t(), ue(ve, {
624
+ key: 0,
625
+ items: n.side,
626
+ home: n.home,
627
+ brand: n.brand
628
+ }, null, 8, ["items", "home", "brand"])) : _("", !0),
629
+ e("div", Ot, [
630
+ F(be, { home: n.home }, null, 8, ["home"]),
631
+ e("main", Nt, [
632
+ I.value ? (t(), l("div", At, [
633
+ F(d($e))
634
+ ])) : _("", !0),
635
+ te(e("div", Bt, [
636
+ (t(!0), l(T, null, D(d(h), (N) => te((t(), l("div", {
637
+ key: N.key,
638
+ class: "labull-tabpage"
639
+ }, [
640
+ F(ut, { tab: N }, null, 8, ["tab"])
641
+ ])), [
642
+ [oe, N.key === d(p)]
643
+ ])), 128))
644
+ ], 512), [
645
+ [oe, !I.value]
646
+ ])
647
+ ])
648
+ ])
649
+ ])
650
+ ]));
651
+ }
652
+ }), Kt = /* @__PURE__ */ J(Ut, [["__scopeId", "data-v-0fb37099"]]), Vt = { ProductShell: Kt, ProductSide: ve, ProductTabs: be, AppSearch: de, UserMenu: pe };
653
+ function Dt(n, i = {}) {
654
+ for (const [c, h] of Object.entries(Vt)) n.component(c, h);
655
+ const m = n.config.globalProperties.$router;
656
+ m ? m.beforeEach(async (c) => c.path === "/login" ? !0 : await fe()) : console.warn("[labull] 没拿到 router:把 app.use(labull) 放到 app.use(router) 之后。");
657
+ for (const c of i.extra ?? []) n.use(c);
658
+ }
659
+ const zt = { install: (n) => Dt(n) };
660
+ export {
661
+ de as A,
662
+ Kt as P,
663
+ pe as U,
664
+ ut as _,
665
+ ve as a,
666
+ be as b,
667
+ Dt as i,
668
+ zt as l
669
+ };