ui-package--table-component-react
v1.2.6
Published
This package implements [models](https://github.com/ui-package/table-component).
Downloads
13
Readme
Introduction:
This package implements models.
Example:
import DefaultTable from 'ui-package--table-component-react'
import 'ui-package--table-component-react/src/Styles/SortComponent.scss'
import 'ui-package--table-component-react/src/Styles/TableComponent.scss'
const data = [
{name: 'Alex', phone: '98234798234'},
{name: 'Jimmy', phone: '09856745'},
{name: 'Albert', phone: '02138366322132'},
{name: 'Jone', phone: '76235464'},
{name: 'Paul', phone: '627363'}
]
const builder = new TableBuilder()
const createColumnHeadFunc = () => (
builder
.getFactory()
.addHeader('name')
.addHeader('phone')
.getHeaders()
)
const createColumnBodyFunc = () => (
builder
.getFactory()
.addBody('name', entity.name)
.addBody('phone', entity.phone)
.getBodies()
)
builder.buildColumnManager(
createColumnHeadFunc,
createColumnBodyFunc
)
const table = builder.getTableFacade()
<DefaultTable
entities={data}
onSelectEntity={() => {}}
table={table} />
Props:
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| table | TableFacadeAbstract | null | You can get its via TableBuilder |
| entities | Array | [] | You need input your data |
| createHeadColumns | Function | null | Should return array of ColumnHeadEntityInterface |
| createBodyColumns | Function<Object>
| null | Should return array of ColumnBodyEntityInterface |
| onSelectEntity | Function<Object[], TableFacadeAbstract>
| | |
| onSort | Function<String, TableFacadeAbstract>
| | |
| onDoubleClick | Function<Event, Object, TableFacadeAbstract>
| | |
| onClick | Function<Event, Object, TableFacadeAbstract>
| | |
| onContextMenu | Function<Event, Object, TableFacadeAbstract>
| | |
| comparison | Function<Object, Object>
| (e, e2) => e === e2 | |
| className | String | | |
| loaded | Boolean | | It need you if you use async |
| theme | String | table-component__theme_default | |