Skip to content

Commit 72505af

Browse files
refactor(overlay): add closeOnEsc property in overlay settings
1 parent f5e6fec commit 72505af

19 files changed

+93
-23
lines changed

projects/igniteui-angular/src/lib/combo/combo.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
156156
private _overlaySettings: OverlaySettings = {
157157
scrollStrategy: new AbsoluteScrollStrategy(),
158158
positionStrategy: new AutoPositionStrategy(),
159+
closeOnEsc: true,
159160
modal: false,
160161
closeOnOutsideClick: true,
161162
excludePositionTarget: true

projects/igniteui-angular/src/lib/date-picker/date-picker.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
775775

776776
this._defaultDropDownOverlaySettings = {
777777
closeOnOutsideClick: true,
778+
closeOnEsc: true,
778779
modal: false,
779780
scrollStrategy: new AbsoluteScrollStrategy(),
780781
positionStrategy: new AutoPositionStrategy(this._positionSettings),
@@ -783,6 +784,7 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
783784

784785
this._modalOverlaySettings = {
785786
closeOnOutsideClick: true,
787+
closeOnEsc: true,
786788
modal: true,
787789
outlet: this.outlet
788790
};

projects/igniteui-angular/src/lib/date-range-picker/date-range-picker.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,12 @@ export class IgxDateRangePickerComponent extends DisplayDensityBase
402402
private _focusedInput: IgxDateRangeInputsBaseComponent;
403403
private _dialogOverlaySettings: OverlaySettings = {
404404
closeOnOutsideClick: true,
405+
closeOnEsc: true,
405406
modal: true
406407
};
407408
private _dropDownOverlaySettings: OverlaySettings = {
408409
closeOnOutsideClick: true,
410+
closeOnEsc: true,
409411
modal: false
410412
};
411413
private onChangeCallback = (dateRange: DateRange) => { };

projects/igniteui-angular/src/lib/dialog/dialog.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ export class IgxDialogComponent implements IToggleView, OnInit, OnDestroy, After
8383
this._isModal = val;
8484
}
8585

86+
get closeOnEscapeKey() {
87+
return this._closeOnEscapeKey;
88+
}
89+
90+
set closeOnEscapeKey(val: boolean) {
91+
this._overlayDefaultSettings.closeOnEsc = val;
92+
this._closeOnEscapeKey = val;
93+
}
94+
8695
/**
8796
* An @Input property controlling the `title` of the dialog.
8897
* ```html
@@ -301,6 +310,7 @@ export class IgxDialogComponent implements IToggleView, OnInit, OnDestroy, After
301310

302311
private _overlayDefaultSettings: OverlaySettings;
303312
private _closeOnOutsideSelect = false;
313+
private _closeOnEscapeKey = true;
304314
private _isModal = true;
305315
protected destroy$ = new Subject<boolean>();
306316

@@ -404,6 +414,7 @@ export class IgxDialogComponent implements IToggleView, OnInit, OnDestroy, After
404414
positionStrategy: new GlobalPositionStrategy(this._positionSettings),
405415
scrollStrategy: new NoOpScrollStrategy(),
406416
modal: this.isModal,
417+
closeOnEsc: true,
407418
closeOnOutsideClick: this.closeOnOutsideSelect
408419
};
409420
}
@@ -503,7 +514,6 @@ export class IgxDialogComponent implements IToggleView, OnInit, OnDestroy, After
503514
}
504515

505516
}
506-
507517
}
508518

509519
export interface IDialogEventArgs extends IBaseEventArgs {

projects/igniteui-angular/src/lib/directives/autocomplete/autocomplete.directive.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export class IgxAutocompleteDirective extends IgxDropDownItemNavigationDirective
8686

8787
private defaultSettings: OverlaySettings = {
8888
modal: false,
89+
closeOnEsc: true,
8990
scrollStrategy: new AbsoluteScrollStrategy(),
9091
positionStrategy: new AutoPositionStrategy({ target: this.parentElement }),
9192
excludePositionTarget: true

projects/igniteui-angular/src/lib/directives/toggle/toggle.directive.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ describe('IgxToggle', () => {
475475
positionStrategy: jasmine.any(ConnectedPositioningStrategy) as any,
476476
closeOnOutsideClick: true,
477477
modal: false,
478+
closeOnEsc: true,
478479
scrollStrategy: jasmine.any(AbsoluteScrollStrategy) as any,
479480
excludePositionTarget: true
480481
};
@@ -498,6 +499,7 @@ describe('IgxToggle', () => {
498499
positionStrategy: jasmine.any(ConnectedPositioningStrategy) as any,
499500
closeOnOutsideClick: true,
500501
modal: false,
502+
closeOnEsc: true,
501503
scrollStrategy: jasmine.any(AbsoluteScrollStrategy) as any,
502504
excludePositionTarget: true
503505
};
@@ -533,6 +535,7 @@ describe('IgxToggle', () => {
533535
positionStrategy: jasmine.any(ConnectedPositioningStrategy) as any,
534536
closeOnOutsideClick: true,
535537
modal: false,
538+
closeOnEsc: true,
536539
scrollStrategy: jasmine.any(AbsoluteScrollStrategy) as any,
537540
excludePositionTarget: true
538541
};
@@ -591,6 +594,7 @@ describe('IgxToggle', () => {
591594
positionStrategy: jasmine.any(ConnectedPositioningStrategy) as any,
592595
closeOnOutsideClick: true,
593596
modal: false,
597+
closeOnEsc: true,
594598
scrollStrategy: jasmine.any(AbsoluteScrollStrategy) as any,
595599
outlet: jasmine.any(IgxOverlayOutletDirective) as any,
596600
excludePositionTarget: true

projects/igniteui-angular/src/lib/directives/toggle/toggle.directive.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ export class IgxToggleActionDirective implements OnInit {
429429
scrollStrategy: new AbsoluteScrollStrategy(),
430430
closeOnOutsideClick: true,
431431
modal: false,
432+
closeOnEsc: true,
432433
excludePositionTarget: true
433434
};
434435
}

projects/igniteui-angular/src/lib/grids/filtering/advanced-filtering/advanced-filtering-dialog.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export class IgxAdvancedFilteringDialogComponent implements AfterViewInit, OnDes
136136
private _overlaySettings: OverlaySettings = {
137137
closeOnOutsideClick: false,
138138
modal: false,
139+
closeOnEsc: true,
139140
positionStrategy: new ConnectedPositioningStrategy(this._positionSettings),
140141
scrollStrategy: new CloseScrollStrategy()
141142
};
@@ -146,6 +147,7 @@ export class IgxAdvancedFilteringDialogComponent implements AfterViewInit, OnDes
146147
public columnSelectOverlaySettings: OverlaySettings = {
147148
scrollStrategy: new AbsoluteScrollStrategy(),
148149
modal: false,
150+
closeOnEsc: true,
149151
closeOnOutsideClick: false,
150152
excludePositionTarget: true
151153
};
@@ -156,6 +158,7 @@ export class IgxAdvancedFilteringDialogComponent implements AfterViewInit, OnDes
156158
public conditionSelectOverlaySettings: OverlaySettings = {
157159
scrollStrategy: new AbsoluteScrollStrategy(),
158160
modal: false,
161+
closeOnEsc: true,
159162
closeOnOutsideClick: false,
160163
excludePositionTarget: true
161164
};

projects/igniteui-angular/src/lib/grids/filtering/base/grid-filtering-row.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
4747
excludePositionTarget: true,
4848
closeOnOutsideClick: true,
4949
modal: false,
50+
closeOnEsc: true,
5051
scrollStrategy: new AbsoluteScrollStrategy(),
5152
positionStrategy: new ConnectedPositioningStrategy(this._positionSettings)
5253
};
@@ -55,6 +56,7 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
5556
excludePositionTarget: true,
5657
closeOnOutsideClick: true,
5758
modal: false,
59+
closeOnEsc: true,
5860
scrollStrategy: new AbsoluteScrollStrategy(),
5961
positionStrategy: new ConnectedPositioningStrategy(this._positionSettings)
6062
};

projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-custom-dialog.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export class IgxExcelStyleCustomDialogComponent implements AfterViewInit {
6060
private _customDialogOverlaySettings: OverlaySettings = {
6161
closeOnOutsideClick: true,
6262
modal: false,
63+
closeOnEsc: true,
6364
positionStrategy: new AutoPositionStrategy(this._customDialogPositionSettings),
6465
scrollStrategy: new AbsoluteScrollStrategy()
6566
};

0 commit comments

Comments
 (0)