This commit is contained in:
wanghaoo 2018-10-11 15:54:34 +08:00
commit 9aad873c5a
13 changed files with 66 additions and 26 deletions

View File

@ -1,3 +1,18 @@
<a name="1.4.13"></a>
## [1.4.13](https://github.com/tinper-bee/bee-table/compare/v1.4.12...v1.4.13) (2018-10-11)
<a name="1.4.12"></a>
## [1.4.12](https://github.com/tinper-bee/bee-table/compare/v1.4.11...v1.4.12) (2018-10-11)
<a name="1.4.11"></a>
## [1.4.11](https://github.com/tinper-bee/bee-table/compare/v1.4.10...v1.4.11) (2018-10-11)
<a name="1.4.10"></a>
## [1.4.10](https://github.com/tinper-bee/bee-table/compare/v1.4.9...v1.4.10) (2018-10-08)

View File

@ -49,7 +49,7 @@ var FilterDropDown = function (_Component) {
if (onSelectDropdown) {
_this.setState({
selectValue: s.key
selectValue: [s.key]
}, function () {
onSelectDropdown(s);
});

View File

@ -184,6 +184,8 @@
transition: all 0.3s ease; }
.u-table tr:hover {
background: rgb(227,242,253); }
.u-table tr:hover td .uf-eye {
visibility: visible !important; }
.u-table tr.tr-row-hover {
background: rgb(227,242,253); }
.u-table th,
@ -371,7 +373,7 @@
.u-table-thead th:hover .bee-table-column-sorter {
display: inline-block; }
.u-table-thead .th-drag {
cursor: pointer; }
cursor: move; }
.u-table-thead .th-drag-hover {
background: #ccc; }
.u-table-thead-th {

View File

@ -642,9 +642,9 @@ var Table = function (_Component) {
}
cols = cols.concat(leafColumns.map(function (c, i, arr) {
var width = c.width;
if (typeof width == 'string' && width.indexOf('%') > -1) {
if (typeof width == 'string' && width.indexOf('%') > -1 && self.contentWidth) {
width = parseInt(self.contentWidth * parseInt(width) / 100);
} else {
} else if (width) {
width = parseInt(width);
}
if (lastShowIndex == i) {
@ -732,10 +732,10 @@ var Table = function (_Component) {
tableStyle.width = _this3.contentWidth;
}
}
//自动出现滚动条
// if(this.contentDomWidth < this.contentWidth){
// tableStyle.width = this.contentWidth;
// }
// 自动出现滚动条
if (_this3.contentDomWidth > _this3.contentWidth) {
tableStyle.width = _this3.contentDomWidth;
}
var tableBody = hasBody ? getBodyWrapper(_react2["default"].createElement(
'tbody',
{ className: clsPrefix + '-tbody' },

View File

@ -379,6 +379,9 @@ var TableHeader = function (_Component) {
da.width = parseInt(da.width) + contentWidthDiff;
canDotDrag = 'th-can-not-drag';
}
if (filterable && index == rows.length - 1) {
da.children = _this2.filterRenderType(da['filtertype'], da.dataindex, i);
}
if (draggable) {
return _react2["default"].createElement('th', _extends({}, da, {
onDragStart: function onDragStart(event) {
@ -433,14 +436,9 @@ var TableHeader = function (_Component) {
);
} else {
var th = void 0;
if (filterable && index == rows.length - 1) {
da.children = _this2.filterRenderType(da['filtertype'], da.dataindex, i);
th = _react2["default"].createElement('th', _extends({}, da, { key: i, className: da.className + ' ' + fixedStyle }));
} else {
th = da.onClick ? _react2["default"].createElement('th', _extends({}, da, { className: da.className + ' ' + fixedStyle, key: i, onClick: function onClick(event) {
da.onClick(da, event);
} })) : _react2["default"].createElement('th', _extends({}, da, { key: i, className: da.className + ' ' + fixedStyle }));
}
th = da.onClick ? _react2["default"].createElement('th', _extends({}, da, { className: da.className + ' ' + fixedStyle, key: i, onClick: function onClick(event) {
da.onClick(da, event);
} })) : _react2["default"].createElement('th', _extends({}, da, { key: i, className: da.className + ' ' + fixedStyle }));
return th;
}
})

View File

@ -128,7 +128,7 @@ function filterColumn(Table, Popover) {
Popover,
{
id: "filter_column_popover",
placement: "leftTop",
placement: "left",
content: content,
show: showModal },
_react2["default"].createElement(

View File

@ -125,7 +125,7 @@ function multiSelect(Table, Checkbox) {
}),
key: "checkbox",
dataIndex: "checkbox",
width: "100",
width: "55",
render: function render(text, record, index) {
var rowKey = record["key"] ? record["key"] : _this2.getRowKey(record, i);
var bool = checkedObj.hasOwnProperty(rowKey);

View File

@ -76,6 +76,19 @@ function sort(Table, Icon) {
_this.setState({ columns: columns });
};
_this.getOrderCols = function (columns) {
var orderCols = [];
columns.forEach(function (item) {
if (item.order == 'ascend' || item.order == 'descend') {
orderCols.push({ order: item.order,
field: item.dataIndex,
orderNum: item.orderNum
});
}
});
return orderCols;
};
_this._sortBy = function (pre, after, orderCols, orderColslen, currentIndex) {
var preKey = pre[orderCols[currentIndex].key];
var afterKey = after[orderCols[currentIndex].key];
@ -137,8 +150,12 @@ function sort(Table, Icon) {
});
seleObj.order = order;
//通过后端请求
if (sort.backSource) {
if (sort.backSource && typeof sort.sortFun === "function") {
//获取排序的字段和方式
sort.sortFun([{
order: order,
field: seleObj.dataIndex
}]);
} else {
if (order === "ascend") {
data = data.sort(function (a, b) {
@ -163,7 +180,11 @@ function sort(Table, Icon) {
if (!seleObj.orderNum && (order == 'ascend' || order == 'descend')) {
seleObj.orderNum = _this.getOrderNum();
}
data = _this.multiSort(columns);
if (sort.backSource && typeof sort.sortFun === "function") {
sort.sortFun(_this.getOrderCols(columns));
} else {
data = _this.multiSort(columns);
}
}
_this.setState({
data: data,
@ -255,6 +276,10 @@ function sort(Table, Icon) {
* 当有的列不排序时将该列的orderNum置为并动态的修改其他列的orderNum
*/
/**
* 获取排序字段
*/
/**
* pre前一条数据

4
dist/demo.js vendored
View File

@ -50833,7 +50833,7 @@
if (onSelectDropdown) {
_this.setState({
selectValue: s.key
selectValue: [s.key]
}, function () {
onSelectDropdown(s);
});
@ -59394,7 +59394,7 @@
Popover,
{
id: "filter_column_popover",
placement: "leftTop",
placement: "left",
content: content,
show: showModal },
_react2["default"].createElement(

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "bee-table",
"version": "1.4.10",
"version": "1.4.13",
"description": "Table ui component for react",
"keywords": [
"react",

View File

@ -16,7 +16,7 @@ class FilterDropDown extends Component {
let { onSelectDropdown } = this.props;
if (onSelectDropdown) {
this.setState({
selectValue: s.key
selectValue: [s.key]
}, () => {
onSelectDropdown(s);
});

View File

@ -152,7 +152,7 @@ export default function filterColumn(Table,Popover) {
<div className={`${prefixCls}-filter-icon`}>
<Popover
id="filter_column_popover"
placement="leftTop"
placement="left"
content={content}
show={showModal} >
<div className={`${prefixCls}-pop-column-filter-cont`}>