export DateSelector, fix issue about column.align and filter panel position of the last header cell.

This commit is contained in:
2024-01-30 11:16:57 +08:00
parent df42221b52
commit 0b897cae8a
8 changed files with 133 additions and 30 deletions

View File

@ -975,6 +975,11 @@ export class Grid {
th.addEventListener('mousedown', e => this._onDragStart(e, col));
}
const wrapper = createElement('div');
if (col.align === 'right') {
wrapper.style.justifyContent = 'flex-end';
} else if (col.align === 'center') {
wrapper.style.justifyContent = 'center';
}
th.appendChild(wrapper);
if (!this.readonly && col.enabled !== false && col.allcheck && isCheckbox) {
const check = createCheckbox({
@ -1239,6 +1244,8 @@ export class Grid {
const style = col.styleFilter(item);
if (style != null) {
type.setStyle(element, style);
} else {
element.style.cssText = '';
}
}
if (col.events != null) {
@ -1562,7 +1569,12 @@ export class Grid {
const th = filter.parentElement;
const width = th.offsetWidth;
panel.style.top = `${th.offsetHeight + this._var.el.scrollTop}px`;
panel.style.left = (th.offsetLeft + (width > FilterPanelWidth ? width - FilterPanelWidth : 0)) + 'px';
const offsetLeft = th.offsetLeft;
const totalWidth = th.parentElement.offsetWidth;
const left = offsetLeft + FilterPanelWidth > totalWidth ?
totalWidth - FilterPanelWidth :
offsetLeft + (width > FilterPanelWidth ? width - FilterPanelWidth : 0);
panel.style.left = `${left}px`;
// search
let searchbox;