@@ -151,26 +151,18 @@ export class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>>
151
151
152
152
constructor (
153
153
elementRef : ElementRef ,
154
- /**
155
- * @deprecated `_changeDetectorRef`, `_model` and `_rangeSelectionStrategy`
156
- * parameters to become required.
157
- * @breaking -change 11.0.0
158
- */
159
- private _changeDetectorRef ?: ChangeDetectorRef ,
160
- private _model ?: MatDateSelectionModel < S , D > ,
161
- private _dateAdapter ?: DateAdapter < D > ,
154
+ private _changeDetectorRef : ChangeDetectorRef ,
155
+ private _model : MatDateSelectionModel < S , D > ,
156
+ private _dateAdapter : DateAdapter < D > ,
162
157
@Optional ( ) @Inject ( MAT_DATE_RANGE_SELECTION_STRATEGY )
163
- private _rangeSelectionStrategy ? : MatDateRangeSelectionStrategy < D > ) {
158
+ private _rangeSelectionStrategy : MatDateRangeSelectionStrategy < D > ) {
164
159
super ( elementRef ) ;
165
160
}
166
161
167
162
ngAfterViewInit ( ) {
168
- // @breaking -change 11.0.0 Remove null check for `_changeDetectorRef.
169
- if ( this . _changeDetectorRef ) {
170
- this . _subscriptions . add ( this . datepicker . _stateChanges . subscribe ( ( ) => {
171
- this . _changeDetectorRef ! . markForCheck ( ) ;
172
- } ) ) ;
173
- }
163
+ this . _subscriptions . add ( this . datepicker . _stateChanges . subscribe ( ( ) => {
164
+ this . _changeDetectorRef . markForCheck ( ) ;
165
+ } ) ) ;
174
166
175
167
this . _calendar . focusActiveCell ( ) ;
176
168
}
@@ -181,26 +173,22 @@ export class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>>
181
173
}
182
174
183
175
_handleUserSelection ( event : MatCalendarUserEvent < D | null > ) {
184
- // @breaking -change 11.0.0 Remove null checks for _model,
185
- // _rangeSelectionStrategy and _dateAdapter.
186
- if ( this . _model && this . _dateAdapter ) {
187
- const selection = this . _model . selection ;
188
- const value = event . value ;
189
- const isRange = selection instanceof DateRange ;
190
-
191
- // If we're selecting a range and we have a selection strategy, always pass the value through
192
- // there. Otherwise don't assign null values to the model, unless we're selecting a range.
193
- // A null value when picking a range means that the user cancelled the selection (e.g. by
194
- // pressing escape), whereas when selecting a single value it means that the value didn't
195
- // change. This isn't very intuitive, but it's here for backwards-compatibility.
196
- if ( isRange && this . _rangeSelectionStrategy ) {
197
- const newSelection = this . _rangeSelectionStrategy . selectionFinished ( value ,
198
- selection as unknown as DateRange < D > , event . event ) ;
199
- this . _model . updateSelection ( newSelection as unknown as S , this ) ;
200
- } else if ( value && ( isRange ||
201
- ! this . _dateAdapter . sameDate ( value , selection as unknown as D ) ) ) {
202
- this . _model . add ( value ) ;
203
- }
176
+ const selection = this . _model . selection ;
177
+ const value = event . value ;
178
+ const isRange = selection instanceof DateRange ;
179
+
180
+ // If we're selecting a range and we have a selection strategy, always pass the value through
181
+ // there. Otherwise don't assign null values to the model, unless we're selecting a range.
182
+ // A null value when picking a range means that the user cancelled the selection (e.g. by
183
+ // pressing escape), whereas when selecting a single value it means that the value didn't
184
+ // change. This isn't very intuitive, but it's here for backwards-compatibility.
185
+ if ( isRange && this . _rangeSelectionStrategy ) {
186
+ const newSelection = this . _rangeSelectionStrategy . selectionFinished ( value ,
187
+ selection as unknown as DateRange < D > , event . event ) ;
188
+ this . _model . updateSelection ( newSelection as unknown as S , this ) ;
189
+ } else if ( value && ( isRange ||
190
+ ! this . _dateAdapter . sameDate ( value , selection as unknown as D ) ) ) {
191
+ this . _model . add ( value ) ;
204
192
}
205
193
206
194
if ( ! this . _model || this . _model . isComplete ( ) ) {
@@ -210,16 +198,11 @@ export class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>>
210
198
211
199
_startExitAnimation ( ) {
212
200
this . _animationState = 'void' ;
213
-
214
- // @breaking -change 11.0.0 Remove null check for `_changeDetectorRef`.
215
- if ( this . _changeDetectorRef ) {
216
- this . _changeDetectorRef . markForCheck ( ) ;
217
- }
201
+ this . _changeDetectorRef . markForCheck ( ) ;
218
202
}
219
203
220
204
_getSelected ( ) {
221
- // @breaking -change 11.0.0 Remove null check for `_model`.
222
- return this . _model ? this . _model . selection as unknown as D | DateRange < D > | null : null ;
205
+ return this . _model . selection as unknown as D | DateRange < D > | null ;
223
206
}
224
207
}
225
208
0 commit comments