"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                                                         */
;/* empty css                                                            */
;/* empty css                                                                  */
;/* empty css                                                            */
;/* empty css                                                            */
const Vue = require("vue");
const index$2 = require("../../../node_modules/@element-plus/icons-vue/dist/index.js");
require("../store/index.js");
const useDialogDialog = require("../packages/dialog/useDialogDialog.js");
const useDialogGlobalDialog = require("../packages/dialogGlobal/useDialogGlobalDialog.js");
const index = require("../../../node_modules/element-plus/es/components/select/index.js");
const index$1 = require("../../../node_modules/element-plus/es/components/button/index.js");
const _sfc_main = {
  __name: "DialogSelect",
  props: {
    modelValue: {
      type: [String, Number],
      default: ""
    },
    loading: {
      type: Boolean,
      default: false
    },
    size: {
      type: String,
      default: "default"
    },
    dialogOptions: {
      type: Array,
      default: []
    },
    isGlobal: {
      type: Boolean,
      default: false
    }
  },
  emits: ["update:modelValue", "change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const modelValue = Vue.computed({
      get: () => props.modelValue,
      set: (val) => emit("update:modelValue", val)
    });
    function handleDialogChange(dialogId) {
      emit("change", dialogId);
    }
    const { dialogDialogVisible, openDialogDialog, DialogDialog } = useDialogDialog.useDialogDialog();
    const {
      dialogGlobalDialogVisible,
      openDialogGlobalDialog,
      DialogGlobalDialog
    } = useDialogGlobalDialog.useDialogGlobalDialog();
    function handleAddDialog() {
      if (props.isGlobal) {
        openDialogGlobalDialog();
      } else {
        openDialogDialog();
      }
    }
    return (_ctx, _cache) => {
      const _component_el_option = index.ElOption;
      const _component_el_button = index$1.ElButton;
      const _component_el_select = index.ElSelect;
      return Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, null, [
        Vue.createVNode(_component_el_select, {
          ref: "selectRef",
          modelValue: Vue.unref(modelValue),
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => Vue.isRef(modelValue) ? modelValue.value = $event : null),
          placeholder: "请选择弹层",
          filterable: "",
          style: { "width": "100%" },
          teleported: false,
          loading: __props.loading,
          size: __props.size,
          clearable: "",
          onChange: handleDialogChange
        }, {
          footer: Vue.withCtx(() => [
            Vue.createVNode(_component_el_button, {
              type: "primary",
              size: "small",
              icon: Vue.unref(index$2.Plus),
              link: "",
              onClick: handleAddDialog
            }, {
              default: Vue.withCtx(() => _cache[3] || (_cache[3] = [
                Vue.createTextVNode(" 新增弹层 ")
              ])),
              _: 1
            }, 8, ["icon"])
          ]),
          default: Vue.withCtx(() => [
            (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(__props.dialogOptions, (dialog) => {
              return Vue.openBlock(), Vue.createBlock(_component_el_option, {
                key: dialog.id,
                label: dialog.name,
                value: dialog.id
              }, null, 8, ["label", "value"]);
            }), 128))
          ]),
          _: 1
        }, 8, ["modelValue", "loading", "size"]),
        Vue.createVNode(Vue.unref(DialogDialog), {
          modelValue: Vue.unref(dialogDialogVisible),
          "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => Vue.isRef(dialogDialogVisible) ? dialogDialogVisible.value = $event : null)
        }, null, 8, ["modelValue"]),
        Vue.createVNode(Vue.unref(DialogGlobalDialog), {
          modelValue: Vue.unref(dialogGlobalDialogVisible),
          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => Vue.isRef(dialogGlobalDialogVisible) ? dialogGlobalDialogVisible.value = $event : null)
        }, null, 8, ["modelValue"])
      ], 64);
    };
  }
};
exports.default = _sfc_main;
