From 4c4e8a4a86ea081c355b93b34f256efe28c437ab Mon Sep 17 00:00:00 2001 From: Daniel Kucal Date: Sun, 30 Oct 2016 21:36:10 +0100 Subject: [PATCH] private access specifiers replaced by protected --- .../accordion/accordion-group.component.ts | 4 +- components/accordion/accordion.component.ts | 2 +- components/accordion/readme.md | 2 +- components/alert/alert.component.ts | 2 +- .../buttons/button-checkbox.directive.ts | 6 +-- components/buttons/button-radio.directive.ts | 2 +- components/carousel/carousel.component.ts | 20 ++++---- components/carousel/slide.component.ts | 2 +- components/collapse/collapse.directive.ts | 14 +++--- components/common.ts | 4 +- .../datepicker/datepicker-inner.component.ts | 30 ++++++------ components/datepicker/datepicker.component.ts | 4 +- components/datepicker/daypicker.component.ts | 6 +-- components/datepicker/yearpicker.component.ts | 6 +-- .../dropdown-keyboard-nav.directive.ts | 4 +- components/dropdown/dropdown.directive.ts | 4 +- components/dropdown/dropdown.service.ts | 10 ++-- components/modal/modal-backdrop.component.ts | 4 +- components/modal/modal.component.ts | 46 +++++++++--------- components/modal/title.md | 2 +- components/ng2-bootstrap-config.ts | 2 +- components/pagination/pagination.component.ts | 16 +++---- components/position.ts | 10 ++-- components/progressbar/bar.component.ts | 2 +- components/progressbar/progress.directive.ts | 2 +- components/rating/rating.component.ts | 6 +-- components/tabs/tab.directive.ts | 2 +- components/tabs/tabset.component.ts | 14 +++--- components/timepicker/timepicker.component.ts | 24 +++++----- components/tooltip/readme.md | 10 ++-- .../tooltip/tooltip-container.component.ts | 18 +++---- components/tooltip/tooltip.directive.ts | 10 ++-- components/typeahead/readme.md | 14 +++--- .../typeahead-container.component.ts | 8 ++-- components/typeahead/typeahead-match.class.ts | 2 +- components/typeahead/typeahead.directive.ts | 48 +++++++++---------- components/utils/components-helper.service.ts | 6 +-- 37 files changed, 184 insertions(+), 184 deletions(-) diff --git a/components/accordion/accordion-group.component.ts b/components/accordion/accordion-group.component.ts index e4fb1aaa0b..866b040bd5 100644 --- a/components/accordion/accordion-group.component.ts +++ b/components/accordion/accordion-group.component.ts @@ -47,8 +47,8 @@ export class AccordionPanelComponent implements OnInit, OnDestroy { } } - private _isOpen:boolean; - private accordion:AccordionComponent; + protected _isOpen:boolean; + protected accordion:AccordionComponent; public constructor(@Inject(AccordionComponent) accordion:AccordionComponent) { this.accordion = accordion; diff --git a/components/accordion/accordion.component.ts b/components/accordion/accordion.component.ts index fd90c44160..91e0da5272 100644 --- a/components/accordion/accordion.component.ts +++ b/components/accordion/accordion.component.ts @@ -15,7 +15,7 @@ export class AccordionComponent { public addClass:boolean = true; /* tslint:enable:no-unused-variable */ - private groups:Array = []; + protected groups:Array = []; public closeOtherPanels(openGroup:AccordionPanelComponent):void { if (!this.closeOthers) { diff --git a/components/accordion/readme.md b/components/accordion/readme.md index 147be6dd6d..d1acb98fd9 100644 --- a/components/accordion/readme.md +++ b/components/accordion/readme.md @@ -32,7 +32,7 @@ export class AccordionGroupComponent implements OnInit, OnDestroy { @Input() public get isOpen(); // should be inside of Accordion element - constructor(private accordion:Accordion) {} + constructor(protected accordion:Accordion) {} } ``` diff --git a/components/alert/alert.component.ts b/components/alert/alert.component.ts index be97fde3b7..d91aa4f528 100644 --- a/components/alert/alert.component.ts +++ b/components/alert/alert.component.ts @@ -23,7 +23,7 @@ export class AlertComponent implements OnInit { @Output() public close:EventEmitter = new EventEmitter(false); public closed:boolean; - private classes:Array = []; + protected classes:Array = []; public ngOnInit():any { this.classes[0] = `alert-${this.type}`; diff --git a/components/buttons/button-checkbox.directive.ts b/components/buttons/button-checkbox.directive.ts index 7eb6bdd38b..f19b74c618 100644 --- a/components/buttons/button-checkbox.directive.ts +++ b/components/buttons/button-checkbox.directive.ts @@ -17,7 +17,7 @@ export class ButtonCheckboxDirective implements ControlValueAccessor, OnInit { protected onChange:any = Function.prototype; protected onTouched:any = Function.prototype; - private value:any; + protected value:any; // view -> model @HostListener('click') @@ -36,13 +36,13 @@ export class ButtonCheckboxDirective implements ControlValueAccessor, OnInit { this.toggle(this.trueValue === this.value); } - private get trueValue():boolean { + protected get trueValue():boolean { return typeof this.btnCheckboxTrue !== 'undefined' ? this.btnCheckboxTrue : true; } - private get falseValue():boolean { + protected get falseValue():boolean { return typeof this.btnCheckboxFalse !== 'undefined' ? this.btnCheckboxFalse : false; diff --git a/components/buttons/button-radio.directive.ts b/components/buttons/button-radio.directive.ts index 325ca61cc0..dad9a4ddf6 100644 --- a/components/buttons/button-radio.directive.ts +++ b/components/buttons/button-radio.directive.ts @@ -42,7 +42,7 @@ export class ButtonRadioDirective implements ControlValueAccessor, OnInit { this.onChange(this.value); } - public constructor( private el: ElementRef) { + public constructor( protected el: ElementRef) { } public ngOnInit(): void { diff --git a/components/carousel/carousel.component.ts b/components/carousel/carousel.component.ts index f49b151fca..9075f1d558 100644 --- a/components/carousel/carousel.component.ts +++ b/components/carousel/carousel.component.ts @@ -51,11 +51,11 @@ export class CarouselComponent implements OnDestroy { } public slides:Array = []; - private currentInterval:any; - private isPlaying:boolean; - private destroyed:boolean = false; - private currentSlide:SlideComponent; - private _interval:number; + protected currentInterval:any; + protected isPlaying:boolean; + protected destroyed:boolean = false; + protected currentSlide:SlideComponent; + protected _interval:number; public get isBS4():boolean { return Ng2BootstrapConfig.theme === Ng2BootstrapTheme.BS4; @@ -144,7 +144,7 @@ export class CarouselComponent implements OnDestroy { } } - private goNext(slide:SlideComponent, direction:Direction):void { + protected goNext(slide:SlideComponent, direction:Direction):void { if (this.destroyed) { return; } @@ -163,7 +163,7 @@ export class CarouselComponent implements OnDestroy { this.restartTimer(); } - private getSlideByIndex(index:number):any { + protected getSlideByIndex(index:number):any { let len = this.slides.length; for (let i = 0; i < len; ++i) { if (this.slides[i].index === index) { @@ -173,11 +173,11 @@ export class CarouselComponent implements OnDestroy { return void 0; } - private getCurrentIndex():number { + protected getCurrentIndex():number { return !this.currentSlide ? 0 : this.currentSlide.index; } - private restartTimer():any { + protected restartTimer():any { this.resetTimer(); let interval = +this.interval; if (!isNaN(interval) && interval > 0) { @@ -194,7 +194,7 @@ export class CarouselComponent implements OnDestroy { } } - private resetTimer():void { + protected resetTimer():void { if (this.currentInterval) { clearInterval(this.currentInterval); this.currentInterval = void 0; diff --git a/components/carousel/slide.component.ts b/components/carousel/slide.component.ts index ac05be5eab..651eb24a11 100644 --- a/components/carousel/slide.component.ts +++ b/components/carousel/slide.component.ts @@ -21,7 +21,7 @@ export class SlideComponent implements OnInit, OnDestroy { @HostBinding('class.carousel-item') public addClass:boolean = true; - private carousel:CarouselComponent; + protected carousel:CarouselComponent; public constructor(carousel:CarouselComponent) { this.carousel = carousel; diff --git a/components/collapse/collapse.directive.ts b/components/collapse/collapse.directive.ts index de14609ba0..a81e126332 100644 --- a/components/collapse/collapse.directive.ts +++ b/components/collapse/collapse.directive.ts @@ -27,12 +27,12 @@ import { Directive, ElementRef, EventEmitter, HostBinding, Input, OnInit, Output // TODO: #576 add callbacks: expanding, collapsing after adding animation @Directive({selector: '[collapse]'}) export class CollapseDirective implements OnInit { - // private animation:any; + // protected animation:any; @Output() public collapsed:EventEmitter = new EventEmitter(false); @Output() public expanded:EventEmitter = new EventEmitter(false); // style // @HostBinding('style.height') - // private height:string; + // protected height:string; @HostBinding('style.display') public display:string; // shown @@ -49,7 +49,7 @@ export class CollapseDirective implements OnInit { @HostBinding('class.collapsing') public isCollapsing:boolean = false; - // @Input() private transitionDuration:number = 500; // Duration in ms + // @Input() protected transitionDuration:number = 500; // Duration in ms @Input() public set collapse(value:boolean) { @@ -61,10 +61,10 @@ export class CollapseDirective implements OnInit { return this.isExpanded; } - // private open: boolean; - // private _ab:AnimationBuilder; - private _el:ElementRef; - private _renderer:Renderer; + // protected open: boolean; + // protected _ab:AnimationBuilder; + protected _el:ElementRef; + protected _renderer:Renderer; public constructor(/*_ab:AnimationBuilder, */_el:ElementRef, _renderer:Renderer) { // this._ab = _ab; diff --git a/components/common.ts b/components/common.ts index 79080e362d..6136811a79 100644 --- a/components/common.ts +++ b/components/common.ts @@ -12,7 +12,7 @@ export interface KeyAttribute { export class NgTranscludeDirective { public viewRef:ViewContainerRef; - private _ngTransclude:TemplateRef; + protected _ngTransclude:TemplateRef; @Input() public set ngTransclude(templateRef:TemplateRef) { @@ -26,7 +26,7 @@ export class NgTranscludeDirective { return this._ngTransclude; } - public constructor(private _viewRef:ViewContainerRef) { + public constructor(protected _viewRef:ViewContainerRef) { this.viewRef = _viewRef; } } diff --git a/components/datepicker/datepicker-inner.component.ts b/components/datepicker/datepicker-inner.component.ts index 0fc0826ed7..2d71a1f7bf 100644 --- a/components/datepicker/datepicker-inner.component.ts +++ b/components/datepicker/datepicker-inner.component.ts @@ -79,19 +79,19 @@ export class DatePickerInnerComponent implements OnInit, OnChanges { public stepMonth: any = {}; public stepYear: any = {}; - private modes: Array = ['day', 'month', 'year']; - private dateFormatter: DateFormatter = new DateFormatter(); - private uniqueId: string; - private _activeDate: Date; - private selectedDate: Date; - private activeDateId: string; - - private refreshViewHandlerDay: Function; - private compareHandlerDay: Function; - private refreshViewHandlerMonth: Function; - private compareHandlerMonth: Function; - private refreshViewHandlerYear: Function; - private compareHandlerYear: Function; + protected modes: Array = ['day', 'month', 'year']; + protected dateFormatter: DateFormatter = new DateFormatter(); + protected uniqueId: string; + protected _activeDate: Date; + protected selectedDate: Date; + protected activeDateId: string; + + protected refreshViewHandlerDay: Function; + protected compareHandlerDay: Function; + protected refreshViewHandlerMonth: Function; + protected compareHandlerMonth: Function; + protected refreshViewHandlerYear: Function; + protected compareHandlerYear: Function; @Input() public get activeDate(): Date { @@ -303,7 +303,7 @@ export class DatePickerInnerComponent implements OnInit, OnChanges { this.refreshView(); } - private getCustomClassForDate(date: Date): string { + protected getCustomClassForDate(date: Date): string { if (!this.customClass) { return ''; } @@ -316,7 +316,7 @@ export class DatePickerInnerComponent implements OnInit, OnChanges { return customClassObject === undefined ? '' : customClassObject.clazz; } - private isDisabled(date: Date): boolean { + protected isDisabled(date: Date): boolean { // todo: implement dateDisabled attribute return ((this.minDate && this.compare(date, this.minDate) < 0) || (this.maxDate && this.compare(date, this.maxDate) > 0)); diff --git a/components/datepicker/datepicker.component.ts b/components/datepicker/datepicker.component.ts index 56ea46fe74..77a7166960 100644 --- a/components/datepicker/datepicker.component.ts +++ b/components/datepicker/datepicker.component.ts @@ -70,8 +70,8 @@ export class DatePickerComponent implements ControlValueAccessor { public onTouched:any = Function.prototype; public cd:NgModel; - private _now:Date = new Date(); - private _activeDate:Date; + protected _now:Date = new Date(); + protected _activeDate:Date; @Input() public get activeDate():Date { diff --git a/components/datepicker/daypicker.component.ts b/components/datepicker/daypicker.component.ts index 1d353be31b..1546348b4e 100644 --- a/components/datepicker/daypicker.component.ts +++ b/components/datepicker/daypicker.component.ts @@ -96,7 +96,7 @@ export class DayPickerComponent implements OnInit { return Ng2BootstrapConfig.theme === Ng2BootstrapTheme.BS4; } - /*private getDaysInMonth(year:number, month:number) { + /*protected getDaysInMonth(year:number, month:number) { return ((month === 1) && (year % 4 === 0) && ((year % 100 !== 0) || (year % 400 === 0))) ? 29 : DAYS_IN_MONTH[month]; }*/ @@ -158,7 +158,7 @@ export class DayPickerComponent implements OnInit { this.datePicker.refreshView(); } - private getDates(startDate:Date, n:number):Array { + protected getDates(startDate:Date, n:number):Array { let dates:Array = new Array(n); let current = new Date(startDate.getTime()); let i = 0; @@ -172,7 +172,7 @@ export class DayPickerComponent implements OnInit { return dates; } - private getISO8601WeekNumber(date:Date):number { + protected getISO8601WeekNumber(date:Date):number { let checkDate = new Date(date.getTime()); // Thursday checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); diff --git a/components/datepicker/yearpicker.component.ts b/components/datepicker/yearpicker.component.ts index 70d77189c7..cb56130749 100644 --- a/components/datepicker/yearpicker.component.ts +++ b/components/datepicker/yearpicker.component.ts @@ -49,8 +49,8 @@ import { DatePickerInnerComponent } from './datepicker-inner.component'; }) export class YearPickerComponent implements OnInit { public datePicker:DatePickerInnerComponent; - private title:string; - private rows:Array = []; + protected title:string; + protected rows:Array = []; public constructor(datePicker:DatePickerInnerComponent) { this.datePicker = datePicker; @@ -89,7 +89,7 @@ export class YearPickerComponent implements OnInit { this.datePicker.refreshView(); } - private getStartingYear(year:number):number { + protected getStartingYear(year:number):number { // todo: parseInt return ((year - 1) / this.datePicker.yearRange) * this.datePicker.yearRange + 1; } diff --git a/components/dropdown/dropdown-keyboard-nav.directive.ts b/components/dropdown/dropdown-keyboard-nav.directive.ts index 9ddb5f2197..e63dc05849 100644 --- a/components/dropdown/dropdown-keyboard-nav.directive.ts +++ b/components/dropdown/dropdown-keyboard-nav.directive.ts @@ -9,8 +9,8 @@ const KeyboardEvent = (global as any).KeyboardEvent as KeyboardEvent; selector: '[dropdown][dropdownKeyboardNav]' }) export class KeyboardNavDirective { - private dd:DropdownDirective; - private el:ElementRef; + protected dd:DropdownDirective; + protected el:ElementRef; public constructor(dd:DropdownDirective, el:ElementRef) { this.dd = dd; diff --git a/components/dropdown/dropdown.directive.ts b/components/dropdown/dropdown.directive.ts index 1e18d7a36d..3facb4359e 100644 --- a/components/dropdown/dropdown.directive.ts +++ b/components/dropdown/dropdown.directive.ts @@ -31,9 +31,9 @@ export class DropdownDirective implements OnInit, OnDestroy { // drop down toggle element public toggleEl:ElementRef; public el:ElementRef; - private _isOpen:boolean; + protected _isOpen:boolean; - private _changeDetector:ChangeDetectorRef; + protected _changeDetector:ChangeDetectorRef; public constructor(el:ElementRef, ref:ChangeDetectorRef) { // @Query('dropdownMenu', {descendants: false}) diff --git a/components/dropdown/dropdown.service.ts b/components/dropdown/dropdown.service.ts index 1ce526ccad..cc3d616727 100644 --- a/components/dropdown/dropdown.service.ts +++ b/components/dropdown/dropdown.service.ts @@ -11,10 +11,10 @@ const KeyboardEvent = (global as any).KeyboardEvent as KeyboardEvent; const MouseEvent = (global as any).MouseEvent as MouseEvent; export class DropdownService { - private openScope:DropdownDirective; + protected openScope:DropdownDirective; - private closeDropdownBind:EventListener = this.closeDropdown.bind(this); - private keybindFilterBind:EventListener = this.keybindFilter.bind(this); + protected closeDropdownBind:EventListener = this.closeDropdown.bind(this); + protected keybindFilterBind:EventListener = this.keybindFilter.bind(this); public open(dropdownScope:DropdownDirective):void { if (!this.openScope) { @@ -39,7 +39,7 @@ export class DropdownService { window.document.removeEventListener('keydown', this.keybindFilterBind); } - private closeDropdown(event:MouseEvent):void { + protected closeDropdown(event:MouseEvent):void { if (!this.openScope) { return; } @@ -69,7 +69,7 @@ export class DropdownService { this.openScope.isOpen = false; } - private keybindFilter(event:KeyboardEvent):void { + protected keybindFilter(event:KeyboardEvent):void { if (event.which === 27) { this.openScope.focusToggleElement(); this.closeDropdown(void 0); diff --git a/components/modal/modal-backdrop.component.ts b/components/modal/modal-backdrop.component.ts index 9f326fdcc8..2478bc8e92 100644 --- a/components/modal/modal-backdrop.component.ts +++ b/components/modal/modal-backdrop.component.ts @@ -37,8 +37,8 @@ export class ModalBackdropComponent { public element:ElementRef; public renderer:Renderer; - private _isAnimated:boolean; - private _isShown:boolean = false; + protected _isAnimated:boolean; + protected _isShown:boolean = false; public constructor(options:ModalBackdropOptions, element:ElementRef, renderer:Renderer) { this.element = element; diff --git a/components/modal/modal.component.ts b/components/modal/modal.component.ts index 94c899b5dc..69daca02c2 100644 --- a/components/modal/modal.component.ts +++ b/components/modal/modal.component.ts @@ -58,22 +58,22 @@ export class ModalDirective implements AfterViewInit, OnDestroy { protected _config: ModalOptions; protected _isShown: boolean = false; - private isBodyOverflowing: boolean = false; - private originalBodyPadding: number = 0; - private scrollbarWidth: number = 0; + protected isBodyOverflowing: boolean = false; + protected originalBodyPadding: number = 0; + protected scrollbarWidth: number = 0; // reference to backdrop component - private backdrop: ComponentRef; + protected backdrop: ComponentRef; - private timerHideModal: number = 0; - private timerRmBackDrop: number = 0; + protected timerHideModal: number = 0; + protected timerRmBackDrop: number = 0; - private get document(): any { + protected get document(): any { return this.componentsHelper.getDocument(); }; /** Host element manipulations */ - // @HostBinding(`class.${ClassName.IN}`) private _addClassIn:boolean; + // @HostBinding(`class.${ClassName.IN}`) protected _addClassIn:boolean; @HostListener('click', ['$event']) public onClick(event: any): void { @@ -92,9 +92,9 @@ export class ModalDirective implements AfterViewInit, OnDestroy { } } - public constructor(private element: ElementRef, - private renderer: Renderer, - private componentsHelper: ComponentsHelper) { + public constructor(protected element: ElementRef, + protected renderer: Renderer, + protected componentsHelper: ComponentsHelper) { } public ngOnDestroy(): any { @@ -173,14 +173,14 @@ export class ModalDirective implements AfterViewInit, OnDestroy { } /** Private methods */ - private getConfig(config?: ModalOptions): ModalOptions { + protected getConfig(config?: ModalOptions): ModalOptions { return Object.assign({}, modalConfigDefaults, config); } /** * Show dialog */ - private showElement(/*relatedTarget?:ViewContainerRef*/): void { + protected showElement(/*relatedTarget?:ViewContainerRef*/): void { // todo: replace this with component helper usage `add to root` if (!this.element.nativeElement.parentNode || (this.element.nativeElement.parentNode.nodeType !== Node.ELEMENT_NODE)) { @@ -215,7 +215,7 @@ export class ModalDirective implements AfterViewInit, OnDestroy { } } - private hideModal(): void { + protected hideModal(): void { this.renderer.setElementAttribute(this.element.nativeElement, 'aria-hidden', 'true'); this.renderer.setElementStyle(this.element.nativeElement, 'display', 'none'); this.showBackdrop(() => { @@ -229,7 +229,7 @@ export class ModalDirective implements AfterViewInit, OnDestroy { } // todo: original show was calling a callback when done, but we can use promise - private showBackdrop(callback?: Function): void { + protected showBackdrop(callback?: Function): void { if (this._isShown && this.config.backdrop && (!this.backdrop || !this.backdrop.instance.isShown)) { this.removeBackdrop(); this.backdrop = this.componentsHelper @@ -274,7 +274,7 @@ export class ModalDirective implements AfterViewInit, OnDestroy { } } - private removeBackdrop(): void { + protected removeBackdrop(): void { if (this.backdrop) { this.backdrop.destroy(); this.backdrop = void 0; @@ -284,7 +284,7 @@ export class ModalDirective implements AfterViewInit, OnDestroy { /** Events tricks */ // no need for it - // private setEscapeEvent():void { + // protected setEscapeEvent():void { // if (this._isShown && this._config.keyboard) { // $(this._element).on(Event.KEYDOWN_DISMISS, (event) => { // if (event.which === 27) { @@ -297,7 +297,7 @@ export class ModalDirective implements AfterViewInit, OnDestroy { // } // } - // private setResizeEvent():void { + // protected setResizeEvent():void { // console.log(this.renderer.listenGlobal('', Event.RESIZE)); // if (this._isShown) { // $(window).on(Event.RESIZE, $.proxy(this._handleUpdate, this)) @@ -306,19 +306,19 @@ export class ModalDirective implements AfterViewInit, OnDestroy { // } // } - private resetAdjustments(): void { + protected resetAdjustments(): void { this.renderer.setElementStyle(this.element.nativeElement, 'paddingLeft', ''); this.renderer.setElementStyle(this.element.nativeElement, 'paddingRight', ''); } /** Scroll bar tricks */ - private checkScrollbar(): void { + protected checkScrollbar(): void { this.isBodyOverflowing = this.document.body.clientWidth < window.innerWidth; this.scrollbarWidth = this.getScrollbarWidth(); } - private setScrollbar(): void { + protected setScrollbar(): void { if (!this.document) { return; } @@ -337,12 +337,12 @@ export class ModalDirective implements AfterViewInit, OnDestroy { } } - private resetScrollbar(): void { + protected resetScrollbar(): void { this.document.body.style.paddingRight = this.originalBodyPadding; } // thx d.walsh - private getScrollbarWidth(): number { + protected getScrollbarWidth(): number { const scrollDiv = this.renderer.createElement(this.document.body, 'div', void 0); scrollDiv.className = ClassName.SCROLLBAR_MEASURER; const scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; diff --git a/components/modal/title.md b/components/modal/title.md index 9b5a0c739c..a9ac66d10f 100644 --- a/components/modal/title.md +++ b/components/modal/title.md @@ -10,7 +10,7 @@ import { Component, ViewContainerRef } from '@angular/core'; @Component({selector:'app-root'}) class AppRoot { - private viewContainerRef: ViewContainerRef; + protected viewContainerRef: ViewContainerRef; public constructor(viewContainerRef:ViewContainerRef) { // You need this small hack in order to catch application root view container ref diff --git a/components/ng2-bootstrap-config.ts b/components/ng2-bootstrap-config.ts index c2a58a4e0f..4e3dac04c7 100644 --- a/components/ng2-bootstrap-config.ts +++ b/components/ng2-bootstrap-config.ts @@ -3,7 +3,7 @@ import { window } from './utils/facade/browser'; export enum Ng2BootstrapTheme {BS3 = 1, BS4 = 2} export class Ng2BootstrapConfig { - private static _theme:Ng2BootstrapTheme; + protected static _theme:Ng2BootstrapTheme; public static get theme():Ng2BootstrapTheme { // hack as for now diff --git a/components/pagination/pagination.component.ts b/components/pagination/pagination.component.ts index 1e632e33ff..b4ee896121 100644 --- a/components/pagination/pagination.component.ts +++ b/components/pagination/pagination.component.ts @@ -165,11 +165,11 @@ export class PaginationComponent implements ControlValueAccessor, OnInit, Pagina public classMap:string; public pages:Array; - private _itemsPerPage:number; - private _totalItems:number; - private _totalPages:number; - private inited:boolean = false; - private _page:number; + protected _itemsPerPage:number; + protected _totalItems:number; + protected _totalPages:number; + protected inited:boolean = false; + protected _page:number; public constructor(@Self() cd:NgModel, renderer:Renderer, elementRef:ElementRef) { this.cd = cd; @@ -250,7 +250,7 @@ export class PaginationComponent implements ControlValueAccessor, OnInit, Pagina } // Create page object used in template - private makePage(num:number, text:string, isActive:boolean):{number:number, text:string, active:boolean} { + protected makePage(num:number, text:string, isActive:boolean):{number:number, text:string, active:boolean} { return { number: num, text: text, @@ -258,7 +258,7 @@ export class PaginationComponent implements ControlValueAccessor, OnInit, Pagina }; } - private getPages(currentPage:number, totalPages:number):Array { + protected getPages(currentPage:number, totalPages:number):Array { let pages:any[] = []; // Default page limits @@ -310,7 +310,7 @@ export class PaginationComponent implements ControlValueAccessor, OnInit, Pagina } // base class - private calculateTotalPages():number { + protected calculateTotalPages():number { let totalPages = this.itemsPerPage < 1 ? 1 : Math.ceil(this.totalItems / this.itemsPerPage); diff --git a/components/position.ts b/components/position.ts index b9d66fa0fb..e0a3f4b636 100644 --- a/components/position.ts +++ b/components/position.ts @@ -105,15 +105,15 @@ export class PositionService { return targetElPos; } - private get window():Window { + protected get window():Window { return window; } - private get document():Document { + protected get document():Document { return window.document; } - private getStyle(nativeEl:HTMLElement, cssProp:string):string { + protected getStyle(nativeEl:HTMLElement, cssProp:string):string { // IE if ((nativeEl as any).currentStyle) { return (nativeEl as any).currentStyle[cssProp]; @@ -130,7 +130,7 @@ export class PositionService { * Checks if a given element is statically positioned * @param nativeEl - raw DOM element */ - private isStaticPositioned(nativeEl:HTMLElement):boolean { + protected isStaticPositioned(nativeEl:HTMLElement):boolean { return (this.getStyle(nativeEl, 'position') || 'static' ) === 'static'; } @@ -139,7 +139,7 @@ export class PositionService { * element * @param nativeEl */ - private parentOffsetEl(nativeEl:HTMLElement):any { + protected parentOffsetEl(nativeEl:HTMLElement):any { let offsetParent:any = nativeEl.offsetParent || this.document; while (offsetParent && offsetParent !== this.document && this.isStaticPositioned(offsetParent)) { diff --git a/components/progressbar/bar.component.ts b/components/progressbar/bar.component.ts index 4f069756c2..24b0f49f82 100644 --- a/components/progressbar/bar.component.ts +++ b/components/progressbar/bar.component.ts @@ -39,7 +39,7 @@ export class BarComponent implements OnInit, OnDestroy { public transition:string; public progress:ProgressDirective; - private _value:number; + protected _value:number; public constructor(@Host() progress:ProgressDirective) { this.progress = progress; diff --git a/components/progressbar/progress.directive.ts b/components/progressbar/progress.directive.ts index 0b8c7b3089..eff920e45c 100644 --- a/components/progressbar/progress.directive.ts +++ b/components/progressbar/progress.directive.ts @@ -32,7 +32,7 @@ export class ProgressDirective implements OnInit { public bars:Array = []; - private _max:number; + protected _max:number; public ngOnInit():void { this.animate = this.animate !== false; diff --git a/components/rating/rating.component.ts b/components/rating/rating.component.ts index a680c4b967..9cc1ce8b74 100644 --- a/components/rating/rating.component.ts +++ b/components/rating/rating.component.ts @@ -37,7 +37,7 @@ export class RatingComponent implements ControlValueAccessor, OnInit { public cd:NgModel; public range:Array; public value:number; - private preValue:number; + protected preValue:number; @HostListener('keydown', ['$event']) public onKeydown(event:KeyboardEvent):void { @@ -103,7 +103,7 @@ export class RatingComponent implements ControlValueAccessor, OnInit { this.onTouched = fn; } - private buildTemplateObjects(ratingStates:Array, max:number):Array { + protected buildTemplateObjects(ratingStates:Array, max:number):Array { ratingStates = ratingStates || []; let count = ratingStates.length || max; let result:any[] = []; @@ -118,7 +118,7 @@ export class RatingComponent implements ControlValueAccessor, OnInit { return result; } - private rate(value:number):void { + protected rate(value:number):void { if (!this.readonly && value >= 0 && value <= this.range.length) { this.writeValue(value); this.cd.viewToModelUpdate(value); diff --git a/components/tabs/tab.directive.ts b/components/tabs/tab.directive.ts index 5e73c2db06..0793ca198a 100644 --- a/components/tabs/tab.directive.ts +++ b/components/tabs/tab.directive.ts @@ -47,7 +47,7 @@ export class TabDirective implements OnDestroy { public headingRef:TemplateRef; public tabset:TabsetComponent; - private _active:boolean; + protected _active:boolean; public constructor(tabset:TabsetComponent) { this.tabset = tabset; diff --git a/components/tabs/tabset.component.ts b/components/tabs/tabset.component.ts index c4cf7f02f5..67f2486130 100644 --- a/components/tabs/tabset.component.ts +++ b/components/tabs/tabset.component.ts @@ -60,10 +60,10 @@ export class TabsetComponent implements OnInit, OnDestroy { public tabs:Array = []; public classMap:any = {}; - private isDestroyed:boolean; - private _vertical:boolean; - private _justified:boolean; - private _type:string; + protected isDestroyed:boolean; + protected _vertical:boolean; + protected _justified:boolean; + protected _type:string; public ngOnInit():void { this.type = this.type !== 'undefined' ? this.type : 'tabs'; @@ -93,7 +93,7 @@ export class TabsetComponent implements OnInit, OnDestroy { this.tabs.splice(index, 1); } - private getClosestTabIndex(index:number):number { + protected getClosestTabIndex(index:number):number { let tabsLength = this.tabs.length; if (!tabsLength) { return -1; @@ -112,7 +112,7 @@ export class TabsetComponent implements OnInit, OnDestroy { return -1; } - private hasAvailableTabs(index:number):boolean { + protected hasAvailableTabs(index:number):boolean { let tabsLength = this.tabs.length; if (!tabsLength) { return false; @@ -126,7 +126,7 @@ export class TabsetComponent implements OnInit, OnDestroy { return false; } - private setClassMap():void { + protected setClassMap():void { this.classMap = { 'nav-stacked': this.vertical, 'nav-justified': this.justified, diff --git a/components/timepicker/timepicker.component.ts b/components/timepicker/timepicker.component.ts index 675271b98b..9a636715fd 100644 --- a/components/timepicker/timepicker.component.ts +++ b/components/timepicker/timepicker.component.ts @@ -128,16 +128,16 @@ export class TimepickerComponent implements ControlValueAccessor, OnInit { public invalidMinutes:any; // result value - private _selected:Date = new Date(); + protected _selected:Date = new Date(); - private _showMeridian:boolean; - private meridian:any; // ?? + protected _showMeridian:boolean; + protected meridian:any; // ?? - private get selected():Date { + protected get selected():Date { return this._selected; } - private set selected(v:Date) { + protected set selected(v:Date) { if (v) { this._selected = v; this.updateTemplate(); @@ -335,13 +335,13 @@ export class TimepickerComponent implements ControlValueAccessor, OnInit { } } - private refresh(/*type?:string*/):void { + protected refresh(/*type?:string*/):void { // this.makeValid(); this.updateTemplate(); this.cd.viewToModelUpdate(this.selected); } - private updateTemplate(/*keyboardChange?:any*/):void { + protected updateTemplate(/*keyboardChange?:any*/):void { let hours = this.selected.getHours(); let minutes = this.selected.getMinutes(); @@ -361,7 +361,7 @@ export class TimepickerComponent implements ControlValueAccessor, OnInit { : this.meridians[1]; } - private getHoursFromTemplate():number { + protected getHoursFromTemplate():number { let hours = parseInt(this.hours, 10); let valid = this.showMeridian ? (hours > 0 && hours < 13) @@ -381,23 +381,23 @@ export class TimepickerComponent implements ControlValueAccessor, OnInit { return hours; } - private getMinutesFromTemplate():number { + protected getMinutesFromTemplate():number { let minutes = parseInt(this.minutes, 10); return (minutes >= 0 && minutes < 60) ? minutes : undefined; } - private pad(value:string|number):string { + protected pad(value:string|number):string { return (isDefined(value) && value.toString().length < 2) ? '0' + value : value.toString(); } - private addMinutesToSelected(minutes:any):void { + protected addMinutesToSelected(minutes:any):void { this.selected = addMinutes(this.selected, minutes); this.refresh(); } - private noToggleMeridian():boolean { + protected noToggleMeridian():boolean { if (this.readonlyInput) { return true; } diff --git a/components/tooltip/readme.md b/components/tooltip/readme.md index 5697090dd6..f3593e550b 100644 --- a/components/tooltip/readme.md +++ b/components/tooltip/readme.md @@ -15,11 +15,11 @@ import { TooltipModule } from 'ng2-bootstrap/components/tooltip'; export class TooltipDirective { @Input('tooltip') public content:string; @Input('tooltipHtml') public htmlContent:string | TemplateRef; - @Input('tooltipPlacement') private placement:string = 'top'; - @Input('tooltipIsOpen') private isOpen:boolean; - @Input('tooltipEnable') private enable:boolean; - @Input('tooltipAppendToBody') private appendToBody:boolean; - @Input('tooltipClass') public popupClass:string; + @Input('tooltipPlacement') protected placement:string = 'top'; + @Input('tooltipIsOpen') protected isOpen:boolean; + @Input('tooltipEnable') protected enable:boolean; + @Input('tooltipAppendToBody') protected appendToBody:boolean; + @Input('tooltipClass') protected popupClass:string; @Input('tooltipContext') public tooltipContext:any; @Input('tooltipPopupDelay') public delay:number = 0; @Output() public tooltipStateChanged:EventEmitter; diff --git a/components/tooltip/tooltip-container.component.ts b/components/tooltip/tooltip-container.component.ts index 6aaf97e060..b49fdc7afa 100644 --- a/components/tooltip/tooltip-container.component.ts +++ b/components/tooltip/tooltip-container.component.ts @@ -36,17 +36,17 @@ export class TooltipContainerComponent implements AfterViewInit { public display:string = 'block'; public content:string; public htmlContent:string | TemplateRef; - private placement:string; - private popupClass:string; - private animation:boolean; - private isOpen:boolean; - private appendToBody:boolean; - private hostEl:ElementRef; - private context:any; + protected placement:string; + protected popupClass:string; + protected animation:boolean; + protected isOpen:boolean; + protected appendToBody:boolean; + protected hostEl:ElementRef; + protected context:any; /* tslint:enable */ - private element:ElementRef; - private cdr:ChangeDetectorRef; + protected element:ElementRef; + protected cdr:ChangeDetectorRef; public constructor(element:ElementRef, cdr:ChangeDetectorRef, diff --git a/components/tooltip/tooltip.directive.ts b/components/tooltip/tooltip.directive.ts index ee0ca38b28..dd8c56d0e6 100644 --- a/components/tooltip/tooltip.directive.ts +++ b/components/tooltip/tooltip.directive.ts @@ -40,11 +40,11 @@ export class TooltipDirective { public viewContainerRef: ViewContainerRef; public componentsHelper: ComponentsHelper; - private changeDetectorRef: ChangeDetectorRef; - private visible: boolean = false; - private tooltip: ComponentRef; + protected changeDetectorRef: ChangeDetectorRef; + protected visible: boolean = false; + protected tooltip: ComponentRef; - private delayTimeoutId: number; + protected delayTimeoutId: number; public constructor(viewContainerRef: ViewContainerRef, componentsHelper: ComponentsHelper, @@ -116,7 +116,7 @@ export class TooltipDirective { this.triggerStateChanged(); } - private triggerStateChanged(): void { + protected triggerStateChanged(): void { this.tooltipStateChanged.emit(this.visible); } } diff --git a/components/typeahead/readme.md b/components/typeahead/readme.md index 786fad0d63..b4cf03057e 100644 --- a/components/typeahead/readme.md +++ b/components/typeahead/readme.md @@ -30,13 +30,13 @@ export class TypeaheadDirective implements OnInit { @Input() public typeaheadItemTemplate:TemplateRef; // not yet implemented - @Input() private typeaheadAppendToBody:boolean; - @Input() private typeaheadEditable:boolean; - @Input() private typeaheadFocusFirst:boolean; - @Input() private typeaheadInputFormatter:any; - @Input() private typeaheadSelectOnExact:boolean; - @Input() private typeaheadSelectOnBlur:boolean; - @Input() private typeaheadFocusOnSelect:boolean; + @Input() protected typeaheadAppendToBody:boolean; + @Input() protected typeaheadEditable:boolean; + @Input() protected typeaheadFocusFirst:boolean; + @Input() protected typeaheadInputFormatter:any; + @Input() protected typeaheadSelectOnExact:boolean; + @Input() protected typeaheadSelectOnBlur:boolean; + @Input() protected typeaheadFocusOnSelect:boolean; } ``` diff --git a/components/typeahead/typeahead-container.component.ts b/components/typeahead/typeahead-container.component.ts index 2505304d30..558b2be8b2 100644 --- a/components/typeahead/typeahead-container.component.ts +++ b/components/typeahead/typeahead-container.component.ts @@ -78,9 +78,9 @@ export class TypeaheadContainerComponent { public left:string; public display:string; - private _active:TypeaheadMatch; - private _matches:Array = []; - private placement:string; + protected _active:TypeaheadMatch; + protected _matches:Array = []; + protected placement:string; public constructor(element:ElementRef, options:TypeaheadOptions) { this.element = element; @@ -185,7 +185,7 @@ export class TypeaheadContainerComponent { return this._active === value; } - private selectMatch(value:TypeaheadMatch, e:Event = void 0):boolean { + protected selectMatch(value:TypeaheadMatch, e:Event = void 0):boolean { if (e) { e.stopPropagation(); e.preventDefault(); diff --git a/components/typeahead/typeahead-match.class.ts b/components/typeahead/typeahead-match.class.ts index 50f3d5694a..3919534be8 100644 --- a/components/typeahead/typeahead-match.class.ts +++ b/components/typeahead/typeahead-match.class.ts @@ -1,7 +1,7 @@ export class TypeaheadMatch { - public constructor(readonly item:any, readonly value:string = item, private header:boolean = false) { + public constructor(readonly item:any, readonly value:string = item, protected header:boolean = false) { } public isHeader():boolean { diff --git a/components/typeahead/typeahead.directive.ts b/components/typeahead/typeahead.directive.ts index 756be38402..7264e18206 100644 --- a/components/typeahead/typeahead.directive.ts +++ b/components/typeahead/typeahead.directive.ts @@ -47,27 +47,27 @@ export class TypeaheadDirective implements OnInit { @Input() public typeaheadItemTemplate:TemplateRef; // not yet implemented - // @Input() private typeaheadAppendToBody:boolean; - // @Input() private typeaheadEditable:boolean; - // @Input() private typeaheadFocusFirst:boolean; - // @Input() private typeaheadInputFormatter:any; - // @Input() private typeaheadSelectOnExact:boolean; - // @Input() private typeaheadSelectOnBlur:boolean; - // @Input() private typeaheadFocusOnSelect:boolean; + // @Input() protected typeaheadAppendToBody:boolean; + // @Input() protected typeaheadEditable:boolean; + // @Input() protected typeaheadFocusFirst:boolean; + // @Input() protected typeaheadInputFormatter:any; + // @Input() protected typeaheadSelectOnExact:boolean; + // @Input() protected typeaheadSelectOnBlur:boolean; + // @Input() protected typeaheadFocusOnSelect:boolean; public container:TypeaheadContainerComponent; public isTypeaheadOptionsListActive:boolean = false; - private keyUpEventEmitter:EventEmitter = new EventEmitter(); - private _matches:Array; - private placement:string = 'bottom-left'; - private popup:ComponentRef; + protected keyUpEventEmitter:EventEmitter = new EventEmitter(); + protected _matches:Array; + protected placement:string = 'bottom-left'; + protected popup:ComponentRef; - private ngControl:NgControl; - private viewContainerRef:ViewContainerRef; - private element:ElementRef; - private renderer:Renderer; - private componentsHelper:ComponentsHelper; + protected ngControl:NgControl; + protected viewContainerRef:ViewContainerRef; + protected element:ElementRef; + protected renderer:Renderer; + protected componentsHelper:ComponentsHelper; @HostListener('keyup', ['$event']) public onChange(e:any):void { @@ -222,7 +222,7 @@ export class TypeaheadDirective implements OnInit { } } - private asyncActions():void { + protected asyncActions():void { this.keyUpEventEmitter .debounceTime(this.typeaheadWaitMs) .mergeMap(() => this.typeahead) @@ -236,7 +236,7 @@ export class TypeaheadDirective implements OnInit { ); } - private syncActions():void { + protected syncActions():void { this.keyUpEventEmitter .debounceTime(this.typeaheadWaitMs) .mergeMap((value:string) => { @@ -258,14 +258,14 @@ export class TypeaheadDirective implements OnInit { ); } - private normalizeOption(option:any):any { + protected normalizeOption(option:any):any { let optionValue:string = TypeaheadUtils.getValueFromObject(option, this.typeaheadOptionField); let normalizedOption = this.typeaheadLatinize ? TypeaheadUtils.latinize(optionValue) : optionValue; return normalizedOption.toLowerCase(); } - private normalizeQuery(value:string):any { + protected normalizeQuery(value:string):any { // If singleWords, break model here to not be doing extra work on each iteration let normalizedQuery:any = (this.typeaheadLatinize ? TypeaheadUtils.latinize(value) : value) @@ -278,7 +278,7 @@ export class TypeaheadDirective implements OnInit { return normalizedQuery; } - private testMatch(match:string, test:any):boolean { + protected testMatch(match:string, test:any):boolean { let spaceLength:number; if (typeof test === 'object') { @@ -294,7 +294,7 @@ export class TypeaheadDirective implements OnInit { } } - private finalizeAsyncCall(matches:any[]):void { + protected finalizeAsyncCall(matches:any[]):void { this.prepareMatches(matches); this.typeaheadLoading.emit(false); @@ -320,7 +320,7 @@ export class TypeaheadDirective implements OnInit { } } - private prepareMatches(options:any[]):void { + protected prepareMatches(options:any[]):void { let limited:any[] = options.slice(0, this.typeaheadOptionsLimit); if (this.typeaheadGroupField) { @@ -347,7 +347,7 @@ export class TypeaheadDirective implements OnInit { } } - private hasMatches():boolean { + protected hasMatches():boolean { return this._matches.length > 0; } } diff --git a/components/utils/components-helper.service.ts b/components/utils/components-helper.service.ts index 18dab19ab8..796fb2ee40 100644 --- a/components/utils/components-helper.service.ts +++ b/components/utils/components-helper.service.ts @@ -13,9 +13,9 @@ import { DOCUMENT } from '@angular/platform-browser'; export class ComponentsHelper { public root:ViewContainerRef; - public constructor(private applicationRef:ApplicationRef, - private componentFactoryResolver:ComponentFactoryResolver, - private injector:Injector) { + public constructor(protected applicationRef:ApplicationRef, + protected componentFactoryResolver:ComponentFactoryResolver, + protected injector:Injector) { } public getDocument():any {