/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

@import '../custom.less';

@grid-prefix-cls: ~'@{css-prefix}grid';
@grid-body-prefix-cls: ~'@{css-prefix}grid-body';
@numeric-prefix-cls: ~'@{css-prefix}numeric';

.@{grid-prefix-cls}__body-wrapper,
.@{grid-prefix-cls}__fixed-left-body-wrapper,
.@{grid-prefix-cls}__fixed-right-body-wrapper {
  overflow-y: auto;
  overflow-x: auto;
}

// 鼠标配置项开启后，选中单元格的边框样式（position：absolute）
.@{grid-prefix-cls}__borders {
  .@{grid-prefix-cls}-border-top,
  .@{grid-prefix-cls}-border-right,
  .@{grid-prefix-cls}-border-bottom,
  .@{grid-prefix-cls}-border-left {
    position: absolute;
    background-color: var(--ti-grid-primary-color);
  }

  .@{grid-prefix-cls}-checked-borders {
    .@{grid-prefix-cls}-border-top,
    .@{grid-prefix-cls}-border-bottom {
      height: var(--ti-grid-column-checked-border-width);
    }

    .@{grid-prefix-cls}-border-right,
    .@{grid-prefix-cls}-border-left {
      width: var(--ti-grid-column-checked-border-width);
    }
  }

  .@{grid-prefix-cls}-copyed-borders {
    .@{grid-prefix-cls}-border-top,
    .@{grid-prefix-cls}-border-bottom {
      height: calc(var(--ti-grid-column-checked-border-width) + 1px);
    }

    .@{grid-prefix-cls}-border-right,
    .@{grid-prefix-cls}-border-left {
      width: calc(var(--ti-grid-column-checked-border-width) + 1px);
    }

    & > span {
      background: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 3px,
        var(--ti-grid-primary-color) 3px,
        var(--ti-grid-primary-color) 9px
      );
      animation: shine 1s infinite linear;
    }
  }
}

.@{grid-body-prefix-cls}__row {
  .@{grid-body-prefix-cls}__column {
    // 设置鼠标或者键盘选中时，单元格的背景颜色
    &.col__selected {
      background-color: var(--ti-grid-light-color);
    }

    // 修复计数器组件在表格中显示异常问题
    .@{numeric-prefix-cls} {
      width: 100%;
    }
  }
}

@keyframes shine {
  0% {
    background-position: -1px -1px;
  }

  100% {
    background-position: -12px -12px;
  }
}
