From 9baa5e72a8de39509453fe1f005da36945a9b731 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Tue, 5 Dec 2017 17:41:36 +0100 Subject: [PATCH] docs: add descriptions to properties initialized through the constructor Adds the missing docs to some of the properties that are declared through the constructor params. Fixes #8789. --- src/lib/autocomplete/autocomplete.ts | 6 +++++- src/lib/chips/chip-input.ts | 2 ++ src/lib/chips/chip-list.ts | 6 +++++- src/lib/chips/chip.ts | 8 +++++++- src/lib/core/option/option.ts | 6 +++++- src/lib/datepicker/datepicker-input.ts | 10 ++++++++-- src/lib/input/autosize.ts | 3 ++- src/lib/menu/menu-directive.ts | 1 + src/lib/select/select.ts | 6 +++++- src/lib/sidenav/drawer.ts | 6 +++++- src/lib/tabs/tab-group.ts | 2 ++ src/lib/tabs/tab.ts | 6 +++++- 12 files changed, 52 insertions(+), 10 deletions(-) diff --git a/src/lib/autocomplete/autocomplete.ts b/src/lib/autocomplete/autocomplete.ts index 0311b4880bd4..cd54eda97632 100644 --- a/src/lib/autocomplete/autocomplete.ts +++ b/src/lib/autocomplete/autocomplete.ts @@ -33,7 +33,11 @@ let _uniqueAutocompleteIdCounter = 0; /** Event object that is emitted when an autocomplete option is selected */ export class MatAutocompleteSelectedEvent { - constructor(public source: MatAutocomplete, public option: MatOption) { } + constructor( + /** Reference to the autocomplete panel that emitted the event. */ + public source: MatAutocomplete, + /** Option that was selected. */ + public option: MatOption) { } } diff --git a/src/lib/chips/chip-input.ts b/src/lib/chips/chip-input.ts index dd3e8ddc7d0e..7bd9cae2bd04 100644 --- a/src/lib/chips/chip-input.ts +++ b/src/lib/chips/chip-input.ts @@ -69,8 +69,10 @@ export class MatChipInput { @Output('matChipInputTokenEnd') chipEnd = new EventEmitter(); + /** The input's placeholder text. */ @Input() placeholder: string = ''; + /** Whether the input is empty. */ get empty(): boolean { let value: string | null = this._inputElement.value; return (value == null || value === ''); diff --git a/src/lib/chips/chip-list.ts b/src/lib/chips/chip-list.ts index bbcb3b7f1379..8a1ca559e34d 100644 --- a/src/lib/chips/chip-list.ts +++ b/src/lib/chips/chip-list.ts @@ -60,7 +60,11 @@ let nextUniqueId = 0; /** Change event object that is emitted when the chip list value has changed. */ export class MatChipListChange { - constructor(public source: MatChipList, public value: any) { } + constructor( + /** Chip list that emitted the event. */ + public source: MatChipList, + /** Value of the chip list when the event was emitted. */ + public value: any) { } } diff --git a/src/lib/chips/chip.ts b/src/lib/chips/chip.ts index 38106026beba..2cbb6248c008 100644 --- a/src/lib/chips/chip.ts +++ b/src/lib/chips/chip.ts @@ -29,7 +29,13 @@ export interface MatChipEvent { /** Event object emitted by MatChip when selected or deselected. */ export class MatChipSelectionChange { - constructor(public source: MatChip, public selected: boolean, public isUserInput = false) { } + constructor( + /** Reference to the chip that emitted the event. */ + public source: MatChip, + /** Whether the chip that emitted the event is selected. */ + public selected: boolean, + /** Whether the selection change was a result of a user interaction. */ + public isUserInput = false) { } } diff --git a/src/lib/core/option/option.ts b/src/lib/core/option/option.ts index efeed564a43b..64666edb9669 100644 --- a/src/lib/core/option/option.ts +++ b/src/lib/core/option/option.ts @@ -32,7 +32,11 @@ let _uniqueIdCounter = 0; /** Event object emitted by MatOption when selected or deselected. */ export class MatOptionSelectionChange { - constructor(public source: MatOption, public isUserInput = false) { } + constructor( + /** Reference to the option that emitted the event. */ + public source: MatOption, + /** Whether the change in the option's value was a result of a user action. */ + public isUserInput = false) { } } /** diff --git a/src/lib/datepicker/datepicker-input.ts b/src/lib/datepicker/datepicker-input.ts index db0cfc8936e0..f428fafcf462 100644 --- a/src/lib/datepicker/datepicker-input.ts +++ b/src/lib/datepicker/datepicker-input.ts @@ -61,7 +61,11 @@ export class MatDatepickerInputEvent { /** The new value for the target datepicker input. */ value: D | null; - constructor(public target: MatDatepickerInput, public targetElement: HTMLElement) { + constructor( + /** Reference to the datepicker input component that emitted the event. */ + public target: MatDatepickerInput, + /** Reference to the native input element associated with the datepicker input. */ + public targetElement: HTMLElement) { this.value = this.target.value; } } @@ -104,7 +108,9 @@ export class MatDatepickerInput implements AfterContentInit, ControlValueAcce } } - @Input() set matDatepickerFilter(filter: (date: D | null) => boolean) { + /** Function that can be used to filter out dates within the datepicker. */ + @Input() + set matDatepickerFilter(filter: (date: D | null) => boolean) { this._dateFilter = filter; this._validatorOnChange(); } diff --git a/src/lib/input/autosize.ts b/src/lib/input/autosize.ts index 0bfc6abe0560..256f4c691e88 100644 --- a/src/lib/input/autosize.ts +++ b/src/lib/input/autosize.ts @@ -29,14 +29,15 @@ export class MatTextareaAutosize implements AfterViewInit, DoCheck { private _minRows: number; private _maxRows: number; + /** Minimum amount of rows in the textarea. */ @Input('matAutosizeMinRows') get minRows() { return this._minRows; } - set minRows(value: number) { this._minRows = value; this._setMinHeight(); } + /** Maximum amount of rows in the textarea. */ @Input('matAutosizeMaxRows') get maxRows() { return this._maxRows; } set maxRows(value: number) { diff --git a/src/lib/menu/menu-directive.ts b/src/lib/menu/menu-directive.ts index a58d36e9f15f..977a34707a31 100644 --- a/src/lib/menu/menu-directive.ts +++ b/src/lib/menu/menu-directive.ts @@ -122,6 +122,7 @@ export class MatMenu implements AfterContentInit, MatMenuPanel, OnDestroy { this.setPositionClasses(); } + /** @docs-private */ @ViewChild(TemplateRef) templateRef: TemplateRef; /** List of the items inside of a menu. */ diff --git a/src/lib/select/select.ts b/src/lib/select/select.ts index 5785e6459ecb..0cee44c76514 100644 --- a/src/lib/select/select.ts +++ b/src/lib/select/select.ts @@ -137,7 +137,11 @@ export const MAT_SELECT_SCROLL_STRATEGY_PROVIDER = { /** Change event object that is emitted when the select value has changed. */ export class MatSelectChange { - constructor(public source: MatSelect, public value: any) { } + constructor( + /** Reference to the select that emitted the change event. */ + public source: MatSelect, + /** Current value of the select that emitted the event. */ + public value: any) { } } // Boilerplate for applying mixins to MatSelect. diff --git a/src/lib/sidenav/drawer.ts b/src/lib/sidenav/drawer.ts index e41b45fb317c..301ad3911421 100644 --- a/src/lib/sidenav/drawer.ts +++ b/src/lib/sidenav/drawer.ts @@ -51,7 +51,11 @@ export function throwMatDuplicatedDrawerError(position: string) { * @deprecated */ export class MatDrawerToggleResult { - constructor(public type: 'open' | 'close', public animationFinished: boolean) {} + constructor( + /** Whether the drawer is opened or closed. */ + public type: 'open' | 'close', + /** Whether the drawer animation is finished. */ + public animationFinished: boolean) {} } diff --git a/src/lib/tabs/tab-group.ts b/src/lib/tabs/tab-group.ts index b526f1deb819..33029f3ea150 100644 --- a/src/lib/tabs/tab-group.ts +++ b/src/lib/tabs/tab-group.ts @@ -41,7 +41,9 @@ let nextId = 0; /** A simple change event emitted on focus or selection changes. */ export class MatTabChangeEvent { + /** Index of the currently-selected tab. */ index: number; + /** Reference to the currently-selected tab. */ tab: MatTab; } diff --git a/src/lib/tabs/tab.ts b/src/lib/tabs/tab.ts index ba0ca42d27f5..8dba0861f11b 100644 --- a/src/lib/tabs/tab.ts +++ b/src/lib/tabs/tab.ts @@ -53,7 +53,11 @@ export class MatTab extends _MatTabMixinBase implements OnInit, CanDisable, OnCh /** The portal that will be the hosted content of the tab */ private _contentPortal: TemplatePortal | null = null; - get content(): TemplatePortal | null { return this._contentPortal; } + + /** @docs-private */ + get content(): TemplatePortal | null { + return this._contentPortal; + } /** Emits whenever the label changes. */ _labelChange = new Subject();