拖拽优化
This commit is contained in:
parent
f34a796879
commit
f1029eaac5
|
@ -5258,6 +5258,18 @@ a, .mdl-accordion, .mdl-button, .mdl-card, .mdl-checkbox, .mdl-dropdown-menu,
|
||||||
.u-panel .u-panel-body {
|
.u-panel .u-panel-body {
|
||||||
padding: 15px 15px;
|
padding: 15px 15px;
|
||||||
position: relative; }
|
position: relative; }
|
||||||
|
.u-panel .u-panel-body .uf {
|
||||||
|
position: absolute;
|
||||||
|
right: 25px;
|
||||||
|
top: 30px;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 20px;
|
||||||
|
padding: 2px 8px;
|
||||||
|
margin: 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer; }
|
||||||
|
.u-panel .u-panel-body .uf:hover {
|
||||||
|
color: #a8a7a7; }
|
||||||
|
|
||||||
.u-panel-default {
|
.u-panel-default {
|
||||||
border-color: #ddd; }
|
border-color: #ddd; }
|
||||||
|
@ -7533,7 +7545,7 @@ ul {
|
||||||
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
z-index: 1050;
|
z-index: 1800;
|
||||||
left: -9999px;
|
left: -9999px;
|
||||||
top: -9999px;
|
top: -9999px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -8294,7 +8306,7 @@ ul {
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 1600;
|
z-index: 1900;
|
||||||
opacity: .7;
|
opacity: .7;
|
||||||
filter: blur(0.5px);
|
filter: blur(0.5px);
|
||||||
background-color: #fff; }
|
background-color: #fff; }
|
||||||
|
@ -9072,7 +9084,7 @@ ul {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -9999px;
|
left: -9999px;
|
||||||
top: -9999px;
|
top: -9999px;
|
||||||
z-index: 1000; }
|
z-index: 1800; }
|
||||||
|
|
||||||
.rc-calendar-picker-hidden {
|
.rc-calendar-picker-hidden {
|
||||||
display: none; }
|
display: none; }
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -564,7 +564,8 @@ class Table extends Component{
|
||||||
const headStyle = {};
|
const headStyle = {};
|
||||||
|
|
||||||
let tableClassName = '';
|
let tableClassName = '';
|
||||||
if (scroll.x || fixed) {
|
//表格元素的宽度大于容器的宽度也显示滚动条
|
||||||
|
if (scroll.x || fixed || this.contentDomWidth<this.contentWidth) {
|
||||||
tableClassName = `${clsPrefix}-fixed`;
|
tableClassName = `${clsPrefix}-fixed`;
|
||||||
if(!footerScroll){
|
if(!footerScroll){
|
||||||
bodyStyle.overflowX = bodyStyle.overflowX || 'auto';
|
bodyStyle.overflowX = bodyStyle.overflowX || 'auto';
|
||||||
|
@ -607,7 +608,7 @@ class Table extends Component{
|
||||||
) : null;
|
) : null;
|
||||||
let _drag_class = this.props.dragborder?"table-drag-bordered":""
|
let _drag_class = this.props.dragborder?"table-drag-bordered":""
|
||||||
return (
|
return (
|
||||||
<table className={` ${tableClassName} table table-bordered ${_drag_class} `} style={tableStyle} >
|
<table className={` ${tableClassName} table-bordered ${_drag_class} `} style={tableStyle} >
|
||||||
{this.props.dragborder?null:this.getColGroup(columns, fixed)}
|
{this.props.dragborder?null:this.getColGroup(columns, fixed)}
|
||||||
{hasHead ? this.getHeader(columns, fixed) : null}
|
{hasHead ? this.getHeader(columns, fixed) : null}
|
||||||
{tableBody}
|
{tableBody}
|
||||||
|
|
|
@ -100,8 +100,9 @@ class TableHeader extends Component{
|
||||||
this.drag.x = this.drag.initLeft;
|
this.drag.x = this.drag.initLeft;
|
||||||
this.drag.currIndex = this.props.rows[0].findIndex(da=>da.key==data.key);
|
this.drag.currIndex = this.props.rows[0].findIndex(da=>da.key==data.key);
|
||||||
this.drag.width = this.drag.data[this.drag.currIndex].width;
|
this.drag.width = this.drag.data[this.drag.currIndex].width;
|
||||||
|
let contentTableDom = document.getElementById("u-table-drag-thead-"+this.theadKey).parentNode;
|
||||||
|
|
||||||
this.contentTableWidth = contentTable.width;
|
this.contentTableWidth = contentTableDom.style.width?parseInt(contentTableDom.style.width):parseInt(contentTableDom.scrollWidth);
|
||||||
}
|
}
|
||||||
onMouseUp=(event,data)=>{
|
onMouseUp=(event,data)=>{
|
||||||
this.border = false;
|
this.border = false;
|
||||||
|
@ -116,10 +117,14 @@ class TableHeader extends Component{
|
||||||
if(!this.border)return;
|
if(!this.border)return;
|
||||||
const {dragborderKey,contentTable} = this.props;
|
const {dragborderKey,contentTable} = this.props;
|
||||||
let x = (event.pageX - this.drag.initPageLeftX) + this.drag.initLeft-0;
|
let x = (event.pageX - this.drag.initPageLeftX) + this.drag.initLeft-0;
|
||||||
|
let contentTableDom = document.getElementById("u-table-drag-thead-"+this.theadKey).parentNode;
|
||||||
|
|
||||||
if(!this.contentTableWidth){
|
if(!this.contentTableWidth){
|
||||||
this.contentTableWidth = contentTable.clientWidth;
|
this.contentTableWidth = contentTableDom.style.width?parseInt(contentTableDom.style.width):parseInt(contentTableDom.scrollWidth);
|
||||||
}
|
}
|
||||||
|
// console.log(this.contentTableWidth,x);
|
||||||
const newTableWidth = this.contentTableWidth + x;
|
const newTableWidth = this.contentTableWidth + x;
|
||||||
|
// console.log(newTableWidth);
|
||||||
const newWidth = this.drag.width + x;
|
const newWidth = this.drag.width + x;
|
||||||
if(newWidth<this.props.minColumnWidth){
|
if(newWidth<this.props.minColumnWidth){
|
||||||
//清楚样式
|
//清楚样式
|
||||||
|
@ -153,8 +158,9 @@ class TableHeader extends Component{
|
||||||
let currentDom = document.getElementById("u-table-drag-thead-"+this.theadKey).getElementsByTagName("th")[this.drag.currIndex];
|
let currentDom = document.getElementById("u-table-drag-thead-"+this.theadKey).getElementsByTagName("th")[this.drag.currIndex];
|
||||||
currentDom.style.width = newWidth+"px";
|
currentDom.style.width = newWidth+"px";
|
||||||
// this.contentTableWidth = newTableWidth;
|
// this.contentTableWidth = newTableWidth;
|
||||||
let contentTableDom = document.getElementById("u-table-drag-thead-"+this.theadKey).parentNode;
|
|
||||||
contentTableDom.style.width = newTableWidth+'px';
|
contentTableDom.style.width = newTableWidth+'px';
|
||||||
|
|
||||||
this.drag.x = x;
|
this.drag.x = x;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue