Skip to content

Commit 2f782d4

Browse files
Copilotrenemadsen
andcommitted
Fix drag and drop for menu items into dropdown bodies
Co-authored-by: renemadsen <[email protected]>
1 parent 50b60cb commit 2f782d4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

eform-client/src/app/modules/advanced/modules/navigation-menu/components/navigation-menu-page/navigation-menu-page.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
class="dragula-template"
3434
cdkDropList
3535
[cdkDropListData]="menuTemplate.items"
36-
[cdkDropListConnectedTo]="['actualMenuList']"
36+
[cdkDropListConnectedTo]="['actualMenuList'].concat(connectedDropdownIds)"
3737
id="mainMenu"
3838
>
3939
<app-navigation-menu-template-item
@@ -98,6 +98,7 @@
9898
<div
9999
class="dropdownBody"
100100
cdkDropList
101+
[id]="getDropdownId(firstLevelIndex)"
101102
[cdkDropListData]="menuItem.children"
102103
[cdkDropListConnectedTo]="['mainMenu']"
103104
(cdkDropListDropped)="dropMenuItemChild($event, firstLevelIndex)"

eform-client/src/app/modules/advanced/modules/navigation-menu/components/navigation-menu-page/navigation-menu-page.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ export class NavigationMenuPageComponent implements OnInit, OnDestroy {
6363
return NavigationMenuItemTypeEnum;
6464
}
6565

66+
getDropdownId(index: number): string {
67+
return `dropdown-${index}`;
68+
}
69+
70+
get connectedDropdownIds(): string[] {
71+
return this.navigationMenuModel.actualMenu
72+
.map((item, index) => item.type === NavigationMenuItemTypeEnum.Dropdown ? this.getDropdownId(index) : null)
73+
.filter(id => id !== null) as string[];
74+
}
75+
6676
constructor() {
6777
}
6878

0 commit comments

Comments
 (0)