<!--
 * Ag Grid 没有行数据时的渲染组件
  -->
<script setup lang="ts">
defineProps<{
  params: any;
}>();
</script>
<template>
  <div class="my-ag-grid-no-rows-component">
    <div class="my-ag-grid-no-rows-component-content">
      <div class="my-ag-grid-no-rows-component-img" v-if="!params.dense"></div>
      <div :class="{ 'my-ag-grid-no-rows-component-text': !params.dense }">
        {{ params.noRowsMessageFunc ? params.noRowsMessageFunc() : '暂无数据' }}
      </div>
    </div>
  </div>
</template>

<style lang="scss">
.my-ag-grid-no-rows-component {
  width: 100%;
  height: 100%;
  position: relative;

  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;

  .my-ag-grid-no-rows-component-content {
    width: 100%;
    height: calc(100% - 50px);
    box-sizing: border-box;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;

    .my-ag-grid-no-rows-component-img {
      width: 100%;
      height: 100px;
      box-sizing: border-box;
      background: url('../../assets/no-data.svg');
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center;
    }
    .my-ag-grid-no-rows-component-text {
      position: absolute;
      height: 40px;
      width: 100px;
      text-align: center;
      line-height: 40px;
      top: 50%;
      left: 50%;
      transform: translate(-50px, 38px);
      box-sizing: border-box;
      color: rgba(0, 0, 0, 0.45);
    }
  }
}
</style>
<style lang="scss" scoped></style>