"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../../node_modules/element-plus/es/index.js");
;/* empty css                                                                */
;/* empty css                                                                      */
;/* empty css                                                                     */
;/* empty css                                                                     */
const Vue = require("vue");
;/* empty css                   */
const index = require("../../../../../../node_modules/element-plus/es/components/dialog/index.js");
const index$1 = require("../../../../../../node_modules/element-plus/es/components/button/index.js");
const _sfc_main = {
  __name: "CustomDialog",
  props: {
    modelValue: {
      type: Boolean,
      default: false
    },
    initOption: {
      type: Object,
      default: {
        width: ""
      }
    },
    width: {
      type: String,
      default: ""
    },
    height: {
      type: String,
      default: "auto"
    },
    //max,default,min
    size: {
      type: String,
      default: "default"
    },
    class: {
      type: String,
      default: ""
    },
    title: {
      type: String,
      default: "标题"
    },
    submitButtonText: {
      type: String,
      default: "确定"
    },
    cancelButtonText: {
      type: String,
      default: "取消"
    },
    query: {
      type: Boolean,
      default: false
    },
    appendToBody: {
      type: Boolean,
      default: false
    },
    hiddenFooter: {
      type: Boolean,
      default: false
    }
  },
  emits: ["submit", "onClose", "update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const slotFooter = !!Vue.useSlots().footer;
    const dialogWidth = Vue.computed(() => {
      let w = props.initOption.width || props.width;
      if (w) {
        return w;
      } else {
        if (props.size == "default") {
          return "65%";
        } else if (props.size == "max") {
          return "80%";
        } else if (props.size == "min") {
          return "50%";
        }
      }
    });
    const dialogVisible = Vue.ref(false);
    const emit = __emit;
    const onClose = () => {
      emit("onClose");
      emit("update:modelValue", false);
    };
    Vue.ref();
    function submit() {
      emit("submit");
    }
    const isFullscreen = Vue.ref(false);
    function changeFullscreen() {
      isFullscreen.value = !isFullscreen.value;
    }
    Vue.watch(
      () => props.modelValue,
      (visible) => {
        if (visible) {
          isFullscreen.value = false;
        }
        dialogVisible.value = visible;
      },
      {
        immediate: true
      }
    );
    return (_ctx, _cache) => {
      const _component_el_button = index$1.ElButton;
      const _component_el_dialog = index.ElDialog;
      return Vue.openBlock(), Vue.createBlock(_component_el_dialog, {
        modelValue: Vue.unref(dialogVisible),
        "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => Vue.isRef(dialogVisible) ? dialogVisible.value = $event : null),
        title: props.title,
        onClose,
        "destroy-on-close": "",
        draggable: "",
        "append-to-body": props.appendToBody,
        "close-on-click-modal": false,
        "close-on-press-escape": false,
        width: Vue.unref(dialogWidth),
        class: Vue.normalizeClass(props.class + " custom-dialog"),
        style: Vue.normalizeStyle("height:" + __props.height),
        fullscreen: Vue.unref(isFullscreen)
      }, Vue.createSlots({
        header: Vue.withCtx(() => [
          Vue.createElementVNode("span", null, Vue.toDisplayString(props.title), 1),
          Vue.createElementVNode("i", {
            class: "iconfont icon-MaxScreen max-screen",
            onClick: changeFullscreen
          })
        ]),
        default: Vue.withCtx(() => [
          Vue.renderSlot(_ctx.$slots, "default")
        ]),
        _: 2
      }, [
        !__props.hiddenFooter ? {
          name: "footer",
          fn: Vue.withCtx(() => [
            Vue.createVNode(_component_el_button, {
              onClick: _cache[0] || (_cache[0] = ($event) => dialogVisible.value = false)
            }, {
              default: Vue.withCtx(() => [
                Vue.createTextVNode(Vue.toDisplayString(props.cancelButtonText), 1)
              ]),
              _: 1
            }),
            slotFooter ? Vue.renderSlot(_ctx.$slots, "footer", { key: 0 }) : (Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, { key: 1 }, [
              !props.query ? (Vue.openBlock(), Vue.createBlock(_component_el_button, {
                key: 0,
                type: "primary",
                onClick: submit,
                size: "default"
              }, {
                default: Vue.withCtx(() => [
                  Vue.createTextVNode(Vue.toDisplayString(props.submitButtonText), 1)
                ]),
                _: 1
              })) : Vue.createCommentVNode("", true)
            ], 64))
          ]),
          key: "0"
        } : void 0
      ]), 1032, ["modelValue", "title", "append-to-body", "width", "class", "style", "fullscreen"]);
    };
  }
};
exports.default = _sfc_main;
