@@ -8,7 +8,7 @@ import { NgDate } from '../../models/ngDate';
88 styleUrls : [ './ngdatepicker.component.scss' ] ,
99 changeDetection : ChangeDetectionStrategy . OnPush
1010} )
11- export class NgDatepickerComponent implements AfterViewChecked {
11+ export class NgDatepickerComponent {
1212 private readonly yearCellsCount : number = 16 ;
1313 private readonly dayTimespan : number = 24 * 3600 * 1000 ;
1414 private readonly datesRows : number = 6 ;
@@ -29,10 +29,6 @@ export class NgDatepickerComponent implements AfterViewChecked {
2929
3030 constructor ( private readonly changeDetectorRef : ChangeDetectorRef ) { }
3131
32- ngAfterViewChecked ( ) {
33- this . changeDetectorRef . markForCheck ( ) ;
34- }
35-
3632 get monthString ( ) : string {
3733 return this . months [ this . month ] ;
3834 }
@@ -158,7 +154,12 @@ export class NgDatepickerComponent implements AfterViewChecked {
158154 this . year = this . date . getFullYear ( ) ;
159155 }
160156
161- backwards ( ) {
157+ backwards ( e : Event ) {
158+ if ( e ) {
159+ e . stopPropagation ( ) ;
160+ e . stopImmediatePropagation ( ) ;
161+ }
162+
162163 switch ( this . currentDatepickerView ) {
163164 case DatepickerView . Days :
164165 this . month -- ;
@@ -194,7 +195,12 @@ export class NgDatepickerComponent implements AfterViewChecked {
194195 this . changeDetectorRef . markForCheck ( ) ;
195196 }
196197
197- forwards ( ) {
198+ forwards ( e : Event ) {
199+ if ( e ) {
200+ e . stopPropagation ( ) ;
201+ e . stopImmediatePropagation ( ) ;
202+ }
203+
198204 switch ( this . currentDatepickerView ) {
199205 case DatepickerView . Days :
200206 this . month ++ ;
@@ -253,12 +259,12 @@ export class NgDatepickerComponent implements AfterViewChecked {
253259 ( ngDate . date . getMonth ( ) < this . month && ngDate . date . getFullYear ( ) === this . year ) ||
254260 ( ngDate . date . getMonth ( ) > this . month && ngDate . date . getFullYear ( ) < this . year )
255261 ) {
256- this . backwards ( ) ;
262+ this . backwards ( e ) ;
257263 } else if (
258264 ( ngDate . date . getMonth ( ) > this . month && ngDate . date . getFullYear ( ) === this . year ) ||
259265 ( ngDate . date . getMonth ( ) < this . month && ngDate . date . getFullYear ( ) > this . year )
260266 ) {
261- this . forwards ( ) ;
267+ this . forwards ( e ) ;
262268 }
263269 } else {
264270 if ( this . minDate ) {
@@ -272,7 +278,7 @@ export class NgDatepickerComponent implements AfterViewChecked {
272278 return ;
273279 }
274280 }
275-
281+
276282 this . dateChanged . emit ( ngDate . date ) ;
277283 this . hide ( ) ;
278284 }
0 commit comments