diff --git a/src/Table.scss b/src/Table.scss
index 7577be3..1494fba 100644
--- a/src/Table.scss
+++ b/src/Table.scss
@@ -76,7 +76,9 @@ $icon-color:#505F79;
tr:last-child{
border-bottom: 1px solid $table-th-bottom-border;
}
-
+ tr>th:last-child{
+ border-right: none;
+ }
}
tr {
// transition: all 0.3s ease;
diff --git a/src/TableHeader.js b/src/TableHeader.js
index 618fda6..475f79e 100644
--- a/src/TableHeader.js
+++ b/src/TableHeader.js
@@ -152,6 +152,7 @@ class TableHeader extends Component {
table.table = tableDome;
table.cols = tableDome.getElementsByTagName("col");
table.ths = tableDome.getElementsByTagName("th");
+ table.tr = tableDome.getElementsByTagName("tr");
}
table.fixedLeftHeaderTable = contentTable.querySelector('.u-table-fixed-left .u-table-header') ;
@@ -289,6 +290,10 @@ class TableHeader extends Component {
*/
onLineMouseUp = (event) => {
let width = this.drag.newWidth;
+ // const newTableWidth = this.drag.tableWidth + diff +'px';
+ // this.table.table.style.width = newTableWidth;//同步table的width
+ // this.table.innerTableBody.style.width = newTableWidth ;//同步改变table body 的width
+ // console.log(" --onLineMouseUp--- ");
this.clearDragBorder(event);
this.props.onDropBorder && this.props.onDropBorder(event,width);
};
@@ -300,7 +305,7 @@ class TableHeader extends Component {
this.clearDragBorder(event);
};
- clearDragBorder(){
+ clearDragBorder(){
if(!this.drag || !this.drag.option)return;
let {rows} = this.props;
let data = {rows:rows[0],cols:this.table.cols,currIndex:this.drag.currIndex};
@@ -593,8 +598,9 @@ class TableHeader extends Component {
let attr = dragborder ? { id: `u-table-drag-thead-${this.theadKey}` } : {};
return (
this._thead = _thead} >
- {rows.map((row, index) => (
-
+ {rows.map((row, index) => {
+ let _rowLeng = (row.length-1);
+ return(
{row.map((da, columIndex, arr) => {
let thHover = da.drgHover
? ` ${clsPrefix}-thead th-drag-hover`
@@ -642,11 +648,10 @@ class TableHeader extends Component {
thClassName += ` ${clsPrefix}-thead-th ${canDotDrag}`;
}
thClassName += ` ${fixedStyle}`;
-
- if(!da.fixed){
+ if(!da.fixed && columIndex != _rowLeng){
return (
- ))}
+ )})}
);
}
diff --git a/src/lib/dragColumn.js b/src/lib/dragColumn.js
index 2a44b20..bb896f4 100644
--- a/src/lib/dragColumn.js
+++ b/src/lib/dragColumn.js
@@ -1,6 +1,5 @@
import React, { Component } from "react";
import {compare,ObjectAssign} from './util';
-let cloneDeep = require('lodash.clonedeep');
/**
* 参数: 列拖拽
* @param {*} Table
@@ -33,14 +32,6 @@ export default function dragColumn(Table) {
return _column;
}
- cloneDeep(obj){
- if( typeof obj !== 'object' || Object.keys(obj).length === 0 ){
- return obj
- }
- let resultData = {}
- return this.recursion(obj, resultData)
- }
-
recursion(obj, data={}){
for(key in obj){
if( typeof obj[key] == 'object' && Object.keys(obj[key].length>0 )){
@@ -58,16 +49,7 @@ export default function dragColumn(Table) {
let sourceIndex = -1,targetIndex = -1;
sourceIndex = columns.findIndex((da,i)=>da.key == dragSource.key);
- targetIndex = columns.findIndex((da,i)=>da.key == dragTarg.key);
- // for (let index = 0; index < columns.length; index++) {
- // const da = columns[index];
- // if(da.key === dragSource.key){
- // columns[index] = dragTargColum;
- // }
- // if(da.key === dragTarg.key){
- // columns[index] = dragSourceColum;
- // }
- // }
+ targetIndex = columns.findIndex((da,i)=>da.key == dragTarg.key);
// 向前移动
if(targetIndex < sourceIndex){
targetIndex = targetIndex + 1;
@@ -77,9 +59,6 @@ export default function dragColumn(Table) {
0,
columns.splice(sourceIndex, 1)[0]
);
- // this.setState({
- // columns:cloneDeep(columns)
- // });
let _newColumns = [];
columns.forEach((da,i)=>{
let newDate = Object.assign(da,{});
@@ -114,7 +93,6 @@ export default function dragColumn(Table) {
onDrop,
...others
} = this.props;
- let key = new Date().getTime();
return (
+ data-line-key={da.key} data-line-index={columIndex} data-th-width={da.width} data-row-leng="1111111111111" >
{da.children}
{
dragborder ?