File tree Expand file tree Collapse file tree 5 files changed +23
-5
lines changed Expand file tree Collapse file tree 5 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 1
1
< div class ="mat-calendar-header ">
2
2
< div class ="mat-calendar-controls ">
3
3
< button mat-button type ="button " class ="mat-calendar-period-button "
4
- (click) ="currentPeriodClicked() " [attr.aria-label] ="periodButtonLabel ">
4
+ (click) ="currentPeriodClicked() " [attr.aria-label] ="periodButtonLabel "
5
+ aria-live ="polite ">
5
6
{{periodButtonText}}
6
- < div class ="mat-calendar-arrow " [class.mat-calendar-invert] ="calendar.currentView != 'month' "> </ div >
7
+ < div class ="mat-calendar-arrow "
8
+ [class.mat-calendar-invert] ="calendar.currentView != 'month' "> </ div >
7
9
</ button >
8
10
9
11
< div class ="mat-calendar-spacer "> </ div >
Original file line number Diff line number Diff line change 15
15
16
16
< mat-year-view
17
17
*ngSwitchCase ="'year' "
18
- [activeDate] ="activeDate "
18
+ [( activeDate) ] ="activeDate "
19
19
[selected] ="selected "
20
20
[dateFilter] ="dateFilter "
21
21
[maxDate] ="maxDate "
26
26
27
27
< mat-multi-year-view
28
28
*ngSwitchCase ="'multi-year' "
29
- [activeDate] ="activeDate "
29
+ [( activeDate) ] ="activeDate "
30
30
[selected] ="selected "
31
31
[dateFilter] ="dateFilter "
32
32
[maxDate] ="maxDate "
Original file line number Diff line number Diff line change @@ -177,8 +177,8 @@ export class MatMonthView<D> implements AfterContentInit {
177
177
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
178
178
179
179
const oldActiveDate = this . _activeDate ;
180
-
181
180
const isRtl = this . _isRtl ( ) ;
181
+
182
182
switch ( event . keyCode ) {
183
183
case LEFT_ARROW :
184
184
this . activeDate = this . _dateAdapter . addCalendarDays ( this . _activeDate , isRtl ? 1 : - 1 ) ;
Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ export class MatMultiYearView<D> implements AfterContentInit {
101
101
/** Emits the selected year. This doesn't imply a change on the selected date */
102
102
@Output ( ) readonly yearSelected : EventEmitter < D > = new EventEmitter < D > ( ) ;
103
103
104
+ /** Emits when any date is activated. */
105
+ @Output ( ) readonly activeDateChange : EventEmitter < D > = new EventEmitter < D > ( ) ;
106
+
104
107
/** The body of calendar table */
105
108
@ViewChild ( MatCalendarBody ) _matCalendarBody : MatCalendarBody ;
106
109
@@ -159,6 +162,7 @@ export class MatMultiYearView<D> implements AfterContentInit {
159
162
// disabled ones from being selected. This may not be ideal, we should look into whether
160
163
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
161
164
165
+ const oldActiveDate = this . _activeDate ;
162
166
const isRtl = this . _isRtl ( ) ;
163
167
164
168
switch ( event . keyCode ) {
@@ -200,6 +204,10 @@ export class MatMultiYearView<D> implements AfterContentInit {
200
204
return ;
201
205
}
202
206
207
+ if ( this . _dateAdapter . compareDate ( oldActiveDate , this . activeDate ) ) {
208
+ this . activeDateChange . emit ( this . activeDate ) ;
209
+ }
210
+
203
211
this . _focusActiveCell ( ) ;
204
212
// Prevent unexpected default actions such as form submission.
205
213
event . preventDefault ( ) ;
Original file line number Diff line number Diff line change @@ -96,6 +96,9 @@ export class MatYearView<D> implements AfterContentInit {
96
96
/** Emits the selected month. This doesn't imply a change on the selected date */
97
97
@Output ( ) readonly monthSelected : EventEmitter < D > = new EventEmitter < D > ( ) ;
98
98
99
+ /** Emits when any date is activated. */
100
+ @Output ( ) readonly activeDateChange : EventEmitter < D > = new EventEmitter < D > ( ) ;
101
+
99
102
/** The body of calendar table */
100
103
@ViewChild ( MatCalendarBody ) _matCalendarBody : MatCalendarBody ;
101
104
@@ -152,6 +155,7 @@ export class MatYearView<D> implements AfterContentInit {
152
155
// disabled ones from being selected. This may not be ideal, we should look into whether
153
156
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
154
157
158
+ const oldActiveDate = this . _activeDate ;
155
159
const isRtl = this . _isRtl ( ) ;
156
160
157
161
switch ( event . keyCode ) {
@@ -191,6 +195,10 @@ export class MatYearView<D> implements AfterContentInit {
191
195
return ;
192
196
}
193
197
198
+ if ( this . _dateAdapter . compareDate ( oldActiveDate , this . activeDate ) ) {
199
+ this . activeDateChange . emit ( this . activeDate ) ;
200
+ }
201
+
194
202
this . _focusActiveCell ( ) ;
195
203
// Prevent unexpected default actions such as form submission.
196
204
event . preventDefault ( ) ;
You can’t perform that action at this time.
0 commit comments