Browse Source

Clear styles and delete unused

pull/11633/head
Chantsova Ekaterina 2 years ago
parent
commit
78b7ef6769
  1. 2
      ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.html
  2. 5
      ui-ngx/src/app/shared/components/time/timewindow-panel.component.html
  3. 2
      ui-ngx/src/app/shared/components/time/timewindow-panel.component.scss
  4. 23
      ui-ngx/src/app/shared/components/time/timezone-panel.component.html
  5. 18
      ui-ngx/src/app/shared/components/time/timezone-panel.component.scss
  6. 10
      ui-ngx/src/app/shared/components/time/timezone.component.html
  7. 54
      ui-ngx/src/app/shared/components/time/timezone.component.ts
  8. 13
      ui-ngx/src/app/shared/models/widget-settings.models.ts

2
ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.html

@ -25,7 +25,7 @@
<mat-icon class="material-icons">close</mat-icon> <mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
<form [formGroup]="timewindowForm" mat-dialog-content class="timewindow-settings-form mat-content"> <form [formGroup]="timewindowForm" mat-dialog-content class="timewindow-settings-form">
<mat-tab-group (selectedTabChange)="onTimewindowTypeChange()" [(selectedIndex)]="timewindow.selectedTab"> <mat-tab-group (selectedTabChange)="onTimewindowTypeChange()" [(selectedIndex)]="timewindow.selectedTab">
<mat-tab label="{{ 'timewindow.realtime' | translate }}"> <mat-tab label="{{ 'timewindow.realtime' | translate }}">
<div class="tb-flex column"> <div class="tb-flex column">

5
ui-ngx/src/app/shared/components/time/timewindow-panel.component.html

@ -15,7 +15,7 @@
limitations under the License. limitations under the License.
--> -->
<form [formGroup]="timewindowForm" class="mat-content"> <form [formGroup]="timewindowForm" class="tb-timewindow-panel-form">
<mat-tab-group [class.tb-headless]="historyOnly" <mat-tab-group [class.tb-headless]="historyOnly"
(selectedTabChange)="onTimewindowTypeChange()" [(selectedIndex)]="timewindow.selectedTab"> (selectedTabChange)="onTimewindowTypeChange()" [(selectedIndex)]="timewindow.selectedTab">
<mat-tab label="{{ 'timewindow.realtime' | translate }}"> <mat-tab label="{{ 'timewindow.realtime' | translate }}">
@ -121,8 +121,7 @@
</ng-container> </ng-container>
</div> </div>
</mat-tab> </mat-tab>
<mat-tab disabled labelClass="timewindow-config-btn"> <mat-tab *ngIf="isEdit" disabled labelClass="timewindow-config-btn">
<!-- <mat-tab *ngIf="isEdit" disabled>-->
<ng-template mat-tab-label> <ng-template mat-tab-label>
<button mat-icon-button (click)="openTimewindowConfig()"> <button mat-icon-button (click)="openTimewindowConfig()">
<mat-icon>settings</mat-icon> <mat-icon>settings</mat-icon>

2
ui-ngx/src/app/shared/components/time/timewindow-panel.component.scss

@ -28,7 +28,7 @@
gap: 12px; gap: 12px;
} }
.mat-content { .tb-timewindow-panel-form {
overflow: hidden; overflow: hidden;
.tb-flex { .tb-flex {

23
ui-ngx/src/app/shared/components/time/timezone-panel.component.html

@ -1,5 +1,22 @@
<form [formGroup]="timezoneForm" class="mat-content"> <!--
<section class="tb-form-panel">
Copyright © 2016-2024 The Thingsboard Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<form [formGroup]="timezoneForm">
<section class="tb-form-panel no-border">
<div class="tb-form-panel-title">{{ 'timezone.timezone' | translate }}</div> <div class="tb-form-panel-title">{{ 'timezone.timezone' | translate }}</div>
<tb-timezone-select [localBrowserTimezonePlaceholderOnEmpty]="localBrowserTimezonePlaceholderOnEmpty" <tb-timezone-select [localBrowserTimezonePlaceholderOnEmpty]="localBrowserTimezonePlaceholderOnEmpty"
formControlName="timezone" formControlName="timezone"
@ -9,7 +26,7 @@
</tb-timezone-select> </tb-timezone-select>
</section> </section>
</form> </form>
<div fxLayout="row" class="tb-panel-actions" fxLayoutAlign="end center"> <div class="tb-panel-actions tb-flex flex-end no-gap">
<button type="button" <button type="button"
mat-button mat-button
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"

18
ui-ngx/src/app/shared/components/time/timezone-panel.component.scss

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
@import "../../../../scss/constants";
:host { :host {
display: flex; display: flex;
@ -28,21 +27,4 @@
gap: 24px; gap: 24px;
} }
.tb-flex {
gap: 16px;
}
.mat-content {
overflow: hidden;
}
.mat-padding {
padding: 0 16px;
}
.hide-label {
margin-bottom: 5px;
margin-right: 5px;
}
} }

10
ui-ngx/src/app/shared/components/time/timezone.component.html

@ -22,7 +22,6 @@
type="button" type="button"
mat-raised-button color="primary" mat-raised-button color="primary"
(click)="toggleTimezone($event)"> (click)="toggleTimezone($event)">
<!-- <mat-icon class="material-icons">query_builder</mat-icon>-->
<span>{{displayValue()}}</span> <span>{{displayValue()}}</span>
</button> </button>
<button *ngIf="asButton && strokedButton" <button *ngIf="asButton && strokedButton"
@ -32,7 +31,6 @@
type="button" type="button"
mat-stroked-button color="primary" mat-stroked-button color="primary"
(click)="toggleTimezone($event)"> (click)="toggleTimezone($event)">
<!-- <mat-icon class="material-icons">query_builder</mat-icon>-->
<span>{{displayValue()}}</span> <span>{{displayValue()}}</span>
</button> </button>
<button *ngIf="asButton && flatButton" <button *ngIf="asButton && flatButton"
@ -42,7 +40,6 @@
type="button" type="button"
mat-button mat-button
(click)="toggleTimezone($event)"> (click)="toggleTimezone($event)">
<!-- <mat-icon class="material-icons">query_builder</mat-icon>-->
<span>{{displayValue()}}</span> <span>{{displayValue()}}</span>
</button> </button>
<section *ngIf="!asButton" <section *ngIf="!asButton"
@ -50,13 +47,8 @@
[class]="{'no-padding': noPadding}" [class]="{'no-padding': noPadding}"
[matTooltip]="tooltipValue()" [matTooltip]="tooltipValue()"
[matTooltipPosition]="tooltipPosition" [matTooltipPosition]="tooltipPosition"
[style]="timezoneComponentStyle"
(click)="toggleTimezone($event)"> (click)="toggleTimezone($event)">
<tb-icon *ngIf="computedTimezoneStyle.showIcon && computedTimezoneStyle.iconPosition === 'left'"
[style]="timezoneIconStyle">{{ computedTimezoneStyle.icon }}</tb-icon>
<div class="tb-timezone-label" [fxHide]="hideLabel"> <div class="tb-timezone-label" [fxHide]="hideLabel">
{{timezoneInfo}} {{displayValue()}}
</div> </div>
<tb-icon *ngIf="computedTimezoneStyle.showIcon && computedTimezoneStyle.iconPosition === 'right'"
[style]="timezoneIconStyle">{{ computedTimezoneStyle.icon }}</tb-icon>
</section> </section>

54
ui-ngx/src/app/shared/components/time/timezone.component.ts

@ -20,10 +20,8 @@ import {
forwardRef, forwardRef,
HostBinding, HostBinding,
Input, Input,
OnChanges,
OnInit, OnInit,
Renderer2, Renderer2,
SimpleChanges,
ViewContainerRef ViewContainerRef
} from '@angular/core'; } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
@ -31,13 +29,6 @@ import { TranslateService } from '@ngx-translate/core';
import { TooltipPosition } from '@angular/material/tooltip'; import { TooltipPosition } from '@angular/material/tooltip';
import { coerceBooleanProperty } from '@angular/cdk/coercion'; import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { coerceBoolean } from '@shared/decorators/coercion'; import { coerceBoolean } from '@shared/decorators/coercion';
import {
ComponentStyle,
defaultTimezoneStyle,
iconStyle,
textStyle,
TimezoneStyle
} from '@shared/models/widget-settings.models';
import { TimezonePanelComponent, TimezoneSelectionResult } from '@shared/components/time/timezone-panel.component'; import { TimezonePanelComponent, TimezoneSelectionResult } from '@shared/components/time/timezone-panel.component';
import { TbPopoverService } from '@shared/components/popover.service'; import { TbPopoverService } from '@shared/components/popover.service';
import { getTimezoneInfo, TimezoneInfo } from '@shared/models/time/time.models'; import { getTimezoneInfo, TimezoneInfo } from '@shared/models/time/time.models';
@ -56,7 +47,7 @@ import { TimeService } from '@core/services/time.service';
} }
] ]
}) })
export class TimezoneComponent implements ControlValueAccessor, OnInit, OnChanges { export class TimezoneComponent implements ControlValueAccessor, OnInit {
@HostBinding('class.no-margin') @HostBinding('class.no-margin')
@Input() @Input()
@ -91,24 +82,9 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit, OnChange
@coerceBoolean() @coerceBoolean()
hideLabel = false; hideLabel = false;
isEditValue = false;
@Input()
set isEdit(val) {
this.isEditValue = coerceBooleanProperty(val);
this.timezoneDisabled = this.isTimezoneDisabled();
}
get isEdit() {
return this.isEditValue;
}
@Input() @Input()
tooltipPosition: TooltipPosition = 'above'; tooltipPosition: TooltipPosition = 'above';
@Input()
timezoneStyle: TimezoneStyle;
@Input() @Input()
@coerceBoolean() @coerceBoolean()
disabled: boolean; disabled: boolean;
@ -155,10 +131,6 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit, OnChange
timezoneDisabled: boolean; timezoneDisabled: boolean;
computedTimezoneStyle: TimezoneStyle;
timezoneComponentStyle: ComponentStyle;
timezoneIconStyle: ComponentStyle;
private propagateChange = (_: any) => {}; private propagateChange = (_: any) => {};
constructor(private translate: TranslateService, constructor(private translate: TranslateService,
@ -170,19 +142,6 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit, OnChange
} }
ngOnInit() { ngOnInit() {
this.updateTimezoneStyle();
}
ngOnChanges(changes: SimpleChanges): void {
for (const propName of Object.keys(changes)) {
const change = changes[propName];
if (!change.firstChange && change.currentValue !== change.previousValue) {
if (propName === 'timezoneStyle') {
this.updateTimezoneStyle();
this.updateDisplayValue();
}
}
}
} }
toggleTimezone($event: Event) { toggleTimezone($event: Event) {
@ -221,17 +180,6 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit, OnChange
this.cd.detectChanges(); this.cd.detectChanges();
} }
private updateTimezoneStyle() {
if (!this.asButton) {
this.computedTimezoneStyle = {...defaultTimezoneStyle, ...(this.timezoneStyle || {})};
this.timezoneComponentStyle = textStyle(this.computedTimezoneStyle.font);
if (this.computedTimezoneStyle.color) {
this.timezoneComponentStyle.color = this.computedTimezoneStyle.color;
}
this.timezoneIconStyle = this.computedTimezoneStyle.iconSize ? iconStyle(this.computedTimezoneStyle.iconSize) : {};
}
}
registerOnChange(fn: any): void { registerOnChange(fn: any): void {
this.propagateChange = fn; this.propagateChange = fn;
} }

13
ui-ngx/src/app/shared/models/widget-settings.models.ts

@ -262,19 +262,6 @@ export const defaultTimewindowStyle: TimewindowStyle = {
displayTypePrefix: true displayTypePrefix: true
}; };
export interface TimezoneStyle {
showIcon: boolean;
icon?: string;
iconSize?: string;
iconPosition?: 'left' | 'right';
font?: Font;
color?: string;
}
export const defaultTimezoneStyle: TimezoneStyle = {
showIcon: false
};
export const constantColor = (color: string): ColorSettings => ({ export const constantColor = (color: string): ColorSettings => ({
type: ColorType.constant, type: ColorType.constant,
color, color,

Loading…
Cancel
Save