| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- import { ref as R, computed as u, reactive as T, watch as h, onMounted as L, resolveComponent as _, openBlock as p, createElementBlock as U, createElementVNode as v, createVNode as w, withCtx as A, normalizeStyle as B, createBlock as k } from "vue";
- import { useRouter as D } from "vue-router";
- import { n as V, ad as g, cP as I, cL as N } from "./index2.js";
- const j = { class: "s-menu-slide-common" }, z = { class: "menu-wrap" }, H = {
- __name: "SSideMenu",
- emits: ["collapsed"],
- setup(W, { emit: $ }) {
- const d = D(), M = $, m = g(), r = R(""), b = u(() => {
- const e = window.$menuTheme;
- return r.value !== "dark" || !e || !e.token ? {} : { components: { Menu: e.token } };
- }), n = T({
- collapsed: !1,
- selectedKeys: [],
- openKeys: [],
- preOpenKeys: []
- });
- h(
- () => 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 K;
- const c = window.$l(((K = s.meta) == null ? void 0 : K.title) || s.name || ""), a = l === 0 && !s.children, i = O(o, s.path), f = {
- key: i,
- // icon: item.icon ? () => h(item.icon) : null,
- icon: null,
- label: t && a ? c.slice(0, 1) : c,
- title: c,
- path: i
- };
- return s.children && (f.children = y(s.children, t, l + 1, i)), f;
- }), C = u(() => {
- var l;
- const e = ((l = m.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);
- });
- }), S = u(() => y(C.value, n.collapsed)), E = () => {
- n.collapsed = !n.collapsed, n.openKeys = n.collapsed ? [] : n.preOpenKeys, M("collapsed", n.collapsed);
- }, P = (e) => {
- d.push(e.key), n.selectedKeys = [e.key], window.$utils.ls.set("selectedKeys", n.selectedKeys);
- }, x = (e) => {
- n.openKeys = e, g().setMenuOpenKeys(n.openKeys);
- };
- return L(() => {
- var o;
- r.value = window.$utils.env.VITE_APP_MENU_THEME || "dark";
- const e = (window.$utils.env.VITE_APP_BASE_URL || "/").replace(/\/+$/, "");
- let t = ((o = d.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 = m.openKeys || [];
- n.openKeys = l;
- }), h(
- () => {
- var e;
- return (e = d.currentRoute.value) == null ? void 0 : e.path;
- },
- (e) => {
- e && (n.selectedKeys = [e], window.$utils.ls.set("selectedKeys", n.selectedKeys));
- }
- ), (e, t) => {
- const l = N, o = I, s = _("DoubleRightOutlined"), c = _("DoubleLeftOutlined");
- return p(), U("div", j, [
- v("div", z, [
- w(o, { theme: b.value }, {
- default: A(() => [
- w(l, {
- openKeys: n.openKeys,
- "onUpdate:openKeys": t[0] || (t[0] = (a) => n.openKeys = a),
- selectedKeys: n.selectedKeys,
- "onUpdate:selectedKeys": t[1] || (t[1] = (a) => n.selectedKeys = a),
- mode: "inline",
- items: S.value,
- theme: r.value,
- onSelect: P,
- onOpenChange: x
- }, null, 8, ["openKeys", "selectedKeys", "items", "theme"])
- ]),
- _: 1
- }, 8, ["theme"])
- ]),
- v("div", {
- class: "right-border-btn",
- style: B({
- backgroundColor: r.value === "dark" ? "var(--s-menu-bg, #e8ecf3)" : "#fff",
- color: r.value === "dark" ? "var(--s-menu-text, #344051)" : "#000000A6",
- border: `1px solid ${r.value === "dark" ? "var(--s-menu-bg, #e8ecf3)" : "#ececec"}`
- }),
- onClick: E
- }, [
- n.collapsed ? (p(), k(s, { key: 0 })) : (p(), k(c, { key: 1 }))
- ], 4)
- ]);
- };
- }
- }, J = /* @__PURE__ */ V(H, [["__scopeId", "data-v-778de210"]]);
- export {
- J as default
- };
|