'use strict';

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

var vue = require('vue');
var elementPlus = require('element-plus');
var index = require('../../page-result/index.js');

"use strict";
const _hoisted_1 = {
  key: 0,
  style: { "width": "100%", "height": "100%", "overflow": "hidden", "display": "flex" }
};
const _hoisted_2 = ["space"];
const _hoisted_3 = ["space"];
const _hoisted_4 = { style: { "height": "100%", "padding": "15px", "box-sizing": "border-box" } };
const _hoisted_5 = {
  key: 3,
  class: "me-body-container"
};
const _hoisted_6 = {
  key: 4,
  style: { "width": "100%", "height": "100%", "overflow": "hidden", "display": "flex" },
  class: "me-body-container"
};
const _hoisted_7 = { style: {} };
const _hoisted_8 = {
  style: { "overflow": "auto", "height": "100%" },
  class: "me-div-scroller"
};
const _hoisted_9 = { style: {} };
const __default__ = vue.defineComponent({
  name: "me-body"
});
var script = /* @__PURE__ */ vue.defineComponent({
  ...__default__,
  props: {
    background: { type: String, required: false, default: "#fff" },
    space: { type: Number, required: false, default: 0 },
    mode: { type: String, required: false, default: "normal" },
    fullScreen: { type: Boolean, required: false, default: false },
    error: { type: Boolean, required: false, skipCheck: true, default: false },
    loading: { type: Boolean, required: false, default: false },
    result: { type: null, required: false, default: void 0 },
    title: { type: String, required: false },
    subTitle: { type: String, required: false }
  },
  setup(__props) {
    const props = __props;
    let space = vue.computed(() => {
      return props.fullScreen ? 0 : props.space;
    });
    const bodyStyle = vue.computed(() => {
      let height = "100%";
      if (props.loading || props.mode == "full") {
        height = "100%";
      } else {
        height = "fit-content";
      }
      return {
        height
      };
    });
    vue.watch(
      () => props.fullScreen,
      (fullScreen) => {
        console.log(`fullScreen is: ${fullScreen}`);
      }
    );
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock(
        "div",
        {
          class: "me-body",
          style: vue.normalizeStyle(bodyStyle.value)
        },
        [
          props.loading && !props.error ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
            vue.createElementVNode(
              "div",
              {
                style: vue.normalizeStyle([{ "width": "100%", "overflow": "hidden", "display": "flex", "align-items": "center", "justify-content": "center", "background": "rgb(255, 255, 255)" }, { margin: props.space + "px" }])
              },
              [..._cache[0] || (_cache[0] = [
                vue.createElementVNode(
                  "div",
                  { class: "me-body__loader" },
                  "loading",
                  -1
                  /* CACHED */
                )
              ])],
              4
              /* STYLE */
            )
          ])) : vue.createCommentVNode("v-if", true),
          props.error ? (vue.openBlock(), vue.createElementBlock("div", {
            key: 1,
            space: props.space
          }, [
            vue.renderSlot(_ctx.$slots, "me-body-error", {}, () => [
              vue.createVNode(vue.unref(index.MePageResult))
            ])
          ], 8, _hoisted_2)) : vue.createCommentVNode("v-if", true),
          props.result ? (vue.openBlock(), vue.createElementBlock("div", {
            key: 2,
            space: props.space,
            style: { "height": "100%" }
          }, [
            vue.createElementVNode("div", _hoisted_4, [
              vue.createVNode(vue.unref(elementPlus.ElResult), {
                style: { "height": "100%", "background": "#fff" },
                icon: props.result,
                title: props.title,
                "sub-title": props.subTitle
              }, {
                extra: vue.withCtx(() => [
                  vue.renderSlot(_ctx.$slots, "me-body-result", {}, () => [
                    vue.renderSlot(_ctx.$slots, "default")
                  ])
                ]),
                _: 3
                /* FORWARDED */
              }, 8, ["icon", "title", "sub-title"])
            ])
          ], 8, _hoisted_3)) : vue.createCommentVNode("v-if", true),
          vue.createCommentVNode(" mode normal "),
          !props.loading && !props.error && !props.result && props.mode == "normal" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
            vue.createElementVNode(
              "div",
              {
                style: vue.normalizeStyle({ background: props.background, margin: `${vue.unref(space)}px` })
              },
              [
                vue.renderSlot(_ctx.$slots, "me-body-header"),
                vue.renderSlot(_ctx.$slots, "me-body-main"),
                vue.renderSlot(_ctx.$slots, "me-body-footer")
              ],
              4
              /* STYLE */
            )
          ])) : vue.createCommentVNode("v-if", true),
          vue.createCommentVNode(" mode full "),
          !props.loading && !props.error && !props.result && props.mode == "full" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
            vue.createElementVNode(
              "div",
              {
                style: vue.normalizeStyle([{ "width": "100%", "flex": "1", "overflow": "hidden", "display": "flex", "flex-direction": "column" }, { background: props.background, margin: `${vue.unref(space)}px` }])
              },
              [
                vue.createElementVNode("div", _hoisted_7, [
                  vue.renderSlot(_ctx.$slots, "me-body-header")
                ]),
                vue.createElementVNode("div", _hoisted_8, [
                  vue.renderSlot(_ctx.$slots, "me-body-main")
                ]),
                vue.createElementVNode("div", _hoisted_9, [
                  vue.renderSlot(_ctx.$slots, "me-body-footer")
                ])
              ],
              4
              /* STYLE */
            )
          ])) : vue.createCommentVNode("v-if", true)
        ],
        4
        /* STYLE */
      );
    };
  }
});

exports.default = script;
//# sourceMappingURL=body.vue2.js.map
