diff --git a/build/Table.js b/build/Table.js
index 02fbc8e..280a7b4 100644
--- a/build/Table.js
+++ b/build/Table.js
@@ -891,7 +891,7 @@ var Table = function (_Component) {
onHoverProps.onHover = this.handleRowHover;
- if (props.height) {
+ if (props.bodyDisplayInRow && props.height) {
height = props.height;
} else if (fixed || props.heightConsistent) {
height = fixedColumnsBodyRowsHeight[fixedIndex];
@@ -1342,7 +1342,8 @@ var Table = function (_Component) {
height = _props8.height,
headerHeight = _props8.headerHeight,
columns = _props8.columns,
- heightConsistent = _props8.heightConsistent;
+ heightConsistent = _props8.heightConsistent,
+ bodyDisplayInRow = _props8.bodyDisplayInRow;
var headRows = this.headTable ? this.headTable.querySelectorAll('thead') : this.bodyTable.querySelectorAll('thead');
var bodyRows = this.bodyTable.querySelectorAll('.' + clsPrefix + '-row') || [];
@@ -1357,11 +1358,12 @@ var Table = function (_Component) {
});
var fixedColumnsBodyRowsHeight = [].map.call(bodyRows, function (row, index) {
var rsHeight = height;
- if (rsHeight) {
+ if (bodyDisplayInRow && rsHeight) {
return rsHeight;
} else {
// 为了提高性能,默认获取主表的高度,但是有的场景中固定列的高度比主表的高度高,所以提供此属性,会统计所有列的高度取最大的,设置
- if (heightConsistent) {
+ // 内容折行显示,并又设置了 height 的情况下,也要获取主表高度
+ if (heightConsistent || !bodyDisplayInRow && rsHeight) {
var leftHeight = void 0,
rightHeight = void 0,
currentHeight = void 0,
@@ -1544,7 +1546,8 @@ var Table = function (_Component) {
}
className += ' ' + clsPrefix + '-scroll-position-' + this.state.scrollPosition;
//如果传入height说明是固定高度
- if (props.height) {
+ //内容过多折行显示时,height 属性会失效,为了避免产生错行
+ if (props.bodyDisplayInRow && props.height) {
className += ' fixed-height';
}
if (props.bodyDisplayInRow) {
diff --git a/build/lib/multiSelect.js b/build/lib/multiSelect.js
index e404384..ebb4ddd 100644
--- a/build/lib/multiSelect.js
+++ b/build/lib/multiSelect.js
@@ -152,10 +152,13 @@ function multiSelect(Table, Checkbox) {
};
return MultiSelect;
- }(_react.Component), _class.defaultProps = {
+ }(_react.Component), _class.propTypes = {
+ autoCheckedByClickRows: PropTypes.bool //行点击时,是否自动勾选复选框
+ }, _class.defaultProps = {
prefixCls: "u-table-mult-select",
getSelectedDataFunc: function getSelectedDataFunc() {},
- autoSelect: false
+ autoSelect: false,
+ autoCheckedByClickRows: true
}, _initialiseProps = function _initialiseProps() {
var _this2 = this;
@@ -340,10 +343,14 @@ function multiSelect(Table, Checkbox) {
};
this.onRowClick = function (record, index, event) {
- _this2.onCheckboxChange('', record, index)();
- if (_this2.props.onRowClick) {
- _this2.props.onRowClick(record, index, event);
+ var _props2 = _this2.props,
+ autoCheckedByClickRows = _props2.autoCheckedByClickRows,
+ onRowClick = _props2.onRowClick;
+
+ if (autoCheckedByClickRows) {
+ _this2.onCheckboxChange('', record, index)();
}
+ onRowClick && onRowClick(record, index, event);
};
}, _temp;
}
diff --git a/demo/demolist/Demo0101.js b/demo/demolist/Demo0101.js
index 0521a96..3d3d53b 100644
--- a/demo/demolist/Demo0101.js
+++ b/demo/demolist/Demo0101.js
@@ -2,7 +2,7 @@
*
* @title 基本表格
* @parent 基础 Basic
-* @description 单元格数据过长时,可结合Tooltip组件使用。
+* @description 当单元格内容过多时,会自动显示省略号,鼠标hover有提示。showRowNum 设置是否显示序号列。
* demo0101
*/
diff --git a/demo/demolist/Demo0404.js b/demo/demolist/Demo0404.js
index 2ce5511..2c8af2e 100644
--- a/demo/demolist/Demo0404.js
+++ b/demo/demolist/Demo0404.js
@@ -96,6 +96,7 @@ class Demo33 extends Component {
data={data}
multiSelect={{type: "checkbox"}}
getSelectedDataFunc={this.getSelectedDataFunc}
+ autoCheckedByClickRows={false} //行点击是否触发勾选动作
/>
}
}
diff --git a/demo/index.js b/demo/index.js
index db1364b..22cb967 100644
--- a/demo/index.js
+++ b/demo/index.js
@@ -8,7 +8,7 @@ import Button from '../src';
-var Demo0101 = require("./demolist/Demo0101");var Demo0102 = require("./demolist/Demo0102");var Demo0103 = require("./demolist/Demo0103");var Demo0104 = require("./demolist/Demo0104");var Demo0105 = require("./demolist/Demo0105");var Demo0106 = require("./demolist/Demo0106");var Demo0107 = require("./demolist/Demo0107");var Demo0201 = require("./demolist/Demo0201");var Demo0202 = require("./demolist/Demo0202");var Demo0301 = require("./demolist/Demo0301");var Demo0302 = require("./demolist/Demo0302");var Demo0402 = require("./demolist/Demo0402");var Demo0404 = require("./demolist/Demo0404");var Demo0405 = require("./demolist/Demo0405");var Demo0501 = require("./demolist/Demo0501");var Demo0502 = require("./demolist/Demo0502");var Demo0503 = require("./demolist/Demo0503");var Demo0505 = require("./demolist/Demo0505");var Demo0601 = require("./demolist/Demo0601");var Demo0602 = require("./demolist/Demo0602");var Demo0603 = require("./demolist/Demo0603");var Demo0701 = require("./demolist/Demo0701");var Demo0702 = require("./demolist/Demo0702");var Demo0802 = require("./demolist/Demo0802");var Demo0901 = require("./demolist/Demo0901");var Demo0902 = require("./demolist/Demo0902");var Demo0903 = require("./demolist/Demo0903");var Demo1001 = require("./demolist/Demo1001");var Demo1002 = require("./demolist/Demo1002");var Demo1101 = require("./demolist/Demo1101");var Demo1102 = require("./demolist/Demo1102");var Demo1103 = require("./demolist/Demo1103");var Demo1105 = require("./demolist/Demo1105");var Demo1106 = require("./demolist/Demo1106");var Demo1107 = require("./demolist/Demo1107");var Demo1108 = require("./demolist/Demo1108");var Demo1201 = require("./demolist/Demo1201");var Demo1301 = require("./demolist/Demo1301");var Demo1302 = require("./demolist/Demo1302");var Demo1401 = require("./demolist/Demo1401");var Demo1402 = require("./demolist/Demo1402");var Demo1403 = require("./demolist/Demo1403");var Demo1404 = require("./demolist/Demo1404");var Demo1601 = require("./demolist/Demo1601");var DemoArray = [{"example":
{ title }
\n{ desc }
\n 查看源码 \n\n { code }
\n
\n {!!scss_code ?\n { scss_code }
\n
: null }\n