import { ref as d, onMounted as T, onActivated as L, resolveDirective as P, openBlock as l, createElementBlock as i, normalizeStyle as c, createElementVNode as r, toDisplayString as S, Fragment as V, renderList as A, withDirectives as b, createBlock as _, withCtx as w, createTextVNode as N, resolveDynamicComponent as z, createCommentVNode as f, vShow as E, renderSlot as m, nextTick as M } from "vue"; import { n as W, B as X } from "./index2.js"; const F = { class: "title" }, I = { class: "btns" }, j = { key: 0, style: { "margin-left": "8px" } }, q = /* @__PURE__ */ Object.assign({ name: "SSkeletonLayout" }, { __name: "SSkeletonLayout", props: { // 页面标题 title: { type: String, required: !0 }, // 工具条按钮:[{ key, name, icon, type, show, disabled, action }] buttons: { type: Array, default: () => [] }, bgColor: { type: String, default: "" } }, emits: ["btnCallback"], setup(p, { emit: $ }) { const h = d(null), v = d(null), k = d(null), y = d(232), a = d(0); function g() { M(() => { var o, t, n, C; const e = ((t = (o = h.value) == null ? void 0 : o.parentNode) == null ? void 0 : t.offsetHeight) || 0, s = ((n = v.value) == null ? void 0 : n.offsetHeight) || 0, u = ((C = k.value) == null ? void 0 : C.offsetHeight) || 0; a.value = Math.max(e - s - u, 0); }); } T(() => g()), L(() => g()); const D = $, H = { add: "PlusCircleOutlined", edit: "FormOutlined", delete: "DeleteOutlined", remove: "DeleteOutlined", import: "UploadOutlined", export: "DownloadOutlined", assign: "ClusterOutlined", execute: "PlayCircleOutlined", pause: "PauseCircleOutlined", resume: "PoweroffOutlined", approve: "HighlightOutlined", setting: "SettingOutlined", TopOfType: "VerticalAlignTopOutlined", TOP: "VerticalAlignTopOutlined", synchronize: "SyncOutlined" }; function x(e) { D("btnCallback", e.key); } function O(e) { return typeof e.icon == "string" ? e.icon : typeof e.icon == "boolean" && e.icon && H[e.key] || ""; } const B = { mounted(e) { e.style.cursor = "e-resize", document.addEventListener("selectstart", (s) => { s.preventDefault(); }), e.onmousedown = (s) => { const u = s.clientX, o = y.value; document.onmousemove = (t) => { const n = t.clientX - u; if (n < 0) { if (o + n <= 232) return; y.value = o + n; } else { if (o + n >= 500) return; y.value = o + n; } }, document.onmouseup = () => { document.onmousemove = document.onmousedown = null; }; }; } }; return (e, s) => { const u = X, o = P("action"); return l(), i("div", { class: "s-skeleton-layout", ref_key: "layout", ref: h, style: c({ backgroundColor: p.bgColor }) }, [ r("div", { class: "tools", ref_key: "tools", ref: v }, [ r("div", F, S(p.title), 1), r("div", I, [ (l(!0), i(V, null, A(p.buttons, (t) => (l(), i("span", { class: "item-btn", key: t.key }, [ b((l(), _(u, { class: "btn", disabled: !!t.disabled, type: t.type || t.key === "add" ? "primary" : "default", onClick: (n) => x(t) }, { icon: w(() => [ O(t) ? (l(), _(z(O(t)), { key: 0 })) : f("", !0) ]), default: w(() => [ N(" " + S(e.$l(t.name)), 1) ]), _: 2 }, 1032, ["disabled", "type", "onClick"])), [ [o, t.action || t.key], [E, t.show !== !1] ]) ]))), 128)), e.$slots.otherBtns ? (l(), i("span", j, [ m(e.$slots, "otherBtns", {}, void 0, !0) ])) : f("", !0) ]) ], 512), r("div", { class: "skeleton-layout-main", style: c({ height: a.value + "px" }) }, [ e.$slots.tree ? (l(), i("div", { key: 0, class: "side s-side-tree", ref: "side", style: c([{ height: a.value + "px", width: y.value + "px" }, { "overflow-y": "auto" }]) }, [ m(e.$slots, "tree", {}, void 0, !0) ], 4)) : f("", !0), e.$slots.tree ? b((l(), i("div", { key: 1, class: "side-bar s-theme-bg", style: c({ height: a.value + "px" }) }, null, 4)), [ [B] ]) : f("", !0), r("div", { class: "skeleton-content", style: c({ height: a.value + "px" }) }, [ m(e.$slots, "default", {}, void 0, !0) ], 4) ], 4), r("div", { class: "other", ref_key: "other", ref: k }, [ m(e.$slots, "other", {}, void 0, !0) ], 512) ], 4); }; } }), J = /* @__PURE__ */ W(q, [["__scopeId", "data-v-b1e7dba2"]]); export { J as default };