Fixed #3549 - ZIndexUtils is not working as expected on the overlays
parent
b1100e9e47
commit
477adc3f30
|
@ -347,8 +347,6 @@ const Tooltip = {
|
||||||
target.$_ptooltipScrollHandler.destroy();
|
target.$_ptooltipScrollHandler.destroy();
|
||||||
target.$_ptooltipScrollHandler = null;
|
target.$_ptooltipScrollHandler = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZIndexUtils.clear(el);
|
|
||||||
},
|
},
|
||||||
updated(el, options) {
|
updated(el, options) {
|
||||||
let target = getTarget(el);
|
let target = getTarget(el);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
function handler() {
|
function handler() {
|
||||||
let zIndexes = [];
|
let zIndexes = [];
|
||||||
|
|
||||||
const generateZIndex = (key, baseZIndex) => {
|
const generateZIndex = (key, baseZIndex = 999) => {
|
||||||
let lastZIndex = zIndexes.length > 0 ? zIndexes[zIndexes.length - 1] : { key, value: baseZIndex };
|
const lastZIndex = getLastZIndex(key, baseZIndex);
|
||||||
let newZIndex = lastZIndex.value + (lastZIndex.key === key ? 0 : baseZIndex) + 1;
|
const newZIndex = lastZIndex.value + (lastZIndex.key === key ? 0 : baseZIndex) + 1;
|
||||||
|
|
||||||
zIndexes.push({ key, value: newZIndex });
|
zIndexes.push({ key, value: newZIndex });
|
||||||
|
|
||||||
|
@ -14,8 +14,12 @@ function handler() {
|
||||||
zIndexes = zIndexes.filter((obj) => obj.value !== zIndex);
|
zIndexes = zIndexes.filter((obj) => obj.value !== zIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCurrentZIndex = () => {
|
const getCurrentZIndex = (key) => {
|
||||||
return zIndexes.length > 0 ? zIndexes[zIndexes.length - 1].value : 0;
|
return getLastZIndex(key).value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getLastZIndex = (key, baseZIndex = 0) => {
|
||||||
|
return [...zIndexes].reverse().find((obj) => obj.key === key) || { key, value: baseZIndex };
|
||||||
};
|
};
|
||||||
|
|
||||||
const getZIndex = (el) => {
|
const getZIndex = (el) => {
|
||||||
|
@ -35,7 +39,7 @@ function handler() {
|
||||||
el.style.zIndex = '';
|
el.style.zIndex = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getCurrent: () => getCurrentZIndex()
|
getCurrent: (key) => getCurrentZIndex(key)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue