Merge branch 'master' of github.com:tinper-bee/bee-table

This commit is contained in:
jonyshi 2019-01-28 10:25:21 +08:00
commit cd9e352381
10 changed files with 15748 additions and 20434 deletions

View File

@ -1,3 +1,18 @@
<a name="1.6.36"></a>
## [1.6.36](https://github.com/tinper-bee/bee-table/compare/v1.6.35...v1.6.36) (2019-01-27)
<a name="1.6.35"></a>
## [1.6.35](https://github.com/tinper-bee/bee-table/compare/v1.6.34...v1.6.35) (2019-01-25)
<a name="1.6.34"></a>
## [1.6.34](https://github.com/tinper-bee/bee-table/compare/v1.6.32...v1.6.34) (2019-01-24)
<a name="1.6.32"></a>
## [1.6.32](https://github.com/tinper-bee/bee-table/compare/v1.6.31...v1.6.32) (2019-01-23)

View File

@ -283,7 +283,7 @@ var Table = function (_Component) {
this.columnManager.reset(null, nextProps.children);
}
//适配lazyload
if (nextProps.scrollTop) {
if (nextProps.scrollTop > -1) {
// this.refs.bodyTable.scrollTop = nextProps.scrollTop;
this.scrollTop = nextProps.scrollTop;
}
@ -305,11 +305,11 @@ var Table = function (_Component) {
this.computeTableWidth();
this.firstDid = false; //避免重复update
}
if (this.scrollTop) {
if (this.scrollTop > -1) {
this.refs.fixedColumnsBodyLeft && (this.refs.fixedColumnsBodyLeft.scrollTop = this.scrollTop);
this.refs.fixedColumnsBodyRight && (this.refs.fixedColumnsBodyRight.scrollTop = this.scrollTop);
this.refs.bodyTable.scrollTop = this.scrollTop;
this.scrollTop = 0;
this.scrollTop = -1;
}
};
@ -906,7 +906,8 @@ var Table = function (_Component) {
} else {
if (fixed) {
if (this.domWidthDiff > 0) {
innerBodyStyle.overflowX = 'auto';
headStyle.overflow = 'hidden';
innerBodyStyle.overflowX = 'auto'; //兼容expand场景、子表格含有固定列的场景
} else {
bodyStyle.marginBottom = '-' + scrollbarWidth + 'px';
}

View File

@ -26,7 +26,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
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); }
var defaultHeight = 40;
var defaultHeight = 30;
var rowDiff = 3; //行差值
var treeTypeIndex = 0;
function bigData(Table) {
@ -108,7 +108,7 @@ function bigData(Table) {
BigData.prototype.setStartAndEndIndex = function setStartAndEndIndex(currentIndex, dataLen) {
var _this = this;
if (currentIndex > _this.endIndex) {
if (currentIndex > _this.currentIndex + _this.props.rowsInView) {
_this.currentIndex = currentIndex;
_this.endIndex = _this.currentIndex; //数据开始位置
_this.startIndex = _this.currentIndex - _this.loadCount; //数据结束位置
@ -118,7 +118,9 @@ function bigData(Table) {
if (_this.startIndex < 0) {
_this.startIndex = 0;
}
} else if (currentIndex < _this.startIndex) {
//重新设定scrollTop值
_this.scrollTop = _this.getSumHeight(0, _this.endIndex - _this.rowsInView + 2);
} else if (currentIndex < _this.currentIndex) {
_this.currentIndex = currentIndex;
_this.startIndex = currentIndex;
_this.endIndex = currentIndex + _this.loadCount;
@ -128,9 +130,9 @@ function bigData(Table) {
if (_this.startIndex < 0) {
_this.startIndex = 0;
}
//重新设定scrollTop值
_this.scrollTop = _this.getSumHeight(0, _this.startIndex);
}
//重新设定scrollTop值
_this.scrollTop = _this.getSumHeight(0, _this.endIndex - _this.rowsInView + 2);
};
BigData.prototype.getRowKey = function getRowKey(record, index) {
@ -310,14 +312,17 @@ function bigData(Table) {
onExpand: function onExpand() {},
scroll: {},
currentIndex: -1
currentIndex: -1,
isTree: false
}, _class.propTypes = {
loadBuffer: _propTypes2["default"].number
}, _initialiseProps = function _initialiseProps() {
var _this4 = this;
this.computeCachedRowParentIndex = function (data) {
var isTreeType = _this4.checkIsTreeType();
var isTree = _this4.props.isTree;
var isTreeType = isTree ? true : _this4.checkIsTreeType();
if (isTreeType) {
data.forEach(function (item, index) {
_this4.firstLevelKey[index] = _this4.getRowKey(item, index);

87
dist/demo.css vendored
View File

@ -2422,6 +2422,9 @@ i.uf {
/*
* 选择时删除文本阴影及设置默认选中颜色
*/
::-moz-selection {
background: rgb(187,222,251);
text-shadow: none; }
::selection {
background: rgb(187,222,251);
text-shadow: none; }
@ -5285,7 +5288,7 @@ a, .mdl-accordion, .mdl-button, .mdl-card, .mdl-checkbox, .mdl-dropdown-menu,
.u-panel .u-panel-body {
padding: 15px 15px;
position: relative; }
.u-panel .u-panel-body .u-panel-copy {
.u-panel .u-panel-body .uf {
position: absolute;
right: 25px;
top: 30px;
@ -5295,7 +5298,7 @@ a, .mdl-accordion, .mdl-button, .mdl-card, .mdl-checkbox, .mdl-dropdown-menu,
margin: 8px;
border-radius: 4px;
cursor: pointer; }
.u-panel .u-panel-body .u-panel-copy:hover {
.u-panel .u-panel-body .uf:hover {
color: #a8a7a7; }
.u-panel-default {
@ -6671,8 +6674,7 @@ input.u-button[type="submit"] {
border-radius: 0 500px 500px 0; }
.u-pagination {
font-size: 14px;
position: relative; }
font-size: 14px; }
.u-pagination-list {
float: left;
margin: 5px; }
@ -6680,10 +6682,6 @@ input.u-button[type="submit"] {
clear: both;
display: table;
content: ''; }
.u-pagination-list > li.iconBtn > a {
padding: 0 11px;
font-size: 22px;
line-height: 1.57142857; }
.u-pagination-list > li > a, .u-pagination-list > li > span {
display: inline-block;
text-decoration: none;
@ -6771,15 +6769,9 @@ input.u-button[type="submit"] {
margin: 5px;
float: left;
min-width: 120px; }
.u-pagination .data_per_select > span {
display: inline-block;
line-height: 36px;
float: left; }
.u-pagination .data_per_select .u-select {
width: 50px;
margin: 0 6px;
height: 36px;
float: left; }
margin: 0 6px; }
.u-pagination .data_per_select .u-select .u-select-selection {
height: 36px; }
.u-pagination .data_per_select .u-select .u-select-selection .u-select-selection-rendered {
@ -6799,26 +6791,20 @@ input.u-button[type="submit"] {
.u-pagination .page_jump {
float: left;
margin: 5px; }
.u-pagination .page_jump > span {
display: inline-block;
line-height: 36px;
float: left; }
.u-pagination .page_jump_value {
outline: none;
-webkit-appearance: none;
background: #fff;
border-radius: 4px;
line-height: 32px;
width: 50px;
margin: 0 6px;
text-align: center;
border: 1px solid #d7d7d7; }
.u-pagination .page_jump_btn,
.u-pagination .page_jump_value {
margin: 0 6px;
padding: 0;
height: 36px;
line-height: 34px;
box-sizing: border-box;
float: left; }
.u-pagination .page_jump_btn {
margin-top: -3px;
margin-left: 10px;
border-color: #d7d7d7; }
.u-pagination-total {
float: left;
height: 36px;
@ -6826,15 +6812,6 @@ input.u-button[type="submit"] {
margin: 5px; }
.u-pagination-total span {
padding: 0 5px; }
.u-pagination.u-pagination-disabled .u-pagination-disabled-mask {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 46px;
background: rgba(255, 255, 255, 0.6);
z-index: 2;
cursor: not-allowed; }
.pagination-state {
float: left;
@ -6941,29 +6918,15 @@ input.u-button[type="submit"] {
margin: 0 5px;
height: 18px;
line-height: 18px;
font-size: 14px;
white-space: nowrap;
cursor: pointer;
outline: none;
position: relative;
line-height: 1;
vertical-align: middle; }
font-size: 14px; }
.u-checkbox.disabled .u-checkbox-label {
cursor: not-allowed;
opacity: 0.5; }
.u-checkbox input[type='checkbox'] {
position: absolute;
z-index: 3;
cursor: pointer;
opacity: 0;
box-sizing: border-box;
padding: 0;
width: 100%;
height: 100%; }
display: none;
cursor: pointer; }
.u-checkbox input[disabled] {
cursor: not-allowed; }
.u-checkbox input[type='checkbox']:focus + .u-checkbox-label:before {
border-color: #1e88e5; }
.u-checkbox.is-checked .u-checkbox-label:before {
box-shadow: inset 0 0 0 10px rgb(30,136,229);
border-color: rgb(30,136,229); }
@ -7015,37 +6978,22 @@ input.u-button[type="submit"] {
box-shadow: inset 0 0 0 10px rgb(76,175,80);
border-color: rgb(76,175,80); }
.u-checkbox.u-checkbox-success input[type='checkbox']:focus + .u-checkbox-label:before {
border-color: rgb(76,175,80); }
.u-checkbox.u-checkbox-warning.is-checked .u-checkbox-label:before {
box-shadow: inset 0 0 0 10px rgb(255,152,0);
border-color: rgb(255,152,0); }
.u-checkbox.u-checkbox-warning input[type='checkbox']:focus + .u-checkbox-label:before {
border-color: rgb(255,152,0); }
.u-checkbox.u-checkbox-danger.is-checked .u-checkbox-label:before {
box-shadow: inset 0 0 0 10px rgb(244,67,54);
border-color: rgb(244,67,54); }
.u-checkbox.u-checkbox-danger input[type='checkbox']:focus + .u-checkbox-label:before {
border-color: rgb(244,67,54); }
.u-checkbox.u-checkbox-dark.is-checked .u-checkbox-label:before {
box-shadow: inset 0 0 0 10px rgb(97,97,97);
border-color: rgb(97,97,97); }
.u-checkbox.u-checkbox-dark input[type='checkbox']:focus + .u-checkbox-label:before {
border-color: rgb(97,97,97); }
.u-checkbox.u-checkbox-info.is-checked .u-checkbox-label:before {
box-shadow: inset 0 0 0 10px rgb(0,188,212);
border-color: rgb(0,188,212); }
.u-checkbox.u-checkbox-info input[type='checkbox']:focus + .u-checkbox-label:before {
border-color: rgb(0,188,212); }
/* FormGroup */
/* Navlayout */
/* keyframes 定义 */
@ -7583,8 +7531,7 @@ ul {
zoom: 1;
position: absolute;
right: 4px;
padding: 0 0 0 8px;
top: -3px; }
padding: 0 0 0 8px; }
.u-select-selection--multiple .u-select-selection-choice-remove:before {
display: block;
font-family: "uf"; }

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

36017
dist/demo.js vendored

File diff suppressed because one or more lines are too long

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.6.34",
"version": "1.6.36",
"description": "Table ui component for react",
"keywords": [
"react",

View File

@ -183,7 +183,7 @@ class Table extends Component {
this.columnManager.reset(null, nextProps.children);
}
//适配lazyload
if(nextProps.scrollTop){
if(nextProps.scrollTop > -1){
// this.refs.bodyTable.scrollTop = nextProps.scrollTop;
this.scrollTop = nextProps.scrollTop;
}
@ -206,11 +206,11 @@ class Table extends Component {
this.computeTableWidth();
this.firstDid = false;//避免重复update
}
if(this.scrollTop){
if(this.scrollTop > -1){
this.refs.fixedColumnsBodyLeft && ( this.refs.fixedColumnsBodyLeft.scrollTop = this.scrollTop);
this.refs.fixedColumnsBodyRight && ( this.refs.fixedColumnsBodyRight.scrollTop = this.scrollTop);
this.refs.bodyTable.scrollTop = this.scrollTop;
this.scrollTop = 0;
this.scrollTop = -1;
}
@ -781,7 +781,8 @@ class Table extends Component {
}else{
if(fixed){
if(this.domWidthDiff > 0){
innerBodyStyle.overflowX = 'auto';
headStyle.overflow = 'hidden';
innerBodyStyle.overflowX = 'auto'; //兼容expand场景、子表格含有固定列的场景
}else{
bodyStyle.marginBottom = `-${scrollbarWidth}px`;
}

View File

@ -1,6 +1,6 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
const defaultHeight = 40;
const defaultHeight = 30;
const rowDiff = 3; //行差值
let treeTypeIndex = 0;
export default function bigData(Table) {
@ -11,7 +11,8 @@ export default function bigData(Table) {
rowKey: "key",
onExpand() {},
scroll: {},
currentIndex:-1
currentIndex:-1,
isTree:false
};
static propTypes = {
loadBuffer: PropTypes.number
@ -79,7 +80,8 @@ export default function bigData(Table) {
*
*/
computeCachedRowParentIndex = data => {
const isTreeType = this.checkIsTreeType();
const {isTree} = this.props;
const isTreeType = isTree?true:this.checkIsTreeType();
if (isTreeType) {
data.forEach((item, index) => {
this.firstLevelKey[index] = this.getRowKey(item, index);
@ -96,7 +98,7 @@ export default function bigData(Table) {
setStartAndEndIndex(currentIndex,dataLen){
const _this = this;
if(currentIndex > _this.endIndex){
if(currentIndex > _this.currentIndex + _this.props.rowsInView){
_this.currentIndex = currentIndex;
_this.endIndex = _this.currentIndex; //数据开始位置
_this.startIndex = _this.currentIndex - _this.loadCount; //数据结束位置
@ -106,7 +108,9 @@ export default function bigData(Table) {
if(_this.startIndex < 0){
_this.startIndex = 0;
}
}else if(currentIndex < _this.startIndex){
//重新设定scrollTop值
_this.scrollTop = _this.getSumHeight(0, _this.endIndex - _this.rowsInView +2);
}else if(currentIndex < _this.currentIndex){
_this.currentIndex = currentIndex;
_this.startIndex = currentIndex;
_this.endIndex = currentIndex + _this.loadCount;
@ -116,10 +120,10 @@ export default function bigData(Table) {
if(_this.startIndex < 0){
_this.startIndex = 0;
}
}
//重新设定scrollTop值
_this.scrollTop = _this.getSumHeight(0, _this.endIndex - _this.rowsInView +2);
_this.scrollTop = _this.getSumHeight(0, _this.startIndex);
}
}
getRowKey(record, index) {