diff --git a/build/Table.js b/build/Table.js
index d306af6..5c27112 100644
--- a/build/Table.js
+++ b/build/Table.js
@@ -691,7 +691,7 @@ var Table = function (_Component) {
var expandIconAsCell = fixed !== 'right' ? props.expandIconAsCell : false;
var expandIconColumnIndex = fixed !== 'right' ? props.expandIconColumnIndex : -1;
if (props.lazyLoad && props.lazyLoad.preHeight && indent == 0) {
- rst.push(_react2["default"].createElement(_TableRow2["default"], { height: props.lazyLoad.preHeight, columns: [], className: '', store: this.store, visible: true }));
+ rst.push(_react2["default"].createElement(_TableRow2["default"], { height: props.lazyLoad.preHeight, columns: [], className: '', key: 'table_row_first', store: this.store, visible: true }));
}
var lazyCurrentIndex = props.lazyLoad && props.lazyLoad.startIndex ? props.lazyLoad.startIndex : 0;
var lazyParentIndex = props.lazyLoad && props.lazyLoad.startParentIndex ? props.lazyLoad.startParentIndex : 0;
@@ -775,7 +775,7 @@ var Table = function (_Component) {
height: height,
isHiddenExpandIcon: isHiddenExpandIcon
}, onHoverProps, {
- key: key,
+ key: "table_row_" + key + "_" + index,
hoverKey: key,
ref: rowRef,
store: this.store,
@@ -801,7 +801,7 @@ var Table = function (_Component) {
}
if (props.lazyLoad && props.lazyLoad.sufHeight && indent == 0) {
- rst.push(_react2["default"].createElement(_TableRow2["default"], { height: props.lazyLoad.sufHeight, columns: [], className: '', store: this.store, visible: true }));
+ rst.push(_react2["default"].createElement(_TableRow2["default"], { height: props.lazyLoad.sufHeight, key: 'table_row_end', columns: [], className: '', store: this.store, visible: true }));
}
return rst;
};
@@ -809,7 +809,8 @@ var Table = function (_Component) {
Table.prototype.getRows = function getRows(columns, fixed) {
//统计index,只有含有鼠表结构才有用,因为数表结构时,固定列的索引取值有问题
this.treeRowIndex = 0;
- return this.getRowsByData(this.state.data, true, 0, columns, fixed);
+ var rs = this.getRowsByData(this.state.data, true, 0, columns, fixed);
+ return rs;
};
Table.prototype.getColGroup = function getColGroup(columns, fixed) {
diff --git a/build/TableHeader.js b/build/TableHeader.js
index 11e84a2..fa1c163 100644
--- a/build/TableHeader.js
+++ b/build/TableHeader.js
@@ -95,43 +95,37 @@ var TableHeader = function (_Component) {
if (_this.fixedTable.cols) {
_this.fixedTable.cols[_this.drag.currIndex].style.width = newWidth + "px";
}
- var oldTableWidth = parseInt(_this.table.table.style.width ? _this.table.table.style.width : _this.table.table.scrollWidth);
- var newTableWidth = oldTableWidth + diff;
+ var newTableWidth = _this.drag.tableWidth + diff + 'px';
_this.table.table.style.width = newTableWidth; //改变table的width
-
+ _this.table.innerTableBody.style.width = newTableWidth;
var showScroll = contentDomWidth - newTableWidth - scrollbarWidth;
- var fixedLeftHeaderTable = contentTable.querySelector('.u-table-fixed-left .u-table-header');
- var fixedRighHeadertTable = contentTable.querySelector('.u-table-fixed-right .u-table-header');
- var contentTableHeader = contentTable.querySelector('.u-table-scroll .u-table-header');
- var fixedLeftBodyTable = contentTable.querySelector('.u-table-fixed-left .u-table-body-outer');
- var fixedRightBodyTable = contentTable.querySelector('.u-table-fixed-right .u-table-body-outer');
//表头滚动条处理
if (headerScroll) {
if (showScroll < 0) {
//找到固定列表格,设置表头的marginBottom值为scrollbarWidth;
- contentTableHeader.style.overflowX = 'scroll';
- _this.optTableMargin(fixedLeftHeaderTable, scrollbarWidth);
- _this.optTableMargin(fixedRighHeadertTable, scrollbarWidth);
+ _this.table.contentTableHeader.style.overflowX = 'scroll';
+ _this.optTableMargin(_this.table.fixedLeftHeaderTable, scrollbarWidth);
+ _this.optTableMargin(_this.table.fixedRighHeadertTable, scrollbarWidth);
// fixedLeftHeaderTable && (fixedLeftHeaderTable.style.marginBottom = scrollbarWidth + "px");
// fixedRighHeadertTable && (fixedRighHeadertTable.style.marginBottom = scrollbarWidth + "px");
//todo inner scroll-x去掉;outer marginbottom 设置成-15px】
} else {
- contentTableHeader.style.overflowX = 'hidden';
- _this.optTableMargin(fixedLeftHeaderTable, 0);
- _this.optTableMargin(fixedRighHeadertTable, 0);
+ _this.table.contentTableHeader.style.overflowX = 'hidden';
+ _this.optTableMargin(_this.table.fixedLeftHeaderTable, 0);
+ _this.optTableMargin(_this.table.fixedRighHeadertTable, 0);
}
} else {
if (showScroll < 0) {
- _this.optTableMargin(fixedLeftBodyTable, '-' + scrollbarWidth);
- _this.optTableMargin(fixedRightBodyTable, '-' + scrollbarWidth);
- _this.optTableScroll(fixedLeftBodyTable, { x: 'scroll' });
- _this.optTableScroll(fixedRightBodyTable, { x: 'scroll' });
+ _this.optTableMargin(_this.table.fixedLeftBodyTable, '-' + scrollbarWidth);
+ _this.optTableMargin(_this.table.fixedRightBodyTable, '-' + scrollbarWidth);
+ _this.optTableScroll(_this.table.fixedLeftBodyTable, { x: 'scroll' });
+ _this.optTableScroll(_this.table.fixedRightBodyTable, { x: 'scroll' });
} else {
- _this.optTableMargin(fixedLeftBodyTable, 0);
- _this.optTableMargin(fixedRightBodyTable, 0);
- _this.optTableScroll(fixedLeftBodyTable, { x: 'auto' });
- _this.optTableScroll(fixedRightBodyTable, { x: 'auto' });
+ _this.optTableMargin(_this.table.fixedLeftBodyTable, 0);
+ _this.optTableMargin(_this.table.fixedRightBodyTable, 0);
+ _this.optTableScroll(_this.table.fixedLeftBodyTable, { x: 'auto' });
+ _this.optTableScroll(_this.table.fixedRightBodyTable, { x: 'auto' });
}
}
}
@@ -153,6 +147,7 @@ var TableHeader = function (_Component) {
_this.drag.oldLeft = event.x;
_this.drag.oldWidth = parseInt(currentObj.style.width);
_this.drag.minWidth = currentObj.style.minWidth != "" ? parseInt(currentObj.style.minWidth) : defaultWidth;
+ _this.drag.tableWidth = parseInt(_this.table.table.style.width ? _this.table.table.style.width : _this.table.table.scrollWidth);
};
_this.onLineMouseUp = function (event) {
@@ -420,6 +415,11 @@ var TableHeader = function (_Component) {
this.initEvent();
};
+ TableHeader.prototype.componentWillUnmount = function componentWillUnmount() {
+ this.removeDragAbleEvent();
+ this.removeDragBorderEvent();
+ };
+
// componentDidMount(){
// this.initTable();
// this.initEvent();
@@ -466,6 +466,8 @@ var TableHeader = function (_Component) {
TableHeader.prototype.initTable = function initTable() {
+ var contentTable = this.props.contentTable;
+
if (!this.props.dragborder && !this.props.draggable) return;
// let el = ReactDOM.findDOMNode(this);
var tableDome = this._thead.parentNode;
@@ -475,11 +477,18 @@ var TableHeader = function (_Component) {
table.cols = tableDome.getElementsByTagName("col");
table.ths = tableDome.getElementsByTagName("th");
}
+
+ table.fixedLeftHeaderTable = contentTable.querySelector('.u-table-fixed-left .u-table-header');
+ table.fixedRighHeadertTable = contentTable.querySelector('.u-table-fixed-right .u-table-header');
+ table.contentTableHeader = contentTable.querySelector('.u-table-scroll .u-table-header');
+ table.fixedLeftBodyTable = contentTable.querySelector('.u-table-fixed-left .u-table-body-outer');
+ table.fixedRightBodyTable = contentTable.querySelector('.u-table-fixed-right .u-table-body-outer');
+ table.innerTableBody = contentTable.querySelector('.u-table-scroll .u-table-body table');
+
this.table = table;
if (!this.props.dragborder) return;
if (document.getElementById("u-table-drag-thead-" + this.theadKey)) {
- //hao 固定列table
this.fixedTable = {};
var _fixedParentContext = document.getElementById("u-table-drag-thead-" + this.theadKey).parentNode;
var siblingDom = _fixedParentContext.parentNode.nextElementSibling;
diff --git a/build/TableRow.js b/build/TableRow.js
index b119c48..3e2ced4 100644
--- a/build/TableRow.js
+++ b/build/TableRow.js
@@ -246,7 +246,6 @@ var TableRow = function (_Component) {
var showSum = false;
var className = this.props.className;
-
if (this.state.hovered) {
className += ' ' + clsPrefix + '-hover';
}
@@ -273,7 +272,7 @@ var TableRow = function (_Component) {
'td',
{
className: clsPrefix + '-expand-icon-cell',
- key: 'rc-table-expand-icon-cell'
+ key: 'rc-table-expand-icon-cell-' + i
},
expandIcon
));
@@ -286,7 +285,7 @@ var TableRow = function (_Component) {
indent: indent,
index: index,
column: columns[i],
- key: columns[i].key || columns[i].dataIndex || i,
+ key: index + "_" + (columns[i].key || columns[i].dataIndex || i),
fixed: fixed,
showSum: showSum,
expandIcon: isColumnHaveExpandIcon ? expandIcon : null
diff --git a/build/lib/multiSelect.js b/build/lib/multiSelect.js
index f0dada4..d0bc0b7 100644
--- a/build/lib/multiSelect.js
+++ b/build/lib/multiSelect.js
@@ -23,8 +23,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
-// import Checkbox from 'bee-checkbox';
-
/**
* 参数: 过滤表头
@@ -38,10 +36,10 @@ function multiSelect(Table, Checkbox) {
var _class, _temp, _initialiseProps;
return _temp = _class = function (_Component) {
- _inherits(NewMultiSelect, _Component);
+ _inherits(MultiSelect, _Component);
- function NewMultiSelect(props) {
- _classCallCheck(this, NewMultiSelect);
+ function MultiSelect(props) {
+ _classCallCheck(this, MultiSelect);
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
@@ -54,7 +52,7 @@ function multiSelect(Table, Checkbox) {
return _this;
}
- NewMultiSelect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
+ MultiSelect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (this.props.data != nextProps.data) {
var obj = this.getCheckedOrIndeter(nextProps.data);
this.setState(_extends({}, obj, {
@@ -68,7 +66,7 @@ function multiSelect(Table, Checkbox) {
*/
- NewMultiSelect.prototype.getCheckedOrIndeter = function getCheckedOrIndeter(data) {
+ MultiSelect.prototype.getCheckedOrIndeter = function getCheckedOrIndeter(data) {
var obj = {};
var checkStatus = this.setChecked(data);
if (!checkStatus) {
@@ -93,7 +91,7 @@ function multiSelect(Table, Checkbox) {
*/
- NewMultiSelect.prototype.setChecked = function setChecked(data) {
+ MultiSelect.prototype.setChecked = function setChecked(data) {
if (!this.isArray(data)) return false;
if (data.length == 0) return false;
var count = 0;
@@ -119,18 +117,18 @@ function multiSelect(Table, Checkbox) {
*/
- NewMultiSelect.prototype.isArray = function isArray(o) {
+ MultiSelect.prototype.isArray = function isArray(o) {
return Object.prototype.toString.call(o) == '[object Array]';
};
- NewMultiSelect.prototype.render = function render() {
+ MultiSelect.prototype.render = function render() {
var columns = this.props.columns;
var data = this.state.data;
return _react2["default"].createElement(Table, _extends({}, this.props, { columns: this.getDefaultColumns(columns), data: data }));
};
- return NewMultiSelect;
+ return MultiSelect;
}(_react.Component), _class.defaultProps = {
prefixCls: "u-table-mult-select",
getSelectedDataFunc: function getSelectedDataFunc() {}
diff --git a/build/lib/newMultiSelect.js b/build/lib/newMultiSelect.js
index caf169d..253db85 100644
--- a/build/lib/newMultiSelect.js
+++ b/build/lib/newMultiSelect.js
@@ -23,8 +23,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
-// import Checkbox from 'bee-checkbox';
-
/**
* 参数: 过滤表头
diff --git a/demo/index.js b/demo/index.js
index 54159ff..ce65992 100644
--- a/demo/index.js
+++ b/demo/index.js
@@ -11,7 +11,7 @@ const CARET = ;
const CARETUP = ;
-var Demo1 = require("./demolist/Demo1");var Demo10 = require("./demolist/Demo10");var Demo11 = require("./demolist/Demo11");var Demo12 = require("./demolist/Demo12");var Demo13 = require("./demolist/Demo13");var Demo14 = require("./demolist/Demo14");var Demo15 = require("./demolist/Demo15");var Demo16 = require("./demolist/Demo16");var Demo17 = require("./demolist/Demo17");var Demo18 = require("./demolist/Demo18");var Demo19 = require("./demolist/Demo19");var Demo2 = require("./demolist/Demo2");var Demo20 = require("./demolist/Demo20");var Demo21 = require("./demolist/Demo21");var Demo22 = require("./demolist/Demo22");var Demo23 = require("./demolist/Demo23");var Demo24 = require("./demolist/Demo24");var Demo25 = require("./demolist/Demo25");var Demo26 = require("./demolist/Demo26");var Demo27 = require("./demolist/Demo27");var Demo28 = require("./demolist/Demo28");var Demo29 = require("./demolist/Demo29");var Demo3 = require("./demolist/Demo3");var Demo30 = require("./demolist/Demo30");var Demo31 = require("./demolist/Demo31");var Demo32 = require("./demolist/Demo32");var Demo34 = require("./demolist/Demo34");var Demo35 = require("./demolist/Demo35");var Demo4 = require("./demolist/Demo4");var Demo5 = require("./demolist/Demo5");var Demo6 = require("./demolist/Demo6");var Demo7 = require("./demolist/Demo7");var Demo8 = require("./demolist/Demo8");var Demo9 = require("./demolist/Demo9");var DemoArray = [{"example":
{ desc }
\n{ code }
\n { !!scss_code ? { scss_code }
: null }\n