Skip to content

Commit 7ed9ee8

Browse files
authored
Merge pull request #17160 from IgniteUI/mvenkov/remove-internal-overlay-outlets
refactor(overlay): do not use outlet internally
1 parent 34c7910 commit 7ed9ee8

37 files changed

Lines changed: 78 additions & 366 deletions

projects/igniteui-angular/core/src/core/styles/components/grid/_grid-component.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -458,14 +458,6 @@
458458
@extend %igx-grid__outlet !optional;
459459
}
460460

461-
@include e(loading-outlet) {
462-
@extend %igx-grid__loading-outlet !optional;
463-
}
464-
465-
@include e(row-editing-outlet) {
466-
@extend %igx-grid__row-editing-outlet !optional;
467-
}
468-
469461
@include e(addrow-snackbar) {
470462
@extend %igx-grid__addrow-snackbar !optional;
471463
}

projects/igniteui-angular/core/src/core/styles/components/grid/_grid-theme.scss

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,35 +2335,6 @@
23352335

23362336
%igx-grid__outlet {
23372337
--ig-size: var(--grid-size);
2338-
2339-
z-index: 10002;
2340-
position: fixed;
2341-
}
2342-
2343-
%igx-grid__loading-outlet {
2344-
width: 100%;
2345-
height: 100%;
2346-
z-index: -1;
2347-
position: absolute;
2348-
2349-
> %overlay-wrapper--modal {
2350-
background: none;
2351-
}
2352-
2353-
%circular-display {
2354-
width: rem(50);
2355-
height: rem(50);
2356-
}
2357-
}
2358-
2359-
%igx-grid__row-editing-outlet {
2360-
z-index: 10000;
2361-
position: absolute;
2362-
2363-
%overlay-wrapper {
2364-
/* Change wrapper position from 'fixed' to 'absolute' so that it is hidden when scrolled below the parent grid body content. */
2365-
position: absolute;
2366-
}
23672338
}
23682339

23692340
%igx-grid__addrow-snackbar {

projects/igniteui-angular/core/src/services/overlay/overlay.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,6 @@ export class IgxOverlayService implements OnDestroy {
136136
this._document = this.document;
137137
}
138138

139-
/**
140-
* @param position Preset position settings. Default position is 'center'
141-
* @param outlet The outlet container to attach the overlay to
142-
* @returns Non-modal overlay settings based on Global or Container position strategy and the provided position.
143-
*
144-
* @deprecated in version 21.2.0. The outlet parameter is deprecated. Please provide the container or outlet element through the
145-
* `createAbsoluteOverlaySettings` method when calling `attach` method.
146-
* Creates overlay settings with global or container position strategy and preset position settings
147-
*/
148-
public static createAbsoluteOverlaySettings(
149-
position?: AbsolutePosition, outlet?: IgxOverlayOutletDirective | ElementRef): OverlaySettings;
150139
/**
151140
* Creates overlay settings with global or container position strategy and preset position settings.
152141
*
@@ -159,6 +148,17 @@ export class IgxOverlayService implements OnDestroy {
159148
*/
160149
public static createAbsoluteOverlaySettings(
161150
position?: AbsolutePosition, useContainerStrategy?: boolean): OverlaySettings;
151+
/**
152+
* @param position Preset position settings. Default position is 'center'
153+
* @param outlet The outlet container to attach the overlay to
154+
* @returns Non-modal overlay settings based on Global or Container position strategy and the provided position.
155+
*
156+
* @deprecated in version 21.2.0. The outlet parameter is deprecated. Please provide the container or outlet element through the
157+
* `createAbsoluteOverlaySettings` method when calling `attach` method.
158+
* Creates overlay settings with global or container position strategy and preset position settings
159+
*/
160+
public static createAbsoluteOverlaySettings(
161+
position?: AbsolutePosition, outlet?: IgxOverlayOutletDirective | ElementRef): OverlaySettings;
162162
public static createAbsoluteOverlaySettings(
163163
position?: AbsolutePosition, containerOrOutlet?: IgxOverlayOutletDirective | ElementRef | boolean): OverlaySettings {
164164
const positionSettings = this.createAbsolutePositionSettings(position);

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

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@ import { IFormattingViews, IgxCalendarComponent, IgxCalendarHeaderTemplateDirect
99
import { IgxCalendarContainerComponent } from './calendar-container/calendar-container.component';
1010
import { IgxDatePickerComponent } from './date-picker.component';
1111
import {
12-
IgxOverlayOutletDirective,
1312
IgxOverlayService,
1413
OverlayCancelableEventArgs, OverlayClosingEventArgs, OverlayEventArgs, OverlaySettings,
15-
WEEKDAYS,
16-
BaseFormatter,
17-
I18N_FORMATTER
14+
WEEKDAYS
1815
} from 'igniteui-angular/core';
1916
import { ChangeDetectorRef, Component, DebugElement, ElementRef, EventEmitter, Injector, QueryList, Renderer2, ViewChild } from '@angular/core';
2017
import { By } from '@angular/platform-browser';
@@ -1064,7 +1061,6 @@ describe('IgxDatePicker', () => {
10641061
expect(datePicker.isDropdown).toEqual(true);
10651062
expect(datePicker.minValue).toEqual(undefined);
10661063
expect(datePicker.maxValue).toEqual(undefined);
1067-
expect(datePicker.outlet).toEqual(undefined);
10681064
expect(datePicker.specialDates).toEqual(null);
10691065
expect(datePicker.spinDelta).toEqual(undefined);
10701066
expect(datePicker.spinLoop).toEqual(true);
@@ -1152,15 +1148,6 @@ describe('IgxDatePicker', () => {
11521148
expect(datePicker.maxValue).toEqual(today);
11531149
datePicker.maxValue = '12/12/1998';
11541150
expect(datePicker.maxValue).toEqual('12/12/1998');
1155-
datePicker.outlet = null;
1156-
expect(datePicker.outlet).toEqual(null);
1157-
const mockEl: ElementRef = jasmine.createSpyObj<ElementRef>('mockEl', ['nativeElement']);
1158-
datePicker.outlet = mockEl;
1159-
expect(datePicker.outlet).toEqual(mockEl);
1160-
const mockOverlayDirective: IgxOverlayOutletDirective =
1161-
jasmine.createSpyObj<IgxOverlayOutletDirective>('mockEl', ['nativeElement']);
1162-
datePicker.outlet = mockOverlayDirective;
1163-
expect(datePicker.outlet).toEqual(mockOverlayDirective);
11641151
const specialDates: DateRangeDescriptor[] = [{ type: DateRangeType.Weekdays },
11651152
{ type: DateRangeType.Before, dateRange: [today] }];
11661153
datePicker.specialDates = specialDates;
@@ -1286,21 +1273,18 @@ describe('IgxDatePicker', () => {
12861273
datePicker.open();
12871274
expect(overlay.attach).toHaveBeenCalledWith(IgxCalendarContainerComponent, viewsContainerRef, baseDropdownSettings);
12881275
expect(overlay.show).toHaveBeenCalledWith(mockOverlayId);
1289-
const mockOutlet = {} as any;
1290-
datePicker.outlet = mockOutlet;
12911276
datePicker.open();
12921277
expect(overlay.attach).toHaveBeenCalledWith(
12931278
IgxCalendarContainerComponent,
12941279
viewsContainerRef,
1295-
Object.assign({}, baseDropdownSettings, { outlet: mockOutlet }),
1280+
Object.assign({}, baseDropdownSettings),
12961281
);
12971282
expect(overlay.show).toHaveBeenCalledWith(mockOverlayId);
12981283
let mockSettings: OverlaySettings = {
12991284
closeOnEscape: true,
13001285
closeOnOutsideClick: true,
13011286
modal: false
13021287
};
1303-
datePicker.outlet = null;
13041288
datePicker.open(mockSettings);
13051289
expect(overlay.attach).toHaveBeenCalledWith(
13061290
IgxCalendarContainerComponent,

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
ChangeDetectorRef,
66
Component,
77
ContentChild,
8-
ElementRef,
98
EventEmitter,
109
HostBinding,
1110
HostListener,
@@ -243,25 +242,6 @@ export class IgxDatePickerComponent extends PickerBaseDirective implements Contr
243242
@Input()
244243
public spinDelta: Pick<DatePartDeltas, 'date' | 'month' | 'year'>;
245244

246-
/**
247-
* Gets/Sets the container used for the popup element.
248-
* @remarks
249-
* `outlet` is an instance of `IgxOverlayOutletDirective` or an `ElementRef`.
250-
* @example
251-
* ```html
252-
* <div igxOverlayOutlet #outlet="overlay-outlet"></div>
253-
* //..
254-
* <igx-date-picker [outlet]="outlet"></igx-date-picker>
255-
* //..
256-
* ```
257-
*
258-
* @deprecated in version 21.2.0. Overlays now use the HTML Popover API and no longer move to the document
259-
* body by default, so using outlet is also no longer needed - just define the overlay in the intended
260-
* DOM tree position instead.
261-
*/
262-
@Input()
263-
public override outlet: IgxOverlayOutletDirective | ElementRef;
264-
265245
/**
266246
* Gets/Sets the value of `id` attribute.
267247
*

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

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ import {
3737
DateTimeUtil,
3838
IgxPickerActionsDirective,
3939
isDateInRanges,
40-
PickerCalendarOrientation,
41-
IgxOverlayOutletDirective
40+
PickerCalendarOrientation
4241
} from 'igniteui-angular/core';
4342
import { IgxCalendarContainerComponent } from '../date-picker/calendar-container/calendar-container.component';
4443
import { PickerBaseDirective } from '../date-picker/picker-base.directive';
@@ -364,26 +363,6 @@ export class IgxDateRangePickerComponent extends PickerBaseDirective
364363
@Input()
365364
public override placeholder = '';
366365

367-
/**
368-
* Gets/Sets the container used for the popup element.
369-
*
370-
* @remarks
371-
* `outlet` is an instance of `IgxOverlayOutletDirective` or an `ElementRef`.
372-
* @example
373-
* ```html
374-
* <div igxOverlayOutlet #outlet="overlay-outlet"></div>
375-
* //..
376-
* <igx-date-range-picker [outlet]="outlet"></igx-date-range-picker>
377-
* //..
378-
* ```
379-
*
380-
* @deprecated in version 21.2.0. Overlays now use the HTML Popover API and no longer move to the document
381-
* body by default, so using outlet is also no longer needed - just define the overlay in the intended
382-
* DOM tree position instead.
383-
*/
384-
@Input()
385-
public override outlet: IgxOverlayOutletDirective | ElementRef<any>;
386-
387366
/**
388367
* Show/hide week numbers
389368
*

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

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
55
import { IgxToggleActionDirective, IgxToggleDirective } from './toggle.directive';
66

77
import { first } from 'rxjs/operators';
8-
import { AbsoluteScrollStrategy, AutoPositionStrategy, CancelableEventArgs, ConnectedPositioningStrategy, HorizontalAlignment, IgxOverlayOutletDirective, IgxOverlayService, OffsetMode, OverlaySettings } from 'igniteui-angular/core';
8+
import { AbsoluteScrollStrategy, AutoPositionStrategy, CancelableEventArgs, ConnectedPositioningStrategy, HorizontalAlignment, IgxOverlayService, OffsetMode, OverlaySettings } from 'igniteui-angular/core';
99

1010
describe('IgxToggle', () => {
1111
const HIDDEN_TOGGLER_CLASS = 'igx-toggle--hidden';
@@ -15,7 +15,6 @@ describe('IgxToggle', () => {
1515
imports: [
1616
NoopAnimationsModule,
1717
IgxToggleActionTestComponent,
18-
IgxToggleOutletComponent,
1918
IgxToggleServiceInjectComponent,
2019
IgxOverlayServiceComponent,
2120
IgxToggleTestComponent,
@@ -610,29 +609,6 @@ describe('IgxToggle', () => {
610609
expect(toggle.closing.emit).toHaveBeenCalledWith({ id: '0', owner: toggle, cancel: false, event: new Event('click') });
611610
expect(toggle.closed.emit).toHaveBeenCalledTimes(1);
612611
}));
613-
614-
it('should pass IgxOverlayOutletDirective input from IgxToggleActionDirective', () => {
615-
const fixture = TestBed.createComponent(IgxToggleOutletComponent);
616-
const outlet = fixture.debugElement.query(By.css('.outlet-container')).nativeElement;
617-
const toggleSpy = spyOn(IgxToggleDirective.prototype, 'toggle');
618-
const button = fixture.debugElement.query(By.directive(IgxToggleActionDirective)).nativeElement;
619-
fixture.detectChanges();
620-
621-
const settings: OverlaySettings = {
622-
target: button,
623-
positionStrategy: jasmine.any(ConnectedPositioningStrategy) as any,
624-
closeOnOutsideClick: true,
625-
modal: false,
626-
scrollStrategy: jasmine.any(AbsoluteScrollStrategy) as any,
627-
outlet: jasmine.any(IgxOverlayOutletDirective) as any,
628-
excludeFromOutsideClick: [button]
629-
};
630-
631-
fixture.componentInstance.toggleAction.onClick();
632-
expect(IgxToggleDirective.prototype.toggle).toHaveBeenCalledWith(settings);
633-
const directive = toggleSpy.calls.mostRecent().args[0].outlet as IgxOverlayOutletDirective;
634-
expect(directive.nativeElement).toBe(outlet);
635-
});
636612
});
637613
});
638614

@@ -678,16 +654,6 @@ export class IgxToggleActionTestComponent {
678654
}
679655
}
680656

681-
@Component({
682-
template: `
683-
<button type="button" [igxToggleAction]="toggleRef" [overlaySettings]="{}" [igxToggleOutlet]="outlet"></button>
684-
<div igxToggle #toggleRef="toggle"></div>
685-
<div igxOverlayOutlet #outlet="overlay-outlet" class="outlet-container"></div>
686-
`,
687-
imports: [IgxToggleActionDirective, IgxToggleDirective, IgxOverlayOutletDirective]
688-
})
689-
export class IgxToggleOutletComponent extends IgxToggleActionTestComponent { }
690-
691657
@Component({
692658
template: `
693659
<button type="button" igxToggleAction="toggleID">Open/Close Toggle</button>

projects/igniteui-angular/grids/core/src/cell.component.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@
125125
<ng-container [formGroup]="formGroup">
126126
<igx-date-picker
127127
[style.width.%]="100"
128-
[outlet]="grid.outlet"
129128
mode="dropdown"
130129
[locale]="grid.locale"
131130
[weekStart]="column.pipeArgs.weekStart"
@@ -142,7 +141,6 @@
142141
<ng-container [formGroup]="formGroup">
143142
<igx-time-picker
144143
[style.width.%]="100"
145-
[outlet]="grid.outlet"
146144
mode="dropdown"
147145
[locale]="grid.locale"
148146
[inputFormat]="column.editorOptions?.dateTimeFormat"
@@ -215,7 +213,6 @@
215213
name="error"
216214
#errorIcon
217215
[igxTooltipTarget]="tooltipRef"
218-
[igxToggleOutlet]="grid.outlet"
219216
(mouseover)='errorShowing = true'
220217
(mouseout)='errorShowing = false'>
221218
</igx-icon>

projects/igniteui-angular/grids/core/src/cell.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,6 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy, CellT
920920
closeOnOutsideClick: true,
921921
excludeFromOutsideClick: [this.nativeElement],
922922
closeOnEscape: false,
923-
outlet: this.grid.outlet,
924923
modal: false,
925924
positionStrategy: new AutoPositionStrategy({
926925
horizontalStartPoint: HorizontalAlignment.Center,

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, ViewChild, ChangeDetectorRef, AfterViewInit, OnDestroy, HostBinding, inject } from '@angular/core';
1+
import { Component, Input, ViewChild, ChangeDetectorRef, OnDestroy, HostBinding, inject } from '@angular/core';
22
import { Subject } from 'rxjs';
33
import { IActiveNode } from '../../grid-navigation.service';
44
import { GridType } from '../../common/grid.interface';
@@ -34,7 +34,7 @@ import {
3434
templateUrl: './advanced-filtering-dialog.component.html',
3535
imports: [IgxDragDirective, NgClass, IgxQueryBuilderComponent, IgxQueryBuilderHeaderComponent, IgxDragHandleDirective, IgxButtonDirective]
3636
})
37-
export class IgxAdvancedFilteringDialogComponent implements AfterViewInit, OnDestroy {
37+
export class IgxAdvancedFilteringDialogComponent implements OnDestroy {
3838
public cdr = inject(ChangeDetectorRef);
3939
protected platform = inject(PlatformUtil);
4040

@@ -75,12 +75,6 @@ export class IgxAdvancedFilteringDialogComponent implements AfterViewInit, OnDes
7575
this.assignResourceStrings(false);
7676
}, this);
7777
}
78-
/**
79-
* @hidden @internal
80-
*/
81-
public ngAfterViewInit(): void {
82-
this.queryBuilder.setPickerOutlet(this.grid.outlet);
83-
}
8478

8579
/**
8680
* @hidden @internal

0 commit comments

Comments
 (0)