Skip to content

Commit 9f1e5c2

Browse files
authored
Merge pull request #7598 from IgniteUI/vmihalkov/paginator-overlay-settings
fix(grid): Expose overlaySettings for paginator #7537
2 parents 58bc3fc + 1782d48 commit 9f1e5c2

File tree

8 files changed

+180
-142
lines changed

8 files changed

+180
-142
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes for each version of this project will be documented in this
1212
- `IgxTransaction` - The `onStateUpdate` now emits with information of its origin. The emitted value is of type `StateUpdateEvent`, which has two properties:
1313
- `origin` - it can vary within the values of the `TransactionEventOrigin` interface;
1414
- `actions` - contains information about the transactions, that caused the emission of the event.
15+
- `IgxPaginator` - The input `overlaySettings` was introduced, which allows applying custom overlay settings for the component.
1516

1617
### New Features
1718
- `IgxGrid`

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

+97-88
Original file line numberDiff line numberDiff line change
@@ -610,15 +610,15 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
610610
public dragRowID = null;
611611

612612

613-
/**
614-
* Gets/Sets whether the rows are editable.
615-
* @remarks
616-
* By default it is set to false.
617-
* @example
618-
* ```html
619-
* <igx-grid #grid [showToolbar]="true" [rowEditable]="true" [primaryKey]="'ProductID'" [columnHiding]="true"></igx-grid>
620-
* ```
621-
*/
613+
/**
614+
* Gets/Sets whether the rows are editable.
615+
* @remarks
616+
* By default it is set to false.
617+
* @example
618+
* ```html
619+
* <igx-grid #grid [showToolbar]="true" [rowEditable]="true" [primaryKey]="'ProductID'" [columnHiding]="true"></igx-grid>
620+
* ```
621+
*/
622622
@WatchChanges()
623623
@Input()
624624
get rowEditable(): boolean {
@@ -1096,13 +1096,13 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
10961096
@Output()
10971097
public onRowSelectionChange = new EventEmitter<IRowSelectionEventArgs>();
10981098

1099-
/**
1100-
* Emitted when `IgxColumnComponent` is selected.
1101-
* @example
1102-
* ```html
1103-
* <igx-grid #grid (onColumnSelectionChange)="onColumnSelectionChange($event)" [data]="localData" [autoGenerate]="true"></igx-grid>
1104-
* ```
1105-
*/
1099+
/**
1100+
* Emitted when `IgxColumnComponent` is selected.
1101+
* @example
1102+
* ```html
1103+
* <igx-grid #grid (onColumnSelectionChange)="onColumnSelectionChange($event)" [data]="localData" [autoGenerate]="true"></igx-grid>
1104+
* ```
1105+
*/
11061106
@Output()
11071107
public onColumnSelectionChange = new EventEmitter<IColumnSelectionEventArgs>();
11081108

@@ -2644,6 +2644,11 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
26442644
positionStrategy: this.rowEditPositioningStrategy
26452645
};
26462646

2647+
/**
2648+
* @hidden @internal
2649+
*/
2650+
public paginatorSettings: OverlaySettings = null;
2651+
26472652
private verticalScrollHandler = (event) => {
26482653
this.verticalScrollContainer.onScroll(event);
26492654
this.disableTransitions = true;
@@ -2879,7 +2884,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
28792884
this.notifyChanges();
28802885
});
28812886

2882-
this.resizeNotify.pipe(destructor, filter(() => !this._init), throttleTime(100, undefined, {leading: true, trailing: true}))
2887+
this.resizeNotify.pipe(destructor, filter(() => !this._init), throttleTime(100, undefined, { leading: true, trailing: true }))
28832888
.subscribe(() => {
28842889
this.zone.run(() => {
28852890
this.notifyChanges(true);
@@ -3016,9 +3021,9 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
30163021
public setFilteredData(data, pinned: boolean) {
30173022
if (this.hasPinnedRecords && pinned) {
30183023
this._filteredPinnedData = data || [];
3019-
const filteredUnpinned = this._filteredUnpinnedData || [];
3020-
const filteredData = [... this._filteredPinnedData, ... filteredUnpinned];
3021-
this.filteredData = filteredData.length > 0 ? filteredData : this._filteredUnpinnedData;
3024+
const filteredUnpinned = this._filteredUnpinnedData || [];
3025+
const filteredData = [... this._filteredPinnedData, ...filteredUnpinned];
3026+
this.filteredData = filteredData.length > 0 ? filteredData : this._filteredUnpinnedData;
30223027
} else if (this.hasPinnedRecords && !pinned) {
30233028
this._filteredUnpinnedData = data;
30243029
} else {
@@ -3079,7 +3084,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
30793084
this._filteredSortedPinnedData = data;
30803085
this.pinnedRecords = data;
30813086
this._filteredSortedData = this.isRowPinningToTop ? [... this._filteredSortedPinnedData, ... this._filteredSortedUnpinnedData] :
3082-
[... this._filteredSortedUnpinnedData, ... this._filteredSortedPinnedData];
3087+
[... this._filteredSortedUnpinnedData, ... this._filteredSortedPinnedData];
30833088
this.refreshSearch(true, false);
30843089
} else if (this.pinnedRecordsCount > 0 && !pinned) {
30853090
this._filteredSortedUnpinnedData = data;
@@ -3131,14 +3136,16 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
31313136
this._setupRowObservers();
31323137
this._zoneBegoneListeners();
31333138

3139+
this.paginatorSettings = { outlet: this.outlet };
3140+
31343141
const vertScrDC = this.verticalScrollContainer.displayContainer;
31353142
vertScrDC.addEventListener('scroll', this.preventContainerScroll);
31363143

31373144
this._pinnedRowList.changes
3138-
.pipe(takeUntil(this.destroy$))
3139-
.subscribe((change: QueryList<IgxGridRowComponent>) => {
3140-
this.onPinnedRowsChanged(change);
3141-
});
3145+
.pipe(takeUntil(this.destroy$))
3146+
.subscribe((change: QueryList<IgxGridRowComponent>) => {
3147+
this.onPinnedRowsChanged(change);
3148+
});
31423149
}
31433150

31443151
/**
@@ -3843,7 +3850,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
38433850
'DropPosition.None is deprecated.' +
38443851
'Use DropPosition.AfterDropTarget instead.',
38453852
warningShown);
3846-
position = DropPosition.AfterDropTarget;
3853+
position = DropPosition.AfterDropTarget;
38473854
}
38483855
if ((column.level !== dropTarget.level) ||
38493856
(column.topLevelParent !== dropTarget.topLevelParent)) {
@@ -4293,7 +4300,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
42934300
* @param rowID The row id - primaryKey value or the data record instance.
42944301
*/
42954302
public unpinRow(rowID: any) {
4296-
const index = this._pinnedRecordIDs.indexOf(rowID);
4303+
const index = this._pinnedRecordIDs.indexOf(rowID);
42974304
if (index === -1) {
42984305
return false;
42994306
}
@@ -4893,7 +4900,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
48934900
const diff = this.rowListDiffer.diff(change);
48944901
if (diff) {
48954902
this.notifyChanges(true);
4896-
}
4903+
}
48974904
}
48984905

48994906
/**
@@ -5189,7 +5196,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
51895196
*/
51905197
protected reinitPinStates() {
51915198
this._pinnedColumns = this.columnList
5192-
.filter((c) => c.pinned).sort((a, b) => this._pinnedColumns.indexOf(a) - this._pinnedColumns.indexOf(b));
5199+
.filter((c) => c.pinned).sort((a, b) => this._pinnedColumns.indexOf(a) - this._pinnedColumns.indexOf(b));
51935200
this._unpinnedColumns = this.hasColumnGroups ? this.columnList.filter((c) => !c.pinned) :
51945201
this.columnList.filter((c) => !c.pinned)
51955202
.sort((a, b) => this._unpinnedColumns.indexOf(a) - this._unpinnedColumns.indexOf(b));
@@ -5515,14 +5522,14 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
55155522
return this.extractDataFromSelection(source, formatters, headers);
55165523
}
55175524

5518-
/**
5519-
* Get current selected columns.
5520-
* @example
5521-
* Returns an array with selected columns
5522-
* ```typescript
5523-
* const selectedColumns = this.grid.selectedColumns();
5524-
* ```
5525-
*/
5525+
/**
5526+
* Get current selected columns.
5527+
* @example
5528+
* Returns an array with selected columns
5529+
* ```typescript
5530+
* const selectedColumns = this.grid.selectedColumns();
5531+
* ```
5532+
*/
55265533
public selectedColumns(): IgxColumnComponent[] {
55275534
const fields = this.selectionService.getSelectedColumns();
55285535
return fields.map(field => this.getColumnByName(field)).filter(field => field);
@@ -5544,9 +5551,9 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
55445551
} else {
55455552
(columns as IgxColumnComponent[]).forEach(col => {
55465553
if (col.columnGroup) {
5547-
const children = col.allChildren.filter(c => !c.columnGroup).map(c => c.field);
5548-
fieldToSelect = [...fieldToSelect, ...children];
5549-
} else {
5554+
const children = col.allChildren.filter(c => !c.columnGroup).map(c => c.field);
5555+
fieldToSelect = [...fieldToSelect, ...children];
5556+
} else {
55505557
fieldToSelect.push(col.field);
55515558
}
55525559
});
@@ -5571,9 +5578,9 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
55715578
} else {
55725579
(columns as IgxColumnComponent[]).forEach(col => {
55735580
if (col.columnGroup) {
5574-
const children = col.allChildren.filter(c => !c.columnGroup).map(c => c.field);
5575-
fieldToDeselect = [...fieldToDeselect, ...children];
5576-
} else {
5581+
const children = col.allChildren.filter(c => !c.columnGroup).map(c => c.field);
5582+
fieldToDeselect = [...fieldToDeselect, ...children];
5583+
} else {
55775584
fieldToDeselect.push(col.field);
55785585
}
55795586
});
@@ -5582,25 +5589,25 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
55825589
this.notifyChanges();
55835590
}
55845591

5585-
/**
5586-
* Deselects all columns
5587-
* @example
5588-
* ```typescript
5589-
* this.grid.deselectAllColumns();
5590-
* ```
5591-
*/
5592+
/**
5593+
* Deselects all columns
5594+
* @example
5595+
* ```typescript
5596+
* this.grid.deselectAllColumns();
5597+
* ```
5598+
*/
55925599
public deselectAllColumns() {
55935600
this.selectionService.clearAllSelectedColumns();
55945601
this.notifyChanges();
55955602
}
55965603

5597-
/**
5598-
* Selects all columns
5599-
* @example
5600-
* ```typescript
5601-
* this.grid.deselectAllColumns();
5602-
* ```
5603-
*/
5604+
/**
5605+
* Selects all columns
5606+
* @example
5607+
* ```typescript
5608+
* this.grid.deselectAllColumns();
5609+
* ```
5610+
*/
56045611
public selectAllColumns() {
56055612
this.selectColumns(this.columnList.filter(c => !c.columnGroup));
56065613
}
@@ -5636,7 +5643,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
56365643
* If `headers` is enabled, it will use the column header (if any) instead of the column field.
56375644
*/
56385645
public getSelectedColumnsData(formatters = false, headers = false) {
5639-
const source = this.filteredSortedData ? this.filteredSortedData : this.data;
5646+
const source = this.filteredSortedData ? this.filteredSortedData : this.data;
56405647
return this.extractDataFromColumnsSelection(source, formatters, headers);
56415648
}
56425649

@@ -5727,34 +5734,36 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
57275734
this.navigation.performVerticalScrollToCell(rowIndex, visibleColIndex, () => {
57285735
if (shouldScrollHorizontally) {
57295736
this.navigation.performHorizontalScrollToCell(visibleColIndex, () =>
5730-
this.executeCallback(rowIndex, visibleColIndex, cb));
5737+
this.executeCallback(rowIndex, visibleColIndex, cb));
57315738
} else {
57325739
this.executeCallback(rowIndex, visibleColIndex, cb);
5733-
}});
5740+
}
5741+
});
57345742
} else if (shouldScrollHorizontally) {
57355743
this.navigation.performHorizontalScrollToCell(visibleColIndex, () => {
57365744
if (shouldScrollVertically) {
57375745
this.navigation.performVerticalScrollToCell(rowIndex, visibleColIndex, () =>
57385746
this.executeCallback(rowIndex, visibleColIndex, cb));
57395747
} else {
57405748
this.executeCallback(rowIndex, visibleColIndex, cb);
5741-
}});
5749+
}
5750+
});
57425751
} else {
57435752
this.executeCallback(rowIndex, visibleColIndex, cb);
57445753
}
57455754
}
57465755

5747-
/**
5748-
* Returns `ICellPosition` which defines the next cell,
5749-
* according to the current position, that match specific criteria.
5750-
* @remarks
5751-
* You can pass callback function as a third parameter of `getPreviousCell` method.
5752-
* The callback function accepts IgxColumnComponent as a param
5753-
* @example
5754-
* ```typescript
5755-
* const nextEditableCellPosition = this.grid.getNextCell(0, 3, (column) => column.editable);
5756-
* ```
5757-
*/
5756+
/**
5757+
* Returns `ICellPosition` which defines the next cell,
5758+
* according to the current position, that match specific criteria.
5759+
* @remarks
5760+
* You can pass callback function as a third parameter of `getPreviousCell` method.
5761+
* The callback function accepts IgxColumnComponent as a param
5762+
* @example
5763+
* ```typescript
5764+
* const nextEditableCellPosition = this.grid.getNextCell(0, 3, (column) => column.editable);
5765+
* ```
5766+
*/
57585767
public getNextCell(currRowIndex: number, curVisibleColIndex: number,
57595768
callback: (IgxColumnComponent) => boolean = null): ICellPosition {
57605769
const columns = this.columnList.filter(col => !col.columnGroup && col.visibleIndex >= 0);
@@ -5777,17 +5786,17 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
57775786
}
57785787
}
57795788

5780-
/**
5781-
* Returns `ICellPosition` which defines the previous cell,
5782-
* according to the current position, that match specific criteria.
5783-
* @remarks
5784-
* You can pass callback function as a third parameter of `getPreviousCell` method.
5785-
* The callback function accepts IgxColumnComponent as a param
5786-
* @example
5787-
* ```typescript
5788-
* const previousEditableCellPosition = this.grid.getPreviousCell(0, 3, (column) => column.editable);
5789-
* ```
5790-
*/
5789+
/**
5790+
* Returns `ICellPosition` which defines the previous cell,
5791+
* according to the current position, that match specific criteria.
5792+
* @remarks
5793+
* You can pass callback function as a third parameter of `getPreviousCell` method.
5794+
* The callback function accepts IgxColumnComponent as a param
5795+
* @example
5796+
* ```typescript
5797+
* const previousEditableCellPosition = this.grid.getPreviousCell(0, 3, (column) => column.editable);
5798+
* ```
5799+
*/
57915800
public getPreviousCell(currRowIndex: number, curVisibleColIndex: number,
57925801
callback: (IgxColumnComponent) => boolean = null): ICellPosition {
57935802
const columns = this.columnList.filter(col => !col.columnGroup && col.visibleIndex >= 0);
@@ -5858,9 +5867,9 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
58585867
}
58595868
// find next/prev record that is editable.
58605869
const nextRowIndex = previous ? this.findPrevEditableDataRowIndex(currentRowIndex) :
5861-
this.dataView.findIndex((rec, index) =>
5862-
index > currentRowIndex && this.isEditableDataRecordAtIndex(index));
5863-
return nextRowIndex !== -1 ? nextRowIndex : currentRowIndex ;
5870+
this.dataView.findIndex((rec, index) =>
5871+
index > currentRowIndex && this.isEditableDataRecordAtIndex(index));
5872+
return nextRowIndex !== -1 ? nextRowIndex : currentRowIndex;
58645873
}
58655874

58665875
/**
@@ -5886,7 +5895,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
58865895
private isEditableDataRecordAtIndex(dataViewIndex) {
58875896
const rec = this.dataView[dataViewIndex];
58885897
return !rec.expression && !rec.summaries && !rec.childGridsData && !rec.detailsData &&
5889-
!this.isGhostRecordAtIndex(dataViewIndex);
5898+
!this.isGhostRecordAtIndex(dataViewIndex);
58905899
}
58915900

58925901
/**
@@ -6254,7 +6263,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
62546263
private configureRowEditingOverlay(rowID: any, useOuter = false) {
62556264
this.rowEditSettings.outlet = useOuter ? this.parentRowOutletDirective : this.rowOutletDirective;
62566265
this.rowEditPositioningStrategy.settings.container = this.tbody.nativeElement;
6257-
const pinned = this._pinnedRecordIDs.indexOf(rowID) !== -1;
6266+
const pinned = this._pinnedRecordIDs.indexOf(rowID) !== -1;
62586267
const targetRow = !pinned ? this.gridAPI.get_row_by_key(rowID) : this.pinnedRows.find(x => x.rowID === rowID);
62596268
if (!targetRow) {
62606269
return;

projects/igniteui-angular/src/lib/grids/grid/grid.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
</div>
242242

243243
<ng-template #defaultPaginator>
244-
<igx-paginator [displayDensity]="displayDensity" [(page)]="page" [totalRecords]="totalRecords" [(perPage)]="perPage">
244+
<igx-paginator [overlaySettings]="paginatorSettings" [displayDensity]="displayDensity" [(page)]="page" [totalRecords]="totalRecords" [(perPage)]="perPage">
245245
</igx-paginator>
246246
</ng-template>
247247

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
</div>
201201

202202
<ng-template #defaultPaginator>
203-
<igx-paginator [displayDensity]="displayDensity" [(page)]="page" [totalRecords]="totalRecords" [(perPage)]="perPage">
203+
<igx-paginator [overlaySettings]="paginatorSettings" [displayDensity]="displayDensity" [(page)]="page" [totalRecords]="totalRecords" [(perPage)]="perPage">
204204
</igx-paginator>
205205
</ng-template>
206206

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
</div>
175175

176176
<ng-template #defaultPaginator>
177-
<igx-paginator [displayDensity]="displayDensity" [(page)]="page" [totalRecords]="totalRecords"
177+
<igx-paginator [overlaySettings]="paginatorSettings" [displayDensity]="displayDensity" [(page)]="page" [totalRecords]="totalRecords"
178178
[(perPage)]="perPage">
179179
</igx-paginator>
180180
</ng-template>

projects/igniteui-angular/src/lib/paginator/paginator.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="igx-paginator__select" [hidden]="dropdownHidden">
22
<label class="igx-paginator__label">{{ resourceStrings.igx_paginator_label }}</label>
33
<div class="igx-paginator__select-input">
4-
<igx-select [(ngModel)]="perPage" [displayDensity]="paginatorSelectDisplayDensity()" type="border"
4+
<igx-select [overlaySettings]="overlaySettings" [(ngModel)]="perPage" [displayDensity]="paginatorSelectDisplayDensity()" type="border"
55
[disabled]="!dropdownEnabled">
66
<label igxLabel [hidden]="true">{{ resourceStrings.igx_paginator_label }}</label>
77
<igx-select-item [value]="val" *ngFor="let val of selectOptions">

0 commit comments

Comments
 (0)