Commit 6b7c95c0405d33a72eeebcb4bdde756d548b683e
1 parent
bf3a8875
UI: Fixed - widgets showed two errors at the same time.
Showing
5 changed files
with
15 additions
and
4 deletions
... | ... | @@ -122,7 +122,7 @@ |
122 | 122 | </div> |
123 | 123 | </div> |
124 | 124 | <div class="tb-multiple-input__errors" fxLayout="column" fxLayoutAlign="center center" style="height: 100%;" |
125 | - *ngIf="!entityDetected || !isAllParametersValid"> | |
125 | + *ngIf="(!entityDetected || !isAllParametersValid) && datasourceDetected"> | |
126 | 126 | <div style="text-align: center; font-size: 18px; color: #a0a0a0;" [fxHide]="entityDetected"> |
127 | 127 | {{ 'widgets.input-widgets.no-entity-selected' | translate }} |
128 | 128 | </div> | ... | ... |
... | ... | @@ -117,6 +117,7 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni |
117 | 117 | resetButtonLabel: string; |
118 | 118 | |
119 | 119 | entityDetected = false; |
120 | + datasourceDetected = false; | |
120 | 121 | isAllParametersValid = true; |
121 | 122 | |
122 | 123 | multipleInputFormGroup: FormGroup; |
... | ... | @@ -203,7 +204,8 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni |
203 | 204 | } |
204 | 205 | |
205 | 206 | private updateDatasources() { |
206 | - if (this.datasources && this.datasources.length) { | |
207 | + this.datasourceDetected = this.datasources?.length !== 0; | |
208 | + if (this.datasourceDetected) { | |
207 | 209 | this.entityDetected = true; |
208 | 210 | let keyIndex = 0; |
209 | 211 | this.datasources.forEach((datasource) => { | ... | ... |
... | ... | @@ -17,6 +17,8 @@ |
17 | 17 | --> |
18 | 18 | <div fxLayout="column" fxLayoutAlign="center center" style="width: 100%; height: 100%;"> |
19 | 19 | <canvas fxFlex #canvas [ngStyle]="{display: qrCodeText && !invalidQrCodeText ? 'block' : 'none'}"></canvas> |
20 | - <div *ngIf="!qrCodeText && !invalidQrCodeText" translate>entity.no-data</div> | |
21 | - <div *ngIf="invalidQrCodeText" translate>widgets.invalid-qr-code-text</div> | |
20 | + <div *ngIf="datasourceDetected"> | |
21 | + <div *ngIf="!qrCodeText && !invalidQrCodeText" style="text-align: center" translate>entity.no-data</div> | |
22 | + <div *ngIf="invalidQrCodeText" style="text-align: center" translate>widgets.invalid-qr-code-text</div> | |
23 | + </div> | |
22 | 24 | </div> | ... | ... |
... | ... | @@ -54,6 +54,7 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte |
54 | 54 | |
55 | 55 | qrCodeText: string; |
56 | 56 | invalidQrCodeText = false; |
57 | + datasourceDetected = false; | |
57 | 58 | |
58 | 59 | private viewInited: boolean; |
59 | 60 | private scheduleUpdateCanvas: boolean; |
... | ... | @@ -95,6 +96,8 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte |
95 | 96 | data: [] |
96 | 97 | } |
97 | 98 | ]; |
99 | + } else { | |
100 | + this.datasourceDetected = false; | |
98 | 101 | } |
99 | 102 | if (initialData) { |
100 | 103 | const data = parseData(initialData); |
... | ... | @@ -103,6 +106,7 @@ export class QrCodeWidgetComponent extends PageComponent implements OnInit, Afte |
103 | 106 | safeExecute(this.qrCodeTextFunction, [dataSourceData]) : this.settings.qrCodeTextPattern; |
104 | 107 | const replaceInfo = processPattern(pattern, dataSourceData); |
105 | 108 | qrCodeText = fillPattern(pattern, replaceInfo, dataSourceData); |
109 | + this.datasourceDetected = true; | |
106 | 110 | } |
107 | 111 | this.updateQrCodeText(qrCodeText); |
108 | 112 | } | ... | ... |
... | ... | @@ -45,6 +45,7 @@ $error-height: 14px !default; |
45 | 45 | font-weight: 500; |
46 | 46 | color: #757575; |
47 | 47 | white-space: nowrap; |
48 | + z-index: 1; | |
48 | 49 | |
49 | 50 | .off-label { |
50 | 51 | color: #b7b5b5; |
... | ... | @@ -86,6 +87,8 @@ $error-height: 14px !default; |
86 | 87 | :host ::ng-deep { |
87 | 88 | .tb-switch { |
88 | 89 | .switch { |
90 | + z-index: 1; | |
91 | + | |
89 | 92 | mat-slide-toggle { |
90 | 93 | position: absolute; |
91 | 94 | top: 0; | ... | ... |