@@ -24,10 +24,12 @@ import {
2424 changeDetection : ChangeDetectionStrategy . OnPush ,
2525 template : `
2626 <div class="bar-gauge" (htLayoutChange)="this.checkNearMaxValue()">
27- <div *ngIf="this.title" class="title">{{ this.title | htDisplayTitle }}</div>
28- <div class="count">
29- {{ this.totalValue | number }} / {{ this.maxValue | number }}
30- <span class="units" *ngIf="this.units">{{ this.units }}</span>
27+ <div class="header-data" [ngClass]="this.display">
28+ <div *ngIf="this.title" class="title">{{ this.title | htDisplayTitle }}</div>
29+ <div class="count">
30+ {{ this.totalValue | number }} / {{ this.maxValue | number }}
31+ <span class="units" *ngIf="this.units">{{ this.units }}</span>
32+ </div>
3133 </div>
3234 <div class="bar">
3335 <div #maxValueBar class="max-value-bar" [ngClass]="{ 'over-max-value': this.overMaxValue }">
@@ -45,7 +47,7 @@ import {
4547 </div>
4648 </div>
4749 </div>
48- <div class="legend">
50+ <div *ngIf="this.display === ' ${ BarGaugeStyle . Regular } '" class="legend">
4951 <div class="legend-item" *ngFor="let segment of this.barSegments">
5052 <span class="legend-symbol" [style.backgroundColor]="segment.color"></span>
5153 <span class="legend-value" *ngIf="this.barSegments.length > 1">{{ segment.value | number }}</span>
@@ -79,6 +81,9 @@ export class BarGaugeComponent implements OnChanges, AfterViewInit {
7981 @Input ( )
8082 public segments ?: Segment [ ] = [ ] ;
8183
84+ @Input ( )
85+ public display : BarGaugeStyle = BarGaugeStyle . Regular ;
86+
8287 public barSegments : BarSegment [ ] = [ ] ;
8388 public totalValue : number = 0 ;
8489 public overMaxValue : boolean = false ;
@@ -148,3 +153,8 @@ export interface Segment {
148153interface BarSegment extends Segment {
149154 percentage : number ;
150155}
156+
157+ export const enum BarGaugeStyle {
158+ Regular = 'regular' ,
159+ Compact = 'compact'
160+ }
0 commit comments