import { defineComponent, computed, useTemplateRef, resolveComponent, createElementBlock, openBlock, Fragment, createBlock, createCommentVNode, Teleport, withModifiers, createElementVNode, normalizeStyle, normalizeClass, unref, createVNode, toDisplayString, withCtx, createTextVNode, renderSlot } from 'vue';
import '../../../utils/index.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';

"use strict";
const _hoisted_1 = { class: "ll-calendar__edit-header" };
const _hoisted_2 = { class: "ll-calendar__edit-title" };
const _hoisted_3 = { class: "ll-calendar__edit-content" };
var _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "calendar-edit-panel",
  props: {
    open: { type: Boolean, required: true },
    presentationMode: { type: String, required: true },
    placement: { type: String, required: true },
    title: { type: String, required: true },
    formData: { type: Object, required: true },
    formColumns: { type: Array, required: true },
    isCreatingEvent: { type: Boolean, required: true },
    currentEditableEvent: { type: Object, required: true },
    style: { type: Object, required: false },
    boundaryStyle: { type: Object, required: false }
  },
  emits: ["mask-close", "switch-presentation", "confirm", "confirm-and-add", "delete-edit-event"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const bem = createNamespace("calendar");
    const canDelete = computed(() => props.currentEditableEvent.delete !== false);
    const popoverRef = useTemplateRef("popoverRef");
    const boundaryRef = useTemplateRef("boundaryRef");
    __expose({
      popoverRef,
      boundaryRef
    });
    return (_ctx, _cache) => {
      const _component_ll_button = resolveComponent("ll-button");
      const _component_ll_form = resolveComponent("ll-form");
      const _component_ll_drawer = resolveComponent("ll-drawer");
      return openBlock(), createElementBlock(
        Fragment,
        null,
        [
          (openBlock(), createBlock(Teleport, { to: "body" }, [
            __props.open && __props.presentationMode === "popover" ? (openBlock(), createElementBlock(
              "div",
              {
                key: 0,
                class: "ll-calendar__edit-teleport-mask",
                onClick: _cache[2] || (_cache[2] = withModifiers(($event) => emit("mask-close"), ["self"])),
                onContextmenu: _cache[3] || (_cache[3] = withModifiers(() => {
                }, ["prevent"]))
              },
              [
                createElementVNode(
                  "div",
                  {
                    ref_key: "boundaryRef",
                    ref: boundaryRef,
                    class: "ll-calendar__boundary-proxy",
                    style: normalizeStyle(__props.boundaryStyle),
                    "aria-hidden": "true"
                  },
                  [
                    createElementVNode(
                      "div",
                      {
                        ref_key: "popoverRef",
                        ref: popoverRef,
                        class: normalizeClass([
                          unref(bem).e("edit-popover"),
                          `ll-calendar__edit-popover--${__props.placement}`,
                          `ll-calendar__teleport-layer`
                        ]),
                        style: normalizeStyle(__props.style),
                        onClick: _cache[1] || (_cache[1] = withModifiers(() => {
                        }, ["stop"]))
                      },
                      [
                        createElementVNode("div", _hoisted_1, [
                          createElementVNode(
                            "div",
                            _hoisted_2,
                            toDisplayString(__props.title),
                            1
                            /* TEXT */
                          ),
                          createVNode(_component_ll_button, {
                            size: "small",
                            onClick: _cache[0] || (_cache[0] = ($event) => emit("switch-presentation"))
                          }, {
                            default: withCtx(() => [..._cache[10] || (_cache[10] = [
                              createTextVNode(
                                " \u5207\u6362\u62BD\u5C49 ",
                                -1
                                /* CACHED */
                              )
                            ])]),
                            _: 1
                            /* STABLE */
                          })
                        ]),
                        createElementVNode("div", _hoisted_3, [
                          renderSlot(_ctx.$slots, "edit-form", { data: __props.formData }, () => [
                            createVNode(_component_ll_form, {
                              "form-options": { layout: "vertical" },
                              "row-options": { gutter: 12 },
                              "form-data": __props.formData,
                              "form-columns": __props.formColumns
                            }, null, 8, ["form-data", "form-columns"])
                          ])
                        ])
                      ],
                      6
                      /* CLASS, STYLE */
                    )
                  ],
                  4
                  /* STYLE */
                )
              ],
              32
              /* NEED_HYDRATION */
            )) : createCommentVNode("v-if", true)
          ])),
          __props.open && __props.presentationMode === "drawer" ? (openBlock(), createBlock(_component_ll_drawer, {
            key: 0,
            open: __props.open,
            title: __props.title,
            width: 460,
            "mask-closable": true,
            onConfirm: _cache[7] || (_cache[7] = ($event) => emit("confirm")),
            onCancel: _cache[8] || (_cache[8] = ($event) => emit("confirm")),
            onClose: _cache[9] || (_cache[9] = ($event) => emit("confirm"))
          }, {
            "footer-left": withCtx(() => [
              !__props.isCreatingEvent && canDelete.value ? (openBlock(), createBlock(_component_ll_button, {
                key: 0,
                danger: "",
                onClick: _cache[4] || (_cache[4] = ($event) => emit("delete-edit-event"))
              }, {
                default: withCtx(() => [..._cache[11] || (_cache[11] = [
                  createTextVNode(
                    " \u5220\u9664 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })) : createCommentVNode("v-if", true)
            ]),
            "footer-right": withCtx(() => [
              createVNode(_component_ll_button, {
                style: { "margin-left": "8px" },
                onClick: _cache[5] || (_cache[5] = ($event) => emit("confirm"))
              }, {
                default: withCtx(() => [..._cache[12] || (_cache[12] = [
                  createTextVNode(
                    " \u4FDD\u5B58 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }),
              __props.isCreatingEvent ? (openBlock(), createBlock(_component_ll_button, {
                key: 0,
                type: "primary",
                onClick: _cache[6] || (_cache[6] = ($event) => emit("confirm-and-add"))
              }, {
                default: withCtx(() => [..._cache[13] || (_cache[13] = [
                  createTextVNode(
                    " \u4FDD\u5B58\u540E\u65B0\u589E ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })) : createCommentVNode("v-if", true)
            ]),
            default: withCtx(() => [
              renderSlot(_ctx.$slots, "edit-form", { data: __props.formData }, () => [
                createVNode(_component_ll_form, {
                  "form-options": { layout: "vertical" },
                  "row-options": { gutter: 12 },
                  "form-data": __props.formData,
                  "form-columns": __props.formColumns
                }, null, 8, ["form-data", "form-columns"])
              ])
            ]),
            _: 3
            /* FORWARDED */
          }, 8, ["open", "title"])) : createCommentVNode("v-if", true)
        ],
        64
        /* STABLE_FRAGMENT */
      );
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=calendar-edit-panel.vue2.mjs.map
