mamba-layout 0.23.0 → 0.24.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/dist/index.js +38 -38
- package/dist/layout.global.js +26 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ const wt = 3600 * 24 * 7, Ce = "UTC", Qe = "timezone", Pt = [
|
|
|
22
22
|
} catch {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
},
|
|
25
|
+
}, G = {
|
|
26
26
|
get(n, e = null) {
|
|
27
27
|
const t = me(), a = t == null ? void 0 : t.getItem(n.toUpperCase());
|
|
28
28
|
if (!a) return e;
|
|
@@ -65,12 +65,12 @@ function ze(n, e) {
|
|
|
65
65
|
}
|
|
66
66
|
function Ze() {
|
|
67
67
|
const n = typeof navigator > "u" ? "en-US" : navigator.language;
|
|
68
|
-
return String(
|
|
68
|
+
return String(G.get("locale", n)).includes("zh") ? "zh-CN" : "en-US";
|
|
69
69
|
}
|
|
70
70
|
const Ne = (n, e, t) => {
|
|
71
71
|
var a;
|
|
72
72
|
return ((a = e == null ? void 0 : e[t]) == null ? void 0 : a[n]) || "";
|
|
73
|
-
},
|
|
73
|
+
}, te = (n, e, t = "") => {
|
|
74
74
|
const a = n;
|
|
75
75
|
return Ne(e, a, Ze()) || t || Ne(e, a, "en-US");
|
|
76
76
|
}, le = (n = "") => n.replace(/【.*】/, ""), je = (n, e, t) => {
|
|
@@ -101,11 +101,11 @@ const Ne = (n, e, t) => {
|
|
|
101
101
|
return !1;
|
|
102
102
|
}
|
|
103
103
|
}, Ye = () => ne(Intl.DateTimeFormat().resolvedOptions().timeZone) || Ce, Se = N(
|
|
104
|
-
ne(
|
|
104
|
+
ne(G.get(Qe)) || Ye()
|
|
105
105
|
), It = () => mt(Se);
|
|
106
106
|
function Lt(n) {
|
|
107
107
|
const e = ne(n);
|
|
108
|
-
e && (Se.value = e,
|
|
108
|
+
e && (Se.value = e, G.set(Qe, e, null));
|
|
109
109
|
}
|
|
110
110
|
const xt = (n) => {
|
|
111
111
|
const e = ne(n) || Ce, t = Me.get(e);
|
|
@@ -151,31 +151,31 @@ const xt = (n) => {
|
|
|
151
151
|
offset: a
|
|
152
152
|
};
|
|
153
153
|
});
|
|
154
|
-
},
|
|
154
|
+
}, $ = N("light");
|
|
155
155
|
function Xe() {
|
|
156
156
|
const n = "theme", e = "(prefers-color-scheme: dark)", t = N(!1);
|
|
157
157
|
let a = !1;
|
|
158
158
|
const o = (p) => p === "dark" || p === "light" ? p : null, s = () => typeof window > "u" || typeof window.matchMedia != "function" ? "light" : window.matchMedia(e).matches ? "dark" : "light", r = (p) => {
|
|
159
|
-
const b = o(
|
|
159
|
+
const b = o(G.get(n, null));
|
|
160
160
|
return b ? (t.value = !0, b) : p || s();
|
|
161
161
|
}, c = (p) => {
|
|
162
162
|
typeof document > "u" || document.documentElement.classList.toggle("dark", p === "dark");
|
|
163
163
|
}, g = (p) => {
|
|
164
164
|
const b = r(p);
|
|
165
|
-
return
|
|
165
|
+
return $.value = b, c(b), a = !0, b;
|
|
166
166
|
}, i = (p, b) => {
|
|
167
|
-
|
|
167
|
+
$.value = p, c(p), (b == null ? void 0 : b.persist) !== !1 && (G.set(n, p, null), t.value = !0);
|
|
168
168
|
}, h = () => {
|
|
169
|
-
i(
|
|
169
|
+
i($.value === "dark" ? "light" : "dark");
|
|
170
170
|
}, m = (p) => {
|
|
171
171
|
if (!a) {
|
|
172
172
|
g(p);
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
175
|
!t.value && p && i(p, { persist: !1 });
|
|
176
|
-
}, v = S(() =>
|
|
176
|
+
}, v = S(() => $.value === "dark");
|
|
177
177
|
return {
|
|
178
|
-
theme:
|
|
178
|
+
theme: $,
|
|
179
179
|
isDark: v,
|
|
180
180
|
initTheme: g,
|
|
181
181
|
setTheme: i,
|
|
@@ -247,11 +247,11 @@ const Ot = (n) => {
|
|
|
247
247
|
ge.value = ze(e.value, t);
|
|
248
248
|
const { syncThemeFromSetting: a } = Xe();
|
|
249
249
|
a(), Rt(ge.value);
|
|
250
|
-
}, Ft = 1024, Ve = N(), ae = N([]), Y = N(),
|
|
250
|
+
}, Ft = 1024, Ve = N(), ae = N([]), Y = N(), ee = N(""), W = N(""), fe = N(""), X = O(), ve = N(!0), ye = N(!1), Ht = N(), oe = () => {
|
|
251
251
|
var n;
|
|
252
|
-
return ((n =
|
|
252
|
+
return ((n = X.value.menus) == null ? void 0 : n.filter((e) => {
|
|
253
253
|
var t;
|
|
254
|
-
return ((t = e.meta) == null ? void 0 : t.appId) ==
|
|
254
|
+
return ((t = e.meta) == null ? void 0 : t.appId) == W.value;
|
|
255
255
|
})) || [];
|
|
256
256
|
}, $e = (n, e, t = 0, a) => {
|
|
257
257
|
var i, h, m, v;
|
|
@@ -267,7 +267,7 @@ const Ot = (n) => {
|
|
|
267
267
|
b[t] = p.item, Y.value = {
|
|
268
268
|
...p.item,
|
|
269
269
|
paths: b.slice(0, t + 1)
|
|
270
|
-
}, console.log(p.item),
|
|
270
|
+
}, console.log(p.item), W.value = ((m = p.item.meta) == null ? void 0 : m.appId) || "", Ve.value = e;
|
|
271
271
|
}
|
|
272
272
|
for (const p in n)
|
|
273
273
|
if (n[p].children && ((v = n[p].children) != null && v.length)) {
|
|
@@ -276,21 +276,21 @@ const Ot = (n) => {
|
|
|
276
276
|
}
|
|
277
277
|
fe.value = o.meta.parentPath || je(
|
|
278
278
|
o.path.toLowerCase(),
|
|
279
|
-
|
|
279
|
+
X.value.menus || []
|
|
280
280
|
) || o.path;
|
|
281
281
|
}, et = () => {
|
|
282
282
|
var a, o, s, r, c, g, i, h, m, v;
|
|
283
|
-
$e(
|
|
283
|
+
console.log(X.value.menus), $e(X.value.menus || []), console.log(W.value), W.value || (W.value = ((s = (o = (a = X.value.menus) == null ? void 0 : a.find((p) => {
|
|
284
284
|
var b;
|
|
285
|
-
return (b = p.path) == null ? void 0 : b.startsWith(
|
|
285
|
+
return (b = p.path) == null ? void 0 : b.startsWith(ee.value);
|
|
286
286
|
})) == null ? void 0 : o.meta) == null ? void 0 : s.appId) || "");
|
|
287
287
|
const n = ((r = Y.value) == null ? void 0 : r.paths) || [], e = le(
|
|
288
|
-
|
|
289
|
-
), t = ((i = Y.value) == null ? void 0 : i.path) == ((h = n[1]) == null ? void 0 : h.path) ? "" : le(
|
|
288
|
+
te(((g = (c = Y.value) == null ? void 0 : c.meta) == null ? void 0 : g.translations) || {}, "name")
|
|
289
|
+
), t = ((i = Y.value) == null ? void 0 : i.path) == ((h = n[1]) == null ? void 0 : h.path) ? "" : le(te(((v = (m = n[1]) == null ? void 0 : m.meta) == null ? void 0 : v.translations) || {}, "name"));
|
|
290
290
|
document.title = e + (t ? ` - ${t}` : "");
|
|
291
291
|
}, Be = () => {
|
|
292
292
|
const n = ie();
|
|
293
|
-
|
|
293
|
+
ee.value = "/" + (n.path.split("/").filter(Boolean).shift() || ""), et(), ae.value = oe();
|
|
294
294
|
}, be = () => {
|
|
295
295
|
const n = window.innerWidth < Ft;
|
|
296
296
|
ye.value = n, ve.value = !n;
|
|
@@ -305,18 +305,18 @@ function H() {
|
|
|
305
305
|
}), Ke(() => {
|
|
306
306
|
window.removeEventListener("resize", be);
|
|
307
307
|
}), re(
|
|
308
|
-
() =>
|
|
308
|
+
() => ee.value,
|
|
309
309
|
() => void (ae.value = oe())
|
|
310
310
|
), re(
|
|
311
|
-
() => [n.path,
|
|
311
|
+
() => [n.path, X.value.menus],
|
|
312
312
|
() => {
|
|
313
|
-
fe.value = "", Y.value = void 0,
|
|
313
|
+
fe.value = "", Y.value = void 0, ee.value = "/" + (n.path.split("/").filter(Boolean).shift() || ""), et(), ae.value = oe(), ye.value && (ve.value = !1);
|
|
314
314
|
}
|
|
315
315
|
), {
|
|
316
316
|
menus: ae,
|
|
317
317
|
currentEndRoute: Y,
|
|
318
|
-
currentTabPath:
|
|
319
|
-
currentAppId:
|
|
318
|
+
currentTabPath: ee,
|
|
319
|
+
currentAppId: W,
|
|
320
320
|
defaultParentActive: fe,
|
|
321
321
|
sideOpen: ve,
|
|
322
322
|
isMobile: ye,
|
|
@@ -408,7 +408,7 @@ const Qt = { class: "menu-item-icon" }, zt = ["innerHTML"], Zt = /* @__PURE__ */
|
|
|
408
408
|
}, null, 8, ["icon", "class"])),
|
|
409
409
|
d("div", {
|
|
410
410
|
class: K(["truncate", (T = t.value) != null && T.length ? "text-xs text-gray-400" : ""])
|
|
411
|
-
}, E(f(le)(f(
|
|
411
|
+
}, E(f(le)(f(te)(((F = (B = e.menu) == null ? void 0 : B.meta) == null ? void 0 : F.translations) || {}, "name"))), 3)
|
|
412
412
|
];
|
|
413
413
|
}),
|
|
414
414
|
_: 1
|
|
@@ -588,7 +588,7 @@ const ot = (n, e) => n.reduce(
|
|
|
588
588
|
_: 3
|
|
589
589
|
}, 8, ["type", "class"]));
|
|
590
590
|
}
|
|
591
|
-
}),
|
|
591
|
+
}), V = /* @__PURE__ */ D(cn, [["__scopeId", "data-v-824bbddc"]]), un = /* @__PURE__ */ M({
|
|
592
592
|
__name: "ThemeToggle",
|
|
593
593
|
setup(n) {
|
|
594
594
|
const e = O(), { theme: t, isDark: a, toggleTheme: o } = Xe();
|
|
@@ -596,7 +596,7 @@ const ot = (n, e) => n.reduce(
|
|
|
596
596
|
e.value.theme = t.value;
|
|
597
597
|
}), (s, r) => {
|
|
598
598
|
const c = L("el-icon");
|
|
599
|
-
return l(), k(
|
|
599
|
+
return l(), k(V, { onClick: f(o) }, {
|
|
600
600
|
default: C(() => [
|
|
601
601
|
_(c, null, {
|
|
602
602
|
default: C(() => [
|
|
@@ -1600,7 +1600,7 @@ const ot = (n, e) => n.reduce(
|
|
|
1600
1600
|
label: se[s].name,
|
|
1601
1601
|
value: s
|
|
1602
1602
|
})), o = (s) => {
|
|
1603
|
-
|
|
1603
|
+
G.set("locale", s), location.reload();
|
|
1604
1604
|
};
|
|
1605
1605
|
return (s, r) => {
|
|
1606
1606
|
const c = L("el-icon"), g = L("el-popover");
|
|
@@ -1611,7 +1611,7 @@ const ot = (n, e) => n.reduce(
|
|
|
1611
1611
|
"popper-class": "top-language-popover"
|
|
1612
1612
|
}, {
|
|
1613
1613
|
reference: C(() => [
|
|
1614
|
-
_(
|
|
1614
|
+
_(V, {
|
|
1615
1615
|
"langselect-toggle": "",
|
|
1616
1616
|
tag: "div",
|
|
1617
1617
|
class: "language-select",
|
|
@@ -1734,7 +1734,7 @@ const ot = (n, e) => n.reduce(
|
|
|
1734
1734
|
_(st),
|
|
1735
1735
|
t.value ? (l(), k(lt, { key: 0 }, {
|
|
1736
1736
|
reference: C(() => [
|
|
1737
|
-
_(
|
|
1737
|
+
_(V, { class: "header-right-mobile__action" }, {
|
|
1738
1738
|
default: C(() => [...s[0] || (s[0] = [
|
|
1739
1739
|
d("i", { class: "metisicon-yonghu1" }, null, -1)
|
|
1740
1740
|
])]),
|
|
@@ -1742,7 +1742,7 @@ const ot = (n, e) => n.reduce(
|
|
|
1742
1742
|
})
|
|
1743
1743
|
]),
|
|
1744
1744
|
_: 1
|
|
1745
|
-
})) : (l(), k(
|
|
1745
|
+
})) : (l(), k(V, {
|
|
1746
1746
|
key: 1,
|
|
1747
1747
|
class: "header-right-mobile__action",
|
|
1748
1748
|
onClick: a
|
|
@@ -1903,7 +1903,7 @@ const ot = (n, e) => n.reduce(
|
|
|
1903
1903
|
};
|
|
1904
1904
|
}, h = (u) => {
|
|
1905
1905
|
var w;
|
|
1906
|
-
return ((w = u == null ? void 0 : u.meta) != null && w.translations ? le(
|
|
1906
|
+
return ((w = u == null ? void 0 : u.meta) != null && w.translations ? le(te(u.meta.translations, "name", u.name)) : "") || (u == null ? void 0 : u.title) || (u == null ? void 0 : u.name) || "";
|
|
1907
1907
|
}, m = () => {
|
|
1908
1908
|
var u;
|
|
1909
1909
|
return e.currentTitle ? e.currentTitle : typeof ((u = t.meta) == null ? void 0 : u.title) == "string" ? t.meta.title : String(t.params.id || t.params.tenantId || "");
|
|
@@ -2037,7 +2037,7 @@ const ot = (n, e) => n.reduce(
|
|
|
2037
2037
|
"popper-class": "top-timezone-popover"
|
|
2038
2038
|
}, {
|
|
2039
2039
|
reference: C(() => [
|
|
2040
|
-
_(
|
|
2040
|
+
_(V, {
|
|
2041
2041
|
tag: "div",
|
|
2042
2042
|
class: "timezone-select",
|
|
2043
2043
|
"icon-only": !n.showLabel,
|
|
@@ -2166,7 +2166,7 @@ const ot = (n, e) => n.reduce(
|
|
|
2166
2166
|
_(tt, {
|
|
2167
2167
|
icon: v.icon || ((b = v.meta) == null ? void 0 : b.icon)
|
|
2168
2168
|
}, null, 8, ["icon"]),
|
|
2169
|
-
d("span", null, E(f(
|
|
2169
|
+
d("span", null, E(f(te)(((T = v.meta) == null ? void 0 : T.translations) || {}, "name", v.name)), 1)
|
|
2170
2170
|
], 8, pa);
|
|
2171
2171
|
}), 128)),
|
|
2172
2172
|
i[2] || (i[2] = d("div", { class: "user-info__divider" }, null, -1)),
|
|
@@ -2196,7 +2196,7 @@ const ot = (n, e) => n.reduce(
|
|
|
2196
2196
|
return (i, h) => {
|
|
2197
2197
|
const m = L("el-icon");
|
|
2198
2198
|
return l(), y("div", ga, [
|
|
2199
|
-
!a.value && g.value ? (l(), k(
|
|
2199
|
+
!a.value && g.value ? (l(), k(V, {
|
|
2200
2200
|
key: 0,
|
|
2201
2201
|
tag: "a",
|
|
2202
2202
|
class: "whitespace-nowrap",
|