[ACS-6071] fix jsdoc warnings and errors (#8948)

* fix content docs

* fix extensions docs

* fix insights docs

* [ci:force] fix jsdoc errors and warnings

* enable jsdoc linter

* [ci:force] fix demo shell jsdoc

* [ci:force] fix e2e typings

* fix typo

* fix typo
This commit is contained in:
Denys Vuika
2023-09-29 08:11:58 +01:00
committed by GitHub
parent 501516c8f5
commit d72eb5ebd3
86 changed files with 1233 additions and 254 deletions

View File

@@ -68,7 +68,7 @@ export class AuditService {
* @param auditApplicationId The identifier of an audit application.
* @param auditAppBodyUpdate The audit application to update.
* @param opts Options.
* @returns
* @returns audit application model
*/
updateAuditApp(auditApplicationId: string, auditAppBodyUpdate: boolean, opts?: any): Observable<AuditApp | any> {
const defaultOptions = {};
@@ -117,7 +117,7 @@ export class AuditService {
*
* @param nodeId The identifier of a node.
* @param opts Options.
* @returns
* @returns audit entry list
*/
getAuditEntriesForNode(nodeId: string, opts?: any): Observable<AuditEntryPaging> {
const defaultOptions = {
@@ -132,7 +132,7 @@ export class AuditService {
*
* @param auditApplicationId The identifier of an audit application.
* @param where Audit entries to permanently delete for an audit application, given an inclusive time period or range of ids.
* @returns
* @returns void operation
*/
deleteAuditEntries(auditApplicationId: string, where: string): Observable<any> {
return from(this.auditApi.deleteAuditEntriesForAuditApp(auditApplicationId, where)).pipe(catchError((err: any) => this.handleError(err)));
@@ -143,7 +143,7 @@ export class AuditService {
*
* @param auditApplicationId The identifier of an audit application.
* @param auditEntryId The identifier of an audit entry.
* @returns
* @returns void operation
*/
deleteAuditEntry(auditApplicationId: string, auditEntryId: string): Observable<any> {
return from(this.auditApi.deleteAuditEntry(auditApplicationId, auditEntryId)).pipe(catchError((err: any) => this.handleError(err)));

View File

@@ -34,26 +34,30 @@ export class BreadcrumbComponent implements OnInit, OnChanges, OnDestroy {
@Input()
folderNode: Node = null;
/** (optional) Name of the root element of the breadcrumb. You can use
/**
* Name of the root element of the breadcrumb. You can use
* this property to rename "Company Home" to "Personal Files" for
* example. You can use an i18n resource key for the property value.
*/
@Input()
root: string = null;
root?: string = null;
/** (optional) The id of the root element. You can use this property
/**
* The id of the root element. You can use this property
* to set a custom element the breadcrumb should start with.
*/
@Input()
rootId: string = null;
rootId?: string = null;
/** (optional) Document List component to operate with. The list will
/**
* Document List component to operate with. The list will
* update when the breadcrumb is clicked.
*/
@Input()
target: DocumentListComponent;
target?: DocumentListComponent;
/** Transformation to be performed on the chosen/folder node before building
/**
* Transformation to be performed on the chosen/folder node before building
* the breadcrumb UI. Can be useful when custom formatting is needed for the
* breadcrumb. You can change the path elements from the node that are used to
* build the breadcrumb using this function.

View File

@@ -56,7 +56,9 @@ export class DropdownBreadcrumbComponent extends BreadcrumbComponent implements
}
/**
* Return if route has more than one element (means: we are not in the root directory)
* Check if route has more than one element (means: we are not in the root directory)
*
* @returns `true` if there are previous nodes, otherwise `false`
*/
hasPreviousNodes(): boolean {
return this.previousNodes.length > 0;

View File

@@ -67,18 +67,40 @@ describe('CategoriesManagementComponent', () => {
categoryService = TestBed.inject(CategoryService);
});
/**
* Get no categories message
*
* @returns message text
*/
function getNoCategoriesMessage(): string {
return fixture.debugElement.query(By.css(`.adf-no-categories-message`))?.nativeElement.textContent.trim();
}
/**
* Get assigned categories list
*
* @returns list of native elements
*/
function getAssignedCategoriesList(): HTMLSpanElement[] {
return fixture.debugElement.queryAll(By.css('.adf-assigned-categories'))?.map((debugElem) => debugElem.nativeElement);
}
/**
* Get the exiting categories list
*
* @returns list of material option element
*/
function getExistingCategoriesList(): MatListOption[] {
return fixture.debugElement.queryAll(By.directive(MatListOption))?.map((debugElem) => debugElem.componentInstance);
}
/**
* Create new category
*
* @param name name of the category
* @param addUsingEnter use Enter key
* @param typingTimeout typing timeout in milliseconds (default 300)
*/
function createCategory(name: string, addUsingEnter?: boolean, typingTimeout = 300): void {
typeCategory(name, typingTimeout);
@@ -92,26 +114,57 @@ describe('CategoriesManagementComponent', () => {
fixture.detectChanges();
}
/**
* Get first error
*
* @returns error text
*/
function getFirstError(): string {
return fixture.debugElement.query(By.directive(MatError)).nativeElement.textContent;
}
/**
* Get selection list
*
* @returns material selection list
*/
function getSelectionList(): MatSelectionList {
return fixture.debugElement.query(By.directive(MatSelectionList)).componentInstance;
}
/**
* Get remove category buttons
*
* @returns list of native elements
*/
function getRemoveCategoryButtons(): HTMLButtonElement[] {
return fixture.debugElement.queryAll(By.css(`[data-automation-id="categories-remove-category-button"]`)).map((debugElem) => debugElem.nativeElement);
}
/**
* Get category control input
*
* @returns native input element
*/
function getCategoryControlInput(): HTMLInputElement {
return fixture.debugElement.query(By.css('.adf-category-name-field input'))?.nativeElement;
}
/**
* Get create category label
*
* @returns native element
*/
function getCreateCategoryLabel(): HTMLSpanElement {
return fixture.debugElement.query(By.css('.adf-existing-categories-panel span'))?.nativeElement;
}
/**
* Type new category
*
* @param name name of the category
* @param timeout typing timeout in milliseconds (default 300)
*/
function typeCategory(name: string, timeout = 300): void {
component.categoryNameControlVisible = true;
fixture.detectChanges();
@@ -208,6 +261,11 @@ describe('CategoriesManagementComponent', () => {
});
describe('Spinner', () => {
/**
* Get the spinner element
*
* @returns debug element
*/
function getSpinner(): DebugElement {
return fixture.debugElement.query(By.css(`.mat-progress-spinner`));
}

View File

@@ -52,7 +52,7 @@ export class CategoryService {
* @param parentCategoryId The identifier of a parent category.
* @param skipCount Number of top categories to skip.
* @param maxItems Maximum number of subcategories returned from Observable.
* @return Observable<CategoryPaging>
* @returns Observable<CategoryPaging>
*/
getSubcategories(parentCategoryId: string, skipCount?: number, maxItems?: number): Observable<CategoryPaging> {
return from(this.categoriesApi.getSubcategories(parentCategoryId ?? '-root-', {skipCount, maxItems}));
@@ -67,7 +67,7 @@ export class CategoryService {
* @param opts.include Returns additional information about the category. The following optional fields can be requested:
* count
* path
* @return Observable<CategoryEntry>
* @returns Observable<CategoryEntry>
*/
getCategory(categoryId: string, opts?: any): Observable<CategoryEntry> {
return from(this.categoriesApi.getCategory(categoryId, opts));
@@ -78,7 +78,7 @@ export class CategoryService {
*
* @param parentCategoryId The identifier of a parent category.
* @param payload List of categories to be created.
* @return Observable<CategoryPaging | CategoryEntry>
* @returns Observable<CategoryPaging | CategoryEntry>
*/
createSubcategories(parentCategoryId: string, payload: CategoryBody[]): Observable<CategoryPaging | CategoryEntry> {
return from(this.categoriesApi.createSubcategories(parentCategoryId, payload, {}));
@@ -89,7 +89,7 @@ export class CategoryService {
*
* @param categoryId The identifier of a category.
* @param payload Updated category body
* @return Observable<CategoryEntry>
* @returns Observable<CategoryEntry>
*/
updateCategory(categoryId: string, payload: CategoryBody): Observable<CategoryEntry> {
return from(this.categoriesApi.updateCategory(categoryId, payload, {}));
@@ -99,7 +99,7 @@ export class CategoryService {
* Deletes category
*
* @param categoryId The identifier of a category.
* @return Observable<void>
* @returns Observable<void>
*/
deleteCategory(categoryId: string): Observable<void> {
return from(this.categoriesApi.deleteCategory(categoryId));
@@ -111,7 +111,7 @@ export class CategoryService {
* @param name Value for name which should be used during searching categories.
* @param skipCount Specify how many first results should be skipped. Default 0.
* @param maxItems Specify max number of returned categories. Default is specified by UserPreferencesService.
* @return Observable<ResultSetPaging> Found categories which name contains searched name.
* @returns Observable<ResultSetPaging> Found categories which name contains searched name.
*/
searchCategories(name: string, skipCount = 0, maxItems?: number): Observable<ResultSetPaging> {
maxItems = maxItems || this.userPreferencesService.paginationSize;
@@ -132,7 +132,7 @@ export class CategoryService {
* List of categories that node is assigned to
*
* @param nodeId The identifier of a node.
* @return Observable<CategoryPaging> Categories that node is assigned to
* @returns Observable<CategoryPaging> Categories that node is assigned to
*/
getCategoryLinksForNode(nodeId: string): Observable<CategoryPaging> {
return from(this.categoriesApi.getCategoryLinksForNode(nodeId, {include: ['path']}));
@@ -143,7 +143,7 @@ export class CategoryService {
*
* @param nodeId The identifier of a node.
* @param categoryId The identifier of a category.
* @return Observable<void>
* @returns Observable<void>
*/
unlinkNodeFromCategory(nodeId: string, categoryId: string): Observable<void> {
return from(this.categoriesApi.unlinkNodeFromCategory(nodeId, categoryId));
@@ -154,7 +154,7 @@ export class CategoryService {
*
* @param nodeId The identifier of a node.
* @param categoryLinkBodyCreate Array of a categories that node will be linked to.
* @return Observable<CategoryEntry>
* @returns Observable<CategoryEntry>
*/
linkNodeToCategory(nodeId: string, categoryLinkBodyCreate: CategoryLinkBody[]): Observable<CategoryPaging | CategoryEntry> {
return from(this.categoriesApi.linkNodeToCategory(nodeId, categoryLinkBodyCreate));

View File

@@ -171,11 +171,11 @@ export class NodesApiService {
/**
* Create a new Node from form metadata.
*
* @param path Path to the node
* @param nodeType Node type
* @param name Node name
* @param nameSpace Namespace for properties
* @param data Property data to store in the node under namespace
* @param path Path to the node
* @param name Node name
* @returns The created node
*/
public createNodeMetadata(nodeType: string, nameSpace: any, data: any, path: string, name?: string): Observable<NodeEntry> {

View File

@@ -259,6 +259,9 @@ export class RenditionService {
* This method takes a url to trigger the print dialog against, and the type of artifact that it
* is.
* This URL should be one that can be rendered in the browser, for example PDF, Image, or Text
*
* @param url url to print
* @param type type of the rendition
*/
printFile(url: string, type: string): void {
const pwa = window.open(url, RenditionService.TARGET);
@@ -284,6 +287,8 @@ export class RenditionService {
* These are: images, PDF files, or PDF rendition of files.
* We also force PDF rendition for TEXT type objects, otherwise the default URL is to download.
* TODO there are different TEXT type objects, (HTML, plaintext, xml, etc. we should determine how these are handled)
* @param objectId object it
* @param mimeType mime type
*/
printFileGeneric(objectId: string, mimeType: string): void {
const nodeId = objectId;

View File

@@ -158,7 +158,7 @@ export class SitesService {
* @param siteId The identifier of a site
* @param siteMembershipBodyCreate The person to add and their role
* @param opts Optional parameters
* @return Observable<SiteMemberEntry>
* @returns Observable<SiteMemberEntry>
*/
createSiteMembership(siteId: string, siteMembershipBodyCreate: SiteMembershipBodyCreate, opts?: any): Observable<SiteMemberEntry> {
return from(this.sitesApi.createSiteMembership(siteId, siteMembershipBodyCreate, opts)).pipe(catchError((err: any) => this.handleError(err)));
@@ -171,7 +171,7 @@ export class SitesService {
* @param personId The identifier of a person.
* @param siteMembershipBodyUpdate The persons new role
* @param opts Optional parameters
* @return Observable<SiteMemberEntry>
* @returns Observable<SiteMemberEntry>
*/
updateSiteMembership(
siteId: string,
@@ -189,7 +189,7 @@ export class SitesService {
*
* @param siteId The identifier of a site.
* @param personId The identifier of a person.
* @return Null response notifying when the operation is complete
* @returns Null response notifying when the operation is complete
*/
deleteSiteMembership(siteId: string, personId: string): Observable<void> {
return from(this.sitesApi.deleteSiteMembership(siteId, personId)).pipe(catchError((err: any) => this.handleError(err)));
@@ -246,7 +246,7 @@ export class SitesService {
*
* @param siteId The identifier of a site.
* @param groupId The authorityId of a group.
* @return Observable<SiteGroupEntry>
* @returns Observable<SiteGroupEntry>
*/
getSiteGroupMembership(siteId: string, groupId: string): Observable<SiteGroupEntry> {
return from(this.sitesApi.getSiteGroupMembership(siteId, groupId)).pipe(catchError((err: any) => this.handleError(err)));
@@ -258,7 +258,7 @@ export class SitesService {
* @param siteId The identifier of a site.
* @param groupId The authorityId of a group.
* @param siteMembershipBodyUpdate The group new role
* @return Observable<SiteGroupEntry>
* @returns Observable<SiteGroupEntry>
*/
updateSiteGroupMembership(siteId: string, groupId: string, siteMembershipBodyUpdate: SiteMembershipBodyUpdate): Observable<SiteGroupEntry> {
return from(this.sitesApi.updateSiteGroupMembership(siteId, groupId, siteMembershipBodyUpdate)).pipe(
@@ -271,7 +271,7 @@ export class SitesService {
*
* @param siteId The identifier of a site.
* @param groupId The authorityId of a group.
* @return Observable<void>
* @returns Observable<void>
*/
deleteSiteGroupMembership(siteId: string, groupId: string): Observable<void> {
return from(this.sitesApi.deleteSiteGroupMembership(siteId, groupId)).pipe(catchError((err: any) => this.handleError(err)));

View File

@@ -35,56 +35,59 @@ export class ContentMetadataCardComponent implements OnChanges {
@Input()
node: Node;
/** (optional) This flag displays/hides empty metadata
/**
* This flag displays/hides empty metadata
* fields.
*/
@Input()
displayEmpty: boolean = false;
displayEmpty?: boolean = false;
/** (optional) This flag displays desired aspect when open for the first time
* fields.
/**
* This flag displays desired aspect when open for the first time fields.
*/
@Input()
displayAspect: string = null;
displayAspect?: string = null;
/** Display tags in the card **/
/** Display tags in the card */
@Input()
displayTags = true;
/** Display categories in the card **/
/** Display categories in the card */
@Input()
displayCategories = true;
/** (required) Name or configuration of the metadata preset, which defines aspects
/**
* Name or configuration of the metadata preset, which defines aspects
* and their properties.
*/
@Input()
preset: string | PresetConfig;
/** (optional) This flag sets the metadata in read only mode
* preventing changes.
/**
* This flag sets the metadata in read only mode preventing changes.
*/
@Input()
readOnly = false;
readOnly? = false;
/** (optional) This flag allows the component to display more
/**
* This flag allows the component to display more
* than one accordion at a time.
*/
@Input()
multi = false;
multi? = false;
/** (optional) This flag toggles editable of content. **/
/** This flag toggles editable of content. */
@Input()
editable = false;
editable? = false;
/** Emitted when content's editable state is changed. **/
/** Emitted when content's editable state is changed. */
@Output()
editableChange = new EventEmitter<boolean>();
private _displayDefaultProperties: boolean = true;
/** (optional) This flag displays/hides the metadata
* properties.
/**
* This flag displays/hides the metadata properties.
*/
@Input()
set displayDefaultProperties(value: boolean) {

View File

@@ -92,18 +92,38 @@ describe('ContentMetadataComponent', () => {
const findShowingTagInputButton = (): HTMLButtonElement =>
fixture.debugElement.query(By.css('[data-automation-id=showing-tag-input-button]')).nativeElement;
/**
* Get metadata categories
*
* @returns list of native elements
*/
function getCategories(): HTMLParagraphElement[] {
return fixture.debugElement.queryAll(By.css('.adf-metadata-categories'))?.map((debugElem) => debugElem.nativeElement);
}
/**
* Get a categories management component
*
* @returns angular component
*/
function getCategoriesManagementComponent(): CategoriesManagementComponent {
return fixture.debugElement.query(By.directive(CategoriesManagementComponent))?.componentInstance;
}
/**
* Get categories title button
*
* @returns native element
*/
function getAssignCategoriesBtn(): HTMLButtonElement {
return fixture.debugElement.query(By.css('.adf-metadata-categories-title button')).nativeElement;
}
/**
* Update aspect property
*
* @param newValue value to set
*/
async function updateAspectProperty(newValue: string): Promise<void> {
component.editable = true;
const property = { key: 'properties.property-key', value: 'original-value' } as CardViewBaseItemModel;

View File

@@ -76,7 +76,8 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
@Input()
displayEmpty: boolean = false;
/** Toggles between expanded (ie, full information) and collapsed
/**
* Toggles between expanded (ie, full information) and collapsed
* (ie, reduced information) in the display
*/
@Input()

View File

@@ -81,14 +81,16 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
@Input()
currentFolderId: string = null;
/** Hide the "My Files" option added to the site list by default.
/**
* Hide the "My Files" option added to the site list by default.
* See the [Sites Dropdown component](sites-dropdown.component.md)
* for more information.
*/
@Input()
dropdownHideMyFiles: boolean = false;
/** Custom site for site dropdown. This is the same as the `siteList`.
/**
* Custom site for site dropdown. This is the same as the `siteList`.
* property of the Sites Dropdown component (see its doc page
* for more information).
*/
@@ -97,7 +99,8 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
_rowFilter: RowFilter = defaultValidation;
/** Custom *where* filter function. See the
/**
* Custom *where* filter function. See the
* Document List component
* for more information.
*/
@@ -120,7 +123,8 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
_excludeSiteContent: string[] = [];
/** Custom list of site content componentIds.
/**
* Custom list of site content componentIds.
* Used to filter out the corresponding items from the displayed nodes
*/
@Input()
@@ -149,13 +153,15 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
@Input()
selectionMode: 'single' | 'multiple' = 'single';
/** Function used to decide if the selected node has permission to be selected.
/**
* Function used to decide if the selected node has permission to be selected.
* Default value is a function that always returns true.
*/
@Input()
isSelectionValid: ValidationFunction = defaultValidation;
/** Transformation to be performed on the chosen/folder node before building the
/**
* Transformation to be performed on the chosen/folder node before building the
* breadcrumb UI. Can be useful when custom formatting is needed for the breadcrumb.
* You can change the path elements from the node that are used to build the
* breadcrumb using this function.
@@ -427,7 +433,9 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
}
/**
* Returns the actually selected|entered folder node or null in case of searching for the breadcrumb
* Get current breadcrumb folder node
*
* @returns the actually selected|entered folder node or null in case of searching for the breadcrumb
*/
get breadcrumbFolderNode(): Node | null {
let folderNode: Node;
@@ -443,6 +451,8 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
/**
* Prepares the dialog for a new search
*
* @param searchRequest request options
*/
prepareDialogForNewSearch(searchRequest: SearchRequest): void {
this.target = searchRequest ? null : this.documentList;
@@ -527,6 +537,8 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
/**
* Sets showingSearchResults state to be able to differentiate between search results or folder results
*
* @param $event node event
*/
onFolderChange($event: NodeEntryEvent): void {
this.folderIdToShow = $event.value.id;
@@ -540,6 +552,8 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
/**
* Attempts to set the currently loaded node
*
* @param nodePaging pagination model
*/
onFolderLoaded(nodePaging: NodePaging): void {
setTimeout(() => {
@@ -554,6 +568,8 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
/**
* Updates pagination.hasMoreItems to false after filtering only folders during 'COPY' and 'MOVE' action
*
* @param nodePaging pagination model
*/
updatePaginationAfterRowFilter(nodePaging: NodePaging): void {
if (this.documentList.data.getRows().length < nodePaging.list.pagination.maxItems) {
@@ -563,6 +579,8 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
/**
* Returns whether breadcrumb has to be shown or not
*
* @returns `true` if needs to show the breadcrumb, otherwise `false`
*/
showBreadcrumbs() {
return !this.showingSearchResults || this.chosenNode;
@@ -586,7 +604,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
/**
* Selects node as chosen if it has the right permission, clears the selection otherwise
*
* @param entry
* @param entry node entry
*/
private attemptNodeSelection(entry: Node): void {
if (entry && this.isSelectionValid(entry)) {
@@ -604,7 +622,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
/**
* It filters and emit the selection coming from the document list
*
* @param nodesEntries
* @param nodesEntries selected nodes
*/
onCurrentSelection(nodesEntries: NodeEntry[]): void {
const validNodesEntity = nodesEntries.filter((node) => this.isSelectionValid(node.entry));

View File

@@ -68,7 +68,8 @@ export class ContentUserInfoComponent 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()

View File

@@ -39,12 +39,14 @@ export class FolderDialogComponent implements OnInit {
folder: Node = null;
/** Emitted when the edit/create folder give error for example a folder with same name already exist
/**
* Emitted when the edit/create folder give error for example a folder with same name already exist
*/
@Output()
error: EventEmitter<any> = new EventEmitter<any>();
/** Emitted when the edit/create folder is successfully created/modified
/**
* Emitted when the edit/create folder is successfully created/modified
*/
@Output()
success: EventEmitter<any> = new EventEmitter<Node>();

View File

@@ -49,7 +49,8 @@ export class LibraryDialogComponent implements OnInit, OnDestroy {
@Output()
error: EventEmitter<any> = new EventEmitter<any>();
/** Emitted when the new library is created successfully. The
/**
* Emitted when the new library is created successfully. The
* event parameter is a SiteEntry object with the details of the
* newly-created library.
*/

View File

@@ -28,7 +28,8 @@ import { NodeAllowableOperationSubject } from '../interfaces/node-allowable-oper
})
export class CheckAllowableOperationDirective implements OnChanges {
/** Node permission to check (create, delete, update, updatePermissions,
/**
* Node permission to check (create, delete, update, updatePermissions,
* !create, !delete, !update, !updatePermissions).
*/
@Input('adf-check-allowable-operation')
@@ -57,7 +58,7 @@ export class CheckAllowableOperationDirective implements OnChanges {
/**
* Updates disabled state for the decorated element
*
* @memberof CheckAllowableOperationDirective
* @returns the new state
*/
updateElement(): boolean {
const enable = this.hasAllowableOperations(this.nodes, this.permission);
@@ -112,7 +113,7 @@ export class CheckAllowableOperationDirective implements OnChanges {
*
* @param nodes Node collection to check
* @param permission Permission to check for each node
* @memberof CheckAllowableOperationDirective
* @returns `true` if there are allowable operations, otherwise `false`
*/
hasAllowableOperations(nodes: NodeEntry[], permission: string): boolean {
if (nodes && nodes.length > 0) {

View File

@@ -35,6 +35,7 @@ export class ContentActionListComponent {
* Registers action handler within the parent document list component.
*
* @param action Action model to register.
* @returns `true` if actions was registered, otherwise `false`
*/
registerAction(action: ContentActionModel): boolean {
if (this.documentList && action) {

View File

@@ -76,13 +76,15 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy {
@Output()
permissionEvent = new EventEmitter();
/** Emitted when an error occurs during the action.
/**
* Emitted when an error occurs during the action.
* Applies to copy and move actions.
*/
@Output()
error = new EventEmitter();
/** Emitted when the action succeeds with the success string message.
/**
* Emitted when the action succeeds with the success string message.
* Applies to copy, move and delete actions.
*/
@Output()

View File

@@ -137,7 +137,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input()
display: string = DisplayMode.List;
/** Define a set of CSS styles to apply depending on the permission
/**
* Define a set of CSS styles to apply depending on the permission
* of the user on that node. See the Permission Style model
* page for further details and examples.
*/
@@ -156,7 +157,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input()
showHeader = ShowHeaderMode.Data;
/** User interaction for folder navigation or file preview.
/**
* User interaction for folder navigation or file preview.
* Valid values are "click" and "dblclick". Default value: "dblclick"
*/
@Input()
@@ -166,7 +168,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input()
thumbnails: boolean = false;
/** Row selection mode. Can be null, `single` or `multiple`. For `multiple` mode,
/**
* Row selection mode. Can be null, `single` or `multiple`. For `multiple` mode,
* you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows.
*/
@Input()
@@ -203,21 +206,24 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input()
allowDropFiles: boolean = false;
/** Defines default sorting. The format is an array of 2 strings `[key, direction]`
/**
* Defines default sorting. The format is an array of 2 strings `[key, direction]`
* i.e. `['name', 'desc']` or `['name', 'asc']`. Set this value only if you want to
* override the default sorting detected by the component based on columns.
*/
@Input()
sorting: string[] | DataSorting = ['name', 'asc'];
/** Defines default sorting. The format is an array of strings `[key direction, otherKey otherDirection]`
/**
* Defines default sorting. The format is an array of strings `[key direction, otherKey otherDirection]`
* i.e. `['name desc', 'nodeType asc']` or `['name asc']`. Set this value if you want a base
* rule to be added to the sorting apart from the one driven by the header.
*/
@Input()
additionalSorting: DataSorting = new DataSorting('isFolder', 'desc');
/** Defines sorting mode. Can be either `client` (items in the list
/**
* Defines sorting mode. Can be either `client` (items in the list
* are sorted client-side) or `server` (the ordering supplied by the
* server is used without further client-side sorting).
* Note that the `server` option *does not* request the server to sort the data
@@ -226,7 +232,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input()
sortingMode: 'server' | 'client' = 'server';
/** The inline style to apply to every row. See
/**
* The inline style to apply to every row. See
* the Angular NgStyle
* docs for more details and usage examples.
*/
@@ -237,14 +244,14 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input()
rowStyleClass: string;
/** Toggles the loading state and animated spinners for the component. Used in
/**
* Toggles the loading state and animated spinners for the component. Used in
* combination with `navigate=false` to perform custom navigation and loading
* state indication.
*/
@Input()
loading: boolean = false;
/** @hidden */
@Input()
_rowFilter: RowFilter | null = null;
@@ -292,7 +299,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input()
currentFolderId: string = null;
/** Array of nodes to be pre-selected. All nodes in the
/**
* Array of nodes to be pre-selected. All nodes in the
* array are pre-selected in multi selection mode, but only the first node
* is pre-selected in single selection mode.
*/
@@ -319,7 +327,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Output()
folderChange = new EventEmitter<NodeEntryEvent>();
/** Emitted when the user acts upon files with either single or double click
/**
* Emitted when the user acts upon files with either single or double click
* (depends on `navigation-mode`). Useful for integration with the
* Viewer component.
*/
@@ -765,6 +774,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
/**
* Creates a set of predefined columns.
* @param preset preset to use
*/
private setupDefaultColumns(preset: string = 'default'): void {
if (this.data) {

View File

@@ -170,7 +170,7 @@ export class DocumentListService implements DocumentListLoader {
* Load a folder by Node Id.
*
* @param nodeId ID of the folder node
* @param pagination
* @param pagination pagination model
* @param includeFields List of data field names to include in the results
* @param where Optionally filter the list
* @param orderBy order by node property

View File

@@ -54,6 +54,7 @@ export class NodeActionsService {
*
* @param contentEntry node to copy
* @param permission permission which is needed to apply the action
* @returns operation result
*/
copyContent(contentEntry: Node, permission?: string): Subject<string> {
return this.doFileOperation(NodeAction.COPY, 'content', contentEntry, permission);
@@ -64,6 +65,7 @@ export class NodeActionsService {
*
* @param contentEntry node to copy
* @param permission permission which is needed to apply the action
* @returns operation result
*/
copyFolder(contentEntry: Node, permission?: string): Subject<string> {
return this.doFileOperation(NodeAction.COPY, 'folder', contentEntry, permission);
@@ -74,6 +76,7 @@ export class NodeActionsService {
*
* @param contentEntry node to move
* @param permission permission which is needed to apply the action
* @returns operation result
*/
moveContent(contentEntry: Node, permission?: string): Subject<string> {
return this.doFileOperation(NodeAction.MOVE, 'content', contentEntry, permission);
@@ -84,6 +87,7 @@ export class NodeActionsService {
*
* @param contentEntry node to move
* @param permission permission which is needed to apply the action
* @returns operation result
*/
moveFolder(contentEntry: Node, permission?: string): Subject<string> {
return this.doFileOperation(NodeAction.MOVE, 'folder', contentEntry, permission);
@@ -96,6 +100,7 @@ export class NodeActionsService {
* @param type type of the content (content|folder)
* @param contentEntry the contentEntry which has to have the action performed on
* @param permission permission which is needed to apply the action
* @returns operation result
*/
private doFileOperation(action: NodeAction.COPY | NodeAction.MOVE, type: 'content' | 'folder', contentEntry: Node, permission?: string): Subject<string> {
const observable = new Subject<string>();

View File

@@ -31,7 +31,7 @@ export class NewVersionUploaderDialogComponent implements OnInit {
/**
* Dialog title to show into the header.
* If data.title is not provided, a default title is set
* */
*/
title: string;
/** Emitted when an action is done. */

View File

@@ -67,6 +67,7 @@ export class NodePermissionService {
* Get permissions for a given node
*
* @param node Node to check permissions for
* @returns list of permission models
*/
getNodePermissions(node: Node): PermissionDisplayModel[] {
const result: PermissionDisplayModel[] = [];

View File

@@ -45,10 +45,20 @@ describe('SearchChipAutocompleteInputComponent', () => {
fixture.detectChanges();
});
/**
* Get the input element
*
* @returns native element
*/
function getInput(): HTMLInputElement {
return fixture.debugElement.query(By.css('input')).nativeElement;
}
/**
* Enter the new input value
*
* @param value value to input
*/
function enterNewInputValue(value: string) {
const inputElement = getInput();
inputElement.dispatchEvent(new Event('focusin'));
@@ -57,6 +67,11 @@ describe('SearchChipAutocompleteInputComponent', () => {
fixture.detectChanges();
}
/**
* Add new option
*
* @param value value to input
*/
function addNewOption(value: string) {
const inputElement = getInput();
inputElement.value = value;
@@ -65,18 +80,39 @@ describe('SearchChipAutocompleteInputComponent', () => {
fixture.detectChanges();
}
/**
* Get material chip list
*
* @returns list of chips
*/
function getChipList(): MatChip[] {
return fixture.debugElement.queryAll(By.css('mat-chip')).map((chip) => chip.nativeElement);
}
/**
* Get chip value by specific index
*
* @param index index of the chip
* @returns chip value
*/
function getChipValue(index: number): string {
return fixture.debugElement.queryAll(By.css('mat-chip span')).map((chip) => chip.nativeElement)[index].innerText;
}
/**
* Get material option elements
*
* @returns list of debug elements
*/
function getOptionElements(): DebugElement[] {
return fixture.debugElement.queryAll(By.css('mat-option'));
}
/**
* Get added options for auto-complete
*
* @returns list of debug elements
*/
function getAddedOptionElements(): DebugElement[] {
return fixture.debugElement.queryAll(By.css('.adf-autocomplete-added-option'));
}

View File

@@ -31,7 +31,7 @@ export class SearchChipListComponent {
/**
* Search filter to supply the data for the chips.
* Not required from 4.5.0 and later versions @deprecated
* */
*/
@Input()
searchFilter: SearchFilterComponent;

View File

@@ -59,7 +59,8 @@ export class SearchControlComponent implements 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()
@@ -69,13 +70,15 @@ export class SearchControlComponent implements OnDestroy {
@Input()
liveSearchMaxResults: number = 5;
/** 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<any> = new EventEmitter();
/** 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.

View File

@@ -57,6 +57,11 @@ describe('SearchFilterAutocompleteChipsComponent', () => {
fixture.detectChanges();
});
/**
* Add new auto-complete input
*
* @param value value to add
*/
function addNewOption(value: string) {
const inputElement = fixture.debugElement.query(By.css('adf-search-chip-autocomplete-input input')).nativeElement;
inputElement.value = value;

View File

@@ -50,16 +50,30 @@ describe('SearchFacetChipTabbedComponent', () => {
fixture.detectChanges();
});
/**
* Open the facet
*/
function openFacet() {
const chip = fixture.debugElement.query(By.css('mat-chip'));
chip.triggerEventHandler('click', {});
fixture.detectChanges();
}
/**
* Get the filter display value
*
* @returns filter value
*/
function getDisplayValue(): string {
return fixture.debugElement.query(By.css('.adf-search-filter-ellipsis.adf-filter-value')).nativeElement.innerText.trim();
}
/**
* Emit the event for the tabbed content
*
* @param eventName event name to trigger
* @param event event to trigger
*/
function emitChildEvent(eventName: string, event: any) {
const debugElem = fixture.debugElement.query(By.css('adf-search-facet-tabbed-content'));
debugElem.triggerEventHandler(eventName, event);
@@ -98,7 +112,7 @@ describe('SearchFacetChipTabbedComponent', () => {
it('should display adf-search-facet-tabbed-content component', () => {
openFacet();
let activeTabLabel = fixture.debugElement.query(By.css('adf-search-facet-tabbed-content'));
const activeTabLabel = fixture.debugElement.query(By.css('adf-search-facet-tabbed-content'));
expect(activeTabLabel).toBeTruthy();
});

View File

@@ -62,15 +62,28 @@ describe('SearchFacetTabbedContentComponent', () => {
fixture.detectChanges();
});
/**
* Get the tab label content
*
* @returns list of native elements
*/
function getTabs(): HTMLDivElement[] {
return fixture.debugElement.queryAll(By.css('.mat-tab-label-content')).map((element) => element.nativeElement);
}
/**
* Set selected tab
*
* @param tabIndex index of the tab
*/
function changeTab(tabIndex: number) {
getTabs()[tabIndex].click();
fixture.detectChanges();
}
/**
* Trigger component property change event
*/
function triggerComponentChanges() {
component.ngOnChanges({
tabbedFacet: new SimpleChange(null, component.tabbedFacet, false)
@@ -78,6 +91,12 @@ describe('SearchFacetTabbedContentComponent', () => {
fixture.detectChanges();
}
/**
* Add new item to the bucket
*
* @param field field name
* @param displayValue value to display
*/
function addBucketItem(field: string, displayValue: string) {
component.tabbedFacet.facets[field].buckets.items.push({
count: 1,

View File

@@ -47,14 +47,30 @@ describe('SearchLogicalFilterComponent', () => {
fixture.detectChanges();
});
/**
* Get search input elements
*
* @returns list of native elements
*/
function getInputs(): HTMLInputElement[] {
return fixture.debugElement.queryAll(By.css('.adf-search-input input')).map((input) => input.nativeElement);
}
/**
* Get input label elements
*
* @returns list of labels
*/
function getInputsLabels(): string[] {
return fixture.debugElement.queryAll(By.css('.adf-search-input mat-label')).map((label) => label.nativeElement.innerText);
}
/**
* Enters a new phrase
*
* @param value new value
* @param index value index
*/
function enterNewPhrase(value: string, index: number) {
const inputs = getInputs();
inputs[index].value = value;

View File

@@ -64,7 +64,8 @@ export class SearchComponent implements SearchComponentInterface, AfterContentIn
@Input()
skipResults: number = 0;
/** Search term to use when executing the search. Updating this value will
/**
* Search term to use when executing the search. Updating this value will
* run a new search and update the results.
*/
@Input()

View File

@@ -55,27 +55,47 @@ export class SearchFilterList<T> implements Iterable<T> {
this.currentPageSize = this.pageSize;
}
/** Returns visible portion of the items. */
/**
* Returns visible portion of the items.
*
* @returns list of items
*/
get visibleItems(): T[] {
return this.filteredItems.slice(0, this.currentPageSize);
}
/** Returns entire collection length including items not displayed on the page. */
/**
* Get items length
*
* @returns entire collection length including items not displayed on the page
*/
get length(): number {
return this.items.length;
}
/** Detects whether more items can be displayed. */
/**
* Detect whether more items can be displayed.
*
* @returns `true` if can show more items, otherwise `false`
*/
get canShowMoreItems(): boolean {
return this.filteredItems.length > this.currentPageSize;
}
/** Detects whether less items can be displayed. */
/**
* Detect whether less items can be displayed.
*
* @returns `true` if can show less items, otherwise `false`
*/
get canShowLessItems(): boolean {
return this.currentPageSize > this.pageSize;
}
/** Detects whether content fits single page. */
/**
* Detect whether content fits single page.
*
* @returns `true` if content fits single page, otherwise `false`.
*/
get fitsPage(): boolean {
return this.pageSize >= this.filteredItems.length;
}

View File

@@ -285,6 +285,8 @@ export abstract class BaseQueryBuilderService {
/**
* Builds the current query and triggers the `updated` event.
*
* @param queryBody query settings
*/
update(queryBody?: SearchRequest): void {
const query = queryBody ? queryBody : this.buildQuery();
@@ -294,7 +296,7 @@ export abstract class BaseQueryBuilderService {
/**
* Builds and executes the current query.
*
* @returns Nothing
* @param queryBody query settings
*/
async execute(queryBody?: SearchRequest) {
try {

View File

@@ -40,9 +40,10 @@ const DEFAULT_PAGE_SIZE: number = 5;
providedIn: 'root'
})
export class SearchFacetFiltersService implements OnDestroy {
/** All facet field items to be displayed in the component. These are updated according to the response.
* When a new search is performed, the already existing items are updated with the new bucket count values and
* the newly received items are added to the responseFacets.
/**
* All facet field items to be displayed in the component. These are updated according to the response.
* When a new search is performed, the already existing items are updated with the new bucket count values and
* the newly received items are added to the responseFacets.
*/
responseFacets: FacetField[] = null;
/* tabbed facet incorporating creator and modifier facets */

View File

@@ -80,10 +80,10 @@ export class SecurityControlsService {
/**
* Get All security groups
*
* @param include Additional information about the security group
* @param skipCount The number of entities that exist in the collection before those included in this list.
* @param maxItems The maximum number of items to return in the list. Default is specified by UserPreferencesService.
* @return Promise<SecurityControlsGroupResponse>
* @param include Additional information about the security group
* @returns Promise<SecurityControlsGroupResponse>
*/
getSecurityGroup(
skipCount = DEFAULT_SKIP_COUNT,
@@ -117,7 +117,7 @@ export class SecurityControlsService {
* Create security group
*
* @param input securityGroupBody.
* @return Observable<SecurityGroupEntry>
* @returns Observable<SecurityGroupEntry>
*/
createSecurityGroup(
input: SecurityGroupBody
@@ -141,7 +141,7 @@ export class SecurityControlsService {
*
* @param securityGroupId The key for the security group id.
* @param input securityMarkBody[].
* @return Promise<SecurityMarkPaging | SecurityMarkEntry>
* @returns Promise<SecurityMarkPaging | SecurityMarkEntry>
*/
createSecurityMarks(
securityGroupId: string,
@@ -170,7 +170,7 @@ export class SecurityControlsService {
*
* @param securityGroupId The key for the security group id.
* @param skipCount The number of entities that exist in the collection before those included in this list.
* @return Promise<SecurityControlsMarkResponse>
* @returns Promise<SecurityControlsMarkResponse>
*/
getSecurityMark(
securityGroupId: string,
@@ -203,7 +203,7 @@ export class SecurityControlsService {
* @param securityGroupId The Key of Security Group id for which info is required
* @param input SecurityGroupBody
* @param opts additional information about the security group
* @return Promise<SecurityGroupEntry>
* @returns Promise<SecurityGroupEntry>
*/
updateSecurityGroup(
securityGroupId: string,
@@ -242,7 +242,7 @@ export class SecurityControlsService {
* @param securityGroupId The key for the security group id.
* @param securityMarkId The key for the security mark is in use or not.
* @param input securityMarkBody.
* @return Promise<SecurityMarkEntry>
* @returns Promise<SecurityMarkEntry>
*/
updateSecurityMark(
securityGroupId: string,
@@ -274,7 +274,7 @@ export class SecurityControlsService {
* Delete security group
*
* @param securityGroupId The key for the security group id.
* @return Observable<void>
* @returns Observable<void>
*/
deleteSecurityGroup(
securityGroupId: string
@@ -292,7 +292,7 @@ export class SecurityControlsService {
*
* @param securityGroupId The key for the security group id.
* @param securityMarkId The key for the security mark id.
* @return Promise<SecurityMarkEntry>
* @returns Promise<SecurityMarkEntry>
*/
deleteSecurityMark(
securityGroupId: string,
@@ -321,7 +321,7 @@ export class SecurityControlsService {
* @param authorityName The name for the authority for which the clearance is to be fetched. Can be left blank in which case it will fetch it for all users with pagination
* @param skipCount The number of entities that exist in the collection before those included in this list.
* @param maxItems The maximum number of items to return in the list. Default is specified by UserPreferencesService.
* @return Observable<AuthorityClearanceGroupPaging>
* @returns Observable<AuthorityClearanceGroupPaging>
*/
getClearancesForAuthority(
authorityName: string,
@@ -345,7 +345,7 @@ export class SecurityControlsService {
*
* @param authorityName The name for the authority for which the clearance is to be updated
* @param securityMarksList NodeSecurityMarkBody[]
* @return Observable<SecurityMarkEntry | SecurityMarkPaging>
* @returns Observable<SecurityMarkEntry | SecurityMarkPaging>
*/
updateClearancesForAuthority(authorityName: string, securityMarksList: NodeSecurityMarkBody[]): Observable<SecurityMarkEntry | SecurityMarkPaging> {
this.loadingSource.next(true);

View File

@@ -43,7 +43,8 @@ export class DropdownSitesComponent implements OnInit {
@Input()
hideMyFiles: boolean = false;
/** A custom list of sites to be displayed by the dropdown. If no value
/**
* A custom list of sites to be displayed by the dropdown. If no value
* is given, the sites of the current user are displayed by default. A
* list of objects only with properties 'title' and 'guid' is enough to
* be able to display the dropdown.
@@ -55,20 +56,23 @@ export class DropdownSitesComponent implements OnInit {
@Input()
value: string = null;
/** Text or a translation key to act as a placeholder. Default value is the
/**
* Text or a translation key to act as a placeholder. Default value is the
* key "DROPDOWN.PLACEHOLDER_LABEL".
*/
@Input()
placeholder: string = 'DROPDOWN.PLACEHOLDER_LABEL';
/** Filter for the results of the sites query. Possible values are
/**
* Filter for the results of the sites query. Possible values are
* "members" and "containers". When "members" is used, the site list
* will be restricted to the sites that the user is a member of.
*/
@Input()
relations: string;
/** Emitted when the user selects a site. When the default option is selected,
/**
* Emitted when the user selects a site. When the default option is selected,
* an empty model is emitted.
*/
@Output()

View File

@@ -194,8 +194,7 @@ export class TagService {
*
* @param nodeId Id of node to which tags should be assigned.
* @param tags List of tags to create and assign or just assign if they already exist.
*
* @return Just linked tags to node or single tag if linked only one tag.
* @returns Just linked tags to node or single tag if linked only one tag.
*/
assignTagsToNode(nodeId: string, tags: TagBody[]): Observable<TagPaging | TagEntry> {
return from(this.tagsApi.assignTagsToNode(nodeId, tags)).pipe(

View File

@@ -56,11 +56,6 @@ export class TagListComponent implements OnInit, OnDestroy {
private onDestroy$ = new Subject<boolean>();
/**
* Constructor
*
* @param tagService
*/
constructor(private tagService: TagService) {
this.defaultPagination = {

View File

@@ -57,10 +57,20 @@ describe('TagNodeList', () => {
let tagService: TagService;
let resizeCallback: ResizeObserverCallback;
/**
* Find 'More' button
*
* @returns native element
*/
function findViewMoreButton(): HTMLButtonElement {
return element.querySelector('.adf-view-more-button');
}
/**
* Get the tag chips
*
* @returns native element list
*/
function findTagChips(): NodeListOf<Element> {
return element.querySelectorAll('.adf-tag-chips');
}
@@ -149,7 +159,12 @@ describe('TagNodeList', () => {
describe('Limit tags display', () => {
let initialEntries: TagEntry[];
async function renderTags(entries?: TagEntry[]): Promise<any> {
/**
* Render tags
*
* @param entries tags to render
*/
async function renderTags(entries?: TagEntry[]) {
dataTag.list.entries = entries || initialEntries;
component.tagsEntries = dataTag.list.entries;
fixture.detectChanges();

View File

@@ -88,12 +88,6 @@ export class TagNodeListComponent implements OnChanges, OnDestroy, OnInit, After
this.changeDetectorRef.detectChanges();
});
/**
* Constructor
*
* @param tagService
* @param changeDetectorRef
*/
constructor(private tagService: TagService, private changeDetectorRef: ChangeDetectorRef) {
}

View File

@@ -85,29 +85,59 @@ describe('TagsCreatorComponent', () => {
fixture.detectChanges();
});
/**
* Get name input element
*
* @returns native element
*/
function getNameInput(): HTMLInputElement {
return fixture.debugElement.query(By.css(`.adf-tag-name-field input`))?.nativeElement;
}
/**
* Get the create tag label
*
* @returns native element
*/
function getCreateTagLabel(): HTMLSpanElement {
return fixture.debugElement.query(By.css('.adf-create-tag-label'))?.nativeElement;
}
/**
* Get remove tag buttons
*
* @returns list of native elements
*/
function getRemoveTagButtons(): HTMLButtonElement[] {
const elements = fixture.debugElement.queryAll(By.css(`[data-automation-id="remove-tag-button"]`));
return elements.map(el => el.nativeElement);
}
/**
* Click at the hide name input button
*/
function clickAtHideNameInputButton() {
fixture.debugElement.query(By.css(`[data-automation-id="hide-tag-name-input-button"]`)).nativeElement.click();
fixture.detectChanges();
}
/**
* Get newly added tags
*
* @returns list of tags
*/
function getAddedTags(): string[] {
const tagElements = fixture.debugElement.queryAll(By.css(`.adf-tags-creation .adf-tag`));
return tagElements.map(el => el.nativeElement.firstChild.nodeValue.trim());
}
/**
* Adds tag to the added list
*
* @param tagName tag name
* @param addUsingEnter use Enter when adding
* @param typingTimeout typing timeout in milliseconds (default 300)
*/
function addTagToAddedList(tagName: string, addUsingEnter?: boolean, typingTimeout = 300): void {
typeTag(tagName, typingTimeout);
@@ -121,6 +151,12 @@ describe('TagsCreatorComponent', () => {
fixture.detectChanges();
}
/**
* type a new tag
*
* @param tagName tag name
* @param timeout typing timeout in milliseconds (default 300)
*/
function typeTag(tagName: string, timeout = 300): void {
component.tagNameControlVisible = true;
fixture.detectChanges();
@@ -133,10 +169,20 @@ describe('TagsCreatorComponent', () => {
fixture.detectChanges();
}
/**
* Find the selection list
*
* @returns material component
*/
function findSelectionList(): MatSelectionList {
return fixture.debugElement.query(By.directive(MatSelectionList)).componentInstance;
}
/**
* Get the existing tags label
*
* @returns label
*/
function getExistingTagsLabel(): string {
return fixture.debugElement.query(By.css('.adf-existing-tags-label')).nativeElement.textContent.trim();
}
@@ -323,6 +369,11 @@ describe('TagsCreatorComponent', () => {
}));
describe('Errors', () => {
/**
* Get first error
*
* @returns error text
*/
function getFirstError(): string {
const error = fixture.debugElement.query(By.directive(MatError));
return error?.nativeElement.textContent;
@@ -407,6 +458,11 @@ describe('TagsCreatorComponent', () => {
});
describe('Existing tags panel', () => {
/**
* Get the existing tags panel
*
* @returns debug element
*/
function getPanel(): DebugElement {
return fixture.debugElement.query(By.css(`.adf-existing-tags-panel`));
}
@@ -498,6 +554,11 @@ describe('TagsCreatorComponent', () => {
});
describe('Existing tags', () => {
/**
* Get the existing tags
*
* @returns list of tags
*/
function getExistingTags(): string[] {
const tagElements = fixture.debugElement.queryAll(By.css(`.adf-existing-tags-panel .adf-tag .mat-list-text`));
return tagElements.map(el => el.nativeElement.firstChild.nodeValue.trim());
@@ -710,6 +771,11 @@ describe('TagsCreatorComponent', () => {
});
describe('Spinner', () => {
/**
* Get the material progress spinner
*
* @returns debug element
*/
function getSpinner(): DebugElement {
return fixture.debugElement.query(By.css(`.mat-progress-spinner`));
}

View File

@@ -285,7 +285,7 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
/**
* Called when user selects any tag from list of existing tags. It moves tag from existing tags list to top list.
*
* @param change
* @param change changes
*/
addExistingTagToTagsToAssign(change: MatSelectionListChange): void {
const selectedTag: TagEntry = change.options[0].value;
@@ -299,7 +299,7 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
/**
* Checks if component is in Create mode.
*
* @return true if Create mode, false otherwise.
* @returns `true` if `Create` mode, `false` otherwise.
*/
isOnlyCreateMode(): boolean {
return this.mode === TagsCreatorMode.CREATE;

View File

@@ -151,10 +151,11 @@ export class TreeComponent<T extends TreeNode> implements OnInit, OnDestroy {
/**
* Checks if node is LoadMoreNode node
*
* @param _idx (unused)
* @param node node to be checked
* @returns boolean
* @returns `true` if there are more items to load, otherwise `false`
*/
public isLoadMoreNode(_: number, node: T): boolean {
public isLoadMoreNode(_idx: number, node: T): boolean {
return node.nodeType === TreeNodeType.LoadMoreNode;
}

View File

@@ -109,7 +109,6 @@ export abstract class TreeService<T extends TreeNode> extends DataSource<T> {
* Gets children of the node
*
* @param parentNode Parent node
*
* @returns children of parent node
*/
public getChildren(parentNode: T): T[] {

View File

@@ -31,13 +31,15 @@ export abstract class UploadBase implements OnInit, OnDestroy {
protected translationService = inject(TranslationService);
protected ngZone = inject(NgZone);
/** Sets a limit on the maximum size (in bytes) of a file to be uploaded.
/**
* Sets a limit on the maximum size (in bytes) of a file to be uploaded.
* Has no effect if undefined.
*/
@Input()
maxFilesSize: number;
/** The ID of the root. Use the nodeId for
/**
* The ID of the root. Use the nodeId for
* Content Services or the taskId/processId for Process Services.
*/
@Input()
@@ -99,7 +101,7 @@ export abstract class UploadBase implements OnInit, OnDestroy {
/**
* Upload a list of file in the specified path
*
* @param files
* @param files files to upload
*/
uploadFiles(files: File[]): void {
const filteredFiles: FileModel[] = files
@@ -142,6 +144,7 @@ export abstract class UploadBase implements OnInit, OnDestroy {
* Checks if the given file is allowed by the extension filters
*
* @param file FileModel
* @returns `true` if file is acceptable, otherwise `false`
*/
protected isFileAcceptable(file: FileModel): boolean {
if (this.acceptedFilesType === '*') {
@@ -158,10 +161,11 @@ export abstract class UploadBase implements OnInit, OnDestroy {
/**
* Creates FileModel from File
*
* @param file
* @param parentId
* @param path
* @param id
* @param file file instance
* @param parentId parent id
* @param path upload path
* @param id model id
* @returns file model
*/
protected createFileModel(file: File, parentId: string, path: string, id?: string): FileModel {
return new FileModel(file, {
@@ -195,6 +199,7 @@ export abstract class UploadBase implements OnInit, OnDestroy {
* Checks if the given file is an acceptable size
*
* @param file FileModel
* @returns `true` if file size is acceptable, otherwise `false`
*/
private isFileSizeAcceptable(file: FileModel): boolean {
let acceptableSize = true;

View File

@@ -55,8 +55,6 @@ export class FileUploadingListComponent {
* Cancel file upload
*
* @param file File model to cancel upload for.
*
* @memberOf FileUploadingListComponent
*/
cancelFile(file: FileModel): void {
if (file.status === FileUploadStatus.Pending) {
@@ -70,8 +68,6 @@ export class FileUploadingListComponent {
* Remove uploaded file
*
* @param file File model to remove upload for.
*
* @memberOf FileUploadingListComponent
*/
removeFile(file: FileModel): void {
if (file.status === FileUploadStatus.Error) {
@@ -99,6 +95,8 @@ export class FileUploadingListComponent {
/**
* Checks if all the files are uploaded false if there is at least one file in Progress | Starting | Pending
*
* @returns `true` if upload is complete, otherwise `false`
*/
isUploadCompleted(): boolean {
return (
@@ -115,6 +113,8 @@ export class FileUploadingListComponent {
/**
* Check if all the files are Cancelled | Aborted | Error. false if there is at least one file in uploading states
*
* @returns `true` if upload is cancelled, otherwise `false`
*/
isUploadCancelled(): boolean {
return (

View File

@@ -77,7 +77,11 @@ export class UploadDragAreaComponent extends UploadBase implements NodeAllowable
});
}
/** Returns true or false considering the component options and node permissions */
/**
* Check if content is droppable
*
* @returns `true` or `false` considering the component options and node permissions
*/
isDroppable(): boolean {
return !this.disabled;
}

View File

@@ -141,7 +141,7 @@ export class FileDraggableDirective implements OnInit, OnDestroy {
/**
* Change the style of the drag area when a file is over the drag area.
*
* @param event
* @param event drag event
*/
onDragOver(event: DragEvent): void {
if (this.enabled && !event.defaultPrevented) {
@@ -158,7 +158,7 @@ export class FileDraggableDirective implements OnInit, OnDestroy {
/**
* Prevent default and stop propagation of the DOM event.
*
* @param $event - DOM event.
* @param event DOM event
*/
preventDefault(event: Event): void {
event.stopPropagation();

View File

@@ -18,6 +18,12 @@
import { VersionCompatibilityService } from './version-compatibility.service';
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
/**
* Create a version compatibility factory
*
* @param versionCompatibilityService service dependency
* @returns factory function
*/
export function versionCompatibilityFactory(versionCompatibilityService: VersionCompatibilityService) {
return () => versionCompatibilityService;
}

View File

@@ -95,7 +95,8 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy {
@Input()
showViewer = true;
/** Number of times the Viewer will retry fetching content Rendition.
/**
* Number of times the Viewer will retry fetching content Rendition.
* There is a delay of at least one second between attempts.
*/
@Input()
@@ -109,13 +110,15 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy {
@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()

View File

@@ -19,27 +19,6 @@ import { ObjectDataTableAdapter, AlfrescoApiService, LogService } from '@alfresc
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
import { WebscriptApi } from '@alfresco/js-api';
/**
* <adf-webscript-get [scriptPath]="string"
* [scriptArgs]="Object"
* [contextRoot]="string"
* [servicePath]="string"
* [contentType]="JSON|HTML|DATATABLE"
* (success)="customMethod($event)>
* </adf-webscript-get>
*
* This component, provide a get webscript viewer
*
* @InputParam {string} scriptPath path to Web Script (as defined by Web Script)
* @InputParam {Object} scriptArgs arguments to pass to Web Script
* @InputParam {string} contextRoot path where application is deployed default value 'alfresco'
* @InputParam {string} servicePath path where Web Script service is mapped default value 'service'
* @InputParam {string} contentType JSON | HTML | DATATABLE | TEXT
*
* @Output - success - The event is emitted when the data are received
*
*/
/**
* @deprecated Webscript component has never been turned into a product and has no UI/UX and no use cases in ACA/ADW/ACC.
*/
@@ -75,13 +54,15 @@ export class WebscriptComponent implements OnChanges {
@Input()
servicePath: string = 'service';
/** Content type to interpret the data received from the webscript.
/**
* Content type to interpret the data received from the webscript.
* Can be "JSON" , "HTML" , "DATATABLE" or "TEXT"
*/
@Input()
contentType: string = 'TEXT';
/** Emitted when the operation succeeds. You can get the plain data from
/**
* Emitted when the operation succeeds. You can get the plain data from
* the webscript through the **success** event parameter and use it as you
* need in your application.
*/
@@ -124,8 +105,7 @@ export class WebscriptComponent implements OnChanges {
/**
* show the data in a ng2-alfresco-datatable
*
* @param data
*
* @param data data
* @returns the data as datatable
*/
showDataAsDataTable(data: any) {