Cherry picked commit from oidc and run fix lint

This commit is contained in:
VitoAlbano
2024-11-04 14:47:02 +00:00
committed by Vito Albano
parent e162ebbfef
commit 4d1108e77e
36 changed files with 150 additions and 111 deletions

View File

@@ -22,7 +22,7 @@ import { Component, TemplateRef, ViewChild } from '@angular/core';
selector: 'adf-breadcrumb-item', selector: 'adf-breadcrumb-item',
template: ` template: `
<ng-template #breadcrumbItemTemplate> <ng-template #breadcrumbItemTemplate>
<ng-content></ng-content> <ng-content />
</ng-template> </ng-template>
` `
}) })

View File

@@ -16,7 +16,18 @@
*/ */
import { fakeAsync, TestBed, tick } from '@angular/core/testing'; import { fakeAsync, TestBed, tick } from '@angular/core/testing';
import { OAuthService, OAuthEvent, OAuthStorage, AUTH_CONFIG, TokenResponse, AuthConfig, OAuthLogger, OAuthErrorEvent, OAuthSuccessEvent, OAuthInfoEvent } from 'angular-oauth2-oidc'; import {
OAuthService,
OAuthEvent,
OAuthStorage,
AUTH_CONFIG,
TokenResponse,
AuthConfig,
OAuthLogger,
OAuthErrorEvent,
OAuthSuccessEvent,
OAuthInfoEvent
} from 'angular-oauth2-oidc';
import { of, Subject, timeout } from 'rxjs'; import { of, Subject, timeout } from 'rxjs';
import { RedirectAuthService } from './redirect-auth.service'; import { RedirectAuthService } from './redirect-auth.service';
import { AUTH_MODULE_CONFIG } from './auth-config'; import { AUTH_MODULE_CONFIG } from './auth-config';
@@ -43,18 +54,22 @@ describe('RedirectAuthService', () => {
retryLoginServiceSpy = jasmine.createSpyObj('RetryLoginService', ['tryToLoginTimes']); retryLoginServiceSpy = jasmine.createSpyObj('RetryLoginService', ['tryToLoginTimes']);
timeSyncServiceSpy = jasmine.createSpyObj('TimeSyncService', ['checkTimeSync']); timeSyncServiceSpy = jasmine.createSpyObj('TimeSyncService', ['checkTimeSync']);
oauthLoggerSpy = jasmine.createSpyObj('OAuthLogger', ['error', 'info', 'warn']); oauthLoggerSpy = jasmine.createSpyObj('OAuthLogger', ['error', 'info', 'warn']);
oauthServiceSpy = jasmine.createSpyObj('OAuthService', [ oauthServiceSpy = jasmine.createSpyObj(
'clearHashAfterLogin', 'OAuthService',
'configure', [
'logOut', 'clearHashAfterLogin',
'hasValidAccessToken', 'configure',
'hasValidIdToken', 'logOut',
'setupAutomaticSilentRefresh', 'hasValidAccessToken',
'silentRefresh', 'hasValidIdToken',
'refreshToken', 'setupAutomaticSilentRefresh',
'getIdentityClaims', 'silentRefresh',
'getAccessToken' 'refreshToken',
], { clockSkewInSec: 120, events: oauthEvents$, tokenValidationHandler: {} }); 'getIdentityClaims',
'getAccessToken'
],
{ clockSkewInSec: 120, events: oauthEvents$, tokenValidationHandler: {} }
);
authConfigSpy = jasmine.createSpyObj('AuthConfig', ['sessionChecksEnabled']); authConfigSpy = jasmine.createSpyObj('AuthConfig', ['sessionChecksEnabled']);
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@@ -202,8 +217,14 @@ describe('RedirectAuthService', () => {
}); });
it('should logout user if token has expired due to local machine clock being out of sync', () => { it('should logout user if token has expired due to local machine clock being out of sync', () => {
const mockTimeSync: TimeSync = { outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' }; const mockTimeSync: TimeSync = {
const expectedError = new Error(`Token has expired due to local machine clock ${mockTimeSync.localDateTimeISO} being out of sync with server time ${mockTimeSync.serverDateTimeISO}`); outOfSync: true,
localDateTimeISO: '2024-10-10T22:00:18.621Z',
serverDateTimeISO: '2024-10-10T22:10:53.000Z'
};
const expectedError = new Error(
`Token has expired due to local machine clock ${mockTimeSync.localDateTimeISO} being out of sync with server time ${mockTimeSync.serverDateTimeISO}`
);
timeSyncServiceSpy.checkTimeSync.and.returnValue(of(mockTimeSync)); timeSyncServiceSpy.checkTimeSync.and.returnValue(of(mockTimeSync));
@@ -375,7 +396,7 @@ describe('RedirectAuthService', () => {
expect(oauthServiceSpy.logOut).not.toHaveBeenCalled(); expect(oauthServiceSpy.logOut).not.toHaveBeenCalled();
expect(oauthLoggerSpy.error).not.toHaveBeenCalled(); expect(oauthLoggerSpy.error).not.toHaveBeenCalled();
expect(await firstEventOccurPromise).toEqual(expectedFakeErrorEvent);; expect(await firstEventOccurPromise).toEqual(expectedFakeErrorEvent);
try { try {
tick(1000); tick(1000);
@@ -387,7 +408,6 @@ describe('RedirectAuthService', () => {
})); }));
it('should logout user if the second time the refresh token failed', fakeAsync(async () => { it('should logout user if the second time the refresh token failed', fakeAsync(async () => {
const expectedErrorCausedBySecondTokenRefreshError = new OAuthErrorEvent('token_refresh_error', { reason: 'second token refresh error' }, {}); const expectedErrorCausedBySecondTokenRefreshError = new OAuthErrorEvent('token_refresh_error', { reason: 'second token refresh error' }, {});
oauthEvents$.next(new OAuthErrorEvent('token_refresh_error', { reason: 'error' }, {})); oauthEvents$.next(new OAuthErrorEvent('token_refresh_error', { reason: 'error' }, {}));
@@ -398,8 +418,12 @@ describe('RedirectAuthService', () => {
})); }));
it('should logout user if token_refresh_error is emitted because of clock out of sync', () => { it('should logout user if token_refresh_error is emitted because of clock out of sync', () => {
const expectedErrorMessage = new Error('OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'); const expectedErrorMessage = new Error(
timeSyncServiceSpy.checkTimeSync.and.returnValue(of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)); 'OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'
);
timeSyncServiceSpy.checkTimeSync.and.returnValue(
of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)
);
oauthEvents$.next(new OAuthErrorEvent('token_refresh_error', { reason: 'error' }, {})); oauthEvents$.next(new OAuthErrorEvent('token_refresh_error', { reason: 'error' }, {}));
@@ -408,8 +432,12 @@ describe('RedirectAuthService', () => {
}); });
it('should logout user if discovery_document_load_error is emitted because of clock out of sync', () => { it('should logout user if discovery_document_load_error is emitted because of clock out of sync', () => {
const expectedErrorMessage = new Error('OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'); const expectedErrorMessage = new Error(
timeSyncServiceSpy.checkTimeSync.and.returnValue(of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)); 'OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'
);
timeSyncServiceSpy.checkTimeSync.and.returnValue(
of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)
);
oauthEvents$.next(new OAuthErrorEvent('discovery_document_load_error', { reason: 'error' }, {})); oauthEvents$.next(new OAuthErrorEvent('discovery_document_load_error', { reason: 'error' }, {}));
@@ -418,8 +446,12 @@ describe('RedirectAuthService', () => {
}); });
it('should logout user if code_error is emitted because of clock out of sync', () => { it('should logout user if code_error is emitted because of clock out of sync', () => {
const expectedErrorMessage = new Error('OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'); const expectedErrorMessage = new Error(
timeSyncServiceSpy.checkTimeSync.and.returnValue(of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)); 'OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'
);
timeSyncServiceSpy.checkTimeSync.and.returnValue(
of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)
);
oauthEvents$.next(new OAuthErrorEvent('code_error', { reason: 'error' }, {})); oauthEvents$.next(new OAuthErrorEvent('code_error', { reason: 'error' }, {}));
@@ -428,8 +460,12 @@ describe('RedirectAuthService', () => {
}); });
it('should logout user if discovery_document_validation_error is emitted because of clock out of sync', () => { it('should logout user if discovery_document_validation_error is emitted because of clock out of sync', () => {
const expectedErrorMessage = new Error('OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'); const expectedErrorMessage = new Error(
timeSyncServiceSpy.checkTimeSync.and.returnValue(of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)); 'OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'
);
timeSyncServiceSpy.checkTimeSync.and.returnValue(
of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)
);
oauthEvents$.next(new OAuthErrorEvent('discovery_document_validation_error', { reason: 'error' }, {})); oauthEvents$.next(new OAuthErrorEvent('discovery_document_validation_error', { reason: 'error' }, {}));
@@ -438,8 +474,12 @@ describe('RedirectAuthService', () => {
}); });
it('should logout user if jwks_load_error is emitted because of clock out of sync', () => { it('should logout user if jwks_load_error is emitted because of clock out of sync', () => {
const expectedErrorMessage = new Error('OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'); const expectedErrorMessage = new Error(
timeSyncServiceSpy.checkTimeSync.and.returnValue(of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)); 'OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'
);
timeSyncServiceSpy.checkTimeSync.and.returnValue(
of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)
);
oauthEvents$.next(new OAuthErrorEvent('jwks_load_error', { reason: 'error' }, {})); oauthEvents$.next(new OAuthErrorEvent('jwks_load_error', { reason: 'error' }, {}));
@@ -448,8 +488,12 @@ describe('RedirectAuthService', () => {
}); });
it('should logout user if silent_refresh_error is emitted because of clock out of sync', () => { it('should logout user if silent_refresh_error is emitted because of clock out of sync', () => {
const expectedErrorMessage = new Error('OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'); const expectedErrorMessage = new Error(
timeSyncServiceSpy.checkTimeSync.and.returnValue(of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)); 'OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'
);
timeSyncServiceSpy.checkTimeSync.and.returnValue(
of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)
);
oauthEvents$.next(new OAuthErrorEvent('silent_refresh_error', { reason: 'error' }, {})); oauthEvents$.next(new OAuthErrorEvent('silent_refresh_error', { reason: 'error' }, {}));
@@ -458,8 +502,12 @@ describe('RedirectAuthService', () => {
}); });
it('should logout user if user_profile_load_error is emitted because of clock out of sync', () => { it('should logout user if user_profile_load_error is emitted because of clock out of sync', () => {
const expectedErrorMessage = new Error('OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'); const expectedErrorMessage = new Error(
timeSyncServiceSpy.checkTimeSync.and.returnValue(of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)); 'OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'
);
timeSyncServiceSpy.checkTimeSync.and.returnValue(
of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)
);
oauthEvents$.next(new OAuthErrorEvent('user_profile_load_error', { reason: 'error' }, {})); oauthEvents$.next(new OAuthErrorEvent('user_profile_load_error', { reason: 'error' }, {}));
@@ -468,8 +516,12 @@ describe('RedirectAuthService', () => {
}); });
it('should logout user if token_error is emitted because of clock out of sync', () => { it('should logout user if token_error is emitted because of clock out of sync', () => {
const expectedErrorMessage = new Error('OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'); const expectedErrorMessage = new Error(
timeSyncServiceSpy.checkTimeSync.and.returnValue(of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)); 'OAuth error occurred due to local machine clock 2024-10-10T22:00:18.621Z being out of sync with server time 2024-10-10T22:10:53.000Z'
);
timeSyncServiceSpy.checkTimeSync.and.returnValue(
of({ outOfSync: true, localDateTimeISO: '2024-10-10T22:00:18.621Z', serverDateTimeISO: '2024-10-10T22:10:53.000Z' } as TimeSync)
);
oauthEvents$.next(new OAuthErrorEvent('token_error', { reason: 'error' }, {})); oauthEvents$.next(new OAuthErrorEvent('token_error', { reason: 'error' }, {}));
@@ -479,7 +531,7 @@ describe('RedirectAuthService', () => {
it('should onLogout$ be emitted when logout event occur', () => { it('should onLogout$ be emitted when logout event occur', () => {
let expectedLogoutIsEmitted = false; let expectedLogoutIsEmitted = false;
service.onLogout$.subscribe(() => expectedLogoutIsEmitted = true); service.onLogout$.subscribe(() => (expectedLogoutIsEmitted = true));
oauthEvents$.next(new OAuthInfoEvent('logout')); oauthEvents$.next(new OAuthInfoEvent('logout'));

View File

@@ -26,7 +26,6 @@ export class RetryLoginService {
/** /**
* Attempts to log in a specified number of times if the initial login attempt fails. * Attempts to log in a specified number of times if the initial login attempt fails.
*
* @param loginOptions - The options to be used for the login attempt. * @param loginOptions - The options to be used for the login attempt.
* @param maxLoginAttempts - The maximum number of login attempts. Defaults to 3. * @param maxLoginAttempts - The maximum number of login attempts. Defaults to 3.
* @returns A promise that resolves to `true` if the login is successful, or rejects with an error if all attempts fail. * @returns A promise that resolves to `true` if the login is successful, or rejects with an error if all attempts fail.

View File

@@ -32,13 +32,9 @@ export interface TimeSync {
providedIn: 'root' providedIn: 'root'
}) })
export class TimeSyncService { export class TimeSyncService {
private readonly _http: HttpClient; private readonly _http: HttpClient;
constructor( constructor(private _injector: Injector, private _appConfigService: AppConfigService) {
private _injector: Injector,
private _appConfigService: AppConfigService
) {
this._http = this._injector.get(HttpClient); this._http = this._injector.get(HttpClient);
} }
@@ -59,7 +55,7 @@ export class TimeSyncService {
serverTimeInMs = serverTimeResponse; serverTimeInMs = serverTimeResponse;
} }
const adjustedServerTimeInMs = serverTimeInMs + (roundTripTimeInMs / 2); const adjustedServerTimeInMs = serverTimeInMs + roundTripTimeInMs / 2;
const localCurrentTimeInMs = Date.now(); const localCurrentTimeInMs = Date.now();
const timeOffsetInMs = Math.abs(localCurrentTimeInMs - adjustedServerTimeInMs); const timeOffsetInMs = Math.abs(localCurrentTimeInMs - adjustedServerTimeInMs);
const maxAllowedClockSkewInMs = maxAllowedClockSkewInSec * 1000; const maxAllowedClockSkewInMs = maxAllowedClockSkewInSec * 1000;
@@ -71,20 +67,17 @@ export class TimeSyncService {
serverDateTimeISO: new Date(adjustedServerTimeInMs).toISOString() serverDateTimeISO: new Date(adjustedServerTimeInMs).toISOString()
}; };
}), }),
catchError(error => throwError(() => new Error(error))) catchError((error) => throwError(() => new Error(error)))
); );
} }
/** /**
* Checks if the local time is out of sync with the server time. * Checks if the local time is out of sync with the server time.
*
* @param maxAllowedClockSkewInSec - The maximum allowed clock skew in seconds. * @param maxAllowedClockSkewInSec - The maximum allowed clock skew in seconds.
* @returns An Observable that emits a boolean indicating whether the local time is out of sync. * @returns An Observable that emits a boolean indicating whether the local time is out of sync.
*/ */
isLocalTimeOutOfSync(maxAllowedClockSkewInSec: number): Observable<boolean> { isLocalTimeOutOfSync(maxAllowedClockSkewInSec: number): Observable<boolean> {
return this.checkTimeSync(maxAllowedClockSkewInSec).pipe( return this.checkTimeSync(maxAllowedClockSkewInSec).pipe(map((sync) => sync.outOfSync));
map(sync => sync.outOfSync)
);
} }
private getServerTime(): Observable<number> { private getServerTime(): Observable<number> {

View File

@@ -123,5 +123,5 @@
</ng-container> </ng-container>
<ng-template #buttonContent> <ng-template #buttonContent>
<ng-content></ng-content> <ng-content />
</ng-template> </ng-template>

View File

@@ -23,7 +23,7 @@ import { DEFAULT_SEPARATOR } from '../card-view-textitem/card-view-textitem.comp
@Component({ @Component({
selector: 'adf-card-view-item-dispatcher', selector: 'adf-card-view-item-dispatcher',
standalone: true, standalone: true,
template: '<ng-template #content></ng-template>' template: '<ng-template #content />'
}) })
export class CardViewItemDispatcherComponent implements OnChanges { export class CardViewItemDispatcherComponent implements OnChanges {
@Input() @Input()

View File

@@ -22,7 +22,7 @@ import { DataRow } from '../../data/data-row.model';
@Component({ @Component({
selector: 'adf-datatable-row', selector: 'adf-datatable-row',
standalone: true, standalone: true,
template: `<ng-content></ng-content>`, template: `<ng-content />`,
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
host: { host: {
class: 'adf-datatable-row', class: 'adf-datatable-row',

View File

@@ -37,7 +37,7 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
@Component({ @Component({
selector: 'adf-custom-column-template-component', selector: 'adf-custom-column-template-component',
standalone: true, standalone: true,
template: ` <ng-template #tmplRef></ng-template> ` template: ` <ng-template #tmplRef /> `
}) })
class CustomColumnTemplateComponent { class CustomColumnTemplateComponent {
@ViewChild('tmplRef', { static: true }) templateRef: TemplateRef<any>; @ViewChild('tmplRef', { static: true }) templateRef: TemplateRef<any>;

View File

@@ -1,6 +1,6 @@
<div class="adf-empty-list_template"> <div class="adf-empty-list_template">
<ng-content select="[adf-empty-list-header]"></ng-content> <ng-content select="[adf-empty-list-header]" />
<ng-content select="[adf-empty-list-body]"></ng-content> <ng-content select="[adf-empty-list-body]" />
<ng-content select="[adf-empty-list-footer]"></ng-content> <ng-content select="[adf-empty-list-footer]" />
<ng-content></ng-content> <ng-content />
</div> </div>

View File

@@ -4,14 +4,14 @@
<div *ngIf="hasTabs()" class="alfresco-tabs-widget"> <div *ngIf="hasTabs()" class="alfresco-tabs-widget">
<mat-tab-group> <mat-tab-group>
<mat-tab *ngFor="let tab of visibleTabs()" [label]="tab.title | translate "> <mat-tab *ngFor="let tab of visibleTabs()" [label]="tab.title | translate ">
<ng-template *ngTemplateOutlet="render; context: { fieldToRender: tab.fields }"></ng-template> <ng-template *ngTemplateOutlet="render; context: { fieldToRender: tab.fields }" />
</mat-tab> </mat-tab>
</mat-tab-group> </mat-tab-group>
</div> </div>
</div> </div>
<div *ngIf="!formDefinition.hasTabs() && formDefinition.hasFields()"> <div *ngIf="!formDefinition.hasTabs() && formDefinition.hasFields()">
<ng-template *ngTemplateOutlet="render; context: { fieldToRender: formDefinition.fields }"></ng-template> <ng-template *ngTemplateOutlet="render; context: { fieldToRender: formDefinition.fields }" />
</div> </div>
</div> </div>

View File

@@ -7,11 +7,11 @@
data-automation-id="adf-inplace-input"> data-automation-id="adf-inplace-input">
<mat-label data-automation-id="adf-inplace-input-label"> <mat-label data-automation-id="adf-inplace-input-label">
<ng-content select="[label]"></ng-content> <ng-content select="[label]" />
</mat-label> </mat-label>
<mat-error data-automation-id="adf-inplace-input-error"> <mat-error data-automation-id="adf-inplace-input-error">
<ng-content select="[error]"></ng-content> <ng-content select="[error]" />
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
</div> </div>

View File

@@ -30,13 +30,13 @@
<ng-template #toolbarActions> <ng-template #toolbarActions>
<div class="adf-toolbar-actions"> <div class="adf-toolbar-actions">
<ng-content select="[adf-toolbar-actions]"></ng-content> <ng-content select="[adf-toolbar-actions]" />
</div> </div>
</ng-template> </ng-template>
<ng-template #navbarTemplate> <ng-template #navbarTemplate>
<adf-navbar [items]="navbarItems"> <adf-navbar [items]="navbarItems">
<ng-content select="adf-navbar-item"></ng-content> <ng-content select="adf-navbar-item" />
</adf-navbar> </adf-navbar>
</ng-template> </ng-template>

View File

@@ -1,4 +1,4 @@
<adf-navbar-item *ngFor="let item of items" <adf-navbar-item *ngFor="let item of items"
[routerLink]="item.routerLink" [routerLink]="item.routerLink"
[label]="item.label" /> [label]="item.label" />
<ng-content></ng-content> <ng-content />

View File

@@ -1,12 +1,12 @@
<div *ngIf="showHeader" class="adf-info-drawer-layout-header"> <div *ngIf="showHeader" class="adf-info-drawer-layout-header">
<div class="adf-info-drawer-layout-header-title"> <div class="adf-info-drawer-layout-header-title">
<ng-content select="[info-drawer-node-icon]"></ng-content> <ng-content select="[info-drawer-node-icon]" />
<ng-content select="[info-drawer-title]"></ng-content> <ng-content select="[info-drawer-title]" />
</div> </div>
<div class="adf-info-drawer-layout-header-buttons"> <div class="adf-info-drawer-layout-header-buttons">
<ng-content select="[info-drawer-buttons]"></ng-content> <ng-content select="[info-drawer-buttons]" />
</div> </div>
</div> </div>
<div class="adf-info-drawer-layout-content"> <div class="adf-info-drawer-layout-content">
<ng-content select="[info-drawer-content]"></ng-content> <ng-content select="[info-drawer-content]" />
</div> </div>

View File

@@ -2,8 +2,8 @@
<img *ngIf="icon" class="adf-info-drawer-icon" alt="{{ 'INFO_DRAWER.ICON' | translate }}" src="{{ icon }}" info-drawer-node-icon> <img *ngIf="icon" class="adf-info-drawer-icon" alt="{{ 'INFO_DRAWER.ICON' | translate }}" src="{{ icon }}" info-drawer-node-icon>
<div *ngIf="title" role="heading" aria-level="1" title="{{ title | translate }}" info-drawer-title>{{ title | translate }}</div> <div *ngIf="title" role="heading" aria-level="1" title="{{ title | translate }}" info-drawer-title>{{ title | translate }}</div>
<ng-content *ngIf="!title" info-drawer-title select="[info-drawer-title]"></ng-content> <ng-content *ngIf="!title" info-drawer-title select="[info-drawer-title]" />
<ng-content info-drawer-buttons select="[info-drawer-buttons]"></ng-content> <ng-content info-drawer-buttons select="[info-drawer-buttons]" />
<ng-container info-drawer-content *ngIf="showTabLayout(); then tabLayout else singleLayout" /> <ng-container info-drawer-content *ngIf="showTabLayout(); then tabLayout else singleLayout" />
<ng-template #tabLayout> <ng-template #tabLayout>
@@ -28,6 +28,6 @@
</ng-template> </ng-template>
<ng-template #singleLayout> <ng-template #singleLayout>
<ng-content select="[info-drawer-content]"></ng-content> <ng-content select="[info-drawer-content]" />
</ng-template> </ng-template>
</adf-info-drawer-layout> </adf-info-drawer-layout>

View File

@@ -40,7 +40,7 @@ import { MatIconModule } from '@angular/material/icon';
@Component({ @Component({
selector: 'adf-info-drawer-tab', selector: 'adf-info-drawer-tab',
standalone: true, standalone: true,
template: '<ng-template><ng-content></ng-content></ng-template>', template: '<ng-template><ng-content /></ng-template>',
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class InfoDrawerTabComponent { export class InfoDrawerTabComponent {

View File

@@ -36,7 +36,7 @@
{{ title }} {{ title }}
</h1> </h1>
<ng-content></ng-content> <ng-content />
<button <button
*ngIf="showSidenavToggle && position === 'end'" *ngIf="showSidenavToggle && position === 'end'"

View File

@@ -6,12 +6,12 @@
[@sidenavAnimation]="sidenavAnimationState" [@sidenavAnimation]="sidenavAnimationState"
[opened]="!isMobileScreenSize || !hideSidenav" [opened]="!isMobileScreenSize || !hideSidenav"
[mode]="isMobileScreenSize ? 'over' : 'side'"> [mode]="isMobileScreenSize ? 'over' : 'side'">
<ng-content sidenav select="[app-layout-navigation]"></ng-content> <ng-content sidenav select="[app-layout-navigation]" />
</mat-sidenav> </mat-sidenav>
<div> <div>
<div class="adf-container-full-width" [@contentAnimationLeft]="getContentAnimationState()"> <div class="adf-container-full-width" [@contentAnimationLeft]="getContentAnimationState()">
<ng-content select="[app-layout-content]"></ng-content> <ng-content select="[app-layout-content]" />
</div> </div>
</div> </div>
</mat-sidenav-container> </mat-sidenav-container>

View File

@@ -1,16 +1,16 @@
<div class="adf-sidebar-action-menu"> <div class="adf-sidebar-action-menu">
<button *ngIf="isExpanded()" mat-raised-button class="adf-sidebar-action-menu-button" data-automation-id="create-button" [matMenuTriggerFor]="adfSidebarMenu"> <button *ngIf="isExpanded()" mat-raised-button class="adf-sidebar-action-menu-button" data-automation-id="create-button" [matMenuTriggerFor]="adfSidebarMenu">
<span *ngIf="title" class="adf-sidebar-action-menu-text">{{ title }}</span> <span *ngIf="title" class="adf-sidebar-action-menu-text">{{ title }}</span>
<ng-content select="[adf-sidebar-menu-title-icon], [sidebar-menu-title-icon]"></ng-content> <ng-content select="[adf-sidebar-menu-title-icon], [sidebar-menu-title-icon]" />
</button> </button>
<div *ngIf="!isExpanded()" class="adf-sidebar-action-menu-icon" [matMenuTriggerFor]="adfSidebarMenu"> <div *ngIf="!isExpanded()" class="adf-sidebar-action-menu-icon" [matMenuTriggerFor]="adfSidebarMenu">
<ng-content select="[adf-sidebar-menu-expand-icon], [sidebar-menu-expand-icon]"></ng-content> <ng-content select="[adf-sidebar-menu-expand-icon], [sidebar-menu-expand-icon]" />
</div> </div>
<mat-menu #adfSidebarMenu="matMenu" class="adf-sidebar-action-menu-panel" [overlapTrigger]="false" yPosition="below"> <mat-menu #adfSidebarMenu="matMenu" class="adf-sidebar-action-menu-panel" [overlapTrigger]="false" yPosition="below">
<div class="adf-sidebar-action-menu-options" [style.width.px]="width"> <div class="adf-sidebar-action-menu-options" [style.width.px]="width">
<ng-content select="[adf-sidebar-menu-options], [sidebar-menu-options]"></ng-content> <ng-content select="[adf-sidebar-menu-options], [sidebar-menu-options]" />
</div> </div>
</mat-menu> </mat-menu>
</div> </div>

View File

@@ -26,5 +26,5 @@
</ng-container> </ng-container>
</adf-layout-container> </adf-layout-container>
<ng-template #emptyTemplate></ng-template> <ng-template #emptyTemplate />
</div> </div>

View File

@@ -6,10 +6,10 @@
[backgroundImageUrl]="''" [backgroundImageUrl]="''"
(success)="onLoginSuccess($event)"> (success)="onLoginSuccess($event)">
<adf-login-header> <adf-login-header>
<ng-template></ng-template> <ng-template />
</adf-login-header> </adf-login-header>
<adf-login-footer> <adf-login-footer>
<ng-template></ng-template> <ng-template />
</adf-login-footer> </adf-login-footer>
</adf-login> </adf-login>
</div> </div>

View File

@@ -16,8 +16,7 @@
*ngIf="headerTemplate" *ngIf="headerTemplate"
ngFor ngFor
[ngForOf]="[data]" [ngForOf]="[data]"
[ngForTemplate]="headerTemplate"> [ngForTemplate]="headerTemplate" />
</ng-template>
<img <img
*ngIf="!headerTemplate" *ngIf="!headerTemplate"
id="adf-login-img-logo" id="adf-login-img-logo"
@@ -118,7 +117,7 @@
</div> </div>
<!--CUSTOM CONTENT--> <!--CUSTOM CONTENT-->
<ng-content></ng-content> <ng-content />
<br> <br>
<button <button
@@ -193,8 +192,7 @@
*ngIf="footerTemplate" *ngIf="footerTemplate"
ngFor ngFor
[ngForOf]="[data]" [ngForOf]="[data]"
[ngForTemplate]="footerTemplate"> [ngForTemplate]="footerTemplate" />
</ng-template>
<div class="adf-login-action" *ngIf="!footerTemplate && showLoginActions"> <div class="adf-login-action" *ngIf="!footerTemplate && showLoginActions">
<div id="adf-login-action-left" class="adf-login-action-left"> <div id="adf-login-action-left" class="adf-login-action-left">
<a href="{{needHelpLink}}">{{'LOGIN.ACTION.HELP' | translate }}</a> <a href="{{needHelpLink}}">{{'LOGIN.ACTION.HELP' | translate }}</a>

View File

@@ -14,8 +14,7 @@
<ng-template *ngIf="headerTemplate" <ng-template *ngIf="headerTemplate"
ngFor ngFor
[ngForOf]="[data]" [ngForOf]="[data]"
[ngForTemplate]="headerTemplate"> [ngForTemplate]="headerTemplate" />
</ng-template>
<img *ngIf="!headerTemplate" <img *ngIf="!headerTemplate"
id="adf-login-img-logo" id="adf-login-img-logo"
class="adf-img-logo" class="adf-img-logo"
@@ -109,7 +108,7 @@
</div> </div>
<!--CUSTOM CONTENT--> <!--CUSTOM CONTENT-->
<ng-content></ng-content> <ng-content />
<br> <br>
<button type="submit" <button type="submit"
@@ -180,8 +179,7 @@
<ng-template *ngIf="footerTemplate" <ng-template *ngIf="footerTemplate"
ngFor ngFor
[ngForOf]="[data]" [ngForOf]="[data]"
[ngForTemplate]="footerTemplate"> [ngForTemplate]="footerTemplate" />
</ng-template>
<div class="adf-login-action" *ngIf="!footerTemplate && showLoginActions"> <div class="adf-login-action" *ngIf="!footerTemplate && showLoginActions">
<div id="adf-login-action-left" class="adf-login-action-left"> <div id="adf-login-action-left" class="adf-login-action-left">
<a href="{{ needHelpLink }}">{{ 'LOGIN.ACTION.HELP' | translate }}</a> <a href="{{ needHelpLink }}">{{ 'LOGIN.ACTION.HELP' | translate }}</a>

View File

@@ -5,7 +5,7 @@
class="adf-infinite-pagination-load-more" class="adf-infinite-pagination-load-more"
(click)="onLoadMore()" (click)="onLoadMore()"
data-automation-id="adf-infinite-pagination-button"> data-automation-id="adf-infinite-pagination-button">
<ng-content></ng-content> <ng-content />
</button> </button>
<mat-progress-bar *ngIf="isLoading" <mat-progress-bar *ngIf="isLoading"

View File

@@ -2,5 +2,5 @@
<adf-icon class="adf-empty-content__icon" [value]="icon" /> <adf-icon class="adf-empty-content__icon" [value]="icon" />
<div class="adf-empty-content__title">{{ title | translate }}</div> <div class="adf-empty-content__title">{{ title | translate }}</div>
<div class="adf-empty-content__subtitle">{{ subtitle | translate }}</div> <div class="adf-empty-content__subtitle">{{ subtitle | translate }}</div>
<ng-content></ng-content> <ng-content />
</div> </div>

View File

@@ -10,6 +10,6 @@
<p class="adf-error-content-description {{ screenSize.isSmallScreen ? 'mat-subtitle-1': 'mat-headline-5' }}"> <p class="adf-error-content-description {{ screenSize.isSmallScreen ? 'mat-subtitle-1': 'mat-headline-5' }}">
{{ 'ERROR_CONTENT.' + errorCodeTranslated + '.DESCRIPTION' | translate }} {{ 'ERROR_CONTENT.' + errorCodeTranslated + '.DESCRIPTION' | translate }}
</p> </p>
<ng-content select="[adf-error-content-actions]"></ng-content> <ng-content select="[adf-error-content-actions]" />
</div> </div>
</ng-container> </ng-container>

View File

@@ -20,7 +20,7 @@ import { Component } from '@angular/core';
@Component({ @Component({
selector: 'adf-toolbar-title', selector: 'adf-toolbar-title',
standalone: true, standalone: true,
template: '<ng-content></ng-content>', template: '<ng-content />',
host: { class: 'adf-toolbar-title' } host: { class: 'adf-toolbar-title' }
}) })
export class ToolbarTitleComponent {} export class ToolbarTitleComponent {}

View File

@@ -1,5 +1,5 @@
<mat-toolbar class="adf-toolbar-container adf-toolbar-container-row" [color]="color"> <mat-toolbar class="adf-toolbar-container adf-toolbar-container-row" [color]="color">
<span class="adf-toolbar-title" *ngIf="title">{{ title | translate }}</span> <span class="adf-toolbar-title" *ngIf="title">{{ title | translate }}</span>
<ng-content select="adf-toolbar-title"></ng-content> <ng-content select="adf-toolbar-title" />
<ng-content></ng-content> <ng-content />
</mat-toolbar> </mat-toolbar>

View File

@@ -23,6 +23,6 @@ import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'adf-viewer-more-actions' }, host: { class: 'adf-viewer-more-actions' },
template: `<ng-content></ng-content>` template: `<ng-content />`
}) })
export class ViewerMoreActionsComponent {} export class ViewerMoreActionsComponent {}

View File

@@ -23,6 +23,6 @@ import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'adf-viewer-open-with' }, host: { class: 'adf-viewer-open-with' },
template: `<ng-content></ng-content>` template: `<ng-content />`
}) })
export class ViewerOpenWithComponent {} export class ViewerOpenWithComponent {}

View File

@@ -79,8 +79,7 @@
<ng-container *ngFor="let extensionTemplate of extensionTemplates"> <ng-container *ngFor="let extensionTemplate of extensionTemplates">
<span *ngIf="extensionTemplate.isVisible" class="adf-viewer-render-custom-content"> <span *ngIf="extensionTemplate.isVisible" class="adf-viewer-render-custom-content">
<ng-template [ngTemplateOutlet]="extensionTemplate.template" <ng-template [ngTemplateOutlet]="extensionTemplate.template"
[ngTemplateOutletContext]="{ urlFile: urlFile, extension: extension }"> [ngTemplateOutletContext]="{ urlFile: urlFile, extension: extension }" />
</ng-template>
</span> </span>
</ng-container> </ng-container>
</ng-container> </ng-container>
@@ -92,5 +91,5 @@
</div> </div>
</div> </div>
<ng-container *ngIf="viewerTemplateExtensions"> <ng-container *ngIf="viewerTemplateExtensions">
<ng-template [ngTemplateOutlet]="viewerTemplateExtensions" [ngTemplateOutletInjector]="injector"></ng-template> <ng-template [ngTemplateOutlet]="viewerTemplateExtensions" [ngTemplateOutletInjector]="injector" />
</ng-container> </ng-container>

View File

@@ -23,7 +23,7 @@ import { ChangeDetectionStrategy, Component, HostListener, ViewEncapsulation } f
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'adf-viewer-sidebar' }, host: { class: 'adf-viewer-sidebar' },
template: `<ng-content></ng-content>` template: `<ng-content />`
}) })
export class ViewerSidebarComponent { export class ViewerSidebarComponent {
@HostListener('keydown', ['$event']) @HostListener('keydown', ['$event'])

View File

@@ -23,6 +23,6 @@ import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'adf-viewer-toolbar-actions' }, host: { class: 'adf-viewer-toolbar-actions' },
template: `<ng-content></ng-content>` template: `<ng-content />`
}) })
export class ViewerToolbarActionsComponent {} export class ViewerToolbarActionsComponent {}

View File

@@ -23,6 +23,6 @@ import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'adf-viewer-toolbar-custom-actions' }, host: { class: 'adf-viewer-toolbar-custom-actions' },
template: `<ng-content></ng-content>` template: `<ng-content />`
}) })
export class ViewerToolbarCustomActionsComponent {} export class ViewerToolbarCustomActionsComponent {}

View File

@@ -23,6 +23,6 @@ import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'adf-viewer-toolbar' }, host: { class: 'adf-viewer-toolbar' },
template: `<ng-content></ng-content>` template: `<ng-content />`
}) })
export class ViewerToolbarComponent {} export class ViewerToolbarComponent {}

View File

@@ -6,7 +6,7 @@
<div class="adf-viewer-content" <div class="adf-viewer-content"
[cdkTrapFocus]="overlayMode" [cdkTrapFocus]="overlayMode"
cdkTrapFocusAutoCapture> cdkTrapFocusAutoCapture>
<ng-content select="adf-viewer-toolbar"></ng-content> <ng-content select="adf-viewer-toolbar" />
<ng-container *ngIf="showToolbar && !toolbar"> <ng-container *ngIf="showToolbar && !toolbar">
<adf-toolbar id="adf-viewer-toolbar" class="adf-viewer-toolbar"> <adf-toolbar id="adf-viewer-toolbar" class="adf-viewer-toolbar">
<adf-toolbar-title> <adf-toolbar-title>
@@ -58,7 +58,7 @@
</button> </button>
</div> </div>
<ng-content select="adf-viewer-toolbar-actions"></ng-content> <ng-content select="adf-viewer-toolbar-actions" />
<ng-container *ngIf="mnuOpenWith" <ng-container *ngIf="mnuOpenWith"
data-automation-id='adf-toolbar-custom-btn'> data-automation-id='adf-toolbar-custom-btn'>
@@ -71,13 +71,13 @@
</button> </button>
<mat-menu #mnuOpenWith="matMenu" <mat-menu #mnuOpenWith="matMenu"
[overlapTrigger]="false"> [overlapTrigger]="false">
<ng-content select="adf-viewer-open-with"></ng-content> <ng-content select="adf-viewer-open-with" />
</mat-menu> </mat-menu>
</ng-container> </ng-container>
<adf-toolbar-divider /> <adf-toolbar-divider />
<ng-content select="adf-viewer-toolbar-custom-actions"></ng-content> <ng-content select="adf-viewer-toolbar-custom-actions" />
<button id="adf-viewer-fullscreen" <button id="adf-viewer-fullscreen"
*ngIf="allowFullScreen" *ngIf="allowFullScreen"
@@ -115,7 +115,7 @@
</button> </button>
<mat-menu #mnuMoreActions="matMenu" <mat-menu #mnuMoreActions="matMenu"
[overlapTrigger]="false"> [overlapTrigger]="false">
<ng-content select="adf-viewer-more-actions"></ng-content> <ng-content select="adf-viewer-more-actions" />
</mat-menu> </mat-menu>
</ng-container> </ng-container>
@@ -144,7 +144,7 @@
<ng-container *ngTemplateOutlet="sidebarRightTemplate;context:sidebarRightTemplateContext" /> <ng-container *ngTemplateOutlet="sidebarRightTemplate;context:sidebarRightTemplateContext" />
</ng-container> </ng-container>
<ng-content *ngIf="!sidebarRightTemplate" <ng-content *ngIf="!sidebarRightTemplate"
select="adf-viewer-sidebar"></ng-content> select="adf-viewer-sidebar" />
</div> </div>
</ng-container> </ng-container>
@@ -155,7 +155,7 @@
<ng-container *ngTemplateOutlet="sidebarLeftTemplate;context:sidebarLeftTemplateContext" /> <ng-container *ngTemplateOutlet="sidebarLeftTemplate;context:sidebarLeftTemplateContext" />
</ng-container> </ng-container>
<ng-content *ngIf="!sidebarLeftTemplate" <ng-content *ngIf="!sidebarLeftTemplate"
select="adf-viewer-sidebar"></ng-content> select="adf-viewer-sidebar" />
</div> </div>
</ng-container> </ng-container>