Skip to content
This repository was archived by the owner on Jun 22, 2020. It is now read-only.

Commit dc08e7f

Browse files
committed
fixup
1 parent 135b10d commit dc08e7f

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

projects/table-builder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular-ru/ng-table-builder",
3-
"version": "0.33.0",
3+
"version": "0.34.0",
44
"license": "MIT",
55
"bugs": {
66
"url": "https://github.com/Angular-RU/ng-table-builder/issues"

projects/table-builder/src/lib/table/animations/fade.animation.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ import { animate, AnimationTriggerMetadata, state, style, transition, trigger }
33
const DEFAULT_TIME_ANIMATION: number = 150;
44

55
export const NGX_ANIMATION: AnimationTriggerMetadata = trigger('fadeAnimation', [
6-
// the "in" style determines the "resting" state of the element when it is visible.
76
state('in', style({ opacity: 1 })),
8-
9-
// fade in when created. this could also be written as transition('void => *')
107
transition(':enter', [style({ opacity: 0 }), animate(DEFAULT_TIME_ANIMATION)]),
11-
12-
// fade out when destroyed. this could also be written as transition('void => *')
13-
transition(':leave', animate(DEFAULT_TIME_ANIMATION, style({ opacity: 0 })))
8+
transition(':leave', animate(0, style({ opacity: 0 })))
149
]);

projects/table-builder/src/lib/table/directives/virtual-for.directive.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export class VirtualForDirective implements OnDestroy {
1111
@Input() public virtualForBufferOffset: number | null = null;
1212
private cache: Map<number, InternalVirtualRef> = new Map();
1313
private _source: TableRow[] = [];
14-
// noinspection JSMismatchedCollectionQueryUpdate
1514
private _indexes: VirtualIndex[] = [];
1615
private createFrameId: number;
1716
private removeFrameId: number;
@@ -35,23 +34,23 @@ export class VirtualForDirective implements OnDestroy {
3534

3635
this._indexes = indexes;
3736
this.removeOldNodes();
38-
this.createNewNodes(indexes);
37+
this.createNewNodes(this._indexes);
3938
}
4039

4140
private get sourceRef(): TableRow[] {
4241
return this._source || [];
4342
}
4443

4544
public ngOnDestroy(): void {
46-
this.view.clear();
4745
window.cancelAnimationFrame(this.createFrameId);
4846
window.cancelAnimationFrame(this.removeFrameId);
47+
this.view.clear();
4948
}
5049

5150
private createNewNodes(indexes: VirtualIndex[]): void {
5251
indexes.forEach(
5352
(index: VirtualIndex): void => {
54-
if (this.virtualForBufferOffset < 0) {
53+
if (this.virtualBufferIsOverloadOrNull) {
5554
this.createEmbeddedViewByIndex(index);
5655
} else {
5756
this.createFrameId = window.requestAnimationFrame(
@@ -97,7 +96,7 @@ export class VirtualForDirective implements OnDestroy {
9796

9897
this.virtualForDiffIndexes.forEach(
9998
(index: number): void => {
100-
if (this.virtualForBufferOffset < 0) {
99+
if (this.virtualBufferIsOverloadOrNull) {
101100
this.removeEmbeddedViewByIndex(index);
102101
} else {
103102
this.removeFrameId = window.requestAnimationFrame(
@@ -108,6 +107,10 @@ export class VirtualForDirective implements OnDestroy {
108107
);
109108
}
110109

110+
private get virtualBufferIsOverloadOrNull(): boolean {
111+
return this.virtualForBufferOffset < 0 || !Number.isInteger(this.virtualForBufferOffset);
112+
}
113+
111114
private removeEmbeddedViewByIndex(index: number): void {
112115
const ref: InternalVirtualRef | undefined = this.cache.get(index);
113116
if (ref) {

projects/table-builder/src/lib/table/table-builder.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
[class.table-grid__column--filter-enable]="filterTemplate"
8888
(observeVisible)="markVisibleColumn(column, $event)"
8989
>
90-
<div *ngIf="column['visible']">
90+
<div *ngIf="column['visible']" [@fadeAnimation]>
9191
<table-thead
9292
cdkDragHandle
9393
[column-schema]="columnSchema"

0 commit comments

Comments
 (0)