Fixed #3554 - ZIndexUtils: Dropdown inside Dialog doesn't work
parent
cb91a464b7
commit
69a05f17f7
|
@ -1,8 +1,8 @@
|
||||||
function handler() {
|
function handler() {
|
||||||
let zIndexes = [];
|
let zIndexes = [];
|
||||||
|
|
||||||
const generateZIndex = (key, baseZIndex = 999) => {
|
const generateZIndex = (key, autoZIndex, baseZIndex = 999) => {
|
||||||
const lastZIndex = getLastZIndex(key, baseZIndex);
|
const lastZIndex = getLastZIndex(key, autoZIndex, baseZIndex);
|
||||||
const 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,12 +14,12 @@ function handler() {
|
||||||
zIndexes = zIndexes.filter((obj) => obj.value !== zIndex);
|
zIndexes = zIndexes.filter((obj) => obj.value !== zIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCurrentZIndex = (key) => {
|
const getCurrentZIndex = (key, autoZIndex) => {
|
||||||
return getLastZIndex(key).value;
|
return getLastZIndex(key, autoZIndex).value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getLastZIndex = (key, baseZIndex = 0) => {
|
const getLastZIndex = (key, autoZIndex, baseZIndex = 0) => {
|
||||||
return [...zIndexes].reverse().find((obj) => obj.key === key) || { key, value: baseZIndex };
|
return [...zIndexes].reverse().find((obj) => (autoZIndex ? true : obj.key === key)) || { key, value: baseZIndex };
|
||||||
};
|
};
|
||||||
|
|
||||||
const getZIndex = (el) => {
|
const getZIndex = (el) => {
|
||||||
|
@ -30,7 +30,7 @@ function handler() {
|
||||||
get: getZIndex,
|
get: getZIndex,
|
||||||
set: (key, el, baseZIndex) => {
|
set: (key, el, baseZIndex) => {
|
||||||
if (el) {
|
if (el) {
|
||||||
el.style.zIndex = String(generateZIndex(key, baseZIndex));
|
el.style.zIndex = String(generateZIndex(key, true, baseZIndex));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clear: (el) => {
|
clear: (el) => {
|
||||||
|
@ -39,7 +39,7 @@ function handler() {
|
||||||
el.style.zIndex = '';
|
el.style.zIndex = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getCurrent: (key) => getCurrentZIndex(key)
|
getCurrent: (key) => getCurrentZIndex(key, true)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue