"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                                                                 */
const Vue = require("vue");
const index$2 = ;/* empty css                   */
const index$1 = ;/* empty css                      */
const index = require("../../../../../node_modules/element-plus/es/components/dialog/index.js");
const index$3 = require("../../../../../node_modules/element-plus/es/components/button/index.js");
const index$4 = require("../../../../../node_modules/element-plus/es/components/input/index.js");
const index$5 = require("../../../../../node_modules/element-plus/es/directives/click-outside/index.js");
const index$6 = require("../../../../../node_modules/element-plus/es/components/link/index.js");
const _hoisted_1 = { class: "dialog-footer" };
const _sfc_main = {
  __name: "index",
  props: /* @__PURE__ */ Vue.mergeModels({
    activeData: Object
  }, {
    "modelValue": { required: true },
    "modelModifiers": {}
  }),
  emits: ["update:modelValue"],
  setup(__props) {
    const dialogVisible = Vue.useModel(__props, "modelValue");
    const props = __props;
    const dialog = {
      approval: index$2.default,
      condition: index$1.default
    };
    const showInput = Vue.ref(false);
    const localData = Vue.ref({});
    Vue.watch(
      () => dialogVisible.value,
      (newVal) => {
        if (newVal && props.activeData) {
          localData.value = JSON.parse(JSON.stringify(props.activeData));
        }
      }
    );
    const onClickOutside = () => {
      if (showInput.value) {
        showInput.value = false;
      }
    };
    const onConfirm = () => {
      Object.assign(props.activeData, localData.value);
      dialogVisible.value = false;
    };
    const onCancel = () => {
      dialogVisible.value = false;
    };
    return (_ctx, _cache) => {
      const _component_el_input = index$4.ElInput;
      const _component_el_link = index$6.ElLink;
      const _component_el_button = index$3.ElButton;
      const _component_el_dialog = index.ElDialog;
      return Vue.openBlock(), Vue.createBlock(_component_el_dialog, {
        modelValue: dialogVisible.value,
        "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => dialogVisible.value = $event),
        width: "800",
        draggable: "",
        overflow: "",
        class: "fec-dev-designer-dialog"
      }, {
        header: Vue.withCtx(() => [
          Vue.createElementVNode("span", {
            class: "fec-edit-title",
            onMousedown: _cache[2] || (_cache[2] = Vue.withModifiers(() => {
            }, ["stop"]))
          }, [
            Vue.withDirectives(Vue.createVNode(_component_el_input, {
              onBlur: onClickOutside,
              maxlength: "30",
              modelValue: Vue.unref(localData).name,
              "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => Vue.unref(localData).name = $event)
            }, null, 8, ["modelValue"]), [
              [Vue.unref(index$5.default), onClickOutside],
              [Vue.vShow, Vue.unref(showInput)]
            ]),
            Vue.withDirectives(Vue.createVNode(_component_el_link, {
              icon: "EditPen",
              onClick: _cache[1] || (_cache[1] = ($event) => showInput.value = true)
            }, {
              default: Vue.withCtx(() => {
                var _a;
                return [
                  Vue.createTextVNode(Vue.toDisplayString(((_a = Vue.unref(localData)) == null ? void 0 : _a.name) || "动作"), 1)
                ];
              }),
              _: 1
            }, 512), [
              [Vue.vShow, !Vue.unref(showInput)]
            ])
          ], 32)
        ]),
        footer: Vue.withCtx(() => [
          Vue.createElementVNode("div", _hoisted_1, [
            Vue.createVNode(_component_el_button, { onClick: onCancel }, {
              default: Vue.withCtx(() => _cache[4] || (_cache[4] = [
                Vue.createTextVNode("取消")
              ])),
              _: 1
            }),
            Vue.createVNode(_component_el_button, {
              type: "primary",
              onClick: onConfirm
            }, {
              default: Vue.withCtx(() => _cache[5] || (_cache[5] = [
                Vue.createTextVNode(" 确定 ")
              ])),
              _: 1
            })
          ])
        ]),
        default: Vue.withCtx(() => [
          (Vue.openBlock(), Vue.createBlock(Vue.resolveDynamicComponent(dialog[Vue.unref(localData).type]), { activeData: Vue.unref(localData) }, null, 8, ["activeData"]))
        ]),
        _: 1
      }, 8, ["modelValue"]);
    };
  }
};
exports.default = _sfc_main;
