// @import "../_utils.scss";
// @import "./poptip.scss";
// @import "./checkbox.scss";
// @import "./radio.scss";
// @import "./icon.scss";
// @import "./spin.scss";
// @import "./button.scss";

.#{$table-prefix-cls} {
  width: inherit;
  // height: 100%;
  max-width: 100%;
  overflow: hidden;
  color: $text-color;
  font-size: $font-size-small;
  background-color: $table-tbody-bg;
  box-sizing: border-box;

  @include theme-font-color($__table_font-color);
  @include theme-background-color($__table_background-color);
  @include structure-font-size($__table-default_font-size, 0);

  &-phantom {
    position: absolute;
    left: $table-phantom-left;
    top: $table-phantom-top;
    right: $table-phantom-right;
    z-index: -1;
  }

  &-wrapper {
    position: relative;
    border: 1px solid $border-color-base;
    border-bottom: $table-wrapper-border-bottom;
    border-right: $table-wrapper-border-right;

    @include theme-border-color($__table-wrapper_border-color);
    //overflow: hidden;
  }

  &-wrapper:focus {
    outline: none;
  }
  //position: relative;

  &-hide {
    opacity: 0;
  }

  &::before {
    content: "";
    width: 100%;
    height: $table-before-height;
    position: absolute;
    left: $table-before-left;
    bottom: $table-before-bottom;
    background-color: $border-color-base;
    z-index: 4;

    @include theme-background-color($__table_befor_background-color);
  }

  &::after {
    content: "";
    width: $table-after-width;
    height: $table-after-height;
    position: absolute;
    top: $table-after-top;
    right: $table-after-right;
    background-color: $border-color-base;
    z-index: 3;

    @include theme-background-color($__table_after_background-color);
  }

  &-with-header {
    //border-radius: $border-radius-base $border-radius-base 0 0;
  }

  &-with-footer {
    //border: 1px solid $border-color-base;
    //border-radius: 0 0 $border-radius-base $border-radius-base;
  }

  &-with-header.#{$table-prefix-cls}-with-footer {
    //border-radius: $border-radius-base;
  }

  & .h-table-immediate-row-click {
    transition: 0s;
  }

  &-title,
  &-footer {
    height: $table-title-height;
    font-size: $table-title-font-size;
    line-height: $table-title-line-height;
    border-bottom: 1px solid $border-color-bottom;

    @include theme-border-bottom-color($__table-title_border-bottom-color);
  }

  &-footer {
    border-bottom: none;
  }

  &-header {
    // width: 100%;
    overflow: hidden;

    & > table {
      position: static !important;
    }
  }

  &-body {
    overflow: auto;

    @include scrollbar;
    //position: relative;
  }

  &-with-fixed-top.#{$table-prefix-cls}-with-footer {
    .#{$table-prefix-cls}-footer {
      border-top: 1px solid $border-color-base;

      @include theme-border-top-color($__table-footer_border-top-color);
    }

    tbody tr:last-child td {
      border-bottom: none;
    }
  }

  th,
  td {
    min-width: 0;
    height: $table-th-td-height;
    box-sizing: border-box;
    text-align: left;
    font-size: $table-td-font-size;
    // text-overflow: ellipsis;
    vertical-align: middle;
    //position: relative;
    border-bottom: 1px solid $border-color-bottom;
    @if $--size-switch == yes {
      font-size: $--size-font-size-base;
    }
    @include theme-border-bottom-color($__table-td_border-bottom-color);
    @include structure-font-size($__table-default_font-size, 0);
  }

  th {
    height: $table-th-height;
    // white-space: nowrap;
    overflow: hidden;
    background-color: $table-thead-bg;
    
    @if $--size-switch == yes {
      // color:red;
      height: computed-table-th-height(normal) ;
      @include computed-font-size(30px);
    }

    @include theme-background-color($__table-th_background-color);
    @include theme-border-bottom-color($__table-th_border-bottom-color);
  }

  td {
    background-color: $table-tbody-bg;
    transition: background-color $transition-time $ease-in-out;
    @if $--size-switch == yes {
      height: computed-table-td-height(normal) ;
    }
    @include theme-background-color($__table-td_background-color);
  }

  th.#{$table-prefix-cls}-head-column,
  td.#{$table-prefix-cls}-body-column {
    &-left {
      text-align: left;
    }

    &-center {
      text-align: center;
    }

    &-right {
      text-align: right;
    }
  }
  th.#{$table-prefix-cls}-column,
  td.#{$table-prefix-cls}-column {
    &-left {
      text-align: left;
    }

    &-center {
      text-align: center;
    }

    &-right {
      text-align: right;
    }
  }
  th.#{$table-prefix-cls}-column-head,
  td.#{$table-prefix-cls}-column-body {
    &-left {
      text-align: left;
    }

    &-center {
      text-align: center;
    }

    &-right {
      text-align: right;
    }
  }

  & table {
    //width: 100%;
    table-layout: fixed;
  }

  &-border {
    th,
    td {
      border-right: 1px solid $border-color-bottom;

      @include theme-border-right-color($__table-border-td_border-right-color);
    }

    th {
      @include theme-border-right-color($__table-border-th_border-right-color);
    }
  }
  &-border.#{$table-prefix-cls}-hide-td-border {
    td {
      border-right: 1px solid transparent;

      @include theme-border-right-color($__table-border-hide-td-border_border-right-color);
    }
  }

  &-not-width {
    .#{$table-prefix-cls}-cell {
      white-space: nowrap;
    }
  }

  &-cell {
    padding-left: $table-cell-padding-left;
    padding-right: $table-cell-padding-right;
    overflow: hidden;
    // text-overflow: ellipsis;
    white-space: normal;
    word-break: break-all;
    box-sizing: border-box;

    &-ellipsis {
      word-break: keep-all;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    &-with-expand {
      @if $--size-switch == yes {
      } @else {
        height: $table-with-expand-height;
        line-height: $table-with-expand-line-height;
      }
      padding: $table-with-expand-padding;
      text-align: center;
    }

    &-with-drag i {
      @if $--size-switch == yes {
        line-height: 1;
      } 
      cursor: move;
    }

    &-expand {
      cursor: pointer;
      transition: transform $transition-time $ease-in-out;
      display: inline-block;

      i {
        font-size: $font-size-base;

        @include theme-font-color($__table-tr-expand-td-icon_font-color);
      }

      &-expanded {
        transform: rotate(90deg);
      }
    }
    & .h-checkbox-wrapper,.h-radio-wrapper {
      @if $--size-switch == yes { //需要去除checkbox的上下padding，否则在最小模式下的单元格会被撑开
        padding-top:0;
        padding-bottom:0;
      } 
    }

  }
  .cur-th th &-cell-overflow-visible {
    overflow: visible;
  }
  td &-cell-overflow-visible {
    overflow: visible;
  }
  &-split-index {
    background: $table-tbody-bg !important;
    user-select: none;

    @include theme-background-color($__table-split-index_background-color, $--important);
  }

  &-split-index::before {
    content: attr(data-index);
  }

  &-hidden {
    visibility: hidden;
  }

  th &-cell {
    // display: inline-block;
    //position: relative;
    white-space: nowrap;
    overflow: hidden;
    vertical-align: middle;
  }

  &-stripe &-body,
  &-stripe &-fixed-body {
    tr:nth-child(2n) {
      td {
        background-color: $table-td-group-line-bg;

        @include theme-background-color($__table-stripe-body-td_background-color);
      }
    }
    tr.#{$table-prefix-cls}-row-hover {
      td {
        background-color: $table-td-hover-bg;

        @include theme-background-color($__table-stripe-body-td_hover_background-color);
      }
    }
    // tr:hover{
    //   td{background-color: $table-td-hover-bg;}
    // }
  }
  // &-row:hover{//改变hover高亮显示形式
  //   td{ background-color: $table-td-hover-bg}
  // }
  tr.#{$table-prefix-cls}-row-hover {
    td {
      background-color: $table-td-hover-bg;

      @include theme-background-color($__table-tr_hover_background-color);
    }
  }

  &-large {
    font-size: $font-size-base;

    @include structure-font-size($__table-default_font-size, 2);

    th {
      height: $table-large-th-height;
      @if $--size-switch == yes {
        height: computed-table-th-height(large) ;
      }
    }

    td {
      height: $table-large-td-height;
      @if $--size-switch == yes {
        height: computed-table-td-height(large) ;
      }
    }

    &-title,
    &-footer {
      height: $table-large-title-height;
      line-height: $table-large-title-line-height;
    }
    .#{$table-prefix-cls}-tiptext {
      // height: $table-large-tiptext-height;
      min-height: $table-large-tiptext-height;
      line-height: $table-large-tiptext-line-height;
    }
  }

  &-small {
    th {
      height: $table-small-th-height;
      @if $--size-switch == yes {
        height: computed-table-th-height(small) ;
      }
    }

    td {
      height: $table-small-td-height;
      @if $--size-switch == yes {
        height: computed-table-td-height(small) ;
      }
    }

    &-title,
    &-footer {
      height: 35px;
      line-height: 35px;
    }
    .#{$table-prefix-cls}-tiptext {
      height: $table-small-title-height;
      min-height: $table-small-title-height;
      line-height: $table-small-title-line-height;
    }
  }
  // &-row-checked{
  //   td{
  //     background-color: $table-td-selected-bg;
  //   }
  // }
  &-row-highlight,&-row-checked,
  tr.#{$table-prefix-cls}-row-highlight.#{$table-prefix-cls}-row-hover,
  tr.#{$table-prefix-cls}-row-checked.#{$table-prefix-cls}-row-hover,
  &-stripe &-body tr.#{$table-prefix-cls}-row-highlight:nth-child(2n),
  &-stripe &-fixed-body tr.#{$table-prefix-cls}-row-highlight:nth-child(2n),
  &-stripe &-body tr.#{$table-prefix-cls}-row-checked:nth-child(2n),
  &-stripe &-fixed-body tr.#{$table-prefix-cls}-row-checked:nth-child(2n) {
    td {
      background-color: $table-td-highlight-bg;

      @include theme-background-color($__table-td_highlight_background-color);
    }
  }

  &-row-filterable {
    td {
      color: darken($error-color, 10%);

      @include theme-font-color($__table-filterable-td_background-color);
    }
  }

  &-row-dashed {
    td {
      border-top: 1px dashed $primary-color;
      border-bottom: 1px dashed $primary-color;

      @include theme-border-top-color($__table-dashed-td_border-top-color);
      @include theme-border-bottom-color($__table-dashed-td_border-bottom-color);
    }

    td:first-child {
      border-left: 1px dashed $primary-color;

      @include theme-border-left-color($__table-dashed-td-first-child_border-left-color);
    }

    td:last-child {
      border-right: 1px dashed $primary-color;

      @include theme-border-right-color($__table-dashed-td-last-child_border-right-color);
    }
  }

  & tr.#{$table-prefix-cls}-row-dragover td {
    background-color: $primary-color;
    color: $table-row-dragover-td-color;

    @include theme-background-color($__table-dragovertd_background-color);
    @include theme-font-color($__table-dragovertd_font-color);
  }

  &-summation {
    border-top: $table-summation-border;
    overflow: hidden;

    @include theme-border-top-color($__table-summation_border-top-color);
  }

  &-fixed,
  &-fixed-right {
    position: absolute;
    top: $table-fixed-top;
    left: $table-fixed-left;
    border-bottom: none;

    @include theme-border-bottom-color($__table-fixed-right-patch_border-bottom-color);
    @include theme-border-right-color($__table-fixed_border-right-color);

    th,
    td {
      @include theme-border-right-color($__table-fixed_border-right-color);
    }
  }

  &-fixed-left-summation,
  &-fixed-right-summation {
    position: absolute;
    border-bottom: none;

    @include theme-border-bottom-color($__table-fixed-right-summation_border-bottom-color);
  }

  &-fixed-left-summation {
    left: $table-fixed-left;
    bottom: 0;
  }

  &-fixed-right {
    top: $table-fixed-fixedright-top;
    left: auto;
    right: $table-fixed-fixedright-right;
    .#{$table-prefix-cls}-fixed-header {
      background: #fff;
    }
    .#{$table-prefix-cls}-cell {
      padding-left: $table-fixed-cell-padding-left;
      padding-right: $table-fixed-cell-padding-right;
    }
    .#{$table-prefix-cls}-hidden {
      .#{$table-prefix-cls}-cell {
        padding-left: $table-cell-padding-left;
        padding-right: $table-cell-padding-left;
      }
    }
  }

  &-fixed-right-summation {
    // left: auto;
    right: $table-fixed-fixedright-right;
    bottom: 0;
    .#{$table-prefix-cls}-fixed-header {
      background: #fff;
    }
    .#{$table-prefix-cls}-cell {
      padding-left: $table-fixed-cell-padding-left;
      padding-right: $table-fixed-cell-padding-right;
    }
    .#{$table-prefix-cls}-hidden {
      .#{$table-prefix-cls}-cell {
        padding-left: $table-cell-padding-left;
        padding-right: $table-cell-padding-left;
      }
    }
  }

  &-fixed-right-patch {
    position: absolute;
    top: $table-fixed-fixedright-patch-top;
    right: $table-fixed-fixedright-patch-right;
    background-color: $table-thead-bg;
    border-bottom: 1px solid $border-color-bottom;

    @include theme-background-color($__table-fixed-right-patch_background-color);
    @include theme-border-bottom-color($__table-fixed-right-patch_border-bottom-color);
    // border-bottom: 1px solid #e6ebf5;
    //汇总行补偿列样式
    &-sum {
      position: absolute;
      bottom: $table-fixed-fixedright-patch-top;
      right: $table-fixed-fixedright-patch-right;
      background-color: $table-thead-bg;
      border-bottom: 1px solid $border-color-bottom;
  
      @include theme-background-color($__table-fixed-right-patch_background-color);
      @include theme-border-bottom-color($__table-fixed-right-patch_border-bottom-color);
    }

  }

  &-fixed {
    &-header {
      box-shadow: $table-fixed-header-box-shadow;
      overflow: hidden;

      @include theme-box-shadow($__table-fixed-header_box-shadow);
    }

    &-body-shadow {
      box-shadow: $table-fixed-body-box-shadow;
      border-right: 1px solid #dce1e7;
      
      @include theme-box-shadow($__table-fixed-body_box-shadow);
    }
  }

  &-fixed-right,
  &-fixed-right-summation {
    .#{$table-prefix-cls}-fixed-header {
      box-shadow: $table-fixed-right-header-box-shadow;

      @include theme-box-shadow($__table-fixed-right-summation-fixedheader_box-shadow);
    }
    .#{$table-prefix-cls}-fixed-body-shadow {
      box-shadow: $table-fixed-right-body-box-shadow;

      @include theme-box-shadow($__table-fixed-right-summation-fixedbody_box-shadow);
    }
  }

  &-fixed-body {
    overflow: hidden;
    position: relative;
    z-index: 3;
  }

  &-fixed-shadow {
    width: $table-fixed-shadow-width;
    height: 100%;
    position: absolute;
    top: $table-fixed-shadow-top;
    right: $table-fixed-shadow-right;
    box-shadow: $shadow-right;
    overflow: hidden;
    z-index: 1;

    @include theme-box-shadow($__table-fixed-shadow_box-shadow);
  }

  &-fixed-summation {
    overflow: hidden;
    position: absolute;
  }

  &-sort {
    @include sortable();
  }

  &-simple-sort {
    display: inline-block;
    width: 16px;
    height: 14px;
    margin-left: 4px;
    margin-top: -1px;
    vertical-align: middle;
    overflow: hidden;
    cursor: pointer;

    i {
      display: block;
      height: 7px;
      line-height: 7px;
      overflow: hidden;
      color: $btn-disable-color;
      transition: color $transition-time $ease-in-out;
      font-size: 14px;

      @include theme-font-color($__common-sortable-i_font-color);

      &:hover {
        color: inherit;

        @include theme-font-color($__common-sortable-i_hover_font-color);
      }

      &.on {
        color: $primary-color;

        @include theme-font-color($__common-sortable-i_on_font-color);
      }

      &:first-child {
        top: 0;
      }

      &:last-child {
        bottom: 0;
      }
    }
  }

  &-sortnew {
    i {
      color: $btn-disable-color;
      transition: color $transition-time $ease-in-out;

      @include theme-font-color($__table-newsort_icon-color);

      &:hover {
        color: inherit;
      }

      &.on {
        color: #666;

        @include theme-font-color($__table-newsort_on_icon-color);
      }
    }

    @include sortable();
  }

  &-newsort-wrap {
    display: inline-block;
    position: absolute;
    right: 0;
    background: #ffff;
    height: 24px;
  }

  &-filter {
    display: inline-block;
    cursor: pointer;
    position: relative;
    top: 2px;

    i {
      color: $btn-disable-color;
      transition: color $transition-time $ease-in-out;

      @include theme-font-color($__table-filter_icon-color);

      &:hover {
        color: inherit;

        @include theme-font-color($__table-filter_icon_hover-color);
      }

      &.on {
        color: $primary-color;

        @include theme-font-color($__table-filter_on_icon-color);
      }
    }

    &-list {
      max-height: 160px;
      padding: $table-filter-list-padding;

      &-item {
        padding: $table-filter-list-item-padding;
        //就是选择某个元素的下一个元素
        // .h-checkbox-wrapper + .h-checkbox-wrapper{
        //     margin: 0;
        // }
        .h-checkbox-wrapper {
          margin: $table-filter-list-checkbox-wrapper-margin;
        }

        label {
          display: block;
          margin-bottom: $table-filter-list-item-label-margin-bottom;

          & > span {
            margin-right: $table-filter-list-item-label-margin-right;
          }
        }
      }

      ul {
        padding-bottom: $table-filter-list-ul-padding-bottom;
      }

      @include select-item($table-prefix-cls, $table-select-item-prefix-cls);
    }

    &-footer {
      padding: $table-filter-footer-padding;
      border-top: 1px solid $border-color-split;

      @include theme-border-top-color($__table-filter-footer_border-top-color);
    }
  }

  & &-poptip-sticky-fix {
    position: static;
  }

  &-simple-filter {
    display: inline-block;
    cursor: pointer;
    top: 2px;

    i {
      color: $btn-disable-color;
      transition: color $transition-time $ease-in-out;

      @include theme-font-color($__table-filter_icon-color);

      &:hover {
        color: inherit;

        @include theme-font-color($__table-filter_icon_hover-color);
      }

      &.on {
        color: $primary-color;

        @include theme-font-color($__table-filter_on_icon-color);
      }
    }

    &-list {
      max-height: 160px;
      padding: $table-filter-list-padding;

      &-item {
        padding: $table-filter-list-item-padding;

        .h-checkbox-wrapper {
          margin: $table-filter-list-checkbox-wrapper-margin;
        }

        label {
          display: block;
          margin-bottom: $table-filter-list-item-label-margin-bottom;

          & > span {
            margin-right: $table-filter-list-item-label-margin-right;
          }
        }
      }

      ul {
        padding-bottom: $table-filter-list-ul-padding-bottom;
      }

      @include select-item($table-prefix-cls, $table-select-item-prefix-cls);
    }

    &-footer {
      padding: $table-filter-footer-padding;
      border-top: 1px solid $border-color-split;

      @include theme-border-top-color($__table-filter-footer_border-top-color);
    }
  }

  .h-poptip-popper {
    min-width: 0;
    text-align: left;
  }

  thead .h-poptip-popper {
    .h-poptip-body {
      padding: 0;
      // position:absolute
    }
  }

  &-tip {
    overflow: auto;

    @include scrollbar;

    table {
      width: 100%;
      min-height: $table-tiptext-height;

      td {
        text-align: center;
      }
    }
  }

  &-tiptext {
    @include scrollbar;
    position: absolute;
    // pointer-events: none;
    text-align: center;
    overflow-y: auto;
    min-height: $table-tiptext-height;
    // height:$table-tiptext-height;
    line-height: $table-tiptext-line-height;
    @if $--size-switch == yes {
      font-size: $--size-font-size-base;
    }
    
  }

  &__column-resize-proxy {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px solid $border-color-base;
    z-index: 10;

    @include theme-border-left-color($__table-column-resize-proxy_border-left-color);
  }

  &__column-move-proxy {
    position: absolute;
    z-index: 10;
  }

  &-simulate-scroll-bar {
    position: fixed;
    bottom: 0;
    overflow: scroll;
    z-index: 4;

    &-actived {
      height: 1px;
    }
  }

  &-childtable {
    width: 100%;
  }

  &-sticky-left-shadow {
    box-shadow: $table-fixed-header-box-shadow;

    @include theme-box-shadow($__table-fixed-header_box-shadow);
  }

  &-sticky-right-shadow {
    box-shadow: $table-fixed-right-header-box-shadow;

    @include theme-box-shadow($__table-fixed-right-summation-fixedheader_box-shadow);
  }
}

.move-proxy-th {
  border: 1px solid $border-color-base;

  @include theme-border-color($__table-move-proxy-th_border-color);
}

.h-simple-view {
  position: relative;
}

.h-simple-content {
  position: absolute;
  left: $table-h-simple-content-left;
  right: $table-h-simple-content-right;
  top: $table-h-simple-content-top;
}

.useSelect {
  -ms-user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

.#{$css-prefix}simple-group-table {
  .#{$table-prefix-cls}-fixed-right {
    .#{$table-prefix-cls}-group-cell td * {
      visibility: hidden;
    }
  }
}
