import React from 'react';
import PropTypes from 'prop-types';
import { withStyles, withTheme } from '@material-ui/core/styles';
import TextField from '@material-ui/core/TextField';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableRow from '@material-ui/core/TableRow';
import TableCell from '@material-ui/core/TableCell';
import TableHead from '@material-ui/core/TableHead';
import TablePagination from '@material-ui/core/TablePagination';
import DeleteOutlinedIcon from '@material-ui/icons/DeleteOutlined';
import { CalendarField, EventField } from './RegexField';
import theme from './theme';
const styles = theme => ({
deleteButtonShow: {
position: 'absolute',
right: 0,
height: 48
},
deleteButtonHide: {
display: 'none'
},
deleteIcon: {
height: '100%',
cursor: 'pointer'
},
patternTableWrapper: {
overflowX: 'auto',
overflowY: 'hidden'
},
patternTable: {
minWidth: 600
}
});
const patternHead = [
{label: "Name", field: "name", elem: TextField},
{label: "Calendar", field: "cal", elem: withTheme(theme)(CalendarField)},
{label: "Event", field: 'event', elem: withTheme(theme)(EventField)}];
class PatternTable extends React.Component {
state = {
page: 0,
rowsPerPage: 5,
};
handleChangePage = (event, page) => {
this.setState({ page });
}
handleChangeRowsPerPage = event => {
this.setState({ rowsPerPage: event.target.value });
}
render() {
const { classes, calendars, patterns } = this.props;
const { rowsPerPage, page } = this.state;
const nDummy = rowsPerPage - Math.min(rowsPerPage, patterns.length - page * rowsPerPage);
let rows = patterns.slice(page * rowsPerPage, (page + 1) * rowsPerPage).map(p => (