@@ -16,7 +16,6 @@ import {
1616 PositionStrategy ,
1717 RepositionScrollStrategy ,
1818 ScrollStrategy ,
19- ConnectedPositionStrategy ,
2019} from '@angular/cdk/overlay' ;
2120import { ComponentPortal } from '@angular/cdk/portal' ;
2221import { take } from 'rxjs/operators/take' ;
@@ -36,8 +35,6 @@ import {
3635 ViewChild ,
3736 ViewContainerRef ,
3837 ViewEncapsulation ,
39- ChangeDetectorRef ,
40- OnInit ,
4138} from '@angular/core' ;
4239import { DateAdapter } from '@angular/material/core' ;
4340import { MatDialog , MatDialogRef } from '@angular/material/dialog' ;
@@ -47,7 +44,6 @@ import {Subscription} from 'rxjs/Subscription';
4744import { MatCalendar } from './calendar' ;
4845import { createMissingDateImplError } from './datepicker-errors' ;
4946import { MatDatepickerInput } from './datepicker-input' ;
50- import { trigger , state , style , animate , transition } from '@angular/animations' ;
5147
5248
5349/** Used to generate a unique ID for each datepicker instance. */
@@ -85,73 +81,23 @@ export const MAT_DATEPICKER_SCROLL_STRATEGY_PROVIDER = {
8581 styleUrls : [ 'datepicker-content.css' ] ,
8682 host : {
8783 'class' : 'mat-datepicker-content' ,
88- '[@tranformPanel]' : '"enter"' ,
8984 '[class.mat-datepicker-content-touch]' : 'datepicker.touchUi' ,
90- '[class.mat-datepicker-content-above]' : '_isAbove' ,
9185 '(keydown)' : '_handleKeydown($event)' ,
9286 } ,
93- animations : [
94- trigger ( 'tranformPanel' , [
95- state ( 'void' , style ( { opacity : 0 , transform : 'scale(1, 0)' } ) ) ,
96- state ( 'enter' , style ( { opacity : 1 , transform : 'scale(1, 1)' } ) ) ,
97- transition ( 'void => enter' , animate ( '400ms cubic-bezier(0.25, 0.8, 0.25, 1)' ) ) ,
98- transition ( '* => void' , animate ( '100ms linear' , style ( { opacity : 0 } ) ) )
99- ] ) ,
100- trigger ( 'fadeInCalendar' , [
101- state ( 'void' , style ( { opacity : 0 } ) ) ,
102- state ( 'enter' , style ( { opacity : 1 } ) ) ,
103- transition ( 'void => *' , animate ( '400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)' ) )
104- ] )
105- ] ,
10687 exportAs : 'matDatepickerContent' ,
10788 encapsulation : ViewEncapsulation . None ,
10889 preserveWhitespaces : false ,
10990 changeDetection : ChangeDetectionStrategy . OnPush ,
11091} )
111- export class MatDatepickerContent < D > implements AfterContentInit , OnInit , OnDestroy {
112- /** Subscription to changes in the overlay's position. */
113- private _positionChange : Subscription | null ;
114-
115- /** Reference to the internal calendar component. */
116- @ViewChild ( MatCalendar ) _calendar : MatCalendar < D > ;
117-
118- /** Reference to the datepicker that created the overlay. */
92+ export class MatDatepickerContent < D > implements AfterContentInit {
11993 datepicker : MatDatepicker < D > ;
12094
121- /** Whether the datepicker is above or below the input. */
122- _isAbove : boolean ;
123-
124- constructor ( private _changeDetectorRef : ChangeDetectorRef ) { }
125-
126- ngOnInit ( ) {
127- if ( ! this . datepicker . _popupRef || this . _positionChange ) {
128- return ;
129- }
130-
131- const positionStrategy =
132- this . datepicker . _popupRef . getConfig ( ) . positionStrategy ! as ConnectedPositionStrategy ;
133-
134- this . _positionChange = positionStrategy . onPositionChange . subscribe ( change => {
135- const isAbove = change . connectionPair . overlayY === 'bottom' ;
136-
137- if ( isAbove !== this . _isAbove ) {
138- this . _isAbove = isAbove ;
139- this . _changeDetectorRef . markForCheck ( ) ;
140- }
141- } ) ;
142- }
95+ @ViewChild ( MatCalendar ) _calendar : MatCalendar < D > ;
14396
14497 ngAfterContentInit ( ) {
14598 this . _calendar . _focusActiveCell ( ) ;
14699 }
147100
148- ngOnDestroy ( ) {
149- if ( this . _positionChange ) {
150- this . _positionChange . unsubscribe ( ) ;
151- this . _positionChange = null ;
152- }
153- }
154-
155101 /**
156102 * Handles keydown event on datepicker content.
157103 * @param event The event.
@@ -268,7 +214,7 @@ export class MatDatepicker<D> implements OnDestroy {
268214 }
269215
270216 /** A reference to the overlay when the calendar is opened as a popup. */
271- _popupRef : OverlayRef ;
217+ private _popupRef : OverlayRef ;
272218
273219 /** A reference to the dialog when the calendar is opened as a dialog. */
274220 private _dialogRef : MatDialogRef < any > | null ;
0 commit comments