提交 cbf2681c 编写于 作者: Y yiminghe

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

# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
...@@ -37,11 +37,11 @@ var data = [{ ...@@ -37,11 +37,11 @@ var data = [{
// 通过 rowSelection 对象表明需要行选择 // 通过 rowSelection 对象表明需要行选择
var rowSelection = { var rowSelection = {
onSelect: function(record, selected) { onSelect: function(record, selected, selectedRows) {
console.log(record, selected); console.log(record, selected, selectedRows);
}, },
onSelectAll: function(selected) { onSelectAll: function(selected, selectedRows) {
console.log(selected); console.log(selected, selectedRows);
} }
}; };
......
...@@ -104,7 +104,6 @@ let AntTable = React.createClass({ ...@@ -104,7 +104,6 @@ let AntTable = React.createClass({
this.fetch(); this.fetch();
}, },
handleSelect(rowIndex, checked) { handleSelect(rowIndex, checked) {
let selectedRow = this.state.data[rowIndex - 1];
if (checked) { if (checked) {
this.state.selectedRowKeys.push(rowIndex); this.state.selectedRowKeys.push(rowIndex);
} else { } else {
...@@ -116,17 +115,25 @@ let AntTable = React.createClass({ ...@@ -116,17 +115,25 @@ let AntTable = React.createClass({
selectedRowKeys: this.state.selectedRowKeys selectedRowKeys: this.state.selectedRowKeys
}); });
if (this.props.rowSelection.onSelect) { if (this.props.rowSelection.onSelect) {
this.props.rowSelection.onSelect(selectedRow, checked); let currentRow = this.state.data[rowIndex - 1];
let selectedRows = this.state.data.filter((row, i) => {
return this.state.selectedRowKeys.indexOf(i + 1) >= 0;
});
this.props.rowSelection.onSelect(currentRow, checked, selectedRows);
} }
}, },
handleSelectAllRow(checked) { handleSelectAllRow(checked) {
this.setState({ var selectedRowKeys = checked ? this.state.data.map(function(item, i) {
selectedRowKeys: checked ? this.state.data.map(function(item, i) {
return i + 1; return i + 1;
}) : [] }) : [];
this.setState({
selectedRowKeys: selectedRowKeys
}); });
if (this.props.rowSelection.onSelectAll) { if (this.props.rowSelection.onSelectAll) {
this.props.rowSelection.onSelectAll(checked); let selectedRows = this.state.data.filter((row, i) => {
return selectedRowKeys.indexOf(i + 1) >= 0;
});
this.props.rowSelection.onSelectAll(checked, selectedRows);
} }
}, },
handlePageChange: function(current) { handlePageChange: function(current) {
......
...@@ -16,7 +16,7 @@ $(function () { ...@@ -16,7 +16,7 @@ $(function () {
return searchData.map(function (s) { return searchData.map(function (s) {
return <Option sData={s} key={s.title}> return <Option sData={s} key={s.title}>
<strong>{s.title}</strong> <strong>{s.title}</strong>
&nbsp; &nbsp;
<span>{s.desc}</span> <span>{s.desc}</span>
</Option>; </Option>;
}); });
...@@ -33,13 +33,11 @@ $(function () { ...@@ -33,13 +33,11 @@ $(function () {
}, },
render() { render() {
return <Select style={{width: 200}} return <Select combobox style={{width: 200}}
placeholder="Select Components" onSelect={this.handleSelect}
onChange={this.handleSelect}
dropdownMenuStyle={{maxHeight: 200, overflow: 'auto'}} dropdownMenuStyle={{maxHeight: 200, overflow: 'auto'}}
searchPlaceholder="Filter Components" searchPlaceholder="搜索组件..."
renderDropdownToBody={true} renderDropdownToBody={true}
showSearch={true}
filterOption={this.filterOption}>{this.getOptions()}</Select>; filterOption={this.filterOption}>{this.getOptions()}</Select>;
} }
}); });
......
...@@ -163,71 +163,24 @@ a.logo { ...@@ -163,71 +163,24 @@ a.logo {
position: relative; position: relative;
} }
.search input[type="text"] { #autoComplete .ant-select-selection--single {
border: transparent; border: transparent;
outline: none; outline: none;
width: 160px; width: 160px;
height: 22px; height: 28px;
padding: 0 0 0 20px; line-height: 28px;
color: #999; color: #999;
transition: padding .3s cubic-bezier(0.075, 0.82, 0.165, 1); transition: padding .3s cubic-bezier(0.075, 0.82, 0.165, 1);
font-size: 14px; font-size: 14px;
box-shadow: none;
} }
.search input::-webkit-input-placeholder, #autoComplete input::-webkit-input-placeholder,
.search input::-moz-placeholder, #autoComplete input::-moz-placeholder,
.search input:-ms-input-placeholder { #autoComplete input:-ms-input-placeholder {
color: #CADCE3; color: #CADCE3;
} }
.search form .focus {
padding: 0 20px 0 0;
}
.search button {
position: absolute;
outline: none;
background: transparent;
border: transparent;
top: 5px;
width: 15px;
height: 15px;
padding: 0;
left: 30px;
cursor: pointer;
transition: left .3s cubic-bezier(0.075, 0.82, 0.165, 1);
}
.search button:before,
.search button:after {
content: "";
display: block;
}
.search button:before {
width: 12px;
height: 12px;
border-radius: 6px;
border: 2px solid #CADCE3;
background: #ffffff;
position: absolute;
top: 0
}
.search button:after {
width: 2px;
height: 6px;
background: #CADCE3;
position: absolute;
transform: rotate(-45deg);
left: 10px;
top: 8px;
}
.search input:focus ~ button {
left: 170px;
}
.nav { .nav {
width: 30%; width: 30%;
height: 80px; height: 80px;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册