import "../../../../../node_modules/element-plus/es/index.mjs";
/* empty css                                                             */
/* empty css                                                               */
/* empty css                                                               */
import { ref, resolveComponent, resolveDirective, withDirectives, createBlock, openBlock, withCtx, createVNode, createElementVNode, unref, isRef, renderSlot, createCommentVNode } from "vue";
import { cloneDeep } from "../../utils/common.mjs";
/* empty css             */
import _export_sfc from "../../../../../_virtual/_plugin-vue_export-helper.mjs";
import { ElRow } from "../../../../../node_modules/element-plus/es/components/row/index.mjs";
import { ElCol } from "../../../../../node_modules/element-plus/es/components/col/index.mjs";
const _hoisted_1 = { class: "grid-content" };
const _hoisted_2 = { class: "grid-content-statistics" };
const _sfc_main = {
  __name: "Layout",
  props: {
    templateKey: {
      type: String,
      default: ""
    },
    initFormMode: {
      type: String,
      default: ""
    },
    initFormData: {
      type: Object,
      default: {}
    }
  },
  emits: ["loaded"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const layoutRowRef = ref();
    const formData = ref(props.initFormData);
    const emit = __emit;
    const showCard = ref(false);
    function loaded(option, formData2) {
      showCard.value = true;
      let offsetHeight = layoutRowRef.value.$el.offsetHeight;
      const cols = layoutRowRef.value.$el.querySelectorAll(".el-col");
      cols.forEach((col) => {
        col.style.height = offsetHeight + "px";
      });
      emit("loaded", cloneDeep(formData2));
    }
    return (_ctx, _cache) => {
      const _component_fec_form = resolveComponent("fec-form");
      const _component_el_col = ElCol;
      const _component_el_row = ElRow;
      const _directive_fec_layout = resolveDirective("fec-layout");
      return withDirectives((openBlock(), createBlock(_component_el_row, {
        gutter: 8,
        class: "fec-layout-row",
        ref_key: "layoutRowRef",
        ref: layoutRowRef
      }, {
        default: withCtx(() => [
          createVNode(_component_el_col, {
            span: 18,
            style: { "padding-left": "0" }
          }, {
            default: withCtx(() => [
              createElementVNode("div", _hoisted_1, [
                createVNode(_component_fec_form, {
                  ref: "formRef",
                  templateKey: __props.templateKey,
                  modelValue: unref(formData),
                  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(formData) ? formData.value = $event : null),
                  onLoaded: loaded,
                  initFormMode: __props.initFormMode
                }, null, 8, ["templateKey", "modelValue", "initFormMode"])
              ])
            ]),
            _: 1
          }),
          createVNode(_component_el_col, {
            span: 6,
            style: { "padding-right": "0" }
          }, {
            default: withCtx(() => [
              createElementVNode("div", _hoisted_2, [
                unref(showCard) ? renderSlot(_ctx.$slots, "card", { key: 0 }, void 0, true) : createCommentVNode("", true)
              ])
            ]),
            _: 3
          })
        ]),
        _: 3
      })), [
        [_directive_fec_layout]
      ]);
    };
  }
};
const _Layout = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1eb7b697"]]);
export {
  _Layout as default
};
