[ACS-6071] fix JSDoc issues for Core lib (#8942)

* fix jsdoc issues

* docs fixes

* doc fixes

* doc fixes

* fix docs

* fix bugs
This commit is contained in:
Denys Vuika
2023-09-28 14:00:30 +01:00
committed by GitHub
parent d7e0bb6cd3
commit 65d70bffb2
46 changed files with 280 additions and 79 deletions

View File

@@ -316,6 +316,10 @@ export class AdfHttpClient implements ee.Emitter,JsApiHttpClient {
/** /**
* Deserialize an HTTP response body into a value of the specified type. * Deserialize an HTTP response body into a value of the specified type.
*
* @param response response object
* @param returnType return type
* @returns deserialized object
*/ */
private static deserialize<T>(response: HttpResponse<T>, returnType?: Constructor<unknown> | 'blob'): any { private static deserialize<T>(response: HttpResponse<T>, returnType?: Constructor<unknown> | 'blob'): any {

View File

@@ -21,6 +21,9 @@ describe('AlfrescoApiUtils', () => {
describe('isConstructor', () => { describe('isConstructor', () => {
class MockClass {} class MockClass {}
/**
* Mock function for tests
*/
function mockFUnction() {} function mockFUnction() {}
it('should return true for class and functions', () => { it('should return true for class and functions', () => {

View File

@@ -57,6 +57,9 @@ export const getQueryParamsWithCustomEncoder = (obj: Record<string | number, unk
/** /**
* Removes null and undefined values from an object. * Removes null and undefined values from an object.
*
* @param obj object to process
* @returns object with updated values
*/ */
export const removeNilValues = (obj: Record<string | number, unknown>) => { export const removeNilValues = (obj: Record<string | number, unknown>) => {

View File

@@ -29,6 +29,13 @@ type NonFunctionPropertyNames<T> = {[K in keyof T]: T[K] extends () => any ? nev
type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>; type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
type StoryWithoutFunction<T> = NonFunctionProperties<Story<T>>; type StoryWithoutFunction<T> = NonFunctionProperties<Story<T>>;
/**
* Copy storybook story
*
* @param story story
* @param annotations annotations
* @returns a copy of the story
*/
function storybookCopyStory<T>( story: Story<T>, annotations?: StoryWithoutFunction<T> ): Story<T> { function storybookCopyStory<T>( story: Story<T>, annotations?: StoryWithoutFunction<T> ): Story<T> {
const cloned = story.bind({}); const cloned = story.bind({});
return Object.assign(cloned, annotations); return Object.assign(cloned, annotations);

View File

@@ -43,6 +43,12 @@ export class ShellModule {
} }
} }
/**
* Resolve module for routes
*
* @param routes route configuration
* @returns module with providers
*/
function getModuleForRoutes(routes: Routes): ModuleWithProviders<ShellModule> { function getModuleForRoutes(routes: Routes): ModuleWithProviders<ShellModule> {
const shellLayoutRoute = SHELL_LAYOUT_ROUTE; const shellLayoutRoute = SHELL_LAYOUT_ROUTE;
@@ -56,6 +62,12 @@ function getModuleForRoutes(routes: Routes): ModuleWithProviders<ShellModule> {
}; };
} }
/**
* Resolve a module for the route configuration
*
* @param config route configuration
* @returns module with providers
*/
function getModuleForRouteConfig(config: AppShellRoutesConfig): ModuleWithProviders<ShellModule> { function getModuleForRouteConfig(config: AppShellRoutesConfig): ModuleWithProviders<ShellModule> {
const shellLayoutRoute = SHELL_LAYOUT_ROUTE; const shellLayoutRoute = SHELL_LAYOUT_ROUTE;

View File

@@ -20,6 +20,12 @@ import { Injectable } from '@angular/core';
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service'; import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
import { AlfrescoApiService } from '../services/alfresco-api.service'; import { AlfrescoApiService } from '../services/alfresco-api.service';
/**
* Create a factory to resolve an api service instance
*
* @param angularAlfrescoApiService loader service
* @returns factory function
*/
export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApiLoaderService) { export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApiLoaderService) {
return () => angularAlfrescoApiService.init(); return () => angularAlfrescoApiService.init();
} }

View File

@@ -19,6 +19,14 @@ import { AppConfigService, AppConfigValues } from './app-config.service';
import { StorageService } from '../common/services/storage.service'; import { StorageService } from '../common/services/storage.service';
import { AdfHttpClient } from '@alfresco/adf-core/api'; import { AdfHttpClient } from '@alfresco/adf-core/api';
/**
* Create a factory to load app configuration
*
* @param appConfigService app config service
* @param storageService storage service
* @param adfHttpClient http client
* @returns factory function
*/
export function loadAppConfig(appConfigService: AppConfigService, storageService: StorageService, adfHttpClient: AdfHttpClient) { export function loadAppConfig(appConfigService: AppConfigService, storageService: StorageService, adfHttpClient: AdfHttpClient) {
return () => appConfigService.load().then(() => { return () => appConfigService.load().then(() => {
adfHttpClient.disableCsrf = appConfigService.get<boolean>(AppConfigValues.DISABLECSRF, true); adfHttpClient.disableCsrf = appConfigService.get<boolean>(AppConfigValues.DISABLECSRF, true);

View File

@@ -215,6 +215,7 @@ export class AppConfigService {
/** /**
* Call the discovery API to fetch configuration * Call the discovery API to fetch configuration
* *
* @param hostIdp host address
* @returns Discovery configuration * @returns Discovery configuration
*/ */
loadWellKnown(hostIdp: string): Promise<OpenidConfiguration> { loadWellKnown(hostIdp: string): Promise<OpenidConfiguration> {
@@ -234,6 +235,8 @@ export class AppConfigService {
/** /**
* OAuth2 configuration * OAuth2 configuration
*
* @returns auth config model
*/ */
get oauth2(): OauthConfigModel { get oauth2(): OauthConfigModel {
const config = this.get(AppConfigValues.OAUTHCONFIG, {}); const config = this.get(AppConfigValues.OAUTHCONFIG, {});

View File

@@ -42,6 +42,12 @@ describe('Auth Guard SSO role service', () => {
routerService = TestBed.inject(Router); routerService = TestBed.inject(Router);
}); });
/**
* Spy on user access
*
* @param realmRoles roles
* @param resourceAccess resource access values
*/
function spyUserAccess(realmRoles: string[], resourceAccess: any) { function spyUserAccess(realmRoles: string[], resourceAccess: any) {
spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token');
spyOn(jwtHelperService, 'decodeToken').and.returnValue({ spyOn(jwtHelperService, 'decodeToken').and.returnValue({

View File

@@ -21,6 +21,12 @@ import { take } from 'rxjs/operators';
import { AppConfigService } from '../../app-config/app-config.service'; import { AppConfigService } from '../../app-config/app-config.service';
import { AuthModuleConfig, AUTH_MODULE_CONFIG } from './auth-config'; import { AuthModuleConfig, AUTH_MODULE_CONFIG } from './auth-config';
/**
* Create auth configuration factory
*
* @param authConfigService auth config service
* @returns factory function
*/
export function authConfigFactory(authConfigService: AuthConfigService): Promise<AuthConfig> { export function authConfigFactory(authConfigService: AuthConfigService): Promise<AuthConfig> {
return authConfigService.loadConfig(); return authConfigService.loadConfig();
} }

View File

@@ -33,6 +33,14 @@ import { OIDCAuthenticationService } from './oidc-authentication.service';
import { RedirectAuthService } from './redirect-auth.service'; import { RedirectAuthService } from './redirect-auth.service';
import { AuthenticationConfirmationComponent } from './view/authentication-confirmation/authentication-confirmation.component'; import { AuthenticationConfirmationComponent } from './view/authentication-confirmation/authentication-confirmation.component';
/**
* Create a Login Factory function
*
* @param oAuthService auth service
* @param storage storage service
* @param config auth configuration
* @returns a factory function
*/
export function loginFactory(oAuthService: OAuthService, storage: OAuthStorage, config: AuthConfig) { export function loginFactory(oAuthService: OAuthService, storage: OAuthStorage, config: AuthConfig) {
const service = new RedirectAuthService(oAuthService, storage, config); const service = new RedirectAuthService(oAuthService, storage, config);
return () => service.init(); return () => service.init();

View File

@@ -34,7 +34,11 @@ export class RedirectAuthService extends AuthService {
/** Subscribe to errors reaching the IdP. */ /** Subscribe to errors reaching the IdP. */
idpUnreachable$!: Observable<Error>; idpUnreachable$!: Observable<Error>;
/** Get whether the user has valid Id/Access tokens. */ /**
* Get whether the user has valid Id/Access tokens.
*
* @returns `true` if the user is authenticated, otherwise `false`
*/
get authenticated(): boolean { get authenticated(): boolean {
return this.oauthService.hasValidIdToken() && this.oauthService.hasValidAccessToken(); return this.oauthService.hasValidIdToken() && this.oauthService.hasValidAccessToken();
} }

View File

@@ -239,7 +239,8 @@ export abstract class BaseAuthenticationService {
this.redirectUrl = url; this.redirectUrl = url;
} }
/** Gets the URL to redirect to after login. /**
* Gets the URL to redirect to after login.
* *
* @returns The redirect URL * @returns The redirect URL
*/ */

View File

@@ -79,6 +79,7 @@ export class IdentityGroupService implements IdentityGroupServiceInterface {
* *
* @param groupId The ID of the group * @param groupId The ID of the group
* @param roles Array of roles to assign * @param roles Array of roles to assign
* @returns request result
*/ */
assignRoles(groupId: string, roles: IdentityRoleModel[]): Observable<any> { assignRoles(groupId: string, roles: IdentityRoleModel[]): Observable<any> {
const url = `${this.identityHost}/groups/${groupId}/role-mappings/realm`; const url = `${this.identityHost}/groups/${groupId}/role-mappings/realm`;
@@ -92,6 +93,7 @@ export class IdentityGroupService implements IdentityGroupServiceInterface {
* *
* @param groupId The ID of the group * @param groupId The ID of the group
* @param roles Array of roles to remove * @param roles Array of roles to remove
* @returns request result
*/ */
removeRoles(groupId: string, roles: IdentityRoleModel[]): Observable<any> { removeRoles(groupId: string, roles: IdentityRoleModel[]): Observable<any> {
const url = `${this.identityHost}/groups/${groupId}/role-mappings/realm`; const url = `${this.identityHost}/groups/${groupId}/role-mappings/realm`;
@@ -114,6 +116,7 @@ export class IdentityGroupService implements IdentityGroupServiceInterface {
/** /**
* Queries groups. * Queries groups.
* *
* @param requestQuery query settings
* @returns Array of user information objects * @returns Array of user information objects
*/ */
queryGroups(requestQuery: IdentityGroupQueryCloudRequestModel): Observable<IdentityGroupQueryResponse> { queryGroups(requestQuery: IdentityGroupQueryCloudRequestModel): Observable<IdentityGroupQueryResponse> {

View File

@@ -48,6 +48,8 @@ export class IdentityRoleService {
/** /**
* Ret all roles * Ret all roles
* *
* @param skipCount skip count
* @param size page size
* @returns List of roles * @returns List of roles
*/ */
getRoles( getRoles(

View File

@@ -320,6 +320,7 @@ export class IdentityUserService implements IdentityUserServiceInterface {
/** /**
* Gets details for all users. * Gets details for all users.
* *
* @param requestQuery query model
* @returns Array of user information objects. * @returns Array of user information objects.
*/ */
queryUsers(requestQuery: IdentityUserQueryCloudRequestModel): Observable<IdentityUserQueryResponse> { queryUsers(requestQuery: IdentityUserQueryCloudRequestModel): Observable<IdentityUserQueryResponse> {
@@ -396,7 +397,7 @@ export class IdentityUserService implements IdentityUserServiceInterface {
* Changes user password. * Changes user password.
* *
* @param userId Id of the user. * @param userId Id of the user.
* @param credentials Details of user Credentials. * @param newPassword Details of user Credentials.
* @returns Empty response when the password changed. * @returns Empty response when the password changed.
*/ */
changePassword(userId: string, newPassword: IdentityUserPasswordModel): Observable<any> { changePassword(userId: string, newPassword: IdentityUserPasswordModel): Observable<any> {
@@ -499,7 +500,7 @@ export class IdentityUserService implements IdentityUserServiceInterface {
* Removes assigned roles. * Removes assigned roles.
* *
* @param userId Id of the user. * @param userId Id of the user.
* @param roles Array of roles. * @param removedRoles Array of roles.
* @returns Empty response when the role removed. * @returns Empty response when the role removed.
*/ */
removeRoles(userId: string, removedRoles: IdentityRoleModel[]): Observable<any> { removeRoles(userId: string, removedRoles: IdentityRoleModel[]): Observable<any> {

View File

@@ -130,12 +130,13 @@ export class JwtHelperService {
/** /**
* Gets a named value from the user access token. * Gets a named value from the user access token.
* *
* @param accessToken your SSO access token where the value is encode * @param token your SSO access token where the value is encode
* @param key Key name of the field to retrieve * @param key Key name of the field to retrieve
* @returns Value from the token * @returns Value from the token
*/ */
getValueFromToken<T>(token: string, key: string): T { getValueFromToken<T>(token: string, key: string): T {
let value; let value: T;
if (token) { if (token) {
const tokenPayload = this.decodeToken(token); const tokenPayload = this.decodeToken(token);
value = tokenPayload[key]; value = tokenPayload[key];
@@ -156,6 +157,7 @@ export class JwtHelperService {
/** /**
* Gets Client roles. * Gets Client roles.
* *
* @param clientName client name
* @returns Array of client roles * @returns Array of client roles
*/ */
getClientRoles(clientName: string): string[] { getClientRoles(clientName: string): string[] {

View File

@@ -36,6 +36,12 @@ describe('UserAccessService', () => {
appConfigService = TestBed.inject(AppConfigService); appConfigService = TestBed.inject(AppConfigService);
}); });
/**
* spy on auth realm access
*
* @param realmRoles roles
* @param resourceAccess access settings
*/
function spyRealmAccess(realmRoles: string[], resourceAccess: any) { function spyRealmAccess(realmRoles: string[], resourceAccess: any) {
spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token');
spyOn(jwtHelperService, 'decodeToken').and.returnValue({ spyOn(jwtHelperService, 'decodeToken').and.returnValue({
@@ -44,6 +50,12 @@ describe('UserAccessService', () => {
}); });
} }
/**
* spy on HxP authorisation
*
* @param appkey app key
* @param roles roles list
*/
function spyHxpAuthorization(appkey: string, roles: string[]) { function spyHxpAuthorization(appkey: string, roles: string[]) {
spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token');
spyOn(jwtHelperService, 'decodeToken').and.returnValue({ spyOn(jwtHelperService, 'decodeToken').and.returnValue({

View File

@@ -247,7 +247,12 @@ describe('CardViewComponent', () => {
expect(cardViewItemDispatcherComponent.displayLabelForChips).toBe(true); expect(cardViewItemDispatcherComponent.displayLabelForChips).toBe(true);
}); });
function getCardViewItemDispatcherComponent() { /**
* Return the card view item dispatcher component
*
* @returns the dispatcher component instance
*/
function getCardViewItemDispatcherComponent(): CardViewItemDispatcherComponent {
const cardViewItemDispatcherDebugElement = fixture.debugElement.query(By.directive(CardViewItemDispatcherComponent)); const cardViewItemDispatcherDebugElement = fixture.debugElement.query(By.directive(CardViewItemDispatcherComponent));
return cardViewItemDispatcherDebugElement.componentInstance as CardViewItemDispatcherComponent; return cardViewItemDispatcherDebugElement.componentInstance as CardViewItemDispatcherComponent;
} }

View File

@@ -53,7 +53,7 @@ export class CardViewUpdateService implements BaseCardViewUpdate {
/** /**
* Updates the cardview items property * Updates the cardview items property
* *
* @param notification * @param notification notification value
*/ */
updateElement(notification: CardViewBaseItemModel) { updateElement(notification: CardViewBaseItemModel) {
this.updateItem$.next(notification); this.updateItem$.next(notification);

View File

@@ -18,6 +18,12 @@
import { DirectionalityConfigService } from './directionality-config.service'; import { DirectionalityConfigService } from './directionality-config.service';
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions // eslint-disable-next-line prefer-arrow/prefer-arrow-functions
/**
* Creates a factory for Angular modules
*
* @param directionalityConfigService service dependency
* @returns a factory function
*/
export function directionalityConfigFactory(directionalityConfigService: DirectionalityConfigService) { export function directionalityConfigFactory(directionalityConfigService: DirectionalityConfigService) {
return () => directionalityConfigService; return () => directionalityConfigService;
} }

View File

@@ -75,6 +75,9 @@ export abstract class DynamicComponentMapper {
/** /**
* Register multiple components * Register multiple components
*
* @param components map of components to register
* @param override replace existing components
*/ */
register(components: { [key: string]: DynamicComponentResolveFunction }, override: boolean = false) { register(components: { [key: string]: DynamicComponentResolveFunction }, override: boolean = false) {
if (components) { if (components) {

View File

@@ -217,7 +217,11 @@ export class UserPreferencesService {
} }
} }
/** Current locale setting. */ /**
* Current locale setting.
*
* @returns locale name
*/
get locale(): string { get locale(): string {
return this.get(UserPreferenceValues.Locale); return this.get(UserPreferenceValues.Locale);
} }

View File

@@ -20,8 +20,9 @@ export class ObjectUtils {
* Gets a value from an object by composed key * Gets a value from an object by composed key
* ObjectUtils.getValue({ item: { nodeType: 'cm:folder' }}, 'item.nodeType') ==> 'cm:folder' * ObjectUtils.getValue({ item: { nodeType: 'cm:folder' }}, 'item.nodeType') ==> 'cm:folder'
* *
* @param target * @param target target object
* @param key * @param key object property key
* @returns object property value
*/ */
static getValue(target: any, key: string): any { static getValue(target: any, key: string): any {

View File

@@ -103,7 +103,8 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
@Input() @Input()
rows: any[] = []; rows: any[] = [];
/** Define the sort order of the datatable. Possible values are : /**
* Define the sort order of the datatable. Possible values are :
* [`created`, `desc`], [`created`, `asc`], [`due`, `desc`], [`due`, `asc`] * [`created`, `desc`], [`created`, `asc`], [`due`, `desc`], [`due`, `asc`]
*/ */
@Input() @Input()
@@ -113,7 +114,8 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
@Input() @Input()
columns: any[] = []; columns: any[] = [];
/** Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, /**
* Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode,
* you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. * you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows.
*/ */
@Input() @Input()
@@ -151,7 +153,8 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
@Input() @Input()
contextMenu: boolean = false; contextMenu: boolean = false;
/** The inline style to apply to every row. See /**
* The inline style to apply to every row. See
* [NgStyle](https://angular.io/docs/ts/latest/api/common/index/NgStyle-directive.html) * [NgStyle](https://angular.io/docs/ts/latest/api/common/index/NgStyle-directive.html)
* docs for more details and usage examples. * docs for more details and usage examples.
*/ */
@@ -198,7 +201,8 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
@Output() @Output()
columnsWidthChanged = new EventEmitter<DataColumn[]>(); columnsWidthChanged = new EventEmitter<DataColumn[]>();
/** Flag that indicates if the datatable is in loading state and needs to show the /**
* Flag that indicates if the datatable is in loading state and needs to show the
* loading template (see the docs to learn how to configure a loading template). * loading template (see the docs to learn how to configure a loading template).
*/ */
@Input() @Input()

View File

@@ -29,7 +29,8 @@ export class DataColumnComponent implements OnInit {
@Input() @Input()
id: string = ''; id: string = '';
/** Data source key. Can be either a column/property key like `title` /**
* Data source key. Can be either a column/property key like `title`
* or a property path like `createdBy.name`. * or a property path like `createdBy.name`.
*/ */
@Input() @Input()
@@ -39,7 +40,8 @@ export class DataColumnComponent implements OnInit {
@Input() @Input()
customData: any; customData: any;
/** Value type for the column. Possible settings are 'text', 'image', /**
* Value type for the column. Possible settings are 'text', 'image',
* 'date', 'fileSize', 'location', and 'json'. * 'date', 'fileSize', 'location', and 'json'.
*/ */
@Input() @Input()
@@ -61,7 +63,8 @@ export class DataColumnComponent implements OnInit {
@Input() @Input()
isHidden: boolean = false; isHidden: boolean = false;
/** Display title of the column, typically used for column headers. You can use the /**
* Display title of the column, typically used for column headers. You can use the
* i18n resource key to get it translated automatically. * i18n resource key to get it translated automatically.
*/ */
@Input() @Input()
@@ -98,7 +101,7 @@ export class DataColumnComponent implements OnInit {
@Input() @Input()
sortingKey: string; sortingKey: string;
/** Sets position of column. **/ /** Sets position of column. */
@Input() @Input()
order?: number; order?: number;

View File

@@ -32,7 +32,8 @@ export class UploadDirective implements OnInit, OnDestroy {
@Input('adf-upload-data') @Input('adf-upload-data')
data: any; data: any;
/** Upload mode. Can be "drop" (receives dropped files) or "click" /**
* Upload mode. Can be "drop" (receives dropped files) or "click"
* (clicking opens a file dialog). Both modes can be active at once. * (clicking opens a file dialog). Both modes can be active at once.
*/ */
@Input() @Input()
@@ -191,6 +192,7 @@ export class UploadDirective implements OnInit, OnDestroy {
* Extract files from the DataTransfer object used to hold the data that is being dragged during a drag and drop operation. * Extract files from the DataTransfer object used to hold the data that is being dragged during a drag and drop operation.
* *
* @param dataTransfer DataTransfer object * @param dataTransfer DataTransfer object
* @returns a list of file info objects
*/ */
getFilesDropped(dataTransfer: DataTransfer): Promise<FileInfo[]> { getFilesDropped(dataTransfer: DataTransfer): Promise<FileInfo[]> {
return new Promise((resolve) => { return new Promise((resolve) => {

View File

@@ -79,19 +79,20 @@ export abstract class FormBaseComponent {
/** Emitted when the supplied form values have a validation error. */ /** Emitted when the supplied form values have a validation error. */
@Output() @Output()
formError: EventEmitter<FormFieldModel[]> = new EventEmitter<FormFieldModel[]>(); formError = new EventEmitter<FormFieldModel[]>();
/** Emitted when any outcome is executed. Default behaviour can be prevented /**
* Emitted when any outcome is executed. Default behaviour can be prevented
* via `event.preventDefault()`. * via `event.preventDefault()`.
*/ */
@Output() @Output()
executeOutcome: EventEmitter<FormOutcomeEvent> = new EventEmitter<FormOutcomeEvent>(); executeOutcome = new EventEmitter<FormOutcomeEvent>();
/** /**
* Emitted when any error occurs. * Emitted when any error occurs.
*/ */
@Output() @Output()
error: EventEmitter<any> = new EventEmitter<any>(); error = new EventEmitter<any>();
form: FormModel; form: FormModel;
@@ -158,6 +159,7 @@ export abstract class FormBaseComponent {
* Invoked when user clicks outcome button. * Invoked when user clicks outcome button.
* *
* @param outcome Form outcome model * @param outcome Form outcome model
* @returns `true` if outcome button was clicked, otherwise `false`
*/ */
onOutcomeClicked(outcome: FormOutcomeModel): boolean { onOutcomeClicked(outcome: FormOutcomeModel): boolean {
if (!this.readOnly && outcome && this.form) { if (!this.readOnly && outcome && this.form) {

View File

@@ -57,7 +57,8 @@ export class FormFieldComponent implements OnInit, OnDestroy {
@ViewChild('container', { read: ViewContainerRef, static: true }) @ViewChild('container', { read: ViewContainerRef, static: true })
container: ViewContainerRef; container: ViewContainerRef;
/** Contains all the necessary data needed to determine what UI Widget /**
* Contains all the necessary data needed to determine what UI Widget
* to use when rendering the field in the form. You would typically not * to use when rendering the field in the form. You would typically not
* create this data manually but instead create the form in APS and export * create this data manually but instead create the form in APS and export
* it to get to all the `FormFieldModel` definitions. * it to get to all the `FormFieldModel` definitions.

View File

@@ -78,6 +78,9 @@ export class FormRendererComponent<T> implements OnChanges, OnDestroy {
/** /**
* Serializes column fields * Serializes column fields
*
* @param content container model
* @returns a list of form field models
*/ */
getContainerFields(content: ContainerModel): FormFieldModel[] { getContainerFields(content: ContainerModel): FormFieldModel[] {
const serialisedFormFields: FormFieldModel[] = []; const serialisedFormFields: FormFieldModel[] = [];
@@ -113,7 +116,8 @@ export class FormRendererComponent<T> implements OnChanges, OnDestroy {
/** /**
* Calculate the column width based on the numberOfColumns and current field's colspan property * Calculate the column width based on the numberOfColumns and current field's colspan property
* *
* @param container * @param container container model
* @returns the column width for the given model
*/ */
getColumnWith(container: ContainerModel): string { getColumnWith(container: ContainerModel): string {
const colspan = container ? container.field.colspan : 1; const colspan = container ? container.field.colspan : 1;

View File

@@ -72,6 +72,16 @@ describe('BaseViewerWidgetComponent', () => {
}); });
}); });
/**
* Assert the field value
*
* @param value field value
* @param expectedFileId field id
* @param fakeForm form model
* @param widget form widget
* @param fixture test fixture
* @param done callback
*/
function assertFileId(value: any, expectedFileId: string, fakeForm: FormModel, widget: BaseViewerWidgetComponent, fixture: ComponentFixture<BaseViewerWidgetComponent>, done: DoneFn) { function assertFileId(value: any, expectedFileId: string, fakeForm: FormModel, widget: BaseViewerWidgetComponent, fixture: ComponentFixture<BaseViewerWidgetComponent>, done: DoneFn) {
const fakeField = new FormFieldModel(fakeForm, { id: 'fakeField', value }); const fakeField = new FormFieldModel(fakeForm, { id: 'fakeField', value });
widget.field = fakeField; widget.field = fakeField;

View File

@@ -474,11 +474,12 @@ export class FormFieldModel extends FormWidgetModel {
} }
/** /**
* Skip the invalid field type * Check if the field type is invalid, requires a type to be a `container`
* *
* @param type * @param type field type
* @returns `true` if type is a `container`, otherwise `false`
*/ */
isInvalidFieldType(type: string) { isInvalidFieldType(type: string): boolean {
return type === 'container'; return type === 'container';
} }

View File

@@ -248,6 +248,7 @@ export class FormModel implements ProcessFormModel {
* Returns a form variable that matches the identifier. * Returns a form variable that matches the identifier.
* *
* @param identifier The `name` or `id` value. * @param identifier The `name` or `id` value.
* @returns form variable model
*/ */
getFormVariable(identifier: string): FormVariableModel { getFormVariable(identifier: string): FormVariableModel {
if (identifier) { if (identifier) {
@@ -261,6 +262,7 @@ export class FormModel implements ProcessFormModel {
* Provides additional conversion of types (date, boolean). * Provides additional conversion of types (date, boolean).
* *
* @param identifier The `name` or `id` value * @param identifier The `name` or `id` value
* @returns form variable value
*/ */
getDefaultFormVariableValue(identifier: string): any { getDefaultFormVariableValue(identifier: string): any {
const variable = this.getFormVariable(identifier); const variable = this.getFormVariable(identifier);
@@ -278,6 +280,7 @@ export class FormModel implements ProcessFormModel {
* is already resolved by the rest API with the name of variables.formVariableName * is already resolved by the rest API with the name of variables.formVariableName
* *
* @param name Variable name * @param name Variable name
* @returns process variable value
*/ */
getProcessVariableValue(name: string): any { getProcessVariableValue(name: string): any {
let value; let value;

View File

@@ -24,6 +24,12 @@ import { FormModel, FormService } from '../public-api';
export const FORM_RULES_MANAGER = new InjectionToken<FormRulesManager<any>>('form.rule.manager'); export const FORM_RULES_MANAGER = new InjectionToken<FormRulesManager<any>>('form.rule.manager');
/**
* A factory for forms rule manager
*
* @param injector Angular injector
* @returns FormsRuleManager instance
*/
export function formRulesManagerFactory<T>(injector: Injector): FormRulesManager<T> { export function formRulesManagerFactory<T>(injector: Injector): FormRulesManager<T> {
try { try {
return injector.get(FORM_RULES_MANAGER); return injector.get(FORM_RULES_MANAGER);

View File

@@ -64,7 +64,7 @@ export class FormService implements FormValidationService {
* @param json JSON to create the form * @param json JSON to create the form
* @param data Values for the form fields * @param data Values for the form fields
* @param readOnly Should the form fields be read-only? * @param readOnly Should the form fields be read-only?
* @param fixedSpace * @param fixedSpace use fixed space
* @returns Form model created from input data * @returns Form model created from input data
*/ */
parseForm(json: any, data?: FormValues, readOnly: boolean = false, fixedSpace?: boolean): FormModel { parseForm(json: any, data?: FormValues, readOnly: boolean = false, fixedSpace?: boolean): FormModel {

View File

@@ -54,11 +54,12 @@ export class IdentityUserInfoComponent implements OnDestroy {
@Input() @Input()
showName: boolean = true; showName: boolean = true;
/** When the username is shown, this defines its position relative to the user info button. /**
* When the username is shown, this defines its position relative to the user info button.
* Can be `right` or `left`. * Can be `right` or `left`.
*/ */
@Input() @Input()
namePosition: string = 'right'; namePosition: 'right' | 'left' = 'right';
private destroy$ = new Subject(); private destroy$ = new Subject();

View File

@@ -42,6 +42,11 @@ interface ValidationMessage {
params?: any; params?: any;
} }
interface LoginFormValues {
username: string;
password: string;
};
@Component({ @Component({
selector: 'adf-login', selector: 'adf-login',
templateUrl: './login.component.html', templateUrl: './login.component.html',
@@ -182,9 +187,9 @@ export class LoginComponent implements OnInit, OnDestroy {
/** /**
* Method called on submit form * Method called on submit form
* *
* @param values * @param values login form values
*/ */
onSubmit(values: any): void { onSubmit(values: LoginFormValues): void {
this.disableError(); this.disableError();
const args = new LoginSubmitEvent({ const args = new LoginSubmitEvent({
@@ -208,7 +213,7 @@ export class LoginComponent implements OnInit, OnDestroy {
/** /**
* The method check the error in the form and push the error in the formError object * The method check the error in the form and push the error in the formError object
* *
* @param data * @param data form data
*/ */
onValueChanged(data: any) { onValueChanged(data: any) {
this.disableError(); this.disableError();
@@ -232,7 +237,7 @@ export class LoginComponent implements OnInit, OnDestroy {
} }
} }
performLogin(values: { username: string; password: string }) { performLogin(values: LoginFormValues) {
this.authService.login(values.username, values.password, this.rememberMe).subscribe( this.authService.login(values.username, values.password, this.rememberMe).subscribe(
(token) => { (token) => {
const redirectUrl = this.authService.getRedirect(); const redirectUrl = this.authService.getRedirect();
@@ -260,6 +265,8 @@ export class LoginComponent implements OnInit, OnDestroy {
/** /**
* Check and display the right error message in the UI * Check and display the right error message in the UI
*
* @param err error object
*/ */
private displayErrorMessage(err: any): void { private displayErrorMessage(err: any): void {
if (err.error?.crossDomain && err.error.message.indexOf('Access-Control-Allow-Origin') !== -1) { if (err.error?.crossDomain && err.error.message.indexOf('Access-Control-Allow-Origin') !== -1) {
@@ -276,8 +283,8 @@ export class LoginComponent implements OnInit, OnDestroy {
/** /**
* Add a custom form error for a field * Add a custom form error for a field
* *
* @param field * @param field field
* @param msg * @param msg error message
*/ */
public addCustomFormError(field: string, msg: string) { public addCustomFormError(field: string, msg: string) {
this.formError[field] += msg; this.formError[field] += msg;
@@ -286,10 +293,10 @@ export class LoginComponent implements OnInit, OnDestroy {
/** /**
* Add a custom validation rule error for a field * Add a custom validation rule error for a field
* *
* @param field * @param field field
* @param ruleId - i.e. required | minlength | maxlength * @param ruleId - i.e. required | minlength | maxlength
* @param msg * @param msg message
* @param params * @param params parameters
*/ */
addCustomValidationError(field: string, ruleId: string, msg: string, params?: any) { addCustomValidationError(field: string, ruleId: string, msg: string, params?: any) {
if (field !== '__proto__' && field !== 'constructor' && field !== 'prototype') { if (field !== '__proto__' && field !== 'constructor' && field !== 'prototype') {
@@ -302,6 +309,8 @@ export class LoginComponent implements OnInit, OnDestroy {
/** /**
* Display and hide the password value. * Display and hide the password value.
*
* @param event input event
*/ */
toggleShowPassword(event: Event) { toggleShowPassword(event: Event) {
event.stopPropagation(); event.stopPropagation();
@@ -311,14 +320,17 @@ export class LoginComponent implements OnInit, OnDestroy {
/** /**
* The method return if a field is valid or not * The method return if a field is valid or not
* *
* @param field * @param field form field to check
* @returns `true` if form field should display an error, otherwise `false`
*/ */
isErrorStyle(field: AbstractControl) { isErrorStyle(field: AbstractControl): boolean {
return !field.valid && field.dirty && !field.pristine; return !field.valid && field.dirty && !field.pristine;
} }
/** /**
* Trim username * Trim username
*
* @param event event
*/ */
trimUsername(event: any) { trimUsername(event: any) {
event.target.value = event.target.value.trim(); event.target.value = event.target.value.trim();

View File

@@ -70,6 +70,7 @@ export class NotificationService {
* @param action Action name * @param action Action name
* @param interpolateArgs The interpolation parameters to add for the translation * @param interpolateArgs The interpolation parameters to add for the translation
* @param showAction True if action should be visible, false if not. Default: true. * @param showAction True if action should be visible, false if not. Default: true.
* @returns snackbar reference
*/ */
showError(message: string, action?: string, interpolateArgs?: any, showAction = true): MatSnackBarRef<any> { showError(message: string, action?: string, interpolateArgs?: any, showAction = true): MatSnackBarRef<any> {
return this.dispatchNotification(message, action, { return this.dispatchNotification(message, action, {
@@ -87,6 +88,7 @@ export class NotificationService {
* @param action Action name * @param action Action name
* @param interpolateArgs The interpolation parameters to add for the translation * @param interpolateArgs The interpolation parameters to add for the translation
* @param showAction True if action should be visible, false if not. Default: true. * @param showAction True if action should be visible, false if not. Default: true.
* @returns snackbar reference
*/ */
showInfo(message: string, action?: string, interpolateArgs?: any, showAction = true): MatSnackBarRef<any> { showInfo(message: string, action?: string, interpolateArgs?: any, showAction = true): MatSnackBarRef<any> {
return this.dispatchNotification(message, action, { return this.dispatchNotification(message, action, {
@@ -104,6 +106,7 @@ export class NotificationService {
* @param action Action name * @param action Action name
* @param interpolateArgs The interpolation parameters to add for the translation * @param interpolateArgs The interpolation parameters to add for the translation
* @param showAction True if action should be visible, false if not. Default: true. * @param showAction True if action should be visible, false if not. Default: true.
* @returns snackbar reference
*/ */
showWarning(message: string, action?: string, interpolateArgs?: any, showAction = true): MatSnackBarRef<any> { showWarning(message: string, action?: string, interpolateArgs?: any, showAction = true): MatSnackBarRef<any> {
return this.dispatchNotification(message, action, { return this.dispatchNotification(message, action, {
@@ -117,8 +120,8 @@ export class NotificationService {
/** /**
* dismiss the notification snackbar * dismiss the notification snackbar
*/ */
dismissSnackMessageAction() { dismissSnackMessageAction(): void {
return this.snackBar.dismiss(); this.snackBar.dismiss();
} }
/** /**

View File

@@ -39,7 +39,8 @@ export class SearchTextInputComponent implements OnInit, OnDestroy {
@Input() @Input()
autocomplete: boolean = false; autocomplete: boolean = false;
/** Toggles whether to use an expanding search control. If false /**
* Toggles whether to use an expanding search control. If false
* then a regular input is used. * then a regular input is used.
*/ */
@Input() @Input()
@@ -93,19 +94,21 @@ export class SearchTextInputComponent implements OnInit, OnDestroy {
@Input() @Input()
hintLabel = ''; hintLabel = '';
/** Emitted when the search term is changed. The search term is provided /**
* Emitted when the search term is changed. The search term is provided
* in the 'value' property of the returned object. If the term is less * in the 'value' property of the returned object. If the term is less
* than three characters in length then it is truncated to an empty * than three characters in length then it is truncated to an empty
* string. * string.
*/ */
@Output() @Output()
searchChange: EventEmitter<string> = new EventEmitter(); searchChange = new EventEmitter<string>();
/** Emitted when the search is submitted by pressing the ENTER key. /**
* Emitted when the search is submitted by pressing the ENTER key.
* The search term is provided as the value of the event. * The search term is provided as the value of the event.
*/ */
@Output() @Output()
submit: EventEmitter<any> = new EventEmitter(); submit = new EventEmitter<any>();
/** Emitted when the result list is selected */ /** Emitted when the result list is selected */
@Output() @Output()

View File

@@ -18,6 +18,13 @@
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service'; import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
import { StorageService } from '../common/services/storage.service'; import { StorageService } from '../common/services/storage.service';
/**
* Loads application config file
*
* @param appConfigService configuration service
* @param storageService storage service
* @returns a factory to load application config
*/
export function loadAppConfig(appConfigService: AppConfigService, storageService: StorageService) { export function loadAppConfig(appConfigService: AppConfigService, storageService: StorageService) {
return () => return () =>
appConfigService.load().then(() => { appConfigService.load().then(() => {

View File

@@ -397,7 +397,7 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
* *
* @param oldScale - old scale page * @param oldScale - old scale page
* @param newScale - new scale page * @param newScale - new scale page
* * @returns `true` if the scale is the same, otherwise `false`
*/ */
isSameScale(oldScale: number, newScale: number): boolean { isSameScale(oldScale: number, newScale: number): boolean {
return newScale === oldScale; return newScale === oldScale;
@@ -406,8 +406,9 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
/** /**
* Check if is a land scape view * Check if is a land scape view
* *
* @param width * @param width target width
* @param height * @param height target height
* @returns `true` if the target is in the landscape mode, otherwise `false`
*/ */
isLandscape(width: number, height: number): boolean { isLandscape(width: number, height: number): boolean {
return width > height; return width > height;
@@ -434,9 +435,9 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
/** /**
* zoom in page pdf * zoom in page pdf
* *
* @param ticks * @param ticks number of ticks to zoom
*/ */
zoomIn(ticks?: number) { zoomIn(ticks?: number): void {
let newScale: any = this.pdfViewer.currentScaleValue; let newScale: any = this.pdfViewer.currentScaleValue;
do { do {
newScale = (newScale * this.DEFAULT_SCALE_DELTA).toFixed(2); newScale = (newScale * this.DEFAULT_SCALE_DELTA).toFixed(2);
@@ -450,9 +451,9 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
/** /**
* zoom out page pdf * zoom out page pdf
* *
* @param ticks * @param ticks number of ticks to scale
*/ */
zoomOut(ticks?: number) { zoomOut(ticks?: number): void {
let newScale: any = this.pdfViewer.currentScaleValue; let newScale: any = this.pdfViewer.currentScaleValue;
do { do {
newScale = (newScale / this.DEFAULT_SCALE_DELTA).toFixed(2); newScale = (newScale / this.DEFAULT_SCALE_DELTA).toFixed(2);
@@ -507,7 +508,7 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
/** /**
* Page Change Event * Page Change Event
* *
* @param event * @param event event
*/ */
onPageChange(event: any) { onPageChange(event: any) {
if (event.source && event.source.container.id === `${this.randomPdfId}-viewer-pdf-viewer`) { if (event.source && event.source.container.id === `${this.randomPdfId}-viewer-pdf-viewer`) {

View File

@@ -36,7 +36,8 @@ import { Track } from '../models/viewer.model';
}) })
export class ViewerRenderComponent implements OnChanges, OnInit, OnDestroy { export class ViewerRenderComponent implements OnChanges, OnInit, OnDestroy {
/** If you want to load an external file that does not come from ACS you /**
* If you want to load an external file that does not come from ACS you
* can use this URL to specify where to load the file from. * can use this URL to specify where to load the file from.
*/ */
@Input() @Input()
@@ -101,6 +102,8 @@ export class ViewerRenderComponent implements OnChanges, OnInit, OnDestroy {
/** /**
* Returns a list of the active Viewer content extensions. * Returns a list of the active Viewer content extensions.
*
* @returns list of extension references
*/ */
get viewerExtensions(): ViewerExtensionRef[] { get viewerExtensions(): ViewerExtensionRef[] {
return this.extensionService.getViewerExtensions(); return this.extensionService.getViewerExtensions();
@@ -108,6 +111,8 @@ export class ViewerRenderComponent implements OnChanges, OnInit, OnDestroy {
/** /**
* Provides a list of file extensions supported by external plugins. * Provides a list of file extensions supported by external plugins.
*
* @returns list of extensions
*/ */
get externalExtensions(): string[] { get externalExtensions(): string[] {
return this.viewerExtensions.map(ext => ext.fileExtension); return this.viewerExtensions.map(ext => ext.fileExtension);

View File

@@ -71,7 +71,8 @@ export class ViewerComponent<T> implements OnDestroy, OnInit, OnChanges {
@ContentChild(ViewerMoreActionsComponent) @ContentChild(ViewerMoreActionsComponent)
mnuMoreActions: ViewerMoreActionsComponent; mnuMoreActions: ViewerMoreActionsComponent;
/** If you want to load an external file that does not come from ACS you /**
* If you want to load an external file that does not come from ACS you
* can use this URL to specify where to load the file from. * can use this URL to specify where to load the file from.
*/ */
@Input() @Input()
@@ -101,13 +102,15 @@ export class ViewerComponent<T> implements OnDestroy, OnInit, OnChanges {
@Input() @Input()
showToolbar = true; showToolbar = true;
/** If `true` then show the Viewer as a full page over the current content. /**
* If `true` then show the Viewer as a full page over the current content.
* Otherwise fit inside the parent div. * Otherwise fit inside the parent div.
*/ */
@Input() @Input()
overlayMode = false; overlayMode = false;
/** Toggles before/next navigation. You can use the arrow buttons to navigate /**
* Toggles before/next navigation. You can use the arrow buttons to navigate
* between documents in the collection. * between documents in the collection.
*/ */
@Input() @Input()
@@ -171,29 +174,29 @@ export class ViewerComponent<T> implements OnDestroy, OnInit, OnChanges {
/** /**
* Enable dialog box to allow user to download the previewed file, in case the preview is not responding for a set period of time. * Enable dialog box to allow user to download the previewed file, in case the preview is not responding for a set period of time.
* */ */
enableDownloadPrompt: boolean = false; enableDownloadPrompt: boolean = false;
/** /**
* Enable reminder dialogs to prompt user to download the file, in case the preview is not responding for a set period of time. * Enable reminder dialogs to prompt user to download the file, in case the preview is not responding for a set period of time.
* */ */
enableDownloadPromptReminder: boolean = false; enableDownloadPromptReminder: boolean = false;
/** /**
* Initial time in seconds to wait before giving the first prompt to user to download the file * Initial time in seconds to wait before giving the first prompt to user to download the file
* */ */
downloadPromptDelay: number = 50; downloadPromptDelay: number = 50;
/** /**
* Time in seconds to wait before giving the second and consequent reminders to the user to download the file. * Time in seconds to wait before giving the second and consequent reminders to the user to download the file.
* */ */
downloadPromptReminderDelay: number = 15; downloadPromptReminderDelay: number = 15;
/** /**
* Emitted when user clicks on download button on download prompt dialog. * Emitted when user clicks on download button on download prompt dialog.
* */ */
@Output() @Output()
downloadFile: EventEmitter<void> = new EventEmitter<void>(); downloadFile = new EventEmitter<void>();
/** Emitted when user clicks 'Navigate Before' ("<") button. */ /** Emitted when user clicks 'Navigate Before' ("<") button. */
@Output() @Output()

View File

@@ -68,9 +68,12 @@ export class ViewerExtensionDirective implements AfterContentInit, OnDestroy {
} }
/** /**
* check if the current extension in the viewer is compatible with this extension checking against supportedExtensions * Check if the current extension in the viewer is compatible with this extension checking against `supportedExtensions`
*
* @param fileExtension file extension to check
* @returns `true` if file extension is compatible, otherwise `false`
*/ */
isVisible(fileExtension): boolean { isVisible(fileExtension: string): boolean {
let supportedExtension: string; let supportedExtension: string;
if (this.supportedExtensions && (this.supportedExtensions instanceof Array)) { if (this.supportedExtensions && (this.supportedExtensions instanceof Array)) {

View File

@@ -43,21 +43,28 @@ export class RenderingQueueServices {
isThumbnailViewEnabled: any = false; isThumbnailViewEnabled: any = false;
/** /**
* @param pdfViewer * Set the instance of the PDF Viewer
*
* @param pdfViewer viewer instance
*/ */
setViewer(pdfViewer) { setViewer(pdfViewer): void {
this.pdfViewer = pdfViewer; this.pdfViewer = pdfViewer;
} }
/** /**
* @param pdfThumbnailViewer * Sets the instance of the PDF Thumbnail Viewer
*
* @param pdfThumbnailViewer viewer instance
*/ */
setThumbnailViewer(pdfThumbnailViewer) { setThumbnailViewer(pdfThumbnailViewer): void {
this.pdfThumbnailViewer = pdfThumbnailViewer; this.pdfThumbnailViewer = pdfThumbnailViewer;
} }
/** /**
* @param view * Check if the view has highest rendering priority
*
* @param view view to render
* @returns `true` if the view has higher priority, otherwise `false`
*/ */
isHighestPriority(view: any): boolean { isHighestPriority(view: any): boolean {
return this.highestPriorityPage === view.renderingId; return this.highestPriorityPage === view.renderingId;
@@ -132,7 +139,10 @@ export class RenderingQueueServices {
} }
/** /**
* @param view * Checks if the view rendering is finished
*
* @param view the View instance to check
* @returns `true` if rendering is finished, otherwise `false`
*/ */
isViewFinished(view): boolean { isViewFinished(view): boolean {
return view.renderingState === this.renderingStates.FINISHED; return view.renderingState === this.renderingStates.FINISHED;
@@ -143,9 +153,10 @@ export class RenderingQueueServices {
* based on the views state. If the view is already rendered it will return * based on the views state. If the view is already rendered it will return
* false. * false.
* *
* @param view * @param view View instance to render
* @returns the rendered state of the view
*/ */
renderView(view: any) { renderView(view: any): boolean {
const state = view.renderingState; const state = view.renderingState;
switch (state) { switch (state) {
case this.renderingStates.FINISHED: { case this.renderingStates.FINISHED: {

View File

@@ -40,6 +40,8 @@ export class ViewUtilService {
/** /**
* Returns a list of the active Viewer content extensions. * Returns a list of the active Viewer content extensions.
*
* @returns list of extension references
*/ */
get viewerExtensions(): ViewerExtensionRef[] { get viewerExtensions(): ViewerExtensionRef[] {
return this.extensionService.getViewerExtensions(); return this.extensionService.getViewerExtensions();
@@ -47,6 +49,8 @@ export class ViewUtilService {
/** /**
* Provides a list of file extensions supported by external plugins. * Provides a list of file extensions supported by external plugins.
*
* @returns list of extensions
*/ */
get externalExtensions(): string[] { get externalExtensions(): string[] {
return this.viewerExtensions.map((ext) => ext.fileExtension); return this.viewerExtensions.map((ext) => ext.fileExtension);
@@ -58,6 +62,7 @@ export class ViewUtilService {
* get File name from url * get File name from url
* *
* @param url - url file * @param url - url file
* @returns file name portion of the url
*/ */
getFilenameFromUrl(url: string): string { getFilenameFromUrl(url: string): string {
const anchor = url.indexOf('#'); const anchor = url.indexOf('#');
@@ -73,6 +78,7 @@ export class ViewUtilService {
* http://localhost/test.jpg#cache=1000 * http://localhost/test.jpg#cache=1000
* *
* @param fileName - file name * @param fileName - file name
* @returns file extension
*/ */
getFileExtension(fileName: string): string { getFileExtension(fileName: string): string {
if (fileName) { if (fileName) {