bug fixed
This commit is contained in:
parent
6a0f008457
commit
0fc503db87
|
@ -1,12 +1,21 @@
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||||
|
|
||||||
import { LogService } from '@ucap/ng-logger';
|
import { LogService } from '@ucap/ng-logger';
|
||||||
import {
|
import {
|
||||||
VirtualScrollStrategy,
|
VirtualScrollStrategy,
|
||||||
FixedSizeVirtualScrollStrategy,
|
FixedSizeVirtualScrollStrategy,
|
||||||
VIRTUAL_SCROLL_STRATEGY
|
VIRTUAL_SCROLL_STRATEGY,
|
||||||
|
CdkVirtualScrollViewport
|
||||||
} from '@angular/cdk/scrolling';
|
} from '@angular/cdk/scrolling';
|
||||||
|
|
||||||
|
export class GroupVirtualScrollStrategy extends FixedSizeVirtualScrollStrategy {
|
||||||
|
constructor() {
|
||||||
|
super(60, 150, 200); // (itemSize, minBufferPx, maxBufferPx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-sections-group-list',
|
selector: 'app-sections-group-list',
|
||||||
templateUrl: './list.section.component.html',
|
templateUrl: './list.section.component.html',
|
||||||
|
@ -14,7 +23,7 @@ import {
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: VIRTUAL_SCROLL_STRATEGY,
|
provide: VIRTUAL_SCROLL_STRATEGY,
|
||||||
useValue: new FixedSizeVirtualScrollStrategy(60, 3, 3)
|
useClass: GroupVirtualScrollStrategy
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
31
src/app/sections/group/components/list.section.strategy.ts
Normal file
31
src/app/sections/group/components/list.section.strategy.ts
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
import { Observable, Subject } from 'rxjs';
|
||||||
|
|
||||||
|
import {
|
||||||
|
VirtualScrollStrategy,
|
||||||
|
CdkVirtualScrollViewport
|
||||||
|
} from '@angular/cdk/scrolling';
|
||||||
|
import { distinctUntilChanged } from 'rxjs/operators';
|
||||||
|
|
||||||
|
export class GroupVirtualScrollStrategy implements VirtualScrollStrategy {
|
||||||
|
scrolledIndexChange: Observable<number>;
|
||||||
|
|
||||||
|
private indexSubject = new Subject<number>();
|
||||||
|
private viewport: CdkVirtualScrollViewport | null = null;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.scrolledIndexChange = this.indexSubject.pipe(distinctUntilChanged());
|
||||||
|
}
|
||||||
|
|
||||||
|
attach(viewport: CdkVirtualScrollViewport): void {
|
||||||
|
this.viewport = viewport;
|
||||||
|
}
|
||||||
|
detach(): void {
|
||||||
|
this.indexSubject.complete();
|
||||||
|
this.viewport = null;
|
||||||
|
}
|
||||||
|
onContentScrolled(): void {}
|
||||||
|
onDataLengthChanged(): void {}
|
||||||
|
onContentRendered(): void {}
|
||||||
|
onRenderedOffsetChanged(): void {}
|
||||||
|
scrollToIndex(index: number, behavior: ScrollBehavior): void {}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user