import { ref as u, computed as Y, watch as Z, onMounted as ee, onActivated as te, resolveComponent as V, resolveDirective as ne, openBlock as n, createElementBlock as a, normalizeStyle as v, createElementVNode as d, toDisplayString as C, Fragment as K, renderList as L, withDirectives as j, createBlock as m, withCtx as f, createTextVNode as A, resolveDynamicComponent as le, createCommentVNode as r, vShow as se, renderSlot as D, createVNode as h, nextTick as oe } from "vue"; import { n as ae, B as ie } from "./index2.js"; import { _ as ue, S as re } from "./index10.js"; import { T as ce, _ as de } from "./index11.js"; const fe = { class: "title" }, ye = { class: "btns" }, pe = { key: 0, style: { "margin-left": "8px" } }, ve = { key: 1, class: "steps-btns" }, me = /* @__PURE__ */ Object.assign({ name: "SSkeletonLayout" }, { __name: "SSkeletonLayout", props: { // 页面标题 title: { type: String, required: !0 }, // 工具条按钮:[{ key, name, icon, type, show, disabled, action }] buttons: { type: Array, default: () => [] }, tabs: { type: Array, default: () => [] }, tabKey: { type: Object, default: () => ({ label: "label", value: "value" }) }, steps: { type: Array, default: () => [] } }, emits: ["tabsChange", "btnCallback", "stepChange", "stepConfirm"], setup(s, { emit: F }) { const _ = F, g = s, x = u(null), N = u(null), P = u(null), O = u(232), y = u(0), b = u(""), z = u(null), R = u(null), p = u(0), E = u(0), B = Y(() => g.tabKey && g.tabKey.value || "value"); Z(() => g.tabs, I, { immediate: !0, deep: !0 }); const I = () => { const e = g.tabs || []; if (!e.length) { b.value = ""; return; } const l = B.value; e.some((o) => o && o[l] === b.value) || (b.value = e[0][l]); }; function q(e) { b.value = e; const l = g.tabs.find((o) => o[B.value] === e); _("tabsChange", l); } function M(e) { p.value += e === "prev" ? -1 : 1, _("stepChange", e, p.value); } function U() { _("stepConfirm", p.value); } function W() { oe(() => { var i, S, w, $, H, T; const e = ((S = (i = x.value) == null ? void 0 : i.parentNode) == null ? void 0 : S.offsetHeight) || 0, l = ((w = N.value) == null ? void 0 : w.offsetHeight) || 0, o = (($ = P.value) == null ? void 0 : $.offsetHeight) || 0; y.value = Math.max(e - l - o, 0); const c = ((H = z.value) == null ? void 0 : H.offsetHeight) || 0, k = ((T = R.value) == null ? void 0 : T.offsetHeight) || 0; E.value = y.value - c - k; }); } ee(() => W()), te(() => W()); const G = { 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 J(e) { _("btnCallback", e.key); } function X(e) { return typeof e.icon == "string" ? e.icon : typeof e.icon == "boolean" && e.icon && G[e.key] || ""; } const Q = { mounted(e) { e.style.cursor = "e-resize", document.addEventListener("selectstart", (l) => { l.preventDefault(); }), e.onmousedown = (l) => { const o = l.clientX, c = O.value; document.onmousemove = (k) => { const i = k.clientX - o; if (i < 0) { if (c + i <= 232) return; O.value = c + i; } else { if (c + i >= 500) return; O.value = c + i; } }, document.onmouseup = () => { document.onmousemove = document.onmousedown = null; }; }; } }; return (e, l) => { const o = ie, c = V("arrow-left-outlined"), k = V("arrow-right-outlined"), i = V("save-outlined"), S = re, w = ue, $ = de, H = ce, T = ne("action"); return n(), a("div", { class: "s-skeleton-layout", ref_key: "layout", ref: x, style: v({ backgroundColor: e.bgColor }) }, [ d("div", { class: "tools", ref_key: "tools", ref: N }, [ d("div", fe, C(s.title), 1), d("div", ye, [ (n(!0), a(K, null, L(s.buttons, (t) => (n(), a("span", { class: "item-btn", key: t.key }, [ j((n(), m(o, { class: "btn", disabled: !!t.disabled, type: t.type || t.key === "add" ? "primary" : "default", onClick: (he) => J(t) }, { icon: f(() => [ X(t) ? (n(), m(le(X(t)), { key: 0 })) : r("", !0) ]), default: f(() => [ A(" " + C(e.$l(t.name)), 1) ]), _: 2 }, 1032, ["disabled", "type", "onClick"])), [ [T, t.action || t.key], [se, t.show !== !1] ]) ]))), 128)), e.$slots.otherBtns ? (n(), a("span", pe, [ D(e.$slots, "otherBtns", {}, void 0, !0) ])) : r("", !0), s.steps.length > 0 ? (n(), a("span", ve, [ s.steps.length ? (n(), m(o, { key: 0, class: "btn", disabled: p.value === e.stepDefaultActive, onClick: l[0] || (l[0] = (t) => M("prev")) }, { default: f(() => [ h(c), A(C(e.$l("上一步")), 1) ]), _: 1 }, 8, ["disabled"])) : r("", !0), s.steps.length ? (n(), m(o, { key: 1, class: "btn", type: "primary", disabled: p.value === s.steps.length - 1, onClick: l[1] || (l[1] = (t) => M("next")) }, { default: f(() => [ h(k), A(C(e.$l("下一步")), 1) ]), _: 1 }, 8, ["disabled"])) : r("", !0), h(o, { style: { "margin-right": "8px" }, type: "primary", onClick: U }, { default: f(() => [ h(i), A(" " + C(e.$l("确认")), 1) ]), _: 1 }) ])) : r("", !0) ]) ], 512), d("div", { class: "skeleton-layout-main", style: v({ height: y.value + "px" }) }, [ e.$slots.tree ? (n(), a("div", { key: 0, class: "side s-side-tree", ref: "side", style: v([{ height: y.value + "px", width: O.value + "px" }, { "overflow-y": "auto" }]) }, [ D(e.$slots, "tree", {}, void 0, !0) ], 4)) : r("", !0), e.$slots.tree ? j((n(), a("div", { key: 1, class: "side-bar s-theme-bg", style: v({ height: y.value + "px" }) }, null, 4)), [ [Q] ]) : r("", !0), d("div", { class: "skeleton-content", style: v({ height: y.value + "px" }) }, [ s.steps && s.steps.length ? (n(), a("div", { key: 0, class: "step-wrap", ref_key: "stepRef", ref: R }, [ h(w, { current: p.value, type: "navigation", size: "small" }, { default: f(() => [ (n(!0), a(K, null, L(s.steps, (t) => (n(), m(S, { title: t, key: t, disabled: !0 }, null, 8, ["title"]))), 128)) ]), _: 1 }, 8, ["current"]) ], 512)) : r("", !0), s.tabs && s.tabs.length ? (n(), a("div", { key: 1, class: "tabs-wrap", ref_key: "tabsRef", ref: z }, [ h(H, { "active-key": b.value, onChange: q }, { default: f(() => [ (n(!0), a(K, null, L(s.tabs, (t) => (n(), m($, { tab: t[s.tabKey.label], key: t[B.value] }, null, 8, ["tab"]))), 128)) ]), _: 1 }, 8, ["active-key"]) ], 512)) : r("", !0), d("div", { class: "skeleton-container", style: v({ height: E.value + "px" }) }, [ D(e.$slots, "default", {}, void 0, !0) ], 4) ], 4) ], 4), d("div", { class: "other", ref_key: "other", ref: P }, [ D(e.$slots, "other", {}, void 0, !0) ], 512) ], 4); }; } }), _e = /* @__PURE__ */ ae(me, [["__scopeId", "data-v-b3f920e1"]]); export { _e as default };