Skip to content

Nav Layout Fixes/Updates #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 20, 2023
Prev Previous commit
Next Next commit
feat: allow more than 2 levels nested nav
  • Loading branch information
raheeliftikhar5 committed Nov 20, 2023
commit 48e4c713aa8863f365da611e8f3100c623312f0b
18 changes: 11 additions & 7 deletions client/packages/lowcoder/src/comps/comps/layout/navLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,25 @@ NavTmpLayout = withViewFn(NavTmpLayout, (comp) => {
},
[filterItem]
);

const itemKeyRecord = useMemo(() => {

const generateItemKeyRecord = useCallback((items: LayoutMenuItemComp[]) => {
console.log('generateItemKeyRecord', items)
const result: Record<string, LayoutMenuItemComp> = {};
items.forEach((item) => {
const subItems = item.children.items.getView();
if (subItems.length > 0) {
item.children.items
.getView()
.forEach((subItem) => (result[subItem.getItemKey()] = subItem));
} else {
Object.assign(result, generateItemKeyRecord(subItems))
}
else {
result[item.getItemKey()] = item;
}
});
return result;
}, [items]);
}, [items])

const itemKeyRecord = useMemo(() => {
return generateItemKeyRecord(items)
}, [generateItemKeyRecord, items]);

const defaultOpenKeys = useMemo(() => {
let itemPath: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default function DraggableMenuItem(props: IDraggableMenuItemProps) {
item={subItem}
level={0}
disabled={disabled || isDragging || disableDropIn}
// onAddSubMenu={onAddSubMenu}
onAddSubMenu={onAddSubMenu}
onDelete={onDelete}
parentDragging={isDragging}
/>
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy