-
Notifications
You must be signed in to change notification settings - Fork 17
feat: Add Python list_view implementation #359
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3910e5b
initial impl
jnumainville 7cdb160
small fix
jnumainville dbec903
fix import
jnumainville 17dc230
comments
jnumainville 8a4c82f
tweaks
jnumainville 3ed8965
fixed imports
jnumainville ac218b9
Update plugins/ui/DESIGN.md
jnumainville File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
plugins/ui/src/deephaven/ui/components/list_action_group.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import Callable, Any, Union | ||
|
|
||
| from .item import ItemElement | ||
| from ..elements import BaseElement, Element | ||
| from .._internal.utils import create_props | ||
| from ..types import Stringable, Selection, Key, ActionKey | ||
|
|
||
| ActionGroupItem = Union[Stringable, ItemElement] | ||
| ListActionGroupElement = Element | ||
|
|
||
|
|
||
| def list_action_group( | ||
| *children: ActionGroupItem, | ||
| on_action: Callable[[ActionKey, Key], None] | None = None, | ||
| on_selection_change: Callable[[Selection, Key], None] | None = None, | ||
| **props: Any, | ||
| ) -> ListActionGroupElement: | ||
| """ | ||
| A group of action buttons that can be used to create a list of actions. | ||
| This component should be used within the actions prop of a `ListView` component. | ||
|
|
||
| Args: | ||
| *children: The options to render within the list_action_group. | ||
| on_action: Handler that is called when an item is pressed. | ||
| The first argument is the key of the action, the second argument is the key of the list_view item. | ||
| on_selection_change: Handler that is called when the selection changes. | ||
| The first argument is the selection, the second argument is the key of the list_view item. | ||
| **props: Any other ActionGroup prop. | ||
|
|
||
| Returns: | ||
| A ListActionGroup that can be used within the actions prop of a `ListView` component. | ||
| """ | ||
| children, props = create_props(locals()) | ||
|
|
||
| return BaseElement("deephaven.ui.components.ListActionGroup", *children, **props) |
38 changes: 38 additions & 0 deletions
38
plugins/ui/src/deephaven/ui/components/list_action_menu.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import Callable, Any, Union | ||
|
|
||
|
|
||
| from .item import ItemElement | ||
| from ..elements import BaseElement, Element | ||
| from .._internal.utils import create_props | ||
| from ..types import Stringable, Key, ActionKey | ||
|
|
||
| ActionMenuItem = Union[Stringable, ItemElement] | ||
| ListActionMenuElement = Element | ||
|
|
||
|
|
||
| def list_action_menu( | ||
| *children: ActionMenuItem, | ||
| on_action: Callable[[ActionKey, Key], None] | None = None, | ||
| on_open_change: Callable[[bool, Key], None] | None = None, | ||
| **props: Any, | ||
| ) -> ListActionMenuElement: | ||
| """ | ||
| A menu of action buttons that can be used to create a list of actions. | ||
| This component should be used within the actions prop of a `ListView` component. | ||
|
|
||
| Args: | ||
| *children: The options to render within the list_action_menu. | ||
| on_action: Handler that is called when an item is selected. | ||
| The first argument is the key of the action, the second argument is the key of the list_view item. | ||
| on_open_change: Handler that is called when the menu is opened or closed. | ||
| The first argument is a boolean indicating if the menu is open, the second argument is the key of the list_view item. | ||
| **props: Any other ActionMenu prop. | ||
|
|
||
| Returns: | ||
| A ListActionMenu that can be used within the actions prop of a `ListView` component. | ||
| """ | ||
| children, props = create_props(locals()) | ||
|
|
||
| return BaseElement("deephaven.ui.components.ListActionMenu", *children, **props) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.