Skip to content

Commit 34863cf

Browse files
committed
chore(*): changing pipe modules
1 parent c3a1878 commit 34863cf

File tree

6 files changed

+49
-52
lines changed

6 files changed

+49
-52
lines changed

projects/igniteui-angular/src/lib/grids/common/grid-pipes.module.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
IgxGridPaginatorOptionsPipe,
1111
IgxHasVisibleColumnsPipe,
1212
IgxDatePipeComponent,
13-
IgxDecimalPipeComponent
13+
IgxDecimalPipeComponent,
14+
IgxGridRowPinningPipe
1415
} from './pipes';
1516

1617
@NgModule({
@@ -24,7 +25,8 @@ import {
2425
IgxGridCellStylesPipe,
2526
IgxGridCellStyleClassesPipe,
2627
IgxGridPaginatorOptionsPipe,
27-
IgxHasVisibleColumnsPipe
28+
IgxHasVisibleColumnsPipe,
29+
IgxGridRowPinningPipe
2830
],
2931
exports: [
3032
IgxDatePipeComponent,
@@ -36,7 +38,8 @@ import {
3638
IgxGridCellStylesPipe,
3739
IgxGridCellStyleClassesPipe,
3840
IgxGridPaginatorOptionsPipe,
39-
IgxHasVisibleColumnsPipe
41+
IgxHasVisibleColumnsPipe,
42+
IgxGridRowPinningPipe
4043
],
4144
imports: [
4245
CommonModule

projects/igniteui-angular/src/lib/grids/common/pipes.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,34 @@ export class IgxDecimalPipeComponent extends DecimalPipe implements PipeTransfor
212212
}
213213
}
214214
}
215+
216+
/**
217+
* @hidden
218+
*/
219+
@Pipe({
220+
name: 'gridRowPinning',
221+
pure: true
222+
})
223+
export class IgxGridRowPinningPipe implements PipeTransform {
224+
225+
constructor(private gridAPI: GridBaseAPIService<IgxGridBaseDirective & GridType>) {}
226+
227+
public transform(collection: any[] , id: string, isPinned = false, pipeTrigger: number) {
228+
const grid = this.gridAPI.grid;
229+
230+
if (!grid.hasPinnedRecords) {
231+
return isPinned ? [] : collection;
232+
}
233+
234+
if (grid.hasPinnedRecords && isPinned) {
235+
const result = collection.filter(rec => grid.isRecordPinned(rec));
236+
result.sort((rec1, rec2) => grid.pinRecordIndex(rec1) - grid.pinRecordIndex(rec2));
237+
return result;
238+
}
239+
240+
grid.unpinnedRecords = collection;
241+
return collection.map((rec) => {
242+
return grid.isRecordPinned(rec) ? { recordRef: rec, ghostRecord: true} : rec;
243+
});
244+
}
245+
}

projects/igniteui-angular/src/lib/grids/grid-common.module.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import { IgxGridColumnModule } from './columns/column.module';
2929
import { IgxGridHeadersModule } from './headers/headers.module';
3030
import { IgxGridFilteringModule } from './filtering/base/filtering.module';
3131
import { IgxRowDirective } from './row.directive';
32-
import { IgxGridRowPinningPipe } from './grid/grid.pipes';
3332
/**
3433
* @hidden
3534
*/
@@ -45,7 +44,6 @@ import { IgxGridRowPinningPipe } from './grid/grid.pipes';
4544
IgxGridBodyDirective,
4645
IgxGridFooterComponent,
4746
IgxAdvancedFilteringDialogComponent,
48-
IgxGridRowPinningPipe
4947
],
5048
entryComponents: [
5149
IgxAdvancedFilteringDialogComponent
@@ -74,7 +72,6 @@ import { IgxGridRowPinningPipe } from './grid/grid.pipes';
7472
IgxGridToolbarModule,
7573
IgxAdvancedFilteringDialogComponent,
7674
IgxGridSharedModules,
77-
IgxGridRowPinningPipe
7875
],
7976
imports: [
8077
IgxGridColumnModule,

projects/igniteui-angular/src/lib/grids/grid/grid.module.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import {
1313
IgxGridPagingPipe,
1414
IgxGridGroupingPipe,
1515
IgxGridSortingPipe,
16-
IgxGridFilteringPipe,
17-
IgxGridRowPinningPipe
16+
IgxGridFilteringPipe
1817
} from './grid.pipes';
1918
import { IgxGridGroupByRowComponent } from './groupby-row.component';
2019
import { IgxGridRowComponent } from './grid-row.component';

projects/igniteui-angular/src/lib/grids/grid/grid.pipes.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -152,33 +152,3 @@ export class IgxGridFilteringPipe implements PipeTransform {
152152
}
153153
}
154154

155-
/**
156-
* @hidden
157-
*/
158-
@Pipe({
159-
name: 'gridRowPinning',
160-
pure: true
161-
})
162-
export class IgxGridRowPinningPipe implements PipeTransform {
163-
164-
constructor(private gridAPI: GridBaseAPIService<IgxGridBaseDirective & GridType>) {}
165-
166-
public transform(collection: any[] , id: string, isPinned = false, pipeTrigger: number) {
167-
const grid = this.gridAPI.grid;
168-
169-
if (!grid.hasPinnedRecords) {
170-
return isPinned ? [] : collection;
171-
}
172-
173-
if (grid.hasPinnedRecords && isPinned) {
174-
const result = collection.filter(rec => grid.isRecordPinned(rec));
175-
result.sort((rec1, rec2) => grid.pinRecordIndex(rec1) - grid.pinRecordIndex(rec2));
176-
return result;
177-
}
178-
179-
grid.unpinnedRecords = collection;
180-
return collection.map((rec) => {
181-
return grid.isRecordPinned(rec) ? { recordRef: rec, ghostRecord: true} : rec;
182-
});
183-
}
184-
}

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

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
import { Component, ChangeDetectorRef, ElementRef, ViewChild, Inject,
2-
ChangeDetectionStrategy, NgZone, OnInit, Input, TemplateRef } from '@angular/core';
3-
import { IgxGridCellComponent } from '../cell.component';
1+
import { Component, ChangeDetectorRef, ElementRef, Inject, ChangeDetectionStrategy, NgZone, Input } from '@angular/core';
42
import { IgxTreeGridAPIService } from './tree-grid-api.service';
53
import { GridBaseAPIService } from '../api.service';
6-
import { getNodeSizeViaRange, PlatformUtil } from '../../core/utils';
4+
import { PlatformUtil } from '../../core/utils';
75
import { DOCUMENT } from '@angular/common';
86
import { IgxGridBaseDirective } from '../grid';
97
import { IgxGridSelectionService, IgxGridCRUDService } from '../selection/selection.service';
108
import { HammerGesturesManager } from '../../core/touch';
119
import { GridType } from '../common/grid.interface';
1210
import { IgxGridExpandableCellComponent } from '../grid/expandable-cell.component';
13-
import { IgxChipComponent } from '../../chips';
1411

1512
@Component({
1613
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -22,15 +19,15 @@ export class IgxTreeGridCellComponent extends IgxGridExpandableCellComponent {
2219
private treeGridAPI: IgxTreeGridAPIService;
2320

2421
constructor(
25-
selectionService: IgxGridSelectionService,
26-
crudService: IgxGridCRUDService,
27-
gridAPI: GridBaseAPIService<IgxGridBaseDirective & GridType>,
28-
cdr: ChangeDetectorRef,
29-
element: ElementRef,
30-
protected zone: NgZone,
31-
touchManager: HammerGesturesManager,
32-
@Inject(DOCUMENT) public document,
33-
protected platformUtil: PlatformUtil) {
22+
selectionService: IgxGridSelectionService,
23+
crudService: IgxGridCRUDService,
24+
gridAPI: GridBaseAPIService<IgxGridBaseDirective & GridType>,
25+
cdr: ChangeDetectorRef,
26+
element: ElementRef,
27+
protected zone: NgZone,
28+
touchManager: HammerGesturesManager,
29+
@Inject(DOCUMENT) public document,
30+
protected platformUtil: PlatformUtil) {
3431
super(selectionService, crudService, gridAPI, cdr, element, zone, touchManager, document, platformUtil);
3532
this.treeGridAPI = <IgxTreeGridAPIService>gridAPI;
3633
}

0 commit comments

Comments
 (0)