-
Notifications
You must be signed in to change notification settings - Fork 160
fix(ESF): move custom dialog out of ESF markup #17136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
904b83a
ec2a77e
4150eb0
0d54fd2
e0643fe
4ec7224
173533b
740b1ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -6,7 +6,7 @@ import { BaseFilteringComponent } from './base-filtering.component'; | |||
| import { NgClass } from '@angular/common'; | ||||
| import { IgxDropDownComponent, IgxDropDownItemComponent, IgxDropDownItemNavigationDirective, ISelectionEventArgs } from 'igniteui-angular/drop-down'; | ||||
| import { IgxIconComponent } from 'igniteui-angular/icon'; | ||||
| import { AbsoluteScrollStrategy, AutoPositionStrategy, GridColumnDataType, HorizontalAlignment, IFilteringExpression, IFilteringOperation, OverlaySettings, PlatformUtil, VerticalAlignment } from 'igniteui-angular/core'; | ||||
| import { AbsoluteScrollStrategy, AutoPositionStrategy, ContainerPositionStrategy, GridColumnDataType, HorizontalAlignment, IFilteringExpression, IFilteringOperation, IgxOverlayService, OverlaySettings, PlatformUtil, VerticalAlignment } from 'igniteui-angular/core'; | ||||
|
|
||||
|
|
||||
| /** | ||||
|
|
@@ -15,17 +15,12 @@ import { AbsoluteScrollStrategy, AutoPositionStrategy, GridColumnDataType, Horiz | |||
| @Component({ | ||||
| selector: 'igx-excel-style-conditional-filter', | ||||
| templateUrl: './excel-style-conditional-filter.component.html', | ||||
| imports: [NgClass, IgxDropDownItemNavigationDirective, IgxIconComponent, IgxDropDownComponent, IgxDropDownItemComponent, IgxExcelStyleCustomDialogComponent] | ||||
| imports: [NgClass, IgxDropDownItemNavigationDirective, IgxIconComponent, IgxDropDownComponent, IgxDropDownItemComponent] | ||||
| }) | ||||
| export class IgxExcelStyleConditionalFilterComponent implements OnDestroy { | ||||
| public esf = inject(BaseFilteringComponent); | ||||
| protected platform = inject(PlatformUtil); | ||||
|
|
||||
| /** | ||||
| * @hidden @internal | ||||
| */ | ||||
| @ViewChild('customDialog', { read: IgxExcelStyleCustomDialogComponent }) | ||||
| public customDialog: IgxExcelStyleCustomDialogComponent; | ||||
| private _overlayService = inject<IgxOverlayService>(IgxOverlayService); | ||||
|
|
||||
| /** | ||||
| * @hidden @internal | ||||
|
|
@@ -133,20 +128,43 @@ export class IgxExcelStyleConditionalFilterComponent implements OnDestroy { | |||
| * @hidden @internal | ||||
| */ | ||||
| public onSubMenuSelection(eventArgs: ISelectionEventArgs) { | ||||
| const overlaySettings: OverlaySettings = { | ||||
| modal: false, | ||||
| closeOnOutsideClick: true, | ||||
| positionStrategy: new ContainerPositionStrategy() | ||||
| }; | ||||
| const overlayId = this._overlayService.attach(IgxExcelStyleCustomDialogComponent, this.esf.grid.viewRef, overlaySettings); | ||||
| const overlayInfo = this._overlayService.getOverlayById(overlayId); | ||||
| const customDialog = overlayInfo.componentRef.instance as IgxExcelStyleCustomDialogComponent; | ||||
| this.esf.grid.tbody.nativeElement.appendChild(overlayInfo.wrapperElement.parentElement); | ||||
|
||||
| this.esf.grid.tbody.nativeElement.appendChild(overlayInfo.wrapperElement.parentElement); |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onSubMenuSelection creates a new overlay and subscribes to overlayService.opening/opened every time the submenu selection changes, but never detaches the overlay when it is closed via outside click (and doesn’t keep the overlayId to clean it up on destroy). This can accumulate component instances/subscriptions over time. Consider reusing a single attached overlay (cache overlayId/componentRef), and/or subscribe to overlayService.closed for this overlayId (with take(1)) to detach after hide, and detach any remaining overlay in ngOnDestroy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this PR merely moves things around to remove the outlet usage, but this component can really use some refactoring where the onSubMenuSelection is emitted upwards for the root ESF component to handle, close itself and spawn the dialog. And possibly some actual dialog and/or dialog ARIA would be nice. Just 2c
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4203,6 +4203,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { | |
| fix.detectChanges(); | ||
|
|
||
| // Open excel style custom filtering dialog and verify its size | ||
| setElementSize(grid.nativeElement, ɵSize.Large); | ||
| GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName'); | ||
|
|
||
| GridFunctions.clickExcelFilterCascadeButton(fix); | ||
|
|
@@ -7563,7 +7564,7 @@ const verifyExcelCustomFilterSize = (fix: ComponentFixture<any>, expectedSize: | |
| const verifyGridSubmenuSize = (gridNativeElement: HTMLElement, expectedSize: ɵSize) => { | ||
| const outlet = gridNativeElement.querySelector('.igx-grid__outlet'); | ||
| const dropdowns = Array.from(outlet.querySelectorAll('.igx-drop-down__list')); | ||
| const visibleDropdown: any = dropdowns.find((d) => !d.classList.contains('igx-toggle--hidden')); | ||
| const visibleDropdown: any = dropdowns[0]; | ||
| const dropdownItems = visibleDropdown.querySelectorAll('igx-drop-down-item'); | ||
|
Comment on lines
7564
to
7568
|
||
|
|
||
| dropdownItems.forEach((dropdownItem) => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is needed atm, but we could consider leaving the dialog on the grid container instead as well (separate from the PR);