diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000000000000000000000000000000000..3d31c124952cd335f436bf6456d6f0d1d2077c9d
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,11 @@
+# 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
diff --git a/components/table/demo/row-selection.md b/components/table/demo/row-selection.md
index 734112734be9c730662ef7826f5a59926d74127e..016fde5f8e16e683b293430af0455a7d5d6699bf 100644
--- a/components/table/demo/row-selection.md
+++ b/components/table/demo/row-selection.md
@@ -37,11 +37,11 @@ var data = [{
// 通过 rowSelection 对象表明需要行选择
var rowSelection = {
- onSelect: function(record, selected) {
- console.log(record, selected);
+ onSelect: function(record, selected, selectedRows) {
+ console.log(record, selected, selectedRows);
},
- onSelectAll: function(selected) {
- console.log(selected);
+ onSelectAll: function(selected, selectedRows) {
+ console.log(selected, selectedRows);
}
};
diff --git a/components/table/index.jsx b/components/table/index.jsx
index b3d6e77cab66f851e41da2ec82148e56e204ddf7..bc7822db62b31eb2212d825cc326487cde84ec14 100644
--- a/components/table/index.jsx
+++ b/components/table/index.jsx
@@ -104,7 +104,6 @@ let AntTable = React.createClass({
this.fetch();
},
handleSelect(rowIndex, checked) {
- let selectedRow = this.state.data[rowIndex - 1];
if (checked) {
this.state.selectedRowKeys.push(rowIndex);
} else {
@@ -116,17 +115,25 @@ let AntTable = React.createClass({
selectedRowKeys: this.state.selectedRowKeys
});
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) {
- this.setState({
- selectedRowKeys: checked ? this.state.data.map(function(item, i) {
+ var selectedRowKeys = checked ? this.state.data.map(function(item, i) {
return i + 1;
- }) : []
+ }) : [];
+ this.setState({
+ selectedRowKeys: selectedRowKeys
});
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) {
diff --git a/scripts/demo.js b/scripts/demo.js
index bf4f29d13200ee28521dc65c555846da49b33672..e0cd29d3afbb3bf230bc15b3db42ac93d32f7928 100644
--- a/scripts/demo.js
+++ b/scripts/demo.js
@@ -16,7 +16,7 @@ $(function () {
return searchData.map(function (s) {
return ;
});
@@ -33,13 +33,11 @@ $(function () {
},
render() {
- return ;
}
});
diff --git a/static/style.css b/static/style.css
index 483597afbbfebbdf02c8972a8922204b82eab2d4..f621e389a649bb90b3ddcc9dd872af66e637c374 100644
--- a/static/style.css
+++ b/static/style.css
@@ -163,71 +163,24 @@ a.logo {
position: relative;
}
-.search input[type="text"] {
+#autoComplete .ant-select-selection--single {
border: transparent;
outline: none;
width: 160px;
- height: 22px;
- padding: 0 0 0 20px;
+ height: 28px;
+ line-height: 28px;
color: #999;
transition: padding .3s cubic-bezier(0.075, 0.82, 0.165, 1);
font-size: 14px;
+ box-shadow: none;
}
-.search input::-webkit-input-placeholder,
-.search input::-moz-placeholder,
-.search input:-ms-input-placeholder {
+#autoComplete input::-webkit-input-placeholder,
+#autoComplete input::-moz-placeholder,
+#autoComplete input:-ms-input-placeholder {
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 {
width: 30%;
height: 80px;