Skip to content

Commit

Permalink
fix: remove @internal where it would make tsc fail (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
jelbourn authored and hansl committed May 27, 2016
1 parent fd02b10 commit efd1be2
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 50 deletions.
44 changes: 26 additions & 18 deletions src/components/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -151,6 +149,7 @@ export class MdCheckbox implements ControlValueAccessor {
}
}

/** TODO: internal */
ngAfterContentInit() {
this._isInitialized = true;
}
Expand Down Expand Up @@ -178,20 +177,29 @@ 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();
}
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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/grid-list/grid-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class MdGridList implements OnInit, AfterContentChecked {
this._setTileStyler();
}

/** @internal */
/** TODO: internal */
ngOnInit() {
this._checkCols();
this._checkRowHeight();
Expand All @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/components/icon/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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. <md-icon>arrow</md-icon>. In this case we need to add a CSS class for the default font.
Expand All @@ -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. <md-icon>home</md-icon> should use 'home').
Expand Down
19 changes: 14 additions & 5 deletions src/components/input/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -241,7 +250,7 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
});
}

/** @internal */
/** TODO: internal */
ngOnChanges(changes: {[key: string]: SimpleChange}) {
this._validateConstraints();
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/list/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class MdListItem implements AfterContentInit {
/** @internal */
hasFocus: boolean = false;

/** @internal */
/** TODO: internal */
ngAfterContentInit() {
this._setLineClass(this._lines.length);

Expand Down
10 changes: 5 additions & 5 deletions src/components/radio/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -204,23 +204,23 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {

/**
* Implemented as part of ControlValueAccessor.
* @internal
* TODO: internal
*/
writeValue(value: any) {
this.value = value;
}

/**
* Implemented as part of ControlValueAccessor.
* @internal
* TODO: internal
*/
registerOnChange(fn: (value: any) => void) {
this._controlValueAccessorChangeFn = fn;
}

/**
* Implemented as part of ControlValueAccessor.
* @internal
* TODO: internal
*/
registerOnTouched(fn: any) {
this.onTouched = fn;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidenav/sidenav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export class MdSidenavLayout implements AfterContentInit {
}
}

/** @internal */
/** TODO: internal */
ngAfterContentInit() {
// On changes, assert on consistency.
this._sidenavs.changes.subscribe(() => this._validateDrawers());
Expand Down
6 changes: 3 additions & 3 deletions src/components/slide-toggle/slide-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,23 @@ export class MdSlideToggle implements ControlValueAccessor {

/**
* Implemented as part of ControlValueAccessor.
* @internal
* TODO: internal
*/
writeValue(value: any): void {
this.checked = value;
}

/**
* Implemented as part of ControlValueAccessor.
* @internal
* TODO: internal
*/
registerOnChange(fn: any): void {
this.onChange = fn;
}

/**
* Implemented as part of ControlValueAccessor.
* @internal
* TODO: internal
*/
registerOnTouched(fn: any): void {
this.onTouched = fn;
Expand Down
2 changes: 1 addition & 1 deletion src/components/tabs/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/core/overlay/overlay-directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
8 changes: 1 addition & 7 deletions src/core/overlay/position/connected-position-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
// We need the bounding rects for the origin and the overlay to determine how to position
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/core/overlay/position/global-position-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class GlobalPositionStrategy implements PositionStrategy {

/**
* Apply the position to the element.
* @internal
* TODO: internal
*/
apply(element: HTMLElement): Promise<void> {
element.style.position = this._cssPosition;
Expand Down
2 changes: 1 addition & 1 deletion src/core/overlay/position/viewport-ruler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit efd1be2

Please sign in to comment.