Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshatJawne committed May 28, 2024
2 parents a1ec475 + df587a8 commit 129a12b
Show file tree
Hide file tree
Showing 14 changed files with 451 additions and 32 deletions.
1 change: 1 addition & 0 deletions plugins/ui/src/deephaven/ui/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .picker import picker
from .action_group import action_group
from .section import section
from .action_menu import action_menu
from .item import item
from .list_view import list_view
from .list_action_group import list_action_group
Expand Down
202 changes: 196 additions & 6 deletions plugins/ui/src/deephaven/ui/components/action_menu.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,203 @@
from ..elements import BaseElement
from __future__ import annotations
from numbers import Number
from typing import Callable, Iterable

from .item import Item
from .section import SectionElement

# TODO: pydocs for action_menu #482
def action_menu(*children, **props):
from .spectrum.events import TriggerType
from ..types import Key, ActionKey, ActionMenuDirection
from ..elements import BaseElement, Element

from .spectrum import (
Alignment,
AlignSelf,
CSSProperties,
DimensionValue,
JustifySelf,
LayoutFlex,
Position,
)


def action_menu(
*children: Item | SectionElement,
is_disabled: bool | None = None,
is_quiet: bool | None = None,
auto_focus: bool | None = None,
disabled_keys: Iterable[Key] | None = None,
align: Alignment | None = "start",
direction: ActionMenuDirection | None = "bottom",
should_flip: bool | None = True,
close_on_select: bool | None = True,
trigger: TriggerType | None = "press",
is_open: bool | None = None,
default_open: bool | None = None,
on_action: Callable[[ActionKey], None] | None = None,
on_open_change: Callable[[bool], None] | None = None,
flex: LayoutFlex | None = None,
flex_grow: Number | None = None,
flex_shrink: Number | None = None,
flex_basis: DimensionValue | None = None,
align_self: AlignSelf | None = None,
justify_self: JustifySelf | None = None,
order: Number | None = None,
grid_area: str | None = None,
grid_row: str | None = None,
grid_row_start: str | None = None,
grid_row_end: str | None = None,
grid_column: str | None = None,
grid_column_start: str | None = None,
grid_column_end: str | None = None,
margin: DimensionValue | None = None,
margin_top: DimensionValue | None = None,
margin_bottom: DimensionValue | None = None,
margin_start: DimensionValue | None = None,
margin_end: DimensionValue | None = None,
margin_x: DimensionValue | None = None,
margin_y: DimensionValue | None = None,
width: DimensionValue | None = None,
height: DimensionValue | None = None,
min_width: DimensionValue | None = None,
min_height: DimensionValue | None = None,
max_width: DimensionValue | None = None,
max_height: DimensionValue | None = None,
position: Position | None = None,
top: DimensionValue | None = None,
bottom: DimensionValue | None = None,
start: DimensionValue | None = None,
end: DimensionValue | None = None,
left: DimensionValue | None = None,
right: DimensionValue | None = None,
z_index: Number | None = None,
is_hidden: bool | None = None,
id: str | None = None,
aria_label: str | None = None,
aria_labelledby: str | None = None,
aria_describedby: str | None = None,
aria_details: str | None = None,
UNSAFE_class_name: str | None = None,
UNSAFE_style: CSSProperties | None = None,
) -> Element:
"""
ActionMenu combines an ActionButton with a Menu for simple "more actions" use cases.
Args:
children: A list of Item or primitive elements.
**props: Any other ActionMenu prop.
children: The contents of the collection.
is_disabled: Whether the button is disabled.
is_quiet: Whether the button should be displayed with a quiet style.
auto_focus: Whether the element should receive focus on render.
disabled_keys: The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.
align: Alignment of the menu relative to the trigger.
direction: Where the Menu opens relative to its trigger.
should_flip: Whether the menu should automatically flip direction when space is limited.
close_on_select: Whether the Menu closes when a selection is made.
trigger: How the menu is triggered.
is_open: Whether the overlay is open by default (controlled).
default_open: Whether the overlay is open by default (uncontrolled).
on_action: Handler that is called when an item is selected.
on_open_change: Handler that is called when the overlay's open state changes.
flex: When used in a flex layout, specifies how the element will grow or shrink to fit the space available.
flex_grow: When used in a flex layout, specifies how the element will grow to fit the space available.
flex_shrink: When used in a flex layout, specifies how the element will shrink to fit the space available.
flex_basis: When used in a flex layout, specifies the initial main size of the element.
align_self: Overrides the alignItems property of a flex or grid container.
justify_self: Species how the element is justified inside a flex or grid container.
order: The layout order for the element within a flex or grid container.
grid_area: When used in a grid layout specifies, specifies the named grid area that the element should be placed in within the grid.
grid_row: When used in a grid layout, specifies the row the element should be placed in within the grid.
grid_column: When used in a grid layout, specifies the column the element should be placed in within the grid.
grid_row_start: When used in a grid layout, specifies the starting row to span within the grid.
grid_row_end: When used in a grid layout, specifies the ending row to span within the grid.
grid_column_start: When used in a grid layout, specifies the starting column to span within the grid.
grid_column_end: When used in a grid layout, specifies the ending column to span within the grid.
margin: The margin for all four sides of the element.
margin_top: The margin for the top side of the element.
margin_bottom: The margin for the bottom side of the element.
margin_start: The margin for the logical start side of the element, depending on layout direction.
margin_end: The margin for the logical end side of the element, depending on layout direction.
margin_x: The margin for the left and right sides of the element.
margin_y: The margin for the top and bottom sides of the element.
width: The width of the element.
height: The height of the element.
min_width: The minimum width of the element.
min_height: The minimum height of the element.
max_width: The maximum width of the element.
max_height: The maximum height of the element.
position: Specifies how the element is position.
top: The top position of the element.
bottom: The bottom position of the element.
left: The left position of the element.
right: The right position of the element.
start: The logical start position of the element, depending on layout direction.
end: The logical end position of the element, depending on layout direction.
z_index: The stacking order for the element
is_hidden: Hides the element.
id: The unique identifier of the element.
aria-label: Defines a string value that labels the current element.
aria-labelledby: Identifies the element (or elements) that labels the current element.
aria-describedby: Identifies the element (or elements) that describes the object.
aria-details: Identifies the element (or elements) that provide a detailed, extended description for the object.
UNSAFE_class_name: Set the CSS className for the element. Only use as a last resort. Use style props instead.
UNSAFE_style: Set the inline style for the element. Only use as a last resort. Use style props instead.
"""
return BaseElement(f"deephaven.ui.components.ActionMenu", *children, **props)
return BaseElement(
f"deephaven.ui.components.ActionMenu",
*children,
is_disabled=is_disabled,
is_quiet=is_quiet,
auto_focus=auto_focus,
disabled_keys=disabled_keys,
align=align,
direction=direction,
should_flip=should_flip,
close_on_select=close_on_select,
trigger=trigger,
is_open=is_open,
default_open=default_open,
on_action=on_action,
on_open_change=on_open_change,
flex=flex,
flex_grow=flex_grow,
flex_shrink=flex_shrink,
flex_basis=flex_basis,
align_self=align_self,
justify_self=justify_self,
order=order,
grid_area=grid_area,
grid_row=grid_row,
grid_row_start=grid_row_start,
grid_row_end=grid_row_end,
grid_column=grid_column,
grid_column_start=grid_column_start,
grid_column_end=grid_column_end,
margin=margin,
margin_top=margin_top,
margin_bottom=margin_bottom,
margin_start=margin_start,
margin_end=margin_end,
margin_x=margin_x,
margin_y=margin_y,
width=width,
height=height,
min_width=min_width,
min_height=min_height,
max_width=max_width,
max_height=max_height,
position=position,
top=top,
bottom=bottom,
start=start,
end=end,
left=left,
right=right,
z_index=z_index,
is_hidden=is_hidden,
id=id,
aria_label=aria_label,
aria_labelledby=aria_labelledby,
aria_describedby=aria_describedby,
aria_details=aria_details,
UNSAFE_class_name=UNSAFE_class_name,
UNSAFE_style=UNSAFE_style,
)
6 changes: 3 additions & 3 deletions plugins/ui/src/deephaven/ui/components/combo_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
Position,
CSSProperties,
LabelPosition,
Alignment,
ValidationBehavior,
NecessityIndicator,
ValidationState,
MenuTriggerAction,
Align,
Direction,
MenuDirection,
LoadingState,
FormValue,
Alignment,
)

from deephaven.table import Table, PartitionedTable
Expand All @@ -48,7 +48,7 @@ def combo_box(
menu_trigger: MenuTriggerAction | None = "input",
is_quiet: bool | None = None,
align: Align | None = "end",
direction: Direction | None = "bottom",
direction: MenuDirection | None = "bottom",
loading_state: LoadingState | None = None,
should_flip: bool = True,
menu_width: DimensionValue | None = None,
Expand Down
3 changes: 2 additions & 1 deletion plugins/ui/src/deephaven/ui/components/date_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
AriaPressed,
CSSProperties,
LabelPosition,
Alignment,
ValidationBehavior,
NecessityIndicator,
ValidationState,
PageBehavior,
HourCycle,
Alignment,
)

from ..hooks import use_memo
from ..elements import Element, BaseElement
from .._internal.utils import (
Expand Down
2 changes: 1 addition & 1 deletion plugins/ui/src/deephaven/ui/components/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Any
from ..elements import BaseElement
from .._internal.utils import create_props
from .spectrum.layout import (
from .spectrum import (
Direction,
Wrap,
JustifyContent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
from .flex import *
from .date_picker import *
from .combo_box import *
from .layout import *
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

MenuTriggerAction = Literal["focus", "input", "manual"]
Align = Literal["start", "end"]
Direction = Literal["bottom", "top"]
MenuDirection = Literal["bottom", "top"]
LoadingState = Literal[
"loading", "sorting", "loadingMore", "error", "idle", "filtering"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
PageBehavior = Literal["single", "visible"]
HourCycle = Literal[12, 24]
ValidationBehavior = Literal["aria", "native"]
Alignment = Literal["start", "end"]
NecessityIndicator = Literal["label", "icon"]
ValidationState = Literal["valid", "invalid"]
1 change: 1 addition & 0 deletions plugins/ui/src/deephaven/ui/components/spectrum/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class PressEvent(TypedDict):

PointerType = Literal["mouse", "touch", "pen", "keyboard", "virtual"]
PressEventType = Literal["pressstart", "pressend", "pressup", "press"]
TriggerType = Literal["press", "longPress"]

StaticColor = Literal["white", "black"]
ButtonType = Literal["button", "submit", "reset"]
Expand Down
2 changes: 2 additions & 0 deletions plugins/ui/src/deephaven/ui/components/spectrum/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@

OverflowMode = Literal["wrap", "collapse"]

Alignment = Literal["start", "end"]

Number = Union[int, float]

LayoutFlex = Union[str, Number, bool]
Expand Down
1 change: 1 addition & 0 deletions plugins/ui/src/deephaven/ui/types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class RowDataValue(CellData):
SelectionMode = Literal["SINGLE", "MULTIPLE"]
Sentinel = Any
TransformedData = Any
ActionMenuDirection = Literal["bottom", "top", "left", "right", "start", "end"]
StringSortDirection = Literal["ASC", "DESC"]
TableSortDirection = Union[StringSortDirection, SortDirection]
# Stringable is a type that is naturally convertible to a string
Expand Down
Loading

0 comments on commit 129a12b

Please sign in to comment.