@import url('../style/var.less');

// 头部样式变量
@table-thead-bg-color: #ebf3fe; // 头部背景
@table-thead-padding-tb: 8px; // 头部上下内边距
@table-thead-padding-lr: 4px; // 头部左右内边距

// 内容样式变量
@table-tbody-bg-color: #fff; // 头部背景
@table-tbody-padding-tb: 8px; // 头部上下内边距
@table-tbody-padding-lr: 4px; // 头部左右内边距

@table-border-color: #dde8f5;

.zt-table-wrapper {
  position: relative;
  // 表格加载中状态...
  .zt-table--loading {
    z-index: 5;
    position: absolute;
    min-height: 200px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    .van-loading {
      text-align: center;
      margin-top: 100px;
      color: @white;
      .van-loading__text {
        color: @white;
      }
    }
  }

  // 表格无数据状态
  .zt-table--nodata {
    z-index: 5;
    position: absolute;
    height: 145px;
    top: 40px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    > .van-image {
      height: 135px;
    }
  }
  .zt-table--new-nodata {
    z-index: 5;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #969799;
    font-size: 14px;
    > .van-image {
      height: 135px;
    }
  }

  .zt-table-content {
    // overflow: auto;
    .zt-table {
      width: 100%;
      table-layout: fixed;
      border-spacing: 0;
      border-collapse: separate;
      transition-property: transform;
      will-change: transform;

      .zt-td--tree-button {
        // display: flex;
        // justify-content: flex-start;
        > .zt-table-tree-button-space {
          display: block;
          // float: left;
          height: 1px;
        }
        .zt-table-tree-button {
          // float: left;
          flex-shrink: 0;
          height: 20px;
          width: 20px;
          background-color: transparent;
          padding: 0;
          padding-bottom: 1px;
          outline: none;
          border: none;
          s &:active {
            background: transparent;
          }
        }
      }

      &.zt-table--border {
        .zt-th {
          border-top: 1px solid @table-border-color;
        }
        .zt-th,
        .zt-td {
          border-right: 1px solid @table-border-color;
          &:first-child {
            border-left: 1px solid @table-border-color;
          }
        }
      }

      .zt-th,
      .zt-td {
        border-bottom: 1px solid @table-border-color;
        vertical-align: middle;
        color: @weight-1;
      }

      // 去掉表格内部表格的最上面、最底下的边框
      .zt-table {
        .zt-th {
          border-top: 0;
        }
        .zt-tbody > .zt-tr:last-child {
          .zt-td {
            border-bottom: 0;
          }
        }
      }

      .zt-th,
      .zt-td {
        font-weight: 400;
        font-size: @g3-font-size;
        word-wrap: break-word;
        transition-property: transform;
      }

      // 阴影部分
      .zt-th--sticky-left-shadow::after,
      .zt-td--sticky-left-shadow::after {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 3;
        width: 0.3rem;
        background: linear-gradient(
          90deg,
          rgba(0, 0, 0, 0.06) 0%,
          rgba(0, 0, 0, 0) 100%
        );
        transform: translateX(100%);
        content: '';
        pointer-events: none;
      }
      .zt-th--sticky-right-shadow::after,
      .zt-td--sticky-right-shadow::after {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 3;
        width: 0.3rem;
        background: linear-gradient(
          90deg,
          rgba(0, 0, 0, 0) 0%,
          rgba(0, 0, 0, 0.06) 100%
        );
        transform: translateX(-100%);
        content: '';
        pointer-events: none;
      }

      // 头部样式
      .zt-th {
        padding: @table-thead-padding-tb @table-thead-padding-lr;
        background-color: @table-thead-bg-color;
        text-align: center;
        &.zt-th--sticky {
          position: sticky;
          top: 0;
          z-index: 3;
        }
        &.zt-th--sticky-left {
          position: sticky;
          z-index: 5;
        }
        &.zt-th--sticky-right {
          position: sticky;
          z-index: 5;
        }
        .zt-th-sort-icon--opacity {
          transition: all 0.25s ease-out;
          opacity: 0.3;
          &.zt-th-sort-icon--up {
            transform: rotate(180deg);
            opacity: 1;
          }
          &.zt-th-sort-icon--down {
            transform: rotate(0);
            opacity: 1;
          }
        }
      }

      // 内容样式
      .zt-td {
        padding: @table-tbody-padding-tb @table-tbody-padding-lr;
        background-color: @table-tbody-bg-color;
        &.zt-td--sticky-left,
        &.zt-td--sticky-right {
          position: sticky;
          z-index: 1;
        }
        &.zt-td--expand {
          padding: 4px;
          color: red;
          // 嵌套子表格展开滚动区分
          .zt-table-wrapper {
            width: calc(100vw - 8px);
            position: sticky;
            left: 4px;
          }
        }
      }

      // 底部样式
      .zt-footer {
        .zt-td {
          padding: 8px 4px;
          background-color: #ebf3fe;
          text-align: center;
        }
        .zt-td--sticky {
          position: sticky;
          bottom: 0;
          z-index: 3;
          &.zt-td--sticky-left,
          &.zt-td--sticky-right {
            position: sticky;
            z-index: 5;
          }
        }
      }
    }
  }
}
.zt-th--search-filter--popover {
  max-width: 100px;
  height: 36px;
  line-height: 36px;
}

.zt-table-col-ellipsis {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
}
.zt-ellipsis-info-box {
  padding: 20px;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-y: auto;
  word-break: break-word;
}
.zt-col-info-popup {
  border-radius: 5px;
  width: 80%;
  max-height: 80%;
}

.zt-custom-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  .zt-custom-wrapper-header {
    height: 50px;
    line-height: 50px;
    background: #4285f4;
    color: #fff;
    font-size: 18px;
    padding: 0px 10px;
  }
  .zt-custom-wrapper-body {
    flex-grow: 1;
    overflow: auto;
    padding-bottom: 50px;
    .van-collapse-item__content .van-cell {
      padding: 0px;
    }
  }
  .zt-custom-wrapper-footer {
    display: flex;
    button {
      flex-grow: 1;
      height: 100%;
      border-radius: 0px;
    }
  }
}
