Commit cb13c60
feat: ListView + Picker - Item icon support (#1959)
This example shows both basic and table data sources.
```python
import deephaven.ui as ui
@ui.component
def ui_list_view():
value, set_value = ui.use_state(["Text 2"])
text = ui.text("Selection: " + ", ".join(map(str, value)), grid_column="span 2")
# list_view with text children
lv = ui.list_view(
"Text 1",
"Text 2",
"Text 3",
# min_height=1,
aria_label="List View",
on_change=set_value,
selected_keys=value,
)
# list_view with item children
lv2 = ui.list_view(
ui.item("Item 1", key="Text 1"),
ui.item("Item 2", key="Text 2"),
ui.item("Item 3", key="Text 3"),
aria_label="List View 2",
on_change=set_value,
selected_keys=value,
)
return ui.grid(
text,
lv,
lv2,
columns="repeat(2, 1fr)",
rows="min-content",
height="100%"
)
lv = ui_list_view()
####################################
import deephaven.ui as ui
from deephaven import time_table
import datetime
icon_names = ['vsAccount']
# Ticking table with initial row count of 200 that adds a row every second
initial_row_count=2000
columns = [
"Id=new Integer(i)",
"Display=new String(`Display `+i)",
"Description=new String(`Description `+i)",
"Icon=(String) icon_names[0]"
]
# column_types_ticking = time_table("PT1S", start_time=datetime.datetime.now() - datetime.timedelta(seconds=initial_row_count)).update([
# columns
# )
column_types = empty_table(initial_row_count).update(columns)
@ui.component
def labeled_lv(label, *args, **kwargs):
return ui.flex(
ui.text(label),
ui.list_view(
*args,
**kwargs
),
direction="column",
flex=1,
min_width=0,
)
@ui.component
def ui_list_view_table():
value, set_value = ui.use_state([2, 4, 5])
lv = labeled_lv(
"Compact",
column_types,
max_height=5000,
density="compact",
key_column="Id",
label_column="Display",
icon_column="Icon",
aria_label="List View",
on_change=set_value,
selected_keys=value,
)
lv2 = labeled_lv(
"Regular",
column_types,
max_height=5000,
density="regular",
key_column="Id",
label_column="Display",
icon_column="Icon",
aria_label="List View 2",
on_change=set_value,
selected_keys=value,
)
lv3 = labeled_lv(
"Spacious",
column_types,
max_height=5000,
density="spacious",
key_column="Id",
label_column="Display",
icon_column="Icon",
aria_label="List View 3",
on_change=set_value,
selected_keys=value,
)
text = ui.text("Selection: " + ", ".join(map(str, value)))
return ui.flex(
ui.flex(
lv,
lv2,
lv3,
direction="row",
gap=10,
),
text,
direction="column",
)
lv_table = ui_list_view_table()
```
resolves #1890
---------
Co-authored-by: Don McKenzie <donmckenzie@deephaven.io>1 parent fb63be1 commit cb13c60
33 files changed
Lines changed: 1368 additions & 564 deletions
File tree
- packages
- code-studio/src/styleguide
- __snapshots__
- components/src/spectrum
- listView
- picker
- utils
- jsapi-components/src/spectrum
- utils
- utils/src
- tests
- styleguide.spec.ts-snapshots
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
9 | 18 | | |
10 | 19 | | |
11 | | - | |
| 20 | + | |
12 | 21 | | |
13 | 22 | | |
14 | 23 | | |
15 | | - | |
| 24 | + | |
16 | 25 | | |
17 | 26 | | |
18 | 27 | | |
| |||
25 | 34 | | |
26 | 35 | | |
27 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
28 | 70 | | |
| 71 | + | |
29 | 72 | | |
30 | 73 | | |
31 | 74 | | |
32 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
33 | 94 | | |
34 | 95 | | |
35 | 96 | | |
| |||
39 | 100 | | |
40 | 101 | | |
41 | 102 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
86 | 113 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
115 | 125 | | |
116 | | - | |
117 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
118 | 225 | | |
119 | 226 | | |
120 | 227 | | |
| |||
0 commit comments