mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
refactor: enhance site dropdown component structure and improve template syntax
- Updated the HTML structure for better readability and maintainability. - Replaced the ngFor syntax with a more concise @for syntax. - Improved the conditional rendering syntax for loading state. - Removed unused CommonModule import from the component.
This commit is contained in:
+7
-3
@@ -13,14 +13,18 @@
|
|||||||
placeholder="{{placeholder | translate}}"
|
placeholder="{{placeholder | translate}}"
|
||||||
(selectionChange)="selectedSite($event)">
|
(selectionChange)="selectedSite($event)">
|
||||||
<mat-select-trigger class="adf-sites-dropdown-select-trigger">
|
<mat-select-trigger class="adf-sites-dropdown-select-trigger">
|
||||||
{{ selected?.entry.title | translate}}
|
{{ selected?.entry?.title | translate}}
|
||||||
</mat-select-trigger>
|
</mat-select-trigger>
|
||||||
<mat-option *ngFor="let site of siteList?.list.entries;" [value]="site">
|
@for (site of siteList?.list?.entries; track site?.entry?.id) {
|
||||||
|
<mat-option [value]="site">
|
||||||
{{ site.entry.title | translate}}
|
{{ site.entry.title | translate}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
<mat-option *ngIf="showLoading()" disabled="true" data-automation-id="site-loading">
|
}
|
||||||
|
@if (showLoading()) {
|
||||||
|
<mat-option disabled="true" data-automation-id="site-loading">
|
||||||
{{ 'ADF_DROPDOWN.LOADING' | translate}}
|
{{ 'ADF_DROPDOWN.LOADING' | translate}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
|
}
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+2
-5
@@ -22,11 +22,8 @@ import { MatSelectChange, MatSelectModule } from '@angular/material/select';
|
|||||||
import { LiveAnnouncer } from '@angular/cdk/a11y';
|
import { LiveAnnouncer } from '@angular/cdk/a11y';
|
||||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||||
import { SitesService } from '../../common/services/sites.service';
|
import { SitesService } from '../../common/services/sites.service';
|
||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
||||||
|
|
||||||
/* eslint-disable no-shadow */
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
|
|
||||||
export const Relations = {
|
export const Relations = {
|
||||||
Members: 'members',
|
Members: 'members',
|
||||||
@@ -37,7 +34,7 @@ export type Relations = (typeof Relations)[keyof typeof Relations];
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-sites-dropdown',
|
selector: 'adf-sites-dropdown',
|
||||||
imports: [CommonModule, TranslatePipe, MatFormFieldModule, MatSelectModule, InfiniteSelectScrollDirective],
|
imports: [TranslatePipe, MatFormFieldModule, MatSelectModule, InfiniteSelectScrollDirective],
|
||||||
templateUrl: './sites-dropdown.component.html',
|
templateUrl: './sites-dropdown.component.html',
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'adf-sites-dropdown' }
|
host: { class: 'adf-sites-dropdown' }
|
||||||
|
|||||||
Reference in New Issue
Block a user