@@ -34,7 +34,7 @@ import { IgxInputGroupModule, IgxInputDirective, IgxInputGroupComponent, IgxInpu
34
34
import { Subject , fromEvent , animationFrameScheduler , interval , Subscription } from 'rxjs' ;
35
35
import { filter , takeUntil , throttle } from 'rxjs/operators' ;
36
36
import { IgxOverlayOutletDirective } from '../directives/toggle/toggle.directive' ;
37
- import { IgxTextSelectionModule } from '../directives/text-selection/text-selection.directive' ;
37
+ import { IgxTextSelectionModule } from '../directives/text-selection/text-selection.directive' ;
38
38
import {
39
39
OverlaySettings ,
40
40
IgxOverlayService ,
@@ -144,7 +144,7 @@ const noop = () => { };
144
144
` ]
145
145
} )
146
146
export class IgxDatePickerComponent implements IDatePicker , ControlValueAccessor ,
147
- EditorProvider , OnInit , AfterViewInit , OnDestroy , AfterViewChecked {
147
+ EditorProvider , OnInit , AfterViewInit , OnDestroy , AfterViewChecked {
148
148
/**
149
149
* Gets/Sets the `IgxDatePickerComponent` label.
150
150
* @remarks
@@ -914,10 +914,10 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
914
914
* @param date passed date that has to be set to the calendar.
915
915
*/
916
916
public selectDate ( date : Date ) : void {
917
- const oldValue = this . value ;
917
+ const oldValue = this . value ;
918
918
this . value = date ;
919
919
920
- this . emitValueChangeEvent ( oldValue , this . value ) ;
920
+ this . emitValueChangeEvent ( oldValue , this . value ) ;
921
921
this . onSelection . emit ( date ) ;
922
922
}
923
923
@@ -929,9 +929,9 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
929
929
* ```
930
930
*/
931
931
public deselectDate ( ) : void {
932
- const oldValue = this . value ;
932
+ const oldValue = this . value ;
933
933
this . value = null ;
934
- this . emitValueChangeEvent ( oldValue , this . value ) ;
934
+ this . emitValueChangeEvent ( oldValue , this . value ) ;
935
935
if ( this . calendar ) {
936
936
this . calendar . deselectDate ( ) ;
937
937
}
@@ -946,7 +946,7 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
946
946
* ```
947
947
*/
948
948
public openDialog ( ) : void {
949
- if ( ! this . collapsed ) {
949
+ if ( ! this . collapsed || this . disabled ) {
950
950
return ;
951
951
}
952
952
@@ -987,10 +987,12 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
987
987
* @hidden @internal
988
988
*/
989
989
public clear ( ) : void {
990
- this . isEmpty = true ;
991
- this . invalidDate = '' ;
992
- this . deselectDate ( ) ;
993
- this . _setCursorPosition ( 0 ) ;
990
+ if ( ! this . disabled ) {
991
+ this . isEmpty = true ;
992
+ this . invalidDate = '' ;
993
+ this . deselectDate ( ) ;
994
+ this . _setCursorPosition ( 0 ) ;
995
+ }
994
996
}
995
997
996
998
/**
@@ -1008,10 +1010,10 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
1008
1010
date . setSeconds ( this . value . getSeconds ( ) ) ;
1009
1011
date . setMilliseconds ( this . value . getMilliseconds ( ) ) ;
1010
1012
}
1011
- const oldValue = this . value ;
1013
+ const oldValue = this . value ;
1012
1014
this . value = date ;
1013
1015
1014
- this . emitValueChangeEvent ( oldValue , this . value ) ;
1016
+ this . emitValueChangeEvent ( oldValue , this . value ) ;
1015
1017
this . calendar . viewDate = date ;
1016
1018
this . closeCalendar ( ) ;
1017
1019
this . onSelection . emit ( date ) ;
@@ -1141,11 +1143,11 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
1141
1143
1142
1144
if ( this . disabledDates === null
1143
1145
|| ( this . disabledDates !== null && ! isDateInRanges ( newValue , this . disabledDates ) ) ) {
1144
- const oldValue = this . value ;
1145
- this . value = newValue ;
1146
+ const oldValue = this . value ;
1147
+ this . value = newValue ;
1146
1148
1147
- this . emitValueChangeEvent ( oldValue , this . value ) ;
1148
- this . invalidDate = '' ;
1149
+ this . emitValueChangeEvent ( oldValue , this . value ) ;
1150
+ this . invalidDate = '' ;
1149
1151
} else {
1150
1152
const args : IDatePickerDisabledDateEventArgs = {
1151
1153
datePicker : this ,
0 commit comments