UI: Refactoring entity subtype list
This commit is contained in:
parent
95f37ee61b
commit
900bb9a57c
@ -24,7 +24,7 @@
|
||||
*ngFor="let entitySubtype of entitySubtypeList"
|
||||
[removable]="!disabled"
|
||||
(removed)="remove(entitySubtype)">
|
||||
{{entitySubtype}}
|
||||
{{customTranslate(entitySubtype)}}
|
||||
<mat-icon matChipRemove *ngIf="!disabled">close</mat-icon>
|
||||
</mat-chip-row>
|
||||
<input matInput type="text" placeholder="{{ !disabled ? ((!entitySubtypeList || !entitySubtypeList.length) ? placeholder : secondaryPlaceholder) : '' }}"
|
||||
@ -33,6 +33,7 @@
|
||||
(focusin)="onFocus()"
|
||||
formControlName="entitySubtype"
|
||||
matAutocompleteOrigin
|
||||
matChipInputAddOnBlur
|
||||
#origin="matAutocompleteOrigin"
|
||||
[matAutocompleteConnectedTo]="origin"
|
||||
[matAutocomplete]="entitySubtypeAutocomplete"
|
||||
@ -47,11 +48,6 @@
|
||||
<mat-option *ngFor="let entitySubtype of filteredEntitySubtypeList | async" [value]="entitySubtype">
|
||||
<span [innerHTML]="entitySubtype | highlight:searchText"></span>
|
||||
</mat-option>
|
||||
<mat-option *ngIf="!(filteredEntitySubtypeList | async)?.length" [value]="null">
|
||||
<span>
|
||||
{{ translate.get(noSubtypesMathingText, {entitySubtype: searchText}) | async }}
|
||||
</span>
|
||||
</mat-option>
|
||||
</mat-autocomplete>
|
||||
<div matSuffix>
|
||||
<ng-content select="[matSuffix]"></ng-content>
|
||||
|
||||
@ -33,6 +33,7 @@ import { FloatLabelType, MatFormFieldAppearance, SubscriptSizing } from '@angula
|
||||
import { coerceArray, coerceBoolean } from '@shared/decorators/coercion';
|
||||
import { PageLink } from '@shared/models/page/page-link';
|
||||
import { PageData } from '@shared/models/page/page-data';
|
||||
import { UtilsService } from '@core/services/utils.service';
|
||||
|
||||
@Component({
|
||||
selector: 'tb-entity-subtype-list',
|
||||
@ -129,6 +130,7 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit,
|
||||
private edgeService: EdgeService,
|
||||
private entityViewService: EntityViewService,
|
||||
private alarmService: AlarmService,
|
||||
private utils: UtilsService,
|
||||
private fb: FormBuilder) {
|
||||
this.entitySubtypeListFormGroup = this.fb.group({
|
||||
entitySubtypeList: [this.entitySubtypeList, this.required ? [Validators.required] : []],
|
||||
@ -372,4 +374,8 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit,
|
||||
}, 0);
|
||||
}
|
||||
|
||||
customTranslate(entity: string) {
|
||||
return this.utils.customTranslation(entity, entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user