Compare commits

..

No commits in common. "7940edbea27469d15c8bbac30a5628d14206d1e7" and "dc2b67a33c8030fb067625d5b07ad2481bf7ebd8" have entirely different histories.

2 changed files with 9 additions and 17 deletions

View File

@ -202,7 +202,7 @@
// } // }
} }
>.bottom-border { >em.bottom-border {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;

View File

@ -691,12 +691,6 @@ export class Grid {
* @private * @private
*/ */
footerOffset: null, footerOffset: null,
/**
* 容器宽度
* @type {number}
* @private
*/
wrapClientWidth: null,
/** /**
* 正文宽度 * 正文宽度
* @type {number} * @type {number}
@ -1375,7 +1369,7 @@ export class Grid {
}); });
holder.addEventListener('dblclick', e => this._onRowDblClicked(e)); holder.addEventListener('dblclick', e => this._onRowDblClicked(e));
wrapper.appendChild(holder); wrapper.appendChild(holder);
grid.addEventListener('mousemove', e => throttle(this._onGridMouseMove, HoverInternal, this, e, holder), { passive: true }); wrapper.addEventListener('mousemove', e => throttle(this._onGridMouseMove, HoverInternal, this, e, holder), { passive: true });
} }
// loading // loading
@ -1443,7 +1437,6 @@ export class Grid {
this.reload(keep); this.reload(keep);
} }
} }
this._var.wrapClientWidth = this._var.refs.wrapper.clientWidth;
this._var.bodyClientWidth = body.clientWidth; this._var.bodyClientWidth = body.clientWidth;
} }
@ -1498,7 +1491,7 @@ export class Grid {
if (!keep) { if (!keep) {
this._var.scrollTop = 0; this._var.scrollTop = 0;
this._var.el.scrollTop = 0; this._var.el.scrollTop = 0;
this._var.el.scrollLeft = 0; // this._var.el.scrollLeft = 0;
this._var.refs.table.style.top = '0px'; this._var.refs.table.style.top = '0px';
} }
this._adjustRows(this._var.refs.body); this._adjustRows(this._var.refs.body);
@ -2279,7 +2272,7 @@ export class Grid {
th.appendChild(spliter); th.appendChild(spliter);
} }
// bottom border // bottom border
th.appendChild(createElement('layer', 'bottom-border')); th.appendChild(createElement('em', 'bottom-border'));
// tooltip // tooltip
// !nullOrEmpty(col.tooltip) && setTooltip(th, col.tooltip); // !nullOrEmpty(col.tooltip) && setTooltip(th, col.tooltip);
header.appendChild(th); header.appendChild(th);
@ -2288,7 +2281,7 @@ export class Grid {
const draggerCursor = createElement('layer', 'dragger-cursor'); const draggerCursor = createElement('layer', 'dragger-cursor');
header.appendChild( header.appendChild(
createElement('th', null, createElement('th', null,
dragger, draggerCursor, createElement('div'), createElement('layer', 'bottom-border'))); dragger, draggerCursor, createElement('div'), createElement('em', 'bottom-border')));
sizer.replaceChildren(); sizer.replaceChildren();
this._var.refs.header = header; this._var.refs.header = header;
@ -3604,7 +3597,6 @@ export class Grid {
if (this.onBodyScrolled === 'function') { if (this.onBodyScrolled === 'function') {
this.onBodyScrolled(e); this.onBodyScrolled(e);
} }
this._var.scrollLeft = e.target.scrollLeft;
if (!this.virtual) { if (!this.virtual) {
if (this.total != null) { if (this.total != null) {
this._var.refs.footer.parentElement.style.bottom = `${this._var.footerOffset - e.target.scrollTop}px`; this._var.refs.footer.parentElement.style.bottom = `${this._var.footerOffset - e.target.scrollTop}px`;
@ -3667,15 +3659,15 @@ export class Grid {
const top = (parent.classList.contains('ui-grid-total-row') ? this._var.refs.footer.parentElement.offsetTop + 1 : target.offsetTop) + this._var.refs.table.offsetTop; const top = (parent.classList.contains('ui-grid-total-row') ? this._var.refs.footer.parentElement.offsetTop + 1 : target.offsetTop) + this._var.refs.table.offsetTop;
let left = target.offsetLeft; let left = target.offsetLeft;
let width = holder.offsetWidth; let width = holder.offsetWidth;
if (width > this._var.wrapClientWidth) { if (width > this._var.bodyClientWidth) {
width = this._var.wrapClientWidth; width = this._var.bodyClientWidth;
} }
const maxleft = this._var.wrapClientWidth + this._var.scrollLeft - width; const maxleft = this._var.bodyClientWidth + this._var.scrollLeft - width;
if (left > maxleft) { if (left > maxleft) {
left = maxleft; left = maxleft;
} }
const height = target.offsetHeight; const height = target.offsetHeight;
holder.style.cssText = `top: ${top}px; left: ${left}px; max-width: ${this._var.wrapClientWidth}px; height: ${height - 2}px`; holder.style.cssText = `top: ${top}px; left: ${left}px; max-width: ${this._var.bodyClientWidth}px; height: ${height - 2}px`;
holder.classList.add('active'); holder.classList.add('active');
} else if (holder.classList.contains('active')) { } else if (holder.classList.contains('active')) {
delete holder.dataset.row; delete holder.dataset.row;