From 65d70bffb2498c28a1ce1d90d5367f4a487989d3 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 28 Sep 2023 14:00:30 +0100 Subject: [PATCH] [ACS-6071] fix JSDoc issues for Core lib (#8942) * fix jsdoc issues * docs fixes * doc fixes * doc fixes * fix docs * fix bugs --- .../api/src/lib/adf-http-client.service.ts | 4 +++ .../alfresco-api/alfresco-api.utils.spec.ts | 3 ++ .../lib/alfresco-api/alfresco-api.utils.ts | 3 ++ .../src/_stories/breadcrumb.stories.ts | 7 ++++ lib/core/shell/src/lib/shell.module.ts | 12 +++++++ .../alfresco-api-v2-loader.service.ts | 6 ++++ .../src/lib/app-config/app-config.loader.ts | 8 +++++ .../src/lib/app-config/app-config.service.ts | 3 ++ .../guard/auth-guard-sso-role.service.spec.ts | 6 ++++ .../src/lib/auth/oidc/auth-config.service.ts | 6 ++++ lib/core/src/lib/auth/oidc/auth.module.ts | 8 +++++ .../lib/auth/oidc/redirect-auth.service.ts | 6 +++- .../services/base-authentication.service.ts | 3 +- .../auth/services/identity-group.service.ts | 3 ++ .../auth/services/identity-role.service.ts | 2 ++ .../auth/services/identity-user.service.ts | 5 +-- .../lib/auth/services/jwt-helper.service.ts | 6 ++-- .../auth/services/user-access.service.spec.ts | 12 +++++++ .../card-view/card-view.component.spec.ts | 7 +++- .../services/card-view-update.service.ts | 2 +- .../services/directionality-config-factory.ts | 6 ++++ .../dynamic-component-mapper.service.ts | 3 ++ .../services/user-preferences.service.ts | 6 +++- lib/core/src/lib/common/utils/object-utils.ts | 5 +-- .../datatable/datatable.component.ts | 12 ++++--- .../data-column/data-column.component.ts | 13 ++++--- .../src/lib/directives/upload.directive.ts | 4 ++- .../form/components/form-base.component.ts | 10 +++--- .../form-field/form-field.component.ts | 3 +- .../components/form-renderer.component.ts | 6 +++- .../base-viewer/base-viewer.widget.spec.ts | 10 ++++++ .../widgets/core/form-field.model.ts | 7 ++-- .../components/widgets/core/form.model.ts | 3 ++ .../src/lib/form/models/form-rules.model.ts | 6 ++++ .../src/lib/form/services/form.service.ts | 2 +- .../identity-user-info.component.ts | 5 +-- .../lib/login/components/login.component.ts | 34 +++++++++++++------ .../services/notification.service.ts | 7 ++-- .../search-text-input.component.ts | 13 ++++--- .../lib/services/startup-service-factory.ts | 7 ++++ .../viewer/components/pdf-viewer.component.ts | 17 +++++----- .../components/viewer-render.component.ts | 7 +++- .../lib/viewer/components/viewer.component.ts | 21 +++++++----- .../directives/viewer-extension.directive.ts | 7 ++-- .../services/rendering-queue.services.ts | 27 ++++++++++----- .../lib/viewer/services/view-util.service.ts | 6 ++++ 46 files changed, 280 insertions(+), 79 deletions(-) diff --git a/lib/core/api/src/lib/adf-http-client.service.ts b/lib/core/api/src/lib/adf-http-client.service.ts index 702cda1830..973bdaf333 100644 --- a/lib/core/api/src/lib/adf-http-client.service.ts +++ b/lib/core/api/src/lib/adf-http-client.service.ts @@ -316,6 +316,10 @@ export class AdfHttpClient implements ee.Emitter,JsApiHttpClient { /** * 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(response: HttpResponse, returnType?: Constructor | 'blob'): any { diff --git a/lib/core/api/src/lib/alfresco-api/alfresco-api.utils.spec.ts b/lib/core/api/src/lib/alfresco-api/alfresco-api.utils.spec.ts index 7ffb0c85cf..a483d7b16a 100644 --- a/lib/core/api/src/lib/alfresco-api/alfresco-api.utils.spec.ts +++ b/lib/core/api/src/lib/alfresco-api/alfresco-api.utils.spec.ts @@ -21,6 +21,9 @@ describe('AlfrescoApiUtils', () => { describe('isConstructor', () => { class MockClass {} + /** + * Mock function for tests + */ function mockFUnction() {} it('should return true for class and functions', () => { diff --git a/lib/core/api/src/lib/alfresco-api/alfresco-api.utils.ts b/lib/core/api/src/lib/alfresco-api/alfresco-api.utils.ts index 50ce14b38b..665b2eb7fd 100644 --- a/lib/core/api/src/lib/alfresco-api/alfresco-api.utils.ts +++ b/lib/core/api/src/lib/alfresco-api/alfresco-api.utils.ts @@ -57,6 +57,9 @@ export const getQueryParamsWithCustomEncoder = (obj: Record) => { diff --git a/lib/core/breadcrumbs/src/_stories/breadcrumb.stories.ts b/lib/core/breadcrumbs/src/_stories/breadcrumb.stories.ts index c985cd98ca..3217a96bf8 100644 --- a/lib/core/breadcrumbs/src/_stories/breadcrumb.stories.ts +++ b/lib/core/breadcrumbs/src/_stories/breadcrumb.stories.ts @@ -29,6 +29,13 @@ type NonFunctionPropertyNames = {[K in keyof T]: T[K] extends () => any ? nev type NonFunctionProperties = Pick>; type StoryWithoutFunction = NonFunctionProperties>; +/** + * Copy storybook story + * + * @param story story + * @param annotations annotations + * @returns a copy of the story + */ function storybookCopyStory( story: Story, annotations?: StoryWithoutFunction ): Story { const cloned = story.bind({}); return Object.assign(cloned, annotations); diff --git a/lib/core/shell/src/lib/shell.module.ts b/lib/core/shell/src/lib/shell.module.ts index 95045762f7..b4fae38f89 100644 --- a/lib/core/shell/src/lib/shell.module.ts +++ b/lib/core/shell/src/lib/shell.module.ts @@ -43,6 +43,12 @@ export class ShellModule { } } +/** + * Resolve module for routes + * + * @param routes route configuration + * @returns module with providers + */ function getModuleForRoutes(routes: Routes): ModuleWithProviders { const shellLayoutRoute = SHELL_LAYOUT_ROUTE; @@ -56,6 +62,12 @@ function getModuleForRoutes(routes: Routes): ModuleWithProviders { }; } +/** + * Resolve a module for the route configuration + * + * @param config route configuration + * @returns module with providers + */ function getModuleForRouteConfig(config: AppShellRoutesConfig): ModuleWithProviders { const shellLayoutRoute = SHELL_LAYOUT_ROUTE; diff --git a/lib/core/src/lib/api-factories/alfresco-api-v2-loader.service.ts b/lib/core/src/lib/api-factories/alfresco-api-v2-loader.service.ts index 098c16e9ba..836c53d9b1 100644 --- a/lib/core/src/lib/api-factories/alfresco-api-v2-loader.service.ts +++ b/lib/core/src/lib/api-factories/alfresco-api-v2-loader.service.ts @@ -20,6 +20,12 @@ import { Injectable } from '@angular/core'; import { AppConfigService, AppConfigValues } from '../app-config/app-config.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) { return () => angularAlfrescoApiService.init(); } diff --git a/lib/core/src/lib/app-config/app-config.loader.ts b/lib/core/src/lib/app-config/app-config.loader.ts index 55fd386c4e..d04bde43e1 100644 --- a/lib/core/src/lib/app-config/app-config.loader.ts +++ b/lib/core/src/lib/app-config/app-config.loader.ts @@ -19,6 +19,14 @@ import { AppConfigService, AppConfigValues } from './app-config.service'; import { StorageService } from '../common/services/storage.service'; 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) { return () => appConfigService.load().then(() => { adfHttpClient.disableCsrf = appConfigService.get(AppConfigValues.DISABLECSRF, true); diff --git a/lib/core/src/lib/app-config/app-config.service.ts b/lib/core/src/lib/app-config/app-config.service.ts index c17e7b1660..b272bcc50f 100644 --- a/lib/core/src/lib/app-config/app-config.service.ts +++ b/lib/core/src/lib/app-config/app-config.service.ts @@ -215,6 +215,7 @@ export class AppConfigService { /** * Call the discovery API to fetch configuration * + * @param hostIdp host address * @returns Discovery configuration */ loadWellKnown(hostIdp: string): Promise { @@ -234,6 +235,8 @@ export class AppConfigService { /** * OAuth2 configuration + * + * @returns auth config model */ get oauth2(): OauthConfigModel { const config = this.get(AppConfigValues.OAUTHCONFIG, {}); diff --git a/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.spec.ts b/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.spec.ts index feab33cf95..4102f2e804 100644 --- a/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.spec.ts +++ b/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.spec.ts @@ -42,6 +42,12 @@ describe('Auth Guard SSO role service', () => { routerService = TestBed.inject(Router); }); + /** + * Spy on user access + * + * @param realmRoles roles + * @param resourceAccess resource access values + */ function spyUserAccess(realmRoles: string[], resourceAccess: any) { spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'decodeToken').and.returnValue({ diff --git a/lib/core/src/lib/auth/oidc/auth-config.service.ts b/lib/core/src/lib/auth/oidc/auth-config.service.ts index a33b05a436..796f40f378 100644 --- a/lib/core/src/lib/auth/oidc/auth-config.service.ts +++ b/lib/core/src/lib/auth/oidc/auth-config.service.ts @@ -21,6 +21,12 @@ import { take } from 'rxjs/operators'; import { AppConfigService } from '../../app-config/app-config.service'; 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 { return authConfigService.loadConfig(); } diff --git a/lib/core/src/lib/auth/oidc/auth.module.ts b/lib/core/src/lib/auth/oidc/auth.module.ts index bf2a6fa550..d0907f20b8 100644 --- a/lib/core/src/lib/auth/oidc/auth.module.ts +++ b/lib/core/src/lib/auth/oidc/auth.module.ts @@ -33,6 +33,14 @@ import { OIDCAuthenticationService } from './oidc-authentication.service'; import { RedirectAuthService } from './redirect-auth.service'; 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) { const service = new RedirectAuthService(oAuthService, storage, config); return () => service.init(); diff --git a/lib/core/src/lib/auth/oidc/redirect-auth.service.ts b/lib/core/src/lib/auth/oidc/redirect-auth.service.ts index 0e87c75bed..c8591d0339 100644 --- a/lib/core/src/lib/auth/oidc/redirect-auth.service.ts +++ b/lib/core/src/lib/auth/oidc/redirect-auth.service.ts @@ -34,7 +34,11 @@ export class RedirectAuthService extends AuthService { /** Subscribe to errors reaching the IdP. */ idpUnreachable$!: Observable; - /** 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 { return this.oauthService.hasValidIdToken() && this.oauthService.hasValidAccessToken(); } diff --git a/lib/core/src/lib/auth/services/base-authentication.service.ts b/lib/core/src/lib/auth/services/base-authentication.service.ts index b79b60c36c..3e6d618c02 100644 --- a/lib/core/src/lib/auth/services/base-authentication.service.ts +++ b/lib/core/src/lib/auth/services/base-authentication.service.ts @@ -239,7 +239,8 @@ export abstract class BaseAuthenticationService { this.redirectUrl = url; } - /** Gets the URL to redirect to after login. + /** + * Gets the URL to redirect to after login. * * @returns The redirect URL */ diff --git a/lib/core/src/lib/auth/services/identity-group.service.ts b/lib/core/src/lib/auth/services/identity-group.service.ts index 9cf977a90b..8ba4ce97fd 100644 --- a/lib/core/src/lib/auth/services/identity-group.service.ts +++ b/lib/core/src/lib/auth/services/identity-group.service.ts @@ -79,6 +79,7 @@ export class IdentityGroupService implements IdentityGroupServiceInterface { * * @param groupId The ID of the group * @param roles Array of roles to assign + * @returns request result */ assignRoles(groupId: string, roles: IdentityRoleModel[]): Observable { 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 roles Array of roles to remove + * @returns request result */ removeRoles(groupId: string, roles: IdentityRoleModel[]): Observable { const url = `${this.identityHost}/groups/${groupId}/role-mappings/realm`; @@ -114,6 +116,7 @@ export class IdentityGroupService implements IdentityGroupServiceInterface { /** * Queries groups. * + * @param requestQuery query settings * @returns Array of user information objects */ queryGroups(requestQuery: IdentityGroupQueryCloudRequestModel): Observable { diff --git a/lib/core/src/lib/auth/services/identity-role.service.ts b/lib/core/src/lib/auth/services/identity-role.service.ts index bdef798454..765718390c 100644 --- a/lib/core/src/lib/auth/services/identity-role.service.ts +++ b/lib/core/src/lib/auth/services/identity-role.service.ts @@ -48,6 +48,8 @@ export class IdentityRoleService { /** * Ret all roles * + * @param skipCount skip count + * @param size page size * @returns List of roles */ getRoles( diff --git a/lib/core/src/lib/auth/services/identity-user.service.ts b/lib/core/src/lib/auth/services/identity-user.service.ts index dfb1ee2700..eb5573524c 100644 --- a/lib/core/src/lib/auth/services/identity-user.service.ts +++ b/lib/core/src/lib/auth/services/identity-user.service.ts @@ -320,6 +320,7 @@ export class IdentityUserService implements IdentityUserServiceInterface { /** * Gets details for all users. * + * @param requestQuery query model * @returns Array of user information objects. */ queryUsers(requestQuery: IdentityUserQueryCloudRequestModel): Observable { @@ -396,7 +397,7 @@ export class IdentityUserService implements IdentityUserServiceInterface { * Changes user password. * * @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. */ changePassword(userId: string, newPassword: IdentityUserPasswordModel): Observable { @@ -499,7 +500,7 @@ export class IdentityUserService implements IdentityUserServiceInterface { * Removes assigned roles. * * @param userId Id of the user. - * @param roles Array of roles. + * @param removedRoles Array of roles. * @returns Empty response when the role removed. */ removeRoles(userId: string, removedRoles: IdentityRoleModel[]): Observable { diff --git a/lib/core/src/lib/auth/services/jwt-helper.service.ts b/lib/core/src/lib/auth/services/jwt-helper.service.ts index 4aad71f86f..87b2d05ad4 100644 --- a/lib/core/src/lib/auth/services/jwt-helper.service.ts +++ b/lib/core/src/lib/auth/services/jwt-helper.service.ts @@ -130,12 +130,13 @@ export class JwtHelperService { /** * 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 * @returns Value from the token */ getValueFromToken(token: string, key: string): T { - let value; + let value: T; + if (token) { const tokenPayload = this.decodeToken(token); value = tokenPayload[key]; @@ -156,6 +157,7 @@ export class JwtHelperService { /** * Gets Client roles. * + * @param clientName client name * @returns Array of client roles */ getClientRoles(clientName: string): string[] { diff --git a/lib/core/src/lib/auth/services/user-access.service.spec.ts b/lib/core/src/lib/auth/services/user-access.service.spec.ts index 3032441733..473d82b32f 100644 --- a/lib/core/src/lib/auth/services/user-access.service.spec.ts +++ b/lib/core/src/lib/auth/services/user-access.service.spec.ts @@ -36,6 +36,12 @@ describe('UserAccessService', () => { appConfigService = TestBed.inject(AppConfigService); }); + /** + * spy on auth realm access + * + * @param realmRoles roles + * @param resourceAccess access settings + */ function spyRealmAccess(realmRoles: string[], resourceAccess: any) { spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); 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[]) { spyOn(jwtHelperService, 'getAccessToken').and.returnValue('my-access_token'); spyOn(jwtHelperService, 'decodeToken').and.returnValue({ diff --git a/lib/core/src/lib/card-view/components/card-view/card-view.component.spec.ts b/lib/core/src/lib/card-view/components/card-view/card-view.component.spec.ts index 5ec56e7999..c7ea73ddc7 100644 --- a/lib/core/src/lib/card-view/components/card-view/card-view.component.spec.ts +++ b/lib/core/src/lib/card-view/components/card-view/card-view.component.spec.ts @@ -247,7 +247,12 @@ describe('CardViewComponent', () => { 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)); return cardViewItemDispatcherDebugElement.componentInstance as CardViewItemDispatcherComponent; } diff --git a/lib/core/src/lib/card-view/services/card-view-update.service.ts b/lib/core/src/lib/card-view/services/card-view-update.service.ts index b220692d7e..044d516669 100644 --- a/lib/core/src/lib/card-view/services/card-view-update.service.ts +++ b/lib/core/src/lib/card-view/services/card-view-update.service.ts @@ -53,7 +53,7 @@ export class CardViewUpdateService implements BaseCardViewUpdate { /** * Updates the cardview items property * - * @param notification + * @param notification notification value */ updateElement(notification: CardViewBaseItemModel) { this.updateItem$.next(notification); diff --git a/lib/core/src/lib/common/services/directionality-config-factory.ts b/lib/core/src/lib/common/services/directionality-config-factory.ts index cf41819b77..b1e325429b 100644 --- a/lib/core/src/lib/common/services/directionality-config-factory.ts +++ b/lib/core/src/lib/common/services/directionality-config-factory.ts @@ -18,6 +18,12 @@ import { DirectionalityConfigService } from './directionality-config.service'; // 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) { return () => directionalityConfigService; } diff --git a/lib/core/src/lib/common/services/dynamic-component-mapper.service.ts b/lib/core/src/lib/common/services/dynamic-component-mapper.service.ts index 6c086aa5b5..923d6262f5 100644 --- a/lib/core/src/lib/common/services/dynamic-component-mapper.service.ts +++ b/lib/core/src/lib/common/services/dynamic-component-mapper.service.ts @@ -75,6 +75,9 @@ export abstract class DynamicComponentMapper { /** * Register multiple components + * + * @param components map of components to register + * @param override replace existing components */ register(components: { [key: string]: DynamicComponentResolveFunction }, override: boolean = false) { if (components) { diff --git a/lib/core/src/lib/common/services/user-preferences.service.ts b/lib/core/src/lib/common/services/user-preferences.service.ts index e2ade7b9d8..01078088b2 100644 --- a/lib/core/src/lib/common/services/user-preferences.service.ts +++ b/lib/core/src/lib/common/services/user-preferences.service.ts @@ -217,7 +217,11 @@ export class UserPreferencesService { } } - /** Current locale setting. */ + /** + * Current locale setting. + * + * @returns locale name + */ get locale(): string { return this.get(UserPreferenceValues.Locale); } diff --git a/lib/core/src/lib/common/utils/object-utils.ts b/lib/core/src/lib/common/utils/object-utils.ts index 01c73ab3d2..f8808473a9 100644 --- a/lib/core/src/lib/common/utils/object-utils.ts +++ b/lib/core/src/lib/common/utils/object-utils.ts @@ -20,8 +20,9 @@ export class ObjectUtils { * Gets a value from an object by composed key * ObjectUtils.getValue({ item: { nodeType: 'cm:folder' }}, 'item.nodeType') ==> 'cm:folder' * - * @param target - * @param key + * @param target target object + * @param key object property key + * @returns object property value */ static getValue(target: any, key: string): any { diff --git a/lib/core/src/lib/datatable/components/datatable/datatable.component.ts b/lib/core/src/lib/datatable/components/datatable/datatable.component.ts index 19218b0634..42b429c07c 100644 --- a/lib/core/src/lib/datatable/components/datatable/datatable.component.ts +++ b/lib/core/src/lib/datatable/components/datatable/datatable.component.ts @@ -103,7 +103,8 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges, @Input() 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`] */ @Input() @@ -113,7 +114,8 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges, @Input() 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. */ @Input() @@ -151,7 +153,8 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges, @Input() 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) * docs for more details and usage examples. */ @@ -198,7 +201,8 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges, @Output() columnsWidthChanged = new EventEmitter(); - /** 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). */ @Input() diff --git a/lib/core/src/lib/datatable/data-column/data-column.component.ts b/lib/core/src/lib/datatable/data-column/data-column.component.ts index 1e9e9969f7..3b242358bf 100644 --- a/lib/core/src/lib/datatable/data-column/data-column.component.ts +++ b/lib/core/src/lib/datatable/data-column/data-column.component.ts @@ -29,8 +29,9 @@ export class DataColumnComponent implements OnInit { @Input() id: string = ''; - /** Data source key. Can be either a column/property key like `title` - * or a property path like `createdBy.name`. + /** + * Data source key. Can be either a column/property key like `title` + * or a property path like `createdBy.name`. */ @Input() key: string; @@ -39,7 +40,8 @@ export class DataColumnComponent implements OnInit { @Input() 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'. */ @Input() @@ -61,7 +63,8 @@ export class DataColumnComponent implements OnInit { @Input() 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. */ @Input() @@ -98,7 +101,7 @@ export class DataColumnComponent implements OnInit { @Input() sortingKey: string; - /** Sets position of column. **/ + /** Sets position of column. */ @Input() order?: number; diff --git a/lib/core/src/lib/directives/upload.directive.ts b/lib/core/src/lib/directives/upload.directive.ts index ae24e70c90..a4cc8a9860 100644 --- a/lib/core/src/lib/directives/upload.directive.ts +++ b/lib/core/src/lib/directives/upload.directive.ts @@ -32,7 +32,8 @@ export class UploadDirective implements OnInit, OnDestroy { @Input('adf-upload-data') 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. */ @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. * * @param dataTransfer DataTransfer object + * @returns a list of file info objects */ getFilesDropped(dataTransfer: DataTransfer): Promise { return new Promise((resolve) => { diff --git a/lib/core/src/lib/form/components/form-base.component.ts b/lib/core/src/lib/form/components/form-base.component.ts index 637b6fe4b5..7240efd50d 100644 --- a/lib/core/src/lib/form/components/form-base.component.ts +++ b/lib/core/src/lib/form/components/form-base.component.ts @@ -79,19 +79,20 @@ export abstract class FormBaseComponent { /** Emitted when the supplied form values have a validation error. */ @Output() - formError: EventEmitter = new EventEmitter(); + formError = new EventEmitter(); - /** 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()`. */ @Output() - executeOutcome: EventEmitter = new EventEmitter(); + executeOutcome = new EventEmitter(); /** * Emitted when any error occurs. */ @Output() - error: EventEmitter = new EventEmitter(); + error = new EventEmitter(); form: FormModel; @@ -158,6 +159,7 @@ export abstract class FormBaseComponent { * Invoked when user clicks outcome button. * * @param outcome Form outcome model + * @returns `true` if outcome button was clicked, otherwise `false` */ onOutcomeClicked(outcome: FormOutcomeModel): boolean { if (!this.readOnly && outcome && this.form) { diff --git a/lib/core/src/lib/form/components/form-field/form-field.component.ts b/lib/core/src/lib/form/components/form-field/form-field.component.ts index 58377a459d..f52d275a08 100644 --- a/lib/core/src/lib/form/components/form-field/form-field.component.ts +++ b/lib/core/src/lib/form/components/form-field/form-field.component.ts @@ -57,7 +57,8 @@ export class FormFieldComponent implements OnInit, OnDestroy { @ViewChild('container', { read: ViewContainerRef, static: true }) 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 * create this data manually but instead create the form in APS and export * it to get to all the `FormFieldModel` definitions. diff --git a/lib/core/src/lib/form/components/form-renderer.component.ts b/lib/core/src/lib/form/components/form-renderer.component.ts index 1329a0e655..cd8cda70a6 100644 --- a/lib/core/src/lib/form/components/form-renderer.component.ts +++ b/lib/core/src/lib/form/components/form-renderer.component.ts @@ -78,6 +78,9 @@ export class FormRendererComponent implements OnChanges, OnDestroy { /** * Serializes column fields + * + * @param content container model + * @returns a list of form field models */ getContainerFields(content: ContainerModel): FormFieldModel[] { const serialisedFormFields: FormFieldModel[] = []; @@ -113,7 +116,8 @@ export class FormRendererComponent implements OnChanges, OnDestroy { /** * 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 { const colspan = container ? container.field.colspan : 1; diff --git a/lib/core/src/lib/form/components/widgets/base-viewer/base-viewer.widget.spec.ts b/lib/core/src/lib/form/components/widgets/base-viewer/base-viewer.widget.spec.ts index 993ccb09a5..92c8247cba 100644 --- a/lib/core/src/lib/form/components/widgets/base-viewer/base-viewer.widget.spec.ts +++ b/lib/core/src/lib/form/components/widgets/base-viewer/base-viewer.widget.spec.ts @@ -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, done: DoneFn) { const fakeField = new FormFieldModel(fakeForm, { id: 'fakeField', value }); widget.field = fakeField; diff --git a/lib/core/src/lib/form/components/widgets/core/form-field.model.ts b/lib/core/src/lib/form/components/widgets/core/form-field.model.ts index ef450acaf8..dd2c0b2f95 100644 --- a/lib/core/src/lib/form/components/widgets/core/form-field.model.ts +++ b/lib/core/src/lib/form/components/widgets/core/form-field.model.ts @@ -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'; } diff --git a/lib/core/src/lib/form/components/widgets/core/form.model.ts b/lib/core/src/lib/form/components/widgets/core/form.model.ts index 8d58ea0e2d..c98600bdf0 100644 --- a/lib/core/src/lib/form/components/widgets/core/form.model.ts +++ b/lib/core/src/lib/form/components/widgets/core/form.model.ts @@ -248,6 +248,7 @@ export class FormModel implements ProcessFormModel { * Returns a form variable that matches the identifier. * * @param identifier The `name` or `id` value. + * @returns form variable model */ getFormVariable(identifier: string): FormVariableModel { if (identifier) { @@ -261,6 +262,7 @@ export class FormModel implements ProcessFormModel { * Provides additional conversion of types (date, boolean). * * @param identifier The `name` or `id` value + * @returns form variable value */ getDefaultFormVariableValue(identifier: string): any { 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 * * @param name Variable name + * @returns process variable value */ getProcessVariableValue(name: string): any { let value; diff --git a/lib/core/src/lib/form/models/form-rules.model.ts b/lib/core/src/lib/form/models/form-rules.model.ts index fea9f251e0..93e76833e6 100644 --- a/lib/core/src/lib/form/models/form-rules.model.ts +++ b/lib/core/src/lib/form/models/form-rules.model.ts @@ -24,6 +24,12 @@ import { FormModel, FormService } from '../public-api'; export const FORM_RULES_MANAGER = new InjectionToken>('form.rule.manager'); +/** + * A factory for forms rule manager + * + * @param injector Angular injector + * @returns FormsRuleManager instance + */ export function formRulesManagerFactory(injector: Injector): FormRulesManager { try { return injector.get(FORM_RULES_MANAGER); diff --git a/lib/core/src/lib/form/services/form.service.ts b/lib/core/src/lib/form/services/form.service.ts index e12e6da76f..5505fb7ec4 100644 --- a/lib/core/src/lib/form/services/form.service.ts +++ b/lib/core/src/lib/form/services/form.service.ts @@ -64,7 +64,7 @@ export class FormService implements FormValidationService { * @param json JSON to create the form * @param data Values for the form fields * @param readOnly Should the form fields be read-only? - * @param fixedSpace + * @param fixedSpace use fixed space * @returns Form model created from input data */ parseForm(json: any, data?: FormValues, readOnly: boolean = false, fixedSpace?: boolean): FormModel { diff --git a/lib/core/src/lib/identity-user-info/identity-user-info.component.ts b/lib/core/src/lib/identity-user-info/identity-user-info.component.ts index 610662336b..e42ec0674c 100644 --- a/lib/core/src/lib/identity-user-info/identity-user-info.component.ts +++ b/lib/core/src/lib/identity-user-info/identity-user-info.component.ts @@ -54,11 +54,12 @@ export class IdentityUserInfoComponent implements OnDestroy { @Input() 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`. */ @Input() - namePosition: string = 'right'; + namePosition: 'right' | 'left' = 'right'; private destroy$ = new Subject(); diff --git a/lib/core/src/lib/login/components/login.component.ts b/lib/core/src/lib/login/components/login.component.ts index f20965131a..5b3762e1c6 100644 --- a/lib/core/src/lib/login/components/login.component.ts +++ b/lib/core/src/lib/login/components/login.component.ts @@ -42,6 +42,11 @@ interface ValidationMessage { params?: any; } +interface LoginFormValues { + username: string; + password: string; +}; + @Component({ selector: 'adf-login', templateUrl: './login.component.html', @@ -182,9 +187,9 @@ export class LoginComponent implements OnInit, OnDestroy { /** * Method called on submit form * - * @param values + * @param values login form values */ - onSubmit(values: any): void { + onSubmit(values: LoginFormValues): void { this.disableError(); 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 * - * @param data + * @param data form data */ onValueChanged(data: any) { 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( (token) => { 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 + * + * @param err error object */ private displayErrorMessage(err: any): void { 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 * - * @param field - * @param msg + * @param field field + * @param msg error message */ public addCustomFormError(field: string, msg: string) { this.formError[field] += msg; @@ -286,10 +293,10 @@ export class LoginComponent implements OnInit, OnDestroy { /** * Add a custom validation rule error for a field * - * @param field + * @param field field * @param ruleId - i.e. required | minlength | maxlength - * @param msg - * @param params + * @param msg message + * @param params parameters */ addCustomValidationError(field: string, ruleId: string, msg: string, params?: any) { if (field !== '__proto__' && field !== 'constructor' && field !== 'prototype') { @@ -302,6 +309,8 @@ export class LoginComponent implements OnInit, OnDestroy { /** * Display and hide the password value. + * + * @param event input event */ toggleShowPassword(event: Event) { event.stopPropagation(); @@ -311,14 +320,17 @@ export class LoginComponent implements OnInit, OnDestroy { /** * 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; } /** * Trim username + * + * @param event event */ trimUsername(event: any) { event.target.value = event.target.value.trim(); diff --git a/lib/core/src/lib/notifications/services/notification.service.ts b/lib/core/src/lib/notifications/services/notification.service.ts index 22fbbdd5d2..1d47f45863 100644 --- a/lib/core/src/lib/notifications/services/notification.service.ts +++ b/lib/core/src/lib/notifications/services/notification.service.ts @@ -70,6 +70,7 @@ export class NotificationService { * @param action Action name * @param interpolateArgs The interpolation parameters to add for the translation * @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 { return this.dispatchNotification(message, action, { @@ -87,6 +88,7 @@ export class NotificationService { * @param action Action name * @param interpolateArgs The interpolation parameters to add for the translation * @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 { return this.dispatchNotification(message, action, { @@ -104,6 +106,7 @@ export class NotificationService { * @param action Action name * @param interpolateArgs The interpolation parameters to add for the translation * @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 { return this.dispatchNotification(message, action, { @@ -117,8 +120,8 @@ export class NotificationService { /** * dismiss the notification snackbar */ - dismissSnackMessageAction() { - return this.snackBar.dismiss(); + dismissSnackMessageAction(): void { + this.snackBar.dismiss(); } /** diff --git a/lib/core/src/lib/search-text/search-text-input.component.ts b/lib/core/src/lib/search-text/search-text-input.component.ts index 2e703adb58..b21f0494f3 100644 --- a/lib/core/src/lib/search-text/search-text-input.component.ts +++ b/lib/core/src/lib/search-text/search-text-input.component.ts @@ -39,7 +39,8 @@ export class SearchTextInputComponent implements OnInit, OnDestroy { @Input() 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. */ @Input() @@ -93,19 +94,21 @@ export class SearchTextInputComponent implements OnInit, OnDestroy { @Input() 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 * than three characters in length then it is truncated to an empty * string. */ @Output() - searchChange: EventEmitter = new EventEmitter(); + searchChange = new EventEmitter(); - /** 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. */ @Output() - submit: EventEmitter = new EventEmitter(); + submit = new EventEmitter(); /** Emitted when the result list is selected */ @Output() diff --git a/lib/core/src/lib/services/startup-service-factory.ts b/lib/core/src/lib/services/startup-service-factory.ts index beb78b2ad5..b55da498c6 100644 --- a/lib/core/src/lib/services/startup-service-factory.ts +++ b/lib/core/src/lib/services/startup-service-factory.ts @@ -18,6 +18,13 @@ import { AppConfigService, AppConfigValues } from '../app-config/app-config.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) { return () => appConfigService.load().then(() => { diff --git a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts index da0548f70b..0a267a3130 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts @@ -397,7 +397,7 @@ export class PdfViewerComponent implements OnChanges, OnDestroy { * * @param oldScale - old scale page * @param newScale - new scale page - * + * @returns `true` if the scale is the same, otherwise `false` */ isSameScale(oldScale: number, newScale: number): boolean { return newScale === oldScale; @@ -406,8 +406,9 @@ export class PdfViewerComponent implements OnChanges, OnDestroy { /** * Check if is a land scape view * - * @param width - * @param height + * @param width target width + * @param height target height + * @returns `true` if the target is in the landscape mode, otherwise `false` */ isLandscape(width: number, height: number): boolean { return width > height; @@ -434,9 +435,9 @@ export class PdfViewerComponent implements OnChanges, OnDestroy { /** * 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; do { newScale = (newScale * this.DEFAULT_SCALE_DELTA).toFixed(2); @@ -450,9 +451,9 @@ export class PdfViewerComponent implements OnChanges, OnDestroy { /** * 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; do { newScale = (newScale / this.DEFAULT_SCALE_DELTA).toFixed(2); @@ -507,7 +508,7 @@ export class PdfViewerComponent implements OnChanges, OnDestroy { /** * Page Change Event * - * @param event + * @param event event */ onPageChange(event: any) { if (event.source && event.source.container.id === `${this.randomPdfId}-viewer-pdf-viewer`) { diff --git a/lib/core/src/lib/viewer/components/viewer-render.component.ts b/lib/core/src/lib/viewer/components/viewer-render.component.ts index 63680538d2..20c4846db6 100644 --- a/lib/core/src/lib/viewer/components/viewer-render.component.ts +++ b/lib/core/src/lib/viewer/components/viewer-render.component.ts @@ -36,7 +36,8 @@ import { Track } from '../models/viewer.model'; }) 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. */ @Input() @@ -101,6 +102,8 @@ export class ViewerRenderComponent implements OnChanges, OnInit, OnDestroy { /** * Returns a list of the active Viewer content extensions. + * + * @returns list of extension references */ get viewerExtensions(): ViewerExtensionRef[] { 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. + * + * @returns list of extensions */ get externalExtensions(): string[] { return this.viewerExtensions.map(ext => ext.fileExtension); diff --git a/lib/core/src/lib/viewer/components/viewer.component.ts b/lib/core/src/lib/viewer/components/viewer.component.ts index 038cedd545..75955ceec7 100644 --- a/lib/core/src/lib/viewer/components/viewer.component.ts +++ b/lib/core/src/lib/viewer/components/viewer.component.ts @@ -71,7 +71,8 @@ export class ViewerComponent implements OnDestroy, OnInit, OnChanges { @ContentChild(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. */ @Input() @@ -101,13 +102,15 @@ export class ViewerComponent implements OnDestroy, OnInit, OnChanges { @Input() 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. */ @Input() 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. */ @Input() @@ -171,29 +174,29 @@ export class ViewerComponent 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. - * */ + */ 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. - * */ + */ enableDownloadPromptReminder: boolean = false; /** * Initial time in seconds to wait before giving the first prompt to user to download the file - * */ + */ downloadPromptDelay: number = 50; /** * Time in seconds to wait before giving the second and consequent reminders to the user to download the file. - * */ + */ downloadPromptReminderDelay: number = 15; /** * Emitted when user clicks on download button on download prompt dialog. - * */ + */ @Output() - downloadFile: EventEmitter = new EventEmitter(); + downloadFile = new EventEmitter(); /** Emitted when user clicks 'Navigate Before' ("<") button. */ @Output() diff --git a/lib/core/src/lib/viewer/directives/viewer-extension.directive.ts b/lib/core/src/lib/viewer/directives/viewer-extension.directive.ts index 51ca3a4697..e992d4aae9 100644 --- a/lib/core/src/lib/viewer/directives/viewer-extension.directive.ts +++ b/lib/core/src/lib/viewer/directives/viewer-extension.directive.ts @@ -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; if (this.supportedExtensions && (this.supportedExtensions instanceof Array)) { diff --git a/lib/core/src/lib/viewer/services/rendering-queue.services.ts b/lib/core/src/lib/viewer/services/rendering-queue.services.ts index 50b884c4d9..82612d1d7a 100644 --- a/lib/core/src/lib/viewer/services/rendering-queue.services.ts +++ b/lib/core/src/lib/viewer/services/rendering-queue.services.ts @@ -43,21 +43,28 @@ export class RenderingQueueServices { isThumbnailViewEnabled: any = false; /** - * @param pdfViewer + * Set the instance of the PDF Viewer + * + * @param pdfViewer viewer instance */ - setViewer(pdfViewer) { + setViewer(pdfViewer): void { 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; } /** - * @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 { 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 { 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 * 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; switch (state) { case this.renderingStates.FINISHED: { diff --git a/lib/core/src/lib/viewer/services/view-util.service.ts b/lib/core/src/lib/viewer/services/view-util.service.ts index 1f1fe25d96..6e2e497f58 100644 --- a/lib/core/src/lib/viewer/services/view-util.service.ts +++ b/lib/core/src/lib/viewer/services/view-util.service.ts @@ -40,6 +40,8 @@ export class ViewUtilService { /** * Returns a list of the active Viewer content extensions. + * + * @returns list of extension references */ get viewerExtensions(): ViewerExtensionRef[] { return this.extensionService.getViewerExtensions(); @@ -47,6 +49,8 @@ export class ViewUtilService { /** * Provides a list of file extensions supported by external plugins. + * + * @returns list of extensions */ get externalExtensions(): string[] { return this.viewerExtensions.map((ext) => ext.fileExtension); @@ -58,6 +62,7 @@ export class ViewUtilService { * get File name from url * * @param url - url file + * @returns file name portion of the url */ getFilenameFromUrl(url: string): string { const anchor = url.indexOf('#'); @@ -73,6 +78,7 @@ export class ViewUtilService { * http://localhost/test.jpg#cache=1000 * * @param fileName - file name + * @returns file extension */ getFileExtension(fileName: string): string { if (fileName) {