Skip to content

Commit

Permalink
selection mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jnumainville committed Apr 16, 2024
1 parent 3547694 commit 848d15a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
19 changes: 10 additions & 9 deletions plugins/ui/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,7 @@ Supported `ItemTableSource` arguments are `key_column`, `label_column`, `descrip
import deephaven.ui as ui
ui.list_view(
*children: Item | Table | ItemTableSource,
selection_mode: SelectionMode | None = 'MULTIPLE',
default_selected_keys: Selection | None = None,
selected_keys: Selection | None = None,
render_empty_state: Element | None = None,
Expand All @@ -1286,14 +1287,15 @@ ui.list_view(
```

###### Parameters
| Parameter | Type | Description |
|-------------------------|-----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `*children` | `Item \| Table \| ItemTableSource` | The options to render within the list_view. |
| `default_selected_keys` | `Selection \| None` | The initial selected keys in the collection (uncontrolled). |
| `selected_keys` | `Selection \| None` | The currently selected keys in the collection (controlled). |
| `render_empty_state` | `Element \| None` | Sets what the `list_view` should render when there is no content to display. |
| `on_selection_change` | `Callable[[Selection], None] \| None` | Handler that is called when the selections changes. |
| `on_change` | `Callable[[Selection], None] \| None` | Alias of `on_selection_change`. Handler that is called when the selections changes. |
| Parameter | Type | Description |
|-------------------------|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `*children` | `Item \| Table \| ItemTableSource` | The options to render within the list_view. |
| `selection_mode` | `SelectionMode \| None` | Can be `MULTIPLE` to allow multiple selection, `SINGLE` to allow only single selection, or None to allow no selection. |
| `default_selected_keys` | `Selection \| None` | The initial selected keys in the collection (uncontrolled). |
| `selected_keys` | `Selection \| None` | The currently selected keys in the collection (controlled). |
| `render_empty_state` | `Element \| None` | Sets what the `list_view` should render when there is no content to display. |
| `on_selection_change` | `Callable[[Selection], None] \| None` | Handler that is called when the selections changes. |
| `on_change` | `Callable[[Selection], None] \| None` | Alias of `on_selection_change`. Handler that is called when the selections changes. |
| `**props` | `Any` | Any other [ListView](https://react-spectrum.adobe.com/react-spectrum/ListView.html) prop, with the exception of `items`, `dragAndDropHooks`, and `onLoadMore`. |


Expand Down Expand Up @@ -1366,7 +1368,6 @@ source = ui.item_table_source(
label_column="Labels",
description_column="Descriptions",
icon_column="Icons",
title_column="SectionLabels",
actions=button
)
list_view5 = ui.list_view(
Expand Down
6 changes: 5 additions & 1 deletion plugins/ui/src/deephaven/ui/components/list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .item_table_source import ItemTableSource
from ..elements import BaseElement, Element
from .._internal.utils import create_props
from ..types import Stringable, Selection
from ..types import Stringable, Selection, SelectionMode

ListViewItem = Union[Stringable, ItemElement]
ListViewElement = Element
Expand All @@ -18,6 +18,7 @@ def list_view(
*children: ListViewItem | Table | ItemTableSource,
default_selected_keys: Selection | None = None,
selected_keys: Selection | None = None,
selection_mode: SelectionMode | None = "MULTIPLE",
render_empty_state: Element | None = None,
on_selection_change: Callable[[Selection], None] | None = None,
on_change: Callable[[Selection], None] | None = None,
Expand All @@ -40,6 +41,9 @@ def list_view(
The initial selected keys in the collection (uncontrolled).
selected_keys:
The currently selected keys in the collection (controlled).
selection_mode:
Can be `MULTIPLE` to allow multiple selection, `SINGLE` to allow only single selection,
or None to allow no selection.
render_empty_state:
Sets what the `list_view` should render when there is no content to display.
on_selection_change:
Expand Down
3 changes: 2 additions & 1 deletion plugins/ui/src/deephaven/ui/types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class RowDataValue(CellData):
ColumnData = List[Any]
TableData = Dict[ColumnName, ColumnData]
SearchMode = Literal["SHOW", "HIDE", "DEFAULT"]
SelectionMode = Literal["CELL", "ROW", "COLUMN"]
SelectionArea = Literal["CELL", "ROW", "COLUMN"]
SelectionMode = Literal["SINGLE", "MULTIPLE"]
Sentinel = Any
TransformedData = Any
StringSortDirection = Literal["ASC", "DESC"]
Expand Down

0 comments on commit 848d15a

Please sign in to comment.