Skip to content

Commit

Permalink
feat(grid): create a setter for grid's outlet #7379
Browse files Browse the repository at this point in the history
  • Loading branch information
onlyexeption committed Jul 23, 2020
1 parent 7efa0ad commit cf58d35
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 33 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ The following example shows how you can use the Indigo theme:
- `IgxSelect` support for `igxHint` directive added.
- Allows the user to add `igxHint` to be displayed bellow the input element.

## 9.1.9

### New Features
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
- Expose a setter for grid's `outlet` property, which can be used to set the outlet used to attach the grid's overlays to.

## 9.1.4

### New Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
[igxFocus]="true" [disableRipple]="true"></igx-checkbox>
</ng-container>
<ng-container *ngIf="column.dataType === 'date'">
<igx-date-picker [style.width.%]="100" [outlet]="grid.outletDirective" mode="dropdown"
<igx-date-picker [style.width.%]="100" [outlet]="grid.outlet" mode="dropdown"
[locale]="grid.locale" [(value)]="editValue" [igxFocus]="true" [labelVisibility]="false">
</igx-date-picker>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface GridType extends IGridDataBindable {
selectionService: any;
navigation: any;
filteringService: any;
outletDirective: any;
outlet: any;

calcHeight: number;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ <h6 class="igx-filter-empty__title">
mode="dropdown"
[(ngModel)]="searchValue"
[locale]="grid.locale"
[outlet]="grid.outletDirective">
[outlet]="grid.outlet">
<ng-template igxDatePickerTemplate let-openDialog="openDialog" let-value="value">
<igx-input-group #dropDownTarget type="box" [displayDensity]="'compact'">
<input #searchValueInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
tabindex="0"
mode="dropdown"
[value]="value"
[outlet]="filteringService.grid.outletDirective"
[outlet]="filteringService.grid.outlet"
[locale]="filteringService.grid.locale"
(onSelection)="onDateSelected($event)"
(onClosed)="datePickerClose()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
constructor(public filteringService: IgxFilteringService, public element: ElementRef, public cdr: ChangeDetectorRef) { }

ngAfterViewInit() {
this._conditionsOverlaySettings.outlet = this.column.grid.outletDirective;
this._operatorsOverlaySettings.outlet = this.column.grid.outletDirective;
this._conditionsOverlaySettings.outlet = this.column.grid.outlet;
this._operatorsOverlaySettings.outlet = this.column.grid.outlet;

const selectedItem = this.expressionsList.find(expr => expr.isSelected === true);
if (selectedItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</igx-select-item>
</igx-select>

<igx-date-picker #datePicker mode="dropdown" [(ngModel)]="expressionUI.expression.searchVal" [locale]="grid.locale" [outlet]="grid.outletDirective">
<igx-date-picker #datePicker mode="dropdown" [(ngModel)]="expressionUI.expression.searchVal" [locale]="grid.locale" [outlet]="grid.outlet">
<ng-template igxDatePickerTemplate let-openDialog="openDialog" let-value="value">
<igx-input-group #dropDownTarget type="box" [displayDensity]="displayDensity">
<input #input
Expand Down
35 changes: 21 additions & 14 deletions projects/igniteui-angular/src/lib/grids/grid-base.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
positionStrategy: new ConnectedPositioningStrategy(this._advancedFilteringPositionSettings),
};

protected _userOutletDirective: IgxOverlayOutletDirective;

/**
* @hidden @internal
*/
Expand Down Expand Up @@ -1816,20 +1818,12 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
@ViewChild('tfoot', { static: true })
public tfoot: ElementRef;


/**
* @hidden @internal
*/
@ViewChild('igxFilteringOverlayOutlet', { read: IgxOverlayOutletDirective, static: true })
protected _outletDirective: IgxOverlayOutletDirective;

/**
* @hidden @internal
*/
public get outletDirective() {
return this._outletDirective;
}

/**
* @hidden @internal
*/
Expand All @@ -1854,7 +1848,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
* @hidden @internal
*/
public get parentRowOutletDirective() {
return this.outletDirective;
return this.outlet;
}

/**
Expand Down Expand Up @@ -2946,7 +2940,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
return;
}

if (this.overlayService.getOverlayById(event.id)?.settings?.outlet === this.outletDirective &&
if (this.overlayService.getOverlayById(event.id)?.settings?.outlet === this.outlet &&
this.overlayIDs.indexOf(event.id) < 0) {
this.overlayIDs.push(event.id);
}
Expand Down Expand Up @@ -3384,10 +3378,23 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
}

/**
* @hidden @internal
* Gets the outlet used to attach the grid's overlays to.
* @remark
* If set, returns the outlet defined outside the grid. Otherwise returns the grid's internal outlet directive.
*/
get outlet() {
return this.resolveOutlet();
}

protected resolveOutlet() {
return this._userOutletDirective ? this._userOutletDirective : this._outletDirective;
}

/**
* Sets the outlet used to attach the grid's overlays to.
*/
protected get outlet() {
return this.outletDirective;
set outlet(val: any) {
this._userOutletDirective = val;
}

/**
Expand Down Expand Up @@ -6509,7 +6516,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
if (!this._advancedFilteringOverlayId) {
this._advancedFilteringOverlaySettings.positionStrategy.settings.target =
(this as any).rootGrid ? (this as any).rootGrid.nativeElement : this.nativeElement;
this._advancedFilteringOverlaySettings.outlet = this.outletDirective;
this._advancedFilteringOverlaySettings.outlet = this.outlet;

this._advancedFilteringOverlayId = this.overlayService.attach(
IgxAdvancedFilteringDialogComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<igx-checkbox (change)="editValue = $event.checked" [value]="editValue" [checked]="editValue" [disableRipple]="true"></igx-checkbox>
</ng-container>
<ng-container *ngIf="column.dataType === 'date'">
<igx-date-picker [style.width.%]="100" [outlet]="grid.outletDirective" mode="dropdown"
<igx-date-picker [style.width.%]="100" [outlet]="grid.outlet" mode="dropdown"
[locale]="grid.locale" [(value)]="editValue" [igxFocus]="true" [labelVisibility]="false">
</igx-date-picker>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[column]="child"
[gridID]="child.grid.id"
[igxColumnMovingDrag]="child"
[ghostHost]="grid.outletDirective.nativeElement"
[ghostHost]="grid.outlet.nativeElement"
[attr.droppable]="true"
[igxColumnMovingDrop]="child">
</igx-grid-header-group>
Expand Down Expand Up @@ -48,7 +48,7 @@
'igx-grid__th--selected': selected,
'igx-grid__th--active': activeGroup}"
[igxColumnMovingDrag]="column"
[ghostHost]="grid.outletDirective.nativeElement"
[ghostHost]="grid.outlet.nativeElement"
[attr.droppable]="true"
[igxColumnMovingDrop]="column"
(pointerdown)="activate()"
Expand Down Expand Up @@ -81,7 +81,7 @@

<ng-container *ngIf="!column.columnGroup">
<span *ngIf="grid.hasMovableColumns" class="igx-grid__th-drop-indicator-left"></span>
<igx-grid-header [igxColumnMovingDrag]="column" [ghostHost]="grid.outletDirective.nativeElement" [attr.droppable]="true" (pointerdown)="activate()" [igxColumnMovingDrop]="column" [gridID]="column.grid.id" [column]="column"></igx-grid-header>
<igx-grid-header [igxColumnMovingDrag]="column" [ghostHost]="grid.outlet.nativeElement" [attr.droppable]="true" (pointerdown)="activate()" [igxColumnMovingDrop]="column" [gridID]="column.grid.id" [column]="column"></igx-grid-header>
<igx-grid-filtering-cell *ngIf="grid.allowFiltering && grid.filterMode == 'quickFilter'" [column]="column" [attr.draggable]="false"></igx-grid-filtering-cell>
<span *ngIf="!column.columnGroup && column.resizable" class="igx-grid__th-resize-handle"
[igxResizeHandle]="column"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,19 @@ export class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirective {
}

/**
* @hidden
* Gets the outlet used to attach the grid's overlays to.
* @remark
* If set, returns the outlet defined outside the grid. Otherwise returns the grid's internal outlet directive.
*/
get outlet() {
return this.rootGrid ? this.rootGrid.resolveOutlet() : this.resolveOutlet();
}

/**
* Sets the outlet used to attach the grid's overlays to.
*/
protected get outlet() {
return this.rootGrid ? this.rootGrid.outletDirective : this.outletDirective;
set outlet(val: any) {
this._userOutletDirective = val;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export class IgxGridToolbarComponent extends DisplayDensityBase implements After
*/
public exportClicked() {
this._overlaySettings.positionStrategy.settings.target = this.exportButton.nativeElement;
this._overlaySettings.outlet = this.grid.outletDirective;
this._overlaySettings.outlet = this.grid.outlet;
this.exportDropdown.toggle(this._overlaySettings);
}

Expand Down Expand Up @@ -350,7 +350,7 @@ export class IgxGridToolbarComponent extends DisplayDensityBase implements After
*/
public toggleColumnHidingUI() {
this._overlaySettings.positionStrategy.settings.target = this.columnHidingButton.nativeElement;
this._overlaySettings.outlet = this.grid.outletDirective;
this._overlaySettings.outlet = this.grid.outlet;
this.columnHidingDropdown.toggle(this._overlaySettings);
}

Expand All @@ -362,7 +362,7 @@ export class IgxGridToolbarComponent extends DisplayDensityBase implements After
*/
public toggleColumnPinningUI() {
this._overlaySettings.positionStrategy.settings.target = this.columnPinningButton.nativeElement;
this._overlaySettings.outlet = this.grid.outletDirective;
this._overlaySettings.outlet = this.grid.outlet;
this.columnPinningDropdown.toggle(this._overlaySettings);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<igx-checkbox (change)="editValue = $event.checked" [value]="editValue" [checked]="editValue" [disableRipple]="true"></igx-checkbox>
</ng-container>
<ng-container *ngIf="column.dataType === 'date'">
<igx-date-picker [style.width.%]="100" [outlet]="grid.outletDirective" mode="dropdown"
<igx-date-picker [style.width.%]="100" [outlet]="grid.outlet" mode="dropdown"
[locale]="grid.locale" [(value)]="editValue" [igxFocus]="focused" [labelVisibility]="false">
</igx-date-picker>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class GridColumnSelectionSampleComponent implements OnInit {

public toggleColumnSelection() {
this._overlaySettings.positionStrategy.settings.target = this.columnSelectionButton.nativeElement;
this._overlaySettings.outlet = this.grid1.outletDirective;
this._overlaySettings.outlet = this.grid1.outlet;
this.columnSelectionDropdown.toggle(this._overlaySettings);
}

Expand Down

0 comments on commit cf58d35

Please sign in to comment.