This commit is contained in:
Mirco Wittrien 2020-05-20 16:28:09 +02:00
parent d8ab524cc6
commit f7fd20198d
2 changed files with 14 additions and 13 deletions

View File

@ -3285,26 +3285,27 @@
return strings.map(s => typeof s == "number" ? s.toString() : s).filter(s => typeof s == "string").map(s => s.toLowerCase().replace(/\s/, "-")).join("-"); return strings.map(s => typeof s == "number" ? s.toString() : s).filter(s => typeof s == "string").map(s => s.toLowerCase().replace(/\s/, "-")).join("-");
}; };
BDFDB.ContextMenuUtils.findItem = function (returnvalue, config) { BDFDB.ContextMenuUtils.findItem = function (returnvalue, config) {
if (!returnvalue || !returnvalue.props || !BDFDB.ArrayUtils.is(returnvalue.props.children) || !BDFDB.ObjectUtils.is(config) || !config.label && !config.id) return [null, -1]; if (!returnvalue || !BDFDB.ObjectUtils.is(config) || !config.label && !config.id) return [null, -1];
config.label = config.label && [config.label].flat().filter(n => n); config.label = config.label && [config.label].flat().filter(n => n);
config.id = config.id && [config.id].flat().filter(n => n); config.id = config.id && [config.id].flat().filter(n => n);
for (let i in returnvalue.props.children) { let contextMenu = BDFDB.ReactUtils.findChild(returnvalue, {props: "navId"});
if (returnvalue.props.children[i] && returnvalue.props.children[i].type == RealMenuItems.MenuGroup) { if (contextMenu) for (let i in contextMenu.props.children) {
if (BDFDB.ArrayUtils.is(returnvalue.props.children[i].props.children)) { if (contextMenu.props.children[i] && contextMenu.props.children[i].type == RealMenuItems.MenuGroup) {
for (let j in returnvalue.props.children[i].props.children) if (check(returnvalue.props.children[i].props.children[j])) { if (BDFDB.ArrayUtils.is(contextMenu.props.children[i].props.children)) {
if (config.group) return [returnvalue.props.children, parseInt(i)]; for (let j in contextMenu.props.children[i].props.children) if (check(contextMenu.props.children[i].props.children[j])) {
else return [returnvalue.props.children[i].props.children, parseInt(j)]; if (config.group) return [contextMenu.props.children, parseInt(i)];
else return [contextMenu.props.children[i].props.children, parseInt(j)];
} }
} }
else if (returnvalue.props.children[i] && returnvalue.props.children[i].props && check(returnvalue.props.children[i].props.children)) { else if (contextMenu.props.children[i] && contextMenu.props.children[i].props && check(contextMenu.props.children[i].props.children)) {
if (config.group) return [returnvalue.props.children, parseInt(i)]; if (config.group) return [contextMenu.props.children, parseInt(i)];
else { else {
returnvalue.props.children[i].props.children = [returnvalue.props.children[i].props.children]; contextMenu.props.children[i].props.children = [contextMenu.props.children[i].props.children];
return [returnvalue.props.children[i].props.children, 0]; return [contextMenu.props.children[i].props.children, 0];
} }
} }
} }
else if (check(returnvalue.props.children[i])) return [returnvalue.props.children, parseInt(i)]; else if (check(contextMenu.props.children[i])) return [contextMenu.props.children, parseInt(i)];
} }
return [null, -1]; return [null, -1];
function check (child) { function check (child) {

File diff suppressed because one or more lines are too long