@axewo/cnsframework
Version:
一个免费开源的中后台管理系统基础解决方案,基于 Vue3、TypeScript、Element Plus、Pinia 和 Vite 等主流技术
1,551 lines (1,550 loc) • 55.9 kB
JavaScript
import { reactive as We, ref as W, watch as Me, onBeforeMount as He, onMounted as $e, onBeforeUnmount as Oe, defineComponent as L, openBlock as d, createElementBlock as k, createElementVNode as x, toDisplayString as I, unref as f, resolveComponent as g, createVNode as u, withCtx as p, Transition as Ae, createBlock as w, KeepAlive as qe, resolveDynamicComponent as fe, createCommentVNode as $, Fragment as j, renderList as Q, withModifiers as oe, renderSlot as ae, computed as C, normalizeClass as N, createSlots as Ue, createTextVNode as J, normalizeStyle as Le, useCssVars as Ve, watchEffect as le, pushScopeId as Re, popScopeId as Ie, nextTick as Ge, getCurrentInstance as Xe, withDirectives as re, vShow as ce } from "vue";
import { d as je, g as Je, s as xe, u as ie, a as O, b as H, c as Fe, e as ue, f as de, r as Ke, h as Pe, i as Ye, j as Ze, k as Qe, R as et } from "./main-3931998b.js";
import { Fold as tt, Expand as nt, Bell as ot, MagicStick as st, UserFilled as at, Refresh as lt, ArrowLeft as rt, ArrowRight as ct, Close as it, Setting as ut } from "@element-plus/icons-vue";
import "dayjs";
import { ElMessage as De, ElScrollbar as dt } from "element-plus";
var X = /* @__PURE__ */ ((n) => (n[n.Mobile = 0] = "Mobile", n[n.Desktop = 1] = "Desktop", n))(X || {});
const _t = "opened", Ne = "closed";
function ft(n) {
n ? xe(_t) : xe(Ne);
}
const ne = je("app", () => {
const n = We({
opened: Je() !== Ne,
withoutAnimation: !1
}), e = W(X.Desktop);
return Me(
() => n.opened,
(s) => ft(s)
), { device: e, sidebar: n, toggleSidebar: (s) => {
n.opened = !n.opened, n.withoutAnimation = s;
}, closeSidebar: (s) => {
n.opened = !1, n.withoutAnimation = s;
}, toggleDevice: (s) => {
e.value = s;
} };
}), pt = 992, vt = () => {
const n = ne(), { listenerRouteChange: e } = ie(), t = () => document.body.getBoundingClientRect().width - 1 < pt, a = () => {
if (!document.hidden) {
const o = t();
n.toggleDevice(o ? X.Mobile : X.Desktop), o && n.closeSidebar(!0);
}
};
e(() => {
n.device === X.Mobile && n.sidebar.opened && n.closeSidebar(!1);
}), He(() => {
window.addEventListener("resize", a);
}), $e(() => {
t() && (n.toggleDevice(X.Mobile), n.closeSidebar(!0));
}), Oe(() => {
window.removeEventListener("resize", a);
});
}, mt = { class: "layout-footer" }, ht = /* @__PURE__ */ L({
__name: "index",
setup(n) {
const e = O(), { copyrightZh: t, copyrightEn: a } = H(e);
return (o, s) => (d(), k("footer", mt, [
x("div", null, I(f(t)), 1),
x("div", null, I(f(a)), 1)
]));
}
});
const V = (n, e) => {
const t = n.__vccOpts || n;
for (const [a, o] of e)
t[a] = o;
return t;
}, gt = /* @__PURE__ */ V(ht, [["__scopeId", "data-v-365aeeb6"]]), bt = { class: "app-main" }, yt = { class: "app-scrollbar" }, wt = /* @__PURE__ */ L({
__name: "AppMain",
setup(n) {
const e = Fe(), t = O();
return (a, o) => {
const s = g("router-view"), l = g("el-backtop");
return d(), k("section", bt, [
x("div", yt, [
u(s, null, {
default: p(({ Component: r, route: c }) => [
u(Ae, {
name: "el-fade-in",
mode: "out-in"
}, {
default: p(() => [
(d(), w(qe, {
include: f(e).cachedViews
}, [
(d(), w(fe(r), {
key: c.path,
class: "app-container-grow"
}))
], 1032, ["include"]))
]),
_: 2
}, 1024)
]),
_: 1
}),
f(t).showFooter ? (d(), w(gt, { key: 0 })) : $("", !0)
]),
u(l),
u(l, { target: ".app-scrollbar" })
]);
};
}
});
const ve = /* @__PURE__ */ V(wt, [["__scopeId", "data-v-849e13d2"]]), xt = /* @__PURE__ */ L({
__name: "index",
props: {
isActive: { type: Boolean, default: !1 }
},
emits: ["toggleClick"],
setup(n, { emit: e }) {
const t = n, a = e, o = () => {
a("toggleClick");
};
return (s, l) => {
const r = g("el-icon");
return d(), k("div", { onClick: o }, [
u(r, {
size: 20,
class: "icon"
}, {
default: p(() => [
t.isActive ? (d(), w(f(tt), { key: 0 })) : (d(), w(f(nt), { key: 1 }))
]),
_: 1
})
]);
};
}
});
const kt = /* @__PURE__ */ V(xt, [["__scopeId", "data-v-9f145668"]]);
function St(n) {
for (var e = [], t = 0; t < n.length; ) {
var a = n[t];
if (a === "*" || a === "+" || a === "?") {
e.push({ type: "MODIFIER", index: t, value: n[t++] });
continue;
}
if (a === "\\") {
e.push({ type: "ESCAPED_CHAR", index: t++, value: n[t++] });
continue;
}
if (a === "{") {
e.push({ type: "OPEN", index: t, value: n[t++] });
continue;
}
if (a === "}") {
e.push({ type: "CLOSE", index: t, value: n[t++] });
continue;
}
if (a === ":") {
for (var o = "", s = t + 1; s < n.length; ) {
var l = n.charCodeAt(s);
if (
// `0-9`
l >= 48 && l <= 57 || // `A-Z`
l >= 65 && l <= 90 || // `a-z`
l >= 97 && l <= 122 || // `_`
l === 95
) {
o += n[s++];
continue;
}
break;
}
if (!o)
throw new TypeError("Missing parameter name at ".concat(t));
e.push({ type: "NAME", index: t, value: o }), t = s;
continue;
}
if (a === "(") {
var r = 1, c = "", s = t + 1;
if (n[s] === "?")
throw new TypeError('Pattern cannot start with "?" at '.concat(s));
for (; s < n.length; ) {
if (n[s] === "\\") {
c += n[s++] + n[s++];
continue;
}
if (n[s] === ")") {
if (r--, r === 0) {
s++;
break;
}
} else if (n[s] === "(" && (r++, n[s + 1] !== "?"))
throw new TypeError("Capturing groups are not allowed at ".concat(s));
c += n[s++];
}
if (r)
throw new TypeError("Unbalanced pattern at ".concat(t));
if (!c)
throw new TypeError("Missing pattern at ".concat(t));
e.push({ type: "PATTERN", index: t, value: c }), t = s;
continue;
}
e.push({ type: "CHAR", index: t, value: n[t++] });
}
return e.push({ type: "END", index: t, value: "" }), e;
}
function Ct(n, e) {
e === void 0 && (e = {});
for (var t = St(n), a = e.prefixes, o = a === void 0 ? "./" : a, s = "[^".concat(Mt(e.delimiter || "/#?"), "]+?"), l = [], r = 0, c = 0, m = "", _ = function(F) {
if (c < t.length && t[c].type === F)
return t[c++].value;
}, i = function(F) {
var q = _(F);
if (q !== void 0)
return q;
var K = t[c], b = K.type, A = K.index;
throw new TypeError("Unexpected ".concat(b, " at ").concat(A, ", expected ").concat(F));
}, v = function() {
for (var F = "", q; q = _("CHAR") || _("ESCAPED_CHAR"); )
F += q;
return F;
}; c < t.length; ) {
var h = _("CHAR"), y = _("NAME"), E = _("PATTERN");
if (y || E) {
var S = h || "";
o.indexOf(S) === -1 && (m += S, S = ""), m && (l.push(m), m = ""), l.push({
name: y || r++,
prefix: S,
suffix: "",
pattern: E || s,
modifier: _("MODIFIER") || ""
});
continue;
}
var R = h || _("ESCAPED_CHAR");
if (R) {
m += R;
continue;
}
m && (l.push(m), m = "");
var P = _("OPEN");
if (P) {
var S = v(), M = _("NAME") || "", D = _("PATTERN") || "", U = v();
i("CLOSE"), l.push({
name: M || (D ? r++ : ""),
pattern: M && !D ? s : D,
prefix: S,
suffix: U,
modifier: _("MODIFIER") || ""
});
continue;
}
i("END");
}
return l;
}
function Et(n, e) {
return Tt(Ct(n, e), e);
}
function Tt(n, e) {
e === void 0 && (e = {});
var t = $t(e), a = e.encode, o = a === void 0 ? function(c) {
return c;
} : a, s = e.validate, l = s === void 0 ? !0 : s, r = n.map(function(c) {
if (typeof c == "object")
return new RegExp("^(?:".concat(c.pattern, ")$"), t);
});
return function(c) {
for (var m = "", _ = 0; _ < n.length; _++) {
var i = n[_];
if (typeof i == "string") {
m += i;
continue;
}
var v = c ? c[i.name] : void 0, h = i.modifier === "?" || i.modifier === "*", y = i.modifier === "*" || i.modifier === "+";
if (Array.isArray(v)) {
if (!y)
throw new TypeError('Expected "'.concat(i.name, '" to not repeat, but got an array'));
if (v.length === 0) {
if (h)
continue;
throw new TypeError('Expected "'.concat(i.name, '" to not be empty'));
}
for (var E = 0; E < v.length; E++) {
var S = o(v[E], i);
if (l && !r[_].test(S))
throw new TypeError('Expected all "'.concat(i.name, '" to match "').concat(i.pattern, '", but got "').concat(S, '"'));
m += i.prefix + S + i.suffix;
}
continue;
}
if (typeof v == "string" || typeof v == "number") {
var S = o(String(v), i);
if (l && !r[_].test(S))
throw new TypeError('Expected "'.concat(i.name, '" to match "').concat(i.pattern, '", but got "').concat(S, '"'));
m += i.prefix + S + i.suffix;
continue;
}
if (!h) {
var R = y ? "an array" : "a string";
throw new TypeError('Expected "'.concat(i.name, '" to be ').concat(R));
}
}
return m;
};
}
function Mt(n) {
return n.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
}
function $t(n) {
return n && n.sensitive ? "" : "i";
}
const At = {
key: 0,
class: "no-redirect"
}, Lt = ["onClick"], Vt = /* @__PURE__ */ L({
__name: "index",
setup(n) {
const e = ue(), t = de(), { listenerRouteChange: a } = ie(), o = W([]), s = () => {
o.value = e.matched.filter((c) => c.meta?.title && c.meta?.breadcrumb !== !1);
}, l = (c) => Et(c)(e.params), r = (c) => {
const { redirect: m, path: _ } = c;
if (m) {
t.push(m);
return;
}
t.push(l(_));
};
return a((c) => {
c.path.startsWith("/redirect/") || s();
}, !0), (c, m) => {
const _ = g("el-breadcrumb-item"), i = g("el-breadcrumb");
return d(), w(i, { class: "app-breadcrumb" }, {
default: p(() => [
(d(!0), k(j, null, Q(o.value, (v, h) => (d(), w(_, {
key: v.path
}, {
default: p(() => [
v.redirect === "noRedirect" || h === o.value.length - 1 ? (d(), k("span", At, I(v.meta.title), 1)) : (d(), k("a", {
key: 1,
onClick: oe((y) => r(v), ["prevent"])
}, I(v.meta.title), 9, Lt))
]),
_: 2
}, 1024))), 128))
]),
_: 1
});
};
}
});
const Rt = /* @__PURE__ */ V(Vt, [["__scopeId", "data-v-3a94d4c6"]]), pe = (n) => /^(https?:|mailto:|tel:)/.test(n), It = ["href"], Ft = /* @__PURE__ */ L({
__name: "SidebarItemLink",
props: {
to: {}
},
setup(n) {
const e = n;
return (t, a) => {
const o = g("router-link");
return f(pe)(e.to) ? (d(), k("a", {
key: 0,
href: e.to,
target: "_blank",
rel: "noopener"
}, [
ae(t.$slots, "default")
], 8, It)) : (d(), w(o, {
key: 1,
to: e.to
}, {
default: p(() => [
ae(t.$slots, "default")
]),
_: 3
}, 8, ["to"]));
};
}
});
function Pt(n) {
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
}
function G(n) {
if (typeof n != "string")
throw new TypeError("Path must be a string. Received " + JSON.stringify(n));
}
function ke(n, e) {
for (var t = "", a = 0, o = -1, s = 0, l, r = 0; r <= n.length; ++r) {
if (r < n.length)
l = n.charCodeAt(r);
else {
if (l === 47)
break;
l = 47;
}
if (l === 47) {
if (!(o === r - 1 || s === 1))
if (o !== r - 1 && s === 2) {
if (t.length < 2 || a !== 2 || t.charCodeAt(t.length - 1) !== 46 || t.charCodeAt(t.length - 2) !== 46) {
if (t.length > 2) {
var c = t.lastIndexOf("/");
if (c !== t.length - 1) {
c === -1 ? (t = "", a = 0) : (t = t.slice(0, c), a = t.length - 1 - t.lastIndexOf("/")), o = r, s = 0;
continue;
}
} else if (t.length === 2 || t.length === 1) {
t = "", a = 0, o = r, s = 0;
continue;
}
}
e && (t.length > 0 ? t += "/.." : t = "..", a = 2);
} else
t.length > 0 ? t += "/" + n.slice(o + 1, r) : t = n.slice(o + 1, r), a = r - o - 1;
o = r, s = 0;
} else
l === 46 && s !== -1 ? ++s : s = -1;
}
return t;
}
function Dt(n, e) {
var t = e.dir || e.root, a = e.base || (e.name || "") + (e.ext || "");
return t ? t === e.root ? t + a : t + n + a : a;
}
var te = {
// path.resolve([from ...], to)
resolve: function() {
for (var e = "", t = !1, a, o = arguments.length - 1; o >= -1 && !t; o--) {
var s;
o >= 0 ? s = arguments[o] : (a === void 0 && (a = process.cwd()), s = a), G(s), s.length !== 0 && (e = s + "/" + e, t = s.charCodeAt(0) === 47);
}
return e = ke(e, !t), t ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
},
normalize: function(e) {
if (G(e), e.length === 0)
return ".";
var t = e.charCodeAt(0) === 47, a = e.charCodeAt(e.length - 1) === 47;
return e = ke(e, !t), e.length === 0 && !t && (e = "."), e.length > 0 && a && (e += "/"), t ? "/" + e : e;
},
isAbsolute: function(e) {
return G(e), e.length > 0 && e.charCodeAt(0) === 47;
},
join: function() {
if (arguments.length === 0)
return ".";
for (var e, t = 0; t < arguments.length; ++t) {
var a = arguments[t];
G(a), a.length > 0 && (e === void 0 ? e = a : e += "/" + a);
}
return e === void 0 ? "." : te.normalize(e);
},
relative: function(e, t) {
if (G(e), G(t), e === t || (e = te.resolve(e), t = te.resolve(t), e === t))
return "";
for (var a = 1; a < e.length && e.charCodeAt(a) === 47; ++a)
;
for (var o = e.length, s = o - a, l = 1; l < t.length && t.charCodeAt(l) === 47; ++l)
;
for (var r = t.length, c = r - l, m = s < c ? s : c, _ = -1, i = 0; i <= m; ++i) {
if (i === m) {
if (c > m) {
if (t.charCodeAt(l + i) === 47)
return t.slice(l + i + 1);
if (i === 0)
return t.slice(l + i);
} else
s > m && (e.charCodeAt(a + i) === 47 ? _ = i : i === 0 && (_ = 0));
break;
}
var v = e.charCodeAt(a + i), h = t.charCodeAt(l + i);
if (v !== h)
break;
v === 47 && (_ = i);
}
var y = "";
for (i = a + _ + 1; i <= o; ++i)
(i === o || e.charCodeAt(i) === 47) && (y.length === 0 ? y += ".." : y += "/..");
return y.length > 0 ? y + t.slice(l + _) : (l += _, t.charCodeAt(l) === 47 && ++l, t.slice(l));
},
_makeLong: function(e) {
return e;
},
dirname: function(e) {
if (G(e), e.length === 0)
return ".";
for (var t = e.charCodeAt(0), a = t === 47, o = -1, s = !0, l = e.length - 1; l >= 1; --l)
if (t = e.charCodeAt(l), t === 47) {
if (!s) {
o = l;
break;
}
} else
s = !1;
return o === -1 ? a ? "/" : "." : a && o === 1 ? "//" : e.slice(0, o);
},
basename: function(e, t) {
if (t !== void 0 && typeof t != "string")
throw new TypeError('"ext" argument must be a string');
G(e);
var a = 0, o = -1, s = !0, l;
if (t !== void 0 && t.length > 0 && t.length <= e.length) {
if (t.length === e.length && t === e)
return "";
var r = t.length - 1, c = -1;
for (l = e.length - 1; l >= 0; --l) {
var m = e.charCodeAt(l);
if (m === 47) {
if (!s) {
a = l + 1;
break;
}
} else
c === -1 && (s = !1, c = l + 1), r >= 0 && (m === t.charCodeAt(r) ? --r === -1 && (o = l) : (r = -1, o = c));
}
return a === o ? o = c : o === -1 && (o = e.length), e.slice(a, o);
} else {
for (l = e.length - 1; l >= 0; --l)
if (e.charCodeAt(l) === 47) {
if (!s) {
a = l + 1;
break;
}
} else
o === -1 && (s = !1, o = l + 1);
return o === -1 ? "" : e.slice(a, o);
}
},
extname: function(e) {
G(e);
for (var t = -1, a = 0, o = -1, s = !0, l = 0, r = e.length - 1; r >= 0; --r) {
var c = e.charCodeAt(r);
if (c === 47) {
if (!s) {
a = r + 1;
break;
}
continue;
}
o === -1 && (s = !1, o = r + 1), c === 46 ? t === -1 ? t = r : l !== 1 && (l = 1) : t !== -1 && (l = -1);
}
return t === -1 || o === -1 || // We saw a non-dot character immediately before the dot
l === 0 || // The (right-most) trimmed path component is exactly '..'
l === 1 && t === o - 1 && t === a + 1 ? "" : e.slice(t, o);
},
format: function(e) {
if (e === null || typeof e != "object")
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof e);
return Dt("/", e);
},
parse: function(e) {
G(e);
var t = { root: "", dir: "", base: "", ext: "", name: "" };
if (e.length === 0)
return t;
var a = e.charCodeAt(0), o = a === 47, s;
o ? (t.root = "/", s = 1) : s = 0;
for (var l = -1, r = 0, c = -1, m = !0, _ = e.length - 1, i = 0; _ >= s; --_) {
if (a = e.charCodeAt(_), a === 47) {
if (!m) {
r = _ + 1;
break;
}
continue;
}
c === -1 && (m = !1, c = _ + 1), a === 46 ? l === -1 ? l = _ : i !== 1 && (i = 1) : l !== -1 && (i = -1);
}
return l === -1 || c === -1 || // We saw a non-dot character immediately before the dot
i === 0 || // The (right-most) trimmed path component is exactly '..'
i === 1 && l === c - 1 && l === r + 1 ? c !== -1 && (r === 0 && o ? t.base = t.name = e.slice(1, c) : t.base = t.name = e.slice(r, c)) : (r === 0 && o ? (t.name = e.slice(1, l), t.base = e.slice(1, c)) : (t.name = e.slice(r, l), t.base = e.slice(r, c)), t.ext = e.slice(l, c)), r > 0 ? t.dir = e.slice(0, r - 1) : o && (t.dir = "/"), t;
},
sep: "/",
delimiter: ":",
win32: null,
posix: null
};
te.posix = te;
var Nt = te;
const Be = /* @__PURE__ */ Pt(Nt), Bt = { key: 2 }, zt = /* @__PURE__ */ L({
__name: "SidebarItem",
props: {
item: {},
isCollapse: { type: Boolean, default: !1 },
isTop: { type: Boolean, default: !1 },
isFirstLevel: { type: Boolean, default: !0 },
basePath: { default: "" }
},
setup(n) {
const e = n, t = C(() => e.item.meta?.alwaysShow), a = C(() => e.item.children?.filter((r) => !r.meta?.hidden) ?? []), o = C(() => a.value.length), s = C(() => {
const r = o.value;
switch (!0) {
case r > 1:
return null;
case r === 1:
return a.value[0];
default:
return { ...e.item, path: "" };
}
}), l = (r) => {
switch (!0) {
case pe(r):
return r;
case pe(e.basePath):
return e.basePath;
default:
return Be.resolve(e.basePath, r);
}
};
return (r, c) => {
const m = g("SvgIcon"), _ = g("el-menu-item"), i = g("sidebar-item", !0), v = g("el-sub-menu");
return e.item.meta?.hidden ? $("", !0) : (d(), k("div", {
key: 0,
class: N({ "simple-mode": e.isCollapse && !r.isTop, "first-level": e.isFirstLevel })
}, [
!t.value && s.value && !s.value.children ? (d(), k(j, { key: 0 }, [
s.value.meta ? (d(), w(Ft, {
key: 0,
to: l(s.value.path)
}, {
default: p(() => [
u(_, {
index: l(s.value.path)
}, Ue({
default: p(() => [
s.value.meta.svgIcon ? (d(), w(m, {
key: 0,
name: s.value.meta.svgIcon
}, null, 8, ["name"])) : s.value.meta.elIcon ? (d(), w(fe(s.value.meta.elIcon), {
key: 1,
class: "el-icon"
})) : $("", !0)
]),
_: 2
}, [
s.value.meta.title ? {
name: "title",
fn: p(() => [
J(I(s.value.meta.title), 1)
]),
key: "0"
} : void 0
]), 1032, ["index"])
]),
_: 1
}, 8, ["to"])) : $("", !0)
], 64)) : (d(), w(v, {
key: 1,
index: l(e.item.path),
teleported: ""
}, {
title: p(() => [
e.item.meta?.svgIcon ? (d(), w(m, {
key: 0,
name: e.item.meta.svgIcon
}, null, 8, ["name"])) : e.item.meta?.elIcon ? (d(), w(fe(e.item.meta.elIcon), {
key: 1,
class: "el-icon"
})) : $("", !0),
e.item.meta?.title ? (d(), k("span", Bt, I(e.item.meta.title), 1)) : $("", !0)
]),
default: p(() => [
e.item.children && e.item.children.length > 0 ? (d(!0), k(j, { key: 0 }, Q(e.item.children, (h) => (d(), w(i, {
key: h.path,
item: h,
"is-collapse": e.isCollapse,
"is-first-level": !1,
"base-path": l(h.path)
}, null, 8, ["item", "is-collapse", "base-path"]))), 128)) : $("", !0)
]),
_: 1
}, 8, ["index"]))
], 2));
};
}
});
const Wt = /* @__PURE__ */ V(zt, [["__scopeId", "data-v-2227fea7"]]), Ht = ["src"], Ot = ["src"], qt = /* @__PURE__ */ L({
__name: "index",
props: {
collapse: { type: Boolean, default: !0 }
},
setup(n) {
const e = n, t = O(), { layoutMode: a, sideLogo: o, title: s } = H(t);
return (l, r) => {
const c = g("router-link");
return d(), k("div", {
class: N(["layout-logo-container", { collapse: e.collapse, "layout-mode-top": f(a) === "top" }])
}, [
u(Ae, { name: "layout-logo-fade" }, {
default: p(() => [
e.collapse ? (d(), w(c, {
key: "collapse",
to: "/"
}, {
default: p(() => [
x("img", {
src: f(o),
class: "layout-logo"
}, null, 8, Ht)
]),
_: 1
})) : (d(), w(c, {
key: "expand",
to: "/",
class: "layout-logo-text"
}, {
default: p(() => [
x("img", {
src: f(o),
style: { flex: "32px 0 0", width: "32px", "margin-left": "10px" }
}, null, 8, Ot),
x("div", {
class: "layout-title",
style: Le({ color: f(a) !== "left" ? "#000" : "#fff" })
}, I(f(s)), 5)
]),
_: 1
}))
]),
_: 1
})
], 2);
};
}
});
const me = /* @__PURE__ */ V(qt, [["__scopeId", "data-v-fa229ec7"]]), se = (n) => {
let e = "";
try {
e = getComputedStyle(document.documentElement).getPropertyValue(n);
} catch (t) {
console.error(t);
}
return e;
}, Se = (n, e) => {
try {
document.documentElement.style.setProperty(n, e);
} catch (t) {
console.error(t);
}
}, Ut = () => {
Ke(), location.reload();
}, Gt = /* @__PURE__ */ L({
__name: "index",
setup(n) {
Ve((b) => ({
"56bea8c8": q.value,
"107712b2": K.value,
"75d0f4f8": U.value,
"4df57e2c": F.value,
"38d5ff3f": D.value
}));
const e = se("--v3-sidebar-menu-bg-color"), t = se("--v3-sidebar-menu-text-color"), a = se("--v3-sidebar-menu-active-text-color"), o = ue(), s = ne(), l = Pe(), r = O(), { sidebar: c, device: m } = H(s), { layoutMode: _, showLogo: i } = H(r), v = C(() => {
const {
meta: { activeMenu: b },
path: A
} = o;
return b || A;
}), h = C(() => !c.value.opened), y = C(() => _.value === "left"), E = C(() => _.value === "top"), S = C(() => m.value === X.Mobile), R = C(() => y.value && i.value), P = C(() => y.value ? e : void 0), M = C(() => y.value ? t : void 0), D = C(() => y.value ? a : void 0), U = C(() => _.value !== "top" ? "var(--v3-sidebar-menu-item-height)" : "var(--v3-navigationbar-height)"), F = C(() => _.value !== "top" ? "var(--v3-sidebar-menu-hover-bg-color)" : "transparent"), q = C(() => _.value !== "top" ? "2px" : "0px"), K = C(() => _.value === "top" ? "none" : "block");
return (b, A) => {
const Y = g("el-menu"), T = g("el-scrollbar");
return d(), k("div", {
class: N({ "has-logo": R.value })
}, [
R.value ? (d(), w(me, {
key: 0,
collapse: h.value
}, null, 8, ["collapse"])) : $("", !0),
u(T, { "wrap-class": "scrollbar-wrapper" }, {
default: p(() => [
u(Y, {
"default-active": v.value,
collapse: h.value && !E.value,
"background-color": P.value,
"text-color": M.value,
"active-text-color": D.value,
"unique-opened": !0,
"collapse-transition": !1,
mode: E.value && !S.value ? "horizontal" : "vertical"
}, {
default: p(() => [
(d(!0), k(j, null, Q(f(l).routes, (B) => (d(), w(Wt, {
key: B.path,
item: B,
"base-path": B.path,
"is-collapse": h.value,
"is-top": E.value
}, null, 8, ["item", "base-path", "is-collapse", "is-top"]))), 128))
]),
_: 1
}, 8, ["default-active", "collapse", "background-color", "text-color", "active-text-color", "mode"])
]),
_: 1
})
], 2);
};
}
});
const he = /* @__PURE__ */ V(Gt, [["__scopeId", "data-v-1b00bae0"]]), Xt = { class: "card-header" }, jt = { class: "card-title" }, Jt = { class: "card-time" }, Kt = {
key: 0,
class: "card-avatar"
}, Yt = ["src"], Zt = { class: "card-body" }, Qt = /* @__PURE__ */ L({
__name: "NotifyList",
props: {
list: {},
prop: {}
},
setup(n) {
return (e, t) => {
const a = g("el-empty"), o = g("el-tag"), s = g("el-card");
return e.list.length === 0 ? (d(), w(a, { key: 0 })) : (d(!0), k(j, { key: 1 }, Q(e.list, (l, r) => (d(), w(s, {
key: r,
shadow: "never",
class: "card-container"
}, {
header: p(() => [
x("div", Xt, [
x("div", null, [
x("span", null, [
x("span", jt, I(l[e.prop.title]), 1),
l[e.prop.extra] ? (d(), w(o, {
key: 0,
type: l[e.prop.status],
effect: "plain",
size: "small"
}, {
default: p(() => [
J(I(l[e.prop.extra]), 1)
]),
_: 2
}, 1032, ["type"])) : $("", !0)
]),
x("div", Jt, I(l[e.prop.datetime]), 1)
]),
l[e.prop.avatar] ? (d(), k("div", Kt, [
x("img", {
src: l[e.prop.avatar],
width: "34"
}, null, 8, Yt)
])) : $("", !0)
])
]),
default: p(() => [
x("div", Zt, I(l[e.prop.description] ?? "No Data"), 1)
]),
_: 2
}, 1024))), 128));
};
}
});
const en = /* @__PURE__ */ V(Qt, [["__scopeId", "data-v-7cda7a8f"]]), tn = { class: "notify" }, nn = { class: "notify-history" }, Ce = 99, on = 350, sn = /* @__PURE__ */ L({
__name: "index",
setup(n) {
const e = de(), { notityProps: t } = Ye(), { column: a, jumpUrl: o, props: s } = t, l = C(() => a.reduce((m, _) => m + _.badge, 0)), r = W(a[0].name || "通知"), c = () => {
o || De.error(`您还没有配置跳转到${r.value}历史页面`), e.push(o);
};
return (m, _) => {
const i = g("el-icon"), v = g("el-tooltip"), h = g("el-badge"), y = g("el-scrollbar"), E = g("el-tab-pane"), S = g("el-tabs"), R = g("el-button"), P = g("el-popover");
return d(), k("div", tn, [
u(P, {
placement: "bottom",
width: on,
trigger: "click"
}, {
reference: p(() => [
u(h, {
value: l.value,
max: Ce,
hidden: l.value === 0
}, {
default: p(() => [
u(v, {
effect: "dark",
content: "消息通知",
placement: "bottom"
}, {
default: p(() => [
u(i, { size: 20 }, {
default: p(() => [
u(f(ot))
]),
_: 1
})
]),
_: 1
})
]),
_: 1
}, 8, ["value", "hidden"])
]),
default: p(() => [
u(S, {
modelValue: r.value,
"onUpdate:modelValue": _[0] || (_[0] = (M) => r.value = M),
class: "demo-tabs",
stretch: ""
}, {
default: p(() => [
(d(!0), k(j, null, Q(f(a), (M, D) => (d(), w(E, {
name: M.name,
key: D
}, {
label: p(() => [
J(I(M.name) + " ", 1),
u(h, {
value: M.badgeMax,
max: Ce,
type: M.type
}, null, 8, ["value", "type"])
]),
default: p(() => [
u(y, { height: "400px" }, {
default: p(() => [
u(en, {
list: M.list,
prop: f(s)
}, null, 8, ["list", "prop"])
]),
_: 2
}, 1024)
]),
_: 2
}, 1032, ["name"]))), 128))
]),
_: 1
}, 8, ["modelValue"]),
x("div", nn, [
u(R, {
link: "",
onClick: c
}, {
default: p(() => [
J("查看" + I(r.value) + "历史", 1)
]),
_: 1
})
])
]),
_: 1
})
]);
};
}
});
const an = /* @__PURE__ */ V(sn, [["__scopeId", "data-v-a09181de"]]), ln = /* @__PURE__ */ L({
__name: "index",
setup(n) {
const { themeList: e, activeThemeName: t, setTheme: a } = Ze();
return (o, s) => {
const l = g("el-icon"), r = g("el-tooltip"), c = g("el-dropdown-item"), m = g("el-dropdown-menu"), _ = g("el-dropdown");
return d(), w(_, {
trigger: "click",
onCommand: f(a)
}, {
dropdown: p(() => [
u(m, null, {
default: p(() => [
(d(!0), k(j, null, Q(f(e), (i, v) => (d(), w(c, {
key: v,
disabled: f(t) === i.name,
command: i.name
}, {
default: p(() => [
x("span", null, I(i.title), 1)
]),
_: 2
}, 1032, ["disabled", "command"]))), 128))
]),
_: 1
})
]),
default: p(() => [
x("div", null, [
u(r, {
effect: "dark",
content: "主题模式",
placement: "bottom"
}, {
default: p(() => [
u(l, { size: 20 }, {
default: p(() => [
u(f(st))
]),
_: 1
})
]),
_: 1
})
])
]),
_: 1
}, 8, ["onCommand"]);
};
}
}), Ee = [
[
"requestFullscreen",
"exitFullscreen",
"fullscreenElement",
"fullscreenEnabled",
"fullscreenchange",
"fullscreenerror"
],
// New WebKit
[
"webkitRequestFullscreen",
"webkitExitFullscreen",
"webkitFullscreenElement",
"webkitFullscreenEnabled",
"webkitfullscreenchange",
"webkitfullscreenerror"
],
// Old WebKit
[
"webkitRequestFullScreen",
"webkitCancelFullScreen",
"webkitCurrentFullScreenElement",
"webkitCancelFullScreen",
"webkitfullscreenchange",
"webkitfullscreenerror"
],
[
"mozRequestFullScreen",
"mozCancelFullScreen",
"mozFullScreenElement",
"mozFullScreenEnabled",
"mozfullscreenchange",
"mozfullscreenerror"
],
[
"msRequestFullscreen",
"msExitFullscreen",
"msFullscreenElement",
"msFullscreenEnabled",
"MSFullscreenChange",
"MSFullscreenError"
]
], Z = (() => {
if (typeof document > "u")
return !1;
const n = Ee[0], e = {};
for (const t of Ee)
if (t?.[1] in document) {
for (const [o, s] of t.entries())
e[n[o]] = s;
return e;
}
return !1;
})(), Te = {
change: Z.fullscreenchange,
error: Z.fullscreenerror
};
let z = {
// eslint-disable-next-line default-param-last
request(n = document.documentElement, e) {
return new Promise((t, a) => {
const o = () => {
z.off("change", o), t();
};
z.on("change", o);
const s = n[Z.requestFullscreen](e);
s instanceof Promise && s.then(o).catch(a);
});
},
exit() {
return new Promise((n, e) => {
if (!z.isFullscreen) {
n();
return;
}
const t = () => {
z.off("change", t), n();
};
z.on("change", t);
const a = document[Z.exitFullscreen]();
a instanceof Promise && a.then(t).catch(e);
});
},
toggle(n, e) {
return z.isFullscreen ? z.exit() : z.request(n, e);
},
onchange(n) {
z.on("change", n);
},
onerror(n) {
z.on("error", n);
},
on(n, e) {
const t = Te[n];
t && document.addEventListener(t, e, !1);
},
off(n, e) {
const t = Te[n];
t && document.removeEventListener(t, e, !1);
},
raw: Z
};
Object.defineProperties(z, {
isFullscreen: {
get: () => !!document[Z.fullscreenElement]
},
element: {
enumerable: !0,
get: () => document[Z.fullscreenElement] ?? void 0
},
isEnabled: {
enumerable: !0,
// Coerce to boolean in case of old WebKit.
get: () => !!document[Z.fullscreenEnabled]
}
});
Z || (z = { isEnabled: !1 });
const ee = z, rn = /* @__PURE__ */ L({
__name: "index",
props: {
element: { default: "html" },
openTips: { default: "全屏" },
exitTips: { default: "退出全屏" },
content: { type: Boolean, default: !1 }
},
setup(n) {
const e = n, t = W(!1), a = C(() => t.value ? e.exitTips : e.openTips), o = C(() => t.value ? "fullscreen-exit" : "fullscreen"), s = () => {
const i = document.querySelector(e.element) || void 0;
ee.isEnabled ? ee.toggle(i) : De.warning("您的浏览器无法工作");
}, l = () => {
t.value = ee.isFullscreen;
};
le((i) => {
ee.on("change", l), i(() => {
ee.isEnabled && ee.off("change", l);
});
});
const r = W(!1), c = C(() => r.value ? "内容区复原" : "内容区放大"), m = C(() => r.value ? "fullscreen-exit" : "fullscreen"), _ = () => {
document.body.className = r.value ? "" : "content-large", r.value = !r.value;
};
return (i, v) => {
const h = g("SvgIcon"), y = g("el-tooltip"), E = g("el-dropdown-item"), S = g("el-dropdown-menu"), R = g("el-dropdown");
return d(), k("div", null, [
i.content ? (d(), w(R, { key: 1 }, {
dropdown: p(() => [
u(S, null, {
default: p(() => [
u(E, { onClick: _ }, {
default: p(() => [
J(I(c.value), 1)
]),
_: 1
}),
u(E, {
onClick: s,
disabled: t.value
}, {
default: p(() => [
J("内容区全屏")
]),
_: 1
}, 8, ["disabled"])
]),
_: 1
})
]),
default: p(() => [
u(h, { name: m.value }, null, 8, ["name"])
]),
_: 1
})) : (d(), w(y, {
key: 0,
effect: "dark",
content: a.value,
placement: "bottom"
}, {
default: p(() => [
u(h, {
name: o.value,
onClick: s
}, null, 8, ["name"])
]),
_: 1
}, 8, ["content"]))
]);
};
}
});
const cn = /* @__PURE__ */ V(rn, [["__scopeId", "data-v-0baf781b"]]), un = (n) => (Re("data-v-70ce923e"), n = n(), Ie(), n), dn = { class: "navigation-bar" }, _n = { class: "right-menu" }, fn = { class: "right-menu-avatar" }, pn = {
target: "_blank",
href: "https://github.com/un-pany/v3-admin-vite"
}, vn = {
target: "_blank",
href: "https://gitee.com/un-pany/v3-admin-vite"
}, mn = /* @__PURE__ */ un(() => /* @__PURE__ */ x("span", { style: { display: "block" } }, "退出登录", -1)), hn = /* @__PURE__ */ L({
__name: "index",
setup(n) {
const e = de(), t = ne(), a = O(), o = Qe(), { sidebar: s, device: l } = H(t), { layoutMode: r, showNotify: c, showThemeSwitch: m, showScreenfull: _, showSearchMenu: i } = H(a), v = C(() => r.value === "top"), h = C(() => l.value === X.Mobile), y = () => {
t.toggleSidebar(!1);
}, E = () => {
o.logout(), e.push("/login");
};
return (S, R) => {
const P = g("el-avatar"), M = g("el-dropdown-item"), D = g("el-dropdown-menu"), U = g("el-dropdown");
return d(), k("div", dn, [
!v.value || h.value ? (d(), w(kt, {
key: 0,
"is-active": f(s).opened,
class: "hamburger",
onToggleClick: y
}, null, 8, ["is-active"])) : $("", !0),
!v.value || h.value ? (d(), w(Rt, {
key: 1,
class: "breadcrumb"
})) : $("", !0),
v.value && !h.value ? (d(), w(he, {
key: 2,
class: "sidebar"
})) : $("", !0),
x("div", _n, [
f(_) ? (d(), w(cn, {
key: 0,
class: "right-menu-item"
})) : $("", !0),
f(m) ? (d(), w(ln, {
key: 1,
class: "right-menu-item"
})) : $("", !0),
f(c) ? (d(), w(an, {
key: 2,
class: "right-menu-item"
})) : $("", !0),
u(U, { class: "right-menu-item" }, {
dropdown: p(() => [
u(D, null, {
default: p(() => [
x("a", pn, [
u(M, null, {
default: p(() => [
J("GitHub")
]),
_: 1
})
]),
x("a", vn, [
u(M, null, {
default: p(() => [
J("Gitee")
]),
_: 1
})
]),
u(M, {
divided: "",
onClick: E
}, {
default: p(() => [
mn
]),
_: 1
})
]),
_: 1
})
]),
default: p(() => [
x("div", fn, [
u(P, {
icon: f(at),
size: 30
}, null, 8, ["icon"]),
x("span", null, I(f(o).username), 1)
])
]),
_: 1
})
])
]);
};
}
});
const ge = /* @__PURE__ */ V(hn, [["__scopeId", "data-v-70ce923e"]]), gn = { class: "select-layout-mode" }, bn = /* @__PURE__ */ L({
__name: "SelectLayoutMode",
setup(n) {
const e = O(), { layoutMode: t } = H(e), a = C(() => t.value === "left"), o = C(() => t.value === "top"), s = C(() => t.value === "left-top");
return (l, r) => {
const c = g("el-aside"), m = g("el-header"), _ = g("el-main"), i = g("el-container"), v = g("el-tooltip");
return d(), k("div", gn, [
u(v, { content: "左侧模式" }, {
default: p(() => [
u(i, {
class: N(["layout-mode left", { active: a.value }]),
onClick: r[0] || (r[0] = (h) => t.value = "left")
}, {
default: p(() => [
u(c),
u(i, null, {
default: p(() => [
u(m),
u(_)
]),
_: 1
})
]),
_: 1
}, 8, ["class"])
]),
_: 1
}),
u(v, { content: "顶部模式" }, {
default: p(() => [
u(i, {
class: N(["layout-mode top", { active: o.value }]),
onClick: r[1] || (r[1] = (h) => t.value = "top")
}, {
default: p(() => [
u(m),
u(_)
]),
_: 1
}, 8, ["class"])
]),
_: 1
}),
u(v, { content: "混合模式" }, {
default: p(() => [
u(i, {
class: N(["layout-mode left-top", { active: s.value }]),
onClick: r[2] || (r[2] = (h) => t.value = "left-top")
}, {
default: p(() => [
u(m),
u(i, null, {
default: p(() => [
u(c),
u(_)
]),
_: 1
})
]),
_: 1
}, 8, ["class"])
]),
_: 1
})
]);
};
}
});
const yn = /* @__PURE__ */ V(bn, [["__scopeId", "data-v-d031256f"]]), ze = (n) => (Re("data-v-d5c669d1"), n = n(), Ie(), n), wn = { class: "setting-container" }, xn = /* @__PURE__ */ ze(() => /* @__PURE__ */ x("h4", null, "布局配置", -1)), kn = /* @__PURE__ */ ze(() => /* @__PURE__ */ x("h4", null, "功能配置", -1)), Sn = { class: "setting-name" }, Cn = /* @__PURE__ */ L({
__name: "index",
setup(n) {
const e = O(), {
layoutMode: t,
showTagsView: a,
showLogo: o,
fixedHeader: s,
showFooter: l,
showNotify: r,
showThemeSwitch: c,
showScreenfull: m,
showSearchMenu: _,
cacheTagsView: i,
showWatermark: v,
showGreyMode: h,
showColorWeakness: y
} = H(e), E = {
显示标签栏: a,
"显示 Logo": o,
"固定 Header": s,
"显示页脚 Footer": l,
显示消息通知: r,
显示切换主题按钮: c,
显示全屏按钮: m,
显示搜索按钮: _,
是否缓存标签栏: i,
开启系统水印: v,
显示灰色模式: h,
显示色弱模式: y
};
return le(() => {
t.value !== "left" && (s.value = !0);
}), (S, R) => {
const P = g("el-divider"), M = g("el-switch"), D = g("el-button");
return d(), k("div", wn, [
xn,
u(yn),
u(P),
kn,
(d(), k(j, null, Q(E, (U, F, q) => x("div", {
class: "setting-item",
key: q
}, [
x("span", Sn, I(F), 1),
u(M, {
modelValue: U.value,
"onUpdate:modelValue": (K) => U.value = K,
disabled: f(t) !== "left" && F === "固定 Header"
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"])
])), 64)),
u(D, {
type: "danger",
icon: f(lt),
onClick: f(Ut)
}, {
default: p(() => [
J("重 置")
]),
_: 1
}, 8, ["icon", "onClick"])
]);
};
}
});
const En = /* @__PURE__ */ V(Cn, [["__scopeId", "data-v-d5c669d1"]]), Tn = { class: "scroll-container" }, Mn = 200, $n = /* @__PURE__ */ L({
__name: "ScrollPane",
props: {
tagRefs: {}
},
setup(n) {
const e = n, t = ue();
O();
const { listenerRouteChange: a } = ie(), o = W(), s = W();
let l = 0;
const r = ({ scrollLeft: v }) => {
l = v;
}, c = ({ deltaY: v }) => {
/^-/.test(v.toString()) ? _("left") : _("right");
}, m = () => {
const v = s.value.clientWidth, h = o.value.wrapRef.clientWidth, y = v - h - l;
return { scrollbarContentRefWidth: v, scrollbarRefWidth: h, lastDistance: y };
}, _ = (v, h = Mn) => {
let y = 0;
const { scrollbarContentRefWidth: E, scrollbarRefWidth: S, lastDistance: R } = m();
S > E || (v === "left" ? y = Math.max(0, l - h) : y = Math.min(l + h, l + R), o.value.setScrollLeft(y));
}, i = () => {
const v = e.tagRefs;
for (let h = 0; h < v.length; h++)
if (t.path === v[h].$props.to.path) {
const y = v[h].$el, E = y.offsetWidth, S = y.offsetLeft, { scrollbarRefWidth: R } = m();
if (S < l) {
const M = l - S;
_("left", M);
return;
}
const P = R + l - E;
if (S > P) {
const M = S - P;
_("right", M);
return;
}
}
};
return a(() => {
Ge(i);
}), (v, h) => {
const y = g("el-icon");
return d(), k("div", Tn, [
u(y, {
class: "arrow left",
onClick: h[0] || (h[0] = (E) => _("left"))
}, {
default: p(() => [
u(f(rt))
]),
_: 1
}),
u(f(dt), {
ref_key: "scrollbarRef",
ref: o,
onWheelPassive: c,
onScroll: r
}, {
default: p(() => [
x("div", {
ref_key: "scrollbarContentRef",
ref: s,
class: "scrollbar-content"
}, [
ae(v.$slots, "default", {}, void 0, !0)
], 512)
]),
_: 3
}, 512),
u(y, {
class: "arrow right",
onClick: h[1] || (h[1] = (E) => _("right"))
}, {
default: p(() => [
u(f(ct))
]),
_: 1
})
]);
};
}
});
const An = /* @__PURE__ */ V($n, [["__scopeId", "data-v-b5475e98"]]), Ln = { class: "tags-view-container" }, Vn = /* @__PURE__ */ L({
__name: "index",
setup(n) {
const e = Xe(), t = de(), a = ue(), o = Fe(), s = Pe(), { listenerRouteChange: l } = ie(), r = W([]), c = W(!1), m = W(0), _ = W(0), i = W({});
let v = [];
const h = (b) => b.path === a.path, y = (b) => b.meta?.affix, E = (b, A = "/") => {
const Y = [];
return b.forEach((T) => {
if (y(T)) {
const B = Be.resolve(A, T.path);
Y.push({
fullPath: B,
path: B,
name: T.name,
meta: { ...T.meta }
});
}
if (T.children) {
const B = E(T.children, T.path);
Y.push(...B);
}
}), Y;
}, S = () => {
v = E(s.routes);
for (const b of v)
b.name && o.addVisitedView(b);
}, R = (b) => {
b.name && (o.addVisitedView(b), o.addCachedView(b));
}, P = (b) => {
o.delCachedView(b), t.replace({ path: "/redirect" + b.path, query: b.query });
}, M = (b) => {
o.delVisitedView(b), o.delCachedView(b), h(b) && F(o.visitedViews, b);
}, D = () => {
const b = i.value.fullPath;
b !== a.path && b !== void 0 && t.push(b), o.delOthersVisitedViews(i.value), o.delOthersCachedViews(i.value);
}, U = (b) => {
o.delAllVisitedViews(), o.delAllCachedViews(), !v.some((A) => A.path === a.path) && F(o.visitedViews, b);
}, F = (b, A) => {
const T = b.slice(-1)[0]?.fullPath;
T !== void 0 ? t.push(T) : A.name === "Dashboard" ? t.push({ path: "/redirect" + A.path, query: A.query }) : t.push("/");
}, q = (b, A) => {
const T = e.proxy.$el.getBoundingClientRect().left, ye = e.proxy.$el.offsetWidth - 105, we = A.clientX - T + 15;
_.value = we > ye ? ye : we, m.value = A.clientY, c.value = !0, i.value = b;
}, K = () => {
c.value = !1;
};
return Me(c, (b) => {
b ? document.body.addEventListener("click", K) : document.body.removeEventListener("click", K);
}), $e(() => {
S(), l((b) => {
R(b);
}, !0);
}), (b, A) => {
const Y = g("el-icon");
return d(), k("div", Ln, [
u(An, {
class: "tags-view-wrapper",
"tag-refs": r.value
}, {
default: p(() => [
(d(!0), k(j, null, Q(f(o).visitedViews, (T) => (d(), w(f(et), {
ref_for: !0,
ref_key: "tagRefs",
ref: r,
key: T.path,
class: N([{ active: h(T) }, "tags-view-item"]),
to: { path: T.path, query: T.query },
onMouseup: oe((B) => !y(T) && M(T), ["middle"]),
onContextmenu: oe((B) => q(T, B), ["prevent"])
}, {
default: p(() => [
J(I(T.meta?.title) + " ", 1),
y(T) ? $("", !0) : (d(), w(Y, {
key: 0,
size: 12,
onClick: oe((B) => M(T), ["prevent", "stop"])
}, {
default: p(() => [
u(f(it))
]),