This commit is contained in:
huayj 2019-08-26 17:07:51 +08:00
commit 1b1a719288
8 changed files with 186304 additions and 33253 deletions

View File

@ -348,9 +348,16 @@ var Table = function (_Component) {
_this.onBodyMouseLeave = _this.onBodyMouseLeave.bind(_this);
_this.tableUid = null;
_this.contentTable = null;
_this.leftColumnsLength; //左侧固定列的长度
_this.centerColumnsLength; //非固定列的长度
return _this;
}
Table.prototype.componentWillMount = function componentWillMount() {
this.centerColumnsLength = this.columnManager.centerColumns().length;
this.leftColumnsLength = this.columnManager.leftColumns().length;
};
Table.prototype.componentDidMount = function componentDidMount() {
this.getTableUID();
_utils.EventUtil.addHandler(this.contentTable, 'keydown', this.onKeyDown);
@ -830,7 +837,7 @@ var Table = function (_Component) {
var onRowDoubleClick = props.onRowDoubleClick;
var expandIconAsCell = fixed !== 'right' ? props.expandIconAsCell : false;
var expandIconColumnIndex = fixed !== 'right' ? props.expandIconColumnIndex : -1;
var expandIconColumnIndex = props.expandIconColumnIndex;
if (props.lazyLoad && props.lazyLoad.preHeight && indent == 0) {
rst.push(_react2["default"].createElement(_TableRow2["default"], { height: props.lazyLoad.preHeight, columns: [], className: '', key: 'table_row_first', store: this.store, visible: true }));
}
@ -957,7 +964,9 @@ var Table = function (_Component) {
expandedIcon: props.expandedIcon,
collapsedIcon: props.collapsedIcon,
lazyStartIndex: lazyCurrentIndex,
lazyEndIndex: lazyEndIndex
lazyEndIndex: lazyEndIndex,
centerColumnsLength: this.centerColumnsLength,
leftColumnsLength: this.leftColumnsLength
})));
this.treeRowIndex++;
var subVisible = visible && isRowExpanded;

View File

@ -593,6 +593,12 @@ var TableRow = function (_Component) {
isHiddenExpandIcon: isHiddenExpandIcon
});
var isExpandIconAsCell = expandIconAsCell ? clsPrefix + '-expand-columns-in-body' : '';
var expandIndexInThisTable;
if (this.props.fixed === 'right') {
expandIndexInThisTable = expandIconColumnIndex - this.props.leftColumnsLength - this.props.centerColumnsLength;
} else {
expandIndexInThisTable = expandIconColumnIndex;
}
for (var i = 0; i < columns.length; i++) {
if (expandIconAsCell && i === 0 && !showSum) {
cells.push(_react2["default"].createElement(
@ -604,7 +610,7 @@ var TableRow = function (_Component) {
expandIcon
));
}
var isColumnHaveExpandIcon = expandIconAsCell || expandRowByClick || showSum ? false : i === expandIconColumnIndex;
var isColumnHaveExpandIcon = expandIconAsCell || expandRowByClick || showSum ? false : i === expandIndexInThisTable;
cells.push(_react2["default"].createElement(_TableCell2["default"], {
clsPrefix: clsPrefix,
record: record,

File diff suppressed because one or more lines are too long

6
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

219494
dist/demo.js vendored

File diff suppressed because one or more lines are too long

4
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -160,6 +160,12 @@ class Table extends Component {
this.onBodyMouseLeave = this.onBodyMouseLeave.bind(this);
this.tableUid = null;
this.contentTable = null;
this.leftColumnsLength //左侧固定列的长度
this.centerColumnsLength //非固定列的长度
}
componentWillMount() {
this.centerColumnsLength = this.columnManager.centerColumns().length
this.leftColumnsLength = this.columnManager.leftColumns().length
}
componentDidMount() {
@ -672,7 +678,7 @@ class Table extends Component {
const onRowDoubleClick = props.onRowDoubleClick;
const expandIconAsCell = fixed !== 'right' ? props.expandIconAsCell : false;
const expandIconColumnIndex = fixed !== 'right' ? props.expandIconColumnIndex : -1;
const expandIconColumnIndex = props.expandIconColumnIndex
if(props.lazyLoad && props.lazyLoad.preHeight && indent == 0){
rst.push(
<TableRow height={props.lazyLoad.preHeight} columns={[]} className='' key={'table_row_first'} store={this.store} visible = {true}/>
@ -804,6 +810,8 @@ class Table extends Component {
collapsedIcon={props.collapsedIcon}
lazyStartIndex = {lazyCurrentIndex}
lazyEndIndex = {lazyEndIndex}
centerColumnsLength={this.centerColumnsLength}
leftColumnsLength={this.leftColumnsLength}
/>
);
this.treeRowIndex++;

View File

@ -200,21 +200,21 @@ class TableRow extends Component{
let event = Event.getEvent(e) ,
_target = Event.getTarget(event),
target = _target.parentNode;
if (target.tagName === 'TR') {
this.currentIndex = target.getAttribute("data-row-key");
onDragRowStart && onDragRowStart(this.currentIndex);
}else{
this.canBeTouch = false
}
}
onTouchMove = (e) => {
if (!this.canBeTouch) return;
e.stopPropagation()
let event = Event.getEvent(e);
@ -235,7 +235,7 @@ class TableRow extends Component{
* 手指移开时触发
*/
onTouchEnd = (e) => {
if(!this.canBeTouch){
this.canBeTouch = true
return
@ -476,6 +476,12 @@ class TableRow extends Component{
/>
);
let isExpandIconAsCell = expandIconAsCell ? `${clsPrefix}-expand-columns-in-body` : '';
var expandIndexInThisTable
if(this.props.fixed === 'right'){
expandIndexInThisTable = expandIconColumnIndex - this.props.leftColumnsLength-this.props.centerColumnsLength
}else {
expandIndexInThisTable = expandIconColumnIndex
}
for (let i = 0; i < columns.length; i++) {
if (expandIconAsCell && i === 0 && !showSum ) {
cells.push(
@ -488,7 +494,7 @@ class TableRow extends Component{
);
}
const isColumnHaveExpandIcon = (expandIconAsCell || expandRowByClick || showSum)
? false : (i === expandIconColumnIndex);
? false : (i === expandIndexInThisTable);
cells.push(
<TableCell
clsPrefix={clsPrefix}