diff --git a/demo/demolist/Demo0501.js b/demo/demolist/Demo0501.js index 7a7eefd..cf2e808 100644 --- a/demo/demolist/Demo0501.js +++ b/demo/demolist/Demo0501.js @@ -1,307 +1,170 @@ /** -* -* @title 编辑态表格 -* @parent 编辑 Editor -* @description 这是带有多种不同格式的编辑态表格(编辑态是通过使用不同的render来达到不同编辑格式) -* -*/ - -import React from "react"; -import {Animate,Tooltip,FormControl,Button,Form,Icon,Checkbox,Select} from "tinper-bee"; + * + * @title 行编辑 + * @description 可以对行进行编辑的表格 + * + */ +import React, { Component } from "react"; import Table from "../../src"; -import Datepicker from "bee-datepicker"; -import renderInput from "../../build/render/InputRender.js"; -import renderDate from "../../build/render/DateRender.js"; -import renderSelect from "../../build/render/SelectRender.js"; +import { Button, FormControl } from "tinper-bee"; -const InputRender = renderInput(Form, FormControl, Icon); -const DateRender = renderDate(Datepicker, Icon); -const SelectRender = renderSelect(Select, Icon); - -const format = "YYYY-MM-DD"; -const format2 = "YYYY-MM"; -const format3 = "YYYY-MM-DD HH:mm:ss"; - -const dateInputPlaceholder = "选择日期"; -const dateInputPlaceholder2 = "选择年月"; -const dataSource = [ - { - key: "boyuzhou", - value: "jack" - }, - { - key: "renhualiu", - value: "lucy" - }, - { - key: "yuzhao", - value: "yiminghe" - } -]; -class Demo41 extends React.Component { - constructor(props) { +class EditableCell extends Component { + constructor(props, context) { super(props); this.state = { - dataSource: [ - { - key: "0", - name: "沉鱼", - number: "10", - age: "y", - address: "jack", - datepicker: "2017-06-12", - MonthPicker: "2017-02" - }, - { - key: "1", - name: "落雁", - number: "100", - age: "y", - address: "lucy", - datepicker: "2017-06-12", - MonthPicker: "2017-02" - }, - { - key: "2", - name: "闭月", - number: "1000", - age: "n", - address: "lucy", - datepicker: "2017-06-12", - MonthPicker: "2017-02" - }, - { - key: "3", - name: "羞花", - number: "9999", - age: "y", - address: "lucy", - datepicker: "2017-06-12", - MonthPicker: "2017-02" - } - ], - count: 4 + value: this.props.value, + editable: false }; + } + + handleChange = value => { + this.setState({ value }); + if (this.props.onChange) { + this.props.onChange(value); + } + }; + + render() { + return ( +