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