2021-05-26 13:49:30 +03:00
|
|
|
<!--
|
|
|
|
|
|
2024-01-09 10:46:16 +02:00
|
|
|
Copyright © 2016-2024 The Thingsboard Authors
|
2021-05-26 13:49:30 +03:00
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
-->
|
2021-12-22 17:15:10 +02:00
|
|
|
<div #tbWidgetElement tb-fullscreen [fullscreen]="widget.isFullscreen"
|
2021-05-26 13:49:30 +03:00
|
|
|
[fullscreenBackgroundStyle]="dashboardStyle"
|
|
|
|
|
[fullscreenBackgroundImage]="backgroundImage"
|
|
|
|
|
(fullscreenChanged)="onFullscreenChanged($event)"
|
|
|
|
|
class="tb-widget"
|
|
|
|
|
[ngClass]="{
|
|
|
|
|
'tb-highlighted': isHighlighted(widget),
|
|
|
|
|
'tb-not-highlighted': isNotHighlighted(widget),
|
|
|
|
|
'mat-elevation-z4': widget.dropShadow,
|
2022-07-12 18:47:40 +03:00
|
|
|
'tb-has-timewindow': widget.hasTimewindow,
|
|
|
|
|
'tb-edit': isEdit
|
2021-05-26 13:49:30 +03:00
|
|
|
}"
|
|
|
|
|
[ngStyle]="widget.style"
|
|
|
|
|
(mousedown)="onMouseDown($event)"
|
|
|
|
|
(click)="onClicked($event)"
|
|
|
|
|
(contextmenu)="onContextMenu($event)">
|
2023-07-27 17:18:39 +03:00
|
|
|
<div *ngIf="!!widgetComponent.widgetContext?.inited"
|
2023-08-08 18:54:07 +03:00
|
|
|
class="tb-widget-header">
|
|
|
|
|
<ng-container *ngIf="!widgetComponent.widgetContext?.embedTitlePanel">
|
|
|
|
|
<ng-container *ngTemplateOutlet="widgetTitlePanel"></ng-container>
|
|
|
|
|
</ng-container>
|
2021-05-26 13:49:30 +03:00
|
|
|
<div *ngIf="widget.showWidgetActions"
|
|
|
|
|
class="tb-widget-actions"
|
2023-08-08 18:54:07 +03:00
|
|
|
[class]="{'tb-widget-actions-absolute': !(widget.showWidgetTitlePanel && !widgetComponent.widgetContext?.embedTitlePanel && (widget.showTitle||widget.hasAggregation))}"
|
2021-05-26 13:49:30 +03:00
|
|
|
(mousedown)="$event.stopPropagation()">
|
2023-02-17 19:24:01 +02:00
|
|
|
<button mat-icon-button *ngFor="let action of widget.customHeaderActions"
|
2021-05-26 13:49:30 +03:00
|
|
|
[fxShow]="!isEdit"
|
|
|
|
|
(click)="action.onAction($event)"
|
|
|
|
|
matTooltip="{{ action.displayName }}"
|
|
|
|
|
matTooltipPosition="above">
|
2023-07-21 18:26:14 +03:00
|
|
|
<tb-icon>{{ action.icon }}</tb-icon>
|
2021-05-26 13:49:30 +03:00
|
|
|
</button>
|
2023-02-17 19:24:01 +02:00
|
|
|
<button mat-icon-button *ngFor="let action of widget.widgetActions"
|
2021-05-26 13:49:30 +03:00
|
|
|
[fxShow]="!isEdit && action.show"
|
|
|
|
|
(click)="action.onAction($event)"
|
|
|
|
|
matTooltip="{{ action.name | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
2023-07-21 18:26:14 +03:00
|
|
|
<tb-icon>{{ action.icon }}</tb-icon>
|
2021-05-26 13:49:30 +03:00
|
|
|
</button>
|
2023-02-17 19:24:01 +02:00
|
|
|
<button mat-icon-button
|
2021-05-26 13:49:30 +03:00
|
|
|
[fxShow]="!isEdit && widget.enableFullscreen"
|
|
|
|
|
(click)="$event.stopPropagation(); widget.isFullscreen = !widget.isFullscreen"
|
|
|
|
|
matTooltip="{{(widget.isFullscreen ? 'fullscreen.exit' : 'fullscreen.expand') | translate}}"
|
|
|
|
|
matTooltipPosition="above">
|
2023-07-21 18:26:14 +03:00
|
|
|
<tb-icon>{{ widget.isFullscreen ? 'fullscreen_exit' : 'fullscreen' }}</tb-icon>
|
2021-05-26 13:49:30 +03:00
|
|
|
</button>
|
2023-02-17 19:24:01 +02:00
|
|
|
<button mat-icon-button
|
2021-05-26 13:49:30 +03:00
|
|
|
[fxShow]="isEditActionEnabled && !widget.isFullscreen"
|
|
|
|
|
(click)="onEdit($event)"
|
|
|
|
|
matTooltip="{{ 'widget.edit' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
2023-07-21 18:26:14 +03:00
|
|
|
<tb-icon>edit</tb-icon>
|
2021-05-26 13:49:30 +03:00
|
|
|
</button>
|
2023-02-17 19:24:01 +02:00
|
|
|
<button mat-icon-button
|
2021-05-26 13:49:30 +03:00
|
|
|
[fxShow]="isExportActionEnabled && !widget.isFullscreen"
|
|
|
|
|
(click)="onExport($event)"
|
|
|
|
|
matTooltip="{{ 'widget.export' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
2023-07-21 18:26:14 +03:00
|
|
|
<tb-icon>file_download</tb-icon>
|
2021-05-26 13:49:30 +03:00
|
|
|
</button>
|
2023-02-17 19:24:01 +02:00
|
|
|
<button mat-icon-button
|
2021-05-26 13:49:30 +03:00
|
|
|
[fxShow]="isRemoveActionEnabled && !widget.isFullscreen"
|
|
|
|
|
(click)="onRemove($event);"
|
|
|
|
|
matTooltip="{{ 'widget.remove' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
2023-07-21 18:26:14 +03:00
|
|
|
<tb-icon>close</tb-icon>
|
2021-05-26 13:49:30 +03:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-07-27 17:18:39 +03:00
|
|
|
<div class="tb-widget-content" [ngClass]="{'tb-no-interaction': disableWidgetInteraction}">
|
|
|
|
|
<tb-widget #widgetComponent
|
2021-05-26 13:49:30 +03:00
|
|
|
[dashboardWidget]="widget"
|
|
|
|
|
[isEdit]="isEdit"
|
2023-08-08 18:54:07 +03:00
|
|
|
[isMobile]="isMobile"
|
|
|
|
|
[widgetTitlePanel]="widgetTitlePanel">
|
2021-05-26 13:49:30 +03:00
|
|
|
</tb-widget>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-08-08 18:54:07 +03:00
|
|
|
<ng-template #widgetTitlePanel>
|
|
|
|
|
<div *ngIf="widget.showWidgetTitlePanel"
|
|
|
|
|
class="tb-widget-title">
|
|
|
|
|
<div *ngIf="widget.showTitle"
|
|
|
|
|
[matTooltip]="widget.titleTooltip"
|
|
|
|
|
matTooltipClass="tb-tooltip-multiline"
|
|
|
|
|
matTooltipPosition="above"
|
|
|
|
|
class="title-row">
|
|
|
|
|
<tb-icon *ngIf="widget.showTitleIcon" [style]="widget.titleIconStyle">{{widget.titleIcon}}</tb-icon>
|
|
|
|
|
<div class="mat-subtitle-1 title" [style]="widget.titleStyle">
|
|
|
|
|
{{widget.title$ | async}}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<tb-timewindow *ngIf="widget.hasTimewindow"
|
|
|
|
|
aggregation="{{widget.hasAggregation}}"
|
|
|
|
|
quickIntervalOnly="{{widget.onlyQuickInterval}}"
|
|
|
|
|
historyOnly="{{widget.onlyHistoryTimewindow}}"
|
|
|
|
|
alwaysDisplayTypePrefix
|
|
|
|
|
timezone="true"
|
|
|
|
|
noMargin
|
|
|
|
|
noPadding
|
|
|
|
|
[isEdit]="isEdit"
|
|
|
|
|
[timewindowStyle]="widgetComponent.widget.config.timewindowStyle"
|
|
|
|
|
[(ngModel)]="widgetComponent.widget.config.timewindow"
|
|
|
|
|
(ngModelChange)="widgetComponent.onTimewindowChanged($event)">
|
|
|
|
|
</tb-timewindow>
|
|
|
|
|
</div>
|
|
|
|
|
</ng-template>
|