h2o-lightwave 1.7.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- h2o_lightwave/__init__.py +30 -0
- h2o_lightwave/core.py +508 -0
- h2o_lightwave/graphics.py +841 -0
- h2o_lightwave/py.typed +0 -0
- h2o_lightwave/routing.py +249 -0
- h2o_lightwave/server.py +109 -0
- h2o_lightwave/types.py +14098 -0
- h2o_lightwave/ui.py +4978 -0
- h2o_lightwave/ui_ext.py +52 -0
- h2o_lightwave/version.py +1 -0
- h2o_lightwave-1.7.6.dist-info/METADATA +172 -0
- h2o_lightwave-1.7.6.dist-info/RECORD +14 -0
- h2o_lightwave-1.7.6.dist-info/WHEEL +4 -0
- h2o_lightwave-1.7.6.dist-info/licenses/LICENSE +1 -0
h2o_lightwave/ui.py
ADDED
|
@@ -0,0 +1,4978 @@
|
|
|
1
|
+
#
|
|
2
|
+
# THIS FILE IS GENERATED; DO NOT EDIT
|
|
3
|
+
#
|
|
4
|
+
|
|
5
|
+
# Copyright 2020 H2O.ai, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
|
|
19
|
+
import warnings
|
|
20
|
+
from .types import *
|
|
21
|
+
from .ui_ext import *
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def text(
|
|
25
|
+
content: str,
|
|
26
|
+
size: Optional[str] = None,
|
|
27
|
+
width: Optional[str] = None,
|
|
28
|
+
visible: Optional[bool] = None,
|
|
29
|
+
align: Optional[str] = None,
|
|
30
|
+
tooltip: Optional[str] = None,
|
|
31
|
+
name: Optional[str] = None,
|
|
32
|
+
) -> Component:
|
|
33
|
+
"""Create text content.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
content: The text content.
|
|
37
|
+
size: The font size of the text content. One of 'xl', 'l', 'm', 's', 'xs'. See enum h2o_wave.ui.TextSize.
|
|
38
|
+
width: The width of the text , e.g. '100px'.
|
|
39
|
+
visible: True if the component should be visible. Defaults to True.
|
|
40
|
+
align: The alignment of the text content. Defaults to 'start'. One of 'start', 'end', 'center', 'justify'. See enum h2o_wave.ui.TextAlign.
|
|
41
|
+
tooltip: Tooltip message.
|
|
42
|
+
name: An identifying name for this component.
|
|
43
|
+
Returns:
|
|
44
|
+
A `h2o_wave.types.Text` instance.
|
|
45
|
+
"""
|
|
46
|
+
return Component(text=Text(
|
|
47
|
+
content,
|
|
48
|
+
size,
|
|
49
|
+
width,
|
|
50
|
+
visible,
|
|
51
|
+
align,
|
|
52
|
+
tooltip,
|
|
53
|
+
name,
|
|
54
|
+
))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def command(
|
|
58
|
+
name: str,
|
|
59
|
+
label: Optional[str] = None,
|
|
60
|
+
caption: Optional[str] = None,
|
|
61
|
+
icon: Optional[str] = None,
|
|
62
|
+
items: Optional[List[Command]] = None,
|
|
63
|
+
value: Optional[str] = None,
|
|
64
|
+
path: Optional[str] = None,
|
|
65
|
+
download: Optional[bool] = None,
|
|
66
|
+
) -> Command:
|
|
67
|
+
"""Create a command.
|
|
68
|
+
|
|
69
|
+
Commands are typically displayed as context menu items or toolbar button.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
name: An identifying name for this component. If the name is prefixed with a '#', the command sets the location hash to the name when executed.
|
|
73
|
+
label: The text displayed for this command.
|
|
74
|
+
caption: The caption for this command (typically a tooltip).
|
|
75
|
+
icon: The icon to be displayed for this command.
|
|
76
|
+
items: Sub-commands, if any
|
|
77
|
+
value: Data associated with this command, if any.
|
|
78
|
+
path: The path or URL to link to. The 'items' and 'value' props are ignored when specified.
|
|
79
|
+
download: True if the link should prompt the user to save the linked URL instead of navigating to it.
|
|
80
|
+
Returns:
|
|
81
|
+
A `h2o_wave.types.Command` instance.
|
|
82
|
+
"""
|
|
83
|
+
return Command(
|
|
84
|
+
name,
|
|
85
|
+
label,
|
|
86
|
+
caption,
|
|
87
|
+
icon,
|
|
88
|
+
items,
|
|
89
|
+
value,
|
|
90
|
+
path,
|
|
91
|
+
download,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def text_xl(
|
|
96
|
+
content: str,
|
|
97
|
+
width: Optional[str] = None,
|
|
98
|
+
visible: Optional[bool] = None,
|
|
99
|
+
align: Optional[str] = None,
|
|
100
|
+
tooltip: Optional[str] = None,
|
|
101
|
+
commands: Optional[List[Command]] = None,
|
|
102
|
+
name: Optional[str] = None,
|
|
103
|
+
) -> Component:
|
|
104
|
+
"""Create extra-large sized text content.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
content: The text content.
|
|
108
|
+
width: The width of the text , e.g. '100px'.
|
|
109
|
+
visible: True if the component should be visible. Defaults to True.
|
|
110
|
+
align: The alignment of the text content. Defaults to 'start'. One of 'start', 'end', 'center', 'justify'. See enum h2o_wave.ui.TextXlAlign.
|
|
111
|
+
tooltip: Tooltip message.
|
|
112
|
+
commands: Contextual menu commands for this component.
|
|
113
|
+
name: An identifying name for this component.
|
|
114
|
+
Returns:
|
|
115
|
+
A `h2o_wave.types.TextXl` instance.
|
|
116
|
+
"""
|
|
117
|
+
return Component(text_xl=TextXl(
|
|
118
|
+
content,
|
|
119
|
+
width,
|
|
120
|
+
visible,
|
|
121
|
+
align,
|
|
122
|
+
tooltip,
|
|
123
|
+
commands,
|
|
124
|
+
name,
|
|
125
|
+
))
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def text_l(
|
|
129
|
+
content: str,
|
|
130
|
+
width: Optional[str] = None,
|
|
131
|
+
visible: Optional[bool] = None,
|
|
132
|
+
align: Optional[str] = None,
|
|
133
|
+
tooltip: Optional[str] = None,
|
|
134
|
+
commands: Optional[List[Command]] = None,
|
|
135
|
+
name: Optional[str] = None,
|
|
136
|
+
) -> Component:
|
|
137
|
+
"""Create large sized text content.
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
content: The text content.
|
|
141
|
+
width: The width of the text , e.g. '100px'.
|
|
142
|
+
visible: True if the component should be visible. Defaults to True.
|
|
143
|
+
align: The alignment of the text content. Defaults to 'start'. One of 'start', 'end', 'center', 'justify'. See enum h2o_wave.ui.TextLAlign.
|
|
144
|
+
tooltip: Tooltip message.
|
|
145
|
+
commands: Contextual menu commands for this component.
|
|
146
|
+
name: An identifying name for this component.
|
|
147
|
+
Returns:
|
|
148
|
+
A `h2o_wave.types.TextL` instance.
|
|
149
|
+
"""
|
|
150
|
+
return Component(text_l=TextL(
|
|
151
|
+
content,
|
|
152
|
+
width,
|
|
153
|
+
visible,
|
|
154
|
+
align,
|
|
155
|
+
tooltip,
|
|
156
|
+
commands,
|
|
157
|
+
name,
|
|
158
|
+
))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def text_m(
|
|
162
|
+
content: str,
|
|
163
|
+
width: Optional[str] = None,
|
|
164
|
+
visible: Optional[bool] = None,
|
|
165
|
+
align: Optional[str] = None,
|
|
166
|
+
tooltip: Optional[str] = None,
|
|
167
|
+
name: Optional[str] = None,
|
|
168
|
+
) -> Component:
|
|
169
|
+
"""Create medium sized text content.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
content: The text content.
|
|
173
|
+
width: The width of the text , e.g. '100px'.
|
|
174
|
+
visible: True if the component should be visible. Defaults to True.
|
|
175
|
+
align: The alignment of the text content. Defaults to 'start'. One of 'start', 'end', 'center', 'justify'. See enum h2o_wave.ui.TextMAlign.
|
|
176
|
+
tooltip: Tooltip message.
|
|
177
|
+
name: An identifying name for this component.
|
|
178
|
+
Returns:
|
|
179
|
+
A `h2o_wave.types.TextM` instance.
|
|
180
|
+
"""
|
|
181
|
+
return Component(text_m=TextM(
|
|
182
|
+
content,
|
|
183
|
+
width,
|
|
184
|
+
visible,
|
|
185
|
+
align,
|
|
186
|
+
tooltip,
|
|
187
|
+
name,
|
|
188
|
+
))
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def text_s(
|
|
192
|
+
content: str,
|
|
193
|
+
width: Optional[str] = None,
|
|
194
|
+
visible: Optional[bool] = None,
|
|
195
|
+
align: Optional[str] = None,
|
|
196
|
+
tooltip: Optional[str] = None,
|
|
197
|
+
name: Optional[str] = None,
|
|
198
|
+
) -> Component:
|
|
199
|
+
"""Create small sized text content.
|
|
200
|
+
|
|
201
|
+
Args:
|
|
202
|
+
content: The text content.
|
|
203
|
+
width: The width of the text , e.g. '100px'.
|
|
204
|
+
visible: True if the component should be visible. Defaults to True.
|
|
205
|
+
align: The alignment of the text content. Defaults to 'start'. One of 'start', 'end', 'center', 'justify'. See enum h2o_wave.ui.TextSAlign.
|
|
206
|
+
tooltip: Tooltip message.
|
|
207
|
+
name: An identifying name for this component.
|
|
208
|
+
Returns:
|
|
209
|
+
A `h2o_wave.types.TextS` instance.
|
|
210
|
+
"""
|
|
211
|
+
return Component(text_s=TextS(
|
|
212
|
+
content,
|
|
213
|
+
width,
|
|
214
|
+
visible,
|
|
215
|
+
align,
|
|
216
|
+
tooltip,
|
|
217
|
+
name,
|
|
218
|
+
))
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def text_xs(
|
|
222
|
+
content: str,
|
|
223
|
+
width: Optional[str] = None,
|
|
224
|
+
visible: Optional[bool] = None,
|
|
225
|
+
align: Optional[str] = None,
|
|
226
|
+
tooltip: Optional[str] = None,
|
|
227
|
+
name: Optional[str] = None,
|
|
228
|
+
) -> Component:
|
|
229
|
+
"""Create extra-small sized text content.
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
content: The text content.
|
|
233
|
+
width: The width of the text , e.g. '100px'.
|
|
234
|
+
visible: True if the component should be visible. Defaults to True.
|
|
235
|
+
align: The alignment of the text content. Defaults to 'start'. One of 'start', 'end', 'center', 'justify'. See enum h2o_wave.ui.TextXsAlign.
|
|
236
|
+
tooltip: Tooltip message.
|
|
237
|
+
name: An identifying name for this component.
|
|
238
|
+
Returns:
|
|
239
|
+
A `h2o_wave.types.TextXs` instance.
|
|
240
|
+
"""
|
|
241
|
+
return Component(text_xs=TextXs(
|
|
242
|
+
content,
|
|
243
|
+
width,
|
|
244
|
+
visible,
|
|
245
|
+
align,
|
|
246
|
+
tooltip,
|
|
247
|
+
name,
|
|
248
|
+
))
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def label(
|
|
252
|
+
label: str,
|
|
253
|
+
required: Optional[bool] = None,
|
|
254
|
+
disabled: Optional[bool] = None,
|
|
255
|
+
width: Optional[str] = None,
|
|
256
|
+
visible: Optional[bool] = None,
|
|
257
|
+
tooltip: Optional[str] = None,
|
|
258
|
+
name: Optional[str] = None,
|
|
259
|
+
) -> Component:
|
|
260
|
+
"""Create a label.
|
|
261
|
+
|
|
262
|
+
Labels give a name or title to a component or group of components.
|
|
263
|
+
Labels should be in close proximity to the component or group they are paired with.
|
|
264
|
+
Some components, such as textboxes, dropdowns, or toggles, already have labels
|
|
265
|
+
incorporated, but other components may optionally add a Label if it helps inform
|
|
266
|
+
the user of the component’s purpose.
|
|
267
|
+
|
|
268
|
+
Args:
|
|
269
|
+
label: The text displayed on the label.
|
|
270
|
+
required: True if the field is required.
|
|
271
|
+
disabled: True if the label should be disabled.
|
|
272
|
+
width: The width of the label , e.g. '100px'.
|
|
273
|
+
visible: True if the component should be visible. Defaults to True.
|
|
274
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
275
|
+
name: An identifying name for this component.
|
|
276
|
+
Returns:
|
|
277
|
+
A `h2o_wave.types.Label` instance.
|
|
278
|
+
"""
|
|
279
|
+
return Component(label=Label(
|
|
280
|
+
label,
|
|
281
|
+
required,
|
|
282
|
+
disabled,
|
|
283
|
+
width,
|
|
284
|
+
visible,
|
|
285
|
+
tooltip,
|
|
286
|
+
name,
|
|
287
|
+
))
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def separator(
|
|
291
|
+
label: Optional[str] = None,
|
|
292
|
+
name: Optional[str] = None,
|
|
293
|
+
width: Optional[str] = None,
|
|
294
|
+
visible: Optional[bool] = None,
|
|
295
|
+
) -> Component:
|
|
296
|
+
"""Create a separator.
|
|
297
|
+
|
|
298
|
+
A separator visually separates content into groups.
|
|
299
|
+
|
|
300
|
+
Args:
|
|
301
|
+
label: The text displayed on the separator.
|
|
302
|
+
name: An identifying name for this component.
|
|
303
|
+
width: The width of the separator , e.g. '100px'. Defaults to '100%'.
|
|
304
|
+
visible: True if the component should be visible. Defaults to True.
|
|
305
|
+
Returns:
|
|
306
|
+
A `h2o_wave.types.Separator` instance.
|
|
307
|
+
"""
|
|
308
|
+
return Component(separator=Separator(
|
|
309
|
+
label,
|
|
310
|
+
name,
|
|
311
|
+
width,
|
|
312
|
+
visible,
|
|
313
|
+
))
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
def progress(
|
|
317
|
+
label: str,
|
|
318
|
+
caption: Optional[str] = None,
|
|
319
|
+
value: Optional[float] = None,
|
|
320
|
+
width: Optional[str] = None,
|
|
321
|
+
visible: Optional[bool] = None,
|
|
322
|
+
tooltip: Optional[str] = None,
|
|
323
|
+
name: Optional[str] = None,
|
|
324
|
+
type: Optional[str] = None,
|
|
325
|
+
) -> Component:
|
|
326
|
+
"""Create a progress bar.
|
|
327
|
+
|
|
328
|
+
Progress bars are used to show the completion status of an operation lasting more than 2 seconds.
|
|
329
|
+
If the state of progress cannot be determined, do not set a value.
|
|
330
|
+
Progress bars feature a bar showing total units to completion, and total units finished.
|
|
331
|
+
The label appears above the bar, and the caption appears below.
|
|
332
|
+
The label should tell someone exactly what the operation is doing.
|
|
333
|
+
|
|
334
|
+
Examples of formatting include:
|
|
335
|
+
[Object] is being [operation name], or
|
|
336
|
+
[Object] is being [operation name] to [destination name] or
|
|
337
|
+
[Object] is being [operation name] from [source name] to [destination name]
|
|
338
|
+
|
|
339
|
+
Status text is generally in units elapsed and total units.
|
|
340
|
+
Real-world examples include copying files to a storage location, saving edits to a file, and more.
|
|
341
|
+
Use units that are informative and relevant to give the best idea to users of how long the operation will take to complete.
|
|
342
|
+
Avoid time units as they are rarely accurate enough to be trustworthy.
|
|
343
|
+
Also, combine steps of a complex operation into one total bar to avoid “rewinding” the bar.
|
|
344
|
+
Instead change the label to reflect the change if necessary. Bars moving backwards reduce confidence in the service.
|
|
345
|
+
|
|
346
|
+
Args:
|
|
347
|
+
label: The text displayed above the bar or right to the spinner.
|
|
348
|
+
caption: The text displayed below the bar or spinner.
|
|
349
|
+
value: The progress, between 0.0 and 1.0, or -1 (default) if indeterminate.
|
|
350
|
+
width: The width of the separator, e.g. '100px'. Defaults to '100%'.
|
|
351
|
+
visible: True if the component should be visible. Defaults to True.
|
|
352
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
353
|
+
name: An identifying name for this component.
|
|
354
|
+
type: The type of progress bar to be displayed. One of 'bar', 'spinner'. Defaults to 'bar'. One of 'bar', 'spinner'. See enum h2o_wave.ui.ProgressType.
|
|
355
|
+
Returns:
|
|
356
|
+
A `h2o_wave.types.Progress` instance.
|
|
357
|
+
"""
|
|
358
|
+
return Component(progress=Progress(
|
|
359
|
+
label,
|
|
360
|
+
caption,
|
|
361
|
+
value,
|
|
362
|
+
width,
|
|
363
|
+
visible,
|
|
364
|
+
tooltip,
|
|
365
|
+
name,
|
|
366
|
+
type,
|
|
367
|
+
))
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
def message_bar(
|
|
371
|
+
type: Optional[str] = None,
|
|
372
|
+
text: Optional[str] = None,
|
|
373
|
+
name: Optional[str] = None,
|
|
374
|
+
width: Optional[str] = None,
|
|
375
|
+
visible: Optional[bool] = None,
|
|
376
|
+
buttons: Optional[List[Component]] = None,
|
|
377
|
+
) -> Component:
|
|
378
|
+
"""Create a message bar.
|
|
379
|
+
|
|
380
|
+
A message bar is an area at the top of a primary view that displays relevant status information.
|
|
381
|
+
You can use a message bar to tell the user about a situation that does not require their immediate attention and
|
|
382
|
+
therefore does not need to block other activities.
|
|
383
|
+
|
|
384
|
+
Args:
|
|
385
|
+
type: The icon and color of the message bar. One of 'info', 'error', 'warning', 'success', 'danger', 'blocked'. See enum h2o_wave.ui.MessageBarType.
|
|
386
|
+
text: The text displayed on the message bar.
|
|
387
|
+
name: An identifying name for this component.
|
|
388
|
+
width: The width of the message bar, e.g. '100px'. Defaults to '100%'.
|
|
389
|
+
visible: True if the component should be visible. Defaults to True.
|
|
390
|
+
buttons: Specify one or more action buttons.
|
|
391
|
+
Returns:
|
|
392
|
+
A `h2o_wave.types.MessageBar` instance.
|
|
393
|
+
"""
|
|
394
|
+
return Component(message_bar=MessageBar(
|
|
395
|
+
type,
|
|
396
|
+
text,
|
|
397
|
+
name,
|
|
398
|
+
width,
|
|
399
|
+
visible,
|
|
400
|
+
buttons,
|
|
401
|
+
))
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def textbox(
|
|
405
|
+
name: str,
|
|
406
|
+
label: Optional[str] = None,
|
|
407
|
+
placeholder: Optional[str] = None,
|
|
408
|
+
value: Optional[str] = None,
|
|
409
|
+
mask: Optional[str] = None,
|
|
410
|
+
icon: Optional[str] = None,
|
|
411
|
+
prefix: Optional[str] = None,
|
|
412
|
+
suffix: Optional[str] = None,
|
|
413
|
+
error: Optional[str] = None,
|
|
414
|
+
required: Optional[bool] = None,
|
|
415
|
+
disabled: Optional[bool] = None,
|
|
416
|
+
readonly: Optional[bool] = None,
|
|
417
|
+
multiline: Optional[bool] = None,
|
|
418
|
+
password: Optional[bool] = None,
|
|
419
|
+
trigger: Optional[bool] = None,
|
|
420
|
+
height: Optional[str] = None,
|
|
421
|
+
width: Optional[str] = None,
|
|
422
|
+
visible: Optional[bool] = None,
|
|
423
|
+
tooltip: Optional[str] = None,
|
|
424
|
+
spellcheck: Optional[bool] = None,
|
|
425
|
+
type: Optional[str] = None,
|
|
426
|
+
) -> Component:
|
|
427
|
+
"""Create a text box.
|
|
428
|
+
|
|
429
|
+
The text box component enables a user to type text into an app.
|
|
430
|
+
It's typically used to capture a single line of text, but can be configured to capture multiple lines of text.
|
|
431
|
+
The text displays on the screen in a simple, uniform format.
|
|
432
|
+
|
|
433
|
+
Args:
|
|
434
|
+
name: An identifying name for this component.
|
|
435
|
+
label: The text displayed above the field.
|
|
436
|
+
placeholder: A string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message.
|
|
437
|
+
value: Text to be displayed inside the text box.
|
|
438
|
+
mask: The masking string that defines the mask's behavior. A backslash will escape any character. Special format characters are: '9': [0-9] 'a': [a-zA-Z] '*': [a-zA-Z0-9].
|
|
439
|
+
icon: Icon displayed in the far right end of the text field.
|
|
440
|
+
prefix: Text to be displayed before the text box contents.
|
|
441
|
+
suffix: Text to be displayed after the text box contents.
|
|
442
|
+
error: Text to be displayed as an error below the text box.
|
|
443
|
+
required: True if the text box is a required field.
|
|
444
|
+
disabled: True if the text box is disabled.
|
|
445
|
+
readonly: True if the text box is a read-only field.
|
|
446
|
+
multiline: True if the text box should allow multi-line text entry.
|
|
447
|
+
password: True if the text box should hide text content.
|
|
448
|
+
trigger: True if the form should be submitted when the text value changes.
|
|
449
|
+
height: The height of the text box, e.g. '100px'. Percentage values not supported. Applicable only if `multiline` is true.
|
|
450
|
+
width: The width of the text box, e.g. '100px'. Defaults to '100%'.
|
|
451
|
+
visible: True if the component should be visible. Defaults to True.
|
|
452
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
453
|
+
spellcheck: True if the text may be checked for spelling errors. Defaults to True.
|
|
454
|
+
type: Keyboard to be shown on mobile devices. Defaults to 'text'. One of 'text', 'number', 'tel'. See enum h2o_wave.ui.TextboxType.
|
|
455
|
+
Returns:
|
|
456
|
+
A `h2o_wave.types.Textbox` instance.
|
|
457
|
+
"""
|
|
458
|
+
return Component(textbox=Textbox(
|
|
459
|
+
name,
|
|
460
|
+
label,
|
|
461
|
+
placeholder,
|
|
462
|
+
value,
|
|
463
|
+
mask,
|
|
464
|
+
icon,
|
|
465
|
+
prefix,
|
|
466
|
+
suffix,
|
|
467
|
+
error,
|
|
468
|
+
required,
|
|
469
|
+
disabled,
|
|
470
|
+
readonly,
|
|
471
|
+
multiline,
|
|
472
|
+
password,
|
|
473
|
+
trigger,
|
|
474
|
+
height,
|
|
475
|
+
width,
|
|
476
|
+
visible,
|
|
477
|
+
tooltip,
|
|
478
|
+
spellcheck,
|
|
479
|
+
type,
|
|
480
|
+
))
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
def checkbox(
|
|
484
|
+
name: str,
|
|
485
|
+
label: Optional[str] = None,
|
|
486
|
+
value: Optional[bool] = None,
|
|
487
|
+
indeterminate: Optional[bool] = None,
|
|
488
|
+
disabled: Optional[bool] = None,
|
|
489
|
+
trigger: Optional[bool] = None,
|
|
490
|
+
width: Optional[str] = None,
|
|
491
|
+
visible: Optional[bool] = None,
|
|
492
|
+
tooltip: Optional[str] = None,
|
|
493
|
+
) -> Component:
|
|
494
|
+
"""Create a checkbox.
|
|
495
|
+
|
|
496
|
+
A checkbox allows users to switch between two mutually exclusive options (checked or unchecked, on or off) through
|
|
497
|
+
a single click or tap. It can also be used to indicate a subordinate setting or preference when paired with another
|
|
498
|
+
component.
|
|
499
|
+
|
|
500
|
+
A checkbox is used to select or deselect action items. It can be used for a single item or for a list of multiple
|
|
501
|
+
items that a user can choose from. The component has two selection states: unselected and selected.
|
|
502
|
+
|
|
503
|
+
For a binary choice, the main difference between a checkbox and a toggle switch is that the checkbox is for status
|
|
504
|
+
and the toggle switch is for action.
|
|
505
|
+
|
|
506
|
+
Use multiple checkboxes for multi-select scenarios in which a user chooses one or more items from a group of
|
|
507
|
+
choices that are not mutually exclusive.
|
|
508
|
+
|
|
509
|
+
Args:
|
|
510
|
+
name: An identifying name for this component.
|
|
511
|
+
label: Text to be displayed alongside the checkbox.
|
|
512
|
+
value: True if selected, False if unselected.
|
|
513
|
+
indeterminate: True if the selection is indeterminate (neither selected nor unselected).
|
|
514
|
+
disabled: True if the checkbox is disabled.
|
|
515
|
+
trigger: True if the form should be submitted when the checkbox value changes.
|
|
516
|
+
width: The width of the checkbox, e.g. '100px'.
|
|
517
|
+
visible: True if the component should be visible. Defaults to True.
|
|
518
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
519
|
+
Returns:
|
|
520
|
+
A `h2o_wave.types.Checkbox` instance.
|
|
521
|
+
"""
|
|
522
|
+
return Component(checkbox=Checkbox(
|
|
523
|
+
name,
|
|
524
|
+
label,
|
|
525
|
+
value,
|
|
526
|
+
indeterminate,
|
|
527
|
+
disabled,
|
|
528
|
+
trigger,
|
|
529
|
+
width,
|
|
530
|
+
visible,
|
|
531
|
+
tooltip,
|
|
532
|
+
))
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
def toggle(
|
|
536
|
+
name: str,
|
|
537
|
+
label: Optional[str] = None,
|
|
538
|
+
value: Optional[bool] = None,
|
|
539
|
+
disabled: Optional[bool] = None,
|
|
540
|
+
trigger: Optional[bool] = None,
|
|
541
|
+
width: Optional[str] = None,
|
|
542
|
+
visible: Optional[bool] = None,
|
|
543
|
+
tooltip: Optional[str] = None,
|
|
544
|
+
) -> Component:
|
|
545
|
+
"""Create a toggle.
|
|
546
|
+
Toggles represent a physical switch that allows users to turn things on or off.
|
|
547
|
+
Use toggles to present users with two mutually exclusive options (like on/off), where choosing an option results
|
|
548
|
+
in an immediate action.
|
|
549
|
+
|
|
550
|
+
Use a toggle for binary operations that take effect right after the user flips the Toggle.
|
|
551
|
+
For example, use a Toggle to turn services or hardware components on or off.
|
|
552
|
+
In other words, if a physical switch would work for the action, a Toggle is probably the best component to use.
|
|
553
|
+
|
|
554
|
+
Args:
|
|
555
|
+
name: An identifying name for this component.
|
|
556
|
+
label: Text to be displayed alongside the component.
|
|
557
|
+
value: True if selected, False if unselected.
|
|
558
|
+
disabled: True if the checkbox is disabled.
|
|
559
|
+
trigger: True if the form should be submitted when the toggle value changes.
|
|
560
|
+
width: The width of the toggle, e.g. '100px'.
|
|
561
|
+
visible: True if the component should be visible. Defaults to True.
|
|
562
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
563
|
+
Returns:
|
|
564
|
+
A `h2o_wave.types.Toggle` instance.
|
|
565
|
+
"""
|
|
566
|
+
return Component(toggle=Toggle(
|
|
567
|
+
name,
|
|
568
|
+
label,
|
|
569
|
+
value,
|
|
570
|
+
disabled,
|
|
571
|
+
trigger,
|
|
572
|
+
width,
|
|
573
|
+
visible,
|
|
574
|
+
tooltip,
|
|
575
|
+
))
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
def choice(
|
|
579
|
+
name: str,
|
|
580
|
+
label: Optional[str] = None,
|
|
581
|
+
disabled: Optional[bool] = None,
|
|
582
|
+
) -> Choice:
|
|
583
|
+
"""Create a choice for a checklist, choice group or dropdown.
|
|
584
|
+
|
|
585
|
+
Args:
|
|
586
|
+
name: An identifying name for this component.
|
|
587
|
+
label: Text to be displayed alongside the component.
|
|
588
|
+
disabled: True if the checkbox is disabled.
|
|
589
|
+
Returns:
|
|
590
|
+
A `h2o_wave.types.Choice` instance.
|
|
591
|
+
"""
|
|
592
|
+
return Choice(
|
|
593
|
+
name,
|
|
594
|
+
label,
|
|
595
|
+
disabled,
|
|
596
|
+
)
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
def choice_group(
|
|
600
|
+
name: str,
|
|
601
|
+
label: Optional[str] = None,
|
|
602
|
+
value: Optional[str] = None,
|
|
603
|
+
choices: Optional[List[Choice]] = None,
|
|
604
|
+
required: Optional[bool] = None,
|
|
605
|
+
trigger: Optional[bool] = None,
|
|
606
|
+
inline: Optional[bool] = None,
|
|
607
|
+
width: Optional[str] = None,
|
|
608
|
+
visible: Optional[bool] = None,
|
|
609
|
+
tooltip: Optional[str] = None,
|
|
610
|
+
) -> Component:
|
|
611
|
+
"""Create a choice group.
|
|
612
|
+
The choice group component, also known as radio buttons, let users select one option from two or more choices.
|
|
613
|
+
Each option is represented by one choice group button; a user can select only one choice group in a button group.
|
|
614
|
+
|
|
615
|
+
Choice groups emphasize all options equally, and that may draw more attention to the options than necessary.
|
|
616
|
+
Consider using other components, unless the options deserve extra attention from the user.
|
|
617
|
+
For example, if the default option is recommended for most users in most situations, use a dropdown instead.
|
|
618
|
+
|
|
619
|
+
If there are only two mutually exclusive options, combine them into a single Checkbox or Toggle switch.
|
|
620
|
+
For example, use a checkbox for "I agree" instead of choice group buttons for "I agree" and "I don't agree."
|
|
621
|
+
|
|
622
|
+
Args:
|
|
623
|
+
name: An identifying name for this component.
|
|
624
|
+
label: Text to be displayed alongside the component.
|
|
625
|
+
value: The name of the selected choice.
|
|
626
|
+
choices: The choices to be presented.
|
|
627
|
+
required: True if this field is required.
|
|
628
|
+
trigger: True if the form should be submitted when the selection changes.
|
|
629
|
+
inline: True if choices should be rendered horizontally. Defaults to False.
|
|
630
|
+
width: The width of the choice group, e.g. '100px'.
|
|
631
|
+
visible: True if the component should be visible. Defaults to True.
|
|
632
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
633
|
+
Returns:
|
|
634
|
+
A `h2o_wave.types.ChoiceGroup` instance.
|
|
635
|
+
"""
|
|
636
|
+
return Component(choice_group=ChoiceGroup(
|
|
637
|
+
name,
|
|
638
|
+
label,
|
|
639
|
+
value,
|
|
640
|
+
choices,
|
|
641
|
+
required,
|
|
642
|
+
trigger,
|
|
643
|
+
inline,
|
|
644
|
+
width,
|
|
645
|
+
visible,
|
|
646
|
+
tooltip,
|
|
647
|
+
))
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
def checklist(
|
|
651
|
+
name: str,
|
|
652
|
+
label: Optional[str] = None,
|
|
653
|
+
values: Optional[List[str]] = None,
|
|
654
|
+
choices: Optional[List[Choice]] = None,
|
|
655
|
+
trigger: Optional[bool] = None,
|
|
656
|
+
inline: Optional[bool] = None,
|
|
657
|
+
width: Optional[str] = None,
|
|
658
|
+
visible: Optional[bool] = None,
|
|
659
|
+
tooltip: Optional[str] = None,
|
|
660
|
+
) -> Component:
|
|
661
|
+
"""Create a set of checkboxes.
|
|
662
|
+
Use this for multi-select scenarios in which a user chooses one or more items from a group of
|
|
663
|
+
choices that are not mutually exclusive.
|
|
664
|
+
|
|
665
|
+
Args:
|
|
666
|
+
name: An identifying name for this component.
|
|
667
|
+
label: Text to be displayed above the component.
|
|
668
|
+
values: The names of the selected choices.
|
|
669
|
+
choices: The choices to be presented.
|
|
670
|
+
trigger: True if the form should be submitted when the checklist value changes.
|
|
671
|
+
inline: True if checklist should be rendered horizontally. Defaults to False.
|
|
672
|
+
width: The width of the checklist, e.g. '100px'.
|
|
673
|
+
visible: True if the component should be visible. Defaults to True.
|
|
674
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
675
|
+
Returns:
|
|
676
|
+
A `h2o_wave.types.Checklist` instance.
|
|
677
|
+
"""
|
|
678
|
+
return Component(checklist=Checklist(
|
|
679
|
+
name,
|
|
680
|
+
label,
|
|
681
|
+
values,
|
|
682
|
+
choices,
|
|
683
|
+
trigger,
|
|
684
|
+
inline,
|
|
685
|
+
width,
|
|
686
|
+
visible,
|
|
687
|
+
tooltip,
|
|
688
|
+
))
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
def dropdown(
|
|
692
|
+
name: str,
|
|
693
|
+
label: Optional[str] = None,
|
|
694
|
+
placeholder: Optional[str] = None,
|
|
695
|
+
value: Optional[str] = None,
|
|
696
|
+
values: Optional[List[str]] = None,
|
|
697
|
+
choices: Optional[List[Choice]] = None,
|
|
698
|
+
required: Optional[bool] = None,
|
|
699
|
+
disabled: Optional[bool] = None,
|
|
700
|
+
trigger: Optional[bool] = None,
|
|
701
|
+
width: Optional[str] = None,
|
|
702
|
+
visible: Optional[bool] = None,
|
|
703
|
+
tooltip: Optional[str] = None,
|
|
704
|
+
popup: Optional[str] = None,
|
|
705
|
+
) -> Component:
|
|
706
|
+
"""Create a dropdown.
|
|
707
|
+
|
|
708
|
+
A dropdown is a list in which the selected item is always visible, and the others are visible on demand by clicking
|
|
709
|
+
a drop-down button. They are used to simplify the design and make a choice within the UI. When closed, only the
|
|
710
|
+
selected item is visible. When users click the drop-down button, all the options become visible.
|
|
711
|
+
|
|
712
|
+
To change the value, users open the list and click another value or use the arrow keys (up and down) to
|
|
713
|
+
select a new value.
|
|
714
|
+
|
|
715
|
+
Note: Use either the 'value' parameter or the 'values' parameter. Setting the 'values' parameter renders a
|
|
716
|
+
multi-select dropdown.
|
|
717
|
+
|
|
718
|
+
Args:
|
|
719
|
+
name: An identifying name for this component.
|
|
720
|
+
label: Text to be displayed alongside the component.
|
|
721
|
+
placeholder: A string that provides a brief hint to the user as to what kind of information is expected in the field.
|
|
722
|
+
value: The name of the selected choice.
|
|
723
|
+
values: The names of the selected choices. If this parameter is set, multiple selections will be allowed.
|
|
724
|
+
choices: The choices to be presented.
|
|
725
|
+
required: True if this is a required field.
|
|
726
|
+
disabled: True if this field is disabled.
|
|
727
|
+
trigger: True if the form should be submitted when the dropdown value changes.
|
|
728
|
+
width: The width of the dropdown, e.g. '100px'. Defaults to '100%'.
|
|
729
|
+
visible: True if the component should be visible. Defaults to True.
|
|
730
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
731
|
+
popup: Whether to present the choices using a pop-up dialog. By default pops up a dialog only for more than 100 choices. Defaults to 'auto'. One of 'auto', 'always', 'never'. See enum h2o_wave.ui.DropdownPopup.
|
|
732
|
+
Returns:
|
|
733
|
+
A `h2o_wave.types.Dropdown` instance.
|
|
734
|
+
"""
|
|
735
|
+
return Component(dropdown=Dropdown(
|
|
736
|
+
name,
|
|
737
|
+
label,
|
|
738
|
+
placeholder,
|
|
739
|
+
value,
|
|
740
|
+
values,
|
|
741
|
+
choices,
|
|
742
|
+
required,
|
|
743
|
+
disabled,
|
|
744
|
+
trigger,
|
|
745
|
+
width,
|
|
746
|
+
visible,
|
|
747
|
+
tooltip,
|
|
748
|
+
popup,
|
|
749
|
+
))
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
def combobox(
|
|
753
|
+
name: str,
|
|
754
|
+
label: Optional[str] = None,
|
|
755
|
+
placeholder: Optional[str] = None,
|
|
756
|
+
value: Optional[str] = None,
|
|
757
|
+
values: Optional[List[str]] = None,
|
|
758
|
+
choices: Optional[List[str]] = None,
|
|
759
|
+
error: Optional[str] = None,
|
|
760
|
+
disabled: Optional[bool] = None,
|
|
761
|
+
width: Optional[str] = None,
|
|
762
|
+
visible: Optional[bool] = None,
|
|
763
|
+
tooltip: Optional[str] = None,
|
|
764
|
+
trigger: Optional[bool] = None,
|
|
765
|
+
required: Optional[bool] = None,
|
|
766
|
+
) -> Component:
|
|
767
|
+
"""Create a combobox.
|
|
768
|
+
|
|
769
|
+
A combobox is a list in which the selected item is always visible, and the others are visible on demand by
|
|
770
|
+
clicking a drop-down button or by typing in the input.
|
|
771
|
+
They are used to simplify the design and make a choice within the UI.
|
|
772
|
+
|
|
773
|
+
When closed, only the selected item is visible.
|
|
774
|
+
When users click the drop-down button, all the options become visible.
|
|
775
|
+
To change the value, users open the list and click another value or use the arrow keys (up and down)
|
|
776
|
+
to select a new value.
|
|
777
|
+
When collapsed the user can select a new value by typing.
|
|
778
|
+
|
|
779
|
+
Args:
|
|
780
|
+
name: An identifying name for this component.
|
|
781
|
+
label: Text to be displayed alongside the component.
|
|
782
|
+
placeholder: A string that provides a brief hint to the user as to what kind of information is expected in the field.
|
|
783
|
+
value: The name of the selected choice.
|
|
784
|
+
values: The names of the selected choices. If set, multiple selections will be allowed.
|
|
785
|
+
choices: The choices to be presented.
|
|
786
|
+
error: Text to be displayed as an error below the text box.
|
|
787
|
+
disabled: True if this field is disabled.
|
|
788
|
+
width: The width of the combobox, e.g. '100px'. Defaults to '100%'.
|
|
789
|
+
visible: True if the component should be visible. Defaults to True.
|
|
790
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
791
|
+
trigger: True if the choice should be submitted when an item from the dropdown is selected or the textbox value changes.
|
|
792
|
+
required: True if this is a required field. Defaults to False.
|
|
793
|
+
Returns:
|
|
794
|
+
A `h2o_wave.types.Combobox` instance.
|
|
795
|
+
"""
|
|
796
|
+
return Component(combobox=Combobox(
|
|
797
|
+
name,
|
|
798
|
+
label,
|
|
799
|
+
placeholder,
|
|
800
|
+
value,
|
|
801
|
+
values,
|
|
802
|
+
choices,
|
|
803
|
+
error,
|
|
804
|
+
disabled,
|
|
805
|
+
width,
|
|
806
|
+
visible,
|
|
807
|
+
tooltip,
|
|
808
|
+
trigger,
|
|
809
|
+
required,
|
|
810
|
+
))
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
def slider(
|
|
814
|
+
name: str,
|
|
815
|
+
label: Optional[str] = None,
|
|
816
|
+
min: Optional[float] = None,
|
|
817
|
+
max: Optional[float] = None,
|
|
818
|
+
step: Optional[float] = None,
|
|
819
|
+
value: Optional[float] = None,
|
|
820
|
+
disabled: Optional[bool] = None,
|
|
821
|
+
trigger: Optional[bool] = None,
|
|
822
|
+
width: Optional[str] = None,
|
|
823
|
+
visible: Optional[bool] = None,
|
|
824
|
+
tooltip: Optional[str] = None,
|
|
825
|
+
) -> Component:
|
|
826
|
+
"""Create a slider.
|
|
827
|
+
|
|
828
|
+
A slider is an element used to set a value. It provides a visual indication of adjustable content, as well as the
|
|
829
|
+
current setting in the total range of content. It is displayed as a horizontal track with options on either side.
|
|
830
|
+
A knob or lever is dragged to one end or the other to make the choice, indicating the current value.
|
|
831
|
+
Marks on the slider bar can show values and users can choose where they want to drag the knob or lever to
|
|
832
|
+
set the value.
|
|
833
|
+
|
|
834
|
+
A slider is a good choice when you know that users think of the value as a relative quantity, not a numeric value.
|
|
835
|
+
For example, users think about setting their audio volume to low or medium — not about setting the
|
|
836
|
+
value to two or five.
|
|
837
|
+
|
|
838
|
+
The default value of the slider will be zero or be constrained to the min and max values. The min will be returned
|
|
839
|
+
if the value is set under the min and the max will be returned if set higher than the max value.
|
|
840
|
+
|
|
841
|
+
Args:
|
|
842
|
+
name: An identifying name for this component.
|
|
843
|
+
label: Text to be displayed alongside the component.
|
|
844
|
+
min: The minimum value of the slider.
|
|
845
|
+
max: The maximum value of the slider.
|
|
846
|
+
step: The difference between two adjacent values of the slider.
|
|
847
|
+
value: The current value of the slider.
|
|
848
|
+
disabled: True if this field is disabled.
|
|
849
|
+
trigger: True if the form should be submitted when the slider value changes.
|
|
850
|
+
width: The width of the slider, e.g. '100px'. Defaults to '100%'.
|
|
851
|
+
visible: True if the component should be visible. Defaults to True.
|
|
852
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
853
|
+
Returns:
|
|
854
|
+
A `h2o_wave.types.Slider` instance.
|
|
855
|
+
"""
|
|
856
|
+
return Component(slider=Slider(
|
|
857
|
+
name,
|
|
858
|
+
label,
|
|
859
|
+
min,
|
|
860
|
+
max,
|
|
861
|
+
step,
|
|
862
|
+
value,
|
|
863
|
+
disabled,
|
|
864
|
+
trigger,
|
|
865
|
+
width,
|
|
866
|
+
visible,
|
|
867
|
+
tooltip,
|
|
868
|
+
))
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
def spinbox(
|
|
872
|
+
name: str,
|
|
873
|
+
label: Optional[str] = None,
|
|
874
|
+
min: Optional[float] = None,
|
|
875
|
+
max: Optional[float] = None,
|
|
876
|
+
step: Optional[float] = None,
|
|
877
|
+
value: Optional[float] = None,
|
|
878
|
+
disabled: Optional[bool] = None,
|
|
879
|
+
width: Optional[str] = None,
|
|
880
|
+
visible: Optional[bool] = None,
|
|
881
|
+
trigger: Optional[bool] = None,
|
|
882
|
+
tooltip: Optional[str] = None,
|
|
883
|
+
) -> Component:
|
|
884
|
+
"""Create a spinbox.
|
|
885
|
+
|
|
886
|
+
A spinbox allows the user to incrementally adjust a value in small steps.
|
|
887
|
+
|
|
888
|
+
Args:
|
|
889
|
+
name: An identifying name for this component.
|
|
890
|
+
label: Text to be displayed alongside the component.
|
|
891
|
+
min: The minimum value of the spinbox. Defaults to 0.
|
|
892
|
+
max: The maximum value of the spinbox. Defaults to 100.
|
|
893
|
+
step: The difference between two adjacent values of the spinbox. Defaults to 1.
|
|
894
|
+
value: The current value of the spinbox. Defaults to 0.
|
|
895
|
+
disabled: True if this field is disabled.
|
|
896
|
+
width: The width of the spinbox, e.g. '100px'. Defaults to '100%'.
|
|
897
|
+
visible: True if the component should be visible. Defaults to True.
|
|
898
|
+
trigger: True if the form should be submitted when the spinbox value changes.
|
|
899
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
900
|
+
Returns:
|
|
901
|
+
A `h2o_wave.types.Spinbox` instance.
|
|
902
|
+
"""
|
|
903
|
+
return Component(spinbox=Spinbox(
|
|
904
|
+
name,
|
|
905
|
+
label,
|
|
906
|
+
min,
|
|
907
|
+
max,
|
|
908
|
+
step,
|
|
909
|
+
value,
|
|
910
|
+
disabled,
|
|
911
|
+
width,
|
|
912
|
+
visible,
|
|
913
|
+
trigger,
|
|
914
|
+
tooltip,
|
|
915
|
+
))
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
def date_picker(
|
|
919
|
+
name: str,
|
|
920
|
+
label: Optional[str] = None,
|
|
921
|
+
placeholder: Optional[str] = None,
|
|
922
|
+
value: Optional[str] = None,
|
|
923
|
+
disabled: Optional[bool] = None,
|
|
924
|
+
trigger: Optional[bool] = None,
|
|
925
|
+
width: Optional[str] = None,
|
|
926
|
+
visible: Optional[bool] = None,
|
|
927
|
+
tooltip: Optional[str] = None,
|
|
928
|
+
min: Optional[str] = None,
|
|
929
|
+
max: Optional[str] = None,
|
|
930
|
+
) -> Component:
|
|
931
|
+
"""Create a date picker.
|
|
932
|
+
|
|
933
|
+
A date picker allows a user to pick a date value.
|
|
934
|
+
|
|
935
|
+
Args:
|
|
936
|
+
name: An identifying name for this component.
|
|
937
|
+
label: Text to be displayed alongside the component.
|
|
938
|
+
placeholder: A string that provides a brief hint to the user as to what kind of information is expected in the field.
|
|
939
|
+
value: The date value in YYYY-MM-DD format.
|
|
940
|
+
disabled: True if this field is disabled.
|
|
941
|
+
trigger: True if the form should be submitted when the datepicker value changes.
|
|
942
|
+
width: The width of the date picker, e.g. '100px'. Defaults to '100%'.
|
|
943
|
+
visible: True if the component should be visible. Defaults to True.
|
|
944
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
945
|
+
min: The minimum allowed date value in YYYY-MM-DD format.
|
|
946
|
+
max: The maximum allowed date value in YYYY-MM-DD format.
|
|
947
|
+
Returns:
|
|
948
|
+
A `h2o_wave.types.DatePicker` instance.
|
|
949
|
+
"""
|
|
950
|
+
return Component(date_picker=DatePicker(
|
|
951
|
+
name,
|
|
952
|
+
label,
|
|
953
|
+
placeholder,
|
|
954
|
+
value,
|
|
955
|
+
disabled,
|
|
956
|
+
trigger,
|
|
957
|
+
width,
|
|
958
|
+
visible,
|
|
959
|
+
tooltip,
|
|
960
|
+
min,
|
|
961
|
+
max,
|
|
962
|
+
))
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
def color_picker(
|
|
966
|
+
name: str,
|
|
967
|
+
label: Optional[str] = None,
|
|
968
|
+
value: Optional[str] = None,
|
|
969
|
+
choices: Optional[List[str]] = None,
|
|
970
|
+
width: Optional[str] = None,
|
|
971
|
+
alpha: Optional[bool] = None,
|
|
972
|
+
inline: Optional[bool] = None,
|
|
973
|
+
visible: Optional[bool] = None,
|
|
974
|
+
trigger: Optional[bool] = None,
|
|
975
|
+
tooltip: Optional[str] = None,
|
|
976
|
+
) -> Component:
|
|
977
|
+
"""Create a color picker.
|
|
978
|
+
|
|
979
|
+
A color picker allows a user to pick a color value.
|
|
980
|
+
If the 'choices' parameter is set, a swatch picker is displayed instead of the standard color picker.
|
|
981
|
+
|
|
982
|
+
Args:
|
|
983
|
+
name: An identifying name for this component.
|
|
984
|
+
label: Text to be displayed alongside the component.
|
|
985
|
+
value: The selected color (CSS-compatible string).
|
|
986
|
+
choices: A list of colors (CSS-compatible strings) to limit color choices to.
|
|
987
|
+
width: The width of the color picker, e.g. '100px'. Defaults to '300px'.
|
|
988
|
+
alpha: True if user should be allowed to pick color transparency. Defaults to True.
|
|
989
|
+
inline: True if color picker should be displayed inline (takes less space). Doesn't work with choices specified. Defaults to False.
|
|
990
|
+
visible: True if the component should be visible. Defaults to True.
|
|
991
|
+
trigger: True if the form should be submitted when the color picker value changes.
|
|
992
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
993
|
+
Returns:
|
|
994
|
+
A `h2o_wave.types.ColorPicker` instance.
|
|
995
|
+
"""
|
|
996
|
+
return Component(color_picker=ColorPicker(
|
|
997
|
+
name,
|
|
998
|
+
label,
|
|
999
|
+
value,
|
|
1000
|
+
choices,
|
|
1001
|
+
width,
|
|
1002
|
+
alpha,
|
|
1003
|
+
inline,
|
|
1004
|
+
visible,
|
|
1005
|
+
trigger,
|
|
1006
|
+
tooltip,
|
|
1007
|
+
))
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+
def button(
|
|
1011
|
+
name: str,
|
|
1012
|
+
label: Optional[str] = None,
|
|
1013
|
+
caption: Optional[str] = None,
|
|
1014
|
+
value: Optional[str] = None,
|
|
1015
|
+
primary: Optional[bool] = None,
|
|
1016
|
+
disabled: Optional[bool] = None,
|
|
1017
|
+
link: Optional[bool] = None,
|
|
1018
|
+
icon: Optional[str] = None,
|
|
1019
|
+
width: Optional[str] = None,
|
|
1020
|
+
visible: Optional[bool] = None,
|
|
1021
|
+
tooltip: Optional[str] = None,
|
|
1022
|
+
path: Optional[str] = None,
|
|
1023
|
+
commands: Optional[List[Command]] = None,
|
|
1024
|
+
) -> Component:
|
|
1025
|
+
"""Create a button.
|
|
1026
|
+
|
|
1027
|
+
Buttons are best used to enable a user to commit a change or complete steps in a task.
|
|
1028
|
+
They are typically found inside forms, dialogs, panels or pages.
|
|
1029
|
+
An example of their usage is confirming the deletion of a file in a confirmation dialog.
|
|
1030
|
+
|
|
1031
|
+
When considering their place in a layout, contemplate the order in which a user will flow through the UI.
|
|
1032
|
+
As an example, in a form, the individual will need to read and interact with the form fields before submitting
|
|
1033
|
+
the form. Therefore, as a general rule, the button should be placed at the bottom of the UI container
|
|
1034
|
+
which holds the related UI elements.
|
|
1035
|
+
|
|
1036
|
+
Buttons may be placed within a "buttons" component which will lay out the buttons horizontally, or used
|
|
1037
|
+
individually and they will be stacked vertically.
|
|
1038
|
+
|
|
1039
|
+
While buttons can technically be used to navigate a user to another part of the experience, this is not
|
|
1040
|
+
recommended unless that navigation is part of an action or their flow.
|
|
1041
|
+
|
|
1042
|
+
Args:
|
|
1043
|
+
name: An identifying name for this component. If the name is prefixed with a '#', the button sets the location hash to the name when clicked.
|
|
1044
|
+
label: The text displayed on the button.
|
|
1045
|
+
caption: The caption displayed below the label.
|
|
1046
|
+
value: A value for this button. If a value is set, it is used for the button's submitted instead of a boolean True.
|
|
1047
|
+
primary: True if the button should be rendered as the primary button in the set.
|
|
1048
|
+
disabled: True if the button should be disabled.
|
|
1049
|
+
link: True if the button should be rendered as link text and not a standard button.
|
|
1050
|
+
icon: An optional icon to display next to the button label (not applicable for links).
|
|
1051
|
+
width: The width of the button, e.g. '100px'.
|
|
1052
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1053
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
1054
|
+
path: The path or URL to link to. If specified, the `name` is ignored. The URL is opened in a new browser window or tab.
|
|
1055
|
+
commands: When specified, a split button is rendered with extra actions tied to it within a context menu. Mutually exclusive with `link` attribute.
|
|
1056
|
+
Returns:
|
|
1057
|
+
A `h2o_wave.types.Button` instance.
|
|
1058
|
+
"""
|
|
1059
|
+
return Component(button=Button(
|
|
1060
|
+
name,
|
|
1061
|
+
label,
|
|
1062
|
+
caption,
|
|
1063
|
+
value,
|
|
1064
|
+
primary,
|
|
1065
|
+
disabled,
|
|
1066
|
+
link,
|
|
1067
|
+
icon,
|
|
1068
|
+
width,
|
|
1069
|
+
visible,
|
|
1070
|
+
tooltip,
|
|
1071
|
+
path,
|
|
1072
|
+
commands,
|
|
1073
|
+
))
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
def buttons(
|
|
1077
|
+
items: List[Component],
|
|
1078
|
+
justify: Optional[str] = None,
|
|
1079
|
+
name: Optional[str] = None,
|
|
1080
|
+
width: Optional[str] = None,
|
|
1081
|
+
visible: Optional[bool] = None,
|
|
1082
|
+
) -> Component:
|
|
1083
|
+
"""Create a set of buttons laid out horizontally.
|
|
1084
|
+
|
|
1085
|
+
Args:
|
|
1086
|
+
items: The buttons in this set.
|
|
1087
|
+
justify: Specifies how to lay out buttons horizontally. One of 'start', 'end', 'center', 'between', 'around'. See enum h2o_wave.ui.ButtonsJustify.
|
|
1088
|
+
name: An identifying name for this component.
|
|
1089
|
+
width: The width of the buttons, e.g. '100px'.
|
|
1090
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1091
|
+
Returns:
|
|
1092
|
+
A `h2o_wave.types.Buttons` instance.
|
|
1093
|
+
"""
|
|
1094
|
+
return Component(buttons=Buttons(
|
|
1095
|
+
items,
|
|
1096
|
+
justify,
|
|
1097
|
+
name,
|
|
1098
|
+
width,
|
|
1099
|
+
visible,
|
|
1100
|
+
))
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
def mini_button(
|
|
1104
|
+
name: str,
|
|
1105
|
+
label: str,
|
|
1106
|
+
icon: Optional[str] = None,
|
|
1107
|
+
) -> Component:
|
|
1108
|
+
"""Create a mini button - same as regular button, but smaller in size.
|
|
1109
|
+
|
|
1110
|
+
Args:
|
|
1111
|
+
name: An identifying name for this component. If the name is prefixed with a '#', the button sets the location hash to the name when clicked.
|
|
1112
|
+
label: The text displayed on the button.
|
|
1113
|
+
icon: An optional icon to display next to the button label.
|
|
1114
|
+
Returns:
|
|
1115
|
+
A `h2o_wave.types.MiniButton` instance.
|
|
1116
|
+
"""
|
|
1117
|
+
return Component(mini_button=MiniButton(
|
|
1118
|
+
name,
|
|
1119
|
+
label,
|
|
1120
|
+
icon,
|
|
1121
|
+
))
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
def mini_buttons(
|
|
1125
|
+
items: List[Component],
|
|
1126
|
+
visible: Optional[bool] = None,
|
|
1127
|
+
) -> Component:
|
|
1128
|
+
"""Create a set of mini buttons laid out horizontally.
|
|
1129
|
+
|
|
1130
|
+
Args:
|
|
1131
|
+
items: The buttons in this set.
|
|
1132
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1133
|
+
Returns:
|
|
1134
|
+
A `h2o_wave.types.MiniButtons` instance.
|
|
1135
|
+
"""
|
|
1136
|
+
return Component(mini_buttons=MiniButtons(
|
|
1137
|
+
items,
|
|
1138
|
+
visible,
|
|
1139
|
+
))
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
def file_upload(
|
|
1143
|
+
name: str,
|
|
1144
|
+
label: Optional[str] = None,
|
|
1145
|
+
multiple: Optional[bool] = None,
|
|
1146
|
+
file_extensions: Optional[List[str]] = None,
|
|
1147
|
+
max_file_size: Optional[float] = None,
|
|
1148
|
+
max_size: Optional[float] = None,
|
|
1149
|
+
height: Optional[str] = None,
|
|
1150
|
+
width: Optional[str] = None,
|
|
1151
|
+
compact: Optional[bool] = None,
|
|
1152
|
+
visible: Optional[bool] = None,
|
|
1153
|
+
tooltip: Optional[str] = None,
|
|
1154
|
+
required: Optional[bool] = None,
|
|
1155
|
+
) -> Component:
|
|
1156
|
+
"""Create a file upload component.
|
|
1157
|
+
A file upload component allows a user to browse, select and upload one or more files.
|
|
1158
|
+
|
|
1159
|
+
Args:
|
|
1160
|
+
name: An identifying name for this component.
|
|
1161
|
+
label: Text to be displayed in the bottom button or as a component title when the component is displayed compactly. Defaults to "Upload".
|
|
1162
|
+
multiple: True if the component should allow multiple files to be uploaded.
|
|
1163
|
+
file_extensions: List of allowed file extensions, e.g. `pdf`, `docx`, etc.
|
|
1164
|
+
max_file_size: Maximum allowed size (Mb) per file. No limit by default.
|
|
1165
|
+
max_size: Maximum allowed size (Mb) for all files combined. No limit by default.
|
|
1166
|
+
height: The height of the file upload, e.g. '400px', '50%', etc. Defaults to '300px'.
|
|
1167
|
+
width: The width of the file upload, e.g. '100px'. Defaults to '100%'.
|
|
1168
|
+
compact: True if the component should be displayed compactly (without drag-and-drop capabilities). Defaults to False.
|
|
1169
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1170
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
1171
|
+
required: True if this is a required field. Defaults to False.
|
|
1172
|
+
Returns:
|
|
1173
|
+
A `h2o_wave.types.FileUpload` instance.
|
|
1174
|
+
"""
|
|
1175
|
+
return Component(file_upload=FileUpload(
|
|
1176
|
+
name,
|
|
1177
|
+
label,
|
|
1178
|
+
multiple,
|
|
1179
|
+
file_extensions,
|
|
1180
|
+
max_file_size,
|
|
1181
|
+
max_size,
|
|
1182
|
+
height,
|
|
1183
|
+
width,
|
|
1184
|
+
compact,
|
|
1185
|
+
visible,
|
|
1186
|
+
tooltip,
|
|
1187
|
+
required,
|
|
1188
|
+
))
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
def progress_table_cell_type(
|
|
1192
|
+
color: Optional[str] = None,
|
|
1193
|
+
name: Optional[str] = None,
|
|
1194
|
+
) -> TableCellType:
|
|
1195
|
+
"""Create a cell type that renders a column's cells as progress bars instead of plain text.
|
|
1196
|
+
If set on a column, the cell value must be between 0.0 and 1.0.
|
|
1197
|
+
|
|
1198
|
+
Args:
|
|
1199
|
+
color: Color of the progress arc.
|
|
1200
|
+
name: An identifying name for this component.
|
|
1201
|
+
Returns:
|
|
1202
|
+
A `h2o_wave.types.ProgressTableCellType` instance.
|
|
1203
|
+
"""
|
|
1204
|
+
return TableCellType(progress=ProgressTableCellType(
|
|
1205
|
+
color,
|
|
1206
|
+
name,
|
|
1207
|
+
))
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
def icon_table_cell_type(
|
|
1211
|
+
color: Optional[str] = None,
|
|
1212
|
+
name: Optional[str] = None,
|
|
1213
|
+
) -> TableCellType:
|
|
1214
|
+
"""Create a cell type that renders a column's cells as icons instead of plain text.
|
|
1215
|
+
If set on a column, the cell value is interpreted as the name of the icon to be displayed.
|
|
1216
|
+
|
|
1217
|
+
Args:
|
|
1218
|
+
color: Icon color.
|
|
1219
|
+
name: An identifying name for this component.
|
|
1220
|
+
Returns:
|
|
1221
|
+
A `h2o_wave.types.IconTableCellType` instance.
|
|
1222
|
+
"""
|
|
1223
|
+
return TableCellType(icon=IconTableCellType(
|
|
1224
|
+
color,
|
|
1225
|
+
name,
|
|
1226
|
+
))
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
def tag(
|
|
1230
|
+
label: str,
|
|
1231
|
+
color: str,
|
|
1232
|
+
label_color: Optional[str] = None,
|
|
1233
|
+
) -> Tag:
|
|
1234
|
+
"""Create a tag.
|
|
1235
|
+
|
|
1236
|
+
Args:
|
|
1237
|
+
label: The text displayed within the tag.
|
|
1238
|
+
color: Tag's background color.
|
|
1239
|
+
label_color: Tag's label color. If not specified, black or white will be picked based on correct contrast with background.
|
|
1240
|
+
Returns:
|
|
1241
|
+
A `h2o_wave.types.Tag` instance.
|
|
1242
|
+
"""
|
|
1243
|
+
return Tag(
|
|
1244
|
+
label,
|
|
1245
|
+
color,
|
|
1246
|
+
label_color,
|
|
1247
|
+
)
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
def tag_table_cell_type(
|
|
1251
|
+
name: str,
|
|
1252
|
+
tags: Optional[List[Tag]] = None,
|
|
1253
|
+
) -> TableCellType:
|
|
1254
|
+
"""Creates a collection of tags, usually used for rendering state values.
|
|
1255
|
+
In case of multiple tags per row, make sure the row values are
|
|
1256
|
+
separated by "," within a single cell string.
|
|
1257
|
+
E.g. ui.table_row(name="...", cells=["cell1", "TAG1,TAG2"]).
|
|
1258
|
+
Each value should correspond to a `ui.tag.label` attr.
|
|
1259
|
+
For the example above: [
|
|
1260
|
+
ui.tag(label="TAG1", color="red"),
|
|
1261
|
+
ui.tag(label="TAG2", color="green"),
|
|
1262
|
+
]
|
|
1263
|
+
|
|
1264
|
+
Args:
|
|
1265
|
+
name: An identifying name for this component.
|
|
1266
|
+
tags: Tags to be rendered.
|
|
1267
|
+
Returns:
|
|
1268
|
+
A `h2o_wave.types.TagTableCellType` instance.
|
|
1269
|
+
"""
|
|
1270
|
+
return TableCellType(tag=TagTableCellType(
|
|
1271
|
+
name,
|
|
1272
|
+
tags,
|
|
1273
|
+
))
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
def menu_table_cell_type(
|
|
1277
|
+
commands: List[Command],
|
|
1278
|
+
name: Optional[str] = None,
|
|
1279
|
+
) -> TableCellType:
|
|
1280
|
+
"""Create a cell type that renders command menu.
|
|
1281
|
+
|
|
1282
|
+
Commands are typically displayed as context menu items. Useful when you need to provide
|
|
1283
|
+
multiple actions within a single row.
|
|
1284
|
+
|
|
1285
|
+
Args:
|
|
1286
|
+
commands: Items to render.
|
|
1287
|
+
name: An identifying name for this component.
|
|
1288
|
+
Returns:
|
|
1289
|
+
A `h2o_wave.types.MenuTableCellType` instance.
|
|
1290
|
+
"""
|
|
1291
|
+
return TableCellType(menu=MenuTableCellType(
|
|
1292
|
+
commands,
|
|
1293
|
+
name,
|
|
1294
|
+
))
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
def markdown_table_cell_type(
|
|
1298
|
+
name: Optional[str] = None,
|
|
1299
|
+
target: Optional[str] = None,
|
|
1300
|
+
) -> TableCellType:
|
|
1301
|
+
"""Create a cell type that renders Markdown content.
|
|
1302
|
+
|
|
1303
|
+
Args:
|
|
1304
|
+
name: An identifying name for this component.
|
|
1305
|
+
target: Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab.
|
|
1306
|
+
Returns:
|
|
1307
|
+
A `h2o_wave.types.MarkdownTableCellType` instance.
|
|
1308
|
+
"""
|
|
1309
|
+
return TableCellType(markdown=MarkdownTableCellType(
|
|
1310
|
+
name,
|
|
1311
|
+
target,
|
|
1312
|
+
))
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
def table_column(
|
|
1316
|
+
name: str,
|
|
1317
|
+
label: str,
|
|
1318
|
+
min_width: Optional[str] = None,
|
|
1319
|
+
max_width: Optional[str] = None,
|
|
1320
|
+
sortable: Optional[bool] = None,
|
|
1321
|
+
searchable: Optional[bool] = None,
|
|
1322
|
+
filterable: Optional[bool] = None,
|
|
1323
|
+
link: Optional[bool] = None,
|
|
1324
|
+
data_type: Optional[str] = None,
|
|
1325
|
+
cell_type: Optional[TableCellType] = None,
|
|
1326
|
+
cell_overflow: Optional[str] = None,
|
|
1327
|
+
filters: Optional[List[str]] = None,
|
|
1328
|
+
align: Optional[str] = None,
|
|
1329
|
+
) -> TableColumn:
|
|
1330
|
+
"""Create a table column.
|
|
1331
|
+
|
|
1332
|
+
Args:
|
|
1333
|
+
name: An identifying name for this column.
|
|
1334
|
+
label: The text displayed on the column header.
|
|
1335
|
+
min_width: The minimum width of this column, e.g. '50px'. Only `px` units are supported at this time.
|
|
1336
|
+
max_width: The maximum width of this column, e.g. '100px'. Only `px` units are supported at this time.
|
|
1337
|
+
sortable: Indicates whether the column is sortable.
|
|
1338
|
+
searchable: Indicates whether the contents of this column can be searched through. Enables a search box for the table if true.
|
|
1339
|
+
filterable: Indicates whether the contents of this column are displayed as filters in a dropdown.
|
|
1340
|
+
link: Indicates whether each cell in this column should be displayed as a clickable link. Applies to exactly one text column in the table.
|
|
1341
|
+
data_type: Defines the data type of this column. Time column takes either ISO 8601 date string or unix epoch miliseconds. Defaults to `string`. One of 'string', 'number', 'time'. See enum h2o_wave.ui.TableColumnDataType.
|
|
1342
|
+
cell_type: Defines how to render each cell in this column. Renders as plain text by default.
|
|
1343
|
+
cell_overflow: Defines what to do with a cell's contents in case it does not fit inside the cell. One of 'tooltip', 'wrap'. See enum h2o_wave.ui.TableColumnCellOverflow.
|
|
1344
|
+
filters: Explicit list of values to allow filtering by, needed when pagination is set or custom order is needed. Only applicable to filterable columns.
|
|
1345
|
+
align: Defines how to align values in a column. One of 'left', 'center', 'right'. See enum h2o_wave.ui.TableColumnAlign.
|
|
1346
|
+
Returns:
|
|
1347
|
+
A `h2o_wave.types.TableColumn` instance.
|
|
1348
|
+
"""
|
|
1349
|
+
return TableColumn(
|
|
1350
|
+
name,
|
|
1351
|
+
label,
|
|
1352
|
+
min_width,
|
|
1353
|
+
max_width,
|
|
1354
|
+
sortable,
|
|
1355
|
+
searchable,
|
|
1356
|
+
filterable,
|
|
1357
|
+
link,
|
|
1358
|
+
data_type,
|
|
1359
|
+
cell_type,
|
|
1360
|
+
cell_overflow,
|
|
1361
|
+
filters,
|
|
1362
|
+
align,
|
|
1363
|
+
)
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
def table_row(
|
|
1367
|
+
name: str,
|
|
1368
|
+
cells: List[str],
|
|
1369
|
+
) -> TableRow:
|
|
1370
|
+
"""Create a table row.
|
|
1371
|
+
|
|
1372
|
+
Args:
|
|
1373
|
+
name: An identifying name for this row.
|
|
1374
|
+
cells: The cells in this row (displayed left to right).
|
|
1375
|
+
Returns:
|
|
1376
|
+
A `h2o_wave.types.TableRow` instance.
|
|
1377
|
+
"""
|
|
1378
|
+
return TableRow(
|
|
1379
|
+
name,
|
|
1380
|
+
cells,
|
|
1381
|
+
)
|
|
1382
|
+
|
|
1383
|
+
|
|
1384
|
+
def table_group(
|
|
1385
|
+
label: str,
|
|
1386
|
+
rows: List[TableRow],
|
|
1387
|
+
collapsed: Optional[bool] = None,
|
|
1388
|
+
) -> TableGroup:
|
|
1389
|
+
"""Make rows within the table collapsible/expandable.
|
|
1390
|
+
|
|
1391
|
+
This type of table is best used for cases when your data makes sense to be presented in chunks rather than a single flat list.
|
|
1392
|
+
|
|
1393
|
+
Args:
|
|
1394
|
+
label: The title of the group.
|
|
1395
|
+
rows: The rows in this group.
|
|
1396
|
+
collapsed: Indicates whether the table group should be collapsed by default. Defaults to True.
|
|
1397
|
+
Returns:
|
|
1398
|
+
A `h2o_wave.types.TableGroup` instance.
|
|
1399
|
+
"""
|
|
1400
|
+
return TableGroup(
|
|
1401
|
+
label,
|
|
1402
|
+
rows,
|
|
1403
|
+
collapsed,
|
|
1404
|
+
)
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
def table_pagination(
|
|
1408
|
+
total_rows: int,
|
|
1409
|
+
rows_per_page: int,
|
|
1410
|
+
) -> TablePagination:
|
|
1411
|
+
"""Configure table pagination. Use as `pagination` parameter to `ui.table()`
|
|
1412
|
+
|
|
1413
|
+
Args:
|
|
1414
|
+
total_rows: Total count of all the rows in your dataset.
|
|
1415
|
+
rows_per_page: The maximum amount of rows to be displayed in a single page.
|
|
1416
|
+
Returns:
|
|
1417
|
+
A `h2o_wave.types.TablePagination` instance.
|
|
1418
|
+
"""
|
|
1419
|
+
return TablePagination(
|
|
1420
|
+
total_rows,
|
|
1421
|
+
rows_per_page,
|
|
1422
|
+
)
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
def table(
|
|
1426
|
+
name: str,
|
|
1427
|
+
columns: List[TableColumn],
|
|
1428
|
+
rows: Optional[List[TableRow]] = None,
|
|
1429
|
+
multiple: Optional[bool] = None,
|
|
1430
|
+
groupable: Optional[bool] = None,
|
|
1431
|
+
downloadable: Optional[bool] = None,
|
|
1432
|
+
resettable: Optional[bool] = None,
|
|
1433
|
+
height: Optional[str] = None,
|
|
1434
|
+
width: Optional[str] = None,
|
|
1435
|
+
values: Optional[List[str]] = None,
|
|
1436
|
+
checkbox_visibility: Optional[str] = None,
|
|
1437
|
+
visible: Optional[bool] = None,
|
|
1438
|
+
tooltip: Optional[str] = None,
|
|
1439
|
+
groups: Optional[List[TableGroup]] = None,
|
|
1440
|
+
pagination: Optional[TablePagination] = None,
|
|
1441
|
+
events: Optional[List[str]] = None,
|
|
1442
|
+
single: Optional[bool] = None,
|
|
1443
|
+
value: Optional[str] = None,
|
|
1444
|
+
) -> Component:
|
|
1445
|
+
"""Create an interactive table.
|
|
1446
|
+
|
|
1447
|
+
This table differs from a markdown table in that it supports clicking or selecting rows. If you simply want to
|
|
1448
|
+
display a non-interactive table of information, use a markdown table.
|
|
1449
|
+
|
|
1450
|
+
If `multiple` is set to False (default), each row in the table is clickable. When a cell in the column with `link=True`
|
|
1451
|
+
(defaults to first column) is clicked or the row is doubleclicked, the form is
|
|
1452
|
+
submitted automatically, and `q.args.table_name` is set to `[row_name]`, where `table_name` is the `name` of
|
|
1453
|
+
the table, and `row_name` is the `name` of the row that was clicked on.
|
|
1454
|
+
|
|
1455
|
+
If `multiple` is set to True, each row in the table is selectable. A row can be selected by clicking on it.
|
|
1456
|
+
Multiple rows can be selected either by shift+clicking or using marquee selection. When the form is submitted,
|
|
1457
|
+
`q.args.table_name` is set to `[row1_name, row2_name, ...]` where `table_name` is the `name` of the table,
|
|
1458
|
+
and `row1_name`, `row2_name` are the `name` of the rows that were selected. Note that if `multiple` is
|
|
1459
|
+
set to True, the form is not submitted automatically, and one or more buttons are required in the form to trigger
|
|
1460
|
+
submission.
|
|
1461
|
+
|
|
1462
|
+
If `pagination` is set, you have to handle search/filter/sort/download/page_change/reset events yourself since
|
|
1463
|
+
none of these features will work automatically like in non-paginated table.
|
|
1464
|
+
|
|
1465
|
+
Args:
|
|
1466
|
+
name: An identifying name for this component.
|
|
1467
|
+
columns: The columns in this table.
|
|
1468
|
+
rows: The rows in this table. Mutually exclusive with `groups` attr.
|
|
1469
|
+
multiple: True to allow multiple rows to be selected. Mutually exclusive with `single` attr.
|
|
1470
|
+
groupable: True to allow group by feature.
|
|
1471
|
+
downloadable: Indicates whether the table rows can be downloaded as a CSV file. Defaults to False.
|
|
1472
|
+
resettable: Indicates whether a Reset button should be displayed to reset search / filter / group-by values to their defaults. Defaults to False.
|
|
1473
|
+
height: The height of the table in px (e.g. '200px') or '1' to fill the remaining card space.
|
|
1474
|
+
width: The width of the table, e.g. '100px'. Defaults to '100%'.
|
|
1475
|
+
values: The names of the selected rows. If this parameter is set, multiple selections will be allowed (`multiple` is assumed to be `True`).
|
|
1476
|
+
checkbox_visibility: Controls visibility of table rows when `multiple` is set to `True`. Defaults to 'on-hover'. One of 'always', 'on-hover', 'hidden'. See enum h2o_wave.ui.TableCheckboxVisibility.
|
|
1477
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1478
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
1479
|
+
groups: Creates collapsible / expandable groups of data rows. Mutually exclusive with `rows` attr.
|
|
1480
|
+
pagination: Display a pagination control at the bottom of the table. Set this value using `ui.table_pagination()`.
|
|
1481
|
+
events: The events to capture on this table. When pagination is set, one of 'search' | 'sort' | 'filter' | 'download' | 'page_change' | 'reset'. These events are available regardless of pagination: 'select' | 'group_change'.
|
|
1482
|
+
single: True to allow only one row to be selected at time. Mutually exclusive with `multiple` attr.
|
|
1483
|
+
value: The name of the selected row. If this parameter is set, single selection will be allowed (`single` is assumed to be `True`).
|
|
1484
|
+
Returns:
|
|
1485
|
+
A `h2o_wave.types.Table` instance.
|
|
1486
|
+
"""
|
|
1487
|
+
return Component(table=Table(
|
|
1488
|
+
name,
|
|
1489
|
+
columns,
|
|
1490
|
+
rows,
|
|
1491
|
+
multiple,
|
|
1492
|
+
groupable,
|
|
1493
|
+
downloadable,
|
|
1494
|
+
resettable,
|
|
1495
|
+
height,
|
|
1496
|
+
width,
|
|
1497
|
+
values,
|
|
1498
|
+
checkbox_visibility,
|
|
1499
|
+
visible,
|
|
1500
|
+
tooltip,
|
|
1501
|
+
groups,
|
|
1502
|
+
pagination,
|
|
1503
|
+
events,
|
|
1504
|
+
single,
|
|
1505
|
+
value,
|
|
1506
|
+
))
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
def link(
|
|
1510
|
+
label: Optional[str] = None,
|
|
1511
|
+
path: Optional[str] = None,
|
|
1512
|
+
disabled: Optional[bool] = None,
|
|
1513
|
+
download: Optional[bool] = None,
|
|
1514
|
+
button: Optional[bool] = None,
|
|
1515
|
+
width: Optional[str] = None,
|
|
1516
|
+
visible: Optional[bool] = None,
|
|
1517
|
+
target: Optional[str] = None,
|
|
1518
|
+
tooltip: Optional[str] = None,
|
|
1519
|
+
name: Optional[str] = None,
|
|
1520
|
+
) -> Component:
|
|
1521
|
+
"""Create a hyperlink.
|
|
1522
|
+
|
|
1523
|
+
Hyperlinks can be internal or external.
|
|
1524
|
+
Internal hyperlinks have paths that begin with a `/` and point to URLs within the Wave UI.
|
|
1525
|
+
All other kinds of paths are treated as external hyperlinks.
|
|
1526
|
+
|
|
1527
|
+
Args:
|
|
1528
|
+
label: The text to be displayed. If blank, the `path` is used as the label.
|
|
1529
|
+
path: The path or URL to link to.
|
|
1530
|
+
disabled: True if the link should be disabled.
|
|
1531
|
+
download: True if the link should prompt the user to save the linked URL instead of navigating to it.
|
|
1532
|
+
button: True if the link should be rendered as a button.
|
|
1533
|
+
width: The width of the link, e.g. '100px'.
|
|
1534
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1535
|
+
target: Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab.
|
|
1536
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
1537
|
+
name: An identifying name for this component.
|
|
1538
|
+
Returns:
|
|
1539
|
+
A `h2o_wave.types.Link` instance.
|
|
1540
|
+
"""
|
|
1541
|
+
return Component(link=Link(
|
|
1542
|
+
label,
|
|
1543
|
+
path,
|
|
1544
|
+
disabled,
|
|
1545
|
+
download,
|
|
1546
|
+
button,
|
|
1547
|
+
width,
|
|
1548
|
+
visible,
|
|
1549
|
+
target,
|
|
1550
|
+
tooltip,
|
|
1551
|
+
name,
|
|
1552
|
+
))
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
def links(
|
|
1556
|
+
items: List[Component],
|
|
1557
|
+
label: Optional[str] = None,
|
|
1558
|
+
inline: Optional[bool] = None,
|
|
1559
|
+
width: Optional[str] = None,
|
|
1560
|
+
) -> Component:
|
|
1561
|
+
"""Create a collection of links.
|
|
1562
|
+
|
|
1563
|
+
Args:
|
|
1564
|
+
items: The links contained in this group.
|
|
1565
|
+
label: The name of the link group.
|
|
1566
|
+
inline: Render links horizontally. Defaults to False.
|
|
1567
|
+
width: The width of the links, e.g. '100px'.
|
|
1568
|
+
Returns:
|
|
1569
|
+
A `h2o_wave.types.Links` instance.
|
|
1570
|
+
"""
|
|
1571
|
+
return Component(links=Links(
|
|
1572
|
+
items,
|
|
1573
|
+
label,
|
|
1574
|
+
inline,
|
|
1575
|
+
width,
|
|
1576
|
+
))
|
|
1577
|
+
|
|
1578
|
+
|
|
1579
|
+
def tab(
|
|
1580
|
+
name: str,
|
|
1581
|
+
label: Optional[str] = None,
|
|
1582
|
+
icon: Optional[str] = None,
|
|
1583
|
+
) -> Tab:
|
|
1584
|
+
"""Create a tab.
|
|
1585
|
+
|
|
1586
|
+
Args:
|
|
1587
|
+
name: An identifying name for this component.
|
|
1588
|
+
label: The text displayed on the tab.
|
|
1589
|
+
icon: The icon displayed on the tab.
|
|
1590
|
+
Returns:
|
|
1591
|
+
A `h2o_wave.types.Tab` instance.
|
|
1592
|
+
"""
|
|
1593
|
+
return Tab(
|
|
1594
|
+
name,
|
|
1595
|
+
label,
|
|
1596
|
+
icon,
|
|
1597
|
+
)
|
|
1598
|
+
|
|
1599
|
+
|
|
1600
|
+
def tabs(
|
|
1601
|
+
name: str,
|
|
1602
|
+
value: Optional[str] = None,
|
|
1603
|
+
items: Optional[List[Tab]] = None,
|
|
1604
|
+
width: Optional[str] = None,
|
|
1605
|
+
visible: Optional[bool] = None,
|
|
1606
|
+
link: Optional[bool] = None,
|
|
1607
|
+
) -> Component:
|
|
1608
|
+
"""Create a tab bar.
|
|
1609
|
+
|
|
1610
|
+
Args:
|
|
1611
|
+
name: An identifying name for this component.
|
|
1612
|
+
value: The name of the tab to select initially.
|
|
1613
|
+
items: The tabs in this tab bar.
|
|
1614
|
+
width: The width of the tabs, e.g. '100px'.
|
|
1615
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1616
|
+
link: True if tabs should be rendered as links instead of buttons.
|
|
1617
|
+
Returns:
|
|
1618
|
+
A `h2o_wave.types.Tabs` instance.
|
|
1619
|
+
"""
|
|
1620
|
+
return Component(tabs=Tabs(
|
|
1621
|
+
name,
|
|
1622
|
+
value,
|
|
1623
|
+
items,
|
|
1624
|
+
width,
|
|
1625
|
+
visible,
|
|
1626
|
+
link,
|
|
1627
|
+
))
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
def expander(
|
|
1631
|
+
name: str,
|
|
1632
|
+
label: Optional[str] = None,
|
|
1633
|
+
expanded: Optional[bool] = None,
|
|
1634
|
+
items: Optional[List[Component]] = None,
|
|
1635
|
+
width: Optional[str] = None,
|
|
1636
|
+
visible: Optional[bool] = None,
|
|
1637
|
+
) -> Component:
|
|
1638
|
+
"""Creates a new expander.
|
|
1639
|
+
|
|
1640
|
+
Expanders can be used to show or hide a group of related components.
|
|
1641
|
+
|
|
1642
|
+
Args:
|
|
1643
|
+
name: An identifying name for this component.
|
|
1644
|
+
label: The text displayed on the expander.
|
|
1645
|
+
expanded: True if expanded, False if collapsed.
|
|
1646
|
+
items: List of components to be hideable by the expander.
|
|
1647
|
+
width: The width of the expander, e.g. '100px'. Defaults to '100%'.
|
|
1648
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1649
|
+
Returns:
|
|
1650
|
+
A `h2o_wave.types.Expander` instance.
|
|
1651
|
+
"""
|
|
1652
|
+
return Component(expander=Expander(
|
|
1653
|
+
name,
|
|
1654
|
+
label,
|
|
1655
|
+
expanded,
|
|
1656
|
+
items,
|
|
1657
|
+
width,
|
|
1658
|
+
visible,
|
|
1659
|
+
))
|
|
1660
|
+
|
|
1661
|
+
|
|
1662
|
+
def frame(
|
|
1663
|
+
path: Optional[str] = None,
|
|
1664
|
+
content: Optional[str] = None,
|
|
1665
|
+
width: Optional[str] = None,
|
|
1666
|
+
height: Optional[str] = None,
|
|
1667
|
+
name: Optional[str] = None,
|
|
1668
|
+
visible: Optional[bool] = None,
|
|
1669
|
+
) -> Component:
|
|
1670
|
+
"""Create a new inline frame (an `iframe`).
|
|
1671
|
+
|
|
1672
|
+
Args:
|
|
1673
|
+
path: The path or URL of the web page, e.g. `/foo.html` or `http://example.com/foo.html`
|
|
1674
|
+
content: The HTML content of the page. A string containing `<html>...</html>`.
|
|
1675
|
+
width: The width of the frame, e.g. `200px`, `50%`, etc. Defaults to '100%'.
|
|
1676
|
+
height: The height of the frame, e.g. `200px`, `50%`, etc. Defaults to '150px'.
|
|
1677
|
+
name: An identifying name for this component.
|
|
1678
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1679
|
+
Returns:
|
|
1680
|
+
A `h2o_wave.types.Frame` instance.
|
|
1681
|
+
"""
|
|
1682
|
+
return Component(frame=Frame(
|
|
1683
|
+
path,
|
|
1684
|
+
content,
|
|
1685
|
+
width,
|
|
1686
|
+
height,
|
|
1687
|
+
name,
|
|
1688
|
+
visible,
|
|
1689
|
+
))
|
|
1690
|
+
|
|
1691
|
+
|
|
1692
|
+
def markup(
|
|
1693
|
+
content: str,
|
|
1694
|
+
name: Optional[str] = None,
|
|
1695
|
+
width: Optional[str] = None,
|
|
1696
|
+
visible: Optional[bool] = None,
|
|
1697
|
+
) -> Component:
|
|
1698
|
+
"""Render HTML content.
|
|
1699
|
+
|
|
1700
|
+
Args:
|
|
1701
|
+
content: The HTML content.
|
|
1702
|
+
name: An identifying name for this component.
|
|
1703
|
+
width: The width of the markup, e.g. '100px'.
|
|
1704
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1705
|
+
Returns:
|
|
1706
|
+
A `h2o_wave.types.Markup` instance.
|
|
1707
|
+
"""
|
|
1708
|
+
return Component(markup=Markup(
|
|
1709
|
+
content,
|
|
1710
|
+
name,
|
|
1711
|
+
width,
|
|
1712
|
+
visible,
|
|
1713
|
+
))
|
|
1714
|
+
|
|
1715
|
+
|
|
1716
|
+
def template(
|
|
1717
|
+
content: str,
|
|
1718
|
+
data: Optional[PackedRecord] = None,
|
|
1719
|
+
name: Optional[str] = None,
|
|
1720
|
+
width: Optional[str] = None,
|
|
1721
|
+
visible: Optional[bool] = None,
|
|
1722
|
+
) -> Component:
|
|
1723
|
+
"""Render dynamic content using an HTML template.
|
|
1724
|
+
|
|
1725
|
+
Args:
|
|
1726
|
+
content: The Handlebars template. https://handlebarsjs.com/guide/
|
|
1727
|
+
data: Data for the Handlebars template
|
|
1728
|
+
name: An identifying name for this component.
|
|
1729
|
+
width: The width of the template, e.g. '100px'.
|
|
1730
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1731
|
+
Returns:
|
|
1732
|
+
A `h2o_wave.types.Template` instance.
|
|
1733
|
+
"""
|
|
1734
|
+
return Component(template=Template(
|
|
1735
|
+
content,
|
|
1736
|
+
data,
|
|
1737
|
+
name,
|
|
1738
|
+
width,
|
|
1739
|
+
visible,
|
|
1740
|
+
))
|
|
1741
|
+
|
|
1742
|
+
|
|
1743
|
+
def picker(
|
|
1744
|
+
name: str,
|
|
1745
|
+
choices: List[Choice],
|
|
1746
|
+
label: Optional[str] = None,
|
|
1747
|
+
values: Optional[List[str]] = None,
|
|
1748
|
+
max_choices: Optional[int] = None,
|
|
1749
|
+
required: Optional[bool] = None,
|
|
1750
|
+
disabled: Optional[bool] = None,
|
|
1751
|
+
width: Optional[str] = None,
|
|
1752
|
+
visible: Optional[bool] = None,
|
|
1753
|
+
trigger: Optional[bool] = None,
|
|
1754
|
+
tooltip: Optional[str] = None,
|
|
1755
|
+
) -> Component:
|
|
1756
|
+
"""Create a picker.
|
|
1757
|
+
Pickers are used to select one or more choices, such as tags or files, from a list.
|
|
1758
|
+
Use a picker to allow the user to quickly search for or manage a few tags or files.
|
|
1759
|
+
|
|
1760
|
+
Args:
|
|
1761
|
+
name: An identifying name for this component.
|
|
1762
|
+
choices: The choices to be presented.
|
|
1763
|
+
label: Text to be displayed above the component.
|
|
1764
|
+
values: The names of the selected choices.
|
|
1765
|
+
max_choices: Maximum number of selectable choices.
|
|
1766
|
+
required: True if the picker is a required field.
|
|
1767
|
+
disabled: Controls whether the picker should be disabled or not.
|
|
1768
|
+
width: The width of the picker, e.g. '100px'. Defaults to '100%'.
|
|
1769
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1770
|
+
trigger: True if the form should be submitted when the picker value changes.
|
|
1771
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
1772
|
+
Returns:
|
|
1773
|
+
A `h2o_wave.types.Picker` instance.
|
|
1774
|
+
"""
|
|
1775
|
+
return Component(picker=Picker(
|
|
1776
|
+
name,
|
|
1777
|
+
choices,
|
|
1778
|
+
label,
|
|
1779
|
+
values,
|
|
1780
|
+
max_choices,
|
|
1781
|
+
required,
|
|
1782
|
+
disabled,
|
|
1783
|
+
width,
|
|
1784
|
+
visible,
|
|
1785
|
+
trigger,
|
|
1786
|
+
tooltip,
|
|
1787
|
+
))
|
|
1788
|
+
|
|
1789
|
+
|
|
1790
|
+
def range_slider(
|
|
1791
|
+
name: str,
|
|
1792
|
+
label: Optional[str] = None,
|
|
1793
|
+
min: Optional[float] = None,
|
|
1794
|
+
max: Optional[float] = None,
|
|
1795
|
+
step: Optional[float] = None,
|
|
1796
|
+
min_value: Optional[float] = None,
|
|
1797
|
+
max_value: Optional[float] = None,
|
|
1798
|
+
disabled: Optional[bool] = None,
|
|
1799
|
+
width: Optional[str] = None,
|
|
1800
|
+
trigger: Optional[bool] = None,
|
|
1801
|
+
visible: Optional[bool] = None,
|
|
1802
|
+
tooltip: Optional[str] = None,
|
|
1803
|
+
) -> Component:
|
|
1804
|
+
"""Create a range slider.
|
|
1805
|
+
|
|
1806
|
+
A range slider is an element used to select a value range. It provides a visual indication of adjustable content, as well as the
|
|
1807
|
+
current setting in the total range of content. It is displayed as a horizontal track with options on either side.
|
|
1808
|
+
Knobs or levers are dragged to one end or the other to make the choice, indicating the current max and min value.
|
|
1809
|
+
|
|
1810
|
+
Args:
|
|
1811
|
+
name: An identifying name for this component.
|
|
1812
|
+
label: Text to be displayed alongside the component.
|
|
1813
|
+
min: The minimum value of the slider. Defaults to 0.
|
|
1814
|
+
max: The maximum value of the slider. Defaults to 100.
|
|
1815
|
+
step: The difference between two adjacent values of the slider.
|
|
1816
|
+
min_value: The lower bound of the selected range.
|
|
1817
|
+
max_value: The upper bound of the selected range. Default value is `max`.
|
|
1818
|
+
disabled: True if this field is disabled.
|
|
1819
|
+
width: The width of the range slider, e.g. '100px'. Defaults to '100%'.
|
|
1820
|
+
trigger: True if the form should be submitted when the slider value changes.
|
|
1821
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1822
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
1823
|
+
Returns:
|
|
1824
|
+
A `h2o_wave.types.RangeSlider` instance.
|
|
1825
|
+
"""
|
|
1826
|
+
return Component(range_slider=RangeSlider(
|
|
1827
|
+
name,
|
|
1828
|
+
label,
|
|
1829
|
+
min,
|
|
1830
|
+
max,
|
|
1831
|
+
step,
|
|
1832
|
+
min_value,
|
|
1833
|
+
max_value,
|
|
1834
|
+
disabled,
|
|
1835
|
+
width,
|
|
1836
|
+
trigger,
|
|
1837
|
+
visible,
|
|
1838
|
+
tooltip,
|
|
1839
|
+
))
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
def step(
|
|
1843
|
+
label: str,
|
|
1844
|
+
icon: Optional[str] = None,
|
|
1845
|
+
done: Optional[bool] = None,
|
|
1846
|
+
) -> Step:
|
|
1847
|
+
"""Create a step for a stepper.
|
|
1848
|
+
|
|
1849
|
+
Args:
|
|
1850
|
+
label: Text displayed below icon.
|
|
1851
|
+
icon: Icon to be displayed.
|
|
1852
|
+
done: Indicates whether this step has already been completed.
|
|
1853
|
+
Returns:
|
|
1854
|
+
A `h2o_wave.types.Step` instance.
|
|
1855
|
+
"""
|
|
1856
|
+
return Step(
|
|
1857
|
+
label,
|
|
1858
|
+
icon,
|
|
1859
|
+
done,
|
|
1860
|
+
)
|
|
1861
|
+
|
|
1862
|
+
|
|
1863
|
+
def stepper(
|
|
1864
|
+
name: str,
|
|
1865
|
+
items: List[Step],
|
|
1866
|
+
width: Optional[str] = None,
|
|
1867
|
+
visible: Optional[bool] = None,
|
|
1868
|
+
tooltip: Optional[str] = None,
|
|
1869
|
+
) -> Component:
|
|
1870
|
+
"""Create a component that displays a sequence of steps in a process.
|
|
1871
|
+
The steps keep users informed about where they are in the process and how much is left to complete.
|
|
1872
|
+
|
|
1873
|
+
Args:
|
|
1874
|
+
name: An identifying name for this component.
|
|
1875
|
+
items: The sequence of steps to be displayed.
|
|
1876
|
+
width: The width of the stepper, e.g. '100px'. Defaults to '100%'.
|
|
1877
|
+
visible: True if the component should be visible. Defaults to True.
|
|
1878
|
+
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
1879
|
+
Returns:
|
|
1880
|
+
A `h2o_wave.types.Stepper` instance.
|
|
1881
|
+
"""
|
|
1882
|
+
return Component(stepper=Stepper(
|
|
1883
|
+
name,
|
|
1884
|
+
items,
|
|
1885
|
+
width,
|
|
1886
|
+
visible,
|
|
1887
|
+
tooltip,
|
|
1888
|
+
))
|
|
1889
|
+
|
|
1890
|
+
|
|
1891
|
+
def mark(
|
|
1892
|
+
coord: Optional[str] = None,
|
|
1893
|
+
type: Optional[str] = None,
|
|
1894
|
+
x: Optional[Value] = None,
|
|
1895
|
+
x0: Optional[Value] = None,
|
|
1896
|
+
x1: Optional[Value] = None,
|
|
1897
|
+
x2: Optional[Value] = None,
|
|
1898
|
+
x_q1: Optional[Value] = None,
|
|
1899
|
+
x_q2: Optional[Value] = None,
|
|
1900
|
+
x_q3: Optional[Value] = None,
|
|
1901
|
+
x_min: Optional[float] = None,
|
|
1902
|
+
x_max: Optional[float] = None,
|
|
1903
|
+
x_nice: Optional[bool] = None,
|
|
1904
|
+
x_scale: Optional[str] = None,
|
|
1905
|
+
x_title: Optional[str] = None,
|
|
1906
|
+
y: Optional[Value] = None,
|
|
1907
|
+
y0: Optional[Value] = None,
|
|
1908
|
+
y1: Optional[Value] = None,
|
|
1909
|
+
y2: Optional[Value] = None,
|
|
1910
|
+
y_q1: Optional[Value] = None,
|
|
1911
|
+
y_q2: Optional[Value] = None,
|
|
1912
|
+
y_q3: Optional[Value] = None,
|
|
1913
|
+
y_min: Optional[float] = None,
|
|
1914
|
+
y_max: Optional[float] = None,
|
|
1915
|
+
y_nice: Optional[bool] = None,
|
|
1916
|
+
y_scale: Optional[str] = None,
|
|
1917
|
+
y_title: Optional[str] = None,
|
|
1918
|
+
color: Optional[str] = None,
|
|
1919
|
+
color_range: Optional[str] = None,
|
|
1920
|
+
color_domain: Optional[List[str]] = None,
|
|
1921
|
+
shape: Optional[str] = None,
|
|
1922
|
+
shape_range: Optional[str] = None,
|
|
1923
|
+
size: Optional[Value] = None,
|
|
1924
|
+
size_range: Optional[str] = None,
|
|
1925
|
+
stack: Optional[str] = None,
|
|
1926
|
+
dodge: Optional[str] = None,
|
|
1927
|
+
curve: Optional[str] = None,
|
|
1928
|
+
fill_color: Optional[str] = None,
|
|
1929
|
+
fill_opacity: Optional[float] = None,
|
|
1930
|
+
stroke_color: Optional[str] = None,
|
|
1931
|
+
stroke_opacity: Optional[float] = None,
|
|
1932
|
+
stroke_size: Optional[float] = None,
|
|
1933
|
+
stroke_dash: Optional[str] = None,
|
|
1934
|
+
label: Optional[str] = None,
|
|
1935
|
+
label_offset: Optional[float] = None,
|
|
1936
|
+
label_offset_x: Optional[float] = None,
|
|
1937
|
+
label_offset_y: Optional[float] = None,
|
|
1938
|
+
label_rotation: Optional[str] = None,
|
|
1939
|
+
label_position: Optional[str] = None,
|
|
1940
|
+
label_overlap: Optional[str] = None,
|
|
1941
|
+
label_fill_color: Optional[str] = None,
|
|
1942
|
+
label_fill_opacity: Optional[float] = None,
|
|
1943
|
+
label_stroke_color: Optional[str] = None,
|
|
1944
|
+
label_stroke_opacity: Optional[float] = None,
|
|
1945
|
+
label_stroke_size: Optional[float] = None,
|
|
1946
|
+
label_font_size: Optional[float] = None,
|
|
1947
|
+
label_font_weight: Optional[str] = None,
|
|
1948
|
+
label_line_height: Optional[float] = None,
|
|
1949
|
+
label_align: Optional[str] = None,
|
|
1950
|
+
ref_stroke_color: Optional[str] = None,
|
|
1951
|
+
ref_stroke_opacity: Optional[float] = None,
|
|
1952
|
+
ref_stroke_size: Optional[float] = None,
|
|
1953
|
+
ref_stroke_dash: Optional[str] = None,
|
|
1954
|
+
interactive: Optional[bool] = None,
|
|
1955
|
+
) -> Mark:
|
|
1956
|
+
"""Create a specification for a layer of graphical marks such as bars, lines, points for a plot.
|
|
1957
|
+
A plot can contain multiple such layers of marks.
|
|
1958
|
+
|
|
1959
|
+
Args:
|
|
1960
|
+
coord: Coordinate system. `rect` is synonymous to `cartesian`. `theta` is transposed `polar`. One of 'rect', 'cartesian', 'polar', 'theta', 'helix'. See enum h2o_wave.ui.MarkCoord.
|
|
1961
|
+
type: Graphical geometry. One of 'interval', 'line', 'path', 'point', 'area', 'polygon', 'schema', 'edge', 'heatmap'. See enum h2o_wave.ui.MarkType.
|
|
1962
|
+
x: X field or value.
|
|
1963
|
+
x0: X base field or value.
|
|
1964
|
+
x1: X bin lower bound field or value. For histograms and box plots.
|
|
1965
|
+
x2: X bin upper bound field or value. For histograms and box plots.
|
|
1966
|
+
x_q1: X lower quartile. For box plots.
|
|
1967
|
+
x_q2: X median. For box plots.
|
|
1968
|
+
x_q3: X upper quartile. For box plots.
|
|
1969
|
+
x_min: X axis scale minimum.
|
|
1970
|
+
x_max: X axis scale maximum.
|
|
1971
|
+
x_nice: Whether to nice X axis scale ticks.
|
|
1972
|
+
x_scale: X axis scale type. One of 'linear', 'cat', 'category', 'identity', 'log', 'pow', 'power', 'time', 'time-category', 'quantize', 'quantile'. See enum h2o_wave.ui.MarkXScale.
|
|
1973
|
+
x_title: X axis title.
|
|
1974
|
+
y: Y field or value.
|
|
1975
|
+
y0: Y base field or value.
|
|
1976
|
+
y1: Y bin lower bound field or value. For histograms and box plots.
|
|
1977
|
+
y2: Y bin upper bound field or value. For histograms and box plots.
|
|
1978
|
+
y_q1: Y lower quartile. For box plots.
|
|
1979
|
+
y_q2: Y median. For box plots.
|
|
1980
|
+
y_q3: Y upper quartile. For box plots.
|
|
1981
|
+
y_min: Y axis scale minimum.
|
|
1982
|
+
y_max: Y axis scale maximum.
|
|
1983
|
+
y_nice: Whether to nice Y axis scale ticks.
|
|
1984
|
+
y_scale: Y axis scale type. One of 'linear', 'cat', 'category', 'identity', 'log', 'pow', 'power', 'time', 'time-category', 'quantize', 'quantile'. See enum h2o_wave.ui.MarkYScale.
|
|
1985
|
+
y_title: Y axis title.
|
|
1986
|
+
color: Mark color field or value.
|
|
1987
|
+
color_range: Mark color range for multi-series plots. A string containing space-separated colors, e.g. `'#fee8c8 #fdbb84 #e34a33'`
|
|
1988
|
+
color_domain: The unique values in the data (labels or categories or classes) to map colors to, e.g. `['high', 'medium', 'low']`. If this is not provided, the unique values are automatically inferred from the `color` attribute.
|
|
1989
|
+
shape: Mark shape field or value for `point` mark types. Possible values are 'circle', 'square', 'bowtie', 'diamond', 'hexagon', 'triangle', 'triangle-down', 'cross', 'tick', 'plus', 'hyphen', 'line'.
|
|
1990
|
+
shape_range: Mark shape range for multi-series plots using `point` mark types. A string containing space-separated shapes, e.g. `'circle square diamond'`
|
|
1991
|
+
size: Mark size field or value.
|
|
1992
|
+
size_range: Mark size range. A string containing space-separated integers, e.g. `'4 30'`
|
|
1993
|
+
stack: Field to stack marks by, or 'auto' to infer.
|
|
1994
|
+
dodge: Field to dodge marks by, or 'auto' to infer.
|
|
1995
|
+
curve: Curve type for `line` and `area` mark types. One of 'none', 'smooth', 'step-before', 'step', 'step-after'. See enum h2o_wave.ui.MarkCurve.
|
|
1996
|
+
fill_color: Mark fill color.
|
|
1997
|
+
fill_opacity: Mark fill opacity.
|
|
1998
|
+
stroke_color: Mark stroke color.
|
|
1999
|
+
stroke_opacity: Mark stroke opacity.
|
|
2000
|
+
stroke_size: Mark stroke size.
|
|
2001
|
+
stroke_dash: Mark stroke dash style. A string containing space-separated integers that specify distances to alternately draw a line and a gap (in coordinate space units). If the number of elements in the array is odd, the elements of the array get copied and concatenated. For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25].
|
|
2002
|
+
label: Label field or value.
|
|
2003
|
+
label_offset: Distance between label and mark.
|
|
2004
|
+
label_offset_x: Horizontal distance between label and mark.
|
|
2005
|
+
label_offset_y: Vertical distance between label and mark.
|
|
2006
|
+
label_rotation: Label rotation angle, in degrees, or 'none' to disable automatic rotation. The default behavior is 'auto' for automatic rotation.
|
|
2007
|
+
label_position: Label position relative to the mark. One of 'top', 'bottom', 'middle', 'left', 'right'. See enum h2o_wave.ui.MarkLabelPosition.
|
|
2008
|
+
label_overlap: Strategy to use if labels overlap. One of 'hide', 'overlap', 'constrain'. See enum h2o_wave.ui.MarkLabelOverlap.
|
|
2009
|
+
label_fill_color: Label fill color.
|
|
2010
|
+
label_fill_opacity: Label fill opacity.
|
|
2011
|
+
label_stroke_color: Label stroke color.
|
|
2012
|
+
label_stroke_opacity: Label stroke opacity.
|
|
2013
|
+
label_stroke_size: Label stroke size (line width or pen thickness).
|
|
2014
|
+
label_font_size: Label font size.
|
|
2015
|
+
label_font_weight: Label font weight.
|
|
2016
|
+
label_line_height: Label line height.
|
|
2017
|
+
label_align: Label text alignment. One of 'left', 'right', 'center', 'start', 'end'. See enum h2o_wave.ui.MarkLabelAlign.
|
|
2018
|
+
ref_stroke_color: Reference line stroke color.
|
|
2019
|
+
ref_stroke_opacity: Reference line stroke opacity.
|
|
2020
|
+
ref_stroke_size: Reference line stroke size (line width or pen thickness).
|
|
2021
|
+
ref_stroke_dash: Reference line stroke dash style. A string containing space-separated integers that specify distances to alternately draw a line and a gap (in coordinate space units). If the number of elements in the array is odd, the elements of the array get copied and concatenated. For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25].
|
|
2022
|
+
interactive: Defines whether to raise events on interactions with the mark. Defaults to True.
|
|
2023
|
+
Returns:
|
|
2024
|
+
A `h2o_wave.types.Mark` instance.
|
|
2025
|
+
"""
|
|
2026
|
+
return Mark(
|
|
2027
|
+
coord,
|
|
2028
|
+
type,
|
|
2029
|
+
x,
|
|
2030
|
+
x0,
|
|
2031
|
+
x1,
|
|
2032
|
+
x2,
|
|
2033
|
+
x_q1,
|
|
2034
|
+
x_q2,
|
|
2035
|
+
x_q3,
|
|
2036
|
+
x_min,
|
|
2037
|
+
x_max,
|
|
2038
|
+
x_nice,
|
|
2039
|
+
x_scale,
|
|
2040
|
+
x_title,
|
|
2041
|
+
y,
|
|
2042
|
+
y0,
|
|
2043
|
+
y1,
|
|
2044
|
+
y2,
|
|
2045
|
+
y_q1,
|
|
2046
|
+
y_q2,
|
|
2047
|
+
y_q3,
|
|
2048
|
+
y_min,
|
|
2049
|
+
y_max,
|
|
2050
|
+
y_nice,
|
|
2051
|
+
y_scale,
|
|
2052
|
+
y_title,
|
|
2053
|
+
color,
|
|
2054
|
+
color_range,
|
|
2055
|
+
color_domain,
|
|
2056
|
+
shape,
|
|
2057
|
+
shape_range,
|
|
2058
|
+
size,
|
|
2059
|
+
size_range,
|
|
2060
|
+
stack,
|
|
2061
|
+
dodge,
|
|
2062
|
+
curve,
|
|
2063
|
+
fill_color,
|
|
2064
|
+
fill_opacity,
|
|
2065
|
+
stroke_color,
|
|
2066
|
+
stroke_opacity,
|
|
2067
|
+
stroke_size,
|
|
2068
|
+
stroke_dash,
|
|
2069
|
+
label,
|
|
2070
|
+
label_offset,
|
|
2071
|
+
label_offset_x,
|
|
2072
|
+
label_offset_y,
|
|
2073
|
+
label_rotation,
|
|
2074
|
+
label_position,
|
|
2075
|
+
label_overlap,
|
|
2076
|
+
label_fill_color,
|
|
2077
|
+
label_fill_opacity,
|
|
2078
|
+
label_stroke_color,
|
|
2079
|
+
label_stroke_opacity,
|
|
2080
|
+
label_stroke_size,
|
|
2081
|
+
label_font_size,
|
|
2082
|
+
label_font_weight,
|
|
2083
|
+
label_line_height,
|
|
2084
|
+
label_align,
|
|
2085
|
+
ref_stroke_color,
|
|
2086
|
+
ref_stroke_opacity,
|
|
2087
|
+
ref_stroke_size,
|
|
2088
|
+
ref_stroke_dash,
|
|
2089
|
+
interactive,
|
|
2090
|
+
)
|
|
2091
|
+
|
|
2092
|
+
|
|
2093
|
+
def plot(
|
|
2094
|
+
marks: List[Mark],
|
|
2095
|
+
) -> Plot:
|
|
2096
|
+
"""Create a plot. A plot is composed of one or more graphical mark layers.
|
|
2097
|
+
|
|
2098
|
+
Args:
|
|
2099
|
+
marks: The graphical mark layers contained in this plot.
|
|
2100
|
+
Returns:
|
|
2101
|
+
A `h2o_wave.types.Plot` instance.
|
|
2102
|
+
"""
|
|
2103
|
+
return Plot(
|
|
2104
|
+
marks,
|
|
2105
|
+
)
|
|
2106
|
+
|
|
2107
|
+
|
|
2108
|
+
def visualization(
|
|
2109
|
+
plot: Plot,
|
|
2110
|
+
data: PackedRecord,
|
|
2111
|
+
width: Optional[str] = None,
|
|
2112
|
+
height: Optional[str] = None,
|
|
2113
|
+
name: Optional[str] = None,
|
|
2114
|
+
visible: Optional[bool] = None,
|
|
2115
|
+
events: Optional[List[str]] = None,
|
|
2116
|
+
interactions: Optional[List[str]] = None,
|
|
2117
|
+
animate: Optional[bool] = None,
|
|
2118
|
+
) -> Component:
|
|
2119
|
+
"""Create a visualization for display inside a form.
|
|
2120
|
+
|
|
2121
|
+
Args:
|
|
2122
|
+
plot: The plot to be rendered in this visualization.
|
|
2123
|
+
data: Data for this visualization.
|
|
2124
|
+
width: The width of the visualization. Defaults to '100%'.
|
|
2125
|
+
height: The hight of the visualization. Defaults to '300px'.
|
|
2126
|
+
name: An identifying name for this component.
|
|
2127
|
+
visible: True if the component should be visible. Defaults to True.
|
|
2128
|
+
events: The events to capture on this visualization. One of 'select_marks'.
|
|
2129
|
+
interactions: The interactions to be allowed for this plot. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event.
|
|
2130
|
+
animate: EXPERIMENTAL: True to turn on the chart animations. Defaults to False.
|
|
2131
|
+
Returns:
|
|
2132
|
+
A `h2o_wave.types.Visualization` instance.
|
|
2133
|
+
"""
|
|
2134
|
+
return Component(visualization=Visualization(
|
|
2135
|
+
plot,
|
|
2136
|
+
data,
|
|
2137
|
+
width,
|
|
2138
|
+
height,
|
|
2139
|
+
name,
|
|
2140
|
+
visible,
|
|
2141
|
+
events,
|
|
2142
|
+
interactions,
|
|
2143
|
+
animate,
|
|
2144
|
+
))
|
|
2145
|
+
|
|
2146
|
+
|
|
2147
|
+
def vega_visualization(
|
|
2148
|
+
specification: str,
|
|
2149
|
+
data: Optional[PackedRecord] = None,
|
|
2150
|
+
width: Optional[str] = None,
|
|
2151
|
+
height: Optional[str] = None,
|
|
2152
|
+
name: Optional[str] = None,
|
|
2153
|
+
visible: Optional[bool] = None,
|
|
2154
|
+
grammar: Optional[str] = None,
|
|
2155
|
+
) -> Component:
|
|
2156
|
+
"""Create a Vega-lite plot for display inside a form.
|
|
2157
|
+
|
|
2158
|
+
Args:
|
|
2159
|
+
specification: The Vega-lite specification.
|
|
2160
|
+
data: Data for the plot, if any.
|
|
2161
|
+
width: The width of the visualization. Defaults to '100%'.
|
|
2162
|
+
height: The height of the visualization. Defaults to '300px'.
|
|
2163
|
+
name: An identifying name for this component.
|
|
2164
|
+
visible: True if the component should be visible. Defaults to True.
|
|
2165
|
+
grammar: Vega grammar to use. Defaults to 'vega-lite'. One of 'vega-lite', 'vega'. See enum h2o_wave.ui.VegaVisualizationGrammar.
|
|
2166
|
+
Returns:
|
|
2167
|
+
A `h2o_wave.types.VegaVisualization` instance.
|
|
2168
|
+
"""
|
|
2169
|
+
return Component(vega_visualization=VegaVisualization(
|
|
2170
|
+
specification,
|
|
2171
|
+
data,
|
|
2172
|
+
width,
|
|
2173
|
+
height,
|
|
2174
|
+
name,
|
|
2175
|
+
visible,
|
|
2176
|
+
grammar,
|
|
2177
|
+
))
|
|
2178
|
+
|
|
2179
|
+
|
|
2180
|
+
def stat(
|
|
2181
|
+
label: str,
|
|
2182
|
+
value: Optional[str] = None,
|
|
2183
|
+
caption: Optional[str] = None,
|
|
2184
|
+
icon: Optional[str] = None,
|
|
2185
|
+
icon_color: Optional[str] = None,
|
|
2186
|
+
name: Optional[str] = None,
|
|
2187
|
+
) -> Stat:
|
|
2188
|
+
"""Create a stat (a label-value pair) for displaying a metric.
|
|
2189
|
+
|
|
2190
|
+
Args:
|
|
2191
|
+
label: The label for the metric.
|
|
2192
|
+
value: The value of the metric.
|
|
2193
|
+
caption: The caption displayed below the primary value.
|
|
2194
|
+
icon: An optional icon, displayed next to the label.
|
|
2195
|
+
icon_color: The color of the icon.
|
|
2196
|
+
name: An identifying name for this item.
|
|
2197
|
+
Returns:
|
|
2198
|
+
A `h2o_wave.types.Stat` instance.
|
|
2199
|
+
"""
|
|
2200
|
+
return Stat(
|
|
2201
|
+
label,
|
|
2202
|
+
value,
|
|
2203
|
+
caption,
|
|
2204
|
+
icon,
|
|
2205
|
+
icon_color,
|
|
2206
|
+
name,
|
|
2207
|
+
)
|
|
2208
|
+
|
|
2209
|
+
|
|
2210
|
+
def stats(
|
|
2211
|
+
items: List[Stat],
|
|
2212
|
+
justify: Optional[str] = None,
|
|
2213
|
+
inset: Optional[bool] = None,
|
|
2214
|
+
width: Optional[str] = None,
|
|
2215
|
+
visible: Optional[bool] = None,
|
|
2216
|
+
name: Optional[str] = None,
|
|
2217
|
+
) -> Component:
|
|
2218
|
+
"""Create a set of stats laid out horizontally.
|
|
2219
|
+
|
|
2220
|
+
Args:
|
|
2221
|
+
items: The individual stats to be displayed.
|
|
2222
|
+
justify: Specifies how to lay out the individual stats. Defaults to 'start'. One of 'start', 'end', 'center', 'between', 'around'. See enum h2o_wave.ui.StatsJustify.
|
|
2223
|
+
inset: Whether to display the stats with a contrasting background.
|
|
2224
|
+
width: The width of the stats, e.g. '100px'.
|
|
2225
|
+
visible: True if the component should be visible. Defaults to True.
|
|
2226
|
+
name: An identifying name for this component.
|
|
2227
|
+
Returns:
|
|
2228
|
+
A `h2o_wave.types.Stats` instance.
|
|
2229
|
+
"""
|
|
2230
|
+
return Component(stats=Stats(
|
|
2231
|
+
items,
|
|
2232
|
+
justify,
|
|
2233
|
+
inset,
|
|
2234
|
+
width,
|
|
2235
|
+
visible,
|
|
2236
|
+
name,
|
|
2237
|
+
))
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
def inline(
|
|
2241
|
+
items: List[Component],
|
|
2242
|
+
justify: Optional[str] = None,
|
|
2243
|
+
align: Optional[str] = None,
|
|
2244
|
+
inset: Optional[bool] = None,
|
|
2245
|
+
height: Optional[str] = None,
|
|
2246
|
+
direction: Optional[str] = None,
|
|
2247
|
+
) -> Component:
|
|
2248
|
+
"""Create an inline (horizontal) list of components.
|
|
2249
|
+
|
|
2250
|
+
Args:
|
|
2251
|
+
items: The components laid out inline.
|
|
2252
|
+
justify: Specifies how to lay out the individual components. Defaults to 'start'. One of 'start', 'end', 'center', 'between', 'around'. See enum h2o_wave.ui.InlineJustify.
|
|
2253
|
+
align: Specifies how the individual components are aligned on the vertical axis. Defaults to 'center'. One of 'start', 'end', 'center', 'baseline'. See enum h2o_wave.ui.InlineAlign.
|
|
2254
|
+
inset: Whether to display the components inset from the parent form, with a contrasting background.
|
|
2255
|
+
height: Height of the inline container. Accepts any valid CSS unit e.g. '100vh', '300px'. Use '1' to fill the remaining card space.
|
|
2256
|
+
direction: Container direction. Defaults to 'row'. One of 'row', 'column'. See enum h2o_wave.ui.InlineDirection.
|
|
2257
|
+
Returns:
|
|
2258
|
+
A `h2o_wave.types.Inline` instance.
|
|
2259
|
+
"""
|
|
2260
|
+
return Component(inline=Inline(
|
|
2261
|
+
items,
|
|
2262
|
+
justify,
|
|
2263
|
+
align,
|
|
2264
|
+
inset,
|
|
2265
|
+
height,
|
|
2266
|
+
direction,
|
|
2267
|
+
))
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
def image(
|
|
2271
|
+
title: str,
|
|
2272
|
+
type: Optional[str] = None,
|
|
2273
|
+
image: Optional[str] = None,
|
|
2274
|
+
path: Optional[str] = None,
|
|
2275
|
+
width: Optional[str] = None,
|
|
2276
|
+
visible: Optional[bool] = None,
|
|
2277
|
+
path_popup: Optional[str] = None,
|
|
2278
|
+
) -> Component:
|
|
2279
|
+
"""Create an image.
|
|
2280
|
+
|
|
2281
|
+
Args:
|
|
2282
|
+
title: The image title, typically displayed as a tooltip.
|
|
2283
|
+
type: The image MIME subtype. One of `apng`, `bmp`, `gif`, `x-icon`, `jpeg`, `png`, `webp`. Required only if `image` is set.
|
|
2284
|
+
image: Image data, base64-encoded.
|
|
2285
|
+
path: The path or URL or data URL of the image, e.g. `/foo.png` or `http://example.com/foo.png` or `data:image/png;base64,???`.
|
|
2286
|
+
width: The width of the image, e.g. '100px'.
|
|
2287
|
+
visible: True if the component should be visible. Defaults to True.
|
|
2288
|
+
path_popup: The path or URL or data URL of the image displayed in the popup after clicking the image. Does not replace the `path` property.
|
|
2289
|
+
Returns:
|
|
2290
|
+
A `h2o_wave.types.Image` instance.
|
|
2291
|
+
"""
|
|
2292
|
+
return Component(image=Image(
|
|
2293
|
+
title,
|
|
2294
|
+
type,
|
|
2295
|
+
image,
|
|
2296
|
+
path,
|
|
2297
|
+
width,
|
|
2298
|
+
visible,
|
|
2299
|
+
path_popup,
|
|
2300
|
+
))
|
|
2301
|
+
|
|
2302
|
+
|
|
2303
|
+
def persona(
|
|
2304
|
+
title: str,
|
|
2305
|
+
subtitle: Optional[str] = None,
|
|
2306
|
+
caption: Optional[str] = None,
|
|
2307
|
+
size: Optional[str] = None,
|
|
2308
|
+
image: Optional[str] = None,
|
|
2309
|
+
initials: Optional[str] = None,
|
|
2310
|
+
initials_color: Optional[str] = None,
|
|
2311
|
+
name: Optional[str] = None,
|
|
2312
|
+
) -> Component:
|
|
2313
|
+
"""Create an individual's persona or avatar, a visual representation of a person across products.
|
|
2314
|
+
Can be used to display an individual's avatar (or a composition of the person’s initials on a background color), their name or identification, and online status.
|
|
2315
|
+
|
|
2316
|
+
Args:
|
|
2317
|
+
title: Primary text, displayed next to the persona coin.
|
|
2318
|
+
subtitle: Secondary text, displayed under the title.
|
|
2319
|
+
caption: Tertiary text, displayed under the subtitle. Only visible for sizes >= 'm'.
|
|
2320
|
+
size: The size of the persona coin. Defaults to 'm'. One of 'xl', 'l', 'm', 's', 'xs'. See enum h2o_wave.ui.PersonaSize.
|
|
2321
|
+
image: Image, URL or base64-encoded (`data:image/png;base64,???`).
|
|
2322
|
+
initials: Initials, if `image` is not specified.
|
|
2323
|
+
initials_color: Initials background color (CSS-compatible string).
|
|
2324
|
+
name: An identifying name for this component.
|
|
2325
|
+
Returns:
|
|
2326
|
+
A `h2o_wave.types.Persona` instance.
|
|
2327
|
+
"""
|
|
2328
|
+
return Component(persona=Persona(
|
|
2329
|
+
title,
|
|
2330
|
+
subtitle,
|
|
2331
|
+
caption,
|
|
2332
|
+
size,
|
|
2333
|
+
image,
|
|
2334
|
+
initials,
|
|
2335
|
+
initials_color,
|
|
2336
|
+
name,
|
|
2337
|
+
))
|
|
2338
|
+
|
|
2339
|
+
|
|
2340
|
+
def text_annotator_tag(
|
|
2341
|
+
name: str,
|
|
2342
|
+
label: str,
|
|
2343
|
+
color: str,
|
|
2344
|
+
) -> TextAnnotatorTag:
|
|
2345
|
+
"""Create a tag.
|
|
2346
|
+
|
|
2347
|
+
Args:
|
|
2348
|
+
name: An identifying name for this component.
|
|
2349
|
+
label: Text to be displayed for this tag.
|
|
2350
|
+
color: HEX or RGB color string used as background for highlighted phrases.
|
|
2351
|
+
Returns:
|
|
2352
|
+
A `h2o_wave.types.TextAnnotatorTag` instance.
|
|
2353
|
+
"""
|
|
2354
|
+
return TextAnnotatorTag(
|
|
2355
|
+
name,
|
|
2356
|
+
label,
|
|
2357
|
+
color,
|
|
2358
|
+
)
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
def text_annotator_item(
|
|
2362
|
+
text: str,
|
|
2363
|
+
tag: Optional[str] = None,
|
|
2364
|
+
) -> TextAnnotatorItem:
|
|
2365
|
+
"""Create an annotator item with initial selected tags or no tag for plaintext.
|
|
2366
|
+
|
|
2367
|
+
Args:
|
|
2368
|
+
text: Text to be highlighted.
|
|
2369
|
+
tag: The `name` of the text annotator tag to refer to for the `label` and `color` of this item.
|
|
2370
|
+
Returns:
|
|
2371
|
+
A `h2o_wave.types.TextAnnotatorItem` instance.
|
|
2372
|
+
"""
|
|
2373
|
+
return TextAnnotatorItem(
|
|
2374
|
+
text,
|
|
2375
|
+
tag,
|
|
2376
|
+
)
|
|
2377
|
+
|
|
2378
|
+
|
|
2379
|
+
def text_annotator(
|
|
2380
|
+
name: str,
|
|
2381
|
+
title: str,
|
|
2382
|
+
tags: List[TextAnnotatorTag],
|
|
2383
|
+
items: List[TextAnnotatorItem],
|
|
2384
|
+
trigger: Optional[bool] = None,
|
|
2385
|
+
readonly: Optional[bool] = None,
|
|
2386
|
+
) -> Component:
|
|
2387
|
+
"""Create a text annotator component.
|
|
2388
|
+
|
|
2389
|
+
The text annotator component enables user to manually annotate parts of text. Useful for NLP data prep.
|
|
2390
|
+
|
|
2391
|
+
Args:
|
|
2392
|
+
name: An identifying name for this component.
|
|
2393
|
+
title: The text annotator's title.
|
|
2394
|
+
tags: List of tags the user can annotate with.
|
|
2395
|
+
items: Pretagged parts of text content.
|
|
2396
|
+
trigger: True if the form should be submitted when the annotator value changes.
|
|
2397
|
+
readonly: True to prevent user interaction with the annotator component. Defaults to False.
|
|
2398
|
+
Returns:
|
|
2399
|
+
A `h2o_wave.types.TextAnnotator` instance.
|
|
2400
|
+
"""
|
|
2401
|
+
return Component(text_annotator=TextAnnotator(
|
|
2402
|
+
name,
|
|
2403
|
+
title,
|
|
2404
|
+
tags,
|
|
2405
|
+
items,
|
|
2406
|
+
trigger,
|
|
2407
|
+
readonly,
|
|
2408
|
+
))
|
|
2409
|
+
|
|
2410
|
+
|
|
2411
|
+
def image_annotator_tag(
|
|
2412
|
+
name: str,
|
|
2413
|
+
label: str,
|
|
2414
|
+
color: str,
|
|
2415
|
+
) -> ImageAnnotatorTag:
|
|
2416
|
+
"""Create a unique tag type for use in an image annotator.
|
|
2417
|
+
|
|
2418
|
+
Args:
|
|
2419
|
+
name: An identifying name for this tag.
|
|
2420
|
+
label: Text to be displayed for the annotation.
|
|
2421
|
+
color: Hex or RGB color string to be used as the background color.
|
|
2422
|
+
Returns:
|
|
2423
|
+
A `h2o_wave.types.ImageAnnotatorTag` instance.
|
|
2424
|
+
"""
|
|
2425
|
+
return ImageAnnotatorTag(
|
|
2426
|
+
name,
|
|
2427
|
+
label,
|
|
2428
|
+
color,
|
|
2429
|
+
)
|
|
2430
|
+
|
|
2431
|
+
|
|
2432
|
+
def image_annotator_rect(
|
|
2433
|
+
x1: float,
|
|
2434
|
+
y1: float,
|
|
2435
|
+
x2: float,
|
|
2436
|
+
y2: float,
|
|
2437
|
+
) -> ImageAnnotatorShape:
|
|
2438
|
+
"""Create a rectangular annotation shape.
|
|
2439
|
+
|
|
2440
|
+
Args:
|
|
2441
|
+
x1: `x` coordinate of the rectangle's corner.
|
|
2442
|
+
y1: `y` coordinate of the rectangle's corner.
|
|
2443
|
+
x2: `x` coordinate of the diagonally opposite corner.
|
|
2444
|
+
y2: `y` coordinate of the diagonally opposite corner.
|
|
2445
|
+
Returns:
|
|
2446
|
+
A `h2o_wave.types.ImageAnnotatorRect` instance.
|
|
2447
|
+
"""
|
|
2448
|
+
return ImageAnnotatorShape(rect=ImageAnnotatorRect(
|
|
2449
|
+
x1,
|
|
2450
|
+
y1,
|
|
2451
|
+
x2,
|
|
2452
|
+
y2,
|
|
2453
|
+
))
|
|
2454
|
+
|
|
2455
|
+
|
|
2456
|
+
def image_annotator_point(
|
|
2457
|
+
x: float,
|
|
2458
|
+
y: float,
|
|
2459
|
+
) -> ImageAnnotatorPoint:
|
|
2460
|
+
"""Create a polygon annotation point with x and y coordinates..
|
|
2461
|
+
|
|
2462
|
+
Args:
|
|
2463
|
+
x: `x` coordinate of the point.
|
|
2464
|
+
y: `y` coordinate of the point.
|
|
2465
|
+
Returns:
|
|
2466
|
+
A `h2o_wave.types.ImageAnnotatorPoint` instance.
|
|
2467
|
+
"""
|
|
2468
|
+
return ImageAnnotatorPoint(
|
|
2469
|
+
x,
|
|
2470
|
+
y,
|
|
2471
|
+
)
|
|
2472
|
+
|
|
2473
|
+
|
|
2474
|
+
def image_annotator_polygon(
|
|
2475
|
+
vertices: List[ImageAnnotatorPoint],
|
|
2476
|
+
) -> ImageAnnotatorShape:
|
|
2477
|
+
"""Create a polygon annotation shape.
|
|
2478
|
+
|
|
2479
|
+
Args:
|
|
2480
|
+
vertices: List of polygon points.
|
|
2481
|
+
Returns:
|
|
2482
|
+
A `h2o_wave.types.ImageAnnotatorPolygon` instance.
|
|
2483
|
+
"""
|
|
2484
|
+
return ImageAnnotatorShape(polygon=ImageAnnotatorPolygon(
|
|
2485
|
+
vertices,
|
|
2486
|
+
))
|
|
2487
|
+
|
|
2488
|
+
|
|
2489
|
+
def image_annotator_item(
|
|
2490
|
+
shape: ImageAnnotatorShape,
|
|
2491
|
+
tag: str,
|
|
2492
|
+
) -> ImageAnnotatorItem:
|
|
2493
|
+
"""Create an annotator item with initial selected tags or no tag for plaintext.
|
|
2494
|
+
|
|
2495
|
+
Args:
|
|
2496
|
+
shape: The annotation shape.
|
|
2497
|
+
tag: The `name` of the image annotator tag to refer to for the `label` and `color` of this item.
|
|
2498
|
+
Returns:
|
|
2499
|
+
A `h2o_wave.types.ImageAnnotatorItem` instance.
|
|
2500
|
+
"""
|
|
2501
|
+
return ImageAnnotatorItem(
|
|
2502
|
+
shape,
|
|
2503
|
+
tag,
|
|
2504
|
+
)
|
|
2505
|
+
|
|
2506
|
+
|
|
2507
|
+
def image_annotator(
|
|
2508
|
+
name: str,
|
|
2509
|
+
image: str,
|
|
2510
|
+
title: str,
|
|
2511
|
+
tags: List[ImageAnnotatorTag],
|
|
2512
|
+
items: Optional[List[ImageAnnotatorItem]] = None,
|
|
2513
|
+
trigger: Optional[bool] = None,
|
|
2514
|
+
image_height: Optional[str] = None,
|
|
2515
|
+
allowed_shapes: Optional[List[str]] = None,
|
|
2516
|
+
events: Optional[List[str]] = None,
|
|
2517
|
+
) -> Component:
|
|
2518
|
+
"""Create an image annotator component.
|
|
2519
|
+
|
|
2520
|
+
This component allows annotating and labeling parts of an image by drawing shapes with a pointing device.
|
|
2521
|
+
|
|
2522
|
+
Args:
|
|
2523
|
+
name: An identifying name for this component.
|
|
2524
|
+
image: The path or URL of the image to be presented for annotation.
|
|
2525
|
+
title: The image annotator's title.
|
|
2526
|
+
tags: The master list of tags that can be used for annotations.
|
|
2527
|
+
items: Annotations to display on the image, if any.
|
|
2528
|
+
trigger: True if the form should be submitted as soon as an annotation is drawn.
|
|
2529
|
+
image_height: The card’s image height. The actual image size is used by default.
|
|
2530
|
+
allowed_shapes: List of allowed shapes. Available values are 'rect' and 'polygon'. If not set, all shapes are available by default.
|
|
2531
|
+
events: The events to capture on this image annotator. One of `click` | `tool_change`.
|
|
2532
|
+
Returns:
|
|
2533
|
+
A `h2o_wave.types.ImageAnnotator` instance.
|
|
2534
|
+
"""
|
|
2535
|
+
return Component(image_annotator=ImageAnnotator(
|
|
2536
|
+
name,
|
|
2537
|
+
image,
|
|
2538
|
+
title,
|
|
2539
|
+
tags,
|
|
2540
|
+
items,
|
|
2541
|
+
trigger,
|
|
2542
|
+
image_height,
|
|
2543
|
+
allowed_shapes,
|
|
2544
|
+
events,
|
|
2545
|
+
))
|
|
2546
|
+
|
|
2547
|
+
|
|
2548
|
+
def audio_annotator_tag(
|
|
2549
|
+
name: str,
|
|
2550
|
+
label: str,
|
|
2551
|
+
color: str,
|
|
2552
|
+
) -> AudioAnnotatorTag:
|
|
2553
|
+
"""Create a unique tag type for use in an audio annotator.
|
|
2554
|
+
|
|
2555
|
+
Args:
|
|
2556
|
+
name: An identifying name for this tag.
|
|
2557
|
+
label: Text to be displayed for the annotation.
|
|
2558
|
+
color: Hex or RGB color string to be used as the background color.
|
|
2559
|
+
Returns:
|
|
2560
|
+
A `h2o_wave.types.AudioAnnotatorTag` instance.
|
|
2561
|
+
"""
|
|
2562
|
+
return AudioAnnotatorTag(
|
|
2563
|
+
name,
|
|
2564
|
+
label,
|
|
2565
|
+
color,
|
|
2566
|
+
)
|
|
2567
|
+
|
|
2568
|
+
|
|
2569
|
+
def audio_annotator_item(
|
|
2570
|
+
start: float,
|
|
2571
|
+
end: float,
|
|
2572
|
+
tag: str,
|
|
2573
|
+
) -> AudioAnnotatorItem:
|
|
2574
|
+
"""Create an annotator item with initial selected tags or no tags.
|
|
2575
|
+
|
|
2576
|
+
Args:
|
|
2577
|
+
start: The start of the audio annotation in seconds.
|
|
2578
|
+
end: The end of the audio annotation in seconds.
|
|
2579
|
+
tag: The `name` of the audio annotator tag to refer to for the `label` and `color` of this item.
|
|
2580
|
+
Returns:
|
|
2581
|
+
A `h2o_wave.types.AudioAnnotatorItem` instance.
|
|
2582
|
+
"""
|
|
2583
|
+
return AudioAnnotatorItem(
|
|
2584
|
+
start,
|
|
2585
|
+
end,
|
|
2586
|
+
tag,
|
|
2587
|
+
)
|
|
2588
|
+
|
|
2589
|
+
|
|
2590
|
+
def audio_annotator(
|
|
2591
|
+
name: str,
|
|
2592
|
+
title: str,
|
|
2593
|
+
path: str,
|
|
2594
|
+
tags: List[AudioAnnotatorTag],
|
|
2595
|
+
items: Optional[List[AudioAnnotatorItem]] = None,
|
|
2596
|
+
trigger: Optional[bool] = None,
|
|
2597
|
+
) -> Component:
|
|
2598
|
+
"""Create an audio annotator component.
|
|
2599
|
+
|
|
2600
|
+
This component allows annotating and labeling parts of audio file.
|
|
2601
|
+
|
|
2602
|
+
Args:
|
|
2603
|
+
name: An identifying name for this component.
|
|
2604
|
+
title: The audio annotator's title.
|
|
2605
|
+
path: The path to the audio file. Use mp3 or wav formats to achieve the best cross-browser support. See https://caniuse.com/?search=audio%20format for other formats.
|
|
2606
|
+
tags: The master list of tags that can be used for annotations.
|
|
2607
|
+
items: Annotations to display on the image, if any.
|
|
2608
|
+
trigger: True if the form should be submitted as soon as an annotation is made.
|
|
2609
|
+
Returns:
|
|
2610
|
+
A `h2o_wave.types.AudioAnnotator` instance.
|
|
2611
|
+
"""
|
|
2612
|
+
return Component(audio_annotator=AudioAnnotator(
|
|
2613
|
+
name,
|
|
2614
|
+
title,
|
|
2615
|
+
path,
|
|
2616
|
+
tags,
|
|
2617
|
+
items,
|
|
2618
|
+
trigger,
|
|
2619
|
+
))
|
|
2620
|
+
|
|
2621
|
+
|
|
2622
|
+
def facepile(
|
|
2623
|
+
items: List[Component],
|
|
2624
|
+
name: Optional[str] = None,
|
|
2625
|
+
max: Optional[int] = None,
|
|
2626
|
+
value: Optional[str] = None,
|
|
2627
|
+
) -> Component:
|
|
2628
|
+
"""A face pile displays a list of personas. Each circle represents a person and contains their image or initials.
|
|
2629
|
+
Often this control is used when sharing who has access to a specific view or file.
|
|
2630
|
+
|
|
2631
|
+
Args:
|
|
2632
|
+
items: List of personas to be displayed.
|
|
2633
|
+
name: An identifying name for this component. If specified `Add button` will be rendered.
|
|
2634
|
+
max: Maximum number of personas to be displayed.
|
|
2635
|
+
value: A value for the facepile. If a value is set, it is used for the button's submitted instead of a boolean True.
|
|
2636
|
+
Returns:
|
|
2637
|
+
A `h2o_wave.types.Facepile` instance.
|
|
2638
|
+
"""
|
|
2639
|
+
return Component(facepile=Facepile(
|
|
2640
|
+
items,
|
|
2641
|
+
name,
|
|
2642
|
+
max,
|
|
2643
|
+
value,
|
|
2644
|
+
))
|
|
2645
|
+
|
|
2646
|
+
|
|
2647
|
+
def copyable_text(
|
|
2648
|
+
value: str,
|
|
2649
|
+
label: str,
|
|
2650
|
+
name: Optional[str] = None,
|
|
2651
|
+
multiline: Optional[bool] = None,
|
|
2652
|
+
height: Optional[str] = None,
|
|
2653
|
+
width: Optional[str] = None,
|
|
2654
|
+
) -> Component:
|
|
2655
|
+
"""Create a copyable text component.
|
|
2656
|
+
Use this component when you want to enable your users to quickly copy paste sections of text.
|
|
2657
|
+
|
|
2658
|
+
Args:
|
|
2659
|
+
value: Text to be displayed inside the component.
|
|
2660
|
+
label: The text displayed above the textbox.
|
|
2661
|
+
name: An identifying name for this component.
|
|
2662
|
+
multiline: True if the component should allow multi-line text entry.
|
|
2663
|
+
height: Custom height in px (e.g. '200px') or '1' to fill the remaining card space. Requires `multiline` to be set.
|
|
2664
|
+
width: The width of the copyable text , e.g. '100px'.
|
|
2665
|
+
Returns:
|
|
2666
|
+
A `h2o_wave.types.CopyableText` instance.
|
|
2667
|
+
"""
|
|
2668
|
+
return Component(copyable_text=CopyableText(
|
|
2669
|
+
value,
|
|
2670
|
+
label,
|
|
2671
|
+
name,
|
|
2672
|
+
multiline,
|
|
2673
|
+
height,
|
|
2674
|
+
width,
|
|
2675
|
+
))
|
|
2676
|
+
|
|
2677
|
+
|
|
2678
|
+
def menu(
|
|
2679
|
+
items: List[Command],
|
|
2680
|
+
icon: Optional[str] = None,
|
|
2681
|
+
image: Optional[str] = None,
|
|
2682
|
+
name: Optional[str] = None,
|
|
2683
|
+
label: Optional[str] = None,
|
|
2684
|
+
) -> Component:
|
|
2685
|
+
"""Create a contextual menu component. Useful when you have a lot of links and want to conserve the space.
|
|
2686
|
+
|
|
2687
|
+
Args:
|
|
2688
|
+
items: Commands to render.
|
|
2689
|
+
icon: The card's icon.
|
|
2690
|
+
image: The card’s image, preferably user avatar.
|
|
2691
|
+
name: An identifying name for this component.
|
|
2692
|
+
label: The text displayed next to the chevron.
|
|
2693
|
+
Returns:
|
|
2694
|
+
A `h2o_wave.types.Menu` instance.
|
|
2695
|
+
"""
|
|
2696
|
+
return Component(menu=Menu(
|
|
2697
|
+
items,
|
|
2698
|
+
icon,
|
|
2699
|
+
image,
|
|
2700
|
+
name,
|
|
2701
|
+
label,
|
|
2702
|
+
))
|
|
2703
|
+
|
|
2704
|
+
|
|
2705
|
+
def tags(
|
|
2706
|
+
items: List[Tag],
|
|
2707
|
+
) -> Component:
|
|
2708
|
+
"""Create a set of tags laid out horizontally.
|
|
2709
|
+
|
|
2710
|
+
Args:
|
|
2711
|
+
items: Tags in this set.
|
|
2712
|
+
Returns:
|
|
2713
|
+
A `h2o_wave.types.Tags` instance.
|
|
2714
|
+
"""
|
|
2715
|
+
return Component(tags=Tags(
|
|
2716
|
+
items,
|
|
2717
|
+
))
|
|
2718
|
+
|
|
2719
|
+
|
|
2720
|
+
def time_picker(
|
|
2721
|
+
name: str,
|
|
2722
|
+
label: Optional[str] = None,
|
|
2723
|
+
placeholder: Optional[str] = None,
|
|
2724
|
+
value: Optional[str] = None,
|
|
2725
|
+
disabled: Optional[bool] = None,
|
|
2726
|
+
width: Optional[str] = None,
|
|
2727
|
+
visible: Optional[bool] = None,
|
|
2728
|
+
trigger: Optional[bool] = None,
|
|
2729
|
+
required: Optional[bool] = None,
|
|
2730
|
+
hour_format: Optional[str] = None,
|
|
2731
|
+
min: Optional[str] = None,
|
|
2732
|
+
max: Optional[str] = None,
|
|
2733
|
+
minutes_step: Optional[int] = None,
|
|
2734
|
+
) -> Component:
|
|
2735
|
+
"""Create a time picker.
|
|
2736
|
+
|
|
2737
|
+
A time picker allows a user to pick a time value.
|
|
2738
|
+
|
|
2739
|
+
Args:
|
|
2740
|
+
name: An identifying name for this component.
|
|
2741
|
+
label: Text to be displayed alongside the component.
|
|
2742
|
+
placeholder: A string that provides a brief hint to the user as to what kind of information is expected in the field.
|
|
2743
|
+
value: The time value in hh:mm format. E.g. '10:30', '14:25', '23:59', '00:00'
|
|
2744
|
+
disabled: True if this field is disabled.
|
|
2745
|
+
width: The width of the time picker, e.g. '100px'. Defaults to '100%'.
|
|
2746
|
+
visible: True if the component should be visible. Defaults to True.
|
|
2747
|
+
trigger: True if the form should be submitted when the time is selected.
|
|
2748
|
+
required: True if this is a required field. Defaults to False.
|
|
2749
|
+
hour_format: Specifies 12-hour or 24-hour time format. One of `12` or `24`. Defaults to `12`.
|
|
2750
|
+
min: The minimum allowed time value in hh:mm format. E.g.: '08:00', '13:30'
|
|
2751
|
+
max: The maximum allowed time value in hh:mm format. E.g.: '15:30', '00:00'
|
|
2752
|
+
minutes_step: Limits the available minutes to select from. One of `1`, `5`, `10`, `15`, `20`, `30` or `60`. Defaults to `1`.
|
|
2753
|
+
Returns:
|
|
2754
|
+
A `h2o_wave.types.TimePicker` instance.
|
|
2755
|
+
"""
|
|
2756
|
+
return Component(time_picker=TimePicker(
|
|
2757
|
+
name,
|
|
2758
|
+
label,
|
|
2759
|
+
placeholder,
|
|
2760
|
+
value,
|
|
2761
|
+
disabled,
|
|
2762
|
+
width,
|
|
2763
|
+
visible,
|
|
2764
|
+
trigger,
|
|
2765
|
+
required,
|
|
2766
|
+
hour_format,
|
|
2767
|
+
min,
|
|
2768
|
+
max,
|
|
2769
|
+
minutes_step,
|
|
2770
|
+
))
|
|
2771
|
+
|
|
2772
|
+
|
|
2773
|
+
def article_card(
|
|
2774
|
+
box: str,
|
|
2775
|
+
title: str,
|
|
2776
|
+
content: Optional[str] = None,
|
|
2777
|
+
items: Optional[List[Component]] = None,
|
|
2778
|
+
commands: Optional[List[Command]] = None,
|
|
2779
|
+
) -> ArticleCard:
|
|
2780
|
+
"""Create an article card for longer texts.
|
|
2781
|
+
|
|
2782
|
+
Args:
|
|
2783
|
+
box: A string indicating how to place this component on the page.
|
|
2784
|
+
title: The card’s title, displayed at the top.
|
|
2785
|
+
content: Markdown text.
|
|
2786
|
+
items: Collection of small buttons rendered under the title.
|
|
2787
|
+
commands: Contextual menu commands for this component.
|
|
2788
|
+
Returns:
|
|
2789
|
+
A `h2o_wave.types.ArticleCard` instance.
|
|
2790
|
+
"""
|
|
2791
|
+
return ArticleCard(
|
|
2792
|
+
box,
|
|
2793
|
+
title,
|
|
2794
|
+
content,
|
|
2795
|
+
items,
|
|
2796
|
+
commands,
|
|
2797
|
+
)
|
|
2798
|
+
|
|
2799
|
+
|
|
2800
|
+
def breadcrumb(
|
|
2801
|
+
name: str,
|
|
2802
|
+
label: str,
|
|
2803
|
+
) -> Breadcrumb:
|
|
2804
|
+
"""Create a breadcrumb for a `h2o_wave.types.BreadcrumbsCard()`.
|
|
2805
|
+
|
|
2806
|
+
Args:
|
|
2807
|
+
name: The name of this item. Prefix the name with a '#' to trigger hash-change navigation.
|
|
2808
|
+
label: The label to display.
|
|
2809
|
+
Returns:
|
|
2810
|
+
A `h2o_wave.types.Breadcrumb` instance.
|
|
2811
|
+
"""
|
|
2812
|
+
return Breadcrumb(
|
|
2813
|
+
name,
|
|
2814
|
+
label,
|
|
2815
|
+
)
|
|
2816
|
+
|
|
2817
|
+
|
|
2818
|
+
def breadcrumbs_card(
|
|
2819
|
+
box: str,
|
|
2820
|
+
items: List[Breadcrumb],
|
|
2821
|
+
commands: Optional[List[Command]] = None,
|
|
2822
|
+
) -> BreadcrumbsCard:
|
|
2823
|
+
"""Create a card containing breadcrumbs.
|
|
2824
|
+
Breadcrumbs should be used as a navigational aid in your app or site.
|
|
2825
|
+
They indicate the current page’s location within a hierarchy and help
|
|
2826
|
+
the user understand where they are in relation to the rest of that hierarchy.
|
|
2827
|
+
They also afford one-click access to higher levels of that hierarchy.
|
|
2828
|
+
Breadcrumbs are typically placed, in horizontal form, under the masthead
|
|
2829
|
+
or navigation of an experience, above the primary content area.
|
|
2830
|
+
|
|
2831
|
+
Args:
|
|
2832
|
+
box: A string indicating how to place this component on the page.
|
|
2833
|
+
items: A list of `h2o_wave.types.Breadcrumb` instances to display. See `h2o_wave.ui.breadcrumb()`
|
|
2834
|
+
commands: Contextual menu commands for this component.
|
|
2835
|
+
Returns:
|
|
2836
|
+
A `h2o_wave.types.BreadcrumbsCard` instance.
|
|
2837
|
+
"""
|
|
2838
|
+
return BreadcrumbsCard(
|
|
2839
|
+
box,
|
|
2840
|
+
items,
|
|
2841
|
+
commands,
|
|
2842
|
+
)
|
|
2843
|
+
|
|
2844
|
+
|
|
2845
|
+
def canvas_card(
|
|
2846
|
+
box: str,
|
|
2847
|
+
title: str,
|
|
2848
|
+
width: int,
|
|
2849
|
+
height: int,
|
|
2850
|
+
data: PackedRecord,
|
|
2851
|
+
commands: Optional[List[Command]] = None,
|
|
2852
|
+
) -> CanvasCard:
|
|
2853
|
+
"""WARNING: Experimental and subject to change.
|
|
2854
|
+
Do not use in production sites!
|
|
2855
|
+
|
|
2856
|
+
Create a card that displays a drawing canvas (whiteboard).
|
|
2857
|
+
|
|
2858
|
+
Args:
|
|
2859
|
+
box: A string indicating how to place this component on the page.
|
|
2860
|
+
title: The title for this card.
|
|
2861
|
+
width: Canvas width, in pixels.
|
|
2862
|
+
height: Canvas height, in pixels.
|
|
2863
|
+
data: The data for this card.
|
|
2864
|
+
commands: Contextual menu commands for this component.
|
|
2865
|
+
Returns:
|
|
2866
|
+
A `h2o_wave.types.CanvasCard` instance.
|
|
2867
|
+
"""
|
|
2868
|
+
return CanvasCard(
|
|
2869
|
+
box,
|
|
2870
|
+
title,
|
|
2871
|
+
width,
|
|
2872
|
+
height,
|
|
2873
|
+
data,
|
|
2874
|
+
commands,
|
|
2875
|
+
)
|
|
2876
|
+
|
|
2877
|
+
|
|
2878
|
+
def chat_card(
|
|
2879
|
+
box: str,
|
|
2880
|
+
title: str,
|
|
2881
|
+
data: PackedRecord,
|
|
2882
|
+
capacity: Optional[int] = None,
|
|
2883
|
+
commands: Optional[List[Command]] = None,
|
|
2884
|
+
) -> ChatCard:
|
|
2885
|
+
"""WARNING: Experimental and subject to change.
|
|
2886
|
+
Do not use in production sites!
|
|
2887
|
+
|
|
2888
|
+
Create a card that displays a chat room.
|
|
2889
|
+
|
|
2890
|
+
Args:
|
|
2891
|
+
box: A string indicating how to place this component on the page.
|
|
2892
|
+
title: The title for this card.
|
|
2893
|
+
data: The data for this card.
|
|
2894
|
+
capacity: The maximum number of messages contained in this card. Defaults to 50.
|
|
2895
|
+
commands: Contextual menu commands for this component.
|
|
2896
|
+
Returns:
|
|
2897
|
+
A `h2o_wave.types.ChatCard` instance.
|
|
2898
|
+
"""
|
|
2899
|
+
return ChatCard(
|
|
2900
|
+
box,
|
|
2901
|
+
title,
|
|
2902
|
+
data,
|
|
2903
|
+
capacity,
|
|
2904
|
+
commands,
|
|
2905
|
+
)
|
|
2906
|
+
|
|
2907
|
+
|
|
2908
|
+
def chat_suggestion(
|
|
2909
|
+
name: str,
|
|
2910
|
+
label: str,
|
|
2911
|
+
caption: Optional[str] = None,
|
|
2912
|
+
icon: Optional[str] = None,
|
|
2913
|
+
) -> ChatSuggestion:
|
|
2914
|
+
"""Create a chat prompt suggestion displayed as button below the last response in the chatbot component.
|
|
2915
|
+
|
|
2916
|
+
Args:
|
|
2917
|
+
name: An identifying name for this component.
|
|
2918
|
+
label: The text displayed for this suggestion.
|
|
2919
|
+
caption: The caption displayed below the label.
|
|
2920
|
+
icon: The icon to be displayed for this suggestion.
|
|
2921
|
+
Returns:
|
|
2922
|
+
A `h2o_wave.types.ChatSuggestion` instance.
|
|
2923
|
+
"""
|
|
2924
|
+
return ChatSuggestion(
|
|
2925
|
+
name,
|
|
2926
|
+
label,
|
|
2927
|
+
caption,
|
|
2928
|
+
icon,
|
|
2929
|
+
)
|
|
2930
|
+
|
|
2931
|
+
|
|
2932
|
+
def chatbot_card(
|
|
2933
|
+
box: str,
|
|
2934
|
+
name: str,
|
|
2935
|
+
data: PackedRecord,
|
|
2936
|
+
placeholder: Optional[str] = None,
|
|
2937
|
+
events: Optional[List[str]] = None,
|
|
2938
|
+
generating: Optional[bool] = None,
|
|
2939
|
+
suggestions: Optional[List[ChatSuggestion]] = None,
|
|
2940
|
+
disabled: Optional[bool] = None,
|
|
2941
|
+
value: Optional[str] = None,
|
|
2942
|
+
commands: Optional[List[Command]] = None,
|
|
2943
|
+
) -> ChatbotCard:
|
|
2944
|
+
"""Create a chatbot card to allow getting prompts from users and providing them with LLM generated answers.
|
|
2945
|
+
|
|
2946
|
+
Args:
|
|
2947
|
+
box: A string indicating how to place this component on the page.
|
|
2948
|
+
name: An identifying name for this component.
|
|
2949
|
+
data: Chat messages data. Requires cyclic buffer.
|
|
2950
|
+
placeholder: Chat input box placeholder. Use for prompt examples.
|
|
2951
|
+
events: The events to capture on this chatbot. One of 'stop' | 'scroll_up' | 'feedback' | 'suggestion'.
|
|
2952
|
+
generating: True to show a button to stop the text generation. Defaults to False.
|
|
2953
|
+
suggestions: Clickable prompt suggestions shown below the last response.
|
|
2954
|
+
disabled: True if the user input should be disabled.
|
|
2955
|
+
value: Value of the user input.
|
|
2956
|
+
commands: Contextual menu commands for this component.
|
|
2957
|
+
Returns:
|
|
2958
|
+
A `h2o_wave.types.ChatbotCard` instance.
|
|
2959
|
+
"""
|
|
2960
|
+
return ChatbotCard(
|
|
2961
|
+
box,
|
|
2962
|
+
name,
|
|
2963
|
+
data,
|
|
2964
|
+
placeholder,
|
|
2965
|
+
events,
|
|
2966
|
+
generating,
|
|
2967
|
+
suggestions,
|
|
2968
|
+
disabled,
|
|
2969
|
+
value,
|
|
2970
|
+
commands,
|
|
2971
|
+
)
|
|
2972
|
+
|
|
2973
|
+
|
|
2974
|
+
def editor_card(
|
|
2975
|
+
box: str,
|
|
2976
|
+
mode: str,
|
|
2977
|
+
commands: Optional[List[Command]] = None,
|
|
2978
|
+
) -> EditorCard:
|
|
2979
|
+
"""WARNING: Experimental and subject to change.
|
|
2980
|
+
Do not use in production sites!
|
|
2981
|
+
|
|
2982
|
+
Create a card that enables WYSIWYG editing on a page.
|
|
2983
|
+
Adding this card to a page makes the page editable by end-users.
|
|
2984
|
+
|
|
2985
|
+
Args:
|
|
2986
|
+
box: A string indicating how to place this component on the page.
|
|
2987
|
+
mode: The editing mode. Defaults to `public`. One of 'public', 'private'. See enum h2o_wave.ui.EditorCardMode.
|
|
2988
|
+
commands: Contextual menu commands for this component.
|
|
2989
|
+
Returns:
|
|
2990
|
+
A `h2o_wave.types.EditorCard` instance.
|
|
2991
|
+
"""
|
|
2992
|
+
return EditorCard(
|
|
2993
|
+
box,
|
|
2994
|
+
mode,
|
|
2995
|
+
commands,
|
|
2996
|
+
)
|
|
2997
|
+
|
|
2998
|
+
|
|
2999
|
+
def flex_card(
|
|
3000
|
+
box: str,
|
|
3001
|
+
item_view: str,
|
|
3002
|
+
item_props: PackedRecord,
|
|
3003
|
+
data: PackedData,
|
|
3004
|
+
direction: Optional[str] = None,
|
|
3005
|
+
justify: Optional[str] = None,
|
|
3006
|
+
align: Optional[str] = None,
|
|
3007
|
+
wrap: Optional[str] = None,
|
|
3008
|
+
commands: Optional[List[Command]] = None,
|
|
3009
|
+
) -> FlexCard:
|
|
3010
|
+
"""EXPERIMENTAL. DO NOT USE.
|
|
3011
|
+
Create a card containing other cards laid out using a one-dimensional model with flexible alignemnt and wrapping capabilities.
|
|
3012
|
+
|
|
3013
|
+
Args:
|
|
3014
|
+
box: A string indicating how to place this component on the page.
|
|
3015
|
+
item_view: The child card type.
|
|
3016
|
+
item_props: The child card properties.
|
|
3017
|
+
data: Data for this card.
|
|
3018
|
+
direction: Layout direction. One of 'horizontal', 'vertical'. See enum h2o_wave.ui.FlexCardDirection.
|
|
3019
|
+
justify: Layout strategy for main axis. One of 'start', 'end', 'center', 'between', 'around'. See enum h2o_wave.ui.FlexCardJustify.
|
|
3020
|
+
align: Layout strategy for cross axis. One of 'start', 'end', 'center', 'baseline', 'stretch'. See enum h2o_wave.ui.FlexCardAlign.
|
|
3021
|
+
wrap: Wrapping strategy. One of 'start', 'end', 'center', 'between', 'around', 'stretch'. See enum h2o_wave.ui.FlexCardWrap.
|
|
3022
|
+
commands: Contextual menu commands for this component.
|
|
3023
|
+
Returns:
|
|
3024
|
+
A `h2o_wave.types.FlexCard` instance.
|
|
3025
|
+
"""
|
|
3026
|
+
return FlexCard(
|
|
3027
|
+
box,
|
|
3028
|
+
item_view,
|
|
3029
|
+
item_props,
|
|
3030
|
+
data,
|
|
3031
|
+
direction,
|
|
3032
|
+
justify,
|
|
3033
|
+
align,
|
|
3034
|
+
wrap,
|
|
3035
|
+
commands,
|
|
3036
|
+
)
|
|
3037
|
+
|
|
3038
|
+
|
|
3039
|
+
def footer_card(
|
|
3040
|
+
box: str,
|
|
3041
|
+
caption: str,
|
|
3042
|
+
items: Optional[List[Component]] = None,
|
|
3043
|
+
commands: Optional[List[Command]] = None,
|
|
3044
|
+
) -> FooterCard:
|
|
3045
|
+
"""Render a page footer displaying a caption.
|
|
3046
|
+
Footer cards are typically displayed at the bottom of a page.
|
|
3047
|
+
|
|
3048
|
+
Args:
|
|
3049
|
+
box: A string indicating how to place this component on the page.
|
|
3050
|
+
caption: The caption. Supports markdown. *
|
|
3051
|
+
items: The components displayed to the right of the caption.
|
|
3052
|
+
commands: Contextual menu commands for this component.
|
|
3053
|
+
Returns:
|
|
3054
|
+
A `h2o_wave.types.FooterCard` instance.
|
|
3055
|
+
"""
|
|
3056
|
+
return FooterCard(
|
|
3057
|
+
box,
|
|
3058
|
+
caption,
|
|
3059
|
+
items,
|
|
3060
|
+
commands,
|
|
3061
|
+
)
|
|
3062
|
+
|
|
3063
|
+
|
|
3064
|
+
def form_card(
|
|
3065
|
+
box: str,
|
|
3066
|
+
items: Union[List[Component], str],
|
|
3067
|
+
title: Optional[str] = None,
|
|
3068
|
+
commands: Optional[List[Command]] = None,
|
|
3069
|
+
) -> FormCard:
|
|
3070
|
+
"""Create a form.
|
|
3071
|
+
|
|
3072
|
+
Args:
|
|
3073
|
+
box: A string indicating how to place this component on the page.
|
|
3074
|
+
items: The components in this form.
|
|
3075
|
+
title: The title for this card.
|
|
3076
|
+
commands: Contextual menu commands for this component.
|
|
3077
|
+
Returns:
|
|
3078
|
+
A `h2o_wave.types.FormCard` instance.
|
|
3079
|
+
"""
|
|
3080
|
+
return FormCard(
|
|
3081
|
+
box,
|
|
3082
|
+
items,
|
|
3083
|
+
title,
|
|
3084
|
+
commands,
|
|
3085
|
+
)
|
|
3086
|
+
|
|
3087
|
+
|
|
3088
|
+
def frame_card(
|
|
3089
|
+
box: str,
|
|
3090
|
+
title: str,
|
|
3091
|
+
path: Optional[str] = None,
|
|
3092
|
+
content: Optional[str] = None,
|
|
3093
|
+
compact: Optional[bool] = None,
|
|
3094
|
+
commands: Optional[List[Command]] = None,
|
|
3095
|
+
) -> FrameCard:
|
|
3096
|
+
"""Render a card containing a HTML page inside an inline frame (an `iframe`).
|
|
3097
|
+
|
|
3098
|
+
Either a path or content can be provided as arguments.
|
|
3099
|
+
|
|
3100
|
+
Args:
|
|
3101
|
+
box: A string indicating how to place this component on the page.
|
|
3102
|
+
title: The title for this card.
|
|
3103
|
+
path: The path or URL of the web page, e.g. `/foo.html` or `http://example.com/foo.html`.
|
|
3104
|
+
content: The HTML content of the page. A string containing `<html>...</html>`.
|
|
3105
|
+
compact: True if title and padding should be removed. Defaults to False.
|
|
3106
|
+
commands: Contextual menu commands for this component.
|
|
3107
|
+
Returns:
|
|
3108
|
+
A `h2o_wave.types.FrameCard` instance.
|
|
3109
|
+
"""
|
|
3110
|
+
return FrameCard(
|
|
3111
|
+
box,
|
|
3112
|
+
title,
|
|
3113
|
+
path,
|
|
3114
|
+
content,
|
|
3115
|
+
compact,
|
|
3116
|
+
commands,
|
|
3117
|
+
)
|
|
3118
|
+
|
|
3119
|
+
|
|
3120
|
+
def graphics_card(
|
|
3121
|
+
box: str,
|
|
3122
|
+
view_box: str,
|
|
3123
|
+
stage: Optional[PackedRecords] = None,
|
|
3124
|
+
scene: Optional[PackedData] = None,
|
|
3125
|
+
width: Optional[str] = None,
|
|
3126
|
+
height: Optional[str] = None,
|
|
3127
|
+
image: Optional[str] = None,
|
|
3128
|
+
image_path: Optional[str] = None,
|
|
3129
|
+
image_type: Optional[str] = None,
|
|
3130
|
+
commands: Optional[List[Command]] = None,
|
|
3131
|
+
) -> GraphicsCard:
|
|
3132
|
+
"""Create a card for displaying vector graphics.
|
|
3133
|
+
|
|
3134
|
+
Args:
|
|
3135
|
+
box: A string indicating how to place this component on the page.
|
|
3136
|
+
view_box: The position and dimension of the SVG viewport, in user space. A space-separated list of four numbers: min-x, min-y, width and height. For example, '0 0 400 300'. See: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/viewBox
|
|
3137
|
+
stage: Background layer for rendering static SVG elements. Must be packed to conserve memory.
|
|
3138
|
+
scene: Foreground layer for rendering dynamic SVG elements.
|
|
3139
|
+
width: The displayed width of the rectangular viewport. (Not the width of its coordinate system.)
|
|
3140
|
+
height: The displayed height of the rectangular viewport. (Not the height of its coordinate system.)
|
|
3141
|
+
image: Background image data, base64-encoded.
|
|
3142
|
+
image_path: The path or URL or data URL of the background image, e.g. `/foo.png` or `http://example.com/foo.png` or `data:image/png;base64,???`.
|
|
3143
|
+
image_type: The background image MIME subtype. One of `apng`, `bmp`, `gif`, `x-icon`, `jpeg`, `png`, `webp`. Required only if `image` is set.
|
|
3144
|
+
commands: Contextual menu commands for this component.
|
|
3145
|
+
Returns:
|
|
3146
|
+
A `h2o_wave.types.GraphicsCard` instance.
|
|
3147
|
+
"""
|
|
3148
|
+
return GraphicsCard(
|
|
3149
|
+
box,
|
|
3150
|
+
view_box,
|
|
3151
|
+
stage,
|
|
3152
|
+
scene,
|
|
3153
|
+
width,
|
|
3154
|
+
height,
|
|
3155
|
+
image,
|
|
3156
|
+
image_path,
|
|
3157
|
+
image_type,
|
|
3158
|
+
commands,
|
|
3159
|
+
)
|
|
3160
|
+
|
|
3161
|
+
|
|
3162
|
+
def grid_card(
|
|
3163
|
+
box: str,
|
|
3164
|
+
title: str,
|
|
3165
|
+
cells: PackedData,
|
|
3166
|
+
data: PackedData,
|
|
3167
|
+
commands: Optional[List[Command]] = None,
|
|
3168
|
+
) -> GridCard:
|
|
3169
|
+
"""EXPERIMENTAL. DO NOT USE.
|
|
3170
|
+
|
|
3171
|
+
Args:
|
|
3172
|
+
box: A string indicating how to place this component on the page.
|
|
3173
|
+
title: EXPERIMENTAL. DO NOT USE.
|
|
3174
|
+
cells: EXPERIMENTAL. DO NOT USE.
|
|
3175
|
+
data: EXPERIMENTAL. DO NOT USE.
|
|
3176
|
+
commands: Contextual menu commands for this component.
|
|
3177
|
+
Returns:
|
|
3178
|
+
A `h2o_wave.types.GridCard` instance.
|
|
3179
|
+
"""
|
|
3180
|
+
return GridCard(
|
|
3181
|
+
box,
|
|
3182
|
+
title,
|
|
3183
|
+
cells,
|
|
3184
|
+
data,
|
|
3185
|
+
commands,
|
|
3186
|
+
)
|
|
3187
|
+
|
|
3188
|
+
|
|
3189
|
+
def nav_item(
|
|
3190
|
+
name: str,
|
|
3191
|
+
label: str,
|
|
3192
|
+
icon: Optional[str] = None,
|
|
3193
|
+
disabled: Optional[bool] = None,
|
|
3194
|
+
tooltip: Optional[str] = None,
|
|
3195
|
+
path: Optional[str] = None,
|
|
3196
|
+
) -> NavItem:
|
|
3197
|
+
"""Create a navigation item.
|
|
3198
|
+
|
|
3199
|
+
Args:
|
|
3200
|
+
name: The name of this item. Prefix the name with a '#' to trigger hash-change navigation.
|
|
3201
|
+
label: The label to display.
|
|
3202
|
+
icon: An optional icon to display next to the label.
|
|
3203
|
+
disabled: True if this item should be disabled.
|
|
3204
|
+
tooltip: An optional tooltip message displayed when a user hovers over this item.
|
|
3205
|
+
path: The path or URL to link to. If specified, the `name` is ignored. The URL is opened in a new browser window or tab. E.g. `/foo.html` or `http://example.com/foo.html`
|
|
3206
|
+
Returns:
|
|
3207
|
+
A `h2o_wave.types.NavItem` instance.
|
|
3208
|
+
"""
|
|
3209
|
+
return NavItem(
|
|
3210
|
+
name,
|
|
3211
|
+
label,
|
|
3212
|
+
icon,
|
|
3213
|
+
disabled,
|
|
3214
|
+
tooltip,
|
|
3215
|
+
path,
|
|
3216
|
+
)
|
|
3217
|
+
|
|
3218
|
+
|
|
3219
|
+
def nav_group(
|
|
3220
|
+
label: str,
|
|
3221
|
+
items: List[NavItem],
|
|
3222
|
+
collapsed: Optional[bool] = None,
|
|
3223
|
+
) -> NavGroup:
|
|
3224
|
+
"""Create a group of navigation items.
|
|
3225
|
+
|
|
3226
|
+
Args:
|
|
3227
|
+
label: The label to display for this group.
|
|
3228
|
+
items: The navigation items contained in this group.
|
|
3229
|
+
collapsed: Indicates whether nav groups should be rendered as collapsed initially
|
|
3230
|
+
Returns:
|
|
3231
|
+
A `h2o_wave.types.NavGroup` instance.
|
|
3232
|
+
"""
|
|
3233
|
+
return NavGroup(
|
|
3234
|
+
label,
|
|
3235
|
+
items,
|
|
3236
|
+
collapsed,
|
|
3237
|
+
)
|
|
3238
|
+
|
|
3239
|
+
|
|
3240
|
+
def header_card(
|
|
3241
|
+
box: str,
|
|
3242
|
+
title: str,
|
|
3243
|
+
subtitle: str,
|
|
3244
|
+
icon: Optional[str] = None,
|
|
3245
|
+
icon_color: Optional[str] = None,
|
|
3246
|
+
image: Optional[str] = None,
|
|
3247
|
+
nav: Optional[List[NavGroup]] = None,
|
|
3248
|
+
items: Optional[List[Component]] = None,
|
|
3249
|
+
secondary_items: Optional[List[Component]] = None,
|
|
3250
|
+
color: Optional[str] = None,
|
|
3251
|
+
commands: Optional[List[Command]] = None,
|
|
3252
|
+
) -> HeaderCard:
|
|
3253
|
+
"""Render a page header displaying a title, subtitle and an optional navigation menu.
|
|
3254
|
+
Header cards are typically used for top-level navigation.
|
|
3255
|
+
|
|
3256
|
+
Args:
|
|
3257
|
+
box: A string indicating how to place this component on the page.
|
|
3258
|
+
title: The title. *
|
|
3259
|
+
subtitle: The subtitle, displayed below the title. *
|
|
3260
|
+
icon: The icon, displayed to the left. *
|
|
3261
|
+
icon_color: The icon's color. *
|
|
3262
|
+
image: The URL of an image (usually logo) displayed to the left. Mutually exclusive with icon. *
|
|
3263
|
+
nav: The navigation menu to display when the header's icon is clicked. Recommended for mobile screens only. *
|
|
3264
|
+
items: Items that should be displayed on the right side of the header.
|
|
3265
|
+
secondary_items: Items that should be displayed in the center of the header.
|
|
3266
|
+
color: Header background color. Defaults to 'primary'. One of 'card', 'transparent', 'primary'. See enum h2o_wave.ui.HeaderCardColor.
|
|
3267
|
+
commands: Contextual menu commands for this component.
|
|
3268
|
+
Returns:
|
|
3269
|
+
A `h2o_wave.types.HeaderCard` instance.
|
|
3270
|
+
"""
|
|
3271
|
+
return HeaderCard(
|
|
3272
|
+
box,
|
|
3273
|
+
title,
|
|
3274
|
+
subtitle,
|
|
3275
|
+
icon,
|
|
3276
|
+
icon_color,
|
|
3277
|
+
image,
|
|
3278
|
+
nav,
|
|
3279
|
+
items,
|
|
3280
|
+
secondary_items,
|
|
3281
|
+
color,
|
|
3282
|
+
commands,
|
|
3283
|
+
)
|
|
3284
|
+
|
|
3285
|
+
|
|
3286
|
+
def image_card(
|
|
3287
|
+
box: str,
|
|
3288
|
+
title: str,
|
|
3289
|
+
type: Optional[str] = None,
|
|
3290
|
+
image: Optional[str] = None,
|
|
3291
|
+
data: Optional[PackedRecord] = None,
|
|
3292
|
+
path: Optional[str] = None,
|
|
3293
|
+
path_popup: Optional[str] = None,
|
|
3294
|
+
commands: Optional[List[Command]] = None,
|
|
3295
|
+
) -> ImageCard:
|
|
3296
|
+
"""Create a card that displays a base64-encoded image.
|
|
3297
|
+
|
|
3298
|
+
Args:
|
|
3299
|
+
box: A string indicating how to place this component on the page.
|
|
3300
|
+
title: The card's title.
|
|
3301
|
+
type: The image MIME subtype. One of `apng`, `bmp`, `gif`, `x-icon`, `jpeg`, `png`, `webp`.
|
|
3302
|
+
image: Image data, base64-encoded.
|
|
3303
|
+
data: Data for this card.
|
|
3304
|
+
path: The path or URL or data URL of the image, e.g. `/foo.png` or `http://example.com/foo.png` or `data:image/png;base64,???`.
|
|
3305
|
+
path_popup: The path or URL or data URL of the image displayed in the popup after clicking the image. Does not replace the `path` property.
|
|
3306
|
+
commands: Contextual menu commands for this component.
|
|
3307
|
+
Returns:
|
|
3308
|
+
A `h2o_wave.types.ImageCard` instance.
|
|
3309
|
+
"""
|
|
3310
|
+
return ImageCard(
|
|
3311
|
+
box,
|
|
3312
|
+
title,
|
|
3313
|
+
type,
|
|
3314
|
+
image,
|
|
3315
|
+
data,
|
|
3316
|
+
path,
|
|
3317
|
+
path_popup,
|
|
3318
|
+
commands,
|
|
3319
|
+
)
|
|
3320
|
+
|
|
3321
|
+
|
|
3322
|
+
def large_bar_stat_card(
|
|
3323
|
+
box: str,
|
|
3324
|
+
title: str,
|
|
3325
|
+
caption: str,
|
|
3326
|
+
value: str,
|
|
3327
|
+
aux_value: str,
|
|
3328
|
+
value_caption: str,
|
|
3329
|
+
aux_value_caption: str,
|
|
3330
|
+
progress: float,
|
|
3331
|
+
plot_color: Optional[str] = None,
|
|
3332
|
+
data: Optional[PackedRecord] = None,
|
|
3333
|
+
commands: Optional[List[Command]] = None,
|
|
3334
|
+
) -> LargeBarStatCard:
|
|
3335
|
+
"""Create a large captioned card displaying a primary value, an auxiliary value and a progress bar, with captions for each value.
|
|
3336
|
+
|
|
3337
|
+
Args:
|
|
3338
|
+
box: A string indicating how to place this component on the page.
|
|
3339
|
+
title: The card's title.
|
|
3340
|
+
caption: The card's caption.
|
|
3341
|
+
value: The primary value displayed.
|
|
3342
|
+
aux_value: The auxiliary value, typically a target value.
|
|
3343
|
+
value_caption: The caption displayed below the primary value.
|
|
3344
|
+
aux_value_caption: The caption displayed below the auxiliary value.
|
|
3345
|
+
progress: The value of the progress bar, between 0 and 1.
|
|
3346
|
+
plot_color: The color of the progress bar.
|
|
3347
|
+
data: Data for this card.
|
|
3348
|
+
commands: Contextual menu commands for this component.
|
|
3349
|
+
Returns:
|
|
3350
|
+
A `h2o_wave.types.LargeBarStatCard` instance.
|
|
3351
|
+
"""
|
|
3352
|
+
return LargeBarStatCard(
|
|
3353
|
+
box,
|
|
3354
|
+
title,
|
|
3355
|
+
caption,
|
|
3356
|
+
value,
|
|
3357
|
+
aux_value,
|
|
3358
|
+
value_caption,
|
|
3359
|
+
aux_value_caption,
|
|
3360
|
+
progress,
|
|
3361
|
+
plot_color,
|
|
3362
|
+
data,
|
|
3363
|
+
commands,
|
|
3364
|
+
)
|
|
3365
|
+
|
|
3366
|
+
|
|
3367
|
+
def large_stat_card(
|
|
3368
|
+
box: str,
|
|
3369
|
+
title: str,
|
|
3370
|
+
value: str,
|
|
3371
|
+
aux_value: str,
|
|
3372
|
+
caption: str,
|
|
3373
|
+
data: Optional[PackedRecord] = None,
|
|
3374
|
+
commands: Optional[List[Command]] = None,
|
|
3375
|
+
) -> LargeStatCard:
|
|
3376
|
+
"""Create a stat card displaying a primary value, an auxiliary value and a caption.
|
|
3377
|
+
|
|
3378
|
+
Args:
|
|
3379
|
+
box: A string indicating how to place this component on the page.
|
|
3380
|
+
title: The card's title.
|
|
3381
|
+
value: The primary value displayed.
|
|
3382
|
+
aux_value: The auxiliary value displayed next to the primary value.
|
|
3383
|
+
caption: The caption displayed below the primary value.
|
|
3384
|
+
data: Data for this card.
|
|
3385
|
+
commands: Contextual menu commands for this component.
|
|
3386
|
+
Returns:
|
|
3387
|
+
A `h2o_wave.types.LargeStatCard` instance.
|
|
3388
|
+
"""
|
|
3389
|
+
return LargeStatCard(
|
|
3390
|
+
box,
|
|
3391
|
+
title,
|
|
3392
|
+
value,
|
|
3393
|
+
aux_value,
|
|
3394
|
+
caption,
|
|
3395
|
+
data,
|
|
3396
|
+
commands,
|
|
3397
|
+
)
|
|
3398
|
+
|
|
3399
|
+
|
|
3400
|
+
def list_card(
|
|
3401
|
+
box: str,
|
|
3402
|
+
title: str,
|
|
3403
|
+
item_view: str,
|
|
3404
|
+
item_props: PackedRecord,
|
|
3405
|
+
data: PackedData,
|
|
3406
|
+
commands: Optional[List[Command]] = None,
|
|
3407
|
+
) -> ListCard:
|
|
3408
|
+
"""EXPERIMENTAL. DO NOT USE.
|
|
3409
|
+
Create a card containing other cards laid out in the form of a list (vertically, top-to-bottom).
|
|
3410
|
+
|
|
3411
|
+
Args:
|
|
3412
|
+
box: A string indicating how to place this component on the page.
|
|
3413
|
+
title: The title for this card.
|
|
3414
|
+
item_view: The child card type.
|
|
3415
|
+
item_props: The child card properties.
|
|
3416
|
+
data: Data for this card.
|
|
3417
|
+
commands: Contextual menu commands for this component.
|
|
3418
|
+
Returns:
|
|
3419
|
+
A `h2o_wave.types.ListCard` instance.
|
|
3420
|
+
"""
|
|
3421
|
+
return ListCard(
|
|
3422
|
+
box,
|
|
3423
|
+
title,
|
|
3424
|
+
item_view,
|
|
3425
|
+
item_props,
|
|
3426
|
+
data,
|
|
3427
|
+
commands,
|
|
3428
|
+
)
|
|
3429
|
+
|
|
3430
|
+
|
|
3431
|
+
def list_item1_card(
|
|
3432
|
+
box: str,
|
|
3433
|
+
title: str,
|
|
3434
|
+
caption: str,
|
|
3435
|
+
value: str,
|
|
3436
|
+
aux_value: str,
|
|
3437
|
+
data: PackedRecord,
|
|
3438
|
+
commands: Optional[List[Command]] = None,
|
|
3439
|
+
) -> ListItem1Card:
|
|
3440
|
+
"""EXPERIMENTAL. DO NOT USE.
|
|
3441
|
+
|
|
3442
|
+
Args:
|
|
3443
|
+
box: A string indicating how to place this component on the page.
|
|
3444
|
+
title: EXPERIMENTAL. DO NOT USE.
|
|
3445
|
+
caption: EXPERIMENTAL. DO NOT USE.
|
|
3446
|
+
value: EXPERIMENTAL. DO NOT USE.
|
|
3447
|
+
aux_value: EXPERIMENTAL. DO NOT USE.
|
|
3448
|
+
data: EXPERIMENTAL. DO NOT USE.
|
|
3449
|
+
commands: Contextual menu commands for this component.
|
|
3450
|
+
Returns:
|
|
3451
|
+
A `h2o_wave.types.ListItem1Card` instance.
|
|
3452
|
+
"""
|
|
3453
|
+
return ListItem1Card(
|
|
3454
|
+
box,
|
|
3455
|
+
title,
|
|
3456
|
+
caption,
|
|
3457
|
+
value,
|
|
3458
|
+
aux_value,
|
|
3459
|
+
data,
|
|
3460
|
+
commands,
|
|
3461
|
+
)
|
|
3462
|
+
|
|
3463
|
+
|
|
3464
|
+
def markdown_card(
|
|
3465
|
+
box: str,
|
|
3466
|
+
title: str,
|
|
3467
|
+
content: str,
|
|
3468
|
+
data: Optional[PackedRecord] = None,
|
|
3469
|
+
compact: Optional[bool] = None,
|
|
3470
|
+
commands: Optional[List[Command]] = None,
|
|
3471
|
+
) -> MarkdownCard:
|
|
3472
|
+
"""Create a card that renders Markdown content.
|
|
3473
|
+
|
|
3474
|
+
Github-flavored markdown is supported.
|
|
3475
|
+
HTML markup is allowed in markdown content.
|
|
3476
|
+
URLs, if found, are displayed as hyperlinks.
|
|
3477
|
+
Copyright, reserved, trademark, quotes, etc. are replaced with language-neutral symbols.
|
|
3478
|
+
|
|
3479
|
+
Args:
|
|
3480
|
+
box: A string indicating how to place this component on the page.
|
|
3481
|
+
title: The title for this card.
|
|
3482
|
+
content: The markdown content. Supports Github Flavored Markdown (GFM): https://guides.github.com/features/mastering-markdown/
|
|
3483
|
+
data: Additional data for the card.
|
|
3484
|
+
compact: Make spacing tighter. Defaults to True.
|
|
3485
|
+
commands: Contextual menu commands for this component.
|
|
3486
|
+
Returns:
|
|
3487
|
+
A `h2o_wave.types.MarkdownCard` instance.
|
|
3488
|
+
"""
|
|
3489
|
+
return MarkdownCard(
|
|
3490
|
+
box,
|
|
3491
|
+
title,
|
|
3492
|
+
content,
|
|
3493
|
+
data,
|
|
3494
|
+
compact,
|
|
3495
|
+
commands,
|
|
3496
|
+
)
|
|
3497
|
+
|
|
3498
|
+
|
|
3499
|
+
def markup_card(
|
|
3500
|
+
box: str,
|
|
3501
|
+
title: str,
|
|
3502
|
+
content: str,
|
|
3503
|
+
compact: Optional[bool] = None,
|
|
3504
|
+
commands: Optional[List[Command]] = None,
|
|
3505
|
+
) -> MarkupCard:
|
|
3506
|
+
"""Render HTML content.
|
|
3507
|
+
|
|
3508
|
+
Args:
|
|
3509
|
+
box: A string indicating how to place this component on the page.
|
|
3510
|
+
title: The title for this card.
|
|
3511
|
+
content: The HTML content.
|
|
3512
|
+
compact: True if outer spacing should be removed. Defaults to False.
|
|
3513
|
+
commands: Contextual menu commands for this component.
|
|
3514
|
+
Returns:
|
|
3515
|
+
A `h2o_wave.types.MarkupCard` instance.
|
|
3516
|
+
"""
|
|
3517
|
+
return MarkupCard(
|
|
3518
|
+
box,
|
|
3519
|
+
title,
|
|
3520
|
+
content,
|
|
3521
|
+
compact,
|
|
3522
|
+
commands,
|
|
3523
|
+
)
|
|
3524
|
+
|
|
3525
|
+
|
|
3526
|
+
def notification_bar(
|
|
3527
|
+
text: str,
|
|
3528
|
+
type: Optional[str] = None,
|
|
3529
|
+
timeout: Optional[int] = None,
|
|
3530
|
+
buttons: Optional[List[Component]] = None,
|
|
3531
|
+
position: Optional[str] = None,
|
|
3532
|
+
events: Optional[List[str]] = None,
|
|
3533
|
+
name: Optional[str] = None,
|
|
3534
|
+
) -> NotificationBar:
|
|
3535
|
+
"""Create a notification bar.
|
|
3536
|
+
|
|
3537
|
+
A notification bar is an area at the edge of a primary view that displays relevant status information.
|
|
3538
|
+
You can use a notification bar to tell the user about a result of an action, e.g. "Data has been successfully saved".
|
|
3539
|
+
|
|
3540
|
+
Args:
|
|
3541
|
+
text: The text displayed on the notification bar.
|
|
3542
|
+
type: The icon and color of the notification bar. Defaults to 'info'. One of 'info', 'error', 'warning', 'success', 'danger', 'blocked'. See enum h2o_wave.ui.NotificationBarType.
|
|
3543
|
+
timeout: How long the notification stays visible, in seconds. If set to -1, the notification has to be closed manually. Defaults to 5.
|
|
3544
|
+
buttons: Specify one or more action buttons.
|
|
3545
|
+
position: Specify the location of notification. Defaults to 'top-right'. One of 'top-right', 'bottom-right', 'bottom-center', 'bottom-left', 'top-left', 'top-center'. See enum h2o_wave.ui.NotificationBarPosition.
|
|
3546
|
+
events: The events to capture on this notification bar. One of 'dismissed'.
|
|
3547
|
+
name: An identifying name for this component.
|
|
3548
|
+
Returns:
|
|
3549
|
+
A `h2o_wave.types.NotificationBar` instance.
|
|
3550
|
+
"""
|
|
3551
|
+
return NotificationBar(
|
|
3552
|
+
text,
|
|
3553
|
+
type,
|
|
3554
|
+
timeout,
|
|
3555
|
+
buttons,
|
|
3556
|
+
position,
|
|
3557
|
+
events,
|
|
3558
|
+
name,
|
|
3559
|
+
)
|
|
3560
|
+
|
|
3561
|
+
|
|
3562
|
+
def zone(
|
|
3563
|
+
name: str,
|
|
3564
|
+
size: Optional[str] = None,
|
|
3565
|
+
direction: Optional[str] = None,
|
|
3566
|
+
justify: Optional[str] = None,
|
|
3567
|
+
align: Optional[str] = None,
|
|
3568
|
+
wrap: Optional[str] = None,
|
|
3569
|
+
zones: Optional[List[Zone]] = None,
|
|
3570
|
+
) -> Zone:
|
|
3571
|
+
"""Represents an zone within a page layout.
|
|
3572
|
+
|
|
3573
|
+
Args:
|
|
3574
|
+
name: An identifying name for this zone.
|
|
3575
|
+
size: The size of this zone.
|
|
3576
|
+
direction: Layout direction. One of 'row', 'column'. See enum h2o_wave.ui.ZoneDirection.
|
|
3577
|
+
justify: Layout strategy for main axis. One of 'start', 'end', 'center', 'between', 'around'. See enum h2o_wave.ui.ZoneJustify.
|
|
3578
|
+
align: Layout strategy for cross axis. One of 'start', 'end', 'center', 'stretch'. See enum h2o_wave.ui.ZoneAlign.
|
|
3579
|
+
wrap: Wrapping strategy. One of 'start', 'end', 'center', 'between', 'around', 'stretch'. See enum h2o_wave.ui.ZoneWrap.
|
|
3580
|
+
zones: The sub-zones contained inside this zone.
|
|
3581
|
+
Returns:
|
|
3582
|
+
A `h2o_wave.types.Zone` instance.
|
|
3583
|
+
"""
|
|
3584
|
+
return Zone(
|
|
3585
|
+
name,
|
|
3586
|
+
size,
|
|
3587
|
+
direction,
|
|
3588
|
+
justify,
|
|
3589
|
+
align,
|
|
3590
|
+
wrap,
|
|
3591
|
+
zones,
|
|
3592
|
+
)
|
|
3593
|
+
|
|
3594
|
+
|
|
3595
|
+
def layout(
|
|
3596
|
+
breakpoint: str,
|
|
3597
|
+
zones: List[Zone],
|
|
3598
|
+
width: Optional[str] = None,
|
|
3599
|
+
min_width: Optional[str] = None,
|
|
3600
|
+
max_width: Optional[str] = None,
|
|
3601
|
+
height: Optional[str] = None,
|
|
3602
|
+
min_height: Optional[str] = None,
|
|
3603
|
+
max_height: Optional[str] = None,
|
|
3604
|
+
name: Optional[str] = None,
|
|
3605
|
+
) -> Layout:
|
|
3606
|
+
"""Represents the layout structure for a page.
|
|
3607
|
+
|
|
3608
|
+
Args:
|
|
3609
|
+
breakpoint: The minimum viewport width at which to use this layout. Values must be pixel widths (e.g. '0px', '576px', '768px') or a named preset. The named presets are: 'xs': '0px' for extra small devices (portrait phones), 's': '576px' for small devices (landscape phones), 'm': '768px' for medium devices (tablets), 'l': '992px' for large devices (desktops), 'xl': '1200px' for extra large devices (large desktops). A breakpoint value of 'xs' (or '0') matches all viewport widths, unless other breakpoints are set.
|
|
3610
|
+
zones: The zones in this layout. Each zones can in turn contain sub-zones.
|
|
3611
|
+
width: The width of the layout. Defaults to `100%`.
|
|
3612
|
+
min_width: The minimum width of the layout.
|
|
3613
|
+
max_width: The maximum width of the layout.
|
|
3614
|
+
height: The height of the layout. Defaults to `auto`.
|
|
3615
|
+
min_height: The minimum height of the layout.
|
|
3616
|
+
max_height: The maximum height of the layout.
|
|
3617
|
+
name: An identifying name for this zone.
|
|
3618
|
+
Returns:
|
|
3619
|
+
A `h2o_wave.types.Layout` instance.
|
|
3620
|
+
"""
|
|
3621
|
+
return Layout(
|
|
3622
|
+
breakpoint,
|
|
3623
|
+
zones,
|
|
3624
|
+
width,
|
|
3625
|
+
min_width,
|
|
3626
|
+
max_width,
|
|
3627
|
+
height,
|
|
3628
|
+
min_height,
|
|
3629
|
+
max_height,
|
|
3630
|
+
name,
|
|
3631
|
+
)
|
|
3632
|
+
|
|
3633
|
+
|
|
3634
|
+
def dialog(
|
|
3635
|
+
title: str,
|
|
3636
|
+
items: List[Component],
|
|
3637
|
+
width: Optional[str] = None,
|
|
3638
|
+
closable: Optional[bool] = None,
|
|
3639
|
+
blocking: Optional[bool] = None,
|
|
3640
|
+
primary: Optional[bool] = None,
|
|
3641
|
+
name: Optional[str] = None,
|
|
3642
|
+
events: Optional[List[str]] = None,
|
|
3643
|
+
) -> Dialog:
|
|
3644
|
+
"""A dialog box (Dialog) is a temporary pop-up that takes focus from the page or app
|
|
3645
|
+
and requires people to interact with it. It’s primarily used for confirming actions,
|
|
3646
|
+
such as deleting a file, or asking people to make a choice.
|
|
3647
|
+
|
|
3648
|
+
Args:
|
|
3649
|
+
title: The dialog's title.
|
|
3650
|
+
items: The components displayed in this dialog.
|
|
3651
|
+
width: The width of the dialog, e.g. '400px'. Defaults to '600px'.
|
|
3652
|
+
closable: True if the dialog should have a closing 'X' button at the top right corner.
|
|
3653
|
+
blocking: True to prevent closing when clicking or tapping outside the dialog. Prevents interacting with the page behind the dialog. Defaults to False.
|
|
3654
|
+
primary: Dialog with large header banner, mutually exclusive with `closable` prop. Defaults to False.
|
|
3655
|
+
name: An identifying name for this component.
|
|
3656
|
+
events: The events to capture on this dialog. One of 'dismissed'.
|
|
3657
|
+
Returns:
|
|
3658
|
+
A `h2o_wave.types.Dialog` instance.
|
|
3659
|
+
"""
|
|
3660
|
+
return Dialog(
|
|
3661
|
+
title,
|
|
3662
|
+
items,
|
|
3663
|
+
width,
|
|
3664
|
+
closable,
|
|
3665
|
+
blocking,
|
|
3666
|
+
primary,
|
|
3667
|
+
name,
|
|
3668
|
+
events,
|
|
3669
|
+
)
|
|
3670
|
+
|
|
3671
|
+
|
|
3672
|
+
def side_panel(
|
|
3673
|
+
title: str,
|
|
3674
|
+
items: List[Component],
|
|
3675
|
+
width: Optional[str] = None,
|
|
3676
|
+
name: Optional[str] = None,
|
|
3677
|
+
events: Optional[List[str]] = None,
|
|
3678
|
+
blocking: Optional[bool] = None,
|
|
3679
|
+
closable: Optional[bool] = None,
|
|
3680
|
+
) -> SidePanel:
|
|
3681
|
+
"""A dialog box (Dialog) is a temporary pop-up that takes focus from the page or app
|
|
3682
|
+
and requires people to interact with it. It’s primarily used for confirming actions,
|
|
3683
|
+
such as deleting a file, or asking people to make a choice.
|
|
3684
|
+
|
|
3685
|
+
Args:
|
|
3686
|
+
title: The side panel's title.
|
|
3687
|
+
items: The components displayed in this side panel.
|
|
3688
|
+
width: The width of the dialog, e.g. '400px'. Defaults to '600px'.
|
|
3689
|
+
name: An identifying name for this component.
|
|
3690
|
+
events: The events to capture on this side panel. One of 'dismissed'.
|
|
3691
|
+
blocking: True to prevent closing when clicking or tapping outside the side panel. Prevents interacting with the page behind the side panel. Defaults to False.
|
|
3692
|
+
closable: True if the side panel should have a closing 'X' button at the top right corner.
|
|
3693
|
+
Returns:
|
|
3694
|
+
A `h2o_wave.types.SidePanel` instance.
|
|
3695
|
+
"""
|
|
3696
|
+
return SidePanel(
|
|
3697
|
+
title,
|
|
3698
|
+
items,
|
|
3699
|
+
width,
|
|
3700
|
+
name,
|
|
3701
|
+
events,
|
|
3702
|
+
blocking,
|
|
3703
|
+
closable,
|
|
3704
|
+
)
|
|
3705
|
+
|
|
3706
|
+
|
|
3707
|
+
def theme(
|
|
3708
|
+
name: str,
|
|
3709
|
+
text: str,
|
|
3710
|
+
card: str,
|
|
3711
|
+
page: str,
|
|
3712
|
+
primary: str,
|
|
3713
|
+
) -> Theme:
|
|
3714
|
+
"""Theme (color scheme) to apply colors to the app.
|
|
3715
|
+
|
|
3716
|
+
Args:
|
|
3717
|
+
name: An identifying name for this theme.
|
|
3718
|
+
text: Base color of the textual components.
|
|
3719
|
+
card: Card background color.
|
|
3720
|
+
page: Page background color.
|
|
3721
|
+
primary: Primary color used to accent components.
|
|
3722
|
+
Returns:
|
|
3723
|
+
A `h2o_wave.types.Theme` instance.
|
|
3724
|
+
"""
|
|
3725
|
+
return Theme(
|
|
3726
|
+
name,
|
|
3727
|
+
text,
|
|
3728
|
+
card,
|
|
3729
|
+
page,
|
|
3730
|
+
primary,
|
|
3731
|
+
)
|
|
3732
|
+
|
|
3733
|
+
|
|
3734
|
+
def tracker(
|
|
3735
|
+
type: str,
|
|
3736
|
+
id: str,
|
|
3737
|
+
) -> Tracker:
|
|
3738
|
+
"""Configure user interaction tracking (analytics) for a page.
|
|
3739
|
+
|
|
3740
|
+
Args:
|
|
3741
|
+
type: The tracking provider. Supported providers are `ga` (Google Analytics) and `gtag` (Google Global Site Tags or gtag.js) One of 'ga', 'gtag'. See enum h2o_wave.ui.TrackerType.
|
|
3742
|
+
id: The tracking ID or measurement ID.
|
|
3743
|
+
Returns:
|
|
3744
|
+
A `h2o_wave.types.Tracker` instance.
|
|
3745
|
+
"""
|
|
3746
|
+
return Tracker(
|
|
3747
|
+
type,
|
|
3748
|
+
id,
|
|
3749
|
+
)
|
|
3750
|
+
|
|
3751
|
+
|
|
3752
|
+
def script(
|
|
3753
|
+
path: str,
|
|
3754
|
+
asynchronous: Optional[bool] = None,
|
|
3755
|
+
cross_origin: Optional[str] = None,
|
|
3756
|
+
referrer_policy: Optional[str] = None,
|
|
3757
|
+
integrity: Optional[str] = None,
|
|
3758
|
+
type: Optional[str] = None,
|
|
3759
|
+
) -> Script:
|
|
3760
|
+
"""Create a reference to an external Javascript file to be included on a page.
|
|
3761
|
+
|
|
3762
|
+
Args:
|
|
3763
|
+
path: The URI of an external script.
|
|
3764
|
+
asynchronous: Whether to fetch and load this script in parallel to parsing and evaluated as soon as it is available.
|
|
3765
|
+
cross_origin: The CORS setting for this script. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin
|
|
3766
|
+
referrer_policy: Indicates which referrer to send when fetching the script. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
|
3767
|
+
integrity: The cryptographic hash to verify the script's integrity. See https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
|
|
3768
|
+
type: Type of the script. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type
|
|
3769
|
+
Returns:
|
|
3770
|
+
A `h2o_wave.types.Script` instance.
|
|
3771
|
+
"""
|
|
3772
|
+
return Script(
|
|
3773
|
+
path,
|
|
3774
|
+
asynchronous,
|
|
3775
|
+
cross_origin,
|
|
3776
|
+
referrer_policy,
|
|
3777
|
+
integrity,
|
|
3778
|
+
type,
|
|
3779
|
+
)
|
|
3780
|
+
|
|
3781
|
+
|
|
3782
|
+
def inline_script(
|
|
3783
|
+
content: str,
|
|
3784
|
+
requires: Optional[List[str]] = None,
|
|
3785
|
+
targets: Optional[List[str]] = None,
|
|
3786
|
+
) -> InlineScript:
|
|
3787
|
+
"""Create a block of inline Javascript to be executed immediately on a page.
|
|
3788
|
+
|
|
3789
|
+
Args:
|
|
3790
|
+
content: The Javascript source code to be executed.
|
|
3791
|
+
requires: The names of modules required on the page's `window` global before running this script.
|
|
3792
|
+
targets: The HTML elements required to be present on the page before running this script. Each 'target' can either be the ID of the element (`foo`) or a CSS selector (`#foo`, `.foo`, `table > td.foo`, etc.).
|
|
3793
|
+
Returns:
|
|
3794
|
+
A `h2o_wave.types.InlineScript` instance.
|
|
3795
|
+
"""
|
|
3796
|
+
return InlineScript(
|
|
3797
|
+
content,
|
|
3798
|
+
requires,
|
|
3799
|
+
targets,
|
|
3800
|
+
)
|
|
3801
|
+
|
|
3802
|
+
|
|
3803
|
+
def inline_stylesheet(
|
|
3804
|
+
content: str,
|
|
3805
|
+
media: Optional[str] = None,
|
|
3806
|
+
) -> InlineStylesheet:
|
|
3807
|
+
"""Create an inline CSS to be injected into a page.
|
|
3808
|
+
|
|
3809
|
+
Args:
|
|
3810
|
+
content: The CSS to be applied to this page.
|
|
3811
|
+
media: A valid media query to set conditions for when the style should be applied. More info at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style#attr-media.
|
|
3812
|
+
Returns:
|
|
3813
|
+
A `h2o_wave.types.InlineStylesheet` instance.
|
|
3814
|
+
"""
|
|
3815
|
+
return InlineStylesheet(
|
|
3816
|
+
content,
|
|
3817
|
+
media,
|
|
3818
|
+
)
|
|
3819
|
+
|
|
3820
|
+
|
|
3821
|
+
def stylesheet(
|
|
3822
|
+
path: str,
|
|
3823
|
+
media: Optional[str] = None,
|
|
3824
|
+
cross_origin: Optional[str] = None,
|
|
3825
|
+
) -> Stylesheet:
|
|
3826
|
+
"""Create a reference to an external CSS file to be included on a page.
|
|
3827
|
+
|
|
3828
|
+
Args:
|
|
3829
|
+
path: The URI of an external stylesheet.
|
|
3830
|
+
media: A valid media query to set conditions for when the stylesheet should be loaded. More info at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-media.
|
|
3831
|
+
cross_origin: The CORS setting. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin
|
|
3832
|
+
Returns:
|
|
3833
|
+
A `h2o_wave.types.Stylesheet` instance.
|
|
3834
|
+
"""
|
|
3835
|
+
return Stylesheet(
|
|
3836
|
+
path,
|
|
3837
|
+
media,
|
|
3838
|
+
cross_origin,
|
|
3839
|
+
)
|
|
3840
|
+
|
|
3841
|
+
|
|
3842
|
+
def meta_card(
|
|
3843
|
+
box: str,
|
|
3844
|
+
title: Optional[str] = None,
|
|
3845
|
+
refresh: Optional[int] = None,
|
|
3846
|
+
notification: Optional[str] = None,
|
|
3847
|
+
notification_bar: Optional[NotificationBar] = None,
|
|
3848
|
+
redirect: Optional[str] = None,
|
|
3849
|
+
icon: Optional[str] = None,
|
|
3850
|
+
layouts: Optional[List[Layout]] = None,
|
|
3851
|
+
dialog: Optional[Dialog] = None,
|
|
3852
|
+
side_panel: Optional[SidePanel] = None,
|
|
3853
|
+
theme: Optional[str] = None,
|
|
3854
|
+
themes: Optional[List[Theme]] = None,
|
|
3855
|
+
tracker: Optional[Tracker] = None,
|
|
3856
|
+
scripts: Optional[List[Script]] = None,
|
|
3857
|
+
script: Optional[InlineScript] = None,
|
|
3858
|
+
stylesheet: Optional[InlineStylesheet] = None,
|
|
3859
|
+
stylesheets: Optional[List[Stylesheet]] = None,
|
|
3860
|
+
animate: Optional[bool] = None,
|
|
3861
|
+
commands: Optional[List[Command]] = None,
|
|
3862
|
+
) -> MetaCard:
|
|
3863
|
+
"""Represents page-global state.
|
|
3864
|
+
|
|
3865
|
+
This card is invisible.
|
|
3866
|
+
It is used to control attributes of the active page.
|
|
3867
|
+
|
|
3868
|
+
Args:
|
|
3869
|
+
box: A string indicating how to place this component on the page.
|
|
3870
|
+
title: The title of the page.
|
|
3871
|
+
refresh: Refresh rate in seconds. A value of 0 turns off live-updates. Values != 0 are currently ignored (reserved for future use).
|
|
3872
|
+
notification: Display a desktop notification.
|
|
3873
|
+
notification_bar: Display an in-app notification bar.
|
|
3874
|
+
redirect: Redirect the page to a new URL.
|
|
3875
|
+
icon: Shortcut icon path. Preferably a `.png` file (`.ico` files may not work in mobile browsers). Not supported in Safari.
|
|
3876
|
+
layouts: The layouts supported by this page.
|
|
3877
|
+
dialog: Display a dialog on the page.
|
|
3878
|
+
side_panel: Display a side panel on the page.
|
|
3879
|
+
theme: Specify the name of the theme (color scheme) to use on this page. One of 'light', 'neon' or 'h2o-dark'.
|
|
3880
|
+
themes: * Themes (color schemes) that define color used in the app.
|
|
3881
|
+
tracker: Configure a tracker for the page (for web analytics).
|
|
3882
|
+
scripts: External Javascript files to load into the page.
|
|
3883
|
+
script: Javascript code to execute on this page.
|
|
3884
|
+
stylesheet: CSS stylesheet to be applied to this page.
|
|
3885
|
+
stylesheets: External CSS files to load into the page.
|
|
3886
|
+
animate: EXPERIMENTAL: True to turn on the card animations. Defaults to False.
|
|
3887
|
+
commands: Contextual menu commands for this component.
|
|
3888
|
+
Returns:
|
|
3889
|
+
A `h2o_wave.types.MetaCard` instance.
|
|
3890
|
+
"""
|
|
3891
|
+
return MetaCard(
|
|
3892
|
+
box,
|
|
3893
|
+
title,
|
|
3894
|
+
refresh,
|
|
3895
|
+
notification,
|
|
3896
|
+
notification_bar,
|
|
3897
|
+
redirect,
|
|
3898
|
+
icon,
|
|
3899
|
+
layouts,
|
|
3900
|
+
dialog,
|
|
3901
|
+
side_panel,
|
|
3902
|
+
theme,
|
|
3903
|
+
themes,
|
|
3904
|
+
tracker,
|
|
3905
|
+
scripts,
|
|
3906
|
+
script,
|
|
3907
|
+
stylesheet,
|
|
3908
|
+
stylesheets,
|
|
3909
|
+
animate,
|
|
3910
|
+
commands,
|
|
3911
|
+
)
|
|
3912
|
+
|
|
3913
|
+
|
|
3914
|
+
def nav_card(
|
|
3915
|
+
box: str,
|
|
3916
|
+
items: List[NavGroup],
|
|
3917
|
+
value: Optional[str] = None,
|
|
3918
|
+
title: Optional[str] = None,
|
|
3919
|
+
subtitle: Optional[str] = None,
|
|
3920
|
+
icon: Optional[str] = None,
|
|
3921
|
+
icon_color: Optional[str] = None,
|
|
3922
|
+
image: Optional[str] = None,
|
|
3923
|
+
persona: Optional[Component] = None,
|
|
3924
|
+
secondary_items: Optional[List[Component]] = None,
|
|
3925
|
+
color: Optional[str] = None,
|
|
3926
|
+
commands: Optional[List[Command]] = None,
|
|
3927
|
+
) -> NavCard:
|
|
3928
|
+
"""Create a card containing a navigation pane.
|
|
3929
|
+
|
|
3930
|
+
Args:
|
|
3931
|
+
box: A string indicating how to place this component on the page.
|
|
3932
|
+
items: The navigation groups contained in this pane.
|
|
3933
|
+
value: The name of the active (highlighted) navigation item.
|
|
3934
|
+
title: The card's title.
|
|
3935
|
+
subtitle: The card's subtitle.
|
|
3936
|
+
icon: The icon, displayed to the left. *
|
|
3937
|
+
icon_color: The icon's color. *
|
|
3938
|
+
image: The URL of an image (usually logo) displayed at the top. *
|
|
3939
|
+
persona: The user avatar displayed at the top. Mutually exclusive with image, title and subtitle. *
|
|
3940
|
+
secondary_items: Items that should be displayed at the bottom of the card if items are not empty, otherwise displayed under subtitle.
|
|
3941
|
+
color: Card background color. Defaults to 'card'. One of 'card', 'primary'. See enum h2o_wave.ui.NavCardColor.
|
|
3942
|
+
commands: Contextual menu commands for this component.
|
|
3943
|
+
Returns:
|
|
3944
|
+
A `h2o_wave.types.NavCard` instance.
|
|
3945
|
+
"""
|
|
3946
|
+
return NavCard(
|
|
3947
|
+
box,
|
|
3948
|
+
items,
|
|
3949
|
+
value,
|
|
3950
|
+
title,
|
|
3951
|
+
subtitle,
|
|
3952
|
+
icon,
|
|
3953
|
+
icon_color,
|
|
3954
|
+
image,
|
|
3955
|
+
persona,
|
|
3956
|
+
secondary_items,
|
|
3957
|
+
color,
|
|
3958
|
+
commands,
|
|
3959
|
+
)
|
|
3960
|
+
|
|
3961
|
+
|
|
3962
|
+
def pixel_art_card(
|
|
3963
|
+
box: str,
|
|
3964
|
+
title: str,
|
|
3965
|
+
data: PackedRecord,
|
|
3966
|
+
commands: Optional[List[Command]] = None,
|
|
3967
|
+
) -> PixelArtCard:
|
|
3968
|
+
"""WARNING: Experimental and subject to change.
|
|
3969
|
+
Do not use in production sites!
|
|
3970
|
+
|
|
3971
|
+
Create a card displaying a collaborative Pixel art tool.
|
|
3972
|
+
|
|
3973
|
+
Args:
|
|
3974
|
+
box: A string indicating how to place this component on the page.
|
|
3975
|
+
title: The title for this card.
|
|
3976
|
+
data: The data for this card.
|
|
3977
|
+
commands: Contextual menu commands for this component.
|
|
3978
|
+
Returns:
|
|
3979
|
+
A `h2o_wave.types.PixelArtCard` instance.
|
|
3980
|
+
"""
|
|
3981
|
+
return PixelArtCard(
|
|
3982
|
+
box,
|
|
3983
|
+
title,
|
|
3984
|
+
data,
|
|
3985
|
+
commands,
|
|
3986
|
+
)
|
|
3987
|
+
|
|
3988
|
+
|
|
3989
|
+
def plot_card(
|
|
3990
|
+
box: str,
|
|
3991
|
+
title: str,
|
|
3992
|
+
data: PackedRecord,
|
|
3993
|
+
plot: Plot,
|
|
3994
|
+
events: Optional[List[str]] = None,
|
|
3995
|
+
interactions: Optional[List[str]] = None,
|
|
3996
|
+
animate: Optional[bool] = None,
|
|
3997
|
+
commands: Optional[List[Command]] = None,
|
|
3998
|
+
) -> PlotCard:
|
|
3999
|
+
"""Create a card displaying a plot.
|
|
4000
|
+
|
|
4001
|
+
Args:
|
|
4002
|
+
box: A string indicating how to place this component on the page.
|
|
4003
|
+
title: The title for this card.
|
|
4004
|
+
data: Data for this card.
|
|
4005
|
+
plot: The plot to be displayed in this card.
|
|
4006
|
+
events: The events to capture on this card. One of 'select_marks'.
|
|
4007
|
+
interactions: The interactions to be allowed for this card. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event.
|
|
4008
|
+
animate: EXPERIMENTAL: True to turn on the chart animations. Defaults to False.
|
|
4009
|
+
commands: Contextual menu commands for this component.
|
|
4010
|
+
Returns:
|
|
4011
|
+
A `h2o_wave.types.PlotCard` instance.
|
|
4012
|
+
"""
|
|
4013
|
+
return PlotCard(
|
|
4014
|
+
box,
|
|
4015
|
+
title,
|
|
4016
|
+
data,
|
|
4017
|
+
plot,
|
|
4018
|
+
events,
|
|
4019
|
+
interactions,
|
|
4020
|
+
animate,
|
|
4021
|
+
commands,
|
|
4022
|
+
)
|
|
4023
|
+
|
|
4024
|
+
|
|
4025
|
+
def post_card(
|
|
4026
|
+
box: str,
|
|
4027
|
+
persona: Component,
|
|
4028
|
+
image: str,
|
|
4029
|
+
aux_value: Optional[str] = None,
|
|
4030
|
+
caption: Optional[str] = None,
|
|
4031
|
+
items: Optional[List[Component]] = None,
|
|
4032
|
+
commands: Optional[List[Command]] = None,
|
|
4033
|
+
) -> PostCard:
|
|
4034
|
+
"""Create a postcard displaying a persona, image, caption and optional buttons.
|
|
4035
|
+
|
|
4036
|
+
Args:
|
|
4037
|
+
box: A string indicating how to place this component on the page.
|
|
4038
|
+
persona: The card's user avatar, 'size' prop is restricted to 'xs'.
|
|
4039
|
+
image: The card’s image.
|
|
4040
|
+
aux_value: The card's aux_value, displayed on the right hand side of the image.
|
|
4041
|
+
caption: The card's caption, displayed below the image.
|
|
4042
|
+
items: The card's buttons, displayed at the bottom.
|
|
4043
|
+
commands: Contextual menu commands for this component.
|
|
4044
|
+
Returns:
|
|
4045
|
+
A `h2o_wave.types.PostCard` instance.
|
|
4046
|
+
"""
|
|
4047
|
+
return PostCard(
|
|
4048
|
+
box,
|
|
4049
|
+
persona,
|
|
4050
|
+
image,
|
|
4051
|
+
aux_value,
|
|
4052
|
+
caption,
|
|
4053
|
+
items,
|
|
4054
|
+
commands,
|
|
4055
|
+
)
|
|
4056
|
+
|
|
4057
|
+
|
|
4058
|
+
def preview_card(
|
|
4059
|
+
box: str,
|
|
4060
|
+
name: str,
|
|
4061
|
+
image: str,
|
|
4062
|
+
title: Optional[str] = None,
|
|
4063
|
+
items: Optional[List[Component]] = None,
|
|
4064
|
+
caption: Optional[str] = None,
|
|
4065
|
+
label: Optional[str] = None,
|
|
4066
|
+
commands: Optional[List[Command]] = None,
|
|
4067
|
+
) -> PreviewCard:
|
|
4068
|
+
"""Create a preview card displaying an image with shadow overlay, title, social icons, caption, and button.
|
|
4069
|
+
|
|
4070
|
+
Args:
|
|
4071
|
+
box: A string indicating how to place this component on the page.
|
|
4072
|
+
name: An identifying name for this card. Makes the card clickable if label is not provided, similar to a button.
|
|
4073
|
+
image: The card’s image.
|
|
4074
|
+
title: The card's title
|
|
4075
|
+
items: Mini buttons displayed at the top-right corner
|
|
4076
|
+
caption: The card's caption, displayed below the title.
|
|
4077
|
+
label: Label of a button rendered at the bottom of the card. If specified, the whole card is not clickable anymore.
|
|
4078
|
+
commands: Contextual menu commands for this component.
|
|
4079
|
+
Returns:
|
|
4080
|
+
A `h2o_wave.types.PreviewCard` instance.
|
|
4081
|
+
"""
|
|
4082
|
+
return PreviewCard(
|
|
4083
|
+
box,
|
|
4084
|
+
name,
|
|
4085
|
+
image,
|
|
4086
|
+
title,
|
|
4087
|
+
items,
|
|
4088
|
+
caption,
|
|
4089
|
+
label,
|
|
4090
|
+
commands,
|
|
4091
|
+
)
|
|
4092
|
+
|
|
4093
|
+
|
|
4094
|
+
def profile_card(
|
|
4095
|
+
box: str,
|
|
4096
|
+
persona: Component,
|
|
4097
|
+
image: str,
|
|
4098
|
+
items: Optional[List[Component]] = None,
|
|
4099
|
+
height: Optional[str] = None,
|
|
4100
|
+
commands: Optional[List[Command]] = None,
|
|
4101
|
+
) -> ProfileCard:
|
|
4102
|
+
"""Create a profile card to display information about a user.
|
|
4103
|
+
|
|
4104
|
+
Args:
|
|
4105
|
+
box: A string indicating how to place this component on the page.
|
|
4106
|
+
persona: The persona represented by this card.
|
|
4107
|
+
image: The card’s image, either a base64-encoded image, a path to an image hosted externally (starting with `https://` or `http://`) or a path to an image hosted on the Wave daemon (starting with `/`). .
|
|
4108
|
+
items: Components in this card displayed below the image.
|
|
4109
|
+
height: The height of the bottom content (items), e.g. '400px'. Use sparingly, e.g. in grid views.
|
|
4110
|
+
commands: Contextual menu commands for this component.
|
|
4111
|
+
Returns:
|
|
4112
|
+
A `h2o_wave.types.ProfileCard` instance.
|
|
4113
|
+
"""
|
|
4114
|
+
return ProfileCard(
|
|
4115
|
+
box,
|
|
4116
|
+
persona,
|
|
4117
|
+
image,
|
|
4118
|
+
items,
|
|
4119
|
+
height,
|
|
4120
|
+
commands,
|
|
4121
|
+
)
|
|
4122
|
+
|
|
4123
|
+
|
|
4124
|
+
def repeat_card(
|
|
4125
|
+
box: str,
|
|
4126
|
+
item_view: str,
|
|
4127
|
+
item_props: PackedRecord,
|
|
4128
|
+
data: PackedData,
|
|
4129
|
+
commands: Optional[List[Command]] = None,
|
|
4130
|
+
) -> RepeatCard:
|
|
4131
|
+
"""EXPERIMENTAL. DO NOT USE.
|
|
4132
|
+
Create a card containing other cards.
|
|
4133
|
+
|
|
4134
|
+
Args:
|
|
4135
|
+
box: A string indicating how to place this component on the page.
|
|
4136
|
+
item_view: EXPERIMENTAL. DO NOT USE.
|
|
4137
|
+
item_props: The child card properties.
|
|
4138
|
+
data: Data for this card.
|
|
4139
|
+
commands: Contextual menu commands for this component.
|
|
4140
|
+
Returns:
|
|
4141
|
+
A `h2o_wave.types.RepeatCard` instance.
|
|
4142
|
+
"""
|
|
4143
|
+
return RepeatCard(
|
|
4144
|
+
box,
|
|
4145
|
+
item_view,
|
|
4146
|
+
item_props,
|
|
4147
|
+
data,
|
|
4148
|
+
commands,
|
|
4149
|
+
)
|
|
4150
|
+
|
|
4151
|
+
|
|
4152
|
+
def section_card(
|
|
4153
|
+
box: str,
|
|
4154
|
+
title: str,
|
|
4155
|
+
subtitle: str,
|
|
4156
|
+
items: Optional[Union[List[Component], str]] = None,
|
|
4157
|
+
commands: Optional[List[Command]] = None,
|
|
4158
|
+
) -> SectionCard:
|
|
4159
|
+
"""Render a card displaying a title, a subtitle, and optional components.
|
|
4160
|
+
Section cards are typically used to demarcate different sections on a page.
|
|
4161
|
+
|
|
4162
|
+
Args:
|
|
4163
|
+
box: A string indicating how to place this component on the page.
|
|
4164
|
+
title: The title.
|
|
4165
|
+
subtitle: The subtitle, displayed below the title. Supports Markdown.
|
|
4166
|
+
items: The components to display in this card
|
|
4167
|
+
commands: Contextual menu commands for this component.
|
|
4168
|
+
Returns:
|
|
4169
|
+
A `h2o_wave.types.SectionCard` instance.
|
|
4170
|
+
"""
|
|
4171
|
+
return SectionCard(
|
|
4172
|
+
box,
|
|
4173
|
+
title,
|
|
4174
|
+
subtitle,
|
|
4175
|
+
items,
|
|
4176
|
+
commands,
|
|
4177
|
+
)
|
|
4178
|
+
|
|
4179
|
+
|
|
4180
|
+
def small_series_stat_card(
|
|
4181
|
+
box: str,
|
|
4182
|
+
title: str,
|
|
4183
|
+
value: str,
|
|
4184
|
+
plot_data: PackedData,
|
|
4185
|
+
plot_value: str,
|
|
4186
|
+
plot_zero_value: Optional[float] = None,
|
|
4187
|
+
plot_category: Optional[str] = None,
|
|
4188
|
+
plot_type: Optional[str] = None,
|
|
4189
|
+
plot_curve: Optional[str] = None,
|
|
4190
|
+
plot_color: Optional[str] = None,
|
|
4191
|
+
data: Optional[PackedRecord] = None,
|
|
4192
|
+
commands: Optional[List[Command]] = None,
|
|
4193
|
+
) -> SmallSeriesStatCard:
|
|
4194
|
+
"""Create a small stat card displaying a primary value and a series plot.
|
|
4195
|
+
|
|
4196
|
+
Args:
|
|
4197
|
+
box: A string indicating how to place this component on the page.
|
|
4198
|
+
title: The card's title.
|
|
4199
|
+
value: The primary value displayed.
|
|
4200
|
+
plot_data: The plot's data.
|
|
4201
|
+
plot_value: The data field to use for y-axis values.
|
|
4202
|
+
plot_zero_value: The base value to use for each y-axis mark. Set this to `0` if you want to pin the x-axis at `y=0`. If not provided, the minimum value from the data is used.
|
|
4203
|
+
plot_category: The data field to use for x-axis values (ignored if `plot_type` is `area`; must be provided if `plot_type` is `interval`). Defaults to 'x'.
|
|
4204
|
+
plot_type: The type of plot. Defaults to `area`. One of 'area', 'interval'. See enum h2o_wave.ui.SmallSeriesStatCardPlotType.
|
|
4205
|
+
plot_curve: The plot's curve style. Defaults to `linear`. One of 'linear', 'smooth', 'step', 'step-after', 'step-before'. See enum h2o_wave.ui.SmallSeriesStatCardPlotCurve.
|
|
4206
|
+
plot_color: The plot's color.
|
|
4207
|
+
data: Data for this card.
|
|
4208
|
+
commands: Contextual menu commands for this component.
|
|
4209
|
+
Returns:
|
|
4210
|
+
A `h2o_wave.types.SmallSeriesStatCard` instance.
|
|
4211
|
+
"""
|
|
4212
|
+
return SmallSeriesStatCard(
|
|
4213
|
+
box,
|
|
4214
|
+
title,
|
|
4215
|
+
value,
|
|
4216
|
+
plot_data,
|
|
4217
|
+
plot_value,
|
|
4218
|
+
plot_zero_value,
|
|
4219
|
+
plot_category,
|
|
4220
|
+
plot_type,
|
|
4221
|
+
plot_curve,
|
|
4222
|
+
plot_color,
|
|
4223
|
+
data,
|
|
4224
|
+
commands,
|
|
4225
|
+
)
|
|
4226
|
+
|
|
4227
|
+
|
|
4228
|
+
def small_stat_card(
|
|
4229
|
+
box: str,
|
|
4230
|
+
title: str,
|
|
4231
|
+
value: str,
|
|
4232
|
+
data: Optional[PackedRecord] = None,
|
|
4233
|
+
commands: Optional[List[Command]] = None,
|
|
4234
|
+
) -> SmallStatCard:
|
|
4235
|
+
"""Create a stat card displaying a single value.
|
|
4236
|
+
|
|
4237
|
+
Args:
|
|
4238
|
+
box: A string indicating how to place this component on the page.
|
|
4239
|
+
title: The card's title.
|
|
4240
|
+
value: The primary value displayed.
|
|
4241
|
+
data: Data for this card.
|
|
4242
|
+
commands: Contextual menu commands for this component.
|
|
4243
|
+
Returns:
|
|
4244
|
+
A `h2o_wave.types.SmallStatCard` instance.
|
|
4245
|
+
"""
|
|
4246
|
+
return SmallStatCard(
|
|
4247
|
+
box,
|
|
4248
|
+
title,
|
|
4249
|
+
value,
|
|
4250
|
+
data,
|
|
4251
|
+
commands,
|
|
4252
|
+
)
|
|
4253
|
+
|
|
4254
|
+
|
|
4255
|
+
def stat_list_item(
|
|
4256
|
+
label: str,
|
|
4257
|
+
name: Optional[str] = None,
|
|
4258
|
+
caption: Optional[str] = None,
|
|
4259
|
+
value: Optional[str] = None,
|
|
4260
|
+
value_color: Optional[str] = None,
|
|
4261
|
+
aux_value: Optional[str] = None,
|
|
4262
|
+
icon: Optional[str] = None,
|
|
4263
|
+
icon_color: Optional[str] = None,
|
|
4264
|
+
) -> StatListItem:
|
|
4265
|
+
"""Create a stat item (a label-value pair) for stat_list_card.
|
|
4266
|
+
|
|
4267
|
+
Args:
|
|
4268
|
+
label: The label for the metric.
|
|
4269
|
+
name: An optional name for this item (required only if this item is clickable).
|
|
4270
|
+
caption: The caption for the metric, displayed below the label.
|
|
4271
|
+
value: The primary value of the metric.
|
|
4272
|
+
value_color: The font color of the primary value.
|
|
4273
|
+
aux_value: The auxiliary value, displayed below the primary value.
|
|
4274
|
+
icon: An optional icon, displayed next to the label.
|
|
4275
|
+
icon_color: The color of the icon.
|
|
4276
|
+
Returns:
|
|
4277
|
+
A `h2o_wave.types.StatListItem` instance.
|
|
4278
|
+
"""
|
|
4279
|
+
return StatListItem(
|
|
4280
|
+
label,
|
|
4281
|
+
name,
|
|
4282
|
+
caption,
|
|
4283
|
+
value,
|
|
4284
|
+
value_color,
|
|
4285
|
+
aux_value,
|
|
4286
|
+
icon,
|
|
4287
|
+
icon_color,
|
|
4288
|
+
)
|
|
4289
|
+
|
|
4290
|
+
|
|
4291
|
+
def stat_list_card(
|
|
4292
|
+
box: str,
|
|
4293
|
+
title: str,
|
|
4294
|
+
items: List[StatListItem],
|
|
4295
|
+
name: Optional[str] = None,
|
|
4296
|
+
subtitle: Optional[str] = None,
|
|
4297
|
+
commands: Optional[List[Command]] = None,
|
|
4298
|
+
) -> StatListCard:
|
|
4299
|
+
"""Render a card displaying a list of stats.
|
|
4300
|
+
|
|
4301
|
+
Args:
|
|
4302
|
+
box: A string indicating how to place this component on the page.
|
|
4303
|
+
title: The title.
|
|
4304
|
+
items: The individual stats to be displayed.
|
|
4305
|
+
name: An optional name for this item.
|
|
4306
|
+
subtitle: The subtitle, displayed below the title.
|
|
4307
|
+
commands: Contextual menu commands for this component.
|
|
4308
|
+
Returns:
|
|
4309
|
+
A `h2o_wave.types.StatListCard` instance.
|
|
4310
|
+
"""
|
|
4311
|
+
return StatListCard(
|
|
4312
|
+
box,
|
|
4313
|
+
title,
|
|
4314
|
+
items,
|
|
4315
|
+
name,
|
|
4316
|
+
subtitle,
|
|
4317
|
+
commands,
|
|
4318
|
+
)
|
|
4319
|
+
|
|
4320
|
+
|
|
4321
|
+
def stat_table_item(
|
|
4322
|
+
label: str,
|
|
4323
|
+
values: List[str],
|
|
4324
|
+
name: Optional[str] = None,
|
|
4325
|
+
caption: Optional[str] = None,
|
|
4326
|
+
icon: Optional[str] = None,
|
|
4327
|
+
icon_color: Optional[str] = None,
|
|
4328
|
+
colors: Optional[List[str]] = None,
|
|
4329
|
+
) -> StatTableItem:
|
|
4330
|
+
"""Create a stat item (a label and a set of values) for stat_table_card.
|
|
4331
|
+
|
|
4332
|
+
Args:
|
|
4333
|
+
label: The label for the row.
|
|
4334
|
+
values: The values displayed in the row.
|
|
4335
|
+
name: An optional name for this row (required only if this row is clickable).
|
|
4336
|
+
caption: The caption for the metric, displayed below the label.
|
|
4337
|
+
icon: An optional icon, displayed next to the label.
|
|
4338
|
+
icon_color: The color of the icon.
|
|
4339
|
+
colors: List of colors used for each value in values ordered respectively.
|
|
4340
|
+
Returns:
|
|
4341
|
+
A `h2o_wave.types.StatTableItem` instance.
|
|
4342
|
+
"""
|
|
4343
|
+
return StatTableItem(
|
|
4344
|
+
label,
|
|
4345
|
+
values,
|
|
4346
|
+
name,
|
|
4347
|
+
caption,
|
|
4348
|
+
icon,
|
|
4349
|
+
icon_color,
|
|
4350
|
+
colors,
|
|
4351
|
+
)
|
|
4352
|
+
|
|
4353
|
+
|
|
4354
|
+
def stat_table_card(
|
|
4355
|
+
box: str,
|
|
4356
|
+
title: str,
|
|
4357
|
+
columns: List[str],
|
|
4358
|
+
items: List[StatTableItem],
|
|
4359
|
+
name: Optional[str] = None,
|
|
4360
|
+
subtitle: Optional[str] = None,
|
|
4361
|
+
commands: Optional[List[Command]] = None,
|
|
4362
|
+
) -> StatTableCard:
|
|
4363
|
+
"""Render a card displaying a table of stats.
|
|
4364
|
+
|
|
4365
|
+
Args:
|
|
4366
|
+
box: A string indicating how to place this component on the page.
|
|
4367
|
+
title: The title.
|
|
4368
|
+
columns: The names of this table's columns.
|
|
4369
|
+
items: The rows displayed in this table.
|
|
4370
|
+
name: An optional name for this item.
|
|
4371
|
+
subtitle: The subtitle, displayed below the title.
|
|
4372
|
+
commands: Contextual menu commands for this component.
|
|
4373
|
+
Returns:
|
|
4374
|
+
A `h2o_wave.types.StatTableCard` instance.
|
|
4375
|
+
"""
|
|
4376
|
+
return StatTableCard(
|
|
4377
|
+
box,
|
|
4378
|
+
title,
|
|
4379
|
+
columns,
|
|
4380
|
+
items,
|
|
4381
|
+
name,
|
|
4382
|
+
subtitle,
|
|
4383
|
+
commands,
|
|
4384
|
+
)
|
|
4385
|
+
|
|
4386
|
+
|
|
4387
|
+
def tab_card(
|
|
4388
|
+
box: str,
|
|
4389
|
+
items: List[Tab],
|
|
4390
|
+
value: Optional[str] = None,
|
|
4391
|
+
link: Optional[bool] = None,
|
|
4392
|
+
name: Optional[str] = None,
|
|
4393
|
+
commands: Optional[List[Command]] = None,
|
|
4394
|
+
) -> TabCard:
|
|
4395
|
+
"""Create a card containing tabs for navigation.
|
|
4396
|
+
|
|
4397
|
+
Args:
|
|
4398
|
+
box: A string indicating how to place this component on the page.
|
|
4399
|
+
items: The tabs to display in this card
|
|
4400
|
+
value: The name of the tab to select.
|
|
4401
|
+
link: True if tabs should be rendered as links instead of buttons.
|
|
4402
|
+
name: An optional name for the card. If provided, the selected tab can be accessed using the name of the card.
|
|
4403
|
+
commands: Contextual menu commands for this component.
|
|
4404
|
+
Returns:
|
|
4405
|
+
A `h2o_wave.types.TabCard` instance.
|
|
4406
|
+
"""
|
|
4407
|
+
return TabCard(
|
|
4408
|
+
box,
|
|
4409
|
+
items,
|
|
4410
|
+
value,
|
|
4411
|
+
link,
|
|
4412
|
+
name,
|
|
4413
|
+
commands,
|
|
4414
|
+
)
|
|
4415
|
+
|
|
4416
|
+
|
|
4417
|
+
def tall_article_preview_card(
|
|
4418
|
+
box: str,
|
|
4419
|
+
title: str,
|
|
4420
|
+
image: str,
|
|
4421
|
+
subtitle: Optional[str] = None,
|
|
4422
|
+
value: Optional[str] = None,
|
|
4423
|
+
content: Optional[str] = None,
|
|
4424
|
+
name: Optional[str] = None,
|
|
4425
|
+
items: Optional[List[Component]] = None,
|
|
4426
|
+
commands: Optional[List[Command]] = None,
|
|
4427
|
+
) -> TallArticlePreviewCard:
|
|
4428
|
+
"""Create a tall article preview card.
|
|
4429
|
+
|
|
4430
|
+
Args:
|
|
4431
|
+
box: A string indicating how to place this component on the page.
|
|
4432
|
+
title: The card's title.
|
|
4433
|
+
image: The card’s background image URL, either a base64-encoded image, a path to an image hosted externally (starting with `https://` or `http://`) or a path to an image hosted on the Wave daemon (starting with `/`)
|
|
4434
|
+
subtitle: The card's subtitle, displayed below the title.
|
|
4435
|
+
value: The value displayed to the right of the title/subtitle.
|
|
4436
|
+
content: Markdown text.
|
|
4437
|
+
name: An identifying name for this card. Makes the card clickable, similar to a button.
|
|
4438
|
+
items: Components displayed in the body of the card.
|
|
4439
|
+
commands: Contextual menu commands for this component.
|
|
4440
|
+
Returns:
|
|
4441
|
+
A `h2o_wave.types.TallArticlePreviewCard` instance.
|
|
4442
|
+
"""
|
|
4443
|
+
return TallArticlePreviewCard(
|
|
4444
|
+
box,
|
|
4445
|
+
title,
|
|
4446
|
+
image,
|
|
4447
|
+
subtitle,
|
|
4448
|
+
value,
|
|
4449
|
+
content,
|
|
4450
|
+
name,
|
|
4451
|
+
items,
|
|
4452
|
+
commands,
|
|
4453
|
+
)
|
|
4454
|
+
|
|
4455
|
+
|
|
4456
|
+
def tall_gauge_stat_card(
|
|
4457
|
+
box: str,
|
|
4458
|
+
title: str,
|
|
4459
|
+
value: str,
|
|
4460
|
+
aux_value: str,
|
|
4461
|
+
progress: float,
|
|
4462
|
+
plot_color: Optional[str] = None,
|
|
4463
|
+
data: Optional[PackedRecord] = None,
|
|
4464
|
+
commands: Optional[List[Command]] = None,
|
|
4465
|
+
) -> TallGaugeStatCard:
|
|
4466
|
+
"""Create a tall stat card displaying a primary value, an auxiliary value and a progress gauge.
|
|
4467
|
+
|
|
4468
|
+
Args:
|
|
4469
|
+
box: A string indicating how to place this component on the page.
|
|
4470
|
+
title: The card's title.
|
|
4471
|
+
value: The primary value displayed.
|
|
4472
|
+
aux_value: The auxiliary value displayed next to the primary value.
|
|
4473
|
+
progress: The value of the progress gauge, between 0 and 1.
|
|
4474
|
+
plot_color: The color of the progress gauge.
|
|
4475
|
+
data: Data for this card.
|
|
4476
|
+
commands: Contextual menu commands for this component.
|
|
4477
|
+
Returns:
|
|
4478
|
+
A `h2o_wave.types.TallGaugeStatCard` instance.
|
|
4479
|
+
"""
|
|
4480
|
+
return TallGaugeStatCard(
|
|
4481
|
+
box,
|
|
4482
|
+
title,
|
|
4483
|
+
value,
|
|
4484
|
+
aux_value,
|
|
4485
|
+
progress,
|
|
4486
|
+
plot_color,
|
|
4487
|
+
data,
|
|
4488
|
+
commands,
|
|
4489
|
+
)
|
|
4490
|
+
|
|
4491
|
+
|
|
4492
|
+
def tall_info_card(
|
|
4493
|
+
box: str,
|
|
4494
|
+
name: str,
|
|
4495
|
+
title: str,
|
|
4496
|
+
caption: str,
|
|
4497
|
+
label: Optional[str] = None,
|
|
4498
|
+
icon: Optional[str] = None,
|
|
4499
|
+
image: Optional[str] = None,
|
|
4500
|
+
image_height: Optional[str] = None,
|
|
4501
|
+
category: Optional[str] = None,
|
|
4502
|
+
commands: Optional[List[Command]] = None,
|
|
4503
|
+
) -> TallInfoCard:
|
|
4504
|
+
"""Create a tall information card displaying a title, caption and either an icon or image.
|
|
4505
|
+
|
|
4506
|
+
Args:
|
|
4507
|
+
box: A string indicating how to place this component on the page.
|
|
4508
|
+
name: An identifying name for this card. Makes the card clickable only if name is not empty and label is empty
|
|
4509
|
+
title: The card's title.
|
|
4510
|
+
caption: The card's caption, displayed below the title. Supports markdown.
|
|
4511
|
+
label: Label of a button rendered at the bottom of the card. If specified, whole card is not clickable anymore.
|
|
4512
|
+
icon: The card's icon.
|
|
4513
|
+
image: The card’s image.
|
|
4514
|
+
image_height: The card’s image height in px. Defaults to '150px'.
|
|
4515
|
+
category: The card's category, displayed below the title.
|
|
4516
|
+
commands: Contextual menu commands for this component.
|
|
4517
|
+
Returns:
|
|
4518
|
+
A `h2o_wave.types.TallInfoCard` instance.
|
|
4519
|
+
"""
|
|
4520
|
+
return TallInfoCard(
|
|
4521
|
+
box,
|
|
4522
|
+
name,
|
|
4523
|
+
title,
|
|
4524
|
+
caption,
|
|
4525
|
+
label,
|
|
4526
|
+
icon,
|
|
4527
|
+
image,
|
|
4528
|
+
image_height,
|
|
4529
|
+
category,
|
|
4530
|
+
commands,
|
|
4531
|
+
)
|
|
4532
|
+
|
|
4533
|
+
|
|
4534
|
+
def tall_series_stat_card(
|
|
4535
|
+
box: str,
|
|
4536
|
+
title: str,
|
|
4537
|
+
value: str,
|
|
4538
|
+
aux_value: str,
|
|
4539
|
+
plot_data: PackedData,
|
|
4540
|
+
plot_value: str,
|
|
4541
|
+
plot_zero_value: Optional[float] = None,
|
|
4542
|
+
plot_category: Optional[str] = None,
|
|
4543
|
+
plot_type: Optional[str] = None,
|
|
4544
|
+
plot_curve: Optional[str] = None,
|
|
4545
|
+
plot_color: Optional[str] = None,
|
|
4546
|
+
data: Optional[PackedRecord] = None,
|
|
4547
|
+
commands: Optional[List[Command]] = None,
|
|
4548
|
+
) -> TallSeriesStatCard:
|
|
4549
|
+
"""Create a tall stat card displaying a primary value, an auxiliary value and a series plot.
|
|
4550
|
+
|
|
4551
|
+
Args:
|
|
4552
|
+
box: A string indicating how to place this component on the page.
|
|
4553
|
+
title: The card's title.
|
|
4554
|
+
value: The primary value displayed.
|
|
4555
|
+
aux_value: The auxiliary value displayed below the primary value.
|
|
4556
|
+
plot_data: The plot's data.
|
|
4557
|
+
plot_value: The data field to use for y-axis values.
|
|
4558
|
+
plot_zero_value: The base value to use for each y-axis mark. Set this to `0` if you want to pin the x-axis at `y=0`. If not provided, the minimum value from the data is used.
|
|
4559
|
+
plot_category: The data field to use for x-axis values (ignored if `plot_type` is `area`; must be provided if `plot_type` is `interval`). Defaults to 'x'.
|
|
4560
|
+
plot_type: The type of plot. Defaults to `area`. One of 'area', 'interval'. See enum h2o_wave.ui.TallSeriesStatCardPlotType.
|
|
4561
|
+
plot_curve: The plot's curve style. Defaults to `linear`. One of 'linear', 'smooth', 'step', 'step-after', 'step-before'. See enum h2o_wave.ui.TallSeriesStatCardPlotCurve.
|
|
4562
|
+
plot_color: The plot's color.
|
|
4563
|
+
data: Data for this card.
|
|
4564
|
+
commands: Contextual menu commands for this component.
|
|
4565
|
+
Returns:
|
|
4566
|
+
A `h2o_wave.types.TallSeriesStatCard` instance.
|
|
4567
|
+
"""
|
|
4568
|
+
return TallSeriesStatCard(
|
|
4569
|
+
box,
|
|
4570
|
+
title,
|
|
4571
|
+
value,
|
|
4572
|
+
aux_value,
|
|
4573
|
+
plot_data,
|
|
4574
|
+
plot_value,
|
|
4575
|
+
plot_zero_value,
|
|
4576
|
+
plot_category,
|
|
4577
|
+
plot_type,
|
|
4578
|
+
plot_curve,
|
|
4579
|
+
plot_color,
|
|
4580
|
+
data,
|
|
4581
|
+
commands,
|
|
4582
|
+
)
|
|
4583
|
+
|
|
4584
|
+
|
|
4585
|
+
def tall_stats_card(
|
|
4586
|
+
box: str,
|
|
4587
|
+
items: List[Stat],
|
|
4588
|
+
name: Optional[str] = None,
|
|
4589
|
+
commands: Optional[List[Command]] = None,
|
|
4590
|
+
) -> TallStatsCard:
|
|
4591
|
+
"""Create a vertical label-value pairs collection. Icon in `ui.stat` is not yet supported in this card.
|
|
4592
|
+
|
|
4593
|
+
Args:
|
|
4594
|
+
box: A string indicating how to place this component on the page.
|
|
4595
|
+
items: The individual stats to be displayed.
|
|
4596
|
+
name: An identifying name for this component.
|
|
4597
|
+
commands: Contextual menu commands for this component.
|
|
4598
|
+
Returns:
|
|
4599
|
+
A `h2o_wave.types.TallStatsCard` instance.
|
|
4600
|
+
"""
|
|
4601
|
+
return TallStatsCard(
|
|
4602
|
+
box,
|
|
4603
|
+
items,
|
|
4604
|
+
name,
|
|
4605
|
+
commands,
|
|
4606
|
+
)
|
|
4607
|
+
|
|
4608
|
+
|
|
4609
|
+
def template_card(
|
|
4610
|
+
box: str,
|
|
4611
|
+
title: str,
|
|
4612
|
+
content: str,
|
|
4613
|
+
data: Optional[PackedRecord] = None,
|
|
4614
|
+
commands: Optional[List[Command]] = None,
|
|
4615
|
+
) -> TemplateCard:
|
|
4616
|
+
"""Render dynamic content using an HTML template.
|
|
4617
|
+
|
|
4618
|
+
Args:
|
|
4619
|
+
box: A string indicating how to place this component on the page.
|
|
4620
|
+
title: The title for this card.
|
|
4621
|
+
content: The Handlebars template. https://handlebarsjs.com/guide/
|
|
4622
|
+
data: Data for the Handlebars template.
|
|
4623
|
+
commands: Contextual menu commands for this component.
|
|
4624
|
+
Returns:
|
|
4625
|
+
A `h2o_wave.types.TemplateCard` instance.
|
|
4626
|
+
"""
|
|
4627
|
+
return TemplateCard(
|
|
4628
|
+
box,
|
|
4629
|
+
title,
|
|
4630
|
+
content,
|
|
4631
|
+
data,
|
|
4632
|
+
commands,
|
|
4633
|
+
)
|
|
4634
|
+
|
|
4635
|
+
|
|
4636
|
+
def toolbar_card(
|
|
4637
|
+
box: str,
|
|
4638
|
+
items: List[Command],
|
|
4639
|
+
secondary_items: Optional[List[Command]] = None,
|
|
4640
|
+
overflow_items: Optional[List[Command]] = None,
|
|
4641
|
+
commands: Optional[List[Command]] = None,
|
|
4642
|
+
) -> ToolbarCard:
|
|
4643
|
+
"""Create a card containing a toolbar.
|
|
4644
|
+
|
|
4645
|
+
Args:
|
|
4646
|
+
box: A string indicating how to place this component on the page.
|
|
4647
|
+
items: Items to render.
|
|
4648
|
+
secondary_items: Items to render on the right side (or left, in RTL).
|
|
4649
|
+
overflow_items: Items to render in an overflow menu.
|
|
4650
|
+
commands: Contextual menu commands for this component.
|
|
4651
|
+
Returns:
|
|
4652
|
+
A `h2o_wave.types.ToolbarCard` instance.
|
|
4653
|
+
"""
|
|
4654
|
+
return ToolbarCard(
|
|
4655
|
+
box,
|
|
4656
|
+
items,
|
|
4657
|
+
secondary_items,
|
|
4658
|
+
overflow_items,
|
|
4659
|
+
commands,
|
|
4660
|
+
)
|
|
4661
|
+
|
|
4662
|
+
|
|
4663
|
+
def vega_card(
|
|
4664
|
+
box: str,
|
|
4665
|
+
title: str,
|
|
4666
|
+
specification: str,
|
|
4667
|
+
data: Optional[PackedRecord] = None,
|
|
4668
|
+
grammar: Optional[str] = None,
|
|
4669
|
+
commands: Optional[List[Command]] = None,
|
|
4670
|
+
) -> VegaCard:
|
|
4671
|
+
"""Create a card containing a Vega-lite plot.
|
|
4672
|
+
|
|
4673
|
+
Args:
|
|
4674
|
+
box: A string indicating how to place this component on the page.
|
|
4675
|
+
title: The title of this card.
|
|
4676
|
+
specification: The Vega-lite specification.
|
|
4677
|
+
data: Data for the plot, if any.
|
|
4678
|
+
grammar: Vega grammar to use. Defaults to 'vega-lite'. One of 'vega-lite', 'vega'. See enum h2o_wave.ui.VegaCardGrammar.
|
|
4679
|
+
commands: Contextual menu commands for this component.
|
|
4680
|
+
Returns:
|
|
4681
|
+
A `h2o_wave.types.VegaCard` instance.
|
|
4682
|
+
"""
|
|
4683
|
+
return VegaCard(
|
|
4684
|
+
box,
|
|
4685
|
+
title,
|
|
4686
|
+
specification,
|
|
4687
|
+
data,
|
|
4688
|
+
grammar,
|
|
4689
|
+
commands,
|
|
4690
|
+
)
|
|
4691
|
+
|
|
4692
|
+
|
|
4693
|
+
def wide_article_preview_card(
|
|
4694
|
+
box: str,
|
|
4695
|
+
persona: Component,
|
|
4696
|
+
image: str,
|
|
4697
|
+
title: str,
|
|
4698
|
+
name: Optional[str] = None,
|
|
4699
|
+
aux_value: Optional[str] = None,
|
|
4700
|
+
items: Optional[List[Component]] = None,
|
|
4701
|
+
content: Optional[str] = None,
|
|
4702
|
+
commands: Optional[List[Command]] = None,
|
|
4703
|
+
) -> WideArticlePreviewCard:
|
|
4704
|
+
"""Create a wide article preview card displaying a persona, image, title, caption, and optional buttons.
|
|
4705
|
+
|
|
4706
|
+
Args:
|
|
4707
|
+
box: A string indicating how to place this component on the page.
|
|
4708
|
+
persona: The card's user avatar, 'size' prop is restricted to 'xs'.
|
|
4709
|
+
image: The card’s image displayed on the left-hand side.
|
|
4710
|
+
title: The card's title on the right-hand side
|
|
4711
|
+
name: An identifying name for this card. Makes the card clickable, similar to a button.
|
|
4712
|
+
aux_value: The card's auxiliary text, displayed on the right-hand side of the header.
|
|
4713
|
+
items: The card's buttons, displayed under the caption.
|
|
4714
|
+
content: The card's markdown content, displayed below the title on the right-hand side.
|
|
4715
|
+
commands: Contextual menu commands for this component.
|
|
4716
|
+
Returns:
|
|
4717
|
+
A `h2o_wave.types.WideArticlePreviewCard` instance.
|
|
4718
|
+
"""
|
|
4719
|
+
return WideArticlePreviewCard(
|
|
4720
|
+
box,
|
|
4721
|
+
persona,
|
|
4722
|
+
image,
|
|
4723
|
+
title,
|
|
4724
|
+
name,
|
|
4725
|
+
aux_value,
|
|
4726
|
+
items,
|
|
4727
|
+
content,
|
|
4728
|
+
commands,
|
|
4729
|
+
)
|
|
4730
|
+
|
|
4731
|
+
|
|
4732
|
+
def wide_bar_stat_card(
|
|
4733
|
+
box: str,
|
|
4734
|
+
title: str,
|
|
4735
|
+
value: str,
|
|
4736
|
+
aux_value: str,
|
|
4737
|
+
progress: float,
|
|
4738
|
+
plot_color: Optional[str] = None,
|
|
4739
|
+
data: Optional[PackedRecord] = None,
|
|
4740
|
+
commands: Optional[List[Command]] = None,
|
|
4741
|
+
) -> WideBarStatCard:
|
|
4742
|
+
"""Create a wide stat card displaying a primary value, an auxiliary value and a progress bar.
|
|
4743
|
+
|
|
4744
|
+
Args:
|
|
4745
|
+
box: A string indicating how to place this component on the page.
|
|
4746
|
+
title: The card's title.
|
|
4747
|
+
value: The primary value displayed.
|
|
4748
|
+
aux_value: The auxiliary value displayed next to the primary value.
|
|
4749
|
+
progress: The value of the progress bar, between 0 and 1.
|
|
4750
|
+
plot_color: The color of the progress bar.
|
|
4751
|
+
data: Data for this card.
|
|
4752
|
+
commands: Contextual menu commands for this component.
|
|
4753
|
+
Returns:
|
|
4754
|
+
A `h2o_wave.types.WideBarStatCard` instance.
|
|
4755
|
+
"""
|
|
4756
|
+
return WideBarStatCard(
|
|
4757
|
+
box,
|
|
4758
|
+
title,
|
|
4759
|
+
value,
|
|
4760
|
+
aux_value,
|
|
4761
|
+
progress,
|
|
4762
|
+
plot_color,
|
|
4763
|
+
data,
|
|
4764
|
+
commands,
|
|
4765
|
+
)
|
|
4766
|
+
|
|
4767
|
+
|
|
4768
|
+
def wide_gauge_stat_card(
|
|
4769
|
+
box: str,
|
|
4770
|
+
title: str,
|
|
4771
|
+
value: str,
|
|
4772
|
+
aux_value: str,
|
|
4773
|
+
progress: float,
|
|
4774
|
+
plot_color: Optional[str] = None,
|
|
4775
|
+
data: Optional[PackedRecord] = None,
|
|
4776
|
+
commands: Optional[List[Command]] = None,
|
|
4777
|
+
) -> WideGaugeStatCard:
|
|
4778
|
+
"""Create a wide stat card displaying a primary value, an auxiliary value and a progress gauge.
|
|
4779
|
+
|
|
4780
|
+
Args:
|
|
4781
|
+
box: A string indicating how to place this component on the page.
|
|
4782
|
+
title: The card's title.
|
|
4783
|
+
value: The primary value displayed.
|
|
4784
|
+
aux_value: The auxiliary value displayed next to the primary value.
|
|
4785
|
+
progress: The value of the progress gauge, between 0 and 1.
|
|
4786
|
+
plot_color: The color of the progress gauge.
|
|
4787
|
+
data: Data for this card.
|
|
4788
|
+
commands: Contextual menu commands for this component.
|
|
4789
|
+
Returns:
|
|
4790
|
+
A `h2o_wave.types.WideGaugeStatCard` instance.
|
|
4791
|
+
"""
|
|
4792
|
+
return WideGaugeStatCard(
|
|
4793
|
+
box,
|
|
4794
|
+
title,
|
|
4795
|
+
value,
|
|
4796
|
+
aux_value,
|
|
4797
|
+
progress,
|
|
4798
|
+
plot_color,
|
|
4799
|
+
data,
|
|
4800
|
+
commands,
|
|
4801
|
+
)
|
|
4802
|
+
|
|
4803
|
+
|
|
4804
|
+
def wide_info_card(
|
|
4805
|
+
box: str,
|
|
4806
|
+
name: str,
|
|
4807
|
+
title: str,
|
|
4808
|
+
caption: str,
|
|
4809
|
+
label: Optional[str] = None,
|
|
4810
|
+
subtitle: Optional[str] = None,
|
|
4811
|
+
align: Optional[str] = None,
|
|
4812
|
+
icon: Optional[str] = None,
|
|
4813
|
+
image: Optional[str] = None,
|
|
4814
|
+
category: Optional[str] = None,
|
|
4815
|
+
commands: Optional[List[Command]] = None,
|
|
4816
|
+
) -> WideInfoCard:
|
|
4817
|
+
"""Create a wide information card displaying a title, caption, and either an icon or image.
|
|
4818
|
+
|
|
4819
|
+
Args:
|
|
4820
|
+
box: A string indicating how to place this component on the page.
|
|
4821
|
+
name: An identifying name for this card. Makes the card clickable, similar to a button.
|
|
4822
|
+
title: The card's title.
|
|
4823
|
+
caption: The card's caption, displayed below the subtitle. Supports markdown.
|
|
4824
|
+
label: Label of a button rendered at the bottom of the card. If specified, whole card is not clickable anymore..
|
|
4825
|
+
subtitle: The card's subtitle, displayed below the title.
|
|
4826
|
+
align: The card's alignment, determines the position of an image / icon. Defaults to 'left'. One of 'left', 'right'. See enum h2o_wave.ui.WideInfoCardAlign.
|
|
4827
|
+
icon: The card's icon.
|
|
4828
|
+
image: The card’s image.
|
|
4829
|
+
category: The card's category, displayed above the title.
|
|
4830
|
+
commands: Contextual menu commands for this component.
|
|
4831
|
+
Returns:
|
|
4832
|
+
A `h2o_wave.types.WideInfoCard` instance.
|
|
4833
|
+
"""
|
|
4834
|
+
return WideInfoCard(
|
|
4835
|
+
box,
|
|
4836
|
+
name,
|
|
4837
|
+
title,
|
|
4838
|
+
caption,
|
|
4839
|
+
label,
|
|
4840
|
+
subtitle,
|
|
4841
|
+
align,
|
|
4842
|
+
icon,
|
|
4843
|
+
image,
|
|
4844
|
+
category,
|
|
4845
|
+
commands,
|
|
4846
|
+
)
|
|
4847
|
+
|
|
4848
|
+
|
|
4849
|
+
def pie(
|
|
4850
|
+
label: str,
|
|
4851
|
+
value: str,
|
|
4852
|
+
fraction: float,
|
|
4853
|
+
color: str,
|
|
4854
|
+
aux_value: Optional[str] = None,
|
|
4855
|
+
) -> Pie:
|
|
4856
|
+
"""Card's pie chart data to be displayed.
|
|
4857
|
+
|
|
4858
|
+
Args:
|
|
4859
|
+
label: The description for the pie, displayed in the legend.
|
|
4860
|
+
value: The formatted value displayed on the pie.
|
|
4861
|
+
fraction: A value between 0 and 1 indicating the size of the pie.
|
|
4862
|
+
color: The color of the pie.
|
|
4863
|
+
aux_value: The auxiliary value, displayed below the label.
|
|
4864
|
+
Returns:
|
|
4865
|
+
A `h2o_wave.types.Pie` instance.
|
|
4866
|
+
"""
|
|
4867
|
+
return Pie(
|
|
4868
|
+
label,
|
|
4869
|
+
value,
|
|
4870
|
+
fraction,
|
|
4871
|
+
color,
|
|
4872
|
+
aux_value,
|
|
4873
|
+
)
|
|
4874
|
+
|
|
4875
|
+
|
|
4876
|
+
def wide_pie_stat_card(
|
|
4877
|
+
box: str,
|
|
4878
|
+
title: str,
|
|
4879
|
+
pies: List[Pie],
|
|
4880
|
+
commands: Optional[List[Command]] = None,
|
|
4881
|
+
) -> WidePieStatCard:
|
|
4882
|
+
"""Create a wide pie stat card displaying a title and pie chart with legend.
|
|
4883
|
+
|
|
4884
|
+
Args:
|
|
4885
|
+
box: A string indicating how to place this component on the page.
|
|
4886
|
+
title: The card's title.
|
|
4887
|
+
pies: The pies to be included in the pie chart.
|
|
4888
|
+
commands: Contextual menu commands for this component.
|
|
4889
|
+
Returns:
|
|
4890
|
+
A `h2o_wave.types.WidePieStatCard` instance.
|
|
4891
|
+
"""
|
|
4892
|
+
return WidePieStatCard(
|
|
4893
|
+
box,
|
|
4894
|
+
title,
|
|
4895
|
+
pies,
|
|
4896
|
+
commands,
|
|
4897
|
+
)
|
|
4898
|
+
|
|
4899
|
+
|
|
4900
|
+
def wide_plot_card(
|
|
4901
|
+
box: str,
|
|
4902
|
+
title: str,
|
|
4903
|
+
caption: str,
|
|
4904
|
+
plot: Plot,
|
|
4905
|
+
data: PackedRecord,
|
|
4906
|
+
commands: Optional[List[Command]] = None,
|
|
4907
|
+
) -> WidePlotCard:
|
|
4908
|
+
"""Create a wide plot card displaying a title, caption and a plot.
|
|
4909
|
+
|
|
4910
|
+
Args:
|
|
4911
|
+
box: A string indicating how to place this component on the page.
|
|
4912
|
+
title: The card's title.
|
|
4913
|
+
caption: The card's caption, displayed below the title.
|
|
4914
|
+
plot: The card's plot.
|
|
4915
|
+
data: The card's plot data.
|
|
4916
|
+
commands: Contextual menu commands for this component.
|
|
4917
|
+
Returns:
|
|
4918
|
+
A `h2o_wave.types.WidePlotCard` instance.
|
|
4919
|
+
"""
|
|
4920
|
+
return WidePlotCard(
|
|
4921
|
+
box,
|
|
4922
|
+
title,
|
|
4923
|
+
caption,
|
|
4924
|
+
plot,
|
|
4925
|
+
data,
|
|
4926
|
+
commands,
|
|
4927
|
+
)
|
|
4928
|
+
|
|
4929
|
+
|
|
4930
|
+
def wide_series_stat_card(
|
|
4931
|
+
box: str,
|
|
4932
|
+
title: str,
|
|
4933
|
+
value: str,
|
|
4934
|
+
aux_value: str,
|
|
4935
|
+
plot_data: PackedData,
|
|
4936
|
+
plot_value: str,
|
|
4937
|
+
plot_zero_value: Optional[float] = None,
|
|
4938
|
+
plot_category: Optional[str] = None,
|
|
4939
|
+
plot_type: Optional[str] = None,
|
|
4940
|
+
plot_curve: Optional[str] = None,
|
|
4941
|
+
plot_color: Optional[str] = None,
|
|
4942
|
+
data: Optional[PackedRecord] = None,
|
|
4943
|
+
commands: Optional[List[Command]] = None,
|
|
4944
|
+
) -> WideSeriesStatCard:
|
|
4945
|
+
"""Create a wide stat card displaying a primary value, an auxiliary value and a series plot.
|
|
4946
|
+
|
|
4947
|
+
Args:
|
|
4948
|
+
box: A string indicating how to place this component on the page.
|
|
4949
|
+
title: The card's title.
|
|
4950
|
+
value: The primary value displayed.
|
|
4951
|
+
aux_value: The auxiliary value displayed below the primary value.
|
|
4952
|
+
plot_data: The plot's data.
|
|
4953
|
+
plot_value: The data field to use for y-axis values.
|
|
4954
|
+
plot_zero_value: The base value to use for each y-axis mark. Set this to `0` if you want to pin the x-axis at `y=0`. If not provided, the minimum value from the data is used.
|
|
4955
|
+
plot_category: The data field to use for x-axis values (ignored if `plot_type` is `area`; must be provided if `plot_type` is `interval`). Defaults to 'x'.
|
|
4956
|
+
plot_type: The type of plot. Defaults to `area`. One of 'area', 'interval'. See enum h2o_wave.ui.WideSeriesStatCardPlotType.
|
|
4957
|
+
plot_curve: The plot's curve style. Defaults to `linear`. One of 'linear', 'smooth', 'step', 'step-after', 'step-before'. See enum h2o_wave.ui.WideSeriesStatCardPlotCurve.
|
|
4958
|
+
plot_color: The plot's color.
|
|
4959
|
+
data: Data for this card.
|
|
4960
|
+
commands: Contextual menu commands for this component.
|
|
4961
|
+
Returns:
|
|
4962
|
+
A `h2o_wave.types.WideSeriesStatCard` instance.
|
|
4963
|
+
"""
|
|
4964
|
+
return WideSeriesStatCard(
|
|
4965
|
+
box,
|
|
4966
|
+
title,
|
|
4967
|
+
value,
|
|
4968
|
+
aux_value,
|
|
4969
|
+
plot_data,
|
|
4970
|
+
plot_value,
|
|
4971
|
+
plot_zero_value,
|
|
4972
|
+
plot_category,
|
|
4973
|
+
plot_type,
|
|
4974
|
+
plot_curve,
|
|
4975
|
+
plot_color,
|
|
4976
|
+
data,
|
|
4977
|
+
commands,
|
|
4978
|
+
)
|