Skip to content

Commit

Permalink
Merge branch 'main' into 418-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanalvizo committed Jul 12, 2024
2 parents 5f5cd88 + 4b92021 commit 7a5143f
Show file tree
Hide file tree
Showing 37 changed files with 790 additions and 418 deletions.
4 changes: 3 additions & 1 deletion cog.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ post_bump_hooks = []

# bump hooks for package versions, which is what we actually use
pre_package_bump_hooks = [
"echo Updating {{package}} to version {{version}}",
"echo Updating {{package}} from {{latest}} to version {{version}}",
# Confirm the user wishes to proceed
"../../tools/confirm.sh",
# make sure user has correct software installed and is authenticated with `gh` cli tool
"../../tools/validate.sh",
# change the version number of the given plugin in source, and commit it as a chore(version): commit
Expand Down
503 changes: 206 additions & 297 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions plugins/plotly-express/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.

- - -
## plotly-express-v0.10.0 - 2024-07-09
#### Bug Fixes
- remove Number type and replace with float/int (#590) - (d0e24f4) - Akshat Jawne
- gapminder to be compatible with Pandas 2.0.3 (#586) - (fae2f75) - Alex Peters
#### Documentation
- Make autodoc output structured (#582) - (d1aa3d5) - Joe
#### Features
- add dx.data.jobs and dx.data.marketing example data sets (#595) - (41c7f7e) - Alex Peters
- Replace shortid with nanoid (#591) - (ad8aad9) - Akshat Jawne

- - -

## plotly-express-v0.9.0 - 2024-06-20
#### Bug Fixes
- update init to bring in new datasets (#564) - (048e1d6) - Alex Peters
Expand Down
2 changes: 1 addition & 1 deletion plugins/plotly-express/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = deephaven-plugin-plotly-express
description = Deephaven Chart Plugin
long_description = file: README.md
long_description_content_type = text/markdown
version = 0.9.0.dev0
version = 0.10.0.dev0
url = https://github.com/deephaven/deephaven-plugins
project_urls =
Source Code = https://github.com/deephaven/deephaven-plugins
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
from .data_generators import iris, stocks, tips, election, wind, gapminder
from .data_generators import (
iris,
jobs,
marketing,
stocks,
tips,
election,
wind,
gapminder,
)
2 changes: 1 addition & 1 deletion plugins/plotly-express/src/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deephaven/js-plugin-plotly-express",
"version": "0.9.0",
"version": "0.10.0",
"description": "Deephaven plotly express plugin",
"keywords": [
"Deephaven",
Expand Down
42 changes: 42 additions & 0 deletions plugins/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,48 @@
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.

- - -
## ui-v0.17.0 - 2024-07-09
#### Bug Fixes
- Remove type imports from @react-types/shared (#610) - (66dc4bf) - Akshat Jawne
- ui.table cell and row press event data can be wrong (#593) - (c4a2fe7) - Matthew Runyon
- icons in illustrated message (#575) - (1623ff5) - ethanalvizo
- remove Number type and replace with float/int (#590) - (d0e24f4) - Akshat Jawne
- Don't render objects/children of panels if there's a widget error (#577) (#585) - (bd8cca9) - mofojed
- Don't use a key for the ErrorBoundary in a Panel (#574) - (4a25715) - mofojed
- Wrap the children of ReactPanel with an ErrorBoundary (#565) - (8cbee84) - mofojed
#### Build system
- Update DHC packages to ^0.85.0 (#605) - (df6786a) - bmingles
#### Documentation
- icon (#594) - (20fe042) - ethanalvizo
- item (#531) - (21fe131) - ethanalvizo
- illustrated message (#532) - (137c1ea) - ethanalvizo
- heading (#553) - (00875f9) - ethanalvizo
- grid (#552) - (5bf53e6) - ethanalvizo
#### Features
- UI table layout hints (#587) - (5e3c5e2) - Matthew Runyon
- UI ComboBox component (#588) - (0564299) - bmingles
- make ui.panel flex align-items start by default (#604) - (be97ad8) - Don
- UI Tabs Improvement (#489) - (145493a) - Akshat Jawne
- Replace shortid with nanoid (#591) - (ad8aad9) - Akshat Jawne
- ui.table context menu items (#522) - (32d09e8) - Matthew Runyon
#### Refactoring
- Remove row and column indexes from table press handlers (#592) - (05fc8f0) - Matthew Runyon

- - -

## ui-v0.16.0 - 2024-07-09
#### Documentation
- view (#506) - (e4b7137) - ethanalvizo
#### Features
- Return callables from callables in Deephaven UI (#540) - (8322c2d) - Matthew Runyon
- Use `useWidget` hook to load widgets (#502) - (d9d1e5e) - mofojed
#### Refactoring
- Cleanup js mappings for ui components + utils (#530) - (bbce797) - bmingles
#### Revert
- "revert: Revert some changes that are not compatible with v0.78 (#550)" (#551) - (3502f02) - mofojed

- - -

## ui-v0.16.0 - 2024-06-19
#### Documentation
- view (#506) - (e4b7137) - ethanalvizo
Expand Down
86 changes: 49 additions & 37 deletions plugins/ui/DESIGN.md

Large diffs are not rendered by default.

83 changes: 79 additions & 4 deletions plugins/ui/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,15 +348,15 @@ def ui_picker_table():
column_types,
label="Text",
on_change=set_value,
selected_keys=value,
selected_key=value,
)

text = ui.text(f"Selection: {value}")

return ui.flex(pick_table, text, direction="column", margin=10, gap=10)


pick_table = ui_picker_table()
my_picker_table = ui_picker_table()
```

![Use a picker to select from a table](_assets/pick_table.png)
Expand Down Expand Up @@ -391,19 +391,94 @@ def ui_picker_table_source():
ui.item_table_source(column_types, key_column="Id", label_column="Display"),
label="Text",
on_change=set_value,
selected_keys=value,
selected_key=value,
)

text = ui.text(f"Selection: {value}")

return ui.flex(pick_table, text, direction="column", margin=10, gap=10)


pick_table_source = ui_picker_table_source()
my_picker_table_source = ui_picker_table_source()
```

![Use a picker to select from a table source](_assets/pick_table_source.png)

## ComboBox (string values)

The `ui.combo_box` component can be used to select from a list of items. It also provides a search field to filter available results. Note that the search behavior differs slightly for different data types.
- Numeric types - only support exact match
- Text based data types - support partial search matching
- Date types support searching by different date parts (e.g. `2024`, `2024-01`, `2024-01-02`, `2024-01-02 00`, `2024-07-06 00:43`, `2024-07-06 00:43:14`, `2024-07-06 00:43:14.247`)

Here's a basic example for selecting from a list of string values and displaying the selected key in a text field.

```python
from deephaven import ui


@ui.component
def ui_combo_box():
value, set_value = ui.use_state("")

combo = ui.combo_box(
"Text 1",
"Text 2",
"Text 3",
label="Text",
on_selection_change=set_value,
selected_key=value,
)

text = ui.text("Selection: " + str(value))

return combo, text


my_combo_box = ui_combo_box()
```

## ComboBox (item table source)

A `combo_box` can also take an `item_table_source`. It will use the columns specified.

```python
import deephaven.ui as ui
from deephaven import time_table
import datetime

# Ticking table with initial row count of 200 that adds a row every second
initial_row_count = 200
_table = time_table(
"PT1S",
start_time=datetime.datetime.now() - datetime.timedelta(seconds=initial_row_count),
).update(
[
"Id=new Integer(i)",
"Display=new String(`Display `+i)",
]
)


@ui.component
def ui_combo_box_item_table_source(table):
value, set_value = ui.use_state("")

combo = ui.combo_box(
ui.item_table_source(table, key_column="Id", label_column="Display"),
label="Text",
on_change=set_value,
selected_key=value,
)

text = ui.text(f"Selection: {value}")

return combo, text


my_combo_box_item_table_source = ui_combo_box_item_table_source(_table)
```

## ListView (string values)

A list view that can be used to create a list of selectable 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
2 changes: 1 addition & 1 deletion plugins/ui/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = deephaven-plugin-ui
description = deephaven.ui plugin
long_description = file: README.md
long_description_content_type = text/markdown
version = 0.16.0.dev0
version = 0.17.0.dev0
url = https://github.com/deephaven/deephaven-plugins
project_urls =
Source Code = https://github.com/deephaven/deephaven-plugins
Expand Down
3 changes: 0 additions & 3 deletions plugins/ui/src/deephaven/ui/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from .action_menu import action_menu
from .basic import (
component_element,
icon_wrapper,
switch,
tab_list,
tab_panels,
Expand Down Expand Up @@ -47,7 +46,6 @@
from .text_field import text_field
from .toggle_button import toggle_button
from .view import view
from .types import *

from . import html

Expand All @@ -73,7 +71,6 @@
"grid",
"heading",
"icon",
"icon_wrapper",
"item",
"item_table_source",
"illustrated_message",
Expand Down
11 changes: 0 additions & 11 deletions plugins/ui/src/deephaven/ui/components/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ def component_element(name: str, /, *children: Any, **props: Any) -> BaseElement
return BaseElement(f"deephaven.ui.components.{name}", *children, **props)


def icon_wrapper(*children, **props):
"""
Python implementation for the Adobe React Spectrum Icon component.
Named icon_wrapper so as not to conflict with the Deephaven icon component.
TODO: This doesn't seem to work correctly. It throws an error saying `Cannot read properties of undefined (reading 'className')`.
https://react-spectrum.adobe.com/react-spectrum/Icon.html
https://github.com/deephaven/deephaven-plugins/issues/526
"""
return component_element("Icon", *children, **props)


def switch(*children, **props):
"""
Python implementation for the Adobe React Spectrum Switch component.
Expand Down
2 changes: 1 addition & 1 deletion plugins/ui/src/deephaven/ui/components/combo_box.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Callable
from typing import Callable, Any

from .types import (
FocusEventCallable,
Expand Down
23 changes: 19 additions & 4 deletions plugins/ui/src/deephaven/ui/components/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from ..elements import UITable
from ..types import (
CellPressCallback,
ColumnGroup,
ColumnName,
ColumnPressCallback,
QuickFilterExpression,
Expand All @@ -24,6 +25,11 @@ def table(
quick_filters: dict[ColumnName, QuickFilterExpression] | None = None,
show_quick_filters: bool = False,
show_search: bool = False,
front_columns: list[ColumnName] | None = None,
back_columns: list[ColumnName] | None = None,
frozen_columns: list[ColumnName] | None = None,
hidden_columns: list[ColumnName] | None = None,
column_groups: list[ColumnGroup] | None = None,
context_menu: (
ResolvableContextMenuItem | list[ResolvableContextMenuItem] | None
) = None,
Expand Down Expand Up @@ -53,12 +59,21 @@ def table(
quick_filters: The quick filters to apply to the table. Dictionary of column name to filter value.
show_quick_filters: Whether to show the quick filter bar by default.
show_search: Whether to show the search bar by default.
front_columns: The columns to pin to the front of the table. These will not be movable by the user.
back_columns: The columns to pin to the back of the table. These will not be movable by the user.
frozen_columns: The columns to freeze by default at the front of the table.
These will always be visible regardless of horizontal scrolling.
The user may unfreeze columns or freeze additional columns.
hidden_columns: The columns to hide by default. Users may show the columns by expanding them.
column_groups: Columns to group together by default. The groups will be shown in the table header.
Group names must be unique within the column and group names.
Groups may be nested by providing the group name as a child of another group.
context_menu: The context menu items to show when a cell is right clicked.
May contain action items or submenu items.
May also be a function that receives the cell data and returns the context menu items or None.
May contain action items or submenu items.
May also be a function that receives the cell data and returns the context menu items or None.
context_header_menu: The context menu items to show when a column header is right clicked.
May contain action items or submenu items.
May also be a function that receives the column header data and returns the context menu items or None.
May contain action items or submenu items.
May also be a function that receives the column header data and returns the context menu items or None.
"""
props = locals()
del props["table"]
Expand Down
32 changes: 29 additions & 3 deletions plugins/ui/src/deephaven/ui/types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
from deephaven import SortDirection
from deephaven.dtypes import DType

DeephavenColor = Literal["salmon", "lemonchiffon"]
HexColor = str
Color = Union[DeephavenColor, HexColor]


class CellData(TypedDict):
"""
Expand Down Expand Up @@ -61,6 +65,31 @@ class RowDataValue(CellData):
"""


class ColumnGroup(TypedDict):
"""
Group of columns in a table.
Groups are displayed in the table header.
Groups may be nested.
"""

name: str
"""
Name of the column group.
Must follow column naming rules and be unique within the column and group names.
"""

children: List[str]
"""
List of child columns or groups in the group.
Names are other columns or groups.
"""

color: Color
"""
Color for the group header.
"""


class ContextMenuActionParams(TypedDict):
"""
Parameters given to a context menu action
Expand Down Expand Up @@ -199,9 +228,6 @@ class SliderChange(TypedDict):
"UNIQUE",
"SKIP",
]
DeephavenColor = Literal["salmon", "lemonchiffon"]
HexColor = str
Color = Union[DeephavenColor, HexColor]
ContextMenuModeOption = Literal["CELL", "ROW_HEADER", "COLUMN_HEADER"]
ContextMenuMode = Union[ContextMenuModeOption, List[ContextMenuModeOption], None]
DataBarAxis = Literal["PROPORTIONAL", "MIDDLE", "DIRECTIONAL"]
Expand Down
Loading

0 comments on commit 7a5143f

Please sign in to comment.