'use strict';

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

var vue = require('vue');
require('../../../hooks/index.js');
require('../../../utils/index.js');
var modalOverlay = require('./modal-overlay.js');
var createNamespace = require('../../../utils/create-namespace.js');
var index = require('../../../hooks/use-scroll/index.js');

"use strict";
const _hoisted_1 = { class: "close-text" };
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{ name: "LlModalOverlay" },
  __name: "modal-overlay",
  props: modalOverlay.modalOverlayProps,
  emits: modalOverlay.modalOverlayEmits,
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const bem = createNamespace.createNamespace("modal-overlay");
    const { scrollPosition, isHasScrollBar, scrollRef } = index.useScroll();
    const isShowContentBottomBox = vue.computed(() => {
      if (props.footerShadowPlacement === "inner") {
        return props.isShowFooterShadow && isHasScrollBar.value && scrollPosition.value !== "bottom";
      } else {
        return props.isShowFooterShadow;
      }
    });
    const scrollToTop = () => {
      if (scrollRef.value) {
        scrollRef.value.scrollTo({
          top: 0,
          behavior: "smooth"
        });
      }
    };
    const close = () => {
      emits("close", false);
      emits("update:open", false);
    };
    const rootStyle = vue.computed(() => ({
      zIndex: props.zIndex,
      borderRadius: props.borderRadius
    }));
    __expose({
      scrollToTop
    });
    return (_ctx, _cache) => {
      const _component_ll_icon = vue.resolveComponent("ll-icon");
      const _component_a_spin = vue.resolveComponent("a-spin");
      return _ctx.open ? (vue.openBlock(), vue.createElementBlock(
        "div",
        {
          key: 0,
          class: vue.normalizeClass([vue.unref(bem).b(), _ctx.rootClass]),
          style: vue.normalizeStyle(rootStyle.value)
        },
        [
          vue.createVNode(_component_a_spin, {
            spinning: _ctx.fullLoading,
            "wrapper-class-name": vue.unref(bem).e("content")
          }, {
            default: vue.withCtx(() => [
              vue.createCommentVNode(" \u5934\u90E8\u533A "),
              vue.createElementVNode(
                "div",
                {
                  class: vue.normalizeClass(vue.unref(bem).e("header"))
                },
                [
                  vue.createCommentVNode(" \u5173\u95ED\u6309\u94AE "),
                  _ctx.showClose ? (vue.openBlock(), vue.createElementBlock(
                    "div",
                    {
                      key: 0,
                      class: vue.normalizeClass([vue.unref(bem).e("close"), _ctx.mediaClass]),
                      style: vue.normalizeStyle(_ctx.closeStyle)
                    },
                    [
                      vue.createElementVNode("div", {
                        class: "close-content",
                        onClick: close
                      }, [
                        vue.renderSlot(_ctx.$slots, "closeIcon", {}, () => [
                          vue.createVNode(_component_ll_icon, vue.mergeProps(_ctx.closeIcon, {
                            "icon-name": _ctx.closeIcon.iconName || "icon-return-arrow",
                            style: { marginRight: _ctx.closeIconTextSpace + "px" }
                          }), null, 16, ["icon-name", "style"])
                        ]),
                        vue.createElementVNode("div", _hoisted_1, [
                          vue.renderSlot(_ctx.$slots, "closeText", {}, () => [
                            vue.createElementVNode(
                              "span",
                              {
                                style: vue.normalizeStyle({
                                  "font-size": _ctx.closeTextSize + "px",
                                  color: _ctx.closeTextColor
                                })
                              },
                              vue.toDisplayString(_ctx.closeText),
                              5
                              /* TEXT, STYLE */
                            )
                          ])
                        ])
                      ])
                    ],
                    6
                    /* CLASS, STYLE */
                  )) : vue.createCommentVNode("v-if", true),
                  vue.createCommentVNode(" \u5934\u90E8\u6807\u9898\u63D2\u69FD "),
                  _ctx.showHeader ? (vue.openBlock(), vue.createElementBlock(
                    "div",
                    {
                      key: 1,
                      style: vue.normalizeStyle(_ctx.headerStyle),
                      class: vue.normalizeClass(["header-content", _ctx.mediaClass])
                    },
                    [
                      vue.renderSlot(_ctx.$slots, "header")
                    ],
                    6
                    /* CLASS, STYLE */
                  )) : vue.createCommentVNode("v-if", true)
                ],
                2
                /* CLASS */
              ),
              vue.createCommentVNode(" \u4E3B\u5185\u5BB9\u533A "),
              vue.createVNode(_component_a_spin, {
                spinning: _ctx.mainLoading,
                "wrapper-class-name": vue.unref(bem).e("main-loading")
              }, {
                default: vue.withCtx(() => [
                  vue.createElementVNode(
                    "div",
                    {
                      ref_key: "scrollRef",
                      ref: scrollRef,
                      class: vue.normalizeClass([
                        vue.unref(bem).e("main"),
                        _ctx.isBespreadMain ? "bespread-main" : "",
                        _ctx.mainClass
                      ]),
                      style: vue.normalizeStyle(_ctx.mainStyle)
                    },
                    [
                      vue.createElementVNode(
                        "div",
                        {
                          class: vue.normalizeClass(["main-content", _ctx.mediaClass])
                        },
                        [
                          vue.createCommentVNode(" \u4E3B\u5185\u5BB9\u533A\u57DF\u63D2\u69FD "),
                          vue.renderSlot(_ctx.$slots, "main")
                        ],
                        2
                        /* CLASS */
                      )
                    ],
                    6
                    /* CLASS, STYLE */
                  )
                ]),
                _: 3
                /* FORWARDED */
              }, 8, ["spinning", "wrapper-class-name"]),
              vue.createCommentVNode(" \u9875\u811A "),
              _ctx.showFooter ? (vue.openBlock(), vue.createElementBlock(
                "div",
                {
                  key: 0,
                  class: vue.normalizeClass([
                    vue.unref(bem).e("footer"),
                    isShowContentBottomBox.value ? vue.unref(bem).is("shadow") : ""
                  ]),
                  style: vue.normalizeStyle(_ctx.footerStyle)
                },
                [
                  vue.createElementVNode(
                    "div",
                    {
                      class: vue.normalizeClass(["footer-content", _ctx.mediaClass])
                    },
                    [
                      vue.createCommentVNode(" \u9875\u811A\u533A\u57DF\u63D2\u69FD "),
                      vue.renderSlot(_ctx.$slots, "footer")
                    ],
                    2
                    /* CLASS */
                  )
                ],
                6
                /* CLASS, STYLE */
              )) : vue.createCommentVNode("v-if", true)
            ]),
            _: 3
            /* FORWARDED */
          }, 8, ["spinning", "wrapper-class-name"])
        ],
        6
        /* CLASS, STYLE */
      )) : vue.createCommentVNode("v-if", true);
    };
  }
});

exports.default = _sfc_main;
//# sourceMappingURL=modal-overlay.vue2.js.map
