Propagate UI changes.

This commit is contained in:
Igor Kulikov 2020-02-26 12:36:34 +02:00
parent a122563619
commit cf175acaa4
4 changed files with 73 additions and 28 deletions

View File

@ -91,22 +91,9 @@ export class LegendConfigPanelComponent extends PageComponent implements OnInit
} }
this.legendConfigForm.patchValue( this.legendConfigForm.patchValue(
{ {
position, position
showMin: false,
showMax: false,
showAvg: false,
showTotal: false
}, {emitEvent: false} }, {emitEvent: false}
); );
this.legendConfigForm.get('showMin').disable({emitEvent: false});
this.legendConfigForm.get('showMax').disable({emitEvent: false});
this.legendConfigForm.get('showAvg').disable({emitEvent: false});
this.legendConfigForm.get('showTotal').disable({emitEvent: false});
} else {
this.legendConfigForm.get('showMin').enable({emitEvent: false});
this.legendConfigForm.get('showMax').enable({emitEvent: false});
this.legendConfigForm.get('showAvg').enable({emitEvent: false});
this.legendConfigForm.get('showTotal').enable({emitEvent: false});
} }
} }

View File

@ -15,7 +15,8 @@
limitations under the License. limitations under the License.
--> -->
<table class="tb-legend"> <table class="tb-legend" [ngClass]="isRowDirection ? 'tb-legend-row' : 'tb-legend-column'"
[ngStyle]="{ marginRight: isRowDirection && !displayHeader ? 'auto' : '20px' }">
<thead> <thead>
<tr class="tb-legend-header" *ngIf="!isRowDirection"> <tr class="tb-legend-header" *ngIf="!isRowDirection">
<th colspan="2"></th> <th colspan="2"></th>
@ -26,7 +27,8 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr class="tb-legend-keys" *ngFor="let legendKey of legendKeys()" [ngClass]="{ 'tb-row-direction': isRowDirection }"> <ng-container *ngIf="!isRowDirection">
<tr class="tb-legend-keys" *ngFor="let legendKey of legendKeys()">
<td><span class="tb-legend-line" [ngStyle]="{backgroundColor: legendKey.dataKey.color}"></span></td> <td><span class="tb-legend-line" [ngStyle]="{backgroundColor: legendKey.dataKey.color}"></span></td>
<td class="tb-legend-label" <td class="tb-legend-label"
(click)="toggleHideData(legendKey.dataIndex)" (click)="toggleHideData(legendKey.dataIndex)"
@ -38,5 +40,41 @@
<td class="tb-legend-value" *ngIf="legendConfig.showAvg === true">{{ legendData.data[legendKey.dataIndex].avg }}</td> <td class="tb-legend-value" *ngIf="legendConfig.showAvg === true">{{ legendData.data[legendKey.dataIndex].avg }}</td>
<td class="tb-legend-value" *ngIf="legendConfig.showTotal === true">{{ legendData.data[legendKey.dataIndex].total }}</td> <td class="tb-legend-value" *ngIf="legendConfig.showTotal === true">{{ legendData.data[legendKey.dataIndex].total }}</td>
</tr> </tr>
</ng-container>
<tr *ngIf="isRowDirection" class="tb-legend-keys" [ngClass]="{ 'tb-row-direction': !displayHeader }">
<td></td>
<td *ngFor="let legendKey of legendKeys()">
<span class="tb-legend-line" [ngStyle]="{backgroundColor: legendKey.dataKey.color}"></span>
<span class="tb-legend-label"
(click)="toggleHideData(legendKey.dataIndex)"
[ngClass]="{ 'tb-hidden-label': legendData.keys[legendKey.dataIndex].dataKey.hidden}">
{{ legendKey.dataKey.label }}
</span>
</td>
</tr>
<tr class="tb-legend-keys" *ngIf="isRowDirection && legendConfig.showMin === true">
<td class="tb-legend-type">{{ 'legend.min' | translate }}</td>
<td class="tb-legend-value" *ngFor="let legendKey of legendKeys()">
{{ legendData.data[legendKey.dataIndex].min }}
</td>
</tr>
<tr class="tb-legend-keys" *ngIf="isRowDirection && legendConfig.showMax === true">
<td class="tb-legend-type">{{ 'legend.max' | translate }}</td>
<td class="tb-legend-value" *ngFor="let legendKey of legendKeys()">
{{ legendData.data[legendKey.dataIndex].max }}
</td>
</tr>
<tr class="tb-legend-keys" *ngIf="isRowDirection && legendConfig.showAvg === true">
<td class="tb-legend-type">{{ 'legend.avg' | translate }}</td>
<td class="tb-legend-value" *ngFor="let legendKey of legendKeys()">
{{ legendData.data[legendKey.dataIndex].avg }}
</td>
</tr>
<tr class="tb-legend-keys" *ngIf="isRowDirection && legendConfig.showTotal === true">
<td class="tb-legend-type">{{ 'legend.total' | translate }}</td>
<td class="tb-legend-value" *ngFor="let legendKey of legendKeys()">
{{ legendData.data[legendKey.dataIndex].total }}
</td>
</tr>
</tbody> </tbody>
</table> </table>

View File

@ -15,9 +15,17 @@
*/ */
:host { :host {
table.tb-legend { table.tb-legend {
width: 100%;
font-size: 12px; font-size: 12px;
&.tb-legend-column {
width: 100%;
}
&.tb-legend-row {
width: auto;
margin-left: auto;
}
.tb-legend-header, .tb-legend-header,
.tb-legend-value { .tb-legend-value {
text-align: right; text-align: right;
@ -42,6 +50,15 @@
white-space: nowrap; white-space: nowrap;
} }
.tb-legend-type {
min-width: 50px;
padding: 0 10px 1px 0;
font-weight: 700;
color: rgb(255, 110, 64);
text-align: right;
white-space: nowrap;
}
.tb-legend-line { .tb-legend-line {
display: inline-block; display: inline-block;
width: 15px; width: 15px;
@ -50,7 +67,9 @@
} }
.tb-legend-label { .tb-legend-label {
padding: 2px 10px;
text-align: left; text-align: left;
white-space: nowrap;
outline: none; outline: none;
&.tb-horizontal { &.tb-horizontal {

View File

@ -46,5 +46,6 @@
#widget-container { #widget-container {
min-height: 0; min-height: 0;
min-width: 0;
} }
} }