All files / components/tek-image image.ts

9.09% Statements 2/22
100% Branches 0/0
0% Functions 0/1
9.09% Lines 2/22

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 771x           1x                                                                                                                                            
import { ComponentRender } from '@zeedhi/common';
import { IImage } from './interfaces';
 
/**
 * Teknisa component
 */
export class Image extends ComponentRender implements IImage {
  /**
   * Route path
   */
  public to: string = '';
 
  /**
   * Image source.
   */
  public src: string = '';
 
  /**
   * Defines the component height. Possible values for this property can be
   * <samp>'auto', '100%', '400px' or 400</samp>
   */
  public height: string | number = 'auto';
 
  /**
   * Defines the component min height. Possible values for this property can be
   * <samp>'auto', '100%', '400px' or 400</samp>
   */
  public minHeight: string | number = 'auto';
 
  /**
   * Defines the component max height. Possible values for this property can be
   * <samp>'auto', '100%', '400px' or 400</samp>
   */
  public maxHeight: string | number = 'none';
 
  /**
   * Set component height to fill all space available
   */
  public fillHeight: boolean = false;
 
  /**
   * Defines the component width. Possible values for this property can be
   * <samp>'auto', '100%', '400px' or 400</samp>
   */
  public width: string | number = 'auto';
 
  /**
   * Defines the component min width. Possible values for this property can be
   * <samp>'auto', '100%', '400px' or 400</samp>
   */
  public minWidth: string | number = 'auto';
 
  /**
   * Defines the component max height. Possible values for this property can be
   * <samp>'auto', '100%', '400px' or 400</samp>
   */
  public maxWidth: string | number = 'none';
 
  /**
   * Creates a new instance of ImgLink
   * @param props Image Link props
   */
  constructor(props: IImage) {
    super(props);
    this.to = this.getInitValue('to', props.to, this.to);
    this.src = this.getInitValue('src', props.src, this.src);
    this.height = this.getInitValue('height', props.height, this.height);
    this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
    this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
    this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
    this.width = this.getInitValue('width', props.width, this.width);
    this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
    this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
    this.createAccessors();
  }
}