import "../../../../node_modules/element-plus/es/index.mjs";
/* empty css                                                          */
/* empty css                                                                */
/* empty css                                                               */
/* empty css                                                               */
import { mergeModels, useModel, ref, watch, createBlock, openBlock, withCtx, createElementVNode, createVNode, renderSlot, unref, createTextVNode } from "vue";
import _sfc_main$1 from "./index.vue.mjs";
import { cloneDeep } from "../utils/common.mjs";
/* empty css             */
import _export_sfc from "../../../../_virtual/_plugin-vue_export-helper.mjs";
import { ElDialog } from "../../../../node_modules/element-plus/es/components/dialog/index.mjs";
import { ElButton } from "../../../../node_modules/element-plus/es/components/button/index.mjs";
const _hoisted_1 = { class: "dialog-footer" };
const _sfc_main = {
  __name: "dialog",
  props: /* @__PURE__ */ mergeModels({
    filterConfig: Object,
    title: {
      type: String,
      default: "设置条件"
    },
    onConfirm: Function
  }, {
    "modelValue": { required: true },
    "modelModifiers": {}
  }),
  emits: ["update:modelValue"],
  setup(__props) {
    const dialogVisible = useModel(__props, "modelValue");
    const props = __props;
    const filterConfigData = ref({
      operator: "and",
      conditions: [],
      groups: []
    });
    watch(dialogVisible, (val) => {
      if (val) {
        filterConfigData.value = cloneDeep(props.filterConfig) || {
          operator: "and",
          conditions: [],
          groups: []
        };
      }
    });
    const onConfirm = () => {
      props.onConfirm && props.onConfirm(cloneDeep(filterConfigData.value));
      dialogVisible.value = false;
    };
    return (_ctx, _cache) => {
      const _component_el_button = ElButton;
      const _component_el_dialog = ElDialog;
      return openBlock(), createBlock(_component_el_dialog, {
        modelValue: dialogVisible.value,
        "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => dialogVisible.value = $event),
        width: "50%",
        title: props.title,
        draggable: "",
        overflow: "",
        "append-to-body": "",
        "close-on-click-modal": false,
        class: "fec-dev-designer-dialog"
      }, {
        footer: withCtx(() => [
          createElementVNode("div", _hoisted_1, [
            createVNode(_component_el_button, {
              onClick: _cache[0] || (_cache[0] = ($event) => dialogVisible.value = false),
              size: "default"
            }, {
              default: withCtx(() => _cache[2] || (_cache[2] = [
                createTextVNode("取消")
              ])),
              _: 1
            }),
            createVNode(_component_el_button, {
              type: "primary",
              onClick: onConfirm,
              size: "default"
            }, {
              default: withCtx(() => _cache[3] || (_cache[3] = [
                createTextVNode("确定")
              ])),
              _: 1
            })
          ])
        ]),
        default: withCtx(() => [
          _cache[4] || (_cache[4] = createElementVNode("span", { class: "advanced-title" }, "设置条件", -1)),
          createVNode(_sfc_main$1, { filterConfigData: unref(filterConfigData) }, null, 8, ["filterConfigData"]),
          renderSlot(_ctx.$slots, "default", { filterConfigData: unref(filterConfigData) }, void 0, true)
        ]),
        _: 3
      }, 8, ["modelValue", "title"]);
    };
  }
};
const AdvancedFilterDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9741f10d"]]);
export {
  AdvancedFilterDialog as default
};
