mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix: remove @internal where it would make tsc fail (#538)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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. <md-icon>arrow</md-icon>. 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. <md-icon>home</md-icon> should use 'home').
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export class MdListItem implements AfterContentInit {
|
||||
/** @internal */
|
||||
hasFocus: boolean = false;
|
||||
|
||||
/** @internal */
|
||||
/** TODO: internal */
|
||||
ngAfterContentInit() {
|
||||
this._setLineClass(this._lines.length);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -266,7 +266,7 @@ export class MdSidenavLayout implements AfterContentInit {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/** TODO: internal */
|
||||
ngAfterContentInit() {
|
||||
// On changes, assert on consistency.
|
||||
this._sidenavs.changes.subscribe(() => this._validateDrawers());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user