// placeholder
@import (optional, reference) '../../style/themes/index';

@mega-table-prefix-cls: ~'@{mega-prefix}-table';
@table-prefix-cls: ~'@{ant-prefix}-table';

// 每个空格都占位
.@{mega-table-prefix-cls} {
  .ant-table-thead > tr > th {
    white-space: pre;
  }
  .ant-table-tbody {
    tr {
      .ant-table-row-cell-ellipsis {
        white-space: pre !important;
      }
    }
  }
  .ant-table-tbody > tr > td {
    white-space: initial !important;
  }
}

// 列拖拽
.resize-table-th {
  position: relative;

  .table-draggable-handle {
    position: absolute;
    height: 100%;
    width: 10px;
    top: 0;
    right: -4.5px;
    z-index: 2;
    cursor: col-resize;
    touch-action: none;
    user-select: auto;
  }
}

// 设置 operation 样式
.@{table-prefix-cls} {
  .@{table-prefix-cls}-content {
    overflow-x: auto;

    & > .@{table-prefix-cls}-body {
      min-width: 800px;
    }

    .@{table-prefix-cls}-scroll {
      overflow-x: auto;

      & > .@{table-prefix-cls}-body {
        min-width: 800px;
      }

      & > .@{table-prefix-cls}-header + .@{table-prefix-cls}-body {
        min-width: auto;
      }
    }
  }

  .ant-table-tbody tr td {
    overflow-x: hidden;
  }

  .operation + .operation {
    margin-left: 10px;
    cursor: pointer;
  }

  .operation {
    .anticon-edit,
    .anticon-plus,
    .anticon-copy,
    .anticon-check-circle {
      color: @primary-color;
    }

    .anticon-delete,
    .anticon-stop {
      color: @error-color;
    }

    color: @text-color-secondary;

    .ant-btn,
    .ant-btn-icon-only {
      border: 0;
      line-height: 1;
      height: auto;
      width: auto;
      background: transparent;
    }
  }
}

.@{table-prefix-cls}-fixed-right {
  .@{table-prefix-cls}-header {
    border-top: @border-width-base @border-style-base @border-color-split;

    .@{table-prefix-cls}-fixed {
      border-top-width: 0;

      .@{table-prefix-cls}-thead > tr > th {
        &:last-of-type {
          border-right-color: transparent;
        }
      }
    }
  }
}

.mega-design-pro-table .s-table-tool .s-table-tool-left .ant-btn:nth-of-type(1),
.mega-design-pro-table
  .s-table-tool
  .s-table-tool-left
  .el-button:nth-of-type(1) {
  background-color: #005583;
  border-color: #005583;
}

.mega-design-pro-table
  .s-table-tool
  .s-table-tool-left
  .ant-btn:nth-of-type(1):hover,
.mega-design-pro-table
  .s-table-tool
  .s-table-tool-left
  .el-button:nth-of-type(1):hover,
.mega-design-pro-table
  .s-table-tool
  .s-table-tool-left
  .ant-btn:nth-of-type(1):focus,
.mega-design-pro-table
  .s-table-tool
  .s-table-tool-left
  .el-button:nth-of-type(1):focus {
  background-color: @primary-color;
  border-color: @primary-color;
}

// 统一表格样式
.@{mega-table-prefix-cls} {
  .plTableBox .el-table__fixed-right-patch {
    background: #fafafa;
  }

  .plTableBox .el-table th {
    background: #fafafa;
    border-bottom: 1px solid #e8e8e8;
    color: rgba(0, 0, 0, 0.85);
    font-weight: 500;
    text-align: left;
    height: 40px;
    padding: 0;

    div {
      height: 40px;
      line-height: 40px;
    }
  }

  .plTableBox .el-table td.is-center,
  .plTableBox .el-table th.is-center {
    text-align: center !important;
  }

  .plTableBox .el-table td,
  .plTableBox .el-table th {
    padding: 0;
  }

  .elx-table .elx-cell,
  .plTableBox .el-table .cell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .el-checkbox__input.is-checked .el-checkbox__inner,
  .el-checkbox__input.is-indeterminate .el-checkbox__inner,
  .elx-table .is--checked.elx-cell--checkbox .elx-checkbox--icon:before {
    background-color: #005583;
    border-color: #005583;
  }

  .is--sortable,
  .is-sortable {
    &:hover {
      // background: #f2f2f2 !important;
      background: rgba(0, 0, 0, 0.04) !important;
      cursor: pointer;
    }
  }

  .elx-table .is--checked.elx-cell--checkbox,
  .elx-table .is--checked.elx-cell--radio,
  .elx-table .is--indeterminate.elx-cell--checkbox,
  .is--checked.elx-table--filter-option,
  .is--indeterminate.elx-table--filter-option {
    color: #005583;
  }

  .elx-table .is--checked.elx-cell--checkbox .elx-checkbox--icon:before,
  .elx-table .is--indeterminate.elx-cell--checkbox .elx-checkbox--icon:before,
  .is--checked.elx-table--filter-option .elx-checkbox--icon:before,
  .is--indeterminate.elx-table--filter-option .elx-checkbox--icon:before {
    border: #005583;
    background-color: #005583;
  }

  .elx-table .elx-body--column.col--ellipsis,
  .elx-table .elx-footer--column.col--ellipsis,
  .elx-table .elx-header--column.col--ellipsis,
  .elx-table.elx-editable .elx-body--column {
    height: 40px;
  }

  .elx-header--row {
    background: #fafafa !important;
  }

  .elx-table .elx-body--row.row--hover.row--current,
  .elx-table .elx-body--row.row--checked,
  .elx-table .elx-body--row.row--current,
  .elx-table .elx-body--row.row--radio,
  .plTableBox .el-table__body tr.current-row > td,
  .plTableBox .el-table__body tr.hover-row.current-row > td,
  .plTableBox
    .el-table__body
    tr.hover-row.el-table__row--striped.current-row
    > td,
  .plTableBox .el-table__body tr.hover-row.el-table__row--striped > td,
  .plTableBox .el-table__body tr.hover-row > td,
  .elx-table .elx-body--row.row--hover,
  .elx-table .elx-body--row.row--hover.row--stripe {
    background-color: #e6feff;
  }

  .plTableBox .el-table .sort-caret.descending {
    border-top-color: #bfbfbf;
    bottom: 9px;
  }

  .plTableBox .el-table .sort-caret.ascending {
    border-bottom-color: #bfbfbf;
    top: 6px;
  }

  .plTableBox .el-table .ascending .sort-caret.ascending {
    border-bottom-color: @primary-color;
  }

  .plTableBox .el-table .descending .sort-caret.descending {
    border-top-color: @primary-color;
  }

  .plTableBox .el-table .tree--btn-wrapper-show {
    .tree--btn-wrapper {
      margin-top: -9px;
    }
    i {
      background: #fff;
      border: 1px solid #e8e8e8;
      border-radius: 2px;
      color: #0ea8d0;
      color: inherit;
      cursor: pointer;
      display: inline-block;
      height: 17px;
      line-height: 13px;
      outline: none;
      text-align: center;
      -webkit-text-decoration: none;
      text-decoration: none;
      transition: color 0.3s;
      transition: all 0.3s;
      -webkit-user-select: none;
      -moz-user-select: none;
      user-select: none;
      width: 17px;
      transform: rotate(90deg);
    }
    .el-icon-arrow-right:before {
      content: '-';
    }
  }

  .plTableBox .el-table {
    .tree--btn-wrapper {
      margin-top: -10px;
    }
    .el-icon-arrow-right {
      background: #fff;
      border: 1px solid #e8e8e8;
      border-radius: 2px;
      color: #0ea8d0;
      color: inherit;
      cursor: pointer;
      display: inline-block;
      height: 17px;
      line-height: 13px;
      outline: none;
      text-align: center;
      -webkit-text-decoration: none;
      text-decoration: none;
      transition: color 0.3s;
      transition: all 0.3s;
      -webkit-user-select: none;
      -moz-user-select: none;
      user-select: none;
      width: 17px;
      transform: rotate(90deg);
    }
    .el-icon-arrow-right:before {
      content: '+';
    }
  }

  .elx-table .elx-sort--desc-btn.sort--active {
    &::before {
      border-top-color: @primary-color;
    }
  }

  .elx-table .elx-sort--asc-btn.sort--active {
    &::before {
      border-bottom-color: @primary-color;
    }
  }

  .plTableBox .el-table .caret-wrapper {
    margin-left: 3px;
  }

  .sort--active {
    border-color: @primary-color;
  }

  .plTableBox .el-table .sort-caret {
    border: 4px solid transparent;
  }

  .elx-table .elx-sort--asc-btn,
  .elx-table .elx-sort--desc-btn {
    color: #bfbfbf;
  }

  .elx-table .elx-sort--asc-btn {
    top: 1px;

    &::before {
      border-bottom-color: #bfbfbf;
      border-width: 4px;
    }
  }

  .elx-table .elx-sort--desc-btn {
    bottom: -1px;

    &::before {
      border-top-color: #bfbfbf;
      border-width: 4px;
    }
  }

  .elx-cell--sort {
    margin-left: 4px;
  }
  .elx-table {
    font-family: SourceHanSansCN-Regular, Helvetica Neue, PingFang SC,
      Hiragino Sans GB, Arial, Helvetica, sans-serif !important;
  }
  .elx-header--column {
    font-weight: 500;
  }
  .elx-header--column.col--ellipsis > .elx-cell .elx-cell--title {
    color: rgba(0, 0, 0, 0.85) !important;
  }
}
.intersectionClass {
  .ant-checkbox-inner::after {
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background-color: #005583;
    border: 0;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    content: ' ';
  }
}
.intersectionIsClass {
  .ant-checkbox-inner::after {
    content: ' ';
  }
}
.intersectionClassAll {
  .ant-checkbox-inner {
    background-color: #005583;
    border-color: #005583;
  }
  .ant-checkbox-inner::after {
    position: absolute;
    display: table;
    border: 2px solid #fff;
    border-top: 0;
    border-left: 0;
    opacity: 1;
    transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;
    content: ' ';
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(1) translate(-65%, -50%);
  }
}
