<template>
  <container-item-wrapper :widget="widget" :class="widget.options.isFullscreen ? 'full-height':''">

    <el-row :key="widget.id" :gutter="widget.options.gutter" class="grid-container"
            :class="[widget.options.containerClass , customClass]"
            :ref="widget.id" v-show="!widget.options.hidden" :style="'height:'+widget.options.colHeight+'px'">
      <template v-for="(colWidget, colIdx) in widget.cols">
        <grid-col-item :widget="colWidget" :key="colIdx" :parent-list="widget.cols"
                       :index-of-parent-list="colIdx" :parent-widget="widget"
                       :col-height="widget.options.colHeight" :tableParam="tableParam" :formItemProp="formItemProp">
          <!-- 递归传递插槽！！！ -->
          <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
            <slot :name="slot" v-bind="scope"/>
          </template>
        </grid-col-item>
      </template>
    </el-row>

  </container-item-wrapper>
</template>

<script>
  import emitter from '../../../../components/xform/utils/emitter'
  import i18n from "../../../../components/xform/utils/i18n"
  import refMixin from "../../../../components/xform/form-render/refMixin"
  import ContainerItemWrapper from './container-item-wrapper'
  import GridColItem from './grid-col-item'
  import containerItemMixin from "./containerItemMixin"

  export default {
    name: "grid-item",
    componentName: 'ContainerItem',
    mixins: [emitter, i18n, refMixin, containerItemMixin],
    components: {
      ContainerItemWrapper,
      GridColItem,
    },
    props: {
      widget: Object,
    },
    inject: ['refList', 'sfRefList', 'globalModel'],
    created() {
      this.initRefList()
    },
    mounted() {

    },
    beforeDestroy() {
      this.unregisterFromRefList()
    },
    methods: {

    },
  }
</script>

<style lang="scss" scoped>

</style>
