New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

igroot-edit-table

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

igroot-edit-table

简单的可编辑表格配置 ```jsx import React, { Component } from 'react' import EditTable from 'igroot-edit-table';

npmnpm
Version
0.0.5
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

可编辑表格

简单的可编辑表格配置

import React, { Component } from 'react'
import EditTable from 'igroot-edit-table';

class Example extends Component {
    state = {
        dataSource: [{
            input: '1',
            select: '1',
            num: '1',
            checkbox: true,
            text: 'dadwadw'
        }]
    }
    render() {
        return (
            <EditTable
                columns={[
                    {
                        title: '输入框',
                        dataIndex: 'input',
                        type: 'input',
                        require: true
                    },
                    {
                        title: '下拉框',
                        dataIndex: 'select',
                        type: 'select',
                        selectOption: [
                            {
                                label: '测试',
                                value: '1'
                            }
                        ],
                        width: 200
                    },
                    {
                        title: '数字输入框',
                        dataIndex: 'num',
                        type: 'num'
                    },
                    {
                        title: '多选框',
                        dataIndex: 'checkbox',
                        type: 'checkbox'
                    },
                    {
                        title: '纯文本',
                        dataIndex: 'text',
                    }
                ]}
                dataModule={{
                    input: '1',
                    select: '1',
                    num: '1',
                    checkbox: true,
                    text: 'dadwadw'
                }}
                dataSource={this.state.dataSource}
                onChange={(dataSource) => { this.setState({ dataSource }) }}
            />
        )
    }
}

ReactDOM.render(<Example />, mountNode)

props

props类型说明
dataSourcearray表格数据源
columnsarray表头配置
onChangefunctions必填项,会抛出一个更新完之后的数据
dataModuleobject新增行的行数据
removeboolean是否可以删除行
addboolean是否可以增加行
handleobject自定义操作

支持类型

渲染的表单类型声明集成到了columns 里面进行处理

key类型说明
typestring声明表单类型(input/num/select/checkout)
selectOptionarrayselect的下拉框列表,只接受 label和value形式
requireboolean是否为必填

Keywords

igroot

FAQs

Package last updated on 04 Apr 2019

Related posts