@import '../../mixins/config.less';

@tw: ~'@{ns}-ap-table__table-wrapper';
// vben表格
// 新增对sticky表格的样式类型
[class$='-basic-table'],
[class$='-basic-table-form-container'],
[class$='-basic-table ap-table--sticky'],
[class$='-basic-table-form-container ap-table--sticky'] {
  width: 100%;
  height: 100%;

  .ant-table-wrapper {
    padding: 12px 16px 16px;
    background-color: #ffffff;
    border-radius: 0;

    // 自定义title
    .ant-table.ant-table-middle > .ant-table-title,
    .ant-table.ant-table-small > .ant-table-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: 40px;
      padding: 0 0 12px; // title下边距
      border: none;
    }

    .ant-table {
      width: 100%;
      overflow-x: hidden;
      border-radius: 0;

      .ant-table-container {
        border-radius: 0;

        table {
          border-radius: 0;
        }

        table > thead > tr:first-child > *:first-child {
          border-radius: 0;
        }

        .ant-table-header {
          border-radius: 0; // 解决表格表头圆角缺失
        }

        .ant-table-tbody > tr {
          &.ant-table-row-selected {
            & > td {
              background-color: #f3fbf7;
            }

            &:hover > td {
              background-color: #e6f6ef;
            }
          }

          & > td {
            padding: 13.5px 16px; // 单元格左右间距
            line-height: 20px;
          }
        }

        .ant-table-thead > tr > th {
          padding: 13.5px 16px; // 表头左右间距
          line-height: 20px;
        }
      }

      &-footer {
        padding: 0;

        .ant-table-wrapper {
          padding: 0;
        }

        table {
          border: none;
        }

        .ant-table-body {
          overflow-x: hidden;
          //  overflow-y: scroll !important;
        }

        td {
          padding: 12px 8px;
        }
      }
    }
  }
}

// 处理vben的basicTable头部筛选样式
[class$='-basic-table-form-container'] {
  padding: 16px;

  .ant-form {
    width: 100%;
    margin-bottom: 16px;
    padding: 16px;
    background-color: #ffffff;
    border-radius: 0;

    .ant-row {
      row-gap: 16px;
    }

    .ant-form-item {
      margin-bottom: 0;
    }
  }
}

// vben的basicTable的inset配置
[class$='-basic-table--inset'] {
  .ant-table-wrapper {
    padding: 0;
  }
}

// ④-vben表格的斑马纹
[class$='-basic-table-row__striped'] {
  td {
    background-color: #fafafa;
  }
}

// 三种表格（ApTable，BacisTable，ProTable）的表头+分页器的sticky定位样式
[class*='-basic-table'].ap-table--sticky,
[class*='-ap-table'].ap-table--sticky,
[class*='-pro-table'].ap-table--sticky {
  .@{tw},
  .ant-table-wrapper {
    & .ant-spin-container,
    &,
    .ant-spin-container {
      overflow: visible;

      .ant-table {
        overflow: visible;

        .ant-table-container {
          overflow: visible;

          .ant-table-header {
            position: sticky;
            top: 0;
            z-index: 99;
            border-top: 4px solid #ffffff;
          }
        }
      }

      ul.ant-pagination {
        position: sticky;
        bottom: 0;
        z-index: 99;
        margin: 0;
        padding: 16px 0;
        background-color: #ffffff;
      }
    }
  }
}
