@@ -50,12 +50,13 @@ import {
50
50
} from './date-picker.utils' ;
51
51
import { DatePickerDisplayValuePipe , DatePickerInputValuePipe } from './date-picker.pipes' ;
52
52
import { IDatePicker } from './date-picker.common' ;
53
- import { KEYS } from '../core/utils' ;
54
- import { IgxDatePickerTemplateDirective } from './date-picker.directives' ;
53
+ import { KEYS , CancelableBrowserEventArgs } from '../core/utils' ;
54
+ import { IgxDatePickerTemplateDirective , IgxDatePickerActionsDirective } from './date-picker.directives' ;
55
55
import { IgxCalendarContainerComponent } from './calendar-container.component' ;
56
56
import { InteractionMode } from '../core/enums' ;
57
57
import { getViewportRect } from '../services/overlay/utilities' ;
58
58
import { fadeIn , fadeOut } from '../animations/fade' ;
59
+ import { DeprecateProperty } from '../core/deprecateDecorators' ;
59
60
60
61
let NEXT_ID = 0 ;
61
62
@@ -549,9 +550,16 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
549
550
*<igx-date-picker (onOpen)="open($event)" cancelButtonLabel="cancel" todayButtonLabel="today"></igx-date-picker>
550
551
*```
551
552
*/
553
+ @DeprecateProperty ( `'onOpen' @Ouput property is deprecated\nUse 'onOpened' instead.` )
552
554
@Output ( )
553
555
public onOpen = new EventEmitter < IgxDatePickerComponent > ( ) ;
554
556
557
+ /**
558
+ *An event that is emitted when the `IgxDatePickerComponent` calendar is opened.
559
+ */
560
+ @Output ( )
561
+ public onOpened = new EventEmitter < IgxDatePickerComponent > ( ) ;
562
+
555
563
/**
556
564
*"An event that is emitted when the `IgxDatePickerComponent` is closed.
557
565
*```typescript
@@ -563,8 +571,22 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
563
571
*<igx-date-picker (onClose)="close($event)" cancelButtonLabel="cancel" todayButtonLabel="today"></igx-date-picker>
564
572
*```
565
573
*/
574
+ @DeprecateProperty ( `'onClose' @Ouput property is deprecated\nUse 'onClosed' instead.` )
566
575
@Output ( )
567
576
public onClose = new EventEmitter < IgxDatePickerComponent > ( ) ;
577
+
578
+ /**
579
+ *An event that is emitted when the `IgxDatePickerComponent` is closed.
580
+ */
581
+ @Output ( )
582
+ public onClosed = new EventEmitter < IgxDatePickerComponent > ( ) ;
583
+
584
+ /**
585
+ * An event that is emitted when the `IgxDatePickerComponent` is being closed.
586
+ */
587
+ @Output ( )
588
+ public onClosing = new EventEmitter < CancelableBrowserEventArgs > ( ) ;
589
+
568
590
/**
569
591
*An @Output property that is fired when selection is made in the calendar.
570
592
*```typescript
@@ -673,6 +695,12 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
673
695
@ContentChild ( IgxCalendarSubheaderTemplateDirective , { read : IgxCalendarSubheaderTemplateDirective } )
674
696
public subheaderTemplate : IgxCalendarSubheaderTemplateDirective ;
675
697
698
+ /**
699
+ *@hidden
700
+ */
701
+ @ContentChild ( IgxDatePickerActionsDirective , { read : IgxDatePickerActionsDirective } )
702
+ public datePickerActionsDirective : IgxDatePickerActionsDirective ;
703
+
676
704
public calendar : IgxCalendarComponent ;
677
705
public hasHeader = true ;
678
706
public collapsed = true ;
@@ -804,6 +832,12 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
804
832
this . _onClosed ( ) ;
805
833
} ) ;
806
834
835
+ this . _overlayService . onClosing . pipe (
836
+ filter ( overlay => overlay . id === this . _componentID ) ,
837
+ takeUntil ( this . _destroy$ ) ) . subscribe ( ( event ) => {
838
+ this . onClosing . emit ( event ) ;
839
+ } ) ;
840
+
807
841
if ( this . mode === InteractionMode . DropDown ) {
808
842
this . dateFormatParts = DatePickerUtil . parseDateFormat ( this . mask , this . locale ) ;
809
843
if ( this . mask === undefined ) {
@@ -1159,6 +1193,9 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
1159
1193
1160
1194
private _onOpened ( event ) : void {
1161
1195
this . _onTouchedCallback ( ) ;
1196
+ this . onOpened . emit ( this ) ;
1197
+
1198
+ // TODO: remove this line after deprecating 'onOpen'
1162
1199
this . onOpen . emit ( this ) ;
1163
1200
1164
1201
if ( this . calendar ) {
@@ -1169,6 +1206,9 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
1169
1206
private _onClosed ( ) : void {
1170
1207
this . collapsed = true ;
1171
1208
this . _componentID = null ;
1209
+ this . onClosed . emit ( this ) ;
1210
+
1211
+ // TODO: remove this line after deprecating 'onClose'
1172
1212
this . onClose . emit ( this ) ;
1173
1213
1174
1214
if ( this . getEditElement ( ) ) {
@@ -1200,6 +1240,7 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
1200
1240
componentInstance . vertical = isVertical ;
1201
1241
componentInstance . cancelButtonLabel = this . cancelButtonLabel ;
1202
1242
componentInstance . todayButtonLabel = this . todayButtonLabel ;
1243
+ componentInstance . datePickerActions = this . datePickerActionsDirective ;
1203
1244
1204
1245
componentInstance . onClose . pipe ( takeUntil ( this . _destroy$ ) ) . subscribe ( ( ) => this . closeCalendar ( ) ) ;
1205
1246
componentInstance . onTodaySelection . pipe ( takeUntil ( this . _destroy$ ) ) . subscribe ( ( ) => this . triggerTodaySelection ( ) ) ;
@@ -1265,9 +1306,9 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
1265
1306
* @hidden
1266
1307
*/
1267
1308
@NgModule ( {
1268
- declarations : [ IgxDatePickerComponent , IgxCalendarContainerComponent ,
1309
+ declarations : [ IgxDatePickerComponent , IgxCalendarContainerComponent , IgxDatePickerActionsDirective ,
1269
1310
IgxDatePickerTemplateDirective , DatePickerDisplayValuePipe , DatePickerInputValuePipe ] ,
1270
- exports : [ IgxDatePickerComponent , IgxDatePickerTemplateDirective , DatePickerDisplayValuePipe , DatePickerInputValuePipe ] ,
1311
+ exports : [ IgxDatePickerComponent , IgxDatePickerTemplateDirective , IgxDatePickerActionsDirective , DatePickerDisplayValuePipe , DatePickerInputValuePipe ] ,
1271
1312
imports : [ CommonModule , IgxIconModule , IgxInputGroupModule , IgxCalendarModule , IgxButtonModule , IgxRippleModule , IgxMaskModule ] ,
1272
1313
entryComponents : [ IgxCalendarContainerComponent ]
1273
1314
} )
0 commit comments