import { defineComponent as E, ref as w, reactive as N, openBlock as t, createBlock as r, withCtx as x, createElementBlock as i, createElementVNode as d, toDisplayString as O, createCommentVNode as S, renderSlot as T, Fragment as b, createVNode as y } from "vue";
import { _ as D } from "./BaseTransition.vue_vue_type_script_setup_true_lang-DLAYzSgX.js";
import { C as p } from "./base-PQGakkrl.js";
import c from "../Element/ClButton.js";
const F = {
  key: 0,
  class: "modal-header"
}, I = { class: "modal-title" }, H = { class: "modal-body" }, V = {
  key: 1,
  class: "modal-footer"
}, $ = {
  key: 2,
  class: "modal-footer-hide"
}, P = /* @__PURE__ */ E({
  name: "ClModal",
  __name: "Index",
  props: {
    posSubmitClose: {
      type: String,
      default: "CloseSubmit",
      validator: (e) => ["CloseSubmit", "SubmitClose"].indexOf(e) !== -1
    },
    className: {
      type: String,
      default: ""
    },
    width: {
      type: String,
      default: "600px"
    },
    titleName: {
      type: String,
      default: ""
    },
    isBackClick: {
      type: Boolean,
      default: !0
    },
    isShowHeader: {
      type: Boolean,
      default: !0
    },
    isShowFooter: {
      type: Boolean,
      default: !0
    },
    isShowSubmit: {
      type: Boolean,
      default: !0
    },
    isShowSubmitLoad: {
      type: Boolean,
      default: !0
    },
    closeLabel: {
      type: String,
      default: ""
    },
    submitLabel: {
      type: String,
      default: ""
    },
    classTransitionEnter: {
      type: String,
      default: "animated fadeInDown"
    }
  },
  emits: ["onSubmit", "onClose"],
  setup(e, { expose: B, emit: L }) {
    const u = e, f = L, a = w(null), l = w(null), o = N({
      isLoadBackClick: !0,
      disabledSubmit: !1
    }), v = () => {
      f("onSubmit");
    }, k = () => {
      f("onClose");
    }, h = () => {
      a.value && a.value.hide();
    }, C = () => {
      u.isShowSubmitLoad && (o.isLoadBackClick = !1), v();
    }, m = () => {
      h(), k();
    }, g = () => {
      k();
    };
    return B({
      show: () => {
        o.disabledSubmit = !1, a.value && a.value.show();
      },
      hide: () => {
        o.isLoadBackClick = !0, u.isShowSubmitLoad && l.value && l.value.loadStop(), h();
      },
      loadStop: () => {
        o.isLoadBackClick = !0, u.isShowSubmitLoad && l.value && l.value.loadStop();
      },
      disabledSubmit: (s) => {
        const n = p.isBoolean(s) ? s : !0;
        o.disabledSubmit = n;
      }
    }), (s, n) => (t(), r(D, {
      className: e.className,
      isBackClick: e.isBackClick && o.isLoadBackClick,
      classTransitionEnter: e.classTransitionEnter,
      width: e.width,
      onOnClickBack: g,
      ref_key: "refElTransition",
      ref: a
    }, {
      default: x(() => [
        e.isShowHeader ? (t(), i("div", F, [
          d("h4", I, O(e.titleName), 1),
          d("button", {
            type: "button",
            class: "close",
            onClick: m
          }, [...n[0] || (n[0] = [
            d("i", { class: "clIconFont clIcon-close" }, null, -1)
          ])])
        ])) : S("", !0),
        d("div", H, [
          T(s.$slots, "default")
        ]),
        e.isShowFooter ? (t(), i("div", V, [
          e.posSubmitClose === "CloseSubmit" ? (t(), i(b, { key: 0 }, [
            y(c, {
              label: e.closeLabel || "取消",
              color: "grayLight",
              onOnClick: m
            }, null, 8, ["label"]),
            e.isShowSubmit ? (t(), r(c, {
              key: 0,
              ref_key: "refElBtnSubmit",
              ref: l,
              disabled: o.disabledSubmit,
              isShowLoad: e.isShowSubmitLoad,
              isShowBackDrop: !0,
              label: e.submitLabel || "提交",
              onOnClick: C
            }, null, 8, ["disabled", "isShowLoad", "label"])) : S("", !0)
          ], 64)) : e.posSubmitClose === "SubmitClose" ? (t(), i(b, { key: 1 }, [
            e.isShowSubmit ? (t(), r(c, {
              key: 0,
              ref_key: "refElBtnSubmit",
              ref: l,
              disabled: o.disabledSubmit,
              isShowLoad: e.isShowSubmitLoad,
              isShowBackDrop: !0,
              label: e.submitLabel || "提交",
              onOnClick: C
            }, null, 8, ["disabled", "isShowLoad", "label"])) : S("", !0),
            y(c, {
              label: e.closeLabel || "取消",
              color: "grayLight",
              onOnClick: m
            }, null, 8, ["label"])
          ], 64)) : (t(), i(b, { key: 2 }, [], 64))
        ])) : (t(), i("div", $))
      ]),
      _: 3
    }, 8, ["className", "isBackClick", "classTransitionEnter", "width"]));
  }
});
export {
  P as _
};
//# sourceMappingURL=Index.vue_vue_type_script_setup_true_lang-Da4Z8GsB.js.map
