Merge branch '0.8.0' of github.com:ant-design/ant-design into 0.8.0

This commit is contained in:
然则 2015-08-21 16:19:49 +08:00
commit d7b4bbb289
14 changed files with 64 additions and 42 deletions

View File

@ -39,3 +39,5 @@
| `.ant-btn-circle` `.ant-btn-circle-outline` | 用于创建圆形按钮,`.ant-btn-circle-outline` 为描边按钮。 |
| `.ant-btn-lg` `.ant-btn-sm` | 定义按钮大小尺寸,目前提供三种尺寸:大中小,默认为中。 |
| `.ant-btn-group` | 按钮组合,通过按钮组容器把一组按钮放在同一行里。 |
> 当按钮只有两个汉字时,需要在两字中加空格。

View File

@ -1,4 +1,4 @@
# 基本
# 触发事件
- order: 3
@ -9,11 +9,11 @@
````jsx
var Menu = antd.Menu;
var Dropdown = antd.Dropdown;
var onClick = function ({key}){
var onSelect = function ({key}){
alert('选中了菜单' + key);
};
var menu = <Menu onClick={onClick}>
var menu = <Menu onSelect={onSelect}>
<Menu.Item key="1">第一个菜单项</Menu.Item>
<Menu.Item key="2">第二个菜单项</Menu.Item>
<Menu.Item key="3">第三个菜单项</Menu.Item>

View File

@ -10,18 +10,19 @@
## 何时使用
当页面元素过多时,用此组件可以收纳元素。点击或移入触点,会出现一个下拉菜单。可在列表中进行选择,并执行相应的命令。
当页面上的操作命令过多时,用此组件可以收纳操作元素。点击或移入触点,会出现一个下拉菜单。可在列表中进行选择,并执行相应的命令。
## API
属性如下
| 成员 | 说明 | 类型 | 默认值 |
|-------------|----------------|--------------------|--------------|
| trigger | 触发下来行为 | "click" or "hover" | hover |
| overlay | 菜单节点 | React.Element | 无 |
| 成员 | 说明 | 类型 | 默认值 |
|-------------|------------------|--------------------|--------------|
| trigger | 触发下拉的行为 | "click" or "hover" | hover |
| overlay | 菜单节点 | React.Element | 无 |
| onSelect | 选择后的回调 | function(e) {} | 无 |
菜单可由 `antd.Menu` 取得,可设置 `onClick` 回调,菜单还包括菜单项 `antd.Menu.Item`,分割线 `antd.Menu.Divider`
菜单可由 `antd.Menu` 取得,可设置 `onSelect` 回调,菜单还包括菜单项 `antd.Menu.Item`,分割线 `antd.Menu.Divider`
> 注意: Menu.Item 必须设置唯一的 key 属性。

View File

@ -36,7 +36,7 @@ React.render(
<div className="ant-form-item">
<label className="col-6">Select 选择器:</label>
<div className="col-14">
<Select size="large" value="lucy" style={{width:200}} onChange={handleSelectChange}>
<Select size="large" defaultValue="lucy" style={{width:200}} onChange={handleSelectChange}>
<Option value="jack">jack</Option>
<Option value="lucy">lucy</Option>
<Option value="disabled" disabled>disabled</Option>

View File

@ -71,7 +71,7 @@ React.render(
<div className="ant-form-item">
<label htmlFor="" className="col-8" required>Select 选择器:</label>
<div className="col-16">
<Select size="large" value="lucy" style={{width:200}} onChange={handleSelectChange}>
<Select size="large" defaultValue="lucy" style={{width:200}} onChange={handleSelectChange}>
<Option value="jack">jack</Option>
<Option value="lucy">lucy</Option>
<Option value="disabled" disabled>disabled</Option>

View File

@ -63,7 +63,6 @@ export default React.createClass({
<Tooltip placement={this.props.placement}
overlayStyle={this.props.overlayStyle}
prefixCls={prefixCls}
renderPopupToBody={true}
onVisibleChange={this.onVisibleChange}
transitionName={transitionName}
visible={this.state.visible}

View File

@ -33,7 +33,6 @@ export default React.createClass({
prefixCls={prefixCls}
delay={0.1}
overlayStyle={this.props.overlayStyle}
renderPopupToBody={true}
transitionName={transitionName}
trigger={this.props.trigger}
overlay={overlay}>

View File

@ -37,10 +37,10 @@ var App = React.createClass({
},
render() {
var provinceOptions = provinceData.map(function(province) {
return <Option value={province}>{province}</Option>;
return <Option key={province}>{province}</Option>;
});
var cityOptions = this.state.cities.map(function(city) {
return <Option value={city}>{city}</Option>;
return <Option key={city}>{city}</Option>;
});
return <div>
<Select defaultValue={provinceData[0]} style={{width:150}} onChange={this.handleProvinceChange}>

View File

@ -25,9 +25,9 @@ let AntUpload = React.createClass({
});
},
handleSuccess(ret, file) {
var matchWay = file.uid === '' ? 'byName' : 'byUid';
let matchWay = (!file.uid) ? 'byName' : 'byUid';
Message.success(file.name + '上传完成');
for (var i = 0; i < this.state.downloadList.length; i++) {
for (let i = 0; i < this.state.downloadList.length; i++) {
if (matchWay === 'byName') {
if (this.state.downloadList[i].filename === file.name) {
this.state.downloadList[i].status = 'done';
@ -84,20 +84,22 @@ let AntUpload = React.createClass({
};
if (type === 'drag') {
return (
<Upload {...props}>
<div className={prefixCls + ' ' + prefixCls + '-drag'}>
<div className={prefixCls + ' ' + prefixCls + '-drag'}>
<Upload {...props}>
<div className={prefixCls + '-drag-container'}>
{this.props.children}
</div>
</div>
</Upload>
</Upload>
</div>
);
} else if (type === 'select') {
return (
<div className={prefixCls + ' ' + prefixCls + '-select'}>
<Upload {...props}>
{this.props.children}
</Upload>
<div>
<div className={prefixCls + ' ' + prefixCls + '-select'}>
<Upload {...props}>
{this.props.children}
</Upload>
</div>
<UploadList items={this.state.downloadList} />
</div>
);

View File

@ -39,11 +39,11 @@
"is-equal-shallow": "~0.1.3",
"object-assign": "3.x",
"rc-animate": "~1.1.0",
"rc-calendar": "~3.13.0",
"rc-calendar": "~3.14.0",
"rc-checkbox": "~1.1.1",
"rc-collapse": "~1.2.3",
"rc-dialog": "~5.0.1",
"rc-dropdown": "~1.2.0",
"rc-dropdown": "~1.3.0",
"rc-form-validation": "~2.4.7",
"rc-input-number": "~2.0.1",
"rc-menu": "~4.3.1",
@ -57,7 +57,7 @@
"rc-switch": "~1.2.0",
"rc-table": "~3.1.0",
"rc-tabs": "~5.3.2",
"rc-tooltip": "~2.5.0",
"rc-tooltip": "~2.6.1",
"rc-tree": "~0.14.3",
"rc-upload": "~1.3.1",
"rc-util": "~2.0.3",
@ -71,7 +71,6 @@
"babel-loader": "^5.3.2",
"busboy": "~0.2.9",
"chalk": "~1.1.0",
"css-animation": "~1.0.3",
"css-loader": "^0.14.1",
"eslint": "^1.1.0",
"eslint-plugin-react": "~3.2.2",
@ -84,7 +83,6 @@
"lodash": "^3.10.0",
"nico-jsx": "~0.5.8",
"precommit-hook": "^1.0.7",
"rc-tabs": "~5.3.3",
"react-router": "~1.0.0-beta3",
"webpack": "^1.10.1",
"webpack-dev-middleware": "^1.2.0"

View File

@ -1,17 +1,19 @@
.@{calendar-prefix-cls}-picker .@{calendar-prefix-cls},
.@{calendar-prefix-cls}-picker-container .@{calendar-prefix-cls} {
&-hidden {
display: none;
}
position: absolute;
display: none;
left: -9999px;
top: -9999px;
z-index: 9;
z-index: 1000;
}
.@{calendar-prefix-cls}-picker {
position: relative;
display: inline-block;
&-input {
> input {
outline: none;
}

View File

@ -7,6 +7,7 @@
z-index: 10;
position: absolute;
outline: none;
border-radius: 6px;
}
.@{calendar-prefix-cls}-time-panel-header {

View File

@ -124,7 +124,6 @@
height: 32px;
.ant-select-selection__rendered {
line-height: 30px;
font-size: 14px;
}
}
@ -286,13 +285,15 @@
box-shadow: @overlay-shadow;
border-radius: 4px;
box-sizing: border-box;
z-index: 100;
z-index: 1000;
left: -9999px;
top: -9999px;
position: absolute;
outline: none;
overflow: hidden;
&-menu {
font-size: @font-size-base;
outline: none;
margin-bottom: 0;
padding-left: 0; // Override default ul/ol

View File

@ -1,6 +1,21 @@
@upload-prefix-cls: ant-upload;
.@{upload-prefix-cls} {
> span {
display: block;
width: 100%;
height: 100%;
}
input[type=file] {
cursor: pointer;
}
&.@{upload-prefix-cls}-select {
display: inline-block;
}
&.@{upload-prefix-cls}-drag {
border: 1px dashed #d9d9d9;
transition: all 0.3s ease;
@ -11,13 +26,15 @@
height: 100%;
position: relative;
.@{upload-prefix-cls}-drag-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
> span {
display: table;
}
.@{upload-prefix-cls}-drag-container {
display: table-cell;
vertical-align: middle;
}
&:hover {
border: 1px dashed #999;
}