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

feat: Aggiunti tipi agli attributi dei componenti

This commit is contained in:
Maicol Battistini
2021-12-14 10:27:19 +01:00
parent f9b8daab1b
commit 6f367a5e76
11 changed files with 56 additions and 22 deletions

View File

@ -1,15 +1,19 @@
import '@material/mwc-icon-button-toggle';
import {type Cash} from 'cash-dom/dist/cash';
import {type Cash} from 'cash-dom';
import PropTypes from 'prop-types';
import Component from '../Component.jsx';
import Mdi from '../Mdi.jsx';
/**
* Attributes:
* - type?: numeric, checkbox
*/
export default class TableColumn extends Component {
static propTypes = {
type: PropTypes.oneOf(['numeric', 'checkbox']),
id: PropTypes.string,
sortable: PropTypes.bool,
filterable: PropTypes.bool
};
view(vnode) {
this.attrs.addClassNames('mdc-data-table__header-cell', {
[`mdc-data-table__header-cell--${this.attrs.get('type')}`]: this.attrs.has('type')
@ -111,10 +115,11 @@ export default class TableColumn extends Component {
const index = $(this.element).index();
const rows: Cash = $(this.element).closest('table').find('tbody tr');
rows.hide();
rows.filter((index_, element) => $(element)
.find(`td:nth-child(${index + 1})`)
.text()
.search(event.target.value) !== -1
).show();
rows.filter((index_, element) => (
$(element)
.find(`td:nth-child(${index + 1})`)
.text()
.search(event.target.value) !== -1
)).show();
}
}