[ADF-1769] Added JSDocs and prop tables (#2898)

This commit is contained in:
Andy Stark
2018-01-31 17:40:28 +00:00
committed by Eugenio Romano
parent 0d93c65fd7
commit dd7afc65db
11 changed files with 99 additions and 54 deletions

View File

@@ -45,21 +45,29 @@ import { MatListItem } from '@angular/material';
})
export class SearchControlComponent implements OnInit, OnDestroy {
/** Toggles whether to use an expanding search control. If false
* then a regular input is used.
*/
@Input()
expandable: boolean = true;
/** Toggles highlighting of the search term in the results. */
@Input()
highlight: boolean = false;
/** Type of the input field to render, e.g. "search" or "text" (default). */
@Input()
inputType: string = 'text';
/** Toggles auto-completion of the search input field. */
@Input()
autocomplete: boolean = false;
/** Toggles "find-as-you-type" suggestions for possible matches. */
@Input()
liveSearchEnabled: boolean = true;
/** Maximum number of results to show in the live search. */
@Input()
liveSearchMaxResults: number = 5;
@@ -67,12 +75,21 @@ export class SearchControlComponent implements OnInit, OnDestroy {
@Input()
customQueryBody: QueryBody;
/** Emitted when the search is submitted pressing ENTER button.
* The search term is provided as value of the event.
*/
@Output()
submit: EventEmitter<any> = new EventEmitter();
/** 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 the term is truncated to an empty
* string.
*/
@Output()
searchChange: EventEmitter<string> = new EventEmitter();
/** Emitted when a file item from the list of "find-as-you-type" results is selected. */
@Output()
optionClicked: EventEmitter<any> = new EventEmitter();
@@ -211,7 +228,7 @@ export class SearchControlComponent implements OnInit, OnDestroy {
let previousElement: any = this.getPreviousElementSibling(<Element> $event.target);
if (previousElement) {
previousElement.focus();
}else {
} else {
this.searchInput.nativeElement.focus();
this.focusSubject.next(new FocusEvent('focus'));
}

View File

@@ -51,12 +51,15 @@ export class SearchComponent implements AfterContentInit, OnChanges {
@ContentChild(TemplateRef)
template: TemplateRef<any>;
/** Function that maps an option's value to its display value in the trigger. */
@Input()
displayWith: ((value: any) => string) | null = null;
/** Maximum number of results to show in the search. */
@Input()
maxResults: number = 20;
/** Number of results to skip from the results pagination. */
@Input()
skipResults: number = 0;
@@ -64,9 +67,13 @@ export class SearchComponent implements AfterContentInit, OnChanges {
@Input()
queryBody: QueryBody;
/** Search term to use when executing the search. Updating this value will
* run a new search and update the results.
*/
@Input()
searchTerm: string = '';
/** CSS class for display. */
@Input('class')
set classList(classList: string) {
if (classList && classList.length) {
@@ -75,9 +82,11 @@ export class SearchComponent implements AfterContentInit, OnChanges {
}
}
/** Emitted when search results have fully loaded. */
@Output()
resultLoaded: EventEmitter<NodePaging> = new EventEmitter();
/** Emitted when an error occurs. */
@Output()
error: EventEmitter<any> = new EventEmitter();

View File

@@ -26,15 +26,25 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
})
export class DropdownSitesComponent implements OnInit {
/** Hide the "My Files" option. */
@Input()
hideMyFiles: boolean = false;
/** 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.
*/
@Input()
siteList: SitePaging = null;
/** Text or a translation key to act as a placeholder. */
@Input()
placeholder: string = 'DROPDOWN.PLACEHOLDER_LABEL';
/** Emitted when the user selects a site. When the default option is selected,
* an empty model is emitted.
*/
@Output()
change: EventEmitter<SiteEntry> = new EventEmitter();
@@ -54,7 +64,7 @@ export class DropdownSitesComponent implements OnInit {
let siteFound;
if (this.siteSelected === this.MY_FILES_VALUE) {
siteFound = { entry: {}};
}else {
} else {
siteFound = this.siteList.list.entries.find( site => site.entry.guid === this.siteSelected);
}
this.change.emit(siteFound);

View File

@@ -27,6 +27,7 @@ import { RatingService } from './services/rating.service';
})
export class RatingComponent implements OnChanges {
/** Identifier of the node to apply the rating to. */
@Input()
nodeId: string;
@@ -34,6 +35,7 @@ export class RatingComponent implements OnChanges {
ratingType: string = 'fiveStar';
/** Emitted when the "vote" gets changed. */
@Output()
changeVote = new EventEmitter();

View File

@@ -28,9 +28,11 @@ import { ChangeDetectionStrategy, Component, Directive, Input, ViewEncapsulation
export class SidebarActionMenuComponent {
/** The title of the sidebar action. */
@Input()
title: string;
/** Toggle the sidebar action menu on expand. */
@Input()
expanded: boolean;