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