Skip to content

Instantly share code, notes, and snippets.

@hebertlima
Last active September 26, 2020 15:25
Show Gist options
  • Select an option

  • Save hebertlima/74f31ff7a3e5ef1b822d5b349660ceec to your computer and use it in GitHub Desktop.

Select an option

Save hebertlima/74f31ff7a3e5ef1b822d5b349660ceec to your computer and use it in GitHub Desktop.
table.ts
export class Table {
headers: [{
title: 'Header 1',
code: 'header'
}];
data: any;
hiddenFields: any[];
tablefields: any[];
tableTrExpand: false;
button: ButtonTable;
subHeaders: any[];
constructor(options?: {
tableTrExpand?: boolean
headers?: { title: string, code?: string, style?: string, join?: any[] }[],
subHeaders?: { title: string, code?: string, style?: string, join?: any[] }[],
data?: any,
button?: ButtonTable
}) {
if (options) {
Object.assign(this, options);
this.clear();
}
}
private clear(): void {
Object.keys(this).forEach(key => {
if (Array.isArray( key ) ) {
this[key].filter(item => item );
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment