mui / toolpad

Toolpad: Full stack components and low-code builder for dashboards and internal apps.
https://mui.com/toolpad/
MIT License
963 stars 243 forks source link

[DashboardLayout] Support route patterns in navigation #3991

Closed apedroferreira closed 2 weeks ago

apedroferreira commented 3 weeks ago

Closes https://github.com/mui/mui-toolpad/issues/3974 (partially, must create new partial issue for PageContainer component and follow https://github.com/mui/mui-toolpad/pull/3991#issuecomment-2310618664 + https://github.com/mui/mui-toolpad/pull/3991#pullrequestreview-2262532367

Adds an optional pattern property to navigation page items so that these can be marked as selected according to that pattern (using path-to-regexp), instead of the default behavior that uses their segment property.

https://deploy-preview-3991--mui-toolpad-docs.netlify.app/toolpad/core/react-dashboard-layout/#navigation-pattern-matching

Also simplifies the logic for the console warning in DashboardLayout for duplicate navigation items.

No changes to PageContainer or any more complex behavior for now, those will be done separately, as well as refactored logic for the selected item.

apedroferreira commented 3 weeks ago

In a further PR, will add further refactoring to keep track of one only selected list item and share that logic between DashboardLayout and PageContainer components.

Also create a separate issue for these improvements.