1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
import React from 'react';
import PropTypes from 'prop-types';
import MainTable from './tableParts/MainTable';
class CrudTable extends React.Component {
componentDidMount() {
this.props.fetchData(this.props.dataInit, this.props.branch);
}
render() {
const {
title,
dataTable,
addEmptyRow,
removeRow,
updateRow,
editRow,
finishEditRow,
anchor,
branch
} = this.props;
return (
<MainTable
title={title}
addEmptyRow={addEmptyRow}
items={dataTable}
removeRow={removeRow}
updateRow={updateRow}
editRow={editRow}
finishEditRow={finishEditRow}
anchor={anchor}
branch={branch}
/>
);
}
}
CrudTable.propTypes = {
title: PropTypes.string.isRequired,
anchor: PropTypes.array.isRequired,
dataInit: PropTypes.array.isRequired,
dataTable: PropTypes.object.isRequired,
fetchData: PropTypes.func.isRequired,
addEmptyRow: PropTypes.func.isRequired,
removeRow: PropTypes.func.isRequired,
updateRow: PropTypes.func.isRequired,
editRow: PropTypes.func.isRequired,
finishEditRow: PropTypes.func.isRequired,
branch: PropTypes.string.isRequired,
};
export default CrudTable;
|