@use "sass:map";
@use "@befe/brick-style/src/themes/base";
@use "@befe/brick-style/src/themes/table";
@use "@befe/brick-style/src/themes/checkbox";

// 统一使用 md size
$checkbox-width: map.get(checkbox.$checkbox-mark-size, 'md');

.brick-table {
  @each $align in (left, right, center) {
    .brick-table-col-align-#{$align} {
      text-align: #{$align};
    }
  }

  // 标准行高默认默认 ellipsis
  &[class*="brick-table-head-row-lines-1"] th,
  &[class*="brick-table-body-row-lines-1"] td {
    .brick-table-cell-content {
      @include base.ellipsis();
    }
  }

  // 重置 table-cell-content 的 ellipsis， 使边上按钮的 focus-ring 得以显示
  &[class*="brick-table-body-row-lines-1"] td {
    &.brick-table-col-type-switch,
    &.brick-table-col-type-operations {
      .brick-table-cell-content {
        overflow: unset;
      }
    }
  }

  .brick-table-col-type-operations {
    .brick-table-cell-content {
      white-space: nowrap;
    }
  }
  .brick-table-col-type-checkbox {
    width: $checkbox-width + table.$table-cell-padding-horizontal * 2 + base.$border-width-base;
    .brick-table-cell-content {
      width: $checkbox-width;
    }
  }
  .brick-table-col-type-serial {
    min-width: table.$table-cell-serial-min-width;
    padding-left: table.$table-cell-padding-horizontal-serial;
    padding-right: table.$table-cell-padding-horizontal-serial;
    text-align: center;
  }
}
