You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mohemm_moe/Mohem/src/app/hmg-common/ui/dynamic-table/dynamic-table.component.ts

39 lines
842 B
TypeScript

import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'dynamic-table',
templateUrl: './dynamic-table.component.html',
styleUrls: ['./dynamic-table.component.scss']
})
export class DynamicTableComponent implements OnInit {
@Input() objectsArray: any[];
@Input() properties: string[];
@Input() headers: string[];
@Input() title: string;
@Input() validValuesOnly = false;
constructor() { }
ngOnInit() {
}
/*
row is valid if has no integer with 0 value
*/
public isValidRow(objectData: any): boolean {
if (this.validValuesOnly) {
for (const property of this.properties) {
const value = objectData[property];
if (typeof value === 'number') {
if (value === 0) {
return false;
}
}
}
}
return true;
}
}