Skip to content

Commit 2f58750

Browse files
committed
fix(esf): use AutoPositionStrategy for ESF dialog and attach to gridBodyVCR
1 parent bcf8244 commit 2f58750

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

projects/igniteui-angular/grids/core/src/filtering/excel-style/excel-style-conditional-filter.component.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { BaseFilteringComponent } from './base-filtering.component';
66
import { NgClass } from '@angular/common';
77
import { IgxDropDownComponent, IgxDropDownItemComponent, IgxDropDownItemNavigationDirective, ISelectionEventArgs } from 'igniteui-angular/drop-down';
88
import { IgxIconComponent } from 'igniteui-angular/icon';
9-
import { AbsoluteScrollStrategy, AutoPositionStrategy, ContainerPositionStrategy, GridColumnDataType, HorizontalAlignment, IFilteringExpression, IFilteringOperation, IgxOverlayService, OverlaySettings, PlatformUtil, VerticalAlignment } from 'igniteui-angular/core';
9+
import { AbsoluteScrollStrategy, AutoPositionStrategy, GridColumnDataType, HorizontalAlignment, IFilteringExpression, IFilteringOperation, IgxOverlayService, OverlaySettings, PlatformUtil, PositionSettings, VerticalAlignment } from 'igniteui-angular/core';
1010

1111

1212
/**
@@ -128,22 +128,29 @@ export class IgxExcelStyleConditionalFilterComponent implements OnDestroy {
128128
* @hidden @internal
129129
*/
130130
public onSubMenuSelection(eventArgs: ISelectionEventArgs) {
131+
const positionSettings: PositionSettings = {
132+
horizontalDirection: HorizontalAlignment.Center,
133+
verticalDirection: VerticalAlignment.Middle,
134+
horizontalStartPoint: HorizontalAlignment.Center,
135+
verticalStartPoint: VerticalAlignment.Middle
136+
};
131137
const overlaySettings: OverlaySettings = {
138+
target: this.esf.grid.tbody.nativeElement,
132139
modal: false,
133140
closeOnOutsideClick: true,
134-
positionStrategy: new ContainerPositionStrategy()
141+
positionStrategy: new AutoPositionStrategy(positionSettings),
142+
scrollStrategy: new AbsoluteScrollStrategy(),
135143
};
136-
const overlayId = this._overlayService.attach(IgxExcelStyleCustomDialogComponent, this.esf.grid.viewRef, overlaySettings);
144+
const overlayId = this._overlayService.attach(IgxExcelStyleCustomDialogComponent, this.esf.grid.bodyViewContainerRef, overlaySettings);
137145
const overlayInfo = this._overlayService.getOverlayById(overlayId);
138-
const customDialog = overlayInfo.componentRef.instance as IgxExcelStyleCustomDialogComponent;
139-
this.esf.grid.tbody.nativeElement.appendChild(overlayInfo.wrapperElement.parentElement);
146+
const customDialog = overlayInfo.componentRef!.instance as IgxExcelStyleCustomDialogComponent;
140147

141148
customDialog.esf = this.esf;
142149
customDialog.column = this.esf.column;
143150
customDialog.filteringService = this.esf.grid.filteringService;
144151
customDialog.overlayComponentId = overlayId;
145152
if (this.esf.expressionsList && this.esf.expressionsList.length &&
146-
this.esf.expressionsList[0].expression.condition.name !== 'in') {
153+
this.esf.expressionsList[0].expression.condition?.name !== 'in') {
147154
customDialog.expressionsList = this.esf.expressionsList;
148155
} else {
149156
customDialog.expressionsList = customDialog.expressionsList.filter(e => e.expression.fieldName === this.esf.column.field && e.expression.condition);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class IgxExcelStyleCustomDialogComponent {
110110
}
111111

112112
public cancelDialog() {
113-
this.esf.cancel();
113+
this.esf?.cancel();
114114
this.closeDialog();
115115
}
116116

0 commit comments

Comments
 (0)