/*
 * @Author: 焦质晔
 * @Date: 2021-02-09 09:27:46
 * @Last Modified by: 焦质晔
 * @Last Modified time: 2024-11-05 18:58:41
 */
@use '../../style/src/themes' as *;
@use '../../style/src/mixins/reset' as *;

$prefix-preview: '#{$qm-prefix}-print-preview';
$prefix-container: '#{$qm-prefix}-print-container';

.#{$prefix-preview} {
  @include reset-component();
  margin: -$padding-base;
  height: calc(100% + 20px);
  min-height: calc(80vh - 46px);
  .outer {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: inherit;
    .header,
    .footer {
      padding: 2px 10px;
      background-color: $background-color;
      display: flex;
      align-items: center;
      & > span {
        display: flex;
        align-items: center;
      }
      & > span + span {
        margin-left: 10px;
      }
    }
    .main {
      flex: 1;
      position: relative;
    }
    .header {
      border-bottom: 1px solid $border-color-base;
      .el-pagination {
        .btn-prev {
          margin-right: 1px;
          border-radius: $border-radius-base 0 0 $border-radius-base;
        }
        .el-pager {
          margin: 0 1px;
          li {
            margin: 0 1px;
          }
        }
        .btn-next {
          margin-left: 1px;
          border-radius: 0 $border-radius-base $border-radius-base 0;
        }
      }
    }
    .footer {
      border-top: 1px solid $border-color-base;
      .el-slider {
        display: inline-block;
        width: 150px;
        .el-slider__runway {
          margin: 10px 0;
        }
        .el-slider__button-wrapper {
          width: 16px;
          height: 16px;
          top: -3px;
          .el-slider__button {
            width: 12px;
            height: 12px;
            vertical-align: top;
          }
        }
      }
      .scale-text {
        font-style: normal;
        margin-left: 10px;
      }
    }
  }
  // size
  &--large {
    min-height: calc(80vh - 52px);
  }
  &--small {
    min-height: calc(80vh - 40px);
    font-size: $font-size-sm;
  }
}

.#{$prefix-container} {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%; // main 的 100%
  background-color: #dadce0;
  &.no-visible {
    opacity: 0;
    height: 0 !important;
    overflow: hidden;
    z-index: -1;
  }
  .preview {
    position: relative;
    height: 100%; // main 的 100%
    overflow-x: auto;
    overflow-y: auto;
    .origin-template {
      position: absolute;
      left: 50%;
      top: 0;
      height: 0;
      z-index: -1;
      overflow: hidden;
      visibility: hidden;
    }
    .workspace {
      margin: 0 auto;
      background-color: #fff;
      transform-origin: left top;
      box-sizing: border-box;
    }
    /* 打印模板公共样式 */
    table {
      width: 100%;
      border-spacing: 0;
      border-collapse: collapse;
      table-layout: fixed;
    }
    table tr td {
      padding: 2px;
      word-wrap: break-word;
    }
    .fs12 {
      font-size: 12px;
    }
    .fs13 {
      font-size: 13px;
    }
    .fs14 {
      font-size: 14px;
    }
    .fw500 {
      font-weight: 500;
    }
    .fw700 {
      font-weight: 700;
    }
    .fl {
      float: left;
    }
    .fr {
      float: right;
    }
    .tc {
      text-align: center;
    }
    .tr {
      text-align: right;
    }
    .bor {
      border: 1px solid #000;
    }
    .bor-t {
      border-top: 1px solid #000;
    }
    .bor-b {
      border-bottom: 1px solid #000;
    }
    .bor-l {
      border-left: 1px solid #000;
    }
    .bor-r {
      border-right: 1px solid #000;
    }
    .no-bor {
      border: none !important;
    }
    /* 打印模板公共样式 END */
  }
}

.#{$prefix-preview}__tab {
  .el-tabs__header.is-top {
    margin-bottom: 0 !important;
    .el-tabs__nav-wrap {
      padding-left: $padding-base;
    }
  }
  .#{$prefix-preview} {
    // min-height: calc(80vh - 48px - 36px);
    min-height: calc(80vh - 44px - 34px);
  }
}

/* IE11 hack */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .#{$prefix-preview} {
    .outer {
      height: 0;
    }
  }
  .is-fullscreen {
    .#{$prefix-preview} {
      .outer {
        height: 100%;
      }
    }
  }
}
