File

C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-liveapps-lib/src/lib/components/live-apps-milestone/live-apps-milestone.component.ts

Description

Render a dynamic milestone SVG

alt-text

Implements

OnInit

Example

<tcla-live-apps-milestone></tcla-live-apps-milestone>

Metadata

selector tcla-live-apps-milestone
styleUrls ./live-apps-milestone.component.css
templateUrl ./live-apps-milestone.component.html

Index

Properties
Methods
Inputs

Constructor

constructor(caseStatesService: TcCaseStatesService)
Parameters :
Name Type Optional
caseStatesService TcCaseStatesService No

Inputs

isFirst
Type : boolean
isLast
Type : boolean
isTerminal
Type : boolean
label
Type : string
phase
Type : string
previousPhase
Type : string
small
Type : boolean

Small rendering vs normal - defaults to normal

status
Type : string

Methods

ngOnInit
ngOnInit()
Returns : void

Properties

Public milestoneSvg
Type : string
Public sectionSVG
Type : SafeHtml
Public type
Type : string
import {Component, Input, OnInit} from '@angular/core';
import {SafeHtml} from '@angular/platform-browser';
import {TcCaseStatesService} from '../../services/tc-case-states.service';

/**
 * Render a dynamic milestone SVG
 *
 * ![alt-text](../live-apps-milestone.png "Documents Component Image")
 *
 *@example <tcla-live-apps-milestone></tcla-live-apps-milestone>
 */
@Component({
  selector: 'tcla-live-apps-milestone',
  templateUrl: './live-apps-milestone.component.html',
  styleUrls: ['./live-apps-milestone.component.css']
})
export class LiveAppsMilestoneComponent implements OnInit {
  @Input() isFirst: boolean;
  @Input() isLast: boolean;
  @Input() status: string;
  @Input() label: string;

  /**
   * Small rendering vs normal - defaults to normal
   */
  @Input() small: boolean;
  @Input() isTerminal: boolean;
  @Input() phase: string;
  @Input() previousPhase: string;

  public sectionSVG: SafeHtml;
  public milestoneSvg: string;
  public type: string;

  constructor(protected caseStatesService: TcCaseStatesService) { }

  ngOnInit() {
    // work out which section the MS trailer is (first/middle/end)
    const section = this.isFirst ? 'first' : (this.isLast ? 'end' : 'middle');
    // construct the icon filename
    const svgFileName = section + '-section-' + this.status + '.svg';
    // work out correct class
    let bgClass;
    if (this.status === 'completed' && this.isTerminal) {
      bgClass = 'tc-ms-' + 'completed-terminal' + '-bg';
    } else {
      bgClass = 'tc-ms-' + this.status + '-bg';
    }
    if (this.isFirst || this.isLast) {
      this.type = 'end-ms';
    } else {
      this.type = 'middle-ms';
    }
    this.milestoneSvg = 'tcs-milestone-' + this.status + (this.isTerminal ? '-terminal' : '');

    this.sectionSVG = this.caseStatesService.getMilestoneSectionSvg(this.label, 'tc-ms-label', bgClass, svgFileName, this.small ? '16px' : undefined);
  }

}
<div class="tcs-milestone-block" fxLayout="row" fxLayoutAlign="center start">
  <mat-icon class="tc-ms-circle-icon" [ngClass]="{'small': small}" [svgIcon]="milestoneSvg"></mat-icon>
  <div class="tc-ms-detail {{type}}" [ngClass]="{'small': small}" [innerHtml]="sectionSVG" fxLayoutAlign="start center"></div>
</div>

./live-apps-milestone.component.css

.tc-ms-circle-icon {
  height: 36px;
  width: 36px;
  margin-right: -8px;
  margin-left: -8px;
}

.tcs-milestone-block {
  margin-bottom: 1px;
  margin-top: 1px;
}

.tc-ms-circle-icon.small {
  height: 27px;
  width: 27px;
  margin-right: -6px;
  margin-left: -6px;
}

.tc-ms-detail.small {
  width: 70.5px;
  height: 27px;
}

.tc-ms-detail.small.middle-ms {
  width: 123px;
  height: 27px;
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""