'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../../../utils/index.js');
var createNamespace = require('../../../utils/create-namespace.js');

"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__ */ vue.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.createNamespace("calendar");
    const canDelete = vue.computed(() => props.currentEditableEvent.delete !== false);
    const popoverRef = vue.useTemplateRef("popoverRef");
    const boundaryRef = vue.useTemplateRef("boundaryRef");
    __expose({
      popoverRef,
      boundaryRef
    });
    return (_ctx, _cache) => {
      const _component_ll_button = vue.resolveComponent("ll-button");
      const _component_ll_form = vue.resolveComponent("ll-form");
      const _component_ll_drawer = vue.resolveComponent("ll-drawer");
      return vue.openBlock(), vue.createElementBlock(
        vue.Fragment,
        null,
        [
          (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
            __props.open && __props.presentationMode === "popover" ? (vue.openBlock(), vue.createElementBlock(
              "div",
              {
                key: 0,
                class: "ll-calendar__edit-teleport-mask",
                onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => emit("mask-close"), ["self"])),
                onContextmenu: _cache[3] || (_cache[3] = vue.withModifiers(() => {
                }, ["prevent"]))
              },
              [
                vue.createElementVNode(
                  "div",
                  {
                    ref_key: "boundaryRef",
                    ref: boundaryRef,
                    class: "ll-calendar__boundary-proxy",
                    style: vue.normalizeStyle(__props.boundaryStyle),
                    "aria-hidden": "true"
                  },
                  [
                    vue.createElementVNode(
                      "div",
                      {
                        ref_key: "popoverRef",
                        ref: popoverRef,
                        class: vue.normalizeClass([
                          vue.unref(bem).e("edit-popover"),
                          `ll-calendar__edit-popover--${__props.placement}`,
                          `ll-calendar__teleport-layer`
                        ]),
                        style: vue.normalizeStyle(__props.style),
                        onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
                        }, ["stop"]))
                      },
                      [
                        vue.createElementVNode("div", _hoisted_1, [
                          vue.createElementVNode(
                            "div",
                            _hoisted_2,
                            vue.toDisplayString(__props.title),
                            1
                            /* TEXT */
                          ),
                          vue.createVNode(_component_ll_button, {
                            size: "small",
                            onClick: _cache[0] || (_cache[0] = ($event) => emit("switch-presentation"))
                          }, {
                            default: vue.withCtx(() => [..._cache[10] || (_cache[10] = [
                              vue.createTextVNode(
                                " \u5207\u6362\u62BD\u5C49 ",
                                -1
                                /* CACHED */
                              )
                            ])]),
                            _: 1
                            /* STABLE */
                          })
                        ]),
                        vue.createElementVNode("div", _hoisted_3, [
                          vue.renderSlot(_ctx.$slots, "edit-form", { data: __props.formData }, () => [
                            vue.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 */
            )) : vue.createCommentVNode("v-if", true)
          ])),
          __props.open && __props.presentationMode === "drawer" ? (vue.openBlock(), vue.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": vue.withCtx(() => [
              !__props.isCreatingEvent && canDelete.value ? (vue.openBlock(), vue.createBlock(_component_ll_button, {
                key: 0,
                danger: "",
                onClick: _cache[4] || (_cache[4] = ($event) => emit("delete-edit-event"))
              }, {
                default: vue.withCtx(() => [..._cache[11] || (_cache[11] = [
                  vue.createTextVNode(
                    " \u5220\u9664 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })) : vue.createCommentVNode("v-if", true)
            ]),
            "footer-right": vue.withCtx(() => [
              vue.createVNode(_component_ll_button, {
                style: { "margin-left": "8px" },
                onClick: _cache[5] || (_cache[5] = ($event) => emit("confirm"))
              }, {
                default: vue.withCtx(() => [..._cache[12] || (_cache[12] = [
                  vue.createTextVNode(
                    " \u4FDD\u5B58 ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }),
              __props.isCreatingEvent ? (vue.openBlock(), vue.createBlock(_component_ll_button, {
                key: 0,
                type: "primary",
                onClick: _cache[6] || (_cache[6] = ($event) => emit("confirm-and-add"))
              }, {
                default: vue.withCtx(() => [..._cache[13] || (_cache[13] = [
                  vue.createTextVNode(
                    " \u4FDD\u5B58\u540E\u65B0\u589E ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              })) : vue.createCommentVNode("v-if", true)
            ]),
            default: vue.withCtx(() => [
              vue.renderSlot(_ctx.$slots, "edit-form", { data: __props.formData }, () => [
                vue.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"])) : vue.createCommentVNode("v-if", true)
        ],
        64
        /* STABLE_FRAGMENT */
      );
    };
  }
});

exports.default = _sfc_main;
//# sourceMappingURL=calendar-edit-panel.vue2.js.map
