import { Component } from '@angular/core' ; import { BaseDocumentationSection } from '../../../../../components/base-documentation-section/base-documentation-section' ; import { DocumentationSectionComponent } from '../../../../../decorators/documentation-section-component' ; import { IPlayground } from '../../../../../interfaces/IPlayground' ; import { IPlaygroundProvider } from '../../../../../interfaces/IPlaygroundProvider' ; @ Component ( { selector : 'uxd-components-fixed-header-table' , templateUrl : './fixed-header-table.component.html' , styleUrls : [ './fixed-header-table.component.less' ] } ) @ DocumentationSectionComponent ( 'ComponentsFixedHeaderTableComponent' ) export class ComponentsFixedHeaderTableComponent extends BaseDocumentationSection implements IPlaygroundProvider { people : ReadonlyArray < Person > = [ ] ; loading : boolean = false ; total : number = 250 ; private _page : number = 0 ; playground : IPlayground = { files : { 'app.component.html' : this . snippets . raw . appHtml , 'app.component.ts' : this . snippets . raw . appTs , 'app.component.css' : this . snippets . raw . appCss } , modules : [ { library : 'chance' } , { imports : [ 'FixedHeaderTableModule' ] , library : '@ux-aspects/ux-aspects' } ] } ; constructor ( ) { super ( require . context ( './snippets/' , false , /\.(html|css|js|ts)$/ ) ) ; } /**
     * Simulate the server request
     */ loadPage ( ) { if ( this . loading || this . _page >= 5 ) { return ; } this . loading = true ; setTimeout ( ( ) => { this . people = [ ... this . people , ... this . getPeople ( this . _page ++ , 50 ) ] ; this . loading = false ; } , 2000 ) ; } /**
     * Generate some data about people
     */ private getPeople ( page , count ) { const people = [ ] ; for ( let idx = page * count ; idx < ( page * count ) + count ; idx ++ ) { people . push ( { id : idx , name : chance . name ( ) , address : chance . address ( ) , phone : chance . phone ( ) , active : chance . bool ( ) } ) ; } return people ; } } interface Person { id : number ; name : string ; address : string ; phone : string ; active : boolean ; }