-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
230 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,3 +65,6 @@ typings/ | |
|
||
# npm lock file | ||
package-lock.json | ||
|
||
# webpack build output | ||
Assets/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
html, | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
import '~/css/pages/index.less'; | ||
|
||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { Table, Icon, Switch, Radio, Form, Divider } from 'antd'; | ||
const FormItem = Form.Item; | ||
|
||
const columns = [ | ||
{ | ||
title: 'Name', | ||
dataIndex: 'name', | ||
key: 'name', | ||
width: 150, | ||
render: text => <a href="javascript:;">{text}</a> | ||
}, | ||
{ | ||
title: 'Age', | ||
dataIndex: 'age', | ||
key: 'age', | ||
width: 70 | ||
}, | ||
{ | ||
title: 'Address', | ||
dataIndex: 'address', | ||
key: 'address' | ||
}, | ||
{ | ||
title: 'Action', | ||
key: 'action', | ||
width: 360, | ||
render: (text, record) => ( | ||
<span> | ||
<a href="javascript:;">Action 一 {record.name}</a> | ||
<Divider type="vertical" /> | ||
<a href="javascript:;">Delete</a> | ||
<Divider type="vertical" /> | ||
<a href="javascript:;" className="ant-dropdown-link"> | ||
More actions <Icon type="down" /> | ||
</a> | ||
</span> | ||
) | ||
} | ||
]; | ||
|
||
const data = []; | ||
for (let i = 1; i <= 10; i++) { | ||
data.push({ | ||
key: i, | ||
name: 'John Brown', | ||
age: `${i}2`, | ||
address: `New York No. ${i} Lake Park`, | ||
description: `My name is John Brown, I am ${i}2 years old, living in New York No. ${i} Lake Park.` | ||
}); | ||
} | ||
|
||
const expandedRowRender = record => <p>{record.description}</p>; | ||
const title = () => 'Here is title'; | ||
const showHeader = true; | ||
const footer = () => 'Here is footer'; | ||
const scroll = { y: 240 }; | ||
const pagination = { position: 'bottom' }; | ||
|
||
class Demo extends React.Component { | ||
state = { | ||
bordered: false, | ||
loading: false, | ||
pagination, | ||
size: 'default', | ||
expandedRowRender, | ||
title: undefined, | ||
showHeader, | ||
footer, | ||
rowSelection: {}, | ||
scroll: undefined | ||
}; | ||
|
||
handleToggle = prop => { | ||
return enable => { | ||
this.setState({ [prop]: enable }); | ||
}; | ||
}; | ||
|
||
handleSizeChange = e => { | ||
this.setState({ size: e.target.value }); | ||
}; | ||
|
||
handleExpandChange = enable => { | ||
this.setState({ expandedRowRender: enable ? expandedRowRender : undefined }); | ||
}; | ||
|
||
handleTitleChange = enable => { | ||
this.setState({ title: enable ? title : undefined }); | ||
}; | ||
|
||
handleHeaderChange = enable => { | ||
this.setState({ showHeader: enable ? showHeader : false }); | ||
}; | ||
|
||
handleFooterChange = enable => { | ||
this.setState({ footer: enable ? footer : undefined }); | ||
}; | ||
|
||
handleRowSelectionChange = enable => { | ||
this.setState({ rowSelection: enable ? {} : undefined }); | ||
}; | ||
|
||
handleScollChange = enable => { | ||
this.setState({ scroll: enable ? scroll : undefined }); | ||
}; | ||
|
||
handlePaginationChange = e => { | ||
const { value } = e.target; | ||
this.setState({ | ||
pagination: value === 'none' ? false : { position: value } | ||
}); | ||
}; | ||
|
||
render() { | ||
const state = this.state; | ||
return ( | ||
<div> | ||
<div className="components-table-demo-control-bar"> | ||
<Form layout="inline"> | ||
<FormItem label="Bordered"> | ||
<Switch checked={state.bordered} onChange={this.handleToggle('bordered')} /> | ||
</FormItem> | ||
<FormItem label="loading"> | ||
<Switch checked={state.loading} onChange={this.handleToggle('loading')} /> | ||
</FormItem> | ||
<FormItem label="Title"> | ||
<Switch checked={!!state.title} onChange={this.handleTitleChange} /> | ||
</FormItem> | ||
<FormItem label="Column Header"> | ||
<Switch checked={!!state.showHeader} onChange={this.handleHeaderChange} /> | ||
</FormItem> | ||
<FormItem label="Footer"> | ||
<Switch checked={!!state.footer} onChange={this.handleFooterChange} /> | ||
</FormItem> | ||
<FormItem label="Expandable"> | ||
<Switch checked={!!state.expandedRowRender} onChange={this.handleExpandChange} /> | ||
</FormItem> | ||
<FormItem label="Checkbox"> | ||
<Switch checked={!!state.rowSelection} onChange={this.handleRowSelectionChange} /> | ||
</FormItem> | ||
<FormItem label="Fixed Header"> | ||
<Switch checked={!!state.scroll} onChange={this.handleScollChange} /> | ||
</FormItem> | ||
<FormItem label="Size"> | ||
<Radio.Group size="default" value={state.size} onChange={this.handleSizeChange}> | ||
<Radio.Button value="default">Default</Radio.Button> | ||
<Radio.Button value="middle">Middle</Radio.Button> | ||
<Radio.Button value="small">Small</Radio.Button> | ||
</Radio.Group> | ||
</FormItem> | ||
<FormItem label="Pagination"> | ||
<Radio.Group | ||
value={state.pagination ? state.pagination.position : 'none'} | ||
onChange={this.handlePaginationChange} | ||
> | ||
<Radio.Button value="top">Top</Radio.Button> | ||
<Radio.Button value="bottom">Bottom</Radio.Button> | ||
<Radio.Button value="both">Both</Radio.Button> | ||
<Radio.Button value="none">None</Radio.Button> | ||
</Radio.Group> | ||
</FormItem> | ||
</Form> | ||
</div> | ||
<Table {...this.state} columns={columns} dataSource={data} /> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
ReactDOM.render(<Demo />, document.getElementById('app')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
<title>Index</title> | ||
<link rel="stylesheet" type="text/css" href="./Assets/dist/css/vendors.css" /> | ||
<link rel="stylesheet" type="text/css" href="./Assets/dist/css/pages/index.css" /> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="./Assets/dist/js/runtime.js"></script> | ||
<script src="./Assets/dist/js/react.js"></script> | ||
<script src="./Assets/dist/js/vendors.js"></script> | ||
<script src="./Assets/dist/js/pages/index.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
"name": "webpack-antd-builder", | ||
"version": "0.0.1", | ||
"description": "A webpack antd build configure tools.", | ||
"private": true, | ||
"engines": { | ||
"node": ">=7.6.0" | ||
}, | ||
|
@@ -11,7 +10,10 @@ | |
"watch": "webpack --config webpack/webpack.config.dev.js --watch", | ||
"build": "webpack --config webpack/webpack.config.prod.js" | ||
}, | ||
"author": "nuintun", | ||
"author": { | ||
"name": "nuintun", | ||
"email": "[email protected]" | ||
}, | ||
"dependencies": { | ||
"antd": "^3.5.1", | ||
"react": "^16.3.2", | ||
|
@@ -23,7 +25,7 @@ | |
"babel-loader": "^7.1.4", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-plugin-import": "^1.7.0", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-plugin-transform-react-jsx": "^6.24.1", | ||
"babel-plugin-transform-object-assign": "^6.22.0", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @module theme | ||
* @listens MIT | ||
* @author nuintun | ||
* @description Antd theme configure. | ||
*/ | ||
|
||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters