Skip to content
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

Add NestedSelect dynamic levels #6011

Merged
merged 8 commits into from
Dec 18, 2023
Merged

Conversation

ahuang11
Copy link
Contributor

@ahuang11 ahuang11 commented Dec 7, 2023

Apparently dynamic levels was already supported after changes for this #5791 (comment)

There was just a tiny fix to make to hide the subsequent options.

Screen.Recording.2023-12-07.at.1.38.26.PM.mov

@ahuang11 ahuang11 changed the title Nested select dynamic levels Add NestedSelect dynamic levels Dec 7, 2023
Copy link

codecov bot commented Dec 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4d88374) 84.67% compared to head (a785b83) 84.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6011      +/-   ##
==========================================
+ Coverage   84.67%   84.68%   +0.01%     
==========================================
  Files         291      291              
  Lines       43816    43847      +31     
==========================================
+ Hits        37100    37131      +31     
  Misses       6716     6716              
Flag Coverage Δ
ui-tests 40.62% <2.85%> (-0.04%) ⬇️
unitexamples-tests 72.88% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ahuang11
Copy link
Contributor Author

ahuang11 commented Dec 8, 2023

Eh some Chat things failing. I'll look into it tomorrow

FAILED panel/tests/chat/test_icon.py::TestChatReactionIcons::test_init - assert 'icon-tabler-heart' in '\n    <svg alt="favorite" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-help-square" width="15" height="15" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">\n        <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>\n        <path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"></path>\n        <path d="M12 16v.01"></path>\n        <path d="M12 13a2 2 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483"></path>\n    </svg>\n'
FAILED panel/tests/chat/test_icon.py::TestChatReactionIcons::test_value - assert 'icon-tabler-heart-fill' in '\n    <svg alt="favorite" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-help-square-filled" width="15" height="15" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">\n        <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>\n        <path d="M19 2a3 3 0 0 1 2.995 2.824l.005 .176v14a3 3 0 0 1 -2.824 2.995l-.176 .005h-14a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h14zm-7 13a1 1 0 0 0 -.993 .883l-.007 .117l.007 .127a1 1 0 0 0 1.986 0l.007 -.117l-.007 -.127a1 1 0 0 0 -.993 -.883zm1.368 -6.673a2.98 2.98 0 0 0 -3.631 .728a1 1 0 0 0 1.44 1.383l.171 -.18a.98 .98 0 0 1 1.11 -.15a1 1 0 0 1 -.34 1.886l-.232 .012a1 1 0 0 0 .111 1.994a3 3 0 0 0 1.371 -5.673z" stroke-width="0" fill="currentColor"></path>\n    </svg>\n'
FAILED panel/tests/chat/test_icon.py::TestChatReactionIcons::test_active_icons - assert 'icon-tabler-thumb-down' in '\n    <svg alt="dislike" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-help-square-filled" width="15" height="15" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">\n        <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>\n        <path d="M19 2a3 3 0 0 1 2.995 2.824l.005 .176v14a3 3 0 0 1 -2.824 2.995l-.176 .005h-14a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005h14zm-7 13a1 1 0 0 0 -.993 .883l-.007 .117l.007 .127a1 1 0 0 0 1.986 0l.007 -.117l-.007 -.127a1 1 0 0 0 -.993 -.883zm1.368 -6.673a2.98 2.98 0 0 0 -3.631 .728a1 1 0 0 0 1.44 1.383l.171 -.18a.98 .98 0 0 1 1.11 -.15a1 1 0 0 1 -.34 1.886l-.232 .012a1 1 0 0 0 .111 1.994a3 3 0 0 0 1.371 -5.673z" stroke-width="0" fill="currentColor"></path>\n    </svg>\n'
FAILED panel/tests/chat/test_icon.py::TestChatReactionIcons::test_width_height - assert 'width="50px"' in '\n    <svg alt="favorite" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-help-square" width="15" height="15" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">\n        <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>\n        <path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"></path>\n        <path d="M12 16v.01"></path>\n        <path d="M12 13a2 2 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483"></path>\n    </svg>\n'

@ahuang11
Copy link
Contributor Author

Those tests should be fixed in a separate PR now.

@MarcSkovMadsen
Copy link
Collaborator

MarcSkovMadsen commented Dec 16, 2023

Nice. My use case does not always start from a well defined dict. Instead it starts either from

  • A dataframe for example with categorical columns Source, Product, Var, GPH.
  • a set of functions get_sources(), get_products(source), get_vars(source, product) and get_gphs(source, product, var). For example some that looks up its results in a database or from a rest api.

It would be really, really nice if these cases where supported out of the box or it was documented how to easily implement them.

@philippjfr
Copy link
Member

Yes, I still really want to see the .from_data (naming to be decided) method implemented on widgets where it makes sense. I find myself writing code to find the min/max or the unique values in a column or index constantly.

@MarcSkovMadsen
Copy link
Collaborator

MarcSkovMadsen commented Dec 16, 2023

Furthermore it would be really useful to be able to define the widgets used. I would for example like to sometimes be able to set the size of the Select widget to something >1 or use a RadioButtonGroup instead of a Select.

The same for the widgets_layout. It would be nice to be able to customize it. Should it be WidgetBox, Row, Column or ...

@ahuang11
Copy link
Contributor Author

ahuang11 commented Dec 16, 2023

For your first and second to last request it's already possible https://github.com/holoviz/panel/blob/main/examples%2Freference%2Fwidgets%2FNestedSelect.ipynb

@ahuang11
Copy link
Contributor Author

ahuang11 commented Dec 18, 2023

To clarify, would it be possible to get this PR in before those other feature requests?

Widget layout: #6070
From data: #6071 (I think this one needs more discussion / design)

@philippjfr philippjfr merged commit 80b902e into main Dec 18, 2023
10 of 13 checks passed
@philippjfr philippjfr deleted the nested_select_dynamic_levels branch December 18, 2023 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants