-
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
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); | ||
|
|
||
| customDialog.esf = this.esf; | ||
| customDialog.column = this.esf.column; | ||
| customDialog.filteringService = this.esf.grid.filteringService; | ||
| customDialog.overlayComponentId = overlayId; | ||
| if (this.esf.expressionsList && this.esf.expressionsList.length && | ||
| this.esf.expressionsList[0].expression.condition.name !== 'in') { | ||
| this.customDialog.expressionsList = this.esf.expressionsList; | ||
| customDialog.expressionsList = this.esf.expressionsList; | ||
| } else { | ||
| this.customDialog.expressionsList = this.customDialog.expressionsList.filter(e => e.expression.fieldName === this.esf.column.field && e.expression.condition); | ||
| customDialog.expressionsList = customDialog.expressionsList.filter(e => e.expression.fieldName === this.esf.column.field && e.expression.condition); | ||
| } | ||
| customDialog.selectedOperator = eventArgs.newSelection.value; | ||
|
|
||
| this._overlayService.opening.pipe(takeUntil(this.destroy$)).subscribe((args) => { | ||
| if (args.id === overlayId) | ||
| customDialog.onCustomDialogOpening(); | ||
| }); | ||
| this._overlayService.opened.pipe(takeUntil(this.destroy$)).subscribe((args) => { | ||
| if (args.id === overlayId) | ||
| customDialog.onCustomDialogOpened(); | ||
| }); | ||
|
|
||
| this.customDialog.selectedOperator = eventArgs.newSelection.value; | ||
| eventArgs.cancel = true; | ||
| if (this.esf.overlayComponentId) { | ||
| this.esf.hide(); | ||
| } | ||
| this.subMenu.close(); | ||
| this.customDialog.open(this.esf.mainDropdown.nativeElement); | ||
| this._overlayService.show(overlayId); | ||
|
Comment on lines
163
to
+167
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| } | ||
|
|
||
| /** | ||
|
|
||
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);