Feature Added: Collapse Configs('In-place' config added) for AccordionPanel#776
Feature Added: Collapse Configs('In-place' config added) for AccordionPanel#776KH-Coder865 wants to merge 29 commits intojupyterlab:mainfrom
Conversation
|
Maybe it would be worth adding an example panel with this option enabled in https://github.com/jupyterlab/lumino/tree/main/examples/example-accordionpanel ? |
Refactor accordion implementation to support default and in-place collapse modes.
|
Hello @krassowski, I’ve added an example panel to examples/example-accordionpanel that demonstrates the new collapseMode: 'in-place' option side by side with the default behavior, so the difference is easy to see in practice. Hope these changes are in accordance with what you had in mind. Thanks for the review! |
|
Great, now we have a preview on https://lumino--776.org.readthedocs.build/en/776/examples/accordionpanel/index.html I don't see a difference in behaviour in the preview though? Am I missing something? It looks like it would be good to add orange and purple to: lumino/examples/example-accordionpanel/style/content.css Lines 35 to 49 in 39ba08e |
Refactor widget size computation logic in accordion panel.
Adjust accordion panel behavior to not hide when in 'last-open' collapse mode.
Comment out neighbor calculation and related logic for widget resizing.
Add missing collapse functionality in toggleExpansion method.
This reverts commit 4aa072f.
Refactor accordion panel size calculations to include delta adjustments for collapsing and expanding widgets. Improve normalization logic to maintain size ratios.
Refactor accordion panel to conditionally add spacer widget based on collapse mode. Update titles getter to filter out spacer when present.
|
Hello @krassowski . |
|
Ran Prettier on edited files. |
|
Hello @krassowski, Thanks for taking another look — I appreciate you re-running the workflows. |
|
Hi @krassowski , it would be great if you could take a look at this. I think the |
|
Hi @krassowski . |
|
Hello @krassowski , if everything looks good then please let me know so that we can start working on related issues. Waiting for the review. |
|
Hello @krassowski |
|
No, its done intentionally. So, I didn't changed its default behavior (to keep its current applications intact everywhere, like in notebook), instead, in the new configuration for the Accordion Panel, I changed the redistribution logic, by adding a fake container at the very end, which isn't visible but it plays a role in space redistribution. Makes sense? |
|
Well, so it does solve a problem, but introduces another issue - the space is not fully utilized. I does not feel like the right solution to me but I will let others chime in. |
|
Yes, sure! |
|
But, I personally think, that if we keep the constraint of occupying the full height, then we would have to redistribute the spaces among containers, and this will indeed result in a dropping down action of the last dropdown of Accordion Panel. That's why this new configuration was needed, to tackle that redistribution problem. Further, I am open to corrections and making changes. |
|
I request @krassowski @andrii-i @fcollonval @jtpio to please put forward their thoughts or reviews on this. |
|
Hello @krassowski 👋 I believe that this PR is now ready for merging. As it just adds a functionality to the existing stack (which can be used if required) and doesn't modify the existing behaviour of this accordion panel in other places like notebook. |
What this PR does:
This PR adds a new
collapseModeoption toAccordionPanelthat allows configuring how sections collapse:'last-open'(default): current behavior, the last open widget expands to the bottom'in-place': collapses the widget in its current position, redistributing its size to the nearest open neighborChanges:
_collapseModeproperty toAccordionPanelwith optional getter/setter_computeWidgetSizeto handle both'last-open'and'in-place'collapse modesIOptions.collapseModewith example usageExample usage:
Additional context:
Fixes:
Labels:
enhancement