Skip to content

Commit

Permalink
revert: Revert some changes that are not compatible with v0.78 (deeph…
Browse files Browse the repository at this point in the history
…aven#550)

- Need to revert some changes that require a newer version of
@deephaven/components so that we can publish a version for Enterprise V+
  - Will publish and then add these back to main
- **Revert "refactor: Cleanup component mappings and utils (python side)
(deephaven#523)"**
- **Revert "feat: Make RadioGroup orientation prop case insensitive
(deephaven#536)"**
- **Revert "feat: ui.checkbox, ui.button, ui.button_group, ui.radio,
ui.radio_group, ui.icon (deephaven#512)"**
- **Revert "chore: Update DH packages to ^0.81.1 jsapi-types to
^1.0.0-dev0.34.3 (deephaven#511)"**
- Tested with a V+ branch on Enterprise and v0.78 of `@deephaven`
packages
  • Loading branch information
mofojed authored Jun 13, 2024
1 parent 195f334 commit 27414e1
Show file tree
Hide file tree
Showing 62 changed files with 781 additions and 1,141 deletions.
2 changes: 1 addition & 1 deletion jest.config.base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
'^.+\\.(ts|tsx|js|jsx)$': ['babel-jest', { rootMode: 'upward' }],
},
transformIgnorePatterns: [
'/node_modules/(?!(@deephaven|monaco-editor|d3-interpolate|d3-color|nanoid)/)',
'/node_modules/(?!(@deephaven|monaco-editor|d3-interpolate|d3-color)/)',
],
moduleNameMapper: {
'theme-([^/]+?)\\.css(\\?(?:inline|raw))?$': path.join(
Expand Down
980 changes: 474 additions & 506 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 0 additions & 30 deletions plugins/ui/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,36 +249,6 @@ def ui_action_menu():
my_action_menu = ui_action_menu()
```

## ButtonGroup

ButtonGroup handles overflow for a grouping of buttons whose actions are related to each other.

```python
@ui.component
def ui_button_group():
return ui.button_group(ui.button("One"), ui.button("Two"))


my_button_group = ui_button_group()
```

## RadioGroup

Radio buttons allow users to select a single option from a list of mutually exclusive options. All possible options are exposed up front for users to compare.

```python
@ui.component
def ui_radio_group():
return ui.radio_group(
ui.radio("One", value="one"),
ui.radio("Two", value="two"),
label="Radio Group",
)


my_radio_group = ui_radio_group()
```

## Picker (string values)

The `ui.picker` component can be used to select from a list of items. Here's a basic example for selecting from a list of string values and displaying the selected key in a text field.
Expand Down
62 changes: 15 additions & 47 deletions plugins/ui/src/deephaven/ui/components/__init__.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,24 @@
from .action_button import action_button
from .action_group import action_group
from .action_menu import action_menu
from .basic import (
component_element,
grid,
heading,
icon_wrapper,
illustrated_message,
form,
switch,
tabs,
tab_list,
tab_panels,
text,
view,
)
from .button import button
from .button_group import button_group
from .checkbox import checkbox
from .column import column
from .combo_box import combo_box
from .content import content
from .contextual_help import contextual_help
from .dashboard import dashboard
from .date_picker import date_picker
from .flex import flex
from .fragment import fragment
from .icon import icon
from .item import item
from .item_table_source import item_table_source
from .list_action_group import list_action_group
from .list_action_menu import list_action_menu
from .list_view import list_view
from .make_component import make_component as component
from .number_field import number_field
from .fragment import fragment
from .panel import panel
from .picker import picker
from .radio import radio
from .radio_group import radio_group
from .range_slider import range_slider
from .spectrum import *
from .table import table
from .dashboard import dashboard
from .row import row
from .section import section
from .slider import slider
from .column import column
from .stack import stack
from .table import table
from .text_field import text_field
from .toggle_button import toggle_button
from .types import *
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
from .list_action_menu import list_action_menu
from .item_table_source import item_table_source

from . import html

Expand All @@ -55,17 +27,14 @@
"action_button",
"action_group",
"action_menu",
"component_element",
"button",
"button_group",
"checkbox",
"column",
"combo_box",
"component",
"content",
"contextual_help",
"dashboard",
"date_picker",
"flex",
"form",
"fragment",
Expand All @@ -83,12 +52,11 @@
"number_field",
"panel",
"picker",
"radio",
"radio_group",
"range_slider",
"row",
"section",
"slider",
"spectrum_element",
"stack",
"switch",
"table",
Expand Down
15 changes: 7 additions & 8 deletions plugins/ui/src/deephaven/ui/components/action_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
from typing import Any, Callable, Iterable


from .types import (
# Events
from ..components.spectrum.events import (
ButtonLabelBehavior,
Orientation,
StaticColor,
# Layout
)
from ..elements import Element, BaseElement
from ..types import ActionGroupDensity, SelectedKeys, SelectionMode, Key, Selection
from .spectrum.layout import (
AlignSelf,
CSSProperties,
DimensionValue,
Expand All @@ -17,9 +19,6 @@
OverflowMode,
Position,
)
from .basic import component_element
from ..elements import Element
from ..types import ActionGroupDensity, SelectedKeys, SelectionMode, Key, Selection


def action_group(
Expand Down Expand Up @@ -154,8 +153,8 @@ def action_group(
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 component_element(
"ActionGroup",
return BaseElement(
"deephaven.ui.components.ActionGroup",
*children,
is_emphasized=is_emphasized,
density=density,
Expand Down
19 changes: 5 additions & 14 deletions plugins/ui/src/deephaven/ui/components/action_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,11 @@
from .item import Item
from .section import SectionElement

from .spectrum.events import TriggerType
from ..types import Key, ActionKey, ActionMenuDirection
from .basic import component_element
from ..elements import Element
from ..elements import BaseElement, Element

from ..types import (
Key,
ActionKey,
ActionMenuDirection,
)

from .types import (
# Events
TriggerType,
# Layout
from .spectrum import (
Alignment,
AlignSelf,
CSSProperties,
Expand Down Expand Up @@ -150,8 +141,8 @@ def action_menu(
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 component_element(
f"ActionMenu",
return BaseElement(
f"deephaven.ui.components.ActionMenu",
*children,
is_disabled=is_disabled,
is_quiet=is_quiet,
Expand Down
6 changes: 4 additions & 2 deletions plugins/ui/src/deephaven/ui/components/column.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from typing import Any
from .basic import component_element
from ..elements import BaseElement


def column(*children: Any, width: float | None = None, **kwargs: Any):
Expand All @@ -13,4 +13,6 @@ def column(*children: Any, width: float | None = None, **kwargs: Any):
children: Elements to render in the column.
width: The percent width of the column relative to other children of its parent. If not provided, the column will be sized automatically.
"""
return component_element("Column", *children, width=width, **kwargs)
return BaseElement(
"deephaven.ui.components.Column", *children, width=width, **kwargs
)
5 changes: 2 additions & 3 deletions plugins/ui/src/deephaven/ui/components/combo_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Callable

from .types import (
from .spectrum import (
FocusEventCallable,
KeyboardEventCallable,
LayoutFlex,
Expand Down Expand Up @@ -31,7 +31,6 @@
from ..elements import BaseElement, Element
from .._internal.utils import create_props, unpack_item_table_source
from ..types import Key
from .basic import component_element

ComboBoxElement = BaseElement

Expand Down Expand Up @@ -240,4 +239,4 @@ def combo_box(

children, props = unpack_item_table_source(children, props, SUPPORTED_SOURCE_ARGS)

return component_element("ComboBox", *children, **props)
return BaseElement("deephaven.ui.components.ComboBox", *children, **props)
7 changes: 3 additions & 4 deletions plugins/ui/src/deephaven/ui/components/date_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Any, Sequence, Callable

from .types import (
from .spectrum import (
FocusEventCallable,
KeyboardEventCallable,
LayoutFlex,
Expand All @@ -23,14 +23,13 @@
)

from ..hooks import use_memo
from ..elements import Element
from ..elements import Element, BaseElement
from .._internal.utils import (
create_props,
convert_date_props,
convert_list_prop,
)
from ..types import Date, Granularity
from .basic import component_element

DatePickerElement = Element

Expand Down Expand Up @@ -272,4 +271,4 @@ def date_picker(
[unavailable_values],
)

return component_element("DatePicker", **props)
return BaseElement("deephaven.ui.components.DatePicker", **props)
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/fragment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from typing import Any
from .basic import component_element
from ..elements import BaseElement


def fragment(*children: Any):
Expand All @@ -12,4 +12,4 @@ def fragment(*children: Any):
Args:
children: The children in the fragment.
"""
return component_element("Fragment", children=children)
return BaseElement("deephaven.ui.components.Fragment", children=children)
3 changes: 1 addition & 2 deletions plugins/ui/src/deephaven/ui/components/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from ..elements import BaseElement
from ..types import Stringable
from .basic import component_element

ItemElement = BaseElement
Item = Union[Stringable, ItemElement]
Expand All @@ -16,4 +15,4 @@ def item(*children: Stringable, **props: Any) -> ItemElement:
children: The options to render within the item.
**props: Any other Item prop.
"""
return component_element("Item", *children, **props)
return BaseElement("deephaven.ui.components.Item", *children, **props)
15 changes: 5 additions & 10 deletions plugins/ui/src/deephaven/ui/components/list_action_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from numbers import Number
from typing import Callable, Iterable

from .basic import component_element
from .item import Item
from ..elements import Element
from ..elements import BaseElement, Element
from ..types import (
Key,
ActionKey,
Expand All @@ -14,12 +13,7 @@
SelectionMode,
Selection,
)
from .types import (
# Events
ButtonLabelBehavior,
Orientation,
StaticColor,
# Layout
from .spectrum.layout import (
AlignSelf,
CSSProperties,
DimensionValue,
Expand All @@ -28,6 +22,7 @@
OverflowMode,
Position,
)
from .spectrum.events import ButtonLabelBehavior, Orientation, StaticColor

ListActionGroupElement = Element

Expand Down Expand Up @@ -168,8 +163,8 @@ def list_action_group(
A ListActionGroup that can be used within the actions prop of a `ui.list_view` component.
"""

return component_element(
"ListActionGroup",
return BaseElement(
"deephaven.ui.components.ListActionGroup",
*children,
on_action=on_action,
on_change=on_change,
Expand Down
13 changes: 5 additions & 8 deletions plugins/ui/src/deephaven/ui/components/list_action_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
from typing import Callable, Iterable, Union


from .basic import component_element
from .item import Item
from ..elements import Element
from ..elements import BaseElement, Element
from ..types import Key, ActionKey, ActionMenuDirection
from .types import (
# Events
TriggerType,
# Layout
from .spectrum.layout import (
AlignSelf,
Alignment,
CSSProperties,
Expand All @@ -20,6 +16,7 @@
LayoutFlex,
Position,
)
from .spectrum.events import TriggerType

ListActionMenuElement = Element

Expand Down Expand Up @@ -151,8 +148,8 @@ def list_action_menu(
A ListActionMenu that can be used within the actions prop of a `ui.list_view` component.
"""

return component_element(
"ListActionMenu",
return BaseElement(
"deephaven.ui.components.ListActionMenu",
*children,
on_action=on_action,
on_open_change=on_open_change,
Expand Down
Loading

0 comments on commit 27414e1

Please sign in to comment.