Skip to content

Commit

Permalink
fix(lazy-load): add lazy load support
Browse files Browse the repository at this point in the history
  • Loading branch information
PxyUp committed Apr 26, 2019
1 parent ee9a504 commit bf5eb7b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Make sure you have:
```typescript
import { NgVirtualTableModule } from 'ng-virtual-table';

imports: [NgVirtualTableModule.forRoot()],
imports: [NgVirtualTableModule],
```

```html
Expand Down
31 changes: 12 additions & 19 deletions lib/src/ngVirtualTable.module.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { NgModule, ModuleWithProviders, EmbeddedViewRef } from '@angular/core';
import { CdkVirtualForOf, CdkVirtualForOfContext, ScrollingModule } from '@angular/cdk/scrolling';
import { EmbeddedViewRef, ModuleWithProviders, NgModule } from '@angular/core';

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { CommonModule } from '@angular/common';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { ScrollingModule, CdkVirtualForOf, CdkVirtualForOfContext } from '@angular/cdk/scrolling';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { VirtualTableComponent } from './components/virtual-table.component';
import { ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatIconModule } from '@angular/material/icon';
import { MatFormFieldModule } from '@angular/material/form-field';
import { DynamicModule } from 'ng-dynamic-component';
import { NgVirtualTableService } from './services/ngVirtualTable.service';
import { LayoutModule } from '@angular/cdk/layout';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { NgVirtualTableService } from './services/ngVirtualTable.service';
import { ReactiveFormsModule } from '@angular/forms';
import { VirtualTableComponent } from './components/virtual-table.component';

CdkVirtualForOf.prototype['_updateContext'] = function(this: any) {
const count = this._data.length;
Expand All @@ -32,7 +33,6 @@ CdkVirtualForOf.prototype['_updateContext'] = function(this: any) {
imports: [
CommonModule,
ReactiveFormsModule,
BrowserAnimationsModule,
MatIconModule,
MatFormFieldModule,
ScrollingModule,
Expand All @@ -44,11 +44,4 @@ CdkVirtualForOf.prototype['_updateContext'] = function(this: any) {
],
exports: [VirtualTableComponent],
})
export class NgVirtualTableModule {
public static forRoot(): ModuleWithProviders {
return {
ngModule: NgVirtualTableModule,
providers: [NgVirtualTableService],
};
}
}
export class NgVirtualTableModule {}
7 changes: 5 additions & 2 deletions lib/src/services/ngVirtualTable.service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { Injectable } from '@angular/core';
import {
VirtualTableColumn,
VirtualTableColumnInternal,
VirtualTableItem,
sortColumn,
} from '../interfaces';

@Injectable()
import { Injectable } from '@angular/core';

@Injectable({
providedIn: 'root',
})
export class NgVirtualTableService {
public defaultComparator(a: any, b: any): number {
if (a > b) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-virtual-table",
"version": "1.0.45",
"version": "1.0.46",
"description": "Angular 7 virtual scroll table with support dynamic component, draggable, filtering, server side, sorting, pagination, resizable and custom config column",
"main": "index.js",
"repository": "[email protected]:PxyUp/ng-virtual-table.git",
Expand Down

0 comments on commit bf5eb7b

Please sign in to comment.