-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbec903
commit 17dc230
Showing
5 changed files
with
145 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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 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 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 ListActionGroup 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.