| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- import { ref as I, computed as d, reactive as A, watch as w, onMounted as D, resolveComponent as u, openBlock as p, createElementBlock as L, createElementVNode as v, createVNode as g, withCtx as N, createBlock as $, h as V } from "vue";
- import { useRouter as F } from "vue-router";
- import { n as j, ad as O, cQ as H, ct as Q, cR as m } from "./index2.js";
- const W = { class: "s-menu-slide-common" }, X = { class: "menu-wrap" }, q = {
- __name: "SSideMenu",
- emits: ["collapsed"],
- setup(z, { emit: k }) {
- const i = F(), b = k, y = O(), f = I(""), C = d(() => {
- const e = window.$menuTheme;
- return !e || !e.token ? {} : { components: { Menu: e.token } };
- }), n = A({
- collapsed: !1,
- selectedKeys: [],
- openKeys: [],
- preOpenKeys: []
- });
- w(
- () => n.openKeys,
- (e, t) => {
- n.preOpenKeys = t;
- }
- );
- const M = (e, t) => t ? t.startsWith("/") ? t : e ? `${e.replace(/\/+$/, "")}/${t}` : `/${t}` : e || "", S = /(Outlined|Filled|TwoTone)$/, T = (e) => {
- if (!e) return m;
- const t = String(e).split(/[-_\s]+/).filter(Boolean).map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("");
- if (!t) return m;
- const l = S.test(t) ? t : t + "Outlined", o = u(l);
- return typeof o == "string" ? m : o;
- }, h = (e, t, l = 0, o = "") => e.map((s) => {
- var K;
- const c = window.$l(((K = s.meta) == null ? void 0 : K.title) || s.name || ""), r = l === 0 && !s.children, a = M(o, s.path), B = s.meta.icon ? () => V(T(s.meta.icon)) : null, _ = {
- key: a,
- icon: B,
- // icon: null,
- label: t && r ? c.slice(0, 1) : c,
- // title: name,
- path: a
- };
- return s.children && (_.children = h(s.children, t, l + 1, a)), _;
- }), E = d(() => {
- var l;
- const e = ((l = y.dynamics[0]) == null ? void 0 : l.children) || [], t = (window.$staticRoutes || []).filter(
- (o) => {
- var s, c;
- return o && o.path && ((s = o.meta) == null ? void 0 : s.title) && !((c = o.meta) != null && c.hidden);
- }
- );
- return [...e, ...t].filter((o) => {
- var s;
- return !((s = o.meta) != null && s.hidden);
- });
- }), R = d(() => h(E.value, n.collapsed)), x = () => {
- n.collapsed = !n.collapsed, n.openKeys = n.collapsed ? [] : n.preOpenKeys, b("collapsed", n.collapsed);
- }, P = (e) => {
- i.push(e.key), n.selectedKeys = [e.key], window.$utils.ls.set("selectedKeys", n.selectedKeys);
- }, U = (e) => {
- n.openKeys = e, O().setMenuOpenKeys(n.openKeys);
- };
- return D(() => {
- var o;
- f.value = window.$utils.env.VITE_APP_MENU_THEME || "light";
- const e = (window.$utils.env.VITE_APP_BASE_URL || "/").replace(/\/+$/, "");
- let t = ((o = i.currentRoute.value) == null ? void 0 : o.path) || "";
- t || (t = location.pathname, e && t.indexOf(e) === 0 && (t = t.slice(e.length) || "/")), window.$utils.ls.set("selectedKeys", [t]), n.selectedKeys = window.$utils.ls.get("selectedKeys") || [];
- const l = y.openKeys || [];
- n.openKeys = l;
- }), w(
- () => {
- var e;
- return (e = i.currentRoute.value) == null ? void 0 : e.path;
- },
- (e) => {
- e && (n.selectedKeys = [e], window.$utils.ls.set("selectedKeys", n.selectedKeys));
- }
- ), (e, t) => {
- const l = Q, o = H, s = u("DoubleRightOutlined"), c = u("DoubleLeftOutlined");
- return p(), L("div", W, [
- v("div", X, [
- g(o, { theme: C.value }, {
- default: N(() => [
- g(l, {
- openKeys: n.openKeys,
- "onUpdate:openKeys": t[0] || (t[0] = (r) => n.openKeys = r),
- selectedKeys: n.selectedKeys,
- "onUpdate:selectedKeys": t[1] || (t[1] = (r) => n.selectedKeys = r),
- mode: "inline",
- items: R.value,
- theme: f.value,
- onSelect: P,
- onOpenChange: U
- }, null, 8, ["openKeys", "selectedKeys", "items", "theme"])
- ]),
- _: 1
- }, 8, ["theme"])
- ]),
- v("div", {
- class: "right-border-btn",
- style: {
- backgroundColor: "var(--s-menu-bg, #ebf7fe)",
- color: "var(--s-menu-text, #344051)",
- border: "1px solid var(--s-menu-bg, #ebf7fe)"
- },
- onClick: x
- }, [
- n.collapsed ? (p(), $(s, { key: 0 })) : (p(), $(c, { key: 1 }))
- ])
- ]);
- };
- }
- }, Z = /* @__PURE__ */ j(q, [["__scopeId", "data-v-e3383016"]]);
- export {
- Z as default
- };
|