@@ -16,7 +16,6 @@ import {
16
16
PositionStrategy ,
17
17
RepositionScrollStrategy ,
18
18
ScrollStrategy ,
19
- ConnectedPositionStrategy ,
20
19
} from '@angular/cdk/overlay' ;
21
20
import { ComponentPortal } from '@angular/cdk/portal' ;
22
21
import { take } from 'rxjs/operators/take' ;
@@ -36,8 +35,6 @@ import {
36
35
ViewChild ,
37
36
ViewContainerRef ,
38
37
ViewEncapsulation ,
39
- ChangeDetectorRef ,
40
- OnInit ,
41
38
} from '@angular/core' ;
42
39
import { DateAdapter } from '@angular/material/core' ;
43
40
import { MatDialog , MatDialogRef } from '@angular/material/dialog' ;
@@ -47,7 +44,6 @@ import {Subscription} from 'rxjs/Subscription';
47
44
import { MatCalendar } from './calendar' ;
48
45
import { createMissingDateImplError } from './datepicker-errors' ;
49
46
import { MatDatepickerInput } from './datepicker-input' ;
50
- import { trigger , state , style , animate , transition } from '@angular/animations' ;
51
47
52
48
53
49
/** Used to generate a unique ID for each datepicker instance. */
@@ -85,73 +81,23 @@ export const MAT_DATEPICKER_SCROLL_STRATEGY_PROVIDER = {
85
81
styleUrls : [ 'datepicker-content.css' ] ,
86
82
host : {
87
83
'class' : 'mat-datepicker-content' ,
88
- '[@tranformPanel]' : '"enter"' ,
89
84
'[class.mat-datepicker-content-touch]' : 'datepicker.touchUi' ,
90
- '[class.mat-datepicker-content-above]' : '_isAbove' ,
91
85
'(keydown)' : '_handleKeydown($event)' ,
92
86
} ,
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
- ] ,
106
87
exportAs : 'matDatepickerContent' ,
107
88
encapsulation : ViewEncapsulation . None ,
108
89
preserveWhitespaces : false ,
109
90
changeDetection : ChangeDetectionStrategy . OnPush ,
110
91
} )
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 {
119
93
datepicker : MatDatepicker < D > ;
120
94
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 > ;
143
96
144
97
ngAfterContentInit ( ) {
145
98
this . _calendar . _focusActiveCell ( ) ;
146
99
}
147
100
148
- ngOnDestroy ( ) {
149
- if ( this . _positionChange ) {
150
- this . _positionChange . unsubscribe ( ) ;
151
- this . _positionChange = null ;
152
- }
153
- }
154
-
155
101
/**
156
102
* Handles keydown event on datepicker content.
157
103
* @param event The event.
@@ -268,7 +214,7 @@ export class MatDatepicker<D> implements OnDestroy {
268
214
}
269
215
270
216
/** A reference to the overlay when the calendar is opened as a popup. */
271
- _popupRef : OverlayRef ;
217
+ private _popupRef : OverlayRef ;
272
218
273
219
/** A reference to the dialog when the calendar is opened as a dialog. */
274
220
private _dialogRef : MatDialogRef < any > | null ;
0 commit comments