2016-12-26 22:04:16 +08:00
|
|
|
|
|
|
|
|
|
import { Con, Row, Col } from 'bee-layout';
|
|
|
|
|
import { Panel } from 'bee-panel';
|
|
|
|
|
import Button from 'bee-button';
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
import ReactDOM from 'react-dom';
|
2017-09-27 11:28:46 +08:00
|
|
|
|
|
2016-12-26 22:04:16 +08:00
|
|
|
|
|
2017-01-11 17:01:50 +08:00
|
|
|
|
const CARET = <i className="uf uf-arrow-down"></i>;
|
2016-12-26 22:04:16 +08:00
|
|
|
|
|
2017-01-11 17:01:50 +08:00
|
|
|
|
const CARETUP = <i className="uf uf-arrow-up"></i>;
|
2016-12-26 22:04:16 +08:00
|
|
|
|
|
|
|
|
|
|
2019-03-03 21:40:06 +08:00
|
|
|
|
var Demo1 = require("./demolist/Demo1");var Demo2 = require("./demolist/Demo2");var Demo3 = require("./demolist/Demo3");var Demo4 = require("./demolist/Demo4");var Demo5 = require("./demolist/Demo5");var Demo6 = require("./demolist/Demo6");var Demo7 = require("./demolist/Demo7");var Demo8 = require("./demolist/Demo8");var Demo9 = require("./demolist/Demo9");var Demo10 = require("./demolist/Demo10");var Demo11 = require("./demolist/Demo11");var Demo12 = require("./demolist/Demo12");var Demo13 = require("./demolist/Demo13");var Demo14 = require("./demolist/Demo14");var Demo15 = require("./demolist/Demo15");var Demo16 = require("./demolist/Demo16");var Demo17 = require("./demolist/Demo17");var Demo18 = require("./demolist/Demo18");var Demo19 = require("./demolist/Demo19");var Demo20 = require("./demolist/Demo20");var Demo21 = require("./demolist/Demo21");var Demo22 = require("./demolist/Demo22");var Demo23 = require("./demolist/Demo23");var Demo24 = require("./demolist/Demo24");var Demo25 = require("./demolist/Demo25");var Demo26 = require("./demolist/Demo26");var Demo27 = require("./demolist/Demo27");var Demo28 = require("./demolist/Demo28");var Demo29 = require("./demolist/Demo29");var Demo30 = require("./demolist/Demo30");var Demo31 = require("./demolist/Demo31");var Demo32 = require("./demolist/Demo32");var Demo34 = require("./demolist/Demo34");var Demo35 = require("./demolist/Demo35");var DemoArray = [{"example":<Demo1 />,"title":" 简单表格、文字过长,两种tip","code":"/**\r\n*\r\n* @title 简单表格、文字过长,两种tip\r\n* 【Tooltip】\r\n* @description\r\n*/\r\n\r\nimport React, { Component } from \"react\";\r\n\n\nimport { Table, Tooltip, Button } from 'tinper-bee';\r\n\r\nconst columns = [\r\n {\r\n title: \"用户名\", dataIndex: \"a\", key: \"a\", width: 300, className: \"rowClassName\",\r\n fixed:'left',\r\n render: (text, record, index) => {\r\n return (\r\n <Tooltip inverse overlay={text}>\r\n <span tootip={text} style={{\r\n display: \"inline-block\",\r\n width: \"60px\",\r\n textOverflow: \"ellipsis\",\r\n overflow: \"hidden\",\r\n whiteSpace: \"nowrap\",\r\n verticalAlign: \"middle\",\r\n }}>{text}</span>\r\n </Tooltip>\r\n );\r\n }\r\n },\r\n { id: \"123\", title: \"性别\", dataIndex: \"b\", key: \"b\", width: 500},\r\n { title: \"年龄\", dataIndex: \"c\", key: \"c\", width: 200 },\r\n {\r\n title: \"操作\",\r\n dataIndex: \"d\",\r\n key: \"d\",\r\n render(text, record, index) {\r\n return (\r\n <div style={{ position: 'relative' }} title={text} >\r\n <a\r\n href=\"javascript:;\"\r\n tooltip={text}\r\n onClick={() => {\r\n alert('这是第' + index + '列,内容为:' + text);\r\n }}\r\n >\r\n 一些操作\r\n </a>\r\n </div>\r\n );\r\n }\r\n }\r\n];\r\n\r\nconst data = [\r\n { a: \"令狐冲\", b: \"男\", c: 41, d: \"操作\", key: \"1\" },\r\n { a: \"杨过叔叔的女儿黄蓉\", b: \"男\", c: 67, d: \"操作\", key: \"2\" },\r\n { a: \"郭靖\", b: \"男\", c: 25, d: \"操作\", key: \"3\" }\r\n];\r\n\r\nclass Demo1 extends Component {\r\n\r\n constructor(props) {\r\n super(props);\r\n this.state = {\r\n data: data,\r\n selectedRowIndex: 0\r\n }\r\n }\r\n\r\n render() {\r\n return (\r\n \r\n <Table\r\n columns={columns}\r\n data={data}\r\n parentNodeId='parent'\r\n height={43}\r\n headerHeight={42}\r\n onRowClick={(record, index, indent) => {\r\n this.setState({\r\n selectedRowIndex: index\r\n });\r\n }}\r\n />\r\n\r\n \r\n );\r\n }\r\n}\r\n\r\n\r\n","desc":""},{"example":<Demo2 />,"title":" 增删改表格","code":"/**\r\n*\r\n* @title 增删改表格\r\n* @description 这是带有增删改功能的表格(此编辑功能未使用render组件)\r\n*\r\n*/\r\n\r
|
2016-12-26 22:04:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Demo extends Component {
|
|
|
|
|
constructor(props){
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
open: false
|
|
|
|
|
}
|
|
|
|
|
this.handleClick = this.handleClick.bind(this);
|
|
|
|
|
}
|
|
|
|
|
handleClick() {
|
|
|
|
|
this.setState({ open: !this.state.open })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render () {
|
2018-01-16 10:11:10 +08:00
|
|
|
|
const { title, example, code, desc, scss_code } = this.props;
|
2016-12-26 22:04:16 +08:00
|
|
|
|
let caret = this.state.open ? CARETUP : CARET;
|
|
|
|
|
let text = this.state.open ? "隐藏代码" : "查看代码";
|
|
|
|
|
|
|
|
|
|
const header = (
|
2018-01-16 10:11:10 +08:00
|
|
|
|
<div>
|
|
|
|
|
{example}
|
2018-01-16 10:50:21 +08:00
|
|
|
|
<Button style={{"marginTop": "10px"}} shape="block" onClick={ this.handleClick }>
|
2018-01-16 10:11:10 +08:00
|
|
|
|
{ caret }
|
|
|
|
|
{ text }
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
2016-12-26 22:04:16 +08:00
|
|
|
|
);
|
|
|
|
|
return (
|
|
|
|
|
<Col md={12} >
|
|
|
|
|
<h3>{ title }</h3>
|
|
|
|
|
<p>{ desc }</p>
|
2018-08-30 15:32:18 +08:00
|
|
|
|
<Panel copyable collapsible headerContent expanded={ this.state.open } colors='bordered' header={ header } footerStyle = {{padding: 0}}>
|
2016-12-26 22:04:16 +08:00
|
|
|
|
<pre><code className="hljs javascript">{ code }</code></pre>
|
2018-01-16 10:11:10 +08:00
|
|
|
|
{ !!scss_code ? <pre><code className="hljs css">{ scss_code }</code></pre> : null }
|
2016-12-26 22:04:16 +08:00
|
|
|
|
</Panel>
|
|
|
|
|
</Col>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class DemoGroup extends Component {
|
|
|
|
|
constructor(props){
|
|
|
|
|
super(props)
|
|
|
|
|
}
|
|
|
|
|
render () {
|
|
|
|
|
return (
|
|
|
|
|
<Row>
|
|
|
|
|
{DemoArray.map((child,index) => {
|
|
|
|
|
|
|
|
|
|
return (
|
2018-01-16 10:11:10 +08:00
|
|
|
|
<Demo example= {child.example} title= {child.title} code= {child.code} scss_code= {child.scss_code} desc= {child.desc} key= {index}/>
|
2016-12-26 22:04:16 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
})}
|
|
|
|
|
</Row>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReactDOM.render(<DemoGroup/>, document.getElementById('tinperBeeDemo'));
|