Fixed #3554 - ZIndexUtils: Dropdown inside Dialog doesn't work

pull/3567/head
mertsincan 2023-01-18 15:40:42 +00:00
parent cb91a464b7
commit 69a05f17f7
1 changed files with 8 additions and 8 deletions

View File

@ -1,8 +1,8 @@
function handler() {
let zIndexes = [];
const generateZIndex = (key, baseZIndex = 999) => {
const lastZIndex = getLastZIndex(key, baseZIndex);
const generateZIndex = (key, autoZIndex, baseZIndex = 999) => {
const lastZIndex = getLastZIndex(key, autoZIndex, baseZIndex);
const newZIndex = lastZIndex.value + (lastZIndex.key === key ? 0 : baseZIndex) + 1;
zIndexes.push({ key, value: newZIndex });
@ -14,12 +14,12 @@ function handler() {
zIndexes = zIndexes.filter((obj) => obj.value !== zIndex);
};
const getCurrentZIndex = (key) => {
return getLastZIndex(key).value;
const getCurrentZIndex = (key, autoZIndex) => {
return getLastZIndex(key, autoZIndex).value;
};
const getLastZIndex = (key, baseZIndex = 0) => {
return [...zIndexes].reverse().find((obj) => obj.key === key) || { key, value: baseZIndex };
const getLastZIndex = (key, autoZIndex, baseZIndex = 0) => {
return [...zIndexes].reverse().find((obj) => (autoZIndex ? true : obj.key === key)) || { key, value: baseZIndex };
};
const getZIndex = (el) => {
@ -30,7 +30,7 @@ function handler() {
get: getZIndex,
set: (key, el, baseZIndex) => {
if (el) {
el.style.zIndex = String(generateZIndex(key, baseZIndex));
el.style.zIndex = String(generateZIndex(key, true, baseZIndex));
}
},
clear: (el) => {
@ -39,7 +39,7 @@ function handler() {
el.style.zIndex = '';
}
},
getCurrent: (key) => getCurrentZIndex(key)
getCurrent: (key) => getCurrentZIndex(key, true)
};
}