Fixed #4795 - v2 DataTable: Frozen column improvements
parent
4dd5b46a2f
commit
52f5c5a09a
|
@ -343,7 +343,7 @@ export default {
|
||||||
let align = this.columnProp('alignFrozen');
|
let align = this.columnProp('alignFrozen');
|
||||||
if (align === 'right') {
|
if (align === 'right') {
|
||||||
let right = 0;
|
let right = 0;
|
||||||
let next = this.$el.nextElementSibling;
|
let next = DomHandler.getNextElementSibling(this.$el, '.p-frozen-column');
|
||||||
if (next) {
|
if (next) {
|
||||||
right = DomHandler.getOuterWidth(next) + parseFloat(next.style.right || 0);
|
right = DomHandler.getOuterWidth(next) + parseFloat(next.style.right || 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ export default {
|
||||||
let align = this.columnProp('alignFrozen');
|
let align = this.columnProp('alignFrozen');
|
||||||
if (align === 'right') {
|
if (align === 'right') {
|
||||||
let right = 0;
|
let right = 0;
|
||||||
let next = this.$el.nextElementSibling;
|
let next = DomHandler.getNextElementSibling(this.$el, '.p-frozen-column');
|
||||||
if (next) {
|
if (next) {
|
||||||
right = DomHandler.getOuterWidth(next) + parseFloat(next.style.left);
|
right = DomHandler.getOuterWidth(next) + parseFloat(next.style.left);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ export default {
|
||||||
let align = this.columnProp('alignFrozen');
|
let align = this.columnProp('alignFrozen');
|
||||||
if (align === 'right') {
|
if (align === 'right') {
|
||||||
let right = 0;
|
let right = 0;
|
||||||
let next = this.$el.nextElementSibling;
|
let next = DomHandler.getNextElementSibling(this.$el, '.p-frozen-column');
|
||||||
if (next) {
|
if (next) {
|
||||||
right = DomHandler.getOuterWidth(next) + parseFloat(next.style.right || 0);
|
right = DomHandler.getOuterWidth(next) + parseFloat(next.style.right || 0);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ export default {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let left = 0;
|
let left = 0;
|
||||||
let prev = this.$el.previousElementSibling;
|
let prev = DomHandler.getPreviousElementSibling(this.$el, '.p-frozen-column');
|
||||||
if (prev) {
|
if (prev) {
|
||||||
left = DomHandler.getOuterWidth(prev) + parseFloat(prev.style.left || 0);
|
left = DomHandler.getOuterWidth(prev) + parseFloat(prev.style.left || 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -480,6 +480,34 @@ export default class DomHandler {
|
||||||
return focusableElements.length > 0 ? focusableElements[0] : null;
|
return focusableElements.length > 0 ? focusableElements[0] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getPreviousElementSibling(element, selector) {
|
||||||
|
let previousElement = element.previousElementSibling;
|
||||||
|
|
||||||
|
while (previousElement) {
|
||||||
|
if (previousElement.matches(selector)) {
|
||||||
|
return previousElement;
|
||||||
|
} else {
|
||||||
|
previousElement = previousElement.previousElementSibling;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static getNextElementSibling(element, selector) {
|
||||||
|
let nextElement = element.nextElementSibling;
|
||||||
|
|
||||||
|
while (nextElement) {
|
||||||
|
if (nextElement.matches(selector)) {
|
||||||
|
return nextElement;
|
||||||
|
} else {
|
||||||
|
nextElement = nextElement.nextElementSibling;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
static isClickable(element) {
|
static isClickable(element) {
|
||||||
const targetNode = element.nodeName;
|
const targetNode = element.nodeName;
|
||||||
const parentNode = element.parentElement && element.parentElement.nodeName;
|
const parentNode = element.parentElement && element.parentElement.nodeName;
|
||||||
|
|
|
@ -44,6 +44,8 @@ export declare class DomHandler {
|
||||||
static invokeElementMethod(el: HTMLElement, methodName: string, args: any): void;
|
static invokeElementMethod(el: HTMLElement, methodName: string, args: any): void;
|
||||||
static getFocusableElements(el: HTMLElement): any[];
|
static getFocusableElements(el: HTMLElement): any[];
|
||||||
static getFirstFocusableElement(el: HTMLElement): any;
|
static getFirstFocusableElement(el: HTMLElement): any;
|
||||||
|
static getPreviousElementSibling(el: HTMLElement, selector?: string): any;
|
||||||
|
static getNextElementSibling(el: HTMLElement, selector?: string): any;
|
||||||
static isClickable(el: HTMLElement): boolean;
|
static isClickable(el: HTMLElement): boolean;
|
||||||
static applyStyle(el: HTMLElement, style: any): void;
|
static applyStyle(el: HTMLElement, style: any): void;
|
||||||
static isIOS(): boolean;
|
static isIOS(): boolean;
|
||||||
|
|
Loading…
Reference in New Issue