| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- import { ref as R, computed as i, reactive as T, watch as K, onMounted as U, resolveComponent as _, openBlock as u, createElementBlock as B, createElementVNode as w, createVNode as v, withCtx as D, createBlock as g } from "vue";
- import { useRouter as L } from "vue-router";
- import { n as V, ad as $, cQ as A, cM as I } from "./index2.js";
- const N = { class: "s-menu-slide-common" }, j = { class: "menu-wrap" }, H = {
- __name: "SSideMenu",
- emits: ["collapsed"],
- setup(Q, { emit: k }) {
- const a = L(), b = k, p = $(), m = R(""), M = i(() => {
- const e = window.$menuTheme;
- return !e || !e.token ? {} : { components: { Menu: e.token } };
- }), n = T({
- collapsed: !1,
- selectedKeys: [],
- openKeys: [],
- preOpenKeys: []
- });
- K(
- () => n.openKeys,
- (e, t) => {
- n.preOpenKeys = t;
- }
- );
- const O = (e, t) => t ? t.startsWith("/") ? t : e ? `${e.replace(/\/+$/, "")}/${t}` : `/${t}` : e || "", y = (e, t, l = 0, o = "") => e.map((s) => {
- var h;
- const c = window.$l(((h = s.meta) == null ? void 0 : h.title) || s.name || ""), r = l === 0 && !s.children, d = O(o, s.path), f = {
- key: d,
- // icon: item.icon ? () => h(item.icon) : null,
- icon: null,
- label: t && r ? c.slice(0, 1) : c,
- // title: name,
- path: d
- };
- return s.children && (f.children = y(s.children, t, l + 1, d)), f;
- }), C = i(() => {
- var l;
- const e = ((l = p.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);
- });
- }), E = i(() => y(C.value, n.collapsed)), S = () => {
- n.collapsed = !n.collapsed, n.openKeys = n.collapsed ? [] : n.preOpenKeys, b("collapsed", n.collapsed);
- }, x = (e) => {
- a.push(e.key), n.selectedKeys = [e.key], window.$utils.ls.set("selectedKeys", n.selectedKeys);
- }, P = (e) => {
- n.openKeys = e, $().setMenuOpenKeys(n.openKeys);
- };
- return U(() => {
- var o;
- m.value = window.$utils.env.VITE_APP_MENU_THEME || "light";
- const e = (window.$utils.env.VITE_APP_BASE_URL || "/").replace(/\/+$/, "");
- let t = ((o = a.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 = p.openKeys || [];
- n.openKeys = l;
- }), K(
- () => {
- var e;
- return (e = a.currentRoute.value) == null ? void 0 : e.path;
- },
- (e) => {
- e && (n.selectedKeys = [e], window.$utils.ls.set("selectedKeys", n.selectedKeys));
- }
- ), (e, t) => {
- const l = I, o = A, s = _("DoubleRightOutlined"), c = _("DoubleLeftOutlined");
- return u(), B("div", N, [
- w("div", j, [
- v(o, { theme: M.value }, {
- default: D(() => [
- v(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: E.value,
- theme: m.value,
- onSelect: x,
- onOpenChange: P
- }, null, 8, ["openKeys", "selectedKeys", "items", "theme"])
- ]),
- _: 1
- }, 8, ["theme"])
- ]),
- w("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: S
- }, [
- n.collapsed ? (u(), g(s, { key: 0 })) : (u(), g(c, { key: 1 }))
- ])
- ]);
- };
- }
- }, F = /* @__PURE__ */ V(H, [["__scopeId", "data-v-2ec64017"]]);
- export {
- F as default
- };
|