diff options
Diffstat (limited to 'frontend/src/app/_elements/datatable')
4 files changed, 73 insertions, 0 deletions
diff --git a/frontend/src/app/_elements/datatable/datatable.component.css b/frontend/src/app/_elements/datatable/datatable.component.css new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/frontend/src/app/_elements/datatable/datatable.component.css diff --git a/frontend/src/app/_elements/datatable/datatable.component.html b/frontend/src/app/_elements/datatable/datatable.component.html new file mode 100644 index 00000000..2c469ecc --- /dev/null +++ b/frontend/src/app/_elements/datatable/datatable.component.html @@ -0,0 +1,29 @@ +<div *ngIf="data"> + <div class="table-responsive"> + <table *ngIf="hasHeader" class="table table-bordered table-light mt-4"> + <thead> + <tr> + <th *ngFor="let item of data[0]; let i = index">{{item}}</th> + </tr> + </thead> + <tbody> + <tr *ngFor="let row of data | slice:1:11"> + <td *ngFor="let col of row">{{col}}</td> + </tr> + </tbody> + </table> + + <table *ngIf="data.length > 0 && !hasHeader" class="table table-bordered table-light mt-4"> + <tbody> + <tr *ngFor="let row of data | slice:0:10"> + <td *ngFor="let col of row">{{col}}</td> + </tr> + </tbody> + </table> + </div> + + <div id="info"> + . . . <br> + {{data.length}} x {{data[0].length}} + </div> +</div>
\ No newline at end of file diff --git a/frontend/src/app/_elements/datatable/datatable.component.spec.ts b/frontend/src/app/_elements/datatable/datatable.component.spec.ts new file mode 100644 index 00000000..3cf06160 --- /dev/null +++ b/frontend/src/app/_elements/datatable/datatable.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DatatableComponent } from './datatable.component'; + +describe('DatatableComponent', () => { + let component: DatatableComponent; + let fixture: ComponentFixture<DatatableComponent>; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ DatatableComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(DatatableComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/_elements/datatable/datatable.component.ts b/frontend/src/app/_elements/datatable/datatable.component.ts new file mode 100644 index 00000000..d3740d83 --- /dev/null +++ b/frontend/src/app/_elements/datatable/datatable.component.ts @@ -0,0 +1,19 @@ +import { Component, Input, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-datatable', + templateUrl: './datatable.component.html', + styleUrls: ['./datatable.component.css'] +}) +export class DatatableComponent implements OnInit { + + @Input() hasHeader?: boolean = true; + + @Input() data?: any[] = []; + + constructor() { } + + ngOnInit(): void { + } + +} |