From 69edcf6dab27d750738670ddecb423d35f45bcfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Fatay=20=C3=87ivici?= Date: Mon, 29 May 2017 15:56:59 +0300 Subject: [PATCH] Fixed #2764 --- components/autocomplete/autocomplete.ts | 6 +++--- components/calendar/calendar.ts | 6 +++--- components/carousel/carousel.ts | 6 +++--- components/confirmdialog/confirmdialog.ts | 8 ++++---- components/contextmenu/contextmenu.ts | 8 ++++---- components/datascroller/datascroller.ts | 6 +++--- components/datatable/datatable.ts | 22 +++++++++++----------- components/defer/defer.ts | 6 +++--- components/dialog/dialog.ts | 14 +++++++------- components/dom/domhandler.ts | 4 ++++ components/dropdown/dropdown.ts | 6 +++--- components/lightbox/lightbox.ts | 6 +++--- components/megamenu/megamenu.ts | 4 ++-- components/menu/menu.ts | 6 +++--- components/menubar/menubar.ts | 4 ++-- components/multiselect/multiselect.ts | 6 +++--- components/overlaypanel/overlaypanel.ts | 6 +++--- components/slidemenu/slidemenu.ts | 6 +++--- components/slider/slider.ts | 8 ++++---- components/splitbutton/splitbutton.ts | 6 +++--- components/tieredmenu/tieredmenu.ts | 6 +++--- 21 files changed, 77 insertions(+), 73 deletions(-) diff --git a/components/autocomplete/autocomplete.ts b/components/autocomplete/autocomplete.ts index 51451804291..8d7335d6261 100644 --- a/components/autocomplete/autocomplete.ts +++ b/components/autocomplete/autocomplete.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ViewChild,ElementRef,AfterViewInit,AfterContentInit,AfterViewChecked,Input,Output,EventEmitter,ContentChildren,QueryList,TemplateRef,Renderer,forwardRef,ChangeDetectorRef} from '@angular/core'; +import {NgModule,Component,ViewChild,ElementRef,AfterViewInit,AfterContentInit,AfterViewChecked,Input,Output,EventEmitter,ContentChildren,QueryList,TemplateRef,Renderer2,forwardRef,ChangeDetectorRef} from '@angular/core'; import {CommonModule} from '@angular/common'; import {InputTextModule} from '../inputtext/inputtext'; import {ButtonModule} from '../button/button'; @@ -154,7 +154,7 @@ export class AutoComplete implements AfterViewInit,AfterViewChecked,ControlValue noResults: boolean; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer, public objectUtils: ObjectUtils, public cd: ChangeDetectorRef) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public objectUtils: ObjectUtils, public cd: ChangeDetectorRef) {} @Input() get suggestions(): any[] { return this._suggestions; @@ -486,7 +486,7 @@ export class AutoComplete implements AfterViewInit,AfterViewChecked,ControlValue bindDocumentClickListener() { if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listenGlobal('document', 'click', (event) => { + this.documentClickListener = this.renderer.listen('document', 'click', (event) => { if(event.which === 3) { return; } diff --git a/components/calendar/calendar.ts b/components/calendar/calendar.ts index 4a4d20a67a6..c6907eae4f5 100644 --- a/components/calendar/calendar.ts +++ b/components/calendar/calendar.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,AfterViewInit,AfterViewChecked,OnDestroy,OnInit,Input,Output,SimpleChange,EventEmitter,forwardRef,Renderer,ViewChild,ChangeDetectorRef} from '@angular/core'; +import {NgModule,Component,ElementRef,AfterViewInit,AfterViewChecked,OnDestroy,OnInit,Input,Output,SimpleChange,EventEmitter,forwardRef,Renderer2,ViewChild,ChangeDetectorRef} from '@angular/core'; import {trigger,state,style,transition,animate} from '@angular/animations'; import {CommonModule} from '@angular/common'; import {ButtonModule} from '../button/button'; @@ -330,7 +330,7 @@ export class Calendar implements AfterViewInit,AfterViewChecked,OnInit,OnDestroy this.createMonth(this.currentMonth, this.currentYear); } - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer, public cd: ChangeDetectorRef) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public cd: ChangeDetectorRef) {} ngOnInit() { let date = this.defaultDate||new Date(); @@ -1243,7 +1243,7 @@ export class Calendar implements AfterViewInit,AfterViewChecked,OnInit,OnDestroy bindDocumentClickListener() { if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listenGlobal('document', 'click', () => { + this.documentClickListener = this.renderer.listen('document', 'click', () => { if(this.closeOverlay) { this.overlayVisible = false; } diff --git a/components/carousel/carousel.ts b/components/carousel/carousel.ts index 825e584b232..63fe8af3a37 100644 --- a/components/carousel/carousel.ts +++ b/components/carousel/carousel.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,AfterViewInit,AfterViewChecked,AfterContentInit,EventEmitter,OnDestroy,Input,Output,TemplateRef,ContentChildren,QueryList,Renderer,ViewChild} from '@angular/core'; +import {NgModule,Component,ElementRef,AfterViewInit,AfterViewChecked,AfterContentInit,EventEmitter,OnDestroy,Input,Output,TemplateRef,ContentChildren,QueryList,Renderer2,ViewChild} from '@angular/core'; import {DomHandler} from '../dom/domhandler'; import {SharedModule,PrimeTemplate} from '../common/shared'; import {CommonModule} from '@angular/common'; @@ -102,7 +102,7 @@ export class Carousel implements AfterViewChecked,AfterViewInit,OnDestroy{ differ: any; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} ngAfterContentInit() { this.templates.forEach((item) => { @@ -153,7 +153,7 @@ export class Carousel implements AfterViewChecked,AfterViewInit,OnDestroy{ this.itemsContainer = this.domHandler.findSingle(this.el.nativeElement, 'ul.ui-carousel-items'); if(this.responsive) { - this.documentResponsiveListener = this.renderer.listenGlobal('window', 'resize', (event) => { + this.documentResponsiveListener = this.renderer.listen('window', 'resize', (event) => { this.updateState(); }); } diff --git a/components/confirmdialog/confirmdialog.ts b/components/confirmdialog/confirmdialog.ts index 1b5bff20609..3476cea5301 100644 --- a/components/confirmdialog/confirmdialog.ts +++ b/components/confirmdialog/confirmdialog.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,EventEmitter,Renderer,ContentChild} from '@angular/core'; +import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,EventEmitter,Renderer2,ContentChild} from '@angular/core'; import {trigger,state,style,transition,animate} from '@angular/animations'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; @@ -100,7 +100,7 @@ export class ConfirmDialog implements AfterViewInit,OnDestroy { subscription: Subscription; constructor(public el: ElementRef, public domHandler: DomHandler, - public renderer: Renderer, private confirmationService: ConfirmationService) { + public renderer: Renderer2, private confirmationService: ConfirmationService) { this.subscription = confirmationService.requireConfirmation$.subscribe(confirmation => { if(confirmation.key === this.key) { this.confirmation = confirmation; @@ -151,13 +151,13 @@ export class ConfirmDialog implements AfterViewInit,OnDestroy { this.contentContainer = this.domHandler.findSingle(this.el.nativeElement, '.ui-dialog-content'); if(this.responsive) { - this.documentResponsiveListener = this.renderer.listenGlobal('window', 'resize', (event) => { + this.documentResponsiveListener = this.renderer.listen('window', 'resize', (event) => { this.center(); }); } if(this.closeOnEscape && this.closable) { - this.documentEscapeListener = this.renderer.listenGlobal('document', 'keydown', (event) => { + this.documentEscapeListener = this.renderer.listen('document', 'keydown', (event) => { if(event.which == 27) { if(this.el.nativeElement.children[0].style.zIndex == DomHandler.zindex) { this.hide(event); diff --git a/components/contextmenu/contextmenu.ts b/components/contextmenu/contextmenu.ts index 8c14b6c6c53..8144b5200cf 100644 --- a/components/contextmenu/contextmenu.ts +++ b/components/contextmenu/contextmenu.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer,EventEmitter,Inject,forwardRef,ViewChild} from '@angular/core'; +import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2,EventEmitter,Inject,forwardRef,ViewChild} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; import {MenuItem} from '../common/api'; @@ -151,17 +151,17 @@ export class ContextMenu implements AfterViewInit,OnDestroy { rightClickListener: any; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} ngAfterViewInit() { this.container = this.containerViewChild.nativeElement; - this.documentClickListener = this.renderer.listenGlobal('document', 'click', () => { + this.documentClickListener = this.renderer.listen('document', 'click', () => { this.hide(); }); if(this.global) { - this.rightClickListener = this.renderer.listenGlobal('document', 'contextmenu', (event) => { + this.rightClickListener = this.renderer.listen('document', 'contextmenu', (event) => { this.show(event); event.preventDefault(); }); diff --git a/components/datascroller/datascroller.ts b/components/datascroller/datascroller.ts index 6ab4498b1b6..88868ad6318 100644 --- a/components/datascroller/datascroller.ts +++ b/components/datascroller/datascroller.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,AfterViewInit,AfterContentInit,OnDestroy,Input,Output,Renderer,ViewChild,EventEmitter,ContentChild,ContentChildren,QueryList,TemplateRef} from '@angular/core'; +import {NgModule,Component,ElementRef,AfterViewInit,AfterContentInit,OnDestroy,Input,Output,Renderer2,ViewChild,EventEmitter,ContentChild,ContentChildren,QueryList,TemplateRef} from '@angular/core'; import {CommonModule} from '@angular/common'; import {Header,Footer,PrimeTemplate,SharedModule} from '../common/shared'; import {DomHandler} from '../dom/domhandler'; @@ -64,7 +64,7 @@ export class DataScroller implements AfterViewInit,OnDestroy { contentElement: HTMLDivElement; - constructor(public el: ElementRef, public renderer: Renderer, public domHandler: DomHandler) {} + constructor(public el: ElementRef, public renderer: Renderer2, public domHandler: DomHandler) {} ngAfterViewInit() { if(this.lazy) { @@ -167,7 +167,7 @@ export class DataScroller implements AfterViewInit,OnDestroy { }); } else { - this.scrollFunction = this.renderer.listenGlobal('window', 'scroll', () => { + this.scrollFunction = this.renderer.listen('window', 'scroll', () => { let docBody = document.body; let docElement = document.documentElement; let scrollTop = (window.pageYOffset||document.documentElement.scrollTop); diff --git a/components/datatable/datatable.ts b/components/datatable/datatable.ts index 77d299bc881..f76ec4e8fd9 100644 --- a/components/datatable/datatable.ts +++ b/components/datatable/datatable.ts @@ -1,5 +1,5 @@ import {NgModule,Component,ElementRef,AfterContentInit,AfterViewInit,AfterViewChecked,OnInit,OnDestroy,Input,ViewContainerRef,ViewChild, - Output,SimpleChange,EventEmitter,ContentChild,ContentChildren,Renderer,QueryList,TemplateRef,ChangeDetectorRef,Inject,forwardRef} from '@angular/core'; + Output,SimpleChange,EventEmitter,ContentChild,ContentChildren,Renderer2,QueryList,TemplateRef,ChangeDetectorRef,Inject,forwardRef} from '@angular/core'; import {CommonModule} from '@angular/common'; import {FormsModule} from '@angular/forms' import {SharedModule} from '../common/shared'; @@ -252,7 +252,7 @@ export class TableBody { }) export class ScrollableView implements AfterViewInit,AfterViewChecked,OnDestroy { - constructor(@Inject(forwardRef(() => DataTable)) public dt:DataTable, public domHandler: DomHandler, public el: ElementRef, public renderer: Renderer) {} + constructor(@Inject(forwardRef(() => DataTable)) public dt:DataTable, public domHandler: DomHandler, public el: ElementRef, public renderer: Renderer2) {} @Input("pScrollableView") columns: Column[]; @@ -704,7 +704,7 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni columnsSubscription: Subscription; constructor(public el: ElementRef, public domHandler: DomHandler, - public renderer: Renderer, public changeDetector: ChangeDetectorRef, public objectUtils: ObjectUtils) { + public renderer: Renderer2, public changeDetector: ChangeDetectorRef, public objectUtils: ObjectUtils) { } ngOnInit() { @@ -763,7 +763,7 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni } if(this.editable) { - this.documentClickListener = this.renderer.listenGlobal('document', 'click', (event) => { + this.documentClickListener = this.renderer.listen('document', 'click', (event) => { if(!this.editorClick) { this.closeCell(); } @@ -1535,7 +1535,7 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni this.domHandler.addClass(cell, 'ui-cell-editing'); let focusable = this.domHandler.findSingle(cell, '.ui-cell-editor input'); if(focusable) { - setTimeout(() => this.renderer.invokeElementMethod(focusable, 'focus'), 50); + setTimeout(() => this.domHandler.invokeElementMethod(focusable, 'focus'), 50); } } } @@ -1561,7 +1561,7 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni //enter if(event.keyCode == 13) { this.onEditComplete.emit({column: column, data: rowData, index: rowIndex}); - this.renderer.invokeElementMethod(event.target, 'blur'); + this.domHandler.invokeElementMethod(event.target, 'blur'); this.switchCellToViewMode(event.target); event.preventDefault(); } @@ -1569,7 +1569,7 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni //escape else if(event.keyCode == 27) { this.onEditCancel.emit({column: column, data: rowData, index: rowIndex}); - this.renderer.invokeElementMethod(event.target, 'blur'); + this.domHandler.invokeElementMethod(event.target, 'blur'); this.switchCellToViewMode(event.target); event.preventDefault(); } @@ -1592,7 +1592,7 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni let targetCell = this.findPreviousEditableColumn(currentCell); if(targetCell) { - this.renderer.invokeElementMethod(targetCell, 'click'); + this.domHandler.invokeElementMethod(targetCell, 'click'); event.preventDefault(); } } @@ -1603,7 +1603,7 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni let targetCell = this.findNextEditableColumn(currentCell); if(targetCell) { - this.renderer.invokeElementMethod(targetCell, 'click'); + this.domHandler.invokeElementMethod(targetCell, 'click'); event.preventDefault(); } } @@ -1672,13 +1672,13 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni this.resizerHelper = this.domHandler.findSingle(this.el.nativeElement, 'div.ui-column-resizer-helper'); this.fixColumnWidths(); - this.documentColumnResizeListener = this.renderer.listenGlobal('document', 'mousemove', (event) => { + this.documentColumnResizeListener = this.renderer.listen('document', 'mousemove', (event) => { if(this.columnResizing) { this.onColumnResize(event); } }); - this.documentColumnResizeEndListener = this.renderer.listenGlobal('document', 'mouseup', (event) => { + this.documentColumnResizeEndListener = this.renderer.listen('document', 'mouseup', (event) => { if(this.columnResizing) { this.columnResizing = false; this.onColumnResizeEnd(event); diff --git a/components/defer/defer.ts b/components/defer/defer.ts index d7a0315ccb3..c90e31ed9d2 100644 --- a/components/defer/defer.ts +++ b/components/defer/defer.ts @@ -1,5 +1,5 @@ import {NgModule,Directive,ElementRef,AfterViewInit,OnDestroy,Input,TemplateRef,EmbeddedViewRef, - ViewContainerRef,Renderer,EventEmitter,Output,ContentChild} from '@angular/core'; + ViewContainerRef,Renderer2,EventEmitter,Output,ContentChild} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; @@ -19,14 +19,14 @@ export class DeferredLoader implements AfterViewInit,OnDestroy { view: EmbeddedViewRef; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer, public viewContainer: ViewContainerRef) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public viewContainer: ViewContainerRef) {} ngAfterViewInit() { if(this.shouldLoad()) { this.load(); } - this.documentScrollListener = this.renderer.listenGlobal('window', 'scroll', () => { + this.documentScrollListener = this.renderer.listen('window', 'scroll', () => { if(this.shouldLoad()) { this.load(); this.documentScrollListener(); diff --git a/components/dialog/dialog.ts b/components/dialog/dialog.ts index c57161ff2b4..f8981943693 100644 --- a/components/dialog/dialog.ts +++ b/components/dialog/dialog.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,EventEmitter,Renderer,ContentChild,ViewChild} from '@angular/core'; +import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,EventEmitter,Renderer2,ContentChild,ViewChild} from '@angular/core'; import {trigger,state,style,transition,animate} from '@angular/animations'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; @@ -125,7 +125,7 @@ export class Dialog implements AfterViewInit,OnDestroy { closeIconMouseDown: boolean; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} @Input() get visible(): boolean { return this._visible; @@ -185,17 +185,17 @@ export class Dialog implements AfterViewInit,OnDestroy { this.contentContainer = this.contentViewChild.nativeElement; if(this.draggable) { - this.documentDragListener = this.renderer.listenGlobal('document', 'mousemove', (event) => { + this.documentDragListener = this.renderer.listen('document', 'mousemove', (event) => { this.onDrag(event); }); } if(this.resizable) { - this.documentResizeListener = this.renderer.listenGlobal('document', 'mousemove', (event) => { + this.documentResizeListener = this.renderer.listen('document', 'mousemove', (event) => { this.onResize(event); }); - this.documentResizeEndListener = this.renderer.listenGlobal('document', 'mouseup', (event) => { + this.documentResizeEndListener = this.renderer.listen('document', 'mouseup', (event) => { if(this.resizing) { this.resizing = false; } @@ -203,13 +203,13 @@ export class Dialog implements AfterViewInit,OnDestroy { } if(this.responsive) { - this.documentResponsiveListener = this.renderer.listenGlobal('window', 'resize', (event) => { + this.documentResponsiveListener = this.renderer.listen('window', 'resize', (event) => { this.positionOverlay(); }); } if(this.closeOnEscape && this.closable) { - this.documentEscapeListener = this.renderer.listenGlobal('document', 'keydown', (event) => { + this.documentEscapeListener = this.renderer.listen('document', 'keydown', (event) => { if(event.which == 27) { if(parseInt(this.container.style.zIndex) == DomHandler.zindex) { this.close(event); diff --git a/components/dom/domhandler.ts b/components/dom/domhandler.ts index 208d2ea26b9..47d9ebed42e 100644 --- a/components/dom/domhandler.ts +++ b/components/dom/domhandler.ts @@ -378,4 +378,8 @@ export class DomHandler { return scrollbarWidth; } + + public invokeElementMethod(element: any, methodName: string, args?: any[]): void { + (element as any)[methodName].apply(element, args); + } } diff --git a/components/dropdown/dropdown.ts b/components/dropdown/dropdown.ts index 3735e70cd4f..97a54a906fd 100644 --- a/components/dropdown/dropdown.ts +++ b/components/dropdown/dropdown.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,OnInit,AfterViewInit,AfterContentInit,AfterViewChecked,OnDestroy,Input,Output,Renderer,EventEmitter,ContentChildren, +import {NgModule,Component,ElementRef,OnInit,AfterViewInit,AfterContentInit,AfterViewChecked,OnDestroy,Input,Output,Renderer2,EventEmitter,ContentChildren, QueryList,ViewChild,TemplateRef,forwardRef,ChangeDetectorRef} from '@angular/core'; import {trigger,state,style,transition,animate} from '@angular/animations'; import {CommonModule} from '@angular/common'; @@ -164,7 +164,7 @@ export class Dropdown implements OnInit,AfterViewInit,AfterContentInit,AfterView public selectedOptionUpdated: boolean; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer, private cd: ChangeDetectorRef, public objectUtils: ObjectUtils) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, private cd: ChangeDetectorRef, public objectUtils: ObjectUtils) {} ngAfterContentInit() { this.templates.forEach((item) => { @@ -496,7 +496,7 @@ export class Dropdown implements OnInit,AfterViewInit,AfterContentInit,AfterView bindDocumentClickListener() { if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listenGlobal('document', 'click', () => { + this.documentClickListener = this.renderer.listen('document', 'click', () => { if(!this.selfClick&&!this.itemClick) { this.panelVisible = false; this.unbindDocumentClickListener(); diff --git a/components/lightbox/lightbox.ts b/components/lightbox/lightbox.ts index aae6ac614c2..afdd1422792 100644 --- a/components/lightbox/lightbox.ts +++ b/components/lightbox/lightbox.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,Input,Output,Renderer,AfterViewInit,OnDestroy} from '@angular/core'; +import {NgModule,Component,ElementRef,Input,Output,Renderer2,AfterViewInit,OnDestroy} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; @@ -70,7 +70,7 @@ export class Lightbox implements AfterViewInit,OnDestroy{ public documentClickListener: any; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} onImageClick(event,image,i,content) { this.index = i; @@ -94,7 +94,7 @@ export class Lightbox implements AfterViewInit,OnDestroy{ this.domHandler.appendChild(this.panel, this.appendTo); } - this.documentClickListener = this.renderer.listenGlobal('document', 'click', (event) => { + this.documentClickListener = this.renderer.listen('document', 'click', (event) => { if(!this.preventDocumentClickListener&&this.visible) { this.hide(event); } diff --git a/components/megamenu/megamenu.ts b/components/megamenu/megamenu.ts index a946107e136..016845eec5f 100644 --- a/components/megamenu/megamenu.ts +++ b/components/megamenu/megamenu.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer,EventEmitter} from '@angular/core'; +import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2,EventEmitter} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; import {MenuItem} from '../common/api'; @@ -63,7 +63,7 @@ export class MegaMenu implements OnDestroy { activeItem: any; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} onItemMouseEnter(event, item, menuitem: MenuItem) { if(menuitem.disabled) { diff --git a/components/menu/menu.ts b/components/menu/menu.ts index 74a419e8f43..7b3f8179ab0 100644 --- a/components/menu/menu.ts +++ b/components/menu/menu.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer,HostListener,EventEmitter,ViewChild} from '@angular/core'; +import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2,HostListener,EventEmitter,ViewChild} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; import {MenuItem} from '../common/api'; @@ -67,7 +67,7 @@ export class Menu implements AfterViewInit,OnDestroy { onResizeTarget: any; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} ngAfterViewInit() { this.container = this.containerViewChild.nativeElement; @@ -80,7 +80,7 @@ export class Menu implements AfterViewInit,OnDestroy { this.domHandler.appendChild(this.container, this.appendTo); } - this.documentClickListener = this.renderer.listenGlobal('document', 'click', () => { + this.documentClickListener = this.renderer.listen('document', 'click', () => { if(!this.preventDocumentDefault) { this.hide(); } diff --git a/components/menubar/menubar.ts b/components/menubar/menubar.ts index 788d7ac4ed7..87d731c0bc4 100644 --- a/components/menubar/menubar.ts +++ b/components/menubar/menubar.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer,EventEmitter} from '@angular/core'; +import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2,EventEmitter} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; import {MenuItem} from '../common/api'; @@ -117,7 +117,7 @@ export class Menubar implements OnDestroy { @Input() styleClass: string; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} unsubscribe(item: any) { if(item.eventEmitter) { diff --git a/components/multiselect/multiselect.ts b/components/multiselect/multiselect.ts index 7fbe3909cf8..ec0b6975ba4 100644 --- a/components/multiselect/multiselect.ts +++ b/components/multiselect/multiselect.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,OnInit,AfterViewInit,AfterViewChecked,DoCheck,OnDestroy,Input,Output,Renderer,EventEmitter,IterableDiffers,forwardRef,ViewChild} from '@angular/core'; +import {NgModule,Component,ElementRef,OnInit,AfterViewInit,AfterViewChecked,DoCheck,OnDestroy,Input,Output,Renderer2,EventEmitter,IterableDiffers,forwardRef,ViewChild} from '@angular/core'; import {CommonModule} from '@angular/common'; import {SelectItem} from '../common/api'; import {DomHandler} from '../dom/domhandler'; @@ -135,7 +135,7 @@ export class MultiSelect implements OnInit,AfterViewInit,AfterViewChecked,DoChec public optionsDiffer: any; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer, differs: IterableDiffers, public objectUtils: ObjectUtils) { + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, differs: IterableDiffers, public objectUtils: ObjectUtils) { this.valueDiffer = differs.find([]).create(null); this.optionsDiffer = differs.find([]).create(null); } @@ -143,7 +143,7 @@ export class MultiSelect implements OnInit,AfterViewInit,AfterViewChecked,DoChec ngOnInit() { this.updateLabel(); - this.documentClickListener = this.renderer.listenGlobal('document', 'click', () => { + this.documentClickListener = this.renderer.listen('document', 'click', () => { if(!this.selfClick && !this.panelClick && this.overlayVisible) { this.hide(); } diff --git a/components/overlaypanel/overlaypanel.ts b/components/overlaypanel/overlaypanel.ts index 8558005009b..0c742ffbca0 100644 --- a/components/overlaypanel/overlaypanel.ts +++ b/components/overlaypanel/overlaypanel.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,Input,Output,OnInit,AfterViewInit,OnDestroy,EventEmitter,Renderer,ElementRef,ChangeDetectorRef} from '@angular/core'; +import {NgModule,Component,Input,Output,OnInit,AfterViewInit,OnDestroy,EventEmitter,Renderer2,ElementRef,ChangeDetectorRef} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; @@ -49,11 +49,11 @@ export class OverlayPanel implements OnInit,AfterViewInit,OnDestroy { target: any; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer, private cd: ChangeDetectorRef) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, private cd: ChangeDetectorRef) {} ngOnInit() { if(this.dismissable) { - this.documentClickListener = this.renderer.listenGlobal('document', 'click', () => { + this.documentClickListener = this.renderer.listen('document', 'click', () => { if(!this.selfClick&&!this.targetEvent) { this.hide(); } diff --git a/components/slidemenu/slidemenu.ts b/components/slidemenu/slidemenu.ts index 58929464ad3..145bee9e582 100644 --- a/components/slidemenu/slidemenu.ts +++ b/components/slidemenu/slidemenu.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer,EventEmitter,Inject,forwardRef,ViewChild} from '@angular/core'; +import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2,EventEmitter,Inject,forwardRef,ViewChild} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; import {MenuItem} from '../common/api'; @@ -143,7 +143,7 @@ export class SlideMenu implements AfterViewInit,OnDestroy { public animating: boolean = false; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} ngAfterViewInit() { this.container = this.containerViewChild.nativeElement; @@ -152,7 +152,7 @@ export class SlideMenu implements AfterViewInit,OnDestroy { this.slideMenuContentElement.style.height = this.viewportHeight - this.domHandler.getHiddenElementOuterHeight(this.backwardElement) + 'px'; if(this.popup) { - this.documentClickListener = this.renderer.listenGlobal('document', 'click', () => { + this.documentClickListener = this.renderer.listen('document', 'click', () => { if(!this.preventDocumentDefault) { this.hide(); } diff --git a/components/slider/slider.ts b/components/slider/slider.ts index 3ec5b12daef..81db12eb577 100644 --- a/components/slider/slider.ts +++ b/components/slider/slider.ts @@ -1,4 +1,4 @@ -import {NgModule,Component, ElementRef,AfterViewInit,OnDestroy,Input,Output,SimpleChange,EventEmitter,forwardRef,Renderer} from '@angular/core'; +import {NgModule,Component, ElementRef,AfterViewInit,OnDestroy,Input,Output,SimpleChange,EventEmitter,forwardRef,Renderer2} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; @@ -87,7 +87,7 @@ export class Slider implements AfterViewInit,OnDestroy,ControlValueAccessor { public starty: number; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} onMouseDown(event:Event,index?:number) { if(this.disabled) { @@ -152,13 +152,13 @@ export class Slider implements AfterViewInit,OnDestroy,ControlValueAccessor { return; } - this.dragListener = this.renderer.listenGlobal('document', 'mousemove', (event) => { + this.dragListener = this.renderer.listen('document', 'mousemove', (event) => { if(this.dragging) { this.handleChange(event); } }); - this.mouseupListener = this.renderer.listenGlobal('document', 'mouseup', (event) => { + this.mouseupListener = this.renderer.listen('document', 'mouseup', (event) => { if(this.dragging) { this.dragging = false; if(this.range) { diff --git a/components/splitbutton/splitbutton.ts b/components/splitbutton/splitbutton.ts index e56316548be..aaeaa73c905 100644 --- a/components/splitbutton/splitbutton.ts +++ b/components/splitbutton/splitbutton.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,OnInit,OnDestroy,Input,Output,EventEmitter,ContentChildren,QueryList,Renderer,ChangeDetectorRef} from '@angular/core'; +import {NgModule,Component,ElementRef,OnInit,OnDestroy,Input,Output,EventEmitter,ContentChildren,QueryList,Renderer2,ChangeDetectorRef} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; import {MenuItem} from '../common/api'; @@ -58,10 +58,10 @@ export class SplitButton implements OnInit,OnDestroy { public documentClickListener: any; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer, public router: Router, public cd: ChangeDetectorRef) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public router: Router, public cd: ChangeDetectorRef) {} ngOnInit() { - this.documentClickListener = this.renderer.listenGlobal('document', 'click', () => { + this.documentClickListener = this.renderer.listen('document', 'click', () => { this.menuVisible = false; this.cd.markForCheck(); }); diff --git a/components/tieredmenu/tieredmenu.ts b/components/tieredmenu/tieredmenu.ts index f24d83996af..3a6df668ad6 100644 --- a/components/tieredmenu/tieredmenu.ts +++ b/components/tieredmenu/tieredmenu.ts @@ -1,4 +1,4 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer,EventEmitter} from '@angular/core'; +import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2,EventEmitter} from '@angular/core'; import {CommonModule} from '@angular/common'; import {DomHandler} from '../dom/domhandler'; import {MenuItem} from '../common/api'; @@ -115,13 +115,13 @@ export class TieredMenu implements AfterViewInit,OnDestroy { preventDocumentDefault: any; - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer) {} + constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} ngAfterViewInit() { this.container = this.el.nativeElement.children[0]; if(this.popup) { - this.documentClickListener = this.renderer.listenGlobal('document', 'click', () => { + this.documentClickListener = this.renderer.listen('document', 'click', () => { if(!this.preventDocumentDefault) { this.hide(); }