dcasia / collapsible-resource-manager

A custom sidebar menu with collapsible groups
MIT License
196 stars 44 forks source link

New feature: close side panel manually #120

Closed scramatte closed 1 year ago

scramatte commented 1 year ago

Hello,

Can you add button to collapse side panel manually? When you choose a menu item, the side menu remain opened, that is fine but it would be cool to be able to close it manually to get more space.

Regards

milewski commented 1 year ago

When you load the page it will be expanded by default when there is a menu selected, if you click on the same menu again.. it will close .. inst this a manual button already?

vitorcrovador commented 1 year ago

It doesn't happen like that here. Even if I click on the selected menu button it doesn't close.

It would be very interesting if there was a parameter for the initial default state to be expanded or closed. And the side panel closes when clicking anywhere else on the screen.

When you load the page it will be expanded by default when there is a menu selected, if you click on the same menu again.. it will close .. inst this a manual button already?

vitorcrovador commented 1 year ago

Yesterday, trying to find out why closing the menu wasn't working, for some reason I still don't know what it is, it started working. However, after doing a composer update it stopped working again (without adding or removing any packages). I hope that in some way this information helps to correct the error.

milewski commented 1 year ago

Could that be the nova version? are you running on the latest version?

vitorcrovador commented 1 year ago

Could that be the nova version? are you running on the latest version?

Yes, I´m using the latest version (v4.27.14)

vitorcrovador commented 1 year ago

I think I found where the error is, I just don't know how to fix it. It's in the setActiveMenu function. I did a direct override in the browser to debug and it seems that the currentActiveMenu variable is not the same as the "menu" variable because it comes as "Proxy Object". I sent a print, I believe that this way you will be able to understand and correct it. error-collpsible-menu

milewski commented 1 year ago

Oh this issue I have fixed here: https://github.com/dcasia/collapsible-resource-manager/blob/b582c10c6d9ccd06f2169924f9947a52ae3703a6/resources/js/components/Menu.vue#L283-L291 but wasn't merged yet, all that needs to do to fix is add a .key can you submit a PR matching this? @vitorcrovador

vitorcrovador commented 1 year ago

Thanks! I made the Pull Request, I don't know if I did it right. It's the first time I've done this.

milewski commented 1 year ago

Thanks! released v2.0.7