1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-06-05 22:09:38 +02:00

feat: Major refactor componente DataTable

- Aggiunto supporto per le tabelle "checkable" (tabelle con le checkbox)
- Migliorata la gestione generale della tabella, rendendola meno complicata da creare
This commit is contained in:
Maicol Battistini
2021-11-22 19:22:54 +01:00
parent e5d04fbf17
commit 7acaf6ed38
12 changed files with 210 additions and 107 deletions

View File

@@ -6,7 +6,14 @@ import Component from '../Component.jsx';
*/
export default class TableCell extends Component {
view(vnode) {
this.attrs.addClassNames('mdc-data-table__cell', `mdc-data-table__cell--${this.attrs.get('type')}`);
this.attrs.addClassNames('mdc-data-table__cell', {
[`mdc-data-table__cell--${this.attrs.get('type')}`]: this.attrs.has('type')
});
if ((!vnode.children || vnode.children.length === 0) && this.attrs.get('type') === 'checkbox') {
vnode.children = <mwc-checkbox/>;
}
return <td {...this.attrs.all()}>{vnode.children}</td>;
}
}