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