mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
feat: ✨ Ristrutturazione completa del progetto
This commit is contained in:
44
resources/ts/Components/DataTable/DataTable.tsx
Normal file
44
resources/ts/Components/DataTable/DataTable.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
import '@maicol07/material-web-additions/data-table/data-table.js';
|
||||
|
||||
import {
|
||||
mdiChevronLeft,
|
||||
mdiChevronRight,
|
||||
mdiPageFirst,
|
||||
mdiPageLast
|
||||
} from '@mdi/js';
|
||||
import {
|
||||
Children,
|
||||
Vnode
|
||||
} from 'mithril';
|
||||
|
||||
import {
|
||||
Attributes,
|
||||
Component
|
||||
} from '~/Components/Component';
|
||||
import MdIcon from '~/Components/MdIcon';
|
||||
|
||||
export interface DataTableAttributes extends Attributes {
|
||||
inProgress?: boolean;
|
||||
paginated?: boolean;
|
||||
currentPageSize?: number;
|
||||
pageSizesLabel?: string;
|
||||
paginationTotalLabel?: string;
|
||||
}
|
||||
|
||||
export default class DataTable<A extends DataTableAttributes = DataTableAttributes> extends Component<A> {
|
||||
view(vnode: Vnode<A>) {
|
||||
return (
|
||||
<md-data-table pageSizesLabel={__('Righe per pagina:')} paginationTotalLabel={__(':firstRow-:lastRow di :totalRows')} {...vnode.attrs}>
|
||||
{this.contents(vnode)}
|
||||
<MdIcon icon={mdiPageFirst} slot="pagination-first-button-icon"/>
|
||||
<MdIcon icon={mdiChevronLeft} slot="pagination-previous-button-icon"/>
|
||||
<MdIcon icon={mdiChevronRight} slot="pagination-next-button-icon"/>
|
||||
<MdIcon icon={mdiPageLast} slot="pagination-last-button-icon"/>
|
||||
</md-data-table>
|
||||
);
|
||||
}
|
||||
|
||||
contents(vnode: Vnode<A>): Children {
|
||||
return vnode.children;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user