2023-07-07 17:27:59 +03:00
|
|
|
<!--
|
|
|
|
|
|
2025-02-25 09:39:16 +02:00
|
|
|
Copyright © 2016-2025 The Thingsboard Authors
|
2023-07-07 17:27:59 +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.
|
|
|
|
|
|
|
|
|
|
-->
|
2024-10-09 19:36:42 +03:00
|
|
|
<mat-form-field appearance="outline" class="tb-inline-field tb-suffix-show-on-hover flex-1" subscriptSizing="dynamic" style="width: 100%;">
|
2023-07-07 17:27:59 +03:00
|
|
|
<input matInput #unitInput [formControl]="unitsFormControl"
|
|
|
|
|
placeholder="{{ 'widget-config.set' | translate }}"
|
|
|
|
|
(focusin)="onFocus()"
|
|
|
|
|
[matAutocomplete]="unitsAutocomplete">
|
2023-09-12 15:07:33 +03:00
|
|
|
<button *ngIf="unitsFormControl.value && !disabled && unitsFormControl.valid"
|
2023-07-07 17:27:59 +03:00
|
|
|
type="button"
|
2023-07-12 15:14:42 +03:00
|
|
|
class="tb-icon-24"
|
2023-07-07 17:27:59 +03:00
|
|
|
matSuffix mat-icon-button aria-label="Clear"
|
|
|
|
|
(click)="clear()">
|
|
|
|
|
<mat-icon class="material-icons">close</mat-icon>
|
|
|
|
|
</button>
|
2023-09-12 15:07:33 +03:00
|
|
|
<mat-icon matSuffix
|
|
|
|
|
matTooltipPosition="above"
|
|
|
|
|
matTooltipClass="tb-error-tooltip"
|
|
|
|
|
[matTooltip]="'widget-config.units-required' | translate"
|
|
|
|
|
*ngIf="unitsFormControl.hasError('required')" class="material-icons tb-suffix-show-always tb-error">
|
|
|
|
|
warning
|
|
|
|
|
</mat-icon>
|
2023-07-07 17:27:59 +03:00
|
|
|
<mat-autocomplete
|
|
|
|
|
#unitsAutocomplete="matAutocomplete"
|
|
|
|
|
class="tb-autocomplete tb-unit-input-autocomplete"
|
|
|
|
|
panelWidth="fit-content"
|
|
|
|
|
[displayWith]="displayUnitFn">
|
|
|
|
|
<mat-option *ngFor="let unit of filteredUnits | async" [value]="unit">
|
2024-10-09 19:36:42 +03:00
|
|
|
<span class="tb-unit-name flex-1" [innerHTML]="unit.name | highlight:searchText:true:'ig'"></span>
|
2023-07-07 17:27:59 +03:00
|
|
|
<span class="tb-unit-symbol" [innerHTML]="unit.symbol | highlight:searchText:true:'ig'"></span>
|
|
|
|
|
</mat-option>
|
|
|
|
|
</mat-autocomplete>
|
|
|
|
|
</mat-form-field>
|