2021-05-26 13:49:30 +03:00
|
|
|
<!--
|
|
|
|
|
|
2025-02-25 09:39:16 +02:00
|
|
|
Copyright © 2016-2025 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"
|
2024-10-17 10:43:29 +03:00
|
|
|
[class.tb-highlighted]="isHighlighted(widget)"
|
|
|
|
|
[class.tb-not-highlighted]="isNotHighlighted(widget)"
|
|
|
|
|
[class.mat-elevation-z4]="widget.dropShadow"
|
|
|
|
|
[class.tb-overflow-visible]="widgetComponent.widgetContext?.overflowVisible"
|
|
|
|
|
[class.tb-has-timewindow]="widget.hasTimewindow"
|
|
|
|
|
[class.tb-edit]="isEdit || isEditingWidget"
|
|
|
|
|
[class.tb-hover]="hovered"
|
|
|
|
|
[style]="widget.style">
|
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()">
|
2025-03-07 13:26:21 +02:00
|
|
|
<div class="flex items-center">
|
|
|
|
|
@for (action of widget.customHeaderActions; track action.name; let last = $last) {
|
|
|
|
|
<ng-container *ngTemplateOutlet="widgetHeaderActionButton; context:{ action, last }"></ng-container>
|
|
|
|
|
}
|
2025-03-07 11:09:39 +02:00
|
|
|
</div>
|
|
|
|
|
|
2023-02-17 19:24:01 +02:00
|
|
|
<button mat-icon-button *ngFor="let action of widget.widgetActions"
|
2024-11-01 19:43:31 +02:00
|
|
|
type="button"
|
2024-10-14 15:03:03 +03:00
|
|
|
[class.!hidden]="isEdit || !action.show"
|
2021-05-26 13:49:30 +03:00
|
|
|
(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
|
2024-11-01 19:43:31 +02:00
|
|
|
type="button"
|
2024-10-14 15:03:03 +03:00
|
|
|
[class.!hidden]="isEdit || !widget.enableFullscreen"
|
2024-06-13 20:09:59 +03:00
|
|
|
(click)="$event.stopPropagation(); widget.isFullscreen = !widget.isFullscreen; updateEditWidgetActionsTooltipState()"
|
2021-05-26 13:49:30 +03:00
|
|
|
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>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-10-17 10:43:29 +03:00
|
|
|
<div class="tb-widget-content" [class.tb-no-interaction]="disableWidgetInteraction">
|
2023-07-27 17:18:39 +03:00
|
|
|
<tb-widget #widgetComponent
|
2021-05-26 13:49:30 +03:00
|
|
|
[dashboardWidget]="widget"
|
2024-12-16 17:00:49 +02:00
|
|
|
[widget]="widget.widget"
|
2021-05-26 13:49:30 +03:00
|
|
|
[isEdit]="isEdit"
|
2024-02-01 19:16:37 +02:00
|
|
|
[isPreview]="isPreview"
|
2023-08-08 18:54:07 +03:00
|
|
|
[isMobile]="isMobile"
|
|
|
|
|
[widgetTitlePanel]="widgetTitlePanel">
|
2021-05-26 13:49:30 +03:00
|
|
|
</tb-widget>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-07-03 14:36:58 +03:00
|
|
|
<ng-template #widgetTitlePanel let-titleSuffixTemplate="titleSuffixTemplate">
|
2023-08-08 18:54:07 +03:00
|
|
|
<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>
|
2024-07-03 14:36:58 +03:00
|
|
|
<ng-container *ngTemplateOutlet="titleSuffixTemplate"></ng-container>
|
2023-08-08 18:54:07 +03:00
|
|
|
</div>
|
|
|
|
|
<tb-timewindow *ngIf="widget.hasTimewindow"
|
|
|
|
|
aggregation="{{widget.hasAggregation}}"
|
|
|
|
|
quickIntervalOnly="{{widget.onlyQuickInterval}}"
|
|
|
|
|
historyOnly="{{widget.onlyHistoryTimewindow}}"
|
|
|
|
|
alwaysDisplayTypePrefix
|
|
|
|
|
timezone="true"
|
|
|
|
|
noMargin
|
|
|
|
|
noPadding
|
|
|
|
|
[isEdit]="isEdit"
|
2024-12-16 17:00:49 +02:00
|
|
|
[timewindowStyle]="widget.widget.config.timewindowStyle"
|
|
|
|
|
[(ngModel)]="widget.widget.config.timewindow"
|
2023-08-08 18:54:07 +03:00
|
|
|
(ngModelChange)="widgetComponent.onTimewindowChanged($event)">
|
|
|
|
|
</tb-timewindow>
|
|
|
|
|
</div>
|
|
|
|
|
</ng-template>
|
2025-03-07 13:26:21 +02:00
|
|
|
|
|
|
|
|
<ng-template #widgetHeaderActionButton let-action="action" let-last="last">
|
|
|
|
|
@switch (action.buttonType) {
|
|
|
|
|
@case (widgetHeaderActionButtonType.icon) {
|
|
|
|
|
<button mat-icon-button
|
|
|
|
|
[style]="action.customButtonStyle"
|
|
|
|
|
[class.!hidden]="isEdit"
|
|
|
|
|
(click)="action.onAction($event)"
|
|
|
|
|
matTooltip="{{ action.displayName }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<tb-icon [style.color]="action.buttonColor">{{ action.icon }}</tb-icon>
|
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
@case (widgetHeaderActionButtonType.miniFab) {
|
|
|
|
|
<button mat-mini-fab
|
|
|
|
|
[style]="action.customButtonStyle"
|
|
|
|
|
[class.!hidden]="isEdit"
|
|
|
|
|
[class.mr-2]="!last"
|
|
|
|
|
[style.background-color]="action.buttonFillColor"
|
|
|
|
|
(click)="action.onAction($event)"
|
|
|
|
|
matTooltip="{{ action.displayName }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<tb-icon [style.color]="action.buttonColor">{{ action.icon }}</tb-icon>
|
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
@case (widgetHeaderActionButtonType.basic) {
|
|
|
|
|
<button [class.!hidden]="isEdit" mat-button
|
|
|
|
|
[class.mr-2]="!last"
|
|
|
|
|
[style]="action.customButtonStyle"
|
|
|
|
|
(click)="action.onAction($event)"
|
|
|
|
|
matTooltip="{{ action.displayName }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<tb-icon matButtonIcon *ngIf="action.showIcon" [style.color]="action.buttonColor">{{ action.icon }}</tb-icon>
|
|
|
|
|
<span [style.color]="action.buttonColor">{{ action.displayName }}</span>
|
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
@case (widgetHeaderActionButtonType.raised) {
|
|
|
|
|
<button [class.!hidden]="isEdit" mat-raised-button
|
|
|
|
|
[class.mr-2]="!last"
|
|
|
|
|
[style]="action.customButtonStyle"
|
|
|
|
|
[style.background-color]="action.buttonFillColor"
|
|
|
|
|
(click)="action.onAction($event)"
|
|
|
|
|
matTooltip="{{ action.displayName }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<tb-icon matButtonIcon *ngIf="action.showIcon" [style.color]="action.buttonColor">{{ action.icon }}</tb-icon>
|
|
|
|
|
<span [style.color]="action.buttonColor">{{ action.displayName }}</span>
|
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
@case (widgetHeaderActionButtonType.stroked) {
|
|
|
|
|
<button [class.!hidden]="isEdit" mat-stroked-button
|
|
|
|
|
[class.mr-2]="!last"
|
|
|
|
|
[style]="action.customButtonStyle"
|
|
|
|
|
[style.border-color]="action.buttonBorderColor"
|
|
|
|
|
[style.background-color]="action.buttonFillColor"
|
|
|
|
|
(click)="action.onAction($event)"
|
|
|
|
|
matTooltip="{{ action.displayName }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<tb-icon matButtonIcon *ngIf="action.showIcon" [style.color]="action.buttonColor">{{ action.icon }}</tb-icon>
|
|
|
|
|
<span [style.color]="action.buttonColor">{{ action.displayName }}</span>
|
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
@case (widgetHeaderActionButtonType.flat) {
|
|
|
|
|
<button [class.!hidden]="isEdit" mat-flat-button
|
|
|
|
|
[class.mr-2]="!last"
|
|
|
|
|
[style]="action.customButtonStyle"
|
|
|
|
|
[style.background-color]="action.buttonFillColor"
|
|
|
|
|
[style.border-color]="action.buttonBorderColor"
|
|
|
|
|
(click)="action.onAction($event)"
|
|
|
|
|
matTooltip="{{ action.displayName }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<tb-icon matButtonIcon *ngIf="action.showIcon" [style.color]="action.buttonColor">{{ action.icon }}</tb-icon>
|
|
|
|
|
<span [style.color]="action.buttonColor">{{ action.displayName }}</span>
|
|
|
|
|
</button>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</ng-template>
|