1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-24 07:17:55 +01:00

refactor: ♻️ Aggiunto ulteriore tipo di dato per le colonne

This commit is contained in:
Maicol Battistini 2021-09-13 19:14:40 +02:00
parent ca1a43bb89
commit daa16ffed9
No known key found for this signature in database
GPG Key ID: 4FDB0F87CDB1D34A

View File

@ -1,3 +1,7 @@
import '@material/mwc-dialog';
import '@material/mwc-fab';
import collect from 'collect.js';
import {Children} from 'mithril'; import {Children} from 'mithril';
import DataTable from '../DataTable/DataTable'; import DataTable from '../DataTable/DataTable';
@ -10,25 +14,28 @@ import TableRow from '../DataTable/TableRow';
import Mdi from '../Mdi'; import Mdi from '../Mdi';
import Page from '../Page'; import Page from '../Page';
type ColumnT = {
id?: string,
title: string,
type: 'checkbox' | 'numeric' | null
}
/** /**
* @abstract * @abstract
*/ */
export default class RecordsPage extends Page { export default class RecordsPage extends Page {
columns: Array<{ columns: Object<ColumnT> | Array<ColumnT>;
id: string,
title: string,
type: string | null
}>;
rows: Array<Array<string>> = []; rows: Array<Array<string>> = [];
dialogs: Array<Children>; dialogs: Array<Children>;
tableColumns(): Children { tableColumns(): Children {
return this.columns.map( return collect(this.columns)
(column, index) => ( .map(
<TableHeadCell key={index}> (column: ColumnT, id: string) => (
{column} <TableHeadCell id={id} key={id} {...column}>
{column.title}
</TableHeadCell> </TableHeadCell>
) )
); );