All files / lib/grid/cell grid-cell.component.ts

100% Statements 127/127
73.68% Branches 14/19
100% Functions 9/9
100% Lines 127/127

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 1281x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 478x 478x 478x 1x 1x 1x 1x 1x 1x 308x 308x 308x 1x 1x 1x 1x 1x 1x 308x 308x 308x 1x 1x 1x 1x 1x 1x 308x 308x 308x 1x 1x 1x 1x 1x 1x 16x 16x 16x 1x 1x 1x 1x 1x 1x 8x 8x 8x 1x 1x 1x 1236x 1236x 1236x 1x 1x 1x  
/*******************************************************************************
 * Copyright bei
 * Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa
 *
 *******************************************************************************/
import { Component, HostBinding, Input } from '@angular/core';
 
import { GridComponent } from '../grid.component';
 
export type CellValue =
  | '1'
  | '2'
  | '3'
  | '4'
  | '5'
  | '6'
  | '7'
  | '8'
  | '9'
  | '10'
  | '11'
  | '12';
 
const CSSGuaranteedInvalidValue = 'initial'; // https://www.w3.org/TR/css-variables-1/#guaranteed-invalid
 
/**
 * A Cell component representing a single cell in a row.
 */
@Component({
  selector: 'gc-grid-cell',
  templateUrl: './grid-cell.component.html',
  styleUrls: ['./grid-cell.component.css'],
})
export class GridCellComponent {
  /** @ignore */
  @HostBinding('style.--gc-grid-columns-xs')
  // CSS variables which are not used must be reset explicitly to avoid inheriting from parents in nested grids
  protected _xs: number | typeof CSSGuaranteedInvalidValue =
    CSSGuaranteedInvalidValue;
 
  /** @ignore */
  @HostBinding('style.--gc-grid-columns-sm')
  protected _sm: number | typeof CSSGuaranteedInvalidValue =
    CSSGuaranteedInvalidValue;
 
  /** @ignore */
  @HostBinding('style.--gc-grid-columns-md')
  protected _md: number | typeof CSSGuaranteedInvalidValue =
    CSSGuaranteedInvalidValue;
 
  /** @ignore */
  @HostBinding('style.--gc-grid-columns-lg')
  protected _lg: number | typeof CSSGuaranteedInvalidValue =
    CSSGuaranteedInvalidValue;
 
  /** @ignore */
  @HostBinding('style.--gc-grid-columns-xl')
  protected _xl: number | typeof CSSGuaranteedInvalidValue =
    CSSGuaranteedInvalidValue;
 
  /** @ignore */
  @HostBinding('style.--gc-grid-columns-xxl')
  protected _xxl: number | typeof CSSGuaranteedInvalidValue =
    CSSGuaranteedInvalidValue;
 
  /**
   * Define how many columns are spanned when size is XS
   * @default undefined
   */
  @Input()
  public set xs(cells: CellValue | undefined) {
    this._xs = cells !== undefined ? Number(cells) : CSSGuaranteedInvalidValue;
  }
 
  /**
   * Define how many columns are spanned when size is SM
   * @default undefined
   */
  @Input()
  public set sm(cells: CellValue | undefined) {
    this._sm = cells !== undefined ? Number(cells) : CSSGuaranteedInvalidValue;
  }
 
  /**
   * Define how many columns are spanned when size is MD
   * @default undefined
   */
  @Input()
  public set md(cells: CellValue | undefined) {
    this._md = cells !== undefined ? Number(cells) : CSSGuaranteedInvalidValue;
  }
 
  /**
   * Define how many columns are spanned when size is LG
   * @default undefined
   */
  @Input()
  public set lg(cells: CellValue | undefined) {
    this._lg = cells !== undefined ? Number(cells) : CSSGuaranteedInvalidValue;
  }
 
  /**
   * Define how many columns are spanned when size is XL
   * @default undefined
   */
  @Input()
  public set xl(cells: CellValue | undefined) {
    this._xl = cells !== undefined ? Number(cells) : CSSGuaranteedInvalidValue;
  }
 
  /**
   * Define how many columns are spanned when size is XXL
   * @default undefined
   */
  @Input()
  public set xxl(cells: CellValue | undefined) {
    this._xxl = cells !== undefined ? Number(cells) : CSSGuaranteedInvalidValue;
  }
 
  /** @ignore */
  @HostBinding('class')
  protected get referenceClass(): string {
    return `gc-grid-reference-${this.grid.reference}`;
  }
 
  constructor(private readonly grid: GridComponent) {}
}