|
|
@ -21,8 +21,23 @@ export function createTagInfo(tag: any, allTags: any[]): TagQueryInfo { |
|
|
|
return [t.name]; |
|
|
|
return [t.name]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const resolveChildren: (t: any) => Set<number> = (t: any) => { |
|
|
|
|
|
|
|
if (t.childIds.length > 0) { |
|
|
|
|
|
|
|
const childSets: Set<number>[] = allTags.filter((o: any) => t.childIds.includes(o.tagId)) |
|
|
|
|
|
|
|
.map((child: any) => resolveChildren(child)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var r = new Set<number>(); |
|
|
|
|
|
|
|
childSets.forEach((c: any) => { |
|
|
|
|
|
|
|
r = new Set([...r, ...c]); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return r; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return new Set([t.tagId]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
id: tag.tagId, |
|
|
|
matchIds: [...resolveChildren(tag)], |
|
|
|
fullName: resolveName(tag), |
|
|
|
fullName: resolveName(tag), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -44,6 +59,14 @@ export function QBAddElemMenu(props: MenuProps) { |
|
|
|
return <NestedMenuItem |
|
|
|
return <NestedMenuItem |
|
|
|
label={_props.tag.name} |
|
|
|
label={_props.tag.name} |
|
|
|
parentMenuOpen={Boolean(anchorEl)} |
|
|
|
parentMenuOpen={Boolean(anchorEl)} |
|
|
|
|
|
|
|
onClick={() => { |
|
|
|
|
|
|
|
onClose(); |
|
|
|
|
|
|
|
props.onCreateQuery({ |
|
|
|
|
|
|
|
a: QueryLeafBy.TagInfo, |
|
|
|
|
|
|
|
leafOp: QueryLeafOp.Equals, |
|
|
|
|
|
|
|
b: createTagInfo(_props.tag, _props.allTags), |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
{children.map((child: any) => <TagItem tag={child} allTags={_props.allTags} />)} |
|
|
|
{children.map((child: any) => <TagItem tag={child} allTags={_props.allTags} />)} |
|
|
|
</NestedMenuItem> |
|
|
|
</NestedMenuItem> |
|
|
@ -78,7 +101,7 @@ export function QBAddElemMenu(props: MenuProps) { |
|
|
|
return <TagItem tag={tag} allTags={tags} /> |
|
|
|
return <TagItem tag={tag} allTags={tags} /> |
|
|
|
})} |
|
|
|
})} |
|
|
|
</> |
|
|
|
</> |
|
|
|
: <>Loading!</> |
|
|
|
: <>...</> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return <Menu |
|
|
|
return <Menu |
|
|
|