mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
chore(docs): add types to public and jsdoc cleanup (#7711)
This commit is contained in:
@@ -32,13 +32,13 @@ let nextId = 0;
|
||||
})
|
||||
export class CdkAccordionItem implements OnDestroy {
|
||||
/** Event emitted every time the AccordionItem is closed. */
|
||||
@Output() closed = new EventEmitter<void>();
|
||||
@Output() closed: EventEmitter<void> = new EventEmitter<void>();
|
||||
/** Event emitted every time the AccordionItem is opened. */
|
||||
@Output() opened = new EventEmitter<void>();
|
||||
@Output() opened: EventEmitter<void> = new EventEmitter<void>();
|
||||
/** Event emitted when the AccordionItem is destroyed. */
|
||||
@Output() destroyed = new EventEmitter<void>();
|
||||
@Output() destroyed: EventEmitter<void> = new EventEmitter<void>();
|
||||
/** The unique AccordionItem id. */
|
||||
readonly id = `cdk-accordion-child-${nextId++}`;
|
||||
readonly id: string = `cdk-accordion-child-${nextId++}`;
|
||||
|
||||
/** Whether the AccordionItem is expanded. */
|
||||
@Input()
|
||||
|
||||
@@ -171,13 +171,14 @@ export class CdkStepper implements OnDestroy {
|
||||
|
||||
/** The step that is selected. */
|
||||
@Input()
|
||||
get selected() { return this._steps.toArray()[this.selectedIndex]; }
|
||||
get selected(): CdkStep { return this._steps.toArray()[this.selectedIndex]; }
|
||||
set selected(step: CdkStep) {
|
||||
this.selectedIndex = this._steps.toArray().indexOf(step);
|
||||
}
|
||||
|
||||
/** Event emitted when the selected step has changed. */
|
||||
@Output() selectionChange = new EventEmitter<StepperSelectionEvent>();
|
||||
@Output() selectionChange: EventEmitter<StepperSelectionEvent>
|
||||
= new EventEmitter<StepperSelectionEvent>();
|
||||
|
||||
/** The index of the step that the focus can be set. */
|
||||
_focusIndex: number = 0;
|
||||
|
||||
@@ -171,7 +171,7 @@ export class CdkTable<T> implements CollectionViewer, OnInit, AfterContentChecke
|
||||
* Stream containing the latest information on what rows are being displayed on screen.
|
||||
* Can be used by the data source to as a heuristic of what data should be provided.
|
||||
*/
|
||||
viewChange =
|
||||
viewChange: BehaviorSubject<{start: number, end: number}> =
|
||||
new BehaviorSubject<{start: number, end: number}>({start: 0, end: Number.MAX_VALUE});
|
||||
|
||||
// Placeholders within the table's template where the header and data rows will be inserted.
|
||||
|
||||
@@ -115,7 +115,7 @@ export class MatButtonToggleGroup extends _MatButtonToggleGroupMixinBase
|
||||
return this._vertical;
|
||||
}
|
||||
|
||||
set vertical(value) {
|
||||
set vertical(value: boolean) {
|
||||
this._vertical = coerceBooleanProperty(value);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ export class MatButtonToggleGroup extends _MatButtonToggleGroupMixinBase
|
||||
|
||||
/** Whether the toggle group is selected. */
|
||||
@Input()
|
||||
get selected() {
|
||||
get selected(): MatButtonToggle | null {
|
||||
return this._selected;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ export class MatChipInput {
|
||||
* Whether or not the chipEnd event will be emitted when the input is blurred.
|
||||
*/
|
||||
@Input('matChipInputAddOnBlur')
|
||||
get addOnBlur() { return this._addOnBlur; }
|
||||
get addOnBlur(): boolean { return this._addOnBlur; }
|
||||
set addOnBlur(value: boolean) { this._addOnBlur = coerceBooleanProperty(value); }
|
||||
_addOnBlur: boolean = false;
|
||||
|
||||
@@ -67,7 +67,7 @@ export class MatChipInput {
|
||||
|
||||
/** Emitted when a chip is to be added. */
|
||||
@Output('matChipInputTokenEnd')
|
||||
chipEnd = new EventEmitter<MatChipInputEvent>();
|
||||
chipEnd: EventEmitter<MatChipInputEvent> = new EventEmitter<MatChipInputEvent>();
|
||||
|
||||
/** The input's placeholder text. */
|
||||
@Input() placeholder: string = '';
|
||||
@@ -127,5 +127,5 @@ export class MatChipInput {
|
||||
this._chipList.stateChanges.next();
|
||||
}
|
||||
|
||||
focus() { this._inputElement.focus(); }
|
||||
focus(): void { this._inputElement.focus(); }
|
||||
}
|
||||
|
||||
@@ -227,15 +227,15 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
|
||||
this._id = value;
|
||||
this.stateChanges.next();
|
||||
}
|
||||
get id() { return this._id || this._uid; }
|
||||
get id(): string { return this._id || this._uid; }
|
||||
|
||||
/** Required for FormFieldControl. Whether the chip list is required. */
|
||||
@Input()
|
||||
set required(value: any) {
|
||||
set required(value: boolean) {
|
||||
this._required = coerceBooleanProperty(value);
|
||||
this.stateChanges.next();
|
||||
}
|
||||
get required() {
|
||||
get required(): boolean {
|
||||
return this._required;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
|
||||
this._placeholder = value;
|
||||
this.stateChanges.next();
|
||||
}
|
||||
get placeholder() {
|
||||
get placeholder(): string {
|
||||
return this._chipInput ? this._chipInput.placeholder : this._placeholder;
|
||||
}
|
||||
|
||||
@@ -260,6 +260,7 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
|
||||
return (!this._chipInput || this._chipInput.empty) && this.chips.length === 0;
|
||||
}
|
||||
|
||||
/** @docs-private */
|
||||
get shouldLabelFloat(): boolean {
|
||||
return !this.empty || this.focused;
|
||||
}
|
||||
@@ -315,7 +316,7 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
|
||||
* to facilitate the two-way binding for the `value` input.
|
||||
* @docs-private
|
||||
*/
|
||||
@Output() valueChange = new EventEmitter<any>();
|
||||
@Output() valueChange: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
/** The chip components contained within this chip list. */
|
||||
@ContentChildren(MatChip) chips: QueryList<MatChip>;
|
||||
@@ -389,7 +390,10 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
|
||||
this._chipInput = inputElement;
|
||||
}
|
||||
|
||||
// Implemented as part of MatFormFieldControl.
|
||||
/**
|
||||
* Implemented as part of MatFormFieldControl.
|
||||
* @docs-private
|
||||
*/
|
||||
setDescribedByIds(ids: string[]) { this._ariaDescribedby = ids.join(' '); }
|
||||
|
||||
// Implemented as part of ControlValueAccessor
|
||||
@@ -416,6 +420,7 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
|
||||
this.stateChanges.next();
|
||||
}
|
||||
|
||||
/** @docs-private */
|
||||
onContainerClick() {
|
||||
this.focus();
|
||||
}
|
||||
@@ -424,7 +429,7 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
|
||||
* Focuses the the first non-disabled chip in this chip list, or the associated input when there
|
||||
* are no eligible chips.
|
||||
*/
|
||||
focus() {
|
||||
focus(): void {
|
||||
// TODO: ARIA says this should focus the first `selected` chip if any are selected.
|
||||
// Focus on first element if there's no chipInput inside chip-list
|
||||
if (this._chipInput && this._chipInput.focused) {
|
||||
|
||||
@@ -151,7 +151,8 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
|
||||
_onBlur = new Subject<MatChipEvent>();
|
||||
|
||||
/** Emitted when the chip is selected or deselected. */
|
||||
@Output() selectionChange = new EventEmitter<MatChipSelectionChange>();
|
||||
@Output() selectionChange: EventEmitter<MatChipSelectionChange>
|
||||
= new EventEmitter<MatChipSelectionChange>();
|
||||
|
||||
/** Emitted when the chip is destroyed. */
|
||||
@Output() destroyed = new EventEmitter<MatChipEvent>();
|
||||
@@ -160,16 +161,16 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
|
||||
* Emitted when the chip is destroyed.
|
||||
* @deprecated Use 'destroyed' instead.
|
||||
*/
|
||||
@Output() destroy = this.destroyed;
|
||||
@Output() destroy: EventEmitter<MatChipEvent> = this.destroyed;
|
||||
|
||||
/** Emitted when a chip is to be removed. */
|
||||
@Output() removed = new EventEmitter<MatChipEvent>();
|
||||
@Output() removed: EventEmitter<MatChipEvent> = new EventEmitter<MatChipEvent>();
|
||||
|
||||
/**
|
||||
* Emitted when a chip is to be removed.
|
||||
* @deprecated Use `removed` instead.
|
||||
*/
|
||||
@Output('remove') onRemove = this.removed;
|
||||
@Output('remove') onRemove: EventEmitter<MatChipEvent> = this.removed;
|
||||
|
||||
get ariaSelected(): string | null {
|
||||
return this.selectable ? this.selected.toString() : null;
|
||||
|
||||
@@ -155,8 +155,8 @@ export class MatDatepickerInput<D> implements AfterContentInit, ControlValueAcce
|
||||
|
||||
/** Whether the datepicker-input is disabled. */
|
||||
@Input()
|
||||
get disabled() { return !!this._disabled; }
|
||||
set disabled(value: any) {
|
||||
get disabled(): boolean { return !!this._disabled; }
|
||||
set disabled(value: boolean) {
|
||||
const newValue = coerceBooleanProperty(value);
|
||||
|
||||
if (this._disabled !== newValue) {
|
||||
@@ -167,10 +167,12 @@ export class MatDatepickerInput<D> implements AfterContentInit, ControlValueAcce
|
||||
private _disabled: boolean;
|
||||
|
||||
/** Emits when a `change` event is fired on this `<input>`. */
|
||||
@Output() dateChange = new EventEmitter<MatDatepickerInputEvent<D>>();
|
||||
@Output() dateChange: EventEmitter<MatDatepickerInputEvent<D>>
|
||||
= new EventEmitter<MatDatepickerInputEvent<D>>();
|
||||
|
||||
/** Emits when an `input` event is fired on this `<input>`. */
|
||||
@Output() dateInput = new EventEmitter<MatDatepickerInputEvent<D>>();
|
||||
@Output() dateInput: EventEmitter<MatDatepickerInputEvent<D>>
|
||||
= new EventEmitter<MatDatepickerInputEvent<D>>();
|
||||
|
||||
/** Emits when the value changes (either due to user input or programmatic change). */
|
||||
_valueChange = new EventEmitter<D|null>();
|
||||
@@ -263,6 +265,7 @@ export class MatDatepickerInput<D> implements AfterContentInit, ControlValueAcce
|
||||
this._disabledChange.complete();
|
||||
}
|
||||
|
||||
/** @docs-private */
|
||||
registerOnValidatorChange(fn: () => void): void {
|
||||
this._validatorOnChange = fn;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ export class MatDatepicker<D> implements OnDestroy {
|
||||
* Emits new selected date when selected date changes.
|
||||
* @deprecated Switch to the `dateChange` and `dateInput` binding on the input element.
|
||||
*/
|
||||
@Output() selectedChanged = new EventEmitter<D>();
|
||||
@Output() selectedChanged: EventEmitter<D> = new EventEmitter<D>();
|
||||
|
||||
/** Classes to be passed to the date picker panel. Supports the same syntax as `ngClass`. */
|
||||
@Input() panelClass: string | string[];
|
||||
@@ -181,7 +181,7 @@ export class MatDatepicker<D> implements OnDestroy {
|
||||
private _opened = false;
|
||||
|
||||
/** The id for the datepicker calendar. */
|
||||
id = `mat-datepicker-${datepickerUid++}`;
|
||||
id: string = `mat-datepicker-${datepickerUid++}`;
|
||||
|
||||
/** The currently selected date. */
|
||||
get _selected(): D | null { return this._validSelected; }
|
||||
|
||||
@@ -31,7 +31,7 @@ export class MatDialogRef<T, R = any> {
|
||||
componentInstance: T;
|
||||
|
||||
/** Whether the user is allowed to close the dialog. */
|
||||
disableClose = this._containerInstance._config.disableClose;
|
||||
disableClose: boolean | undefined = this._containerInstance._config.disableClose;
|
||||
|
||||
/** Subject for notifying the user that the dialog has finished opening. */
|
||||
private _afterOpen = new Subject<void>();
|
||||
|
||||
@@ -27,11 +27,9 @@ import {matExpansionAnimations} from './expansion-animations';
|
||||
|
||||
|
||||
/**
|
||||
* <mat-expansion-panel-header> component.
|
||||
* <mat-expansion-panel-header>
|
||||
*
|
||||
* This component corresponds to the header element of an <mat-expansion-panel>.
|
||||
*
|
||||
* Please refer to README.md for examples on how to use it.
|
||||
*/
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
@@ -139,7 +137,7 @@ export class MatExpansionPanelHeader implements OnDestroy {
|
||||
}
|
||||
|
||||
/**
|
||||
* <mat-panel-description> directive.
|
||||
* <mat-panel-description>
|
||||
*
|
||||
* This direction is to be used inside of the MatExpansionPanelHeader component.
|
||||
*/
|
||||
@@ -152,7 +150,7 @@ export class MatExpansionPanelHeader implements OnDestroy {
|
||||
export class MatExpansionPanelDescription {}
|
||||
|
||||
/**
|
||||
* <mat-panel-title> directive.
|
||||
* <mat-panel-title>
|
||||
*
|
||||
* This direction is to be used inside of the MatExpansionPanelHeader component.
|
||||
*/
|
||||
|
||||
@@ -58,12 +58,10 @@ export const _MatExpansionPanelMixinBase = mixinDisabled(MatExpansionPanelBase);
|
||||
export type MatExpansionPanelState = 'expanded' | 'collapsed';
|
||||
|
||||
/**
|
||||
* <mat-expansion-panel> component.
|
||||
* <mat-expansion-panel>
|
||||
*
|
||||
* This component can be used as a single element to show expandable content, or as one of
|
||||
* multiple children of an element with the MatAccordion directive attached.
|
||||
*
|
||||
* Please refer to README.md for examples on how to use it.
|
||||
* multiple children of an element with the MdAccordion directive attached.
|
||||
*/
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
|
||||
@@ -96,8 +96,8 @@ export class MatFormField implements AfterViewInit, AfterContentInit, AfterConte
|
||||
|
||||
/** Whether the required marker should be hidden. */
|
||||
@Input()
|
||||
get hideRequiredMarker() { return this._hideRequiredMarker; }
|
||||
set hideRequiredMarker(value: any) {
|
||||
get hideRequiredMarker(): boolean { return this._hideRequiredMarker; }
|
||||
set hideRequiredMarker(value: boolean) {
|
||||
this._hideRequiredMarker = coerceBooleanProperty(value);
|
||||
}
|
||||
private _hideRequiredMarker: boolean;
|
||||
@@ -118,7 +118,7 @@ export class MatFormField implements AfterViewInit, AfterContentInit, AfterConte
|
||||
|
||||
/** Text for the form field hint. */
|
||||
@Input()
|
||||
get hintLabel() { return this._hintLabel; }
|
||||
get hintLabel(): string { return this._hintLabel; }
|
||||
set hintLabel(value: string) {
|
||||
this._hintLabel = value;
|
||||
this._processHints();
|
||||
@@ -133,12 +133,12 @@ export class MatFormField implements AfterViewInit, AfterContentInit, AfterConte
|
||||
* @deprecated Use floatLabel instead.
|
||||
*/
|
||||
@Input()
|
||||
get floatPlaceholder() { return this._floatLabel; }
|
||||
get floatPlaceholder(): FloatLabelType { return this._floatLabel; }
|
||||
set floatPlaceholder(value: FloatLabelType) { this.floatLabel = value; }
|
||||
|
||||
/** Whether the label should always float, never float or float as the user types. */
|
||||
@Input()
|
||||
get floatLabel() { return this._floatLabel; }
|
||||
get floatLabel(): FloatLabelType { return this._floatLabel; }
|
||||
set floatLabel(value: FloatLabelType) {
|
||||
if (value !== this._floatLabel) {
|
||||
this._floatLabel = value || this._labelOptions.float || 'auto';
|
||||
|
||||
@@ -72,13 +72,13 @@ export class MatGridList implements OnInit, AfterContentChecked {
|
||||
|
||||
/** Amount of columns in the grid list. */
|
||||
@Input()
|
||||
get cols() { return this._cols; }
|
||||
set cols(value: any) { this._cols = coerceToNumber(value); }
|
||||
get cols(): number { return this._cols; }
|
||||
set cols(value: number) { this._cols = coerceToNumber(value); }
|
||||
|
||||
/** Size of the grid list's gutter in pixels. */
|
||||
@Input()
|
||||
get gutterSize() { return this._gutter; }
|
||||
set gutterSize(value: any) { this._gutter = coerceToString(value); }
|
||||
get gutterSize(): string { return this._gutter; }
|
||||
set gutterSize(value: string) { this._gutter = coerceToString(value); }
|
||||
|
||||
/** Set internal representation of row height from the user-provided value. */
|
||||
@Input()
|
||||
|
||||
@@ -42,12 +42,12 @@ export class MatGridTile {
|
||||
/** Amount of rows that the grid tile takes up. */
|
||||
@Input()
|
||||
get rowspan(): number { return this._rowspan; }
|
||||
set rowspan(value) { this._rowspan = coerceToNumber(value); }
|
||||
set rowspan(value: number) { this._rowspan = coerceToNumber(value); }
|
||||
|
||||
/** Amount of columns that the grid tile takes up. */
|
||||
@Input()
|
||||
get colspan(): number { return this._colspan; }
|
||||
set colspan(value) { this._colspan = coerceToNumber(value); }
|
||||
set colspan(value: number) { this._colspan = coerceToNumber(value); }
|
||||
|
||||
/**
|
||||
* Sets the style of the grid-tile element. Needs to be set manually to avoid
|
||||
|
||||
@@ -45,15 +45,15 @@ export class MatTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
|
||||
|
||||
/** Minimum amount of rows in the textarea. */
|
||||
@Input('matAutosizeMinRows')
|
||||
get minRows() { return this._minRows; }
|
||||
set minRows(value: number) {
|
||||
this._minRows = value;
|
||||
this._setMinHeight();
|
||||
}
|
||||
get minRows(): number { return this._minRows; }
|
||||
|
||||
/** Maximum amount of rows in the textarea. */
|
||||
@Input('matAutosizeMaxRows')
|
||||
get maxRows() { return this._maxRows; }
|
||||
get maxRows(): number { return this._maxRows; }
|
||||
set maxRows(value: number) {
|
||||
this._maxRows = value;
|
||||
this._setMaxHeight();
|
||||
|
||||
+27
-13
@@ -107,8 +107,13 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
|
||||
|
||||
/** Whether the element is disabled. */
|
||||
@Input()
|
||||
get disabled() { return this.ngControl ? this.ngControl.disabled : this._disabled; }
|
||||
set disabled(value: any) {
|
||||
get disabled(): boolean {
|
||||
if (this.ngControl && this.ngControl.disabled !== null) {
|
||||
return this.ngControl.disabled;
|
||||
}
|
||||
return this._disabled;
|
||||
}
|
||||
set disabled(value: boolean) {
|
||||
this._disabled = coerceBooleanProperty(value);
|
||||
|
||||
// Browsers may not fire the blur event if the input is disabled too quickly.
|
||||
@@ -121,7 +126,7 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
|
||||
|
||||
/** Unique id of the element. */
|
||||
@Input()
|
||||
get id() { return this._id; }
|
||||
get id(): string { return this._id; }
|
||||
set id(value: string) { this._id = value || this._uid; }
|
||||
|
||||
/** Placeholder attribute of the element. */
|
||||
@@ -129,12 +134,12 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
|
||||
|
||||
/** Whether the element is required. */
|
||||
@Input()
|
||||
get required() { return this._required; }
|
||||
set required(value: any) { this._required = coerceBooleanProperty(value); }
|
||||
get required(): boolean { return this._required; }
|
||||
set required(value: boolean) { this._required = coerceBooleanProperty(value); }
|
||||
|
||||
/** Input type of the element. */
|
||||
@Input()
|
||||
get type() { return this._type; }
|
||||
get type(): string { return this._type; }
|
||||
set type(value: string) {
|
||||
this._type = value || 'text';
|
||||
this._validateType();
|
||||
@@ -152,8 +157,8 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
|
||||
|
||||
/** The input element's value. */
|
||||
@Input()
|
||||
get value(): any { return this._inputValueAccessor.value; }
|
||||
set value(value: any) {
|
||||
get value(): string { return this._inputValueAccessor.value; }
|
||||
set value(value: string) {
|
||||
if (value !== this.value) {
|
||||
this._inputValueAccessor.value = value;
|
||||
this.stateChanges.next();
|
||||
@@ -162,8 +167,8 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
|
||||
|
||||
/** Whether the element is readonly. */
|
||||
@Input()
|
||||
get readonly() { return this._readonly; }
|
||||
set readonly(value: any) { this._readonly = coerceBooleanProperty(value); }
|
||||
get readonly(): boolean { return this._readonly; }
|
||||
set readonly(value: boolean) { this._readonly = coerceBooleanProperty(value); }
|
||||
|
||||
protected _neverEmptyInputTypes = [
|
||||
'date',
|
||||
@@ -296,12 +301,21 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
|
||||
return !this._isNeverEmpty() && !this._elementRef.nativeElement.value && !this._isBadInput();
|
||||
}
|
||||
|
||||
// Implemented as part of MatFormFieldControl.
|
||||
/**
|
||||
* Implemented as part of MatFormFieldControl.
|
||||
* @docs-private
|
||||
*/
|
||||
get shouldLabelFloat(): boolean { return this.focused || !this.empty; }
|
||||
|
||||
// Implemented as part of MatFormFieldControl.
|
||||
/**
|
||||
* Implemented as part of MatFormFieldControl.
|
||||
* @docs-private
|
||||
*/
|
||||
setDescribedByIds(ids: string[]) { this._ariaDescribedby = ids.join(' '); }
|
||||
|
||||
// Implemented as part of MatFormFieldControl.
|
||||
/**
|
||||
* Implemented as part of MatFormFieldControl.
|
||||
* @docs-private
|
||||
*/
|
||||
onContainerClick() { this.focus(); }
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ export class MatMenu implements AfterContentInit, MatMenuPanel, OnDestroy {
|
||||
|
||||
/** Position of the menu in the X axis. */
|
||||
@Input()
|
||||
get xPosition() { return this._xPosition; }
|
||||
get xPosition(): MenuPositionX { return this._xPosition; }
|
||||
set xPosition(value: MenuPositionX) {
|
||||
if (value !== 'before' && value !== 'after') {
|
||||
throwMatMenuInvalidPositionX();
|
||||
@@ -113,7 +113,7 @@ export class MatMenu implements AfterContentInit, MatMenuPanel, OnDestroy {
|
||||
|
||||
/** Position of the menu in the Y axis. */
|
||||
@Input()
|
||||
get yPosition() { return this._yPosition; }
|
||||
get yPosition(): MenuPositionY { return this._yPosition; }
|
||||
set yPosition(value: MenuPositionY) {
|
||||
if (value !== 'above' && value !== 'below') {
|
||||
throwMatMenuInvalidPositionY();
|
||||
@@ -168,7 +168,8 @@ export class MatMenu implements AfterContentInit, MatMenuPanel, OnDestroy {
|
||||
get classList(): string { return this.panelClass; }
|
||||
|
||||
/** Event emitted when the menu is closed. */
|
||||
@Output() closed = new EventEmitter<void | 'click' | 'keydown'>();
|
||||
@Output() closed: EventEmitter<void | 'click' | 'keydown'>
|
||||
= new EventEmitter<void | 'click' | 'keydown'>();
|
||||
|
||||
/**
|
||||
* Event emitted when the menu is closed.
|
||||
@@ -231,7 +232,7 @@ export class MatMenu implements AfterContentInit, MatMenuPanel, OnDestroy {
|
||||
* Focus the first item in the menu. This method is used by the menu trigger
|
||||
* to focus the first item when the menu is opened by the ENTER key.
|
||||
*/
|
||||
focusFirstItem() {
|
||||
focusFirstItem(): void {
|
||||
this._keyManager.setFirstItemActive();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ export class MatMenuItem extends _MatMenuItemMixinBase
|
||||
implements FocusableOption, CanDisable, CanDisableRipple, OnDestroy {
|
||||
|
||||
/** Stream that emits when the menu item is hovered. */
|
||||
_hovered: Subject<MatMenuItem> = new Subject();
|
||||
_hovered: Subject<MatMenuItem> = new Subject<MatMenuItem>();
|
||||
|
||||
/** Whether the menu item is highlighted. */
|
||||
_highlighted: boolean = false;
|
||||
|
||||
@@ -107,22 +107,22 @@ export class MatMenuTrigger implements AfterContentInit, OnDestroy {
|
||||
@Input('matMenuTriggerFor') menu: MatMenuPanel;
|
||||
|
||||
/** Event emitted when the associated menu is opened. */
|
||||
@Output() menuOpened = new EventEmitter<void>();
|
||||
@Output() menuOpened: EventEmitter<void> = new EventEmitter<void>();
|
||||
|
||||
/**
|
||||
* Event emitted when the associated menu is opened.
|
||||
* @deprecated Switch to `menuOpened` instead
|
||||
*/
|
||||
@Output() onMenuOpen = this.menuOpened;
|
||||
@Output() onMenuOpen: EventEmitter<void> = this.menuOpened;
|
||||
|
||||
/** Event emitted when the associated menu is closed. */
|
||||
@Output() menuClosed = new EventEmitter<void>();
|
||||
@Output() menuClosed: EventEmitter<void> = new EventEmitter<void>();
|
||||
|
||||
/**
|
||||
* Event emitted when the associated menu is closed.
|
||||
* @deprecated Switch to `menuClosed` instead
|
||||
*/
|
||||
@Output() onMenuClose = this.menuClosed;
|
||||
@Output() onMenuClose: EventEmitter<void> = this.menuClosed;
|
||||
|
||||
constructor(private _overlay: Overlay,
|
||||
private _element: ElementRef,
|
||||
|
||||
@@ -22,13 +22,13 @@ export class MatPaginatorIntl {
|
||||
changes: Subject<void> = new Subject<void>();
|
||||
|
||||
/** A label for the page size selector. */
|
||||
itemsPerPageLabel = 'Items per page:';
|
||||
itemsPerPageLabel: string = 'Items per page:';
|
||||
|
||||
/** A label for the button that increments the current page. */
|
||||
nextPageLabel = 'Next page';
|
||||
nextPageLabel: string = 'Next page';
|
||||
|
||||
/** A label for the button that decrements the current page. */
|
||||
previousPageLabel = 'Previous page';
|
||||
previousPageLabel: string = 'Previous page';
|
||||
|
||||
/** A label for the range of items within the current page and the length of the whole list. */
|
||||
getRangeLabel = (page: number, pageSize: number, length: number) => {
|
||||
|
||||
@@ -118,26 +118,26 @@ export class MatPaginator implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
/** Advances to the next page if it exists. */
|
||||
nextPage() {
|
||||
nextPage(): void {
|
||||
if (!this.hasNextPage()) { return; }
|
||||
this.pageIndex++;
|
||||
this._emitPageEvent();
|
||||
}
|
||||
|
||||
/** Move back to the previous page if it exists. */
|
||||
previousPage() {
|
||||
previousPage(): void {
|
||||
if (!this.hasPreviousPage()) { return; }
|
||||
this.pageIndex--;
|
||||
this._emitPageEvent();
|
||||
}
|
||||
|
||||
/** Whether there is a previous page. */
|
||||
hasPreviousPage() {
|
||||
hasPreviousPage(): boolean {
|
||||
return this.pageIndex >= 1 && this.pageSize != 0;
|
||||
}
|
||||
|
||||
/** Whether there is a next page. */
|
||||
hasNextPage() {
|
||||
hasNextPage(): boolean {
|
||||
const numberOfPages = Math.ceil(this.length / this.pageSize) - 1;
|
||||
return this.pageIndex < numberOfPages && this.pageSize != 0;
|
||||
}
|
||||
|
||||
@@ -44,14 +44,14 @@ export class MatProgressBar {
|
||||
|
||||
/** Value of the progressbar. Defaults to zero. Mirrored to aria-valuenow. */
|
||||
@Input()
|
||||
get value() { return this._value; }
|
||||
get value(): number { return this._value; }
|
||||
set value(v: number) { this._value = clamp(v || 0); }
|
||||
|
||||
private _bufferValue: number = 0;
|
||||
|
||||
/** Buffer value of the progress bar. Defaults to zero. */
|
||||
@Input()
|
||||
get bufferValue() { return this._bufferValue; }
|
||||
get bufferValue(): number { return this._bufferValue; }
|
||||
set bufferValue(v: number) { this._bufferValue = clamp(v || 0); }
|
||||
|
||||
/**
|
||||
|
||||
+19
-10
@@ -326,7 +326,7 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
|
||||
|
||||
/** Placeholder to be shown if no value has been selected. */
|
||||
@Input()
|
||||
get placeholder() { return this._placeholder; }
|
||||
get placeholder(): string { return this._placeholder; }
|
||||
set placeholder(value: string) {
|
||||
this._placeholder = value;
|
||||
this.stateChanges.next();
|
||||
@@ -334,8 +334,8 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
|
||||
|
||||
/** Whether the component is required. */
|
||||
@Input()
|
||||
get required() { return this._required; }
|
||||
set required(value: any) {
|
||||
get required(): boolean { return this._required; }
|
||||
set required(value: boolean) {
|
||||
this._required = coerceBooleanProperty(value);
|
||||
this.stateChanges.next();
|
||||
}
|
||||
@@ -371,7 +371,7 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
|
||||
|
||||
/** Value of the select control. */
|
||||
@Input()
|
||||
get value() { return this._value; }
|
||||
get value(): any { return this._value; }
|
||||
set value(newValue: any) {
|
||||
if (newValue !== this._value) {
|
||||
this.writeValue(newValue);
|
||||
@@ -391,7 +391,7 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
|
||||
|
||||
/** Unique id of the element. */
|
||||
@Input()
|
||||
get id() { return this._id; }
|
||||
get id(): string { return this._id; }
|
||||
set id(value: string) {
|
||||
this._id = value || this._uid;
|
||||
this.stateChanges.next();
|
||||
@@ -450,7 +450,7 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
|
||||
* to facilitate the two-way binding for the `value` input.
|
||||
* @docs-private
|
||||
*/
|
||||
@Output() valueChange = new EventEmitter<any>();
|
||||
@Output() valueChange: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
constructor(
|
||||
private _viewportRuler: ViewportRuler,
|
||||
@@ -1201,19 +1201,28 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
|
||||
return this._triggerFontSize * SELECT_ITEM_HEIGHT_EM;
|
||||
}
|
||||
|
||||
// Implemented as part of MatFormFieldControl.
|
||||
/**
|
||||
* Implemented as part of MatFormFieldControl.
|
||||
* @docs-private
|
||||
*/
|
||||
setDescribedByIds(ids: string[]) {
|
||||
this._ariaDescribedby = ids.join(' ');
|
||||
}
|
||||
|
||||
// Implemented as part of MatFormFieldControl.
|
||||
/**
|
||||
* Implemented as part of MatFormFieldControl.
|
||||
* @docs-private
|
||||
*/
|
||||
onContainerClick() {
|
||||
this.focus();
|
||||
this.open();
|
||||
}
|
||||
|
||||
// Implemented as part of MatFormFieldControl.
|
||||
get shouldLabelFloat(): boolean {
|
||||
/**
|
||||
* Implemented as part of MatFormFieldControl.
|
||||
* @docs-private
|
||||
*/
|
||||
get shouldPlaceholderFloat(): boolean {
|
||||
return this._panelOpen || !this.empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ export class MatDrawer implements AfterContentInit, AfterContentChecked, OnDestr
|
||||
/** The side that the drawer is attached to. */
|
||||
@Input()
|
||||
get position(): 'start' | 'end' { return this._position; }
|
||||
set position(value) {
|
||||
set position(value: 'start' | 'end') {
|
||||
// Make sure we have a valid value.
|
||||
value = value === 'end' ? 'end' : 'start';
|
||||
if (value != this._position) {
|
||||
@@ -153,12 +153,12 @@ export class MatDrawer implements AfterContentInit, AfterContentChecked, OnDestr
|
||||
/** @deprecated */
|
||||
@Input()
|
||||
get align(): 'start' | 'end' { return this.position; }
|
||||
set align(value) { this.position = value; }
|
||||
set align(value: 'start' | 'end') { this.position = value; }
|
||||
|
||||
/** Mode of the drawer; one of 'over', 'push' or 'side'. */
|
||||
@Input()
|
||||
get mode(): 'over' | 'push' | 'side' { return this._mode; }
|
||||
set mode(value) {
|
||||
set mode(value: 'over' | 'push' | 'side') {
|
||||
this._mode = value;
|
||||
this._modeChanged.next();
|
||||
}
|
||||
@@ -221,19 +221,19 @@ export class MatDrawer implements AfterContentInit, AfterContentChecked, OnDestr
|
||||
* Event emitted when the drawer is fully opened.
|
||||
* @deprecated Use `opened` instead.
|
||||
*/
|
||||
@Output('open') onOpen = this._openedStream;
|
||||
@Output('open') onOpen: Observable<void> = this._openedStream;
|
||||
|
||||
/**
|
||||
* Event emitted when the drawer is fully closed.
|
||||
* @deprecated Use `closed` instead.
|
||||
*/
|
||||
@Output('close') onClose = this._closedStream;
|
||||
@Output('close') onClose: Observable<void> = this._closedStream;
|
||||
|
||||
/** Event emitted when the drawer's position changes. */
|
||||
@Output('positionChanged') onPositionChanged = new EventEmitter<void>();
|
||||
@Output('positionChanged') onPositionChanged: EventEmitter<void> = new EventEmitter<void>();
|
||||
|
||||
/** @deprecated */
|
||||
@Output('align-changed') onAlignChanged = new EventEmitter<void>();
|
||||
@Output('align-changed') onAlignChanged: EventEmitter<void> = new EventEmitter<void>();
|
||||
|
||||
/**
|
||||
* An observable that emits when the drawer mode changes. This is used by the drawer container to
|
||||
|
||||
@@ -221,12 +221,12 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro
|
||||
}
|
||||
|
||||
/** Focuses the slide-toggle. */
|
||||
focus() {
|
||||
focus(): void {
|
||||
this._focusMonitor.focusVia(this._inputElement.nativeElement, 'keyboard');
|
||||
}
|
||||
|
||||
/** Toggles the checked state of the slide-toggle. */
|
||||
toggle() {
|
||||
toggle(): void {
|
||||
this.checked = !this.checked;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ class SlideToggleRenderer {
|
||||
}
|
||||
|
||||
/** Initializes the drag of the slide-toggle. */
|
||||
startThumbDrag(checked: boolean) {
|
||||
startThumbDrag(checked: boolean): void {
|
||||
if (this.dragging) { return; }
|
||||
|
||||
this._thumbBarWidth = this._thumbBarEl.clientWidth - this._thumbEl.clientWidth;
|
||||
@@ -350,7 +350,7 @@ class SlideToggleRenderer {
|
||||
}
|
||||
|
||||
/** Updates the thumb containers position from the specified distance. */
|
||||
updateThumbPosition(distance: number) {
|
||||
updateThumbPosition(distance: number): void {
|
||||
this.dragPercentage = this._getDragPercentage(distance);
|
||||
// Calculate the moved distance based on the thumb bar width.
|
||||
let dragX = (this.dragPercentage / 100) * this._thumbBarWidth;
|
||||
|
||||
+11
-11
@@ -138,15 +138,15 @@ export class MatSlider extends _MatSliderMixinBase
|
||||
implements ControlValueAccessor, OnDestroy, CanDisable, CanColor, OnInit, HasTabIndex {
|
||||
/** Whether the slider is inverted. */
|
||||
@Input()
|
||||
get invert() { return this._invert; }
|
||||
set invert(value: any) {
|
||||
get invert(): boolean { return this._invert; }
|
||||
set invert(value: boolean) {
|
||||
this._invert = coerceBooleanProperty(value);
|
||||
}
|
||||
private _invert = false;
|
||||
|
||||
/** The maximum value that the slider can have. */
|
||||
@Input()
|
||||
get max() { return this._max; }
|
||||
get max(): number { return this._max; }
|
||||
set max(v: number) {
|
||||
this._max = coerceNumberProperty(v, this._max);
|
||||
this._percent = this._calculatePercentage(this._value);
|
||||
@@ -158,7 +158,7 @@ export class MatSlider extends _MatSliderMixinBase
|
||||
|
||||
/** The minimum value that the slider can have. */
|
||||
@Input()
|
||||
get min() { return this._min; }
|
||||
get min(): number { return this._min; }
|
||||
set min(v: number) {
|
||||
this._min = coerceNumberProperty(v, this._min);
|
||||
|
||||
@@ -175,7 +175,7 @@ export class MatSlider extends _MatSliderMixinBase
|
||||
|
||||
/** The values at which the thumb will snap. */
|
||||
@Input()
|
||||
get step() { return this._step; }
|
||||
get step(): number { return this._step; }
|
||||
set step(v: number) {
|
||||
this._step = coerceNumberProperty(v, this._step);
|
||||
|
||||
@@ -191,7 +191,7 @@ export class MatSlider extends _MatSliderMixinBase
|
||||
/** Whether or not to show the thumb label. */
|
||||
@Input()
|
||||
get thumbLabel(): boolean { return this._thumbLabel; }
|
||||
set thumbLabel(value) { this._thumbLabel = coerceBooleanProperty(value); }
|
||||
set thumbLabel(value: boolean) { this._thumbLabel = coerceBooleanProperty(value); }
|
||||
private _thumbLabel: boolean = false;
|
||||
|
||||
/** @deprecated */
|
||||
@@ -223,7 +223,7 @@ export class MatSlider extends _MatSliderMixinBase
|
||||
|
||||
/** Value of the slider. */
|
||||
@Input()
|
||||
get value() {
|
||||
get value(): number | null {
|
||||
// If the value needs to be read and it is still uninitialized, initialize it to the min.
|
||||
if (this._value === null) {
|
||||
this.value = this._min;
|
||||
@@ -243,17 +243,17 @@ export class MatSlider extends _MatSliderMixinBase
|
||||
|
||||
/** Whether the slider is vertical. */
|
||||
@Input()
|
||||
get vertical() { return this._vertical; }
|
||||
set vertical(value: any) {
|
||||
get vertical(): boolean { return this._vertical; }
|
||||
set vertical(value: boolean) {
|
||||
this._vertical = coerceBooleanProperty(value);
|
||||
}
|
||||
private _vertical = false;
|
||||
|
||||
/** Event emitted when the slider value has changed. */
|
||||
@Output() change = new EventEmitter<MatSliderChange>();
|
||||
@Output() change: EventEmitter<MatSliderChange> = new EventEmitter<MatSliderChange>();
|
||||
|
||||
/** Event emitted when the slider thumb moves. */
|
||||
@Output() input = new EventEmitter<MatSliderChange>();
|
||||
@Output() input: EventEmitter<MatSliderChange> = new EventEmitter<MatSliderChange>();
|
||||
|
||||
/** The value to be used for display purposes. */
|
||||
get displayValue(): string | number {
|
||||
|
||||
@@ -89,18 +89,18 @@ export class MatSort extends _MatSortMixinBase implements CanDisable, OnChanges,
|
||||
* May be overriden by the MatSortable's disable clear input.
|
||||
*/
|
||||
@Input('matSortDisableClear')
|
||||
get disableClear() { return this._disableClear; }
|
||||
get disableClear(): boolean { return this._disableClear; }
|
||||
set disableClear(v: boolean) { this._disableClear = coerceBooleanProperty(v); }
|
||||
private _disableClear: boolean;
|
||||
|
||||
/** Event emitted when the user changes either the active sort or sort direction. */
|
||||
@Output('matSortChange') readonly sortChange = new EventEmitter<Sort>();
|
||||
@Output('matSortChange') readonly sortChange: EventEmitter<Sort> = new EventEmitter<Sort>();
|
||||
|
||||
/**
|
||||
* Register function to be used by the contained MatSortables. Adds the MatSortable to the
|
||||
* collection of MatSortables.
|
||||
*/
|
||||
register(sortable: MatSortable) {
|
||||
register(sortable: MatSortable): void {
|
||||
if (!sortable.id) {
|
||||
throw getSortHeaderMissingIdError();
|
||||
}
|
||||
@@ -115,12 +115,12 @@ export class MatSort extends _MatSortMixinBase implements CanDisable, OnChanges,
|
||||
* Unregister function to be used by the contained MatSortables. Removes the MatSortable from the
|
||||
* collection of contained MatSortables.
|
||||
*/
|
||||
deregister(sortable: MatSortable) {
|
||||
deregister(sortable: MatSortable): void {
|
||||
this.sortables.delete(sortable.id);
|
||||
}
|
||||
|
||||
/** Sets the active sort id and determines the new sort direction. */
|
||||
sort(sortable: MatSortable) {
|
||||
sort(sortable: MatSortable): void {
|
||||
if (this.active != sortable.id) {
|
||||
this.active = sortable.id;
|
||||
this.direction = sortable.start ? sortable.start : this.start;
|
||||
|
||||
@@ -46,32 +46,32 @@ export class MatStepHeader implements OnDestroy {
|
||||
|
||||
/** Index of the given step. */
|
||||
@Input()
|
||||
get index() { return this._index; }
|
||||
set index(value: any) {
|
||||
get index(): number { return this._index; }
|
||||
set index(value: number) {
|
||||
this._index = coerceNumberProperty(value);
|
||||
}
|
||||
private _index: number;
|
||||
|
||||
/** Whether the given step is selected. */
|
||||
@Input()
|
||||
get selected() { return this._selected; }
|
||||
set selected(value: any) {
|
||||
get selected(): boolean { return this._selected; }
|
||||
set selected(value: boolean) {
|
||||
this._selected = coerceBooleanProperty(value);
|
||||
}
|
||||
private _selected: boolean;
|
||||
|
||||
/** Whether the given step label is active. */
|
||||
@Input()
|
||||
get active() { return this._active; }
|
||||
set active(value: any) {
|
||||
get active(): boolean { return this._active; }
|
||||
set active(value: boolean) {
|
||||
this._active = coerceBooleanProperty(value);
|
||||
}
|
||||
private _active: boolean;
|
||||
|
||||
/** Whether the given step is optional. */
|
||||
@Input()
|
||||
get optional() { return this._optional; }
|
||||
set optional(value: any) {
|
||||
get optional(): boolean { return this._optional; }
|
||||
set optional(value: boolean) {
|
||||
this._optional = coerceBooleanProperty(value);
|
||||
}
|
||||
private _optional: boolean;
|
||||
|
||||
@@ -20,5 +20,5 @@ export class MatStepperIntl {
|
||||
changes: Subject<void> = new Subject<void>();
|
||||
|
||||
/** Label that is rendered below optional steps. */
|
||||
optionalLabel = 'Optional';
|
||||
optionalLabel: string = 'Optional';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user