From efd1be2ea401b7c30901d11c4df21108d6643fe3 Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Fri, 27 May 2016 10:04:23 -0700 Subject: [PATCH] fix: remove @internal where it would make tsc fail (#538) --- src/components/checkbox/checkbox.ts | 44 +++++++++++-------- src/components/grid-list/grid-list.ts | 4 +- src/components/icon/icon.ts | 6 +-- src/components/input/input.ts | 19 +++++--- src/components/list/list.ts | 2 +- src/components/radio/radio.ts | 10 ++--- src/components/sidenav/sidenav.ts | 2 +- src/components/slide-toggle/slide-toggle.ts | 6 +-- src/components/tabs/tabs.ts | 2 +- src/core/overlay/overlay-directives.ts | 4 +- .../position/connected-position-strategy.ts | 8 +--- .../position/global-position-strategy.ts | 2 +- src/core/overlay/position/viewport-ruler.ts | 2 +- 13 files changed, 61 insertions(+), 50 deletions(-) diff --git a/src/components/checkbox/checkbox.ts b/src/components/checkbox/checkbox.ts index 4754b99ec617..70ef9bf07780 100644 --- a/src/components/checkbox/checkbox.ts +++ b/src/components/checkbox/checkbox.ts @@ -1,19 +1,17 @@ import { - ChangeDetectionStrategy, - Component, - ElementRef, - EventEmitter, - Input, - Output, - Provider, - Renderer, - ViewEncapsulation, - forwardRef, + ChangeDetectionStrategy, + Component, + ElementRef, + EventEmitter, + Input, + Output, + Provider, + Renderer, + ViewEncapsulation, + forwardRef, + AfterContentInit } from '@angular/core'; -import { - NG_VALUE_ACCESSOR, - ControlValueAccessor, -} from '@angular/common'; +import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/common'; /** * Monotonically increasing integer used to auto-generate unique ids for checkbox components. @@ -68,7 +66,7 @@ enum TransitionCheckState { encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush }) -export class MdCheckbox implements ControlValueAccessor { +export class MdCheckbox implements AfterContentInit, ControlValueAccessor { /** * Attached to the aria-label attribute of the host element. In most cases, arial-labelledby will * take precedence so this may be omitted. @@ -151,6 +149,7 @@ export class MdCheckbox implements ControlValueAccessor { } } + /** TODO: internal */ ngAfterContentInit() { this._isInitialized = true; } @@ -178,12 +177,18 @@ export class MdCheckbox implements ControlValueAccessor { } } - /** Implemented as part of ControlValueAccessor. */ + /** + * Implemented as part of ControlValueAccessor. + * TODO: internal + */ writeValue(value: any) { this.checked = !!value; } - /** Implemented as part of ControlValueAccessor. */ + /** + * Implemented as part of ControlValueAccessor. + * TODO: internal + */ registerOnChange(fn: any) { if (this._changeSubscription) { this._changeSubscription.unsubscribe(); @@ -191,7 +196,10 @@ export class MdCheckbox implements ControlValueAccessor { this._changeSubscription = <{unsubscribe: () => any}>this.change.subscribe(fn); } - /** Implemented as part of ControlValueAccessor. */ + /** + * Implemented as part of ControlValueAccessor. + * TODO: internal + */ registerOnTouched(fn: any) { this.onTouched = fn; } diff --git a/src/components/grid-list/grid-list.ts b/src/components/grid-list/grid-list.ts index 306eae0442fb..cecf34e6a050 100644 --- a/src/components/grid-list/grid-list.ts +++ b/src/components/grid-list/grid-list.ts @@ -85,7 +85,7 @@ export class MdGridList implements OnInit, AfterContentChecked { this._setTileStyler(); } - /** @internal */ + /** TODO: internal */ ngOnInit() { this._checkCols(); this._checkRowHeight(); @@ -94,7 +94,7 @@ export class MdGridList implements OnInit, AfterContentChecked { /** * The layout calculation is fairly cheap if nothing changes, so there's little cost * to run it frequently. - * @internal + * TODO: internal */ ngAfterContentChecked() { this._layoutTiles(); diff --git a/src/components/icon/icon.ts b/src/components/icon/icon.ts index 1a2e7ab8705e..fcb867ff1c7a 100644 --- a/src/components/icon/icon.ts +++ b/src/components/icon/icon.ts @@ -112,7 +112,7 @@ export class MdIcon implements OnChanges, OnInit, AfterViewChecked { } } - /** @internal */ + /** TODO: internal */ ngOnChanges(changes: { [propertyName: string]: SimpleChange }) { const changedInputs = Object.keys(changes); // Only update the inline SVG icon if the inputs changed, to avoid unnecessary DOM operations. @@ -134,7 +134,7 @@ export class MdIcon implements OnChanges, OnInit, AfterViewChecked { this._updateAriaLabel(); } - /** @internal */ + /** TODO: internal */ ngOnInit() { // Update font classes because ngOnChanges won't be called if none of the inputs are present, // e.g. arrow. In this case we need to add a CSS class for the default font. @@ -143,7 +143,7 @@ export class MdIcon implements OnChanges, OnInit, AfterViewChecked { } } - /** @internal */ + /** TODO: internal */ ngAfterViewChecked() { // Update aria label here because it may depend on the projected text content. // (e.g. home should use 'home'). diff --git a/src/components/input/input.ts b/src/components/input/input.ts index 71daa4cd424b..5fedec0fb5e8 100644 --- a/src/components/input/input.ts +++ b/src/components/input/input.ts @@ -216,22 +216,31 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange return !!this.placeholder || this._placeholderChild != null; } - /** Implemented as part of ControlValueAccessor. */ + /** + * Implemented as part of ControlValueAccessor. + * TODO: internal + */ writeValue(value: any) { this._value = value; } - /** Implemented as part of ControlValueAccessor. */ + /** + * Implemented as part of ControlValueAccessor. + * TODO: internal + */ registerOnChange(fn: any) { this._onChangeCallback = fn; } - /** Implemented as part of ControlValueAccessor. */ + /** + * Implemented as part of ControlValueAccessor. + * TODO: internal + */ registerOnTouched(fn: any) { this._onTouchedCallback = fn; } - /** @internal */ + /** TODO: internal */ ngAfterContentInit() { this._validateConstraints(); @@ -241,7 +250,7 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange }); } - /** @internal */ + /** TODO: internal */ ngOnChanges(changes: {[key: string]: SimpleChange}) { this._validateConstraints(); } diff --git a/src/components/list/list.ts b/src/components/list/list.ts index 38ac62c4cb64..face45060bf8 100644 --- a/src/components/list/list.ts +++ b/src/components/list/list.ts @@ -47,7 +47,7 @@ export class MdListItem implements AfterContentInit { /** @internal */ hasFocus: boolean = false; - /** @internal */ + /** TODO: internal */ ngAfterContentInit() { this._setLineClass(this._lines.length); diff --git a/src/components/radio/radio.ts b/src/components/radio/radio.ts index 7ca5fe887a2c..5207087f2fda 100644 --- a/src/components/radio/radio.ts +++ b/src/components/radio/radio.ts @@ -150,7 +150,7 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor { /** * Initialize properties once content children are available. * This allows us to propagate relevant attributes to associated buttons. - * @internal + * TODO: internal */ ngAfterContentInit() { // Mark this component as initialized in AfterContentInit because the initial value can @@ -204,7 +204,7 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor { /** * Implemented as part of ControlValueAccessor. - * @internal + * TODO: internal */ writeValue(value: any) { this.value = value; @@ -212,7 +212,7 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor { /** * Implemented as part of ControlValueAccessor. - * @internal + * TODO: internal */ registerOnChange(fn: (value: any) => void) { this._controlValueAccessorChangeFn = fn; @@ -220,7 +220,7 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor { /** * Implemented as part of ControlValueAccessor. - * @internal + * TODO: internal */ registerOnTouched(fn: any) { this.onTouched = fn; @@ -333,7 +333,7 @@ export class MdRadioButton implements OnInit { this._disabled = (value != null && value !== false) ? true : null; } - /** @internal */ + /** TODO: internal */ ngOnInit() { if (this.radioGroup) { // If the radio is inside a radio group, determine if it should be checked diff --git a/src/components/sidenav/sidenav.ts b/src/components/sidenav/sidenav.ts index a10d1290b80a..db2a9dc35223 100644 --- a/src/components/sidenav/sidenav.ts +++ b/src/components/sidenav/sidenav.ts @@ -266,7 +266,7 @@ export class MdSidenavLayout implements AfterContentInit { } } - /** @internal */ + /** TODO: internal */ ngAfterContentInit() { // On changes, assert on consistency. this._sidenavs.changes.subscribe(() => this._validateDrawers()); diff --git a/src/components/slide-toggle/slide-toggle.ts b/src/components/slide-toggle/slide-toggle.ts index df1684231312..41f9c2875422 100644 --- a/src/components/slide-toggle/slide-toggle.ts +++ b/src/components/slide-toggle/slide-toggle.ts @@ -108,7 +108,7 @@ export class MdSlideToggle implements ControlValueAccessor { /** * Implemented as part of ControlValueAccessor. - * @internal + * TODO: internal */ writeValue(value: any): void { this.checked = value; @@ -116,7 +116,7 @@ export class MdSlideToggle implements ControlValueAccessor { /** * Implemented as part of ControlValueAccessor. - * @internal + * TODO: internal */ registerOnChange(fn: any): void { this.onChange = fn; @@ -124,7 +124,7 @@ export class MdSlideToggle implements ControlValueAccessor { /** * Implemented as part of ControlValueAccessor. - * @internal + * TODO: internal */ registerOnTouched(fn: any): void { this.onTouched = fn; diff --git a/src/components/tabs/tabs.ts b/src/components/tabs/tabs.ts index a630d3502433..fd73ca73b019 100644 --- a/src/components/tabs/tabs.ts +++ b/src/components/tabs/tabs.ts @@ -44,7 +44,7 @@ export class MdTabGroup { /** * Waits one frame for the view to update, then upates the ink bar * Note: This must be run outside of the zone or it will create an infinite change detection loop - * @internal + * TODO: internal */ ngAfterViewChecked(): void { this._zone.runOutsideAngular(() => { diff --git a/src/core/overlay/overlay-directives.ts b/src/core/overlay/overlay-directives.ts index 00e0d8d423b8..7f33576aa55a 100644 --- a/src/core/overlay/overlay-directives.ts +++ b/src/core/overlay/overlay-directives.ts @@ -50,12 +50,12 @@ export class ConnectedOverlayDirective implements OnInit, OnDestroy { return this._overlayRef; } - /** @internal */ + /** TODO: internal */ ngOnInit() { this._createOverlay(); } - /** @internal */ + /** TODO: internal */ ngOnDestroy() { this._destroyOverlay(); } diff --git a/src/core/overlay/position/connected-position-strategy.ts b/src/core/overlay/position/connected-position-strategy.ts index 8f6733d9f86e..52bf421f18ba 100644 --- a/src/core/overlay/position/connected-position-strategy.ts +++ b/src/core/overlay/position/connected-position-strategy.ts @@ -44,7 +44,7 @@ export class ConnectedPositionStrategy implements PositionStrategy { /** * Updates the position of the overlay element, using whichever preferred position relative * to the origin fits on-screen. - * @internal + * TODO: internal */ apply(element: HTMLElement): Promise { // We need the bounding rects for the origin and the overlay to determine how to position @@ -78,12 +78,6 @@ export class ConnectedPositionStrategy implements PositionStrategy { return Promise.resolve(); } - - /** Adds a preferred position to the end of the ordered preferred position list. */ - addPreferredPosition(pos: ConnectionPositionPair): void { - this._preferredPositions.push(pos); - } - withFallbackPosition( originPos: OriginConnectionPosition, overlayPos: OverlayConnectionPosition): this { diff --git a/src/core/overlay/position/global-position-strategy.ts b/src/core/overlay/position/global-position-strategy.ts index f7413a3865f8..a5ed7cda84d6 100644 --- a/src/core/overlay/position/global-position-strategy.ts +++ b/src/core/overlay/position/global-position-strategy.ts @@ -87,7 +87,7 @@ export class GlobalPositionStrategy implements PositionStrategy { /** * Apply the position to the element. - * @internal + * TODO: internal */ apply(element: HTMLElement): Promise { element.style.position = this._cssPosition; diff --git a/src/core/overlay/position/viewport-ruler.ts b/src/core/overlay/position/viewport-ruler.ts index db98643d5bf9..6d0e9828e26a 100644 --- a/src/core/overlay/position/viewport-ruler.ts +++ b/src/core/overlay/position/viewport-ruler.ts @@ -4,7 +4,7 @@ import {Injectable} from '@angular/core'; /** * Simple utility for getting the bounds of the browser viewport. - * @internal + * TODO: internal */ @Injectable() export class ViewportRuler {