[ADF-5433] enable strict mode for angular templates (#2191)

* enable strict mode for angular templates

* update formatting

* fix lint

* fix formatting

* remove deprecated method

* upgrade to latest ADF

* restore error handler
This commit is contained in:
Denys Vuika 2021-06-25 12:51:56 +01:00 committed by GitHub
parent d593193cf3
commit 35d6fb7b5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 150 additions and 80 deletions

View File

@ -74,8 +74,8 @@
matInput matInput
type="text" type="text"
[value]="getStringParamValue(param)" [value]="getStringParamValue(param)"
(blur)="setParamValue(param, $event.target.value)" (blur)="onParamValueChanged($event, param)"
(keyup.enter)="setParamValue(param, $event.target.value)" (keyup.enter)="onParamValueChanged($event, param)"
/> />
</mat-form-field> </mat-form-field>
</ng-container> </ng-container>

View File

@ -120,6 +120,11 @@ export class SettingsComponent implements OnInit {
} }
} }
onParamValueChanged(event: Event, param: SettingsParameterRef) {
const target = event.target as HTMLInputElement;
this.setParamValue(param, target.value);
}
getBooleanParamValue(param: SettingsParameterRef): boolean { getBooleanParamValue(param: SettingsParameterRef): boolean {
const result = this.storage.getItem(param.key); const result = this.storage.getItem(param.key);
if (result) { if (result) {

View File

@ -9,7 +9,7 @@
> >
<adf-toolbar class="adf-toolbar--inline" info-drawer-buttons> <adf-toolbar class="adf-toolbar--inline" info-drawer-buttons>
<ng-container *ngFor="let entry of actions; trackBy: trackByActionId"> <ng-container *ngFor="let entry of actions; trackBy: trackByActionId">
<aca-toolbar-action [actionRef]="entry" [color]="entry?.color"></aca-toolbar-action> <aca-toolbar-action [actionRef]="entry" [color]="getEntryColor(entry)"></aca-toolbar-action>
</ng-container> </ng-container>
</adf-toolbar> </adf-toolbar>
@ -19,7 +19,7 @@
[label]="tab.title" [label]="tab.title"
> >
<adf-dynamic-tab <adf-dynamic-tab
[node]="displayNode" [node]="$any(displayNode)"
[id]="tab.component" [id]="tab.component"
[attr.data-automation-id]="tab.component" [attr.data-automation-id]="tab.component"
> >

View File

@ -32,6 +32,7 @@ import { AppExtensionService } from '../../services/app.extension.service';
import { ContentApiService } from '../../services/content-api.service'; import { ContentApiService } from '../../services/content-api.service';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { ThemePalette } from '@angular/material/core';
@Component({ @Component({
selector: 'aca-info-drawer', selector: 'aca-info-drawer',
templateUrl: './info-drawer.component.html' templateUrl: './info-drawer.component.html'
@ -99,6 +100,10 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
return action.id; return action.id;
} }
getEntryColor(entry: any): ThemePalette {
return entry?.color;
}
private close() { private close() {
this.store.dispatch(new ToggleInfoDrawerAction()); this.store.dispatch(new ToggleInfoDrawerAction());
} }

View File

@ -25,6 +25,8 @@
import { Component, ViewEncapsulation, ChangeDetectionStrategy, Input, DoCheck, ChangeDetectorRef } from '@angular/core'; import { Component, ViewEncapsulation, ChangeDetectionStrategy, Input, DoCheck, ChangeDetectorRef } from '@angular/core';
import { ContentActionRef } from '@alfresco/adf-extensions'; import { ContentActionRef } from '@alfresco/adf-extensions';
import { ToolbarButtonType } from '../toolbar-button/toolbar-button.component';
import { ThemePalette } from '@angular/material/core';
@Component({ @Component({
selector: 'aca-toolbar-action', selector: 'aca-toolbar-action',
@ -36,10 +38,10 @@ import { ContentActionRef } from '@alfresco/adf-extensions';
}) })
export class ToolbarActionComponent implements DoCheck { export class ToolbarActionComponent implements DoCheck {
@Input() @Input()
type = 'icon-button'; type: ToolbarButtonType = ToolbarButtonType.ICON_BUTTON;
@Input() @Input()
color = ''; color: ThemePalette;
@Input() @Input()
actionRef: ContentActionRef; actionRef: ContentActionRef;

View File

@ -26,6 +26,7 @@
import { Component, Input, ViewEncapsulation } from '@angular/core'; import { Component, Input, ViewEncapsulation } from '@angular/core';
import { ContentActionRef } from '@alfresco/adf-extensions'; import { ContentActionRef } from '@alfresco/adf-extensions';
import { AppExtensionService } from '../../../services/app.extension.service'; import { AppExtensionService } from '../../../services/app.extension.service';
import { ThemePalette } from '@angular/material/core';
export enum ToolbarButtonType { export enum ToolbarButtonType {
ICON_BUTTON = 'icon-button', ICON_BUTTON = 'icon-button',
@ -43,7 +44,7 @@ export class ToolbarButtonComponent {
type: ToolbarButtonType = ToolbarButtonType.ICON_BUTTON; type: ToolbarButtonType = ToolbarButtonType.ICON_BUTTON;
@Input() @Input()
color = ''; color: ThemePalette;
@Input() @Input()
actionRef: ContentActionRef; actionRef: ContentActionRef;

View File

@ -6,7 +6,7 @@
</button> </button>
<mat-menu #childMenu="matMenu" class="app-create-menu__sub-menu"> <mat-menu #childMenu="matMenu" class="app-create-menu__sub-menu">
<ng-container *ngFor="let child of actionRef.children; trackBy: trackById"> <ng-container *ngFor="let child of actionRef.children; trackBy: trackByActionId">
<app-toolbar-menu-item [actionRef]="child"></app-toolbar-menu-item> <app-toolbar-menu-item [actionRef]="child"></app-toolbar-menu-item>
</ng-container> </ng-container>
</mat-menu> </mat-menu>
@ -23,7 +23,7 @@
<ng-container *ngSwitchDefault> <ng-container *ngSwitchDefault>
<button <button
[id]="actionRef.id" [id]="actionRef.id"
role="menuItem" role="menuitem"
mat-menu-item mat-menu-item
[role]="'menuitem'" [role]="'menuitem'"
[disabled]="actionRef.disabled" [disabled]="actionRef.disabled"

View File

@ -56,7 +56,7 @@ export class ToolbarMenuItemComponent {
return !!(actionRef && actionRef.actions && actionRef.actions.click); return !!(actionRef && actionRef.actions && actionRef.actions.click);
} }
trackById(_: number, obj: { id: string }) { trackByActionId(_: number, obj: ContentActionRef): string {
return obj.id; return obj.id;
} }
} }

View File

@ -11,7 +11,7 @@
</button> </button>
<mat-menu #menu="matMenu" [overlapTrigger]="false"> <mat-menu #menu="matMenu" [overlapTrigger]="false">
<ng-container *ngFor="let child of actionRef.children; trackBy: trackById"> <ng-container *ngFor="let child of actionRef.children; trackBy: trackByActionId">
<ng-container [ngSwitch]="child.type"> <ng-container [ngSwitch]="child.type">
<ng-container *ngSwitchCase="'custom'"> <ng-container *ngSwitchCase="'custom'">
<adf-dynamic-component [id]="child.component" [data]="child.data"></adf-dynamic-component> <adf-dynamic-component [id]="child.component" [data]="child.data"></adf-dynamic-component>

View File

@ -26,6 +26,7 @@
import { Component, Input, ViewEncapsulation, HostListener, ViewChild } from '@angular/core'; import { Component, Input, ViewEncapsulation, HostListener, ViewChild } from '@angular/core';
import { ContentActionRef } from '@alfresco/adf-extensions'; import { ContentActionRef } from '@alfresco/adf-extensions';
import { MatMenuTrigger } from '@angular/material/menu'; import { MatMenuTrigger } from '@angular/material/menu';
import { ThemePalette } from '@angular/material/core';
@Component({ @Component({
selector: 'app-toolbar-menu', selector: 'app-toolbar-menu',
@ -38,16 +39,17 @@ export class ToolbarMenuComponent {
actionRef: ContentActionRef; actionRef: ContentActionRef;
@Input() @Input()
color = ''; color: ThemePalette;
@ViewChild('matTrigger') matTrigger: MatMenuTrigger; @ViewChild('matTrigger')
matTrigger: MatMenuTrigger;
@HostListener('document:keydown.Escape') @HostListener('document:keydown.Escape')
handleKeydownEscape() { handleKeydownEscape() {
this.matTrigger.closeMenu(); this.matTrigger.closeMenu();
} }
trackById(_: number, obj: { id: string }) { trackByActionId(_: number, obj: ContentActionRef): string {
return obj.id; return obj.id;
} }
} }

View File

@ -8,7 +8,7 @@
<mat-menu #childMenu="matMenu"> <mat-menu #childMenu="matMenu">
<ng-container <ng-container
*ngFor="let child of actionRef.children; trackBy: trackById" *ngFor="let child of actionRef.children; trackBy: trackByActionId"
> >
<app-context-menu-item [actionRef]="child"></app-context-menu-item> <app-context-menu-item [actionRef]="child"></app-context-menu-item>
</ng-container> </ng-container>

View File

@ -49,7 +49,7 @@ export class ContextMenuItemComponent {
return !!(actionRef && actionRef.actions && actionRef.actions.click); return !!(actionRef && actionRef.actions && actionRef.actions.click);
} }
trackById(_: number, obj: { id: string }) { trackByActionId(_: number, obj: ContentActionRef): string {
return obj.id; return obj.id;
} }
} }

View File

@ -2,7 +2,7 @@
<div style="visibility: hidden" [matMenuTriggerFor]="rootMenu"></div> <div style="visibility: hidden" [matMenuTriggerFor]="rootMenu"></div>
<mat-menu #rootMenu="matMenu" class="aca-context-menu" hasBackdrop="false" acaContextMenuOutsideEvent (clickOutside)="onClickOutsideEvent()"> <mat-menu #rootMenu="matMenu" class="aca-context-menu" hasBackdrop="false" acaContextMenuOutsideEvent (clickOutside)="onClickOutsideEvent()">
<ng-container *ngFor="let entry of actions; trackBy: trackById" [ngSwitch]="entry.type"> <ng-container *ngFor="let entry of actions; trackBy: trackByActionId" [ngSwitch]="entry.type">
<ng-container *ngSwitchDefault> <ng-container *ngSwitchDefault>
<button mat-menu-item [id]="entry.id" (click)="runAction(entry.actions.click)"> <button mat-menu-item [id]="entry.id" (click)="runAction(entry.actions.click)">
<adf-icon [value]="entry.icon"></adf-icon> <adf-icon [value]="entry.icon"></adf-icon>
@ -21,7 +21,7 @@
</button> </button>
<mat-menu #childMenu="matMenu"> <mat-menu #childMenu="matMenu">
<ng-container *ngFor="let child of entry.children; trackBy: trackById"> <ng-container *ngFor="let child of entry.children; trackBy: trackByActionId">
<app-context-menu-item [actionRef]="child"></app-context-menu-item> <app-context-menu-item [actionRef]="child"></app-context-menu-item>
</ng-container> </ng-container>
</mat-menu> </mat-menu>

View File

@ -32,7 +32,7 @@ import { takeUntil } from 'rxjs/operators';
import { ContentActionRef } from '@alfresco/adf-extensions'; import { ContentActionRef } from '@alfresco/adf-extensions';
import { ContextMenuOverlayRef } from './context-menu-overlay'; import { ContextMenuOverlayRef } from './context-menu-overlay';
import { CONTEXT_MENU_DIRECTION } from './direction.token'; import { CONTEXT_MENU_DIRECTION } from './direction.token';
import { Directionality } from '@angular/cdk/bidi'; import { Direction } from '@angular/cdk/bidi';
import { AppExtensionService } from '@alfresco/aca-shared'; import { AppExtensionService } from '@alfresco/aca-shared';
@Component({ @Component({
@ -63,7 +63,7 @@ export class ContextMenuComponent implements OnInit, OnDestroy, AfterViewInit {
private contextMenuOverlayRef: ContextMenuOverlayRef, private contextMenuOverlayRef: ContextMenuOverlayRef,
private extensions: AppExtensionService, private extensions: AppExtensionService,
private store: Store<AppStore>, private store: Store<AppStore>,
@Inject(CONTEXT_MENU_DIRECTION) public direction: Directionality @Inject(CONTEXT_MENU_DIRECTION) public direction: Direction
) {} ) {}
onClickOutsideEvent() { onClickOutsideEvent() {
@ -96,7 +96,7 @@ export class ContextMenuComponent implements OnInit, OnDestroy, AfterViewInit {
setTimeout(() => this.trigger.openMenu(), 0); setTimeout(() => this.trigger.openMenu(), 0);
} }
trackById(_: number, obj: { id: string }) { trackByActionId(_: number, obj: ContentActionRef): string {
return obj.id; return obj.id;
} }
} }

View File

@ -25,7 +25,7 @@
import { Injectable, Injector, ComponentRef } from '@angular/core'; import { Injectable, Injector, ComponentRef } from '@angular/core';
import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay';
import { ComponentPortal, PortalInjector } from '@angular/cdk/portal'; import { ComponentPortal } from '@angular/cdk/portal';
import { ContextMenuOverlayRef } from './context-menu-overlay'; import { ContextMenuOverlayRef } from './context-menu-overlay';
import { ContextMenuComponent } from './context-menu.component'; import { ContextMenuComponent } from './context-menu.component';
import { ContextmenuOverlayConfig } from './interfaces'; import { ContextmenuOverlayConfig } from './interfaces';
@ -68,13 +68,19 @@ export class ContextMenuService {
return containerRef.instance; return containerRef.instance;
} }
private createInjector(contextmenuOverlayRef: ContextMenuOverlayRef): PortalInjector { private createInjector(contextmenuOverlayRef: ContextMenuOverlayRef): Injector {
const injectionTokens = new WeakMap(); const injectionTokens = new WeakMap();
injectionTokens.set(ContextMenuOverlayRef, contextmenuOverlayRef); injectionTokens.set(ContextMenuOverlayRef, contextmenuOverlayRef);
injectionTokens.set(CONTEXT_MENU_DIRECTION, this.direction); injectionTokens.set(CONTEXT_MENU_DIRECTION, this.direction);
return new PortalInjector(this.injector, injectionTokens); return Injector.create({
parent: this.injector,
providers: [
{ provide: ContextMenuOverlayRef, useValue: contextmenuOverlayRef },
{ provide: CONTEXT_MENU_DIRECTION, useValue: this.direction }
]
});
} }
private getOverlayConfig(config: ContextmenuOverlayConfig): OverlayConfig { private getOverlayConfig(config: ContextmenuOverlayConfig): OverlayConfig {

View File

@ -37,7 +37,7 @@
[overlapTrigger]="false" [overlapTrigger]="false"
yPosition="below" yPosition="below"
> >
<div role="menu" *ngFor="let action of createActions; trackBy: trackById"> <div role="menu" *ngFor="let action of createActions; trackBy: trackByActionId">
<app-toolbar-menu-item [actionRef]="action"></app-toolbar-menu-item> <app-toolbar-menu-item [actionRef]="action"></app-toolbar-menu-item>
</div> </div>
</mat-menu> </mat-menu>

View File

@ -63,7 +63,7 @@ export class CreateMenuComponent implements OnInit, OnDestroy {
this.onDestroy$.complete(); this.onDestroy$.complete();
} }
trackById(_: number, obj: { id: string }) { trackByActionId(_: number, obj: ContentActionRef): string {
return obj.id; return obj.id;
} }
} }

View File

@ -16,15 +16,15 @@
acaDocumentList acaDocumentList
acaContextActions acaContextActions
[display]="documentDisplayMode$ | async" [display]="documentDisplayMode$ | async"
[node]="list" [node]="$any(list)"
[loading]="isLoading" [loading]="isLoading"
selectionMode="single" selectionMode="single"
[navigate]="false" [navigate]="false"
[sorting]="['title', 'asc']" [sorting]="['title', 'asc']"
sortingMode="client" sortingMode="client"
(node-dblclick)="navigateTo($event.detail?.node)" (node-dblclick)="handleNodeClick($event)"
[imageResolver]="imageResolver" [imageResolver]="imageResolver"
(name-click)="navigateTo($event.detail?.node)" (name-click)="handleNodeClick($event)"
> >
<adf-custom-empty-content-template> <adf-custom-empty-content-template>
<adf-empty-content <adf-empty-content
@ -36,7 +36,7 @@
</adf-custom-empty-content-template> </adf-custom-empty-content-template>
<data-columns> <data-columns>
<ng-container *ngFor="let column of columns; trackBy: trackById"> <ng-container *ngFor="let column of columns; trackBy: trackByColumnId">
<ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)"> <ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)">
<data-column <data-column
[key]="column.key" [key]="column.key"

View File

@ -86,6 +86,10 @@ export class FavoriteLibrariesComponent extends PageComponent implements OnInit
} }
} }
handleNodeClick(event: Event) {
this.navigateTo((event as CustomEvent).detail?.node);
}
onChangePageSize(pagination: Pagination) { onChangePageSize(pagination: Pagination) {
this.preferences.paginationSize = pagination.maxItems; this.preferences.paginationSize = pagination.maxItems;
this.getList(pagination); this.getList(pagination);

View File

@ -22,16 +22,19 @@
[sorting]="['modifiedAt', 'desc']" [sorting]="['modifiedAt', 'desc']"
sortingMode="client" sortingMode="client"
[imageResolver]="imageResolver" [imageResolver]="imageResolver"
(node-dblclick)="onNodeDoubleClick($event.detail?.node)" (node-dblclick)="handleNodeClick($event)"
(name-click)="onNodeDoubleClick($event.detail?.node)" (name-click)="handleNodeClick($event)"
> >
<adf-custom-empty-content-template> <adf-custom-empty-content-template>
<adf-empty-content icon="star_rate" [title]="'APP.BROWSE.FAVORITES.EMPTY_STATE.TITLE'" subtitle="APP.BROWSE.FAVORITES.EMPTY_STATE.TEXT"> <adf-empty-content
icon="star_rate"
[title]="'APP.BROWSE.FAVORITES.EMPTY_STATE.TITLE'"
subtitle="APP.BROWSE.FAVORITES.EMPTY_STATE.TEXT">
</adf-empty-content> </adf-empty-content>
</adf-custom-empty-content-template> </adf-custom-empty-content-template>
<data-columns> <data-columns>
<ng-container *ngFor="let column of columns; trackBy: trackById"> <ng-container *ngFor="let column of columns; trackBy: trackByColumnId">
<ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)"> <ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)">
<data-column <data-column
[key]="column.key" [key]="column.key"

View File

@ -101,4 +101,8 @@ export class FavoritesComponent extends PageComponent implements OnInit {
} }
} }
} }
handleNodeClick(event: Event) {
this.onNodeDoubleClick((event as CustomEvent).detail?.node);
}
} }

View File

@ -31,14 +31,14 @@
[imageResolver]="imageResolver" [imageResolver]="imageResolver"
[headerFilters]="true" [headerFilters]="true"
[filterValue]="queryParams" [filterValue]="queryParams"
(node-dblclick)="navigateTo($event.detail?.node)" (node-dblclick)="handleNodeClick($event)"
(name-click)="navigateTo($event.detail?.node)" (name-click)="handleNodeClick($event)"
(sorting-changed)="onSortingChanged($event)" (sorting-changed)="onSortingChanged($event)"
(filterSelection)="onFilterSelected($event)" (filterSelection)="onFilterSelected($event)"
(error)="onError()" (error)="onError()"
> >
<data-columns> <data-columns>
<ng-container *ngFor="let column of columns; trackBy: trackById"> <ng-container *ngFor="let column of columns; trackBy: trackByColumnId">
<ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)"> <ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)">
<data-column <data-column
[key]="column.key" [key]="column.key"

View File

@ -96,7 +96,7 @@ describe('FilesComponent', () => {
uploadService = TestBed.inject(UploadService); uploadService = TestBed.inject(UploadService);
router = TestBed.inject(Router); router = TestBed.inject(Router);
route = TestBed.get(ActivatedRoute); route = TestBed.inject(ActivatedRoute);
nodeActionsService = TestBed.inject(NodeActionsService); nodeActionsService = TestBed.inject(NodeActionsService);
contentApi = TestBed.inject(ContentApiService); contentApi = TestBed.inject(ContentApiService);
spyContent = spyOn(contentApi, 'getNode'); spyContent = spyOn(contentApi, 'getNode');

View File

@ -193,6 +193,10 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
} }
} }
handleNodeClick(event: Event) {
this.navigateTo((event as CustomEvent).detail?.node);
}
onBreadcrumbNavigate(route: PathElementEntity) { onBreadcrumbNavigate(route: PathElementEntity) {
this.documentList.resetNewFolderPagination(); this.documentList.resetNewFolderPagination();

View File

@ -14,7 +14,7 @@
<adf-toolbar-divider></adf-toolbar-divider> <adf-toolbar-divider></adf-toolbar-divider>
<ng-container *ngFor="let actionRef of actions; trackBy: trackByActionId"> <ng-container *ngFor="let actionRef of actions; trackBy: trackByActionId">
<aca-toolbar-action [actionRef]="actionRef" color="default"> <aca-toolbar-action [actionRef]="actionRef">
</aca-toolbar-action> </aca-toolbar-action>
</ng-container> </ng-container>
</adf-layout-header> </adf-layout-header>

View File

@ -44,7 +44,7 @@ export class AppHeaderComponent implements OnInit {
@Input() expandedSidenav = true; @Input() expandedSidenav = true;
appName$: Observable<string>; appName$: Observable<string>;
headerColor$: Observable<string>; headerColor$: Observable<any>;
logo$: Observable<string>; logo$: Observable<string>;
actions: Array<ContentActionRef> = []; actions: Array<ContentActionRef> = [];

View File

@ -124,7 +124,7 @@
</mat-card-content> </mat-card-content>
<mat-card-actions align="end" *ngIf="edit && canUpdateLibrary"> <mat-card-actions align="end" *ngIf="edit && canUpdateLibrary">
<button mat-button color="secondary" (click)="cancel()"> <button mat-button (click)="cancel()">
{{ 'LIBRARY.DIALOG.CANCEL' | translate }} {{ 'LIBRARY.DIALOG.CANCEL' | translate }}
</button> </button>
<button mat-button color="primary" [disabled]="form.invalid || form.pristine" (click)="update()"> <button mat-button color="primary" [disabled]="form.invalid || form.pristine" (click)="update()">

View File

@ -22,8 +22,8 @@
[sorting]="['title', 'asc']" [sorting]="['title', 'asc']"
sortingMode="client" sortingMode="client"
[imageResolver]="imageResolver" [imageResolver]="imageResolver"
(node-dblclick)="navigateTo($event.detail?.node)" (node-dblclick)="handleNodeClick($event)"
(name-click)="navigateTo($event.detail?.node)" (name-click)="handleNodeClick($event)"
> >
<adf-custom-empty-content-template> <adf-custom-empty-content-template>
<adf-empty-content <adf-empty-content
@ -35,7 +35,7 @@
</adf-custom-empty-content-template> </adf-custom-empty-content-template>
<data-columns> <data-columns>
<ng-container *ngFor="let column of columns; trackBy: trackById"> <ng-container *ngFor="let column of columns; trackBy: trackByColumnId">
<ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)"> <ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)">
<data-column <data-column
[key]="column.key" [key]="column.key"
@ -70,7 +70,7 @@
</div> </div>
<div class="sidebar" *ngIf="infoDrawerOpened$ | async"> <div class="sidebar" *ngIf="infoDrawerOpened$ | async">
<aca-info-drawer [node]="selection.library"></aca-info-drawer> <aca-info-drawer [node]="$any(selection).library"></aca-info-drawer>
</div> </div>
</aca-page-layout-content> </aca-page-layout-content>
</aca-page-layout> </aca-page-layout>

View File

@ -72,4 +72,8 @@ export class LibrariesComponent extends PageComponent implements OnInit {
this.store.dispatch(new NavigateLibraryAction(node.entry.guid)); this.store.dispatch(new NavigateLibraryAction(node.entry.guid));
} }
} }
handleNodeClick(event: Event) {
this.navigateTo((event as CustomEvent).detail?.node);
}
} }

View File

@ -25,7 +25,7 @@
import { DocumentListComponent, ShareDataRow } from '@alfresco/adf-content-services'; import { DocumentListComponent, ShareDataRow } from '@alfresco/adf-content-services';
import { ShowHeaderMode } from '@alfresco/adf-core'; import { ShowHeaderMode } from '@alfresco/adf-core';
import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions'; import { ContentActionRef, DocumentListPresetRef, SelectionState } from '@alfresco/adf-extensions';
import { OnDestroy, OnInit, OnChanges, ViewChild, SimpleChanges, Directive } from '@angular/core'; import { OnDestroy, OnInit, OnChanges, ViewChild, SimpleChanges, Directive } from '@angular/core';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging } from '@alfresco/js-api'; import { MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging } from '@alfresco/js-api';
@ -163,6 +163,10 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
return obj.id; return obj.id;
} }
trackByColumnId(_: number, obj: DocumentListPresetRef): string {
return obj.id;
}
private isOutletPreviewUrl(): boolean { private isOutletPreviewUrl(): boolean {
return location.href.includes('viewer:view'); return location.href.includes('viewer:view');
} }

View File

@ -10,8 +10,8 @@
[showRightSidebar]="true" [showRightSidebar]="true"
[allowDownload]="false" [allowDownload]="false"
[allowFullScreen]="false" [allowFullScreen]="false"
[canNavigateBefore]="previousNodeId" [canNavigateBefore]="!!previousNodeId"
[canNavigateNext]="nextNodeId" [canNavigateNext]="!!nextNodeId"
[overlayMode]="true" [overlayMode]="true"
(showViewerChange)="onVisibilityChanged($event)" (showViewerChange)="onVisibilityChanged($event)"
(navigateBefore)="onNavigateBefore($event)" (navigateBefore)="onNavigateBefore($event)"

View File

@ -22,8 +22,8 @@
[sorting]="['modifiedAt', 'desc']" [sorting]="['modifiedAt', 'desc']"
sortingMode="client" sortingMode="client"
[imageResolver]="imageResolver" [imageResolver]="imageResolver"
(node-dblclick)="onNodeDoubleClick($event.detail?.node)" (node-dblclick)="handleNodeClick($event)"
(name-click)="onNodeDoubleClick($event.detail?.node)" (name-click)="handleNodeClick($event)"
> >
<adf-custom-empty-content-template> <adf-custom-empty-content-template>
<adf-empty-content icon="access_time" [title]="'APP.BROWSE.RECENT.EMPTY_STATE.TITLE'" subtitle="APP.BROWSE.RECENT.EMPTY_STATE.TEXT"> <adf-empty-content icon="access_time" [title]="'APP.BROWSE.RECENT.EMPTY_STATE.TITLE'" subtitle="APP.BROWSE.RECENT.EMPTY_STATE.TEXT">
@ -31,7 +31,7 @@
</adf-custom-empty-content-template> </adf-custom-empty-content-template>
<data-columns> <data-columns>
<ng-container *ngFor="let column of columns; trackBy: trackById"> <ng-container *ngFor="let column of columns; trackBy: trackByColumnId">
<ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)"> <ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)">
<data-column <data-column
[key]="column.key" [key]="column.key"

View File

@ -76,6 +76,10 @@ export class RecentFilesComponent extends PageComponent implements OnInit {
} }
} }
handleNodeClick(event: Event) {
this.onNodeDoubleClick((event as CustomEvent).detail?.node);
}
private onFileUploadedEvent() { private onFileUploadedEvent() {
this.reload(); this.reload();
} }

View File

@ -53,11 +53,11 @@
[sorting]="['name', 'asc']" [sorting]="['name', 'asc']"
[node]="data" [node]="data"
[imageResolver]="imageResolver" [imageResolver]="imageResolver"
(node-dblclick)="navigateTo($event.detail?.node)" (node-dblclick)="handleNodeClick($event)"
(name-click)="navigateTo($event.detail?.node)" (name-click)="handleNodeClick($event)"
> >
<data-columns> <data-columns>
<ng-container *ngFor="let column of columns; trackBy: trackById"> <ng-container *ngFor="let column of columns; trackBy: trackByColumnId">
<ng-container <ng-container
*ngIf=" *ngIf="
column.template && !(column.desktopOnly && isSmallScreen) column.template && !(column.desktopOnly && isSmallScreen)

View File

@ -154,4 +154,8 @@ export class SearchLibrariesResultsComponent extends PageComponent implements On
this.store.dispatch(new NavigateLibraryAction(node.entry.guid)); this.store.dispatch(new NavigateLibraryAction(node.entry.guid));
} }
} }
handleNodeClick(event: Event) {
this.navigateTo((event as CustomEvent).detail?.node);
}
} }

View File

@ -115,12 +115,12 @@ export class SearchResultsRowComponent implements OnInit, OnDestroy {
return isLocked(this.node); return isLocked(this.node);
} }
showPreview(event: MouseEvent) { showPreview(event: Event) {
event.stopPropagation(); event.stopPropagation();
this.store.dispatch(new ViewNodeAction(this.node.entry.id, { location: this.router.url })); this.store.dispatch(new ViewNodeAction(this.node.entry.id, { location: this.router.url }));
} }
navigate(event: MouseEvent) { navigate(event: Event) {
event.stopPropagation(); event.stopPropagation();
this.store.dispatch(new NavigateToFolder(this.node)); this.store.dispatch(new NavigateToFolder(this.node));
} }

View File

@ -63,13 +63,13 @@
#documentList #documentList
acaDocumentList acaDocumentList
acaContextActions acaContextActions
[showHeader]="false" [showHeader]="showHeader"
[selectionMode]="'multiple'" [selectionMode]="'multiple'"
[sortingMode]="'server'" [sortingMode]="'server'"
[sorting]="sorting" [sorting]="sorting"
[imageResolver]="imageResolver" [imageResolver]="imageResolver"
[node]="data" [node]="$any(data)"
(node-dblclick)="onNodeDoubleClick($event.detail?.node)" (node-dblclick)="handleNodeClick($event)"
> >
<data-columns> <data-columns>
<data-column <data-column

View File

@ -40,7 +40,7 @@ import {
SnackbarErrorAction SnackbarErrorAction
} from '@alfresco/aca-shared/store'; } from '@alfresco/aca-shared/store';
import { ContentManagementService } from '../../../services/content-management.service'; import { ContentManagementService } from '../../../services/content-management.service';
import { TranslationService } from '@alfresco/adf-core'; import { ShowHeaderMode, TranslationService } from '@alfresco/adf-core';
import { combineLatest, Observable } from 'rxjs'; import { combineLatest, Observable } from 'rxjs';
import { AppExtensionService } from '@alfresco/aca-shared'; import { AppExtensionService } from '@alfresco/aca-shared';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
@ -65,6 +65,7 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
hasSelectedFilters = false; hasSelectedFilters = false;
sorting = ['name', 'asc']; sorting = ['name', 'asc'];
isLoading = false; isLoading = false;
showHeader: ShowHeaderMode = ShowHeaderMode.Never;
constructor( constructor(
private queryBuilder: SearchQueryBuilderService, private queryBuilder: SearchQueryBuilderService,
@ -257,6 +258,14 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
this.queryBuilder.updateSelectedConfiguration(form.index); this.queryBuilder.updateSelectedConfiguration(form.index);
} }
handleNodeClick(event: Event) {
this.onNodeDoubleClick((event as CustomEvent).detail?.node);
}
hideSearchFilter() {
return !this.totalResults && !this.hasSelectedFilters;
}
onPreviewClosed() { onPreviewClosed() {
this.store.dispatch(new ShowInfoDrawerPreviewAction()); this.store.dispatch(new ShowInfoDrawerPreviewAction());
} }

View File

@ -21,8 +21,8 @@
[sorting]="['modifiedAt', 'desc']" [sorting]="['modifiedAt', 'desc']"
[imageResolver]="imageResolver" [imageResolver]="imageResolver"
sortingMode="client" sortingMode="client"
(node-dblclick)="preview($event.detail?.node)" (node-dblclick)="handleNodeClick($event)"
(name-click)="preview($event.detail?.node)" (name-click)="handleNodeClick($event)"
> >
<adf-custom-empty-content-template> <adf-custom-empty-content-template>
<adf-empty-content icon="people" [title]="'APP.BROWSE.SHARED.EMPTY_STATE.TITLE'" subtitle="APP.BROWSE.SHARED.EMPTY_STATE.TEXT"> <adf-empty-content icon="people" [title]="'APP.BROWSE.SHARED.EMPTY_STATE.TITLE'" subtitle="APP.BROWSE.SHARED.EMPTY_STATE.TEXT">
@ -30,7 +30,7 @@
</adf-custom-empty-content-template> </adf-custom-empty-content-template>
<data-columns> <data-columns>
<ng-container *ngFor="let column of columns; trackBy: trackById"> <ng-container *ngFor="let column of columns; trackBy: trackByColumnId">
<ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)"> <ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)">
<data-column <data-column
[key]="column.key" [key]="column.key"

View File

@ -75,4 +75,8 @@ export class SharedFilesComponent extends PageComponent implements OnInit {
preview(node: MinimalNodeEntity) { preview(node: MinimalNodeEntity) {
this.showPreview(node, { location: this.router.url }); this.showPreview(node, { location: this.router.url });
} }
handleNodeClick(event: Event) {
this.preview((event as CustomEvent).detail?.node);
}
} }

View File

@ -45,7 +45,7 @@ export class ButtonMenuComponent implements OnInit {
this.cd.detectChanges(); this.cd.detectChanges();
} }
trackById(_index: number, obj: { id: string }) { trackById(_index: number, obj: NavBarLinkRef) {
return obj.id; return obj.id;
} }
} }

View File

@ -42,7 +42,7 @@ export class ExpandMenuComponent implements OnInit {
this.cd.detectChanges(); this.cd.detectChanges();
} }
trackById(_index: number, obj: { id: string }) { trackById(_index: number, obj: NavBarLinkRef) {
return obj.id; return obj.id;
} }
} }

View File

@ -5,9 +5,9 @@
</div> </div>
<div class="section-sub-actions"> <div class="section-sub-actions">
<div *ngFor="let group of groups; trackBy: trackById" class="section" [ngClass]="'section--' + mode"> <div *ngFor="let group of groups; trackBy: trackByGroupId" class="section" [ngClass]="'section--' + mode">
<ng-container *ngSwitchCase="'expanded'"> <ng-container *ngSwitchCase="'expanded'">
<mat-list-item *ngFor="let item of group.items; trackBy: trackById"> <mat-list-item *ngFor="let item of group.items; trackBy: trackByLinkId">
<ng-container *ngIf="!item.component"> <ng-container *ngIf="!item.component">
<app-expand-menu [item]="item"></app-expand-menu> <app-expand-menu [item]="item"></app-expand-menu>
</ng-container> </ng-container>
@ -19,7 +19,7 @@
</ng-container> </ng-container>
<ng-container *ngSwitchCase="'collapsed'"> <ng-container *ngSwitchCase="'collapsed'">
<div class="list-item" *ngFor="let item of group.items; trackBy: trackById"> <div class="list-item" *ngFor="let item of group.items; trackBy: trackByLinkId">
<ng-container *ngIf="!item.component"> <ng-container *ngIf="!item.component">
<app-button-menu [item]="item"></app-button-menu> <app-button-menu [item]="item"></app-button-menu>
</ng-container> </ng-container>

View File

@ -24,7 +24,7 @@
*/ */
import { Component, Input, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core'; import { Component, Input, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
import { NavBarGroupRef } from '@alfresco/adf-extensions'; import { NavBarGroupRef, NavBarLinkRef } from '@alfresco/adf-extensions';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppStore, getSideNavState } from '@alfresco/aca-shared/store'; import { AppStore, getSideNavState } from '@alfresco/aca-shared/store';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
@ -56,7 +56,11 @@ export class SidenavComponent implements OnInit, OnDestroy {
}); });
} }
trackById(_: number, obj: { id: string }) { trackByGroupId(_: number, obj: NavBarGroupRef): string {
return obj.id;
}
trackByLinkId(_: number, obj: NavBarLinkRef): string {
return obj.id; return obj.id;
} }

View File

@ -33,7 +33,7 @@ import { ToggleInfoDrawerAction, isInfoDrawerOpened } from '@alfresco/aca-shared
template: ` template: `
<button <button
mat-icon-button mat-icon-button
[color]="(infoDrawerOpened$ | async) ? 'primary' : ''" [color]="(infoDrawerOpened$ | async) ? 'primary' : null"
[attr.aria-label]="'APP.ACTIONS.DETAILS' | translate" [attr.aria-label]="'APP.ACTIONS.DETAILS' | translate"
[attr.aria-expanded]="infoDrawerOpened$ | async" [attr.aria-expanded]="infoDrawerOpened$ | async"
[attr.title]="'APP.ACTIONS.DETAILS' | translate" [attr.title]="'APP.ACTIONS.DETAILS' | translate"

View File

@ -35,7 +35,7 @@
</adf-custom-empty-content-template> </adf-custom-empty-content-template>
<data-columns> <data-columns>
<ng-container *ngFor="let column of columns; trackBy: trackById"> <ng-container *ngFor="let column of columns; trackBy: trackByColumnId">
<ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)"> <ng-container *ngIf="column.template && !(column.desktopOnly && isSmallScreen)">
<data-column <data-column
[key]="column.key" [key]="column.key"

View File

@ -15,8 +15,8 @@
[allowFullScreen]="false" [allowFullScreen]="false"
[overlayMode]="true" [overlayMode]="true"
(showViewerChange)="onViewerVisibilityChanged()" (showViewerChange)="onViewerVisibilityChanged()"
[canNavigateBefore]="previousNodeId" [canNavigateBefore]="!!previousNodeId"
[canNavigateNext]="nextNodeId" [canNavigateNext]="!!nextNodeId"
(navigateBefore)="onNavigateBefore($event)" (navigateBefore)="onNavigateBefore($event)"
(navigateNext)="onNavigateNext($event)" (navigateNext)="onNavigateNext($event)"
> >
@ -25,13 +25,13 @@
</adf-viewer-sidebar> </adf-viewer-sidebar>
<adf-viewer-open-with *ngIf="openWith.length"> <adf-viewer-open-with *ngIf="openWith.length">
<ng-container *ngFor="let action of openWith; trackBy: trackById"> <ng-container *ngFor="let action of openWith; trackBy: trackByActionId">
<app-toolbar-menu-item [actionRef]="action"></app-toolbar-menu-item> <app-toolbar-menu-item [actionRef]="action"></app-toolbar-menu-item>
</ng-container> </ng-container>
</adf-viewer-open-with> </adf-viewer-open-with>
<adf-viewer-toolbar-actions> <adf-viewer-toolbar-actions>
<ng-container *ngFor="let action of toolbarActions; trackBy: trackById"> <ng-container *ngFor="let action of toolbarActions; trackBy: trackByActionId">
<aca-toolbar-action [actionRef]="action"></aca-toolbar-action> <aca-toolbar-action [actionRef]="action"></aca-toolbar-action>
</ng-container> </ng-container>
</adf-viewer-toolbar-actions> </adf-viewer-toolbar-actions>

View File

@ -200,7 +200,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
this.onDestroy$.complete(); this.onDestroy$.complete();
} }
trackById(_: number, obj: { id: string }) { trackByActionId(_: number, obj: ContentActionRef): string {
return obj.id; return obj.id;
} }

View File

@ -44,7 +44,7 @@ export class NodeVersionsDialogComponent {
/** Emitted when a version is restored or deleted. */ /** Emitted when a version is restored or deleted. */
@Output() @Output()
refreshEvent: EventEmitter<Node> = new EventEmitter<Node>(); refreshEvent = new EventEmitter<Node>();
constructor( constructor(
@Inject(MAT_DIALOG_DATA) data: any, @Inject(MAT_DIALOG_DATA) data: any,
@ -57,7 +57,7 @@ export class NodeVersionsDialogComponent {
this.isTypeList = data.isTypeList !== undefined ? data.isTypeList : true; this.isTypeList = data.isTypeList !== undefined ? data.isTypeList : true;
} }
onUploadError(errorMessage: string) { onUploadError(errorMessage: any) {
this.store.dispatch(new SnackbarErrorAction(errorMessage)); this.store.dispatch(new SnackbarErrorAction(errorMessage));
} }

View File

@ -34,6 +34,7 @@
"angularCompilerOptions": { "angularCompilerOptions": {
"preserveWhitespaces": false, "preserveWhitespaces": false,
"fullTemplateTypeCheck": true, "fullTemplateTypeCheck": true,
"strictInjectionParameters": true "strictInjectionParameters": true,
"strictTemplates": true
} }
} }