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 @@ -178,8 +178,8 @@ export class MatMonthView<D> implements AfterContentInit {
178
178
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
179
179
180
180
const oldActiveDate = this . _activeDate ;
181
-
182
181
const isRtl = this . _isRtl ( ) ;
182
+
183
183
switch ( event . keyCode ) {
184
184
case LEFT_ARROW :
185
185
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 ;
106
109
@@ -160,6 +163,7 @@ export class MatMultiYearView<D> implements AfterContentInit {
160
163
// disabled ones from being selected. This may not be ideal, we should look into whether
161
164
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
162
165
166
+ const oldActiveDate = this . _activeDate ;
163
167
const isRtl = this . _isRtl ( ) ;
164
168
165
169
switch ( event . keyCode ) {
@@ -201,6 +205,10 @@ export class MatMultiYearView<D> implements AfterContentInit {
201
205
return ;
202
206
}
203
207
208
+ if ( this . _dateAdapter . compareDate ( oldActiveDate , this . activeDate ) ) {
209
+ this . activeDateChange . emit ( this . activeDate ) ;
210
+ }
211
+
204
212
this . _focusActiveCell ( ) ;
205
213
// Prevent unexpected default actions such as form submission.
206
214
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 ;
101
104
@@ -153,6 +156,7 @@ export class MatYearView<D> implements AfterContentInit {
153
156
// disabled ones from being selected. This may not be ideal, we should look into whether
154
157
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
155
158
159
+ const oldActiveDate = this . _activeDate ;
156
160
const isRtl = this . _isRtl ( ) ;
157
161
158
162
switch ( event . keyCode ) {
@@ -192,6 +196,10 @@ export class MatYearView<D> implements AfterContentInit {
192
196
return ;
193
197
}
194
198
199
+ if ( this . _dateAdapter . compareDate ( oldActiveDate , this . activeDate ) ) {
200
+ this . activeDateChange . emit ( this . activeDate ) ;
201
+ }
202
+
195
203
this . _focusActiveCell ( ) ;
196
204
// Prevent unexpected default actions such as form submission.
197
205
event . preventDefault ( ) ;
You can’t perform that action at this time.
0 commit comments