mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
style(): use only leading underscores
This commit is contained in:
@@ -72,7 +72,7 @@ export class MdButton {
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class MdAnchor extends MdButton {
|
||||
disabled_: boolean = null;
|
||||
_disabled: boolean = null;
|
||||
|
||||
@HostBinding('tabIndex')
|
||||
get tabIndex(): number {
|
||||
@@ -87,11 +87,11 @@ export class MdAnchor extends MdButton {
|
||||
|
||||
@HostBinding('attr.disabled')
|
||||
@Input('disabled')
|
||||
get disabled() { return this.disabled_; }
|
||||
get disabled() { return this._disabled; }
|
||||
|
||||
set disabled(value: boolean) {
|
||||
// The presence of *any* disabled value makes the component disabled, *except* for false.
|
||||
this.disabled_ = (value != null && value != false) ? true : null;
|
||||
this._disabled = (value != null && value != false) ? true : null;
|
||||
}
|
||||
|
||||
@HostListener('click', ['$event'])
|
||||
|
||||
@@ -38,11 +38,11 @@ export class MdProgressCircle {
|
||||
* Value of the progress circle.
|
||||
*
|
||||
* Input:number, defaults to 0.
|
||||
* value_ is bound to the host as the attribute aria-valuenow.
|
||||
* _value is bound to the host as the attribute aria-valuenow.
|
||||
*/
|
||||
@HostBinding('attr.aria-valuenow')
|
||||
@Input('value')
|
||||
value_: number = 0;
|
||||
_value: number = 0;
|
||||
|
||||
/**
|
||||
* Mode of the progress circle
|
||||
@@ -69,20 +69,20 @@ export class MdProgressCircle {
|
||||
|
||||
// The total circumference is calculated based on the radius we use, 45.
|
||||
// PI * 2 * 45
|
||||
return 251.3274 * (100 - this.value_) / 100;
|
||||
return 251.3274 * (100 - this._value) / 100;
|
||||
}
|
||||
|
||||
|
||||
/** Gets the progress value, returning the clamped value. */
|
||||
get value() {
|
||||
return this.value_;
|
||||
return this._value;
|
||||
}
|
||||
|
||||
|
||||
/** Sets the progress value, clamping before setting the internal value. */
|
||||
set value(v: number) {
|
||||
if (isPresent(v)) {
|
||||
this.value_ = MdProgressCircle.clamp(v);
|
||||
this._value = MdProgressCircle.clamp(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<div class="md-sidenav-backdrop" (click)="closeModalSidenav_()"
|
||||
[class.md-sidenav-shown]="isShowingBackdrop_()"></div>
|
||||
<div class="md-sidenav-backdrop" (click)="_closeModalSidenav()"
|
||||
[class.md-sidenav-shown]="_isShowingBackdrop()"></div>
|
||||
|
||||
<ng-content select="md-sidenav"></ng-content>
|
||||
|
||||
<md-content [style.margin-left.px]="getMarginLeft_()"
|
||||
[style.margin-right.px]="getMarginRight_()"
|
||||
[style.left.px]="getPositionLeft_()"
|
||||
[style.right.px]="getPositionRight_()">
|
||||
<md-content [style.margin-left.px]="_getMarginLeft()"
|
||||
[style.margin-right.px]="_getMarginRight()"
|
||||
[style.left.px]="_getPositionLeft()"
|
||||
[style.right.px]="_getPositionRight()">
|
||||
<ng-content></ng-content>
|
||||
</md-content>
|
||||
|
||||
@@ -55,7 +55,7 @@ function createFixture(builder: TestComponentBuilder,
|
||||
function endSidenavTransition(fixture: ComponentFixture) {
|
||||
let sidenav: any = fixture.debugElement.query(By.directive(MdSidenav)).componentInstance;
|
||||
sidenav.onTransitionEnd({
|
||||
target: (<any>sidenav).elementRef_.nativeElement,
|
||||
target: (<any>sidenav)._elementRef.nativeElement,
|
||||
propertyName: 'transform'
|
||||
});
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -57,7 +57,7 @@ export class MdSidenav {
|
||||
@Input() @OneOf(['over', 'push', 'side']) mode: string = 'over';
|
||||
|
||||
/** Whether the sidenav is opened. */
|
||||
@Input('opened') private opened_: boolean;
|
||||
@Input('opened') private _opened: boolean;
|
||||
|
||||
/** Event emitted when the sidenav is being opened. Use this to synchronize animations. */
|
||||
@Output('open-start') onOpenStart = new EventEmitter<Object>();
|
||||
@@ -73,16 +73,16 @@ export class MdSidenav {
|
||||
|
||||
|
||||
/**
|
||||
* @param elementRef_ The DOM element reference. Used for transition and width calculation.
|
||||
* @param _elementRef The DOM element reference. Used for transition and width calculation.
|
||||
* If not available we do not hook on transitions.
|
||||
*/
|
||||
constructor(private elementRef_: ElementRef) {}
|
||||
constructor(private _elementRef: ElementRef) {}
|
||||
|
||||
/**
|
||||
* Whether the sidenav is opened. We overload this because we trigger an event when it
|
||||
* starts or end.
|
||||
*/
|
||||
get opened(): boolean { return this.opened_; }
|
||||
get opened(): boolean { return this._opened; }
|
||||
set opened(v: boolean) {
|
||||
this.toggle(v);
|
||||
}
|
||||
@@ -113,15 +113,15 @@ export class MdSidenav {
|
||||
}
|
||||
// Shortcut it if we're already opened.
|
||||
if (isOpen === this.opened) {
|
||||
if (!this.transition_) {
|
||||
if (!this._transition) {
|
||||
return PromiseWrapper.resolve(null);
|
||||
} else {
|
||||
return isOpen ? this.openPromise_ : this.closePromise_;
|
||||
return isOpen ? this._openPromise : this._closePromise;
|
||||
}
|
||||
}
|
||||
|
||||
this.opened_ = isOpen;
|
||||
this.transition_ = true;
|
||||
this._opened = isOpen;
|
||||
this._transition = true;
|
||||
|
||||
if (isOpen) {
|
||||
this.onOpenStart.emit(null);
|
||||
@@ -130,21 +130,21 @@ export class MdSidenav {
|
||||
}
|
||||
|
||||
if (isOpen) {
|
||||
if (this.openPromise_ == null) {
|
||||
if (this._openPromise == null) {
|
||||
let completer = PromiseWrapper.completer();
|
||||
this.openPromise_ = completer.promise;
|
||||
this.openPromiseReject_ = completer.reject;
|
||||
this.openPromiseResolve_ = completer.resolve;
|
||||
this._openPromise = completer.promise;
|
||||
this._openPromiseReject = completer.reject;
|
||||
this._openPromiseResolve = completer.resolve;
|
||||
}
|
||||
return this.openPromise_;
|
||||
return this._openPromise;
|
||||
} else {
|
||||
if (this.closePromise_ == null) {
|
||||
if (this._closePromise == null) {
|
||||
let completer = PromiseWrapper.completer();
|
||||
this.closePromise_ = completer.promise;
|
||||
this.closePromiseReject_ = completer.reject;
|
||||
this.closePromiseResolve_ = completer.resolve;
|
||||
this._closePromise = completer.promise;
|
||||
this._closePromiseReject = completer.reject;
|
||||
this._closePromiseResolve = completer.resolve;
|
||||
}
|
||||
return this.closePromise_;
|
||||
return this._closePromise;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,57 +157,57 @@ export class MdSidenav {
|
||||
* @private
|
||||
*/
|
||||
@HostListener('transitionend', ['$event']) onTransitionEnd(e: any) {
|
||||
if (e.target == this.elementRef_.nativeElement
|
||||
if (e.target == this._elementRef.nativeElement
|
||||
// Simpler version to check for prefixes.
|
||||
&& e.propertyName.endsWith('transform')) {
|
||||
this.transition_ = false;
|
||||
if (this.opened_) {
|
||||
if (this.openPromise_ != null) {
|
||||
this.openPromiseResolve_();
|
||||
this._transition = false;
|
||||
if (this._opened) {
|
||||
if (this._openPromise != null) {
|
||||
this._openPromiseResolve();
|
||||
}
|
||||
if (this.closePromise_ != null) {
|
||||
this.closePromiseReject_();
|
||||
if (this._closePromise != null) {
|
||||
this._closePromiseReject();
|
||||
}
|
||||
|
||||
this.onOpen.emit(null);
|
||||
} else {
|
||||
if (this.closePromise_ != null) {
|
||||
this.closePromiseResolve_();
|
||||
if (this._closePromise != null) {
|
||||
this._closePromiseResolve();
|
||||
}
|
||||
if (this.openPromise_ != null) {
|
||||
this.openPromiseReject_();
|
||||
if (this._openPromise != null) {
|
||||
this._openPromiseReject();
|
||||
}
|
||||
|
||||
this.onClose.emit(null);
|
||||
}
|
||||
|
||||
this.openPromise_ = null;
|
||||
this.closePromise_ = null;
|
||||
this._openPromise = null;
|
||||
this._closePromise = null;
|
||||
}
|
||||
}
|
||||
|
||||
@HostBinding('class.md-sidenav-closing') private get isClosing_() {
|
||||
return !this.opened_ && this.transition_;
|
||||
@HostBinding('class.md-sidenav-closing') private get _isClosing() {
|
||||
return !this._opened && this._transition;
|
||||
}
|
||||
@HostBinding('class.md-sidenav-opening') private get isOpening_() {
|
||||
return this.opened_ && this.transition_;
|
||||
@HostBinding('class.md-sidenav-opening') private get _isOpening() {
|
||||
return this._opened && this._transition;
|
||||
}
|
||||
@HostBinding('class.md-sidenav-closed') private get isClosed_() {
|
||||
return !this.opened_ && !this.transition_;
|
||||
@HostBinding('class.md-sidenav-closed') private get _isClosed() {
|
||||
return !this._opened && !this._transition;
|
||||
}
|
||||
@HostBinding('class.md-sidenav-opened') private get isOpened_() {
|
||||
return this.opened_ && !this.transition_;
|
||||
@HostBinding('class.md-sidenav-opened') private get _isOpened() {
|
||||
return this._opened && !this._transition;
|
||||
}
|
||||
@HostBinding('class.md-sidenav-end') private get isEnd_() {
|
||||
@HostBinding('class.md-sidenav-end') private get _isEnd() {
|
||||
return this.align == 'end';
|
||||
}
|
||||
@HostBinding('class.md-sidenav-side') private get modeSide_() {
|
||||
@HostBinding('class.md-sidenav-side') private get _modeSide() {
|
||||
return this.mode == 'side';
|
||||
}
|
||||
@HostBinding('class.md-sidenav-over') private get modeOver_() {
|
||||
@HostBinding('class.md-sidenav-over') private get _modeOver() {
|
||||
return this.mode == 'over';
|
||||
}
|
||||
@HostBinding('class.md-sidenav-push') private get modePush_() {
|
||||
@HostBinding('class.md-sidenav-push') private get _modePush() {
|
||||
return this.mode == 'push';
|
||||
}
|
||||
|
||||
@@ -216,20 +216,20 @@ export class MdSidenav {
|
||||
* not be used outside.
|
||||
* @private
|
||||
*/
|
||||
public get width_() {
|
||||
if (this.elementRef_.nativeElement) {
|
||||
return this.elementRef_.nativeElement.offsetWidth;
|
||||
public get _width() {
|
||||
if (this._elementRef.nativeElement) {
|
||||
return this._elementRef.nativeElement.offsetWidth;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private transition_: boolean = false;
|
||||
private openPromise_: Promise<void>;
|
||||
private openPromiseResolve_: () => void;
|
||||
private openPromiseReject_: () => void;
|
||||
private closePromise_: Promise<void>;
|
||||
private closePromiseResolve_: () => void;
|
||||
private closePromiseReject_: () => void;
|
||||
private _transition: boolean = false;
|
||||
private _openPromise: Promise<void>;
|
||||
private _openPromiseResolve: () => void;
|
||||
private _openPromiseReject: () => void;
|
||||
private _closePromise: Promise<void>;
|
||||
private _closePromiseResolve: () => void;
|
||||
private _closePromiseReject: () => void;
|
||||
}
|
||||
|
||||
|
||||
@@ -255,88 +255,88 @@ export class MdSidenav {
|
||||
],
|
||||
})
|
||||
export class MdSidenavLayout implements AfterContentInit {
|
||||
@ContentChildren(MdSidenav) private sidenavs_: QueryList<MdSidenav>;
|
||||
@ContentChildren(MdSidenav) private _sidenavs: QueryList<MdSidenav>;
|
||||
|
||||
get start() { return this.start_; }
|
||||
get end() { return this.end_; }
|
||||
get start() { return this._start; }
|
||||
get end() { return this._end; }
|
||||
|
||||
constructor(@Optional() @Host() private dir_: Dir) {
|
||||
constructor(@Optional() @Host() private _dir: Dir) {
|
||||
// If a `Dir` directive exists up the tree, listen direction changes and update the left/right
|
||||
// properties to point to the proper start/end.
|
||||
if (dir_ != null) {
|
||||
dir_.dirChange.add(() => this.validateDrawers_());
|
||||
if (_dir != null) {
|
||||
_dir.dirChange.add(() => this._validateDrawers());
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
// On changes, assert on consistency.
|
||||
ObservableWrapper.subscribe(this.sidenavs_.changes, () => this.validateDrawers_());
|
||||
this.validateDrawers_();
|
||||
ObservableWrapper.subscribe(this._sidenavs.changes, () => this._validateDrawers());
|
||||
this._validateDrawers();
|
||||
}
|
||||
|
||||
|
||||
/** The sidenav at the start/end alignment, independent of direction. */
|
||||
private start_: MdSidenav;
|
||||
private end_: MdSidenav;
|
||||
private _start: MdSidenav;
|
||||
private _end: MdSidenav;
|
||||
|
||||
/**
|
||||
* The sidenav at the left/right. When direction changes, these will change as well.
|
||||
* They're used as aliases for the above to set the left/right style properly.
|
||||
* In LTR, left_ == start_ and right_ == end_.
|
||||
* In RTL, left_ == end_ and right_ == start_.
|
||||
* In LTR, _left == _start and _right == _end.
|
||||
* In RTL, _left == _end and _right == _start.
|
||||
*/
|
||||
private left_: MdSidenav;
|
||||
private right_: MdSidenav;
|
||||
private _left: MdSidenav;
|
||||
private _right: MdSidenav;
|
||||
|
||||
/**
|
||||
* Validate the state of the sidenav children components.
|
||||
* @private
|
||||
*/
|
||||
private validateDrawers_() {
|
||||
this.start_ = this.end_ = null;
|
||||
if (this.sidenavs_.length === 0) {
|
||||
private _validateDrawers() {
|
||||
this._start = this._end = null;
|
||||
if (this._sidenavs.length === 0) {
|
||||
throw new MdMissingSidenavException();
|
||||
}
|
||||
|
||||
// Ensure that we have at most one start and one end sidenav.
|
||||
iterateListLike(this.sidenavs_, (sidenav: any) => {
|
||||
iterateListLike(this._sidenavs, (sidenav: any) => {
|
||||
if (sidenav.align == 'end') {
|
||||
if (this.end_ != null) {
|
||||
if (this._end != null) {
|
||||
throw new MdDuplicatedSidenavException('end');
|
||||
}
|
||||
this.end_ = sidenav;
|
||||
this._end = sidenav;
|
||||
} else {
|
||||
if (this.start_ != null) {
|
||||
if (this._start != null) {
|
||||
throw new MdDuplicatedSidenavException('start');
|
||||
}
|
||||
this.start_ = sidenav;
|
||||
this._start = sidenav;
|
||||
}
|
||||
});
|
||||
|
||||
this.right_ = this.left_ = null;
|
||||
this._right = this._left = null;
|
||||
|
||||
// Detect if we're LTR or RTL.
|
||||
if (this.dir_ == null || this.dir_.value == 'ltr') {
|
||||
this.left_ = this.start_;
|
||||
this.right_ = this.end_;
|
||||
if (this._dir == null || this._dir.value == 'ltr') {
|
||||
this._left = this._start;
|
||||
this._right = this._end;
|
||||
} else {
|
||||
this.left_ = this.end_;
|
||||
this.right_ = this.start_;
|
||||
this._left = this._end;
|
||||
this._right = this._start;
|
||||
}
|
||||
}
|
||||
|
||||
private closeModalSidenav_() {
|
||||
if (this.start_ != null && this.start_.mode != 'side') {
|
||||
this.start_.close();
|
||||
private _closeModalSidenav() {
|
||||
if (this._start != null && this._start.mode != 'side') {
|
||||
this._start.close();
|
||||
}
|
||||
if (this.end_ != null && this.end_.mode != 'side') {
|
||||
this.end_.close();
|
||||
if (this._end != null && this._end.mode != 'side') {
|
||||
this._end.close();
|
||||
}
|
||||
}
|
||||
|
||||
private isShowingBackdrop_() {
|
||||
return (this.start_ != null && this.start_.mode != 'side' && this.start_.opened)
|
||||
|| (this.end_ != null && this.end_.mode != 'side' && this.end_.opened);
|
||||
private _isShowingBackdrop() {
|
||||
return (this._start != null && this._start.mode != 'side' && this._start.opened)
|
||||
|| (this._end != null && this._end.mode != 'side' && this._end.opened);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,27 +345,27 @@ export class MdSidenavLayout implements AfterContentInit {
|
||||
* @param MdSidenav
|
||||
* @private
|
||||
*/
|
||||
private getSidenavEffectiveWidth_(sidenav: MdSidenav, mode: string): number {
|
||||
private _getSidenavEffectiveWidth(sidenav: MdSidenav, mode: string): number {
|
||||
if (sidenav != null && sidenav.mode == mode && sidenav.opened) {
|
||||
return sidenav.width_;
|
||||
return sidenav._width;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private getMarginLeft_() {
|
||||
return this.getSidenavEffectiveWidth_(this.left_, 'side');
|
||||
private _getMarginLeft() {
|
||||
return this._getSidenavEffectiveWidth(this._left, 'side');
|
||||
}
|
||||
|
||||
private getMarginRight_() {
|
||||
return this.getSidenavEffectiveWidth_(this.right_, 'side');
|
||||
private _getMarginRight() {
|
||||
return this._getSidenavEffectiveWidth(this._right, 'side');
|
||||
}
|
||||
|
||||
private getPositionLeft_() {
|
||||
return this.getSidenavEffectiveWidth_(this.left_, 'push');
|
||||
private _getPositionLeft() {
|
||||
return this._getSidenavEffectiveWidth(this._left, 'push');
|
||||
}
|
||||
|
||||
private getPositionRight_() {
|
||||
return this.getSidenavEffectiveWidth_(this.right_, 'push');
|
||||
private _getPositionRight() {
|
||||
return this._getSidenavEffectiveWidth(this._right, 'push');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@ import {FunctionWrapper, isPresent, Type} from 'angular2/src/facade/lang';
|
||||
|
||||
export class TestInjector {
|
||||
|
||||
private instantiated_: boolean = false;
|
||||
private _instantiated: boolean = false;
|
||||
|
||||
private injector_: Injector = null;
|
||||
private _injector: Injector = null;
|
||||
|
||||
private providers_: Array<Type | Provider | any[]> = [];
|
||||
private _providers: Array<Type | Provider | any[]> = [];
|
||||
|
||||
reset() {
|
||||
this.injector_ = null;
|
||||
this.providers_ = [];
|
||||
this.instantiated_ = false;
|
||||
this._injector = null;
|
||||
this._providers = [];
|
||||
this._instantiated = false;
|
||||
}
|
||||
|
||||
platformProviders: Array<Type | Provider | any[]> = [];
|
||||
@@ -22,25 +22,25 @@ export class TestInjector {
|
||||
applicationProviders: Array<Type | Provider | any[]> = [];
|
||||
|
||||
addProviders(providers: Array<Type | Provider | any[]>) {
|
||||
if (this.instantiated_) {
|
||||
if (this._instantiated) {
|
||||
throw new BaseException('Cannot add providers after test injector is instantiated');
|
||||
}
|
||||
this.providers_ = ListWrapper.concat(this.providers_, providers);
|
||||
this._providers = ListWrapper.concat(this._providers, providers);
|
||||
}
|
||||
|
||||
createInjector() {
|
||||
let rootInjector = Injector.resolveAndCreate(this.platformProviders);
|
||||
this.injector_ = rootInjector.resolveAndCreateChild(
|
||||
ListWrapper.concat(this.applicationProviders, this.providers_));
|
||||
this.instantiated_ = true;
|
||||
return this.injector_;
|
||||
this._injector = rootInjector.resolveAndCreateChild(
|
||||
ListWrapper.concat(this.applicationProviders, this._providers));
|
||||
this._instantiated = true;
|
||||
return this._injector;
|
||||
}
|
||||
|
||||
execute(fn: FunctionWithParamTokens): any {
|
||||
if (!this.instantiated_) {
|
||||
if (!this._instantiated) {
|
||||
this.createInjector();
|
||||
}
|
||||
return fn.execute(this.injector_);
|
||||
return fn.execute(this._injector);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,15 +143,15 @@ export function injectAsync(tokens: any[], fn: Function): FunctionWithParamToken
|
||||
}
|
||||
|
||||
export class FunctionWithParamTokens {
|
||||
constructor(private tokens_: any[], private fn_: Function, public isAsync: boolean) {}
|
||||
constructor(private _tokens: any[], private _fn: Function, public isAsync: boolean) {}
|
||||
|
||||
/**
|
||||
* Returns the value of the executed function.
|
||||
*/
|
||||
execute(injector: Injector): any {
|
||||
let params = this.tokens_.map(t => injector.get(t));
|
||||
return FunctionWrapper.apply(this.fn_, params);
|
||||
let params = this._tokens.map(t => injector.get(t));
|
||||
return FunctionWrapper.apply(this._fn, params);
|
||||
}
|
||||
|
||||
hasToken(token: any): boolean { return this.tokens_.indexOf(token) > -1; }
|
||||
hasToken(token: any): boolean { return this._tokens.indexOf(token) > -1; }
|
||||
}
|
||||
|
||||
@@ -43,21 +43,21 @@ export class TemplatePortalDirective extends TemplatePortal {
|
||||
})
|
||||
export class PortalHostDirective extends BasePortalHost {
|
||||
/** The attached portal. */
|
||||
private portal_: Portal<any>;
|
||||
private _portal: Portal<any>;
|
||||
|
||||
constructor(
|
||||
private dynamicComponentLoader_: DynamicComponentLoader,
|
||||
private elementRef_: ElementRef,
|
||||
private viewContainerRef_: ViewContainerRef) {
|
||||
private _dynamicComponentLoader: DynamicComponentLoader,
|
||||
private _elementRef: ElementRef,
|
||||
private _viewContainerRef: ViewContainerRef) {
|
||||
super();
|
||||
}
|
||||
|
||||
get portal(): Portal<any> {
|
||||
return this.portal_;
|
||||
return this._portal;
|
||||
}
|
||||
|
||||
set portal(p: Portal<any>) {
|
||||
this.replaceAttachedPortal_(p);
|
||||
this._replaceAttachedPortal(p);
|
||||
}
|
||||
|
||||
/** Attach the given ComponentPortal to this PortlHost using the DynamicComponentLoader. */
|
||||
@@ -66,11 +66,11 @@ export class PortalHostDirective extends BasePortalHost {
|
||||
|
||||
// If the portal specifies an origin, use that as the logical location of the component
|
||||
// in the application tree. Otherwise use the location of this PortalHost.
|
||||
let elementRef = portal.origin != null ? portal.origin : this.elementRef_;
|
||||
let elementRef = portal.origin != null ? portal.origin : this._elementRef;
|
||||
|
||||
// Typecast is necessary for Dart transpilation.
|
||||
return <Promise<ComponentRef>>
|
||||
this.dynamicComponentLoader_.loadNextToLocation(portal.component, elementRef)
|
||||
this._dynamicComponentLoader.loadNextToLocation(portal.component, elementRef)
|
||||
.then(ref => {
|
||||
this.setDisposeFn(() => ref.dispose());
|
||||
return ref;
|
||||
@@ -81,9 +81,9 @@ export class PortalHostDirective extends BasePortalHost {
|
||||
attachTemplatePortal(portal: TemplatePortal): Promise<Map<string, any>> {
|
||||
portal.setAttachedHost(this);
|
||||
|
||||
let viewRef = this.viewContainerRef_.createEmbeddedView(portal.templateRef);
|
||||
let viewRef = this._viewContainerRef.createEmbeddedView(portal.templateRef);
|
||||
portal.locals.forEach((v, k) => viewRef.setLocal(k, v));
|
||||
this.setDisposeFn(() => this.viewContainerRef_.clear());
|
||||
this.setDisposeFn(() => this._viewContainerRef.clear());
|
||||
|
||||
// TODO(jelbourn): return locals from view
|
||||
// Typecast is necessary for Dart transpilation.
|
||||
@@ -91,13 +91,13 @@ export class PortalHostDirective extends BasePortalHost {
|
||||
}
|
||||
|
||||
/** Detatches the currently attached Portal (if there is one) and attaches the given Portal. */
|
||||
private replaceAttachedPortal_(p: Portal<any>): void {
|
||||
private _replaceAttachedPortal(p: Portal<any>): void {
|
||||
let maybeDetach = this.hasAttached() ? this.detach() : Promise.resolve(null);
|
||||
|
||||
maybeDetach.then(_ => {
|
||||
if (p != null) {
|
||||
this.attach(p);
|
||||
this.portal_ = p;
|
||||
this._portal = p;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+20
-20
@@ -10,7 +10,7 @@ import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
* It can be attach to / detached from a `PortalHost`.
|
||||
*/
|
||||
export abstract class Portal<T> {
|
||||
private attachedHost_: PortalHost;
|
||||
private _attachedHost: PortalHost;
|
||||
|
||||
/** Attach this portal to a host. */
|
||||
attach(host: PortalHost): Promise<T> {
|
||||
@@ -22,24 +22,24 @@ export abstract class Portal<T> {
|
||||
throw new BaseException('Host already has a portal attached');
|
||||
}
|
||||
|
||||
this.attachedHost_ = host;
|
||||
this._attachedHost = host;
|
||||
return <Promise<T>> host.attach(this);
|
||||
}
|
||||
|
||||
/** Detach this portal from its host */
|
||||
detach(): Promise<void> {
|
||||
let host = this.attachedHost_;
|
||||
let host = this._attachedHost;
|
||||
if (host == null) {
|
||||
throw new BaseException('Portal has no host from which to detach');
|
||||
}
|
||||
|
||||
this.attachedHost_ = null;
|
||||
this._attachedHost = null;
|
||||
return host.detach();
|
||||
}
|
||||
|
||||
/** Whether this portal is attached to a host. */
|
||||
get isAttached(): boolean {
|
||||
return this.attachedHost_ != null;
|
||||
return this._attachedHost != null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ export abstract class Portal<T> {
|
||||
* the PortalHost when it is performing an `attach()` or `detatch()`.
|
||||
*/
|
||||
setAttachedHost(host: PortalHost) {
|
||||
this.attachedHost_ = host;
|
||||
this._attachedHost = host;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,17 +130,17 @@ export interface PortalHost {
|
||||
*/
|
||||
export abstract class BasePortalHost implements PortalHost {
|
||||
/** The portal currently attached to the host. */
|
||||
private attachedPortal_: Portal<any>;
|
||||
private _attachedPortal: Portal<any>;
|
||||
|
||||
/** A function that will permanently dispose this host. */
|
||||
private disposeFn_: () => void;
|
||||
private _disposeFn: () => void;
|
||||
|
||||
/** Whether this host has already been permanently disposed. */
|
||||
private isDisposed_: boolean = false;
|
||||
private _isDisposed: boolean = false;
|
||||
|
||||
/** Whether this host has an attached portal. */
|
||||
hasAttached() {
|
||||
return this.attachedPortal_ != null;
|
||||
return this._attachedPortal != null;
|
||||
}
|
||||
|
||||
attach(portal: Portal<any>): Promise<any> {
|
||||
@@ -152,15 +152,15 @@ export abstract class BasePortalHost implements PortalHost {
|
||||
throw new BaseException('A portal is already attached');
|
||||
}
|
||||
|
||||
if (this.isDisposed_) {
|
||||
if (this._isDisposed) {
|
||||
throw new BaseException('This PortalHost has already been disposed');
|
||||
}
|
||||
|
||||
if (portal instanceof ComponentPortal) {
|
||||
this.attachedPortal_ = portal;
|
||||
this._attachedPortal = portal;
|
||||
return this.attachComponentPortal(portal);
|
||||
} else if (portal instanceof TemplatePortal) {
|
||||
this.attachedPortal_ = portal;
|
||||
this._attachedPortal = portal;
|
||||
return this.attachTemplatePortal(portal);
|
||||
}
|
||||
|
||||
@@ -174,11 +174,11 @@ export abstract class BasePortalHost implements PortalHost {
|
||||
abstract attachTemplatePortal(portal: TemplatePortal): Promise<Map<string, any>>;
|
||||
|
||||
detach(): Promise<void> {
|
||||
this.attachedPortal_.setAttachedHost(null);
|
||||
this.attachedPortal_ = null;
|
||||
if (this.disposeFn_ != null) {
|
||||
this.disposeFn_();
|
||||
this.disposeFn_ = null;
|
||||
this._attachedPortal.setAttachedHost(null);
|
||||
this._attachedPortal = null;
|
||||
if (this._disposeFn != null) {
|
||||
this._disposeFn();
|
||||
this._disposeFn = null;
|
||||
}
|
||||
|
||||
return Promise.resolve(null);
|
||||
@@ -189,10 +189,10 @@ export abstract class BasePortalHost implements PortalHost {
|
||||
this.detach();
|
||||
}
|
||||
|
||||
this.isDisposed_ = true;
|
||||
this._isDisposed = true;
|
||||
}
|
||||
|
||||
setDisposeFn(fn: () => void) {
|
||||
this.disposeFn_ = fn;
|
||||
this._disposeFn = fn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,18 +15,18 @@ import {OneOf} from '../../core/annotations/one-of';
|
||||
exportAs: '$implicit'
|
||||
})
|
||||
export class Dir {
|
||||
@Input('dir') @OneOf(['ltr', 'rtl']) private dir_: string = 'ltr';
|
||||
@Input('dir') @OneOf(['ltr', 'rtl']) private _dir: string = 'ltr';
|
||||
|
||||
@Output() dirChange = new EventEmitter<void>();
|
||||
|
||||
@HostBinding('attr.dir')
|
||||
get dir(): string {
|
||||
return this.dir_;
|
||||
return this._dir;
|
||||
}
|
||||
set dir(v: string) {
|
||||
let old = this.dir_;
|
||||
this.dir_ = v;
|
||||
if (old != this.dir_) {
|
||||
let old = this._dir;
|
||||
this._dir = v;
|
||||
if (old != this._dir) {
|
||||
this.dirChange.emit(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,12 +47,12 @@ export function analyze(dir: string, command: string, use_ddc: boolean = false):
|
||||
fs.writeFileSync(path.join(dir, tempFile), analyzeFile.join('\n'));
|
||||
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
analyze_(command, dir, resolve, use_ddc);
|
||||
_analyze(command, dir, resolve, use_ddc);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function analyze_(command, dirName, done, useDdc) {
|
||||
function _analyze(command, dirName, done, useDdc) {
|
||||
// TODO remove --package-warnings once dartanalyzer handles transitive libraries
|
||||
var flags = ['--fatal-warnings', '--format=machine'];
|
||||
|
||||
@@ -158,11 +158,11 @@ class _AnalyzerOutputLine {
|
||||
}
|
||||
|
||||
static parse(line: string) {
|
||||
const result = this.analyzerParseRegExp_.exec(line);
|
||||
const result = this._analyzerParseRegExp.exec(line);
|
||||
return result ? new this(result) : null;
|
||||
}
|
||||
|
||||
private static analyzerParseRegExp_ =
|
||||
private static _analyzerParseRegExp =
|
||||
new RegExp('([^\|]+)\\|' + // #1, severity (NONE, INFO, WARNING, ERROR)
|
||||
'([^\|]+)\\|' + // #2, errorCode.type (HINT, *_WARNING, *_ERROR, etc)
|
||||
'([^\|]+)\\|' + // #3, errorCode (UNUSED_IMPORT, UNUSED_CATCH_STACK, etc)
|
||||
@@ -173,7 +173,7 @@ class _AnalyzerOutputLine {
|
||||
'(.*)$'); // #8, error message
|
||||
|
||||
/* Maps file path (as string) to file source (an array of strings, one per line). */
|
||||
private static cache_ = {};
|
||||
private static _cache = {};
|
||||
|
||||
private static ERR_NO_SOURCE = '(Could not find source line).';
|
||||
|
||||
@@ -228,7 +228,7 @@ class _AnalyzerOutputLine {
|
||||
|
||||
// Reads the source file for the Analyzer output, caching it for future use.
|
||||
_getSourceLine() {
|
||||
var cache = _AnalyzerOutputLine.cache_;
|
||||
var cache = _AnalyzerOutputLine._cache;
|
||||
var sourceLines = null;
|
||||
if (cache.hasOwnProperty(this.sourcePath)) {
|
||||
sourceLines = cache[this.sourcePath];
|
||||
|
||||
Vendored
+10
-10
@@ -153,10 +153,10 @@ declare module jasmine {
|
||||
it(description: string, func: () => void): Spec;
|
||||
// iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these
|
||||
xit(desc: string, func: () => void): XSpec;
|
||||
compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
||||
compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
||||
equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
||||
contains_(haystack: any, needle: any): boolean;
|
||||
_compareRegExps(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
||||
_compareObjects(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
||||
_equals(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
||||
_contains(haystack: any, needle: any): boolean;
|
||||
addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
|
||||
addMatchers(matchers: CustomMatcherFactories): void;
|
||||
specFilter(spec: Spec): boolean;
|
||||
@@ -253,7 +253,7 @@ declare module jasmine {
|
||||
insertNext(block: any, ensure?: boolean): void;
|
||||
start(onComplete?: () => void): void;
|
||||
isRunning(): boolean;
|
||||
next_(): void;
|
||||
_next(): void;
|
||||
results(): NestedResults;
|
||||
}
|
||||
|
||||
@@ -343,9 +343,9 @@ declare module jasmine {
|
||||
suite: Suite;
|
||||
|
||||
afterCallbacks: SpecFunction[];
|
||||
spies_: Spy[];
|
||||
_spies: Spy[];
|
||||
|
||||
results_: NestedResults;
|
||||
_results: NestedResults;
|
||||
matchersClass: Matchers;
|
||||
|
||||
getFullName(): string;
|
||||
@@ -358,7 +358,7 @@ declare module jasmine {
|
||||
waits(timeout: number): Spec;
|
||||
waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec;
|
||||
fail(e?: any): void;
|
||||
getMatchersClass_(): Matchers;
|
||||
_getMatchersClass(): Matchers;
|
||||
addMatchers(matchersPrototype: CustomMatcherFactories): void;
|
||||
finishCallback(): void;
|
||||
finish(onComplete?: () => void): void;
|
||||
@@ -461,12 +461,12 @@ declare module jasmine {
|
||||
new (): any;
|
||||
|
||||
suites(): Suite[];
|
||||
summarize_(suiteOrSpec: SuiteOrSpec): any;
|
||||
_summarize(suiteOrSpec: SuiteOrSpec): any;
|
||||
results(): any;
|
||||
resultsForSpec(specId: any): any;
|
||||
log(str: any): any;
|
||||
resultsForSpecs(specIds: any): any;
|
||||
summarizeResult_(result: any): any;
|
||||
_summarizeResult(result: any): any;
|
||||
}
|
||||
|
||||
interface Jasmine {
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@
|
||||
"no-bitwise": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unused-variable": [true, {"ignore-pattern": "ddescribe|iit|.*_$"}],
|
||||
"no-unused-variable": [true, {"ignore-pattern": "^(ddescribe|iit|_.*)$"}],
|
||||
"one-line": [
|
||||
true,
|
||||
"check-catch",
|
||||
@@ -49,7 +49,7 @@
|
||||
true,
|
||||
"ban-keywords",
|
||||
"check-format",
|
||||
"allow-trailing-underscore"
|
||||
"allow-leading-underscore"
|
||||
],
|
||||
"whitespace": [
|
||||
true,
|
||||
|
||||
Reference in New Issue
Block a user