Skip to content

Commit a3f7856

Browse files
committed
refactor(grid): Removed scroll throttle for grid scrolls
1 parent f8ef6ab commit a3f7856

11 files changed

Lines changed: 0 additions & 79 deletions

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
ViewContainerRef,
3131
DOCUMENT,
3232
inject,
33-
InjectionToken
3433
} from '@angular/core';
3534
import {
3635
areEqualArrays,
@@ -111,15 +110,6 @@ import { CharSeparatedValueData, DropPosition, FilterMode, getUUID, GridCellMerg
111110
import { getCurrentI18n, getNumberFormatter, IResourceChangeEventArgs, } from 'igniteui-i18n-core';
112111
import { I18N_FORMATTER } from 'igniteui-angular/core';
113112

114-
/**
115-
* Injection token for setting the throttle time used in grid virtual scroll.
116-
* @hidden
117-
*/
118-
export const SCROLL_THROTTLE_TIME = /*@__PURE__*/new InjectionToken<number>('SCROLL_THROTTLE_TIME', {
119-
factory: () => 40
120-
});
121-
122-
123113
interface IMatchInfoCache {
124114
row: any;
125115
index: number;
@@ -176,7 +166,6 @@ export abstract class IgxGridBaseDirective implements GridType,
176166
protected _diTransactions = inject(IgxGridTransaction, { optional: true });
177167
/** @hidden @internal */
178168
public i18nFormatter = inject(I18N_FORMATTER);
179-
private readonly THROTTLE_TIME = inject(SCROLL_THROTTLE_TIME);
180169

181170
/**
182171
* Gets/Sets the display time for the row adding snackbar notification.
@@ -3730,7 +3719,6 @@ export abstract class IgxGridBaseDirective implements GridType,
37303719

37313720
this.scrollNotify.pipe(
37323721
filter(() => !this._init),
3733-
throttleTime(this.THROTTLE_TIME, animationFrameScheduler, { leading: false, trailing: true }),
37343722
destructor
37353723
)
37363724
.subscribe((event) => {

projects/igniteui-angular/grids/grid/src/grid-cell-selection.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { TestBed, fakeAsync, tick, ComponentFixture, waitForAsync } from '@angular/core/testing';
22
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
33
import { IgxGridComponent } from './public_api';
4-
import { SCROLL_THROTTLE_TIME } from './../src/grid-base.directive';
54
import {
65
SelectionWithScrollsComponent,
76
SelectionWithTransactionsComponent,
@@ -979,9 +978,6 @@ describe('IgxGrid - Cell selection #grid', () => {
979978
let gridContent: DebugElement;
980979

981980
beforeEach(() => {
982-
TestBed.configureTestingModule({
983-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 0 }]
984-
});
985981
fix = TestBed.createComponent(SelectionWithScrollsComponent);
986982
fix.detectChanges();
987983
grid = fix.componentInstance.grid;

projects/igniteui-angular/grids/grid/src/grid-keyBoardNav.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { DebugElement, QueryList } from '@angular/core';
1515
import { IgxGridGroupByRowComponent } from './groupby-row.component';
1616
import { CellType } from 'igniteui-angular/grids/core';
1717
import { DefaultSortingStrategy, SortingDirection } from 'igniteui-angular/core';
18-
import { SCROLL_THROTTLE_TIME } from './../src/grid-base.directive';
1918

2019
const DEBOUNCETIME = 100;
2120

@@ -223,9 +222,6 @@ describe('IgxGrid - Keyboard navigation #grid', () => {
223222
}));
224223

225224
beforeEach(() => {
226-
TestBed.configureTestingModule({
227-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 0 }]
228-
});
229225
fix = TestBed.createComponent(VirtualGridComponent);
230226
fix.detectChanges();
231227
grid = fix.componentInstance.grid;

projects/igniteui-angular/grids/grid/src/grid-mrl-keyboard-nav.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { GridFunctions, GRID_MRL_BLOCK } from '../../../test-utils/grid-function
1111
import { CellType, IGridCellEventArgs, IgxColumnComponent, IgxGridMRLNavigationService } from 'igniteui-angular/grids/core';
1212
import { IgxColumnLayoutComponent } from 'igniteui-angular/grids/core';
1313
import { DefaultSortingStrategy, SortingDirection } from 'igniteui-angular/core';
14-
import { SCROLL_THROTTLE_TIME } from './../src/grid-base.directive';
1514

1615
const DEBOUNCE_TIME = 60;
1716
const CELL_CSS_CLASS = '.igx-grid__td';
@@ -29,9 +28,6 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
2928
}));
3029

3130
beforeEach(() => {
32-
TestBed.configureTestingModule({
33-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 0 }]
34-
});
3531
fix = TestBed.createComponent(ColumnLayoutTestComponent);
3632
});
3733

projects/igniteui-angular/grids/grid/src/grid.component.spec.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { AsyncPipe } from '@angular/common';
1818
import { setElementSize, ymd } from '../../../test-utils/helper-utils.spec';
1919
import { FilteringExpressionsTree, FilteringLogic, getComponentSize, GridColumnDataType, IgxNumberFilteringOperand, IgxStringFilteringOperand, ISortingExpression, ɵSize, SortingDirection } from 'igniteui-angular/core';
2020
import { IgxPaginatorComponent, IgxPaginatorContentDirective } from 'igniteui-angular/paginator';
21-
import { SCROLL_THROTTLE_TIME } from './../src/grid-base.directive';
2221

2322
describe('IgxGrid Component Tests #grid', () => {
2423
const MIN_COL_WIDTH = '136px';
@@ -42,12 +41,6 @@ describe('IgxGrid Component Tests #grid', () => {
4241
.compileComponents();
4342
}));
4443

45-
beforeEach(() => {
46-
TestBed.configureTestingModule({
47-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 0 }]
48-
});
49-
});
50-
5144
it('should initialize a grid with columns from markup', () => {
5245
const fix = TestBed.createComponent(IgxGridMarkupDeclarationComponent);
5346
fix.detectChanges();

projects/igniteui-angular/grids/grid/src/grid.master-detail.spec.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { GridSummaryCalculationMode, IgxStringFilteringOperand, SortingDirection
1515
import { IgxCheckboxComponent } from 'igniteui-angular/checkbox';
1616
import { IgxInputDirective, IgxInputGroupComponent } from 'igniteui-angular/input-group';
1717
import { IgxPaginatorComponent } from 'igniteui-angular/paginator';
18-
import { SCROLL_THROTTLE_TIME } from './../src/grid-base.directive';
1918

2019
const DEBOUNCE_TIME = 60;
2120
const ROW_TAG = 'igx-grid-row';
@@ -44,12 +43,6 @@ describe('IgxGrid Master Detail #grid', () => {
4443
}).compileComponents();
4544
}));
4645

47-
beforeEach(waitForAsync(() => {
48-
TestBed.configureTestingModule({
49-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 0 }]
50-
});
51-
}));
52-
5346
describe('Basic', () => {
5447
beforeEach(fakeAsync(() => {
5548
fix = TestBed.createComponent(DefaultGridMasterDetailComponent);

projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.navigation.spec.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { clearGridSubs, setupHierarchicalGridScrollDetection } from '../../../te
1010
import { GridFunctions } from '../../../test-utils/grid-functions.spec';
1111
import { IGridCellEventArgs, IgxColumnComponent, IgxGridCellComponent, IgxGridNavigationService } from 'igniteui-angular/grids/core';
1212
import { IPathSegment } from 'igniteui-angular/core';
13-
import { SCROLL_THROTTLE_TIME } from './../../grid/src/grid-base.directive';
1413

1514
const DEBOUNCE_TIME = 60;
1615
const GRID_CONTENT_CLASS = '.igx-grid__tbody-content';
@@ -38,20 +37,11 @@ describe('IgxHierarchicalGrid Navigation', () => {
3837
jasmine.DEFAULT_TIMEOUT_INTERVAL = defaultTimeout * 2;
3938
}));
4039

41-
beforeEach(waitForAsync(() => {
42-
TestBed.configureTestingModule({
43-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 0 }]
44-
});
45-
}));
46-
4740
afterAll(() => jasmine.DEFAULT_TIMEOUT_INTERVAL = defaultTimeout);
4841

4942
describe('IgxHierarchicalGrid Basic Navigation #hGrid', () => {
5043

5144
beforeEach(waitForAsync(() => {
52-
TestBed.configureTestingModule({
53-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 0 }]
54-
});
5545
fixture = TestBed.createComponent(IgxHierarchicalGridTestBaseComponent);
5646
fixture.detectChanges();
5747
hierarchicalGrid = fixture.componentInstance.hgrid;
@@ -964,9 +954,6 @@ describe('IgxHierarchicalGrid Navigation', () => {
964954

965955
describe('IgxHierarchicalGrid Navigation API #hGrid', () => {
966956
beforeEach(waitForAsync(() => {
967-
TestBed.configureTestingModule({
968-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 1 }]
969-
});
970957
fixture = TestBed.createComponent(IgxHierarchicalGridMultiLayoutComponent);
971958
fixture.detectChanges();
972959
hierarchicalGrid = fixture.componentInstance.hgrid;

projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.virtualization.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { IgxHierarchicalGridDefaultComponent } from '../../../test-utils/hierarc
1414
import { firstValueFrom } from 'rxjs';
1515
import { FilteringExpressionsTree, FilteringLogic, IgxStringFilteringOperand } from 'igniteui-angular/core';
1616
import { IgxGridNavigationService } from 'igniteui-angular/grids/core';
17-
import { SCROLL_THROTTLE_TIME } from './../../grid/src/grid-base.directive';
1817

1918
describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
2019
let fixture;
@@ -34,9 +33,6 @@ describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
3433
}));
3534

3635
beforeEach(() => {
37-
TestBed.configureTestingModule({
38-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 1 }]
39-
});
4036
fixture = TestBed.createComponent(IgxHierarchicalGridTestBaseComponent);
4137
fixture.detectChanges();
4238
hierarchicalGrid = fixture.componentInstance.hgrid;

projects/igniteui-angular/grids/tree-grid/src/tree-grid-keyBoardNav.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { GridFunctions } from '../../../test-utils/grid-functions.spec';
99
import { DebugElement } from '@angular/core';
1010
import { firstValueFrom } from 'rxjs';
1111
import { CellType } from 'igniteui-angular/grids/core';
12-
import { SCROLL_THROTTLE_TIME } from './../../grid/src/grid-base.directive';
1312

1413
const DEBOUNCETIME = 60;
1514

@@ -397,9 +396,6 @@ describe('IgxTreeGrid - Key Board Navigation #tGrid', () => {
397396
const treeColumns = ['ID', 'Name', 'HireDate', 'Age', 'OnPTO'];
398397

399398
beforeEach(() => {
400-
TestBed.configureTestingModule({
401-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 0 }]
402-
});
403399
fix = TestBed.createComponent(IgxTreeGridWithScrollsComponent);
404400
fix.detectChanges();
405401
treeGrid = fix.componentInstance.treeGrid;

projects/igniteui-angular/grids/tree-grid/src/tree-grid-multi-cell-selection.spec.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { UIInteractions, wait } from '../../../test-utils/ui-interactions.spec';
1111
import { GridSelectionFunctions, GridSummaryFunctions, GridFunctions } from '../../../test-utils/grid-functions.spec';
1212
import { GridSelectionMode } from 'igniteui-angular/grids/core';
1313
import { IgxStringFilteringOperand } from 'igniteui-angular/core';
14-
import { SCROLL_THROTTLE_TIME } from './../../grid/src/grid-base.directive';
1514

1615
describe('IgxTreeGrid - Multi Cell selection #tGrid', () => {
1716

@@ -33,9 +32,6 @@ describe('IgxTreeGrid - Multi Cell selection #tGrid', () => {
3332
let detect;
3433

3534
beforeEach(() => {
36-
TestBed.configureTestingModule({
37-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 1 }]
38-
});
3935
fix = TestBed.createComponent(IgxTreeGridSelectionKeyComponent);
4036
fix.detectChanges();
4137
treeGrid = fix.componentInstance.treeGrid;
@@ -560,9 +556,6 @@ describe('IgxTreeGrid - Multi Cell selection #tGrid', () => {
560556
let detect;
561557

562558
beforeEach(() => {
563-
TestBed.configureTestingModule({
564-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 0 }]
565-
});
566559
fix = TestBed.createComponent(IgxTreeGridSelectionComponent);
567560
fix.detectChanges();
568561
treeGrid = fix.componentInstance.treeGrid;
@@ -675,9 +668,6 @@ describe('IgxTreeGrid - Multi Cell selection #tGrid', () => {
675668
let treeGrid;
676669

677670
beforeEach(() => {
678-
TestBed.configureTestingModule({
679-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 0 }]
680-
});
681671
fix = TestBed.createComponent(IgxTreeGridSelectionWithTransactionComponent);
682672
fix.detectChanges();
683673
treeGrid = fix.componentInstance.treeGrid;
@@ -808,9 +798,6 @@ describe('IgxTreeGrid - Multi Cell selection #tGrid', () => {
808798
let treeGrid;
809799

810800
beforeEach(() => {
811-
TestBed.configureTestingModule({
812-
providers: [{ provide: SCROLL_THROTTLE_TIME, useValue: 0 }]
813-
});
814801
fix = TestBed.createComponent(IgxTreeGridFKeySelectionWithTransactionComponent);
815802
fix.detectChanges();
816803
treeGrid = fix.componentInstance.treeGrid;

0 commit comments

Comments
 (0)