import { useSlots as ie, ref as a, computed as z, watch as I, nextTick as ue, onMounted as ce, onUnmounted as re, resolveComponent as h, openBlock as l, createElementBlock as r, createVNode as d, withCtx as f, createElementVNode as i, toDisplayString as p, createBlock as m, createTextVNode as g, createCommentVNode as u, renderSlot as w, Fragment as j, renderList as M, normalizeStyle as _, normalizeClass as de } from "vue"; import { n as fe, aA as me, y as ye, B as ve } from "./index2.js"; import { _ as he, S as pe } from "./index11.js"; import { T as be, _ as ke } from "./index12.js"; const ge = { class: "title" }, we = { style: { "margin-right": "10px" } }, _e = { class: "btns" }, Se = { class: "form-layout-main-content" }, $e = { key: 1, class: "collapses-content-wrap" }, Be = { class: "collapese-container" }, Ce = { class: "modal" }, Te = { class: "form-fixed-footer" }, Ae = /* @__PURE__ */ Object.assign({ name: "SFormLayout" }, { __name: "SFormLayout", props: { viewHeight: { type: Number, default: 0 }, showAnchor: { type: Boolean, default: !0 }, loading: { type: Boolean, default: !1 }, // 页面标题 title: { type: String, required: !0 }, subTitle: { type: String, default: "" }, showBtnIcon: { type: Boolean, default: !0 }, steps: { type: Array, default: () => [] }, stepDefaultActive: { type: Number, default: 0 }, stepValid: { type: Function, default: void 0 }, tabs: { type: Array, default: () => [] }, tabKey: { type: Object, default: () => ({ label: "label", value: "value" }) }, formStyle: { type: Object, default: () => ({}) }, goBack: { type: Boolean, default: !0 }, isShowSave: { type: Boolean, default: !0 }, saveBtnText: { type: String, default: window.$l("保存") }, width: { type: String, default: "1000px" } }, emits: ["footer-callback", "tabsChange"], setup(t, { expose: q, emit: H }) { const n = t, y = H, P = ie(), T = a(null), V = a(null), U = a(null), G = a(null), J = a(null), F = a(null), N = a(null), W = a({}), S = a("100%"), D = a(0), o = a(0), A = z(() => n.tabKey && n.tabKey.value || "value"), b = a(""); I(() => n.tabs, () => { const e = n.tabs || []; if (!e.length) { b.value = ""; return; } const s = A.value; e.some((c) => c && c[s] === b.value) || (b.value = e[0][s]); }, { immediate: !0, deep: !0 }); const Q = z(() => n.showAnchor && n.width); I(Q, () => R(), { immediate: !0, deep: !0 }); function K() { R(); } function L() { y("footer-callback", "cancel"); } function O() { o.value--, y("footer-callback", "prev", o.value); } function x() { if (!window.$utils.isFunction(n.stepValid)) { o.value++, y("footer-callback", "next", o.value); return; } n.stepValid(o.value).then((e) => { e && (o.value++, y("footer-callback", "next", o.value)); }); } function E() { y("footer-callback", "save"); } function X(e) { b.value = e; const s = n.tabs.find((c) => c[A.value] === e); y("tabsChange", s); } function R() { ue(() => { var $, B; const e = {}, s = (($ = V.value) == null ? void 0 : $.offsetWidth) || 0, c = ((B = N.value) == null ? void 0 : B.offsetWidth) || 0; c + 200 > s ? e.right = "0px" : e.left = n.width, W.value = e, n.showAnchor && P.collapses ? S.value = c + 200 > s ? `${s - 200}px` : n.width : S.value = c > s ? `${s}px` : n.width, D.value = F.value.offsetWidth - 10 + "px"; }); } let v = null; return ce(() => { K(), o.value = n.stepDefaultActive, window.ResizeObserver && T.value && (v = new ResizeObserver(() => { K(), R(); }), v.observe(T.value)); }), re(() => { v == null || v.disconnect(), v = null; }), q({ save: E, rollback: L, handNext: x, handPrev: O, stepActive: o, formWidth: S }), (e, s) => { const c = h("InfoCircleOutlined"), $ = ye, B = pe, Y = he, Z = ke, ee = be, te = h("s-anchor"), le = h("close-outlined"), C = ve, ne = h("arrow-left-outlined"), oe = h("arrow-right-outlined"), ae = h("save-outlined"), se = me; return l(), r("div", { class: "form-layout", ref_key: "layout", ref: T }, [ d(se, { spinning: t.loading }, { default: f(() => [ t.title || t.subTitle || e.$slots.otherBtns ? (l(), r("div", { key: 0, class: "tools", ref_key: "toolsRef", ref: U }, [ i("div", ge, [ i("span", we, p(t.title), 1), t.subTitle ? (l(), m($, { key: 0, placement: "topLeft", mouseEnterDelay: 0.5, mouseLeaveDelay: 0.5 }, { title: f(() => [ g(p(t.subTitle), 1) ]), default: f(() => [ d(c) ]), _: 1 })) : u("", !0) ]), i("div", _e, [ w(e.$slots, "otherBtns", {}, void 0, !0) ]) ], 512)) : u("", !0), t.steps && t.steps.length ? (l(), r("div", { key: 1, class: "step-wrap", ref_key: "stepRef", ref: G }, [ d(Y, { current: o.value, type: "navigation", size: "small" }, { default: f(() => [ (l(!0), r(j, null, M(t.steps, (k) => (l(), m(B, { title: k, key: k, disabled: !0 }, null, 8, ["title"]))), 128)) ]), _: 1 }, 8, ["current"]) ], 512)) : u("", !0), t.tabs && t.tabs.length ? (l(), r("div", { key: 2, class: "tabs-wrap", ref_key: "tabsRef", ref: J }, [ d(ee, { "active-key": b.value, onChange: X }, { default: f(() => [ (l(!0), r(j, null, M(t.tabs, (k) => (l(), m(Z, { tab: k[t.tabKey.label], key: k[A.value] }, null, 8, ["tab"]))), 128)) ]), _: 1 }, 8, ["active-key"]) ], 512)) : u("", !0), i("div", Se, [ i("div", { class: "border-top", style: _({ width: D.value }) }, null, 4), i("div", { class: "form-layout-main-scroll", ref_key: "mainScroll", ref: V }, [ i("div", { class: de(["form-layout-main", { whiteBg: !!e.$slots.form || !!e.$slots.collapses }]), ref_key: "formMain", ref: F, style: _({ width: S.value }), id: "form-container" }, [ e.$slots.form ? (l(), r("div", { key: 0, class: "form-container-wrap", style: _(t.formStyle) }, [ w(e.$slots, "form", {}, void 0, !0) ], 4)) : u("", !0), e.$slots.collapses ? (l(), r("div", $e, [ i("div", Be, [ w(e.$slots, "collapses", {}, void 0, !0) ]) ])) : u("", !0) ], 6) ], 512), t.showAnchor && e.$slots.collapses ? (l(), r("div", { key: 0, class: "collapses-nav", style: _(W.value) }, [ d(te, { el: "form-layout-main-scroll" }) ], 4)) : u("", !0) ]), i("div", Ce, [ w(e.$slots, "other", {}, void 0, !0) ]), i("div", Te, [ t.goBack ? (l(), m(C, { key: 0, onClick: L, class: "btn" }, { default: f(() => [ d(le), g(p(e.$l("取消")), 1) ]), _: 1 })) : u("", !0), t.steps.length ? (l(), m(C, { key: 1, class: "btn", disabled: o.value === t.stepDefaultActive, onClick: O }, { default: f(() => [ d(ne), g(p(e.$l("上一步")), 1) ]), _: 1 }, 8, ["disabled"])) : u("", !0), t.steps.length ? (l(), m(C, { key: 2, class: "btn", type: "primary", disabled: o.value === t.steps.length - 1, onClick: x }, { default: f(() => [ d(oe), g(p(e.$l("下一步")), 1) ]), _: 1 }, 8, ["disabled"])) : u("", !0), t.isShowSave ? (l(), m(C, { key: 3, style: { "margin-right": "8px" }, type: "primary", onClick: E }, { default: f(() => [ d(ae), g(" " + p(e.$l(t.saveBtnText)), 1) ]), _: 1 })) : u("", !0), w(e.$slots, "footer", {}, void 0, !0) ]), i("div", { class: "calc-width", ref_key: "caclWidth", ref: N, style: _({ width: t.width }) }, null, 4) ]), _: 3 }, 8, ["spinning"]) ], 512); }; } }), De = /* @__PURE__ */ fe(Ae, [["__scopeId", "data-v-25ef68a9"]]); export { De as default };