quantumgui 1.0.0__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.
- quantumgui/__init__.py +9 -0
- quantumgui/__main__.py +6 -0
- quantumgui/cli.py +341 -0
- quantumgui/core/__init__.py +39 -0
- quantumgui/core/animation.py +221 -0
- quantumgui/core/audit.py +323 -0
- quantumgui/core/context.py +54 -0
- quantumgui/core/data_source.py +426 -0
- quantumgui/core/draw.py +428 -0
- quantumgui/core/enterprise.py +402 -0
- quantumgui/core/enterprise_app.py +419 -0
- quantumgui/core/events.py +34 -0
- quantumgui/core/geometry.py +108 -0
- quantumgui/core/native_dialogs.py +276 -0
- quantumgui/core/pdf_report.py +390 -0
- quantumgui/core/rules.py +284 -0
- quantumgui/core/state.py +42 -0
- quantumgui/core/task_runner.py +181 -0
- quantumgui/core/widget.py +498 -0
- quantumgui/core/window.py +920 -0
- quantumgui/core/xlsx_export.py +145 -0
- quantumgui/py.typed +0 -0
- quantumgui/theme/__init__.py +32 -0
- quantumgui/theme/hct.py +191 -0
- quantumgui/theme/theme.py +93 -0
- quantumgui/theme/tokens.py +423 -0
- quantumgui/ui.py +2142 -0
- quantumgui/widgets/__init__.py +168 -0
- quantumgui/widgets/advanced.py +499 -0
- quantumgui/widgets/button.py +224 -0
- quantumgui/widgets/charts.py +625 -0
- quantumgui/widgets/charts_bi.py +528 -0
- quantumgui/widgets/charts_extra.py +430 -0
- quantumgui/widgets/charts_pro.py +568 -0
- quantumgui/widgets/checkbox.py +199 -0
- quantumgui/widgets/chip.py +219 -0
- quantumgui/widgets/containers.py +321 -0
- quantumgui/widgets/data_controls.py +487 -0
- quantumgui/widgets/data_grid.py +956 -0
- quantumgui/widgets/data_table.py +551 -0
- quantumgui/widgets/date_picker.py +407 -0
- quantumgui/widgets/display_media.py +372 -0
- quantumgui/widgets/display_pro.py +407 -0
- quantumgui/widgets/drawer.py +252 -0
- quantumgui/widgets/enterprise_controls.py +934 -0
- quantumgui/widgets/fab.py +261 -0
- quantumgui/widgets/forms_pro.py +703 -0
- quantumgui/widgets/forms_pro_media.py +587 -0
- quantumgui/widgets/inputs.py +870 -0
- quantumgui/widgets/layout_pro.py +162 -0
- quantumgui/widgets/list_view.py +307 -0
- quantumgui/widgets/masked_input.py +131 -0
- quantumgui/widgets/master_detail.py +155 -0
- quantumgui/widgets/navigation.py +382 -0
- quantumgui/widgets/overlays.py +355 -0
- quantumgui/widgets/productivity.py +500 -0
- quantumgui/widgets/productivity_boards.py +544 -0
- quantumgui/widgets/radio.py +209 -0
- quantumgui/widgets/scroll_view.py +129 -0
- quantumgui/widgets/select.py +373 -0
- quantumgui/widgets/sheets.py +249 -0
- quantumgui/widgets/slider.py +209 -0
- quantumgui/widgets/switch.py +196 -0
- quantumgui/widgets/tabs.py +175 -0
- quantumgui/widgets/text.py +101 -0
- quantumgui/widgets/text_field.py +490 -0
- quantumgui/widgets/time_picker.py +499 -0
- quantumgui-1.0.0.dist-info/METADATA +137 -0
- quantumgui-1.0.0.dist-info/RECORD +73 -0
- quantumgui-1.0.0.dist-info/WHEEL +5 -0
- quantumgui-1.0.0.dist-info/entry_points.txt +2 -0
- quantumgui-1.0.0.dist-info/licenses/LICENSE +32 -0
- quantumgui-1.0.0.dist-info/top_level.txt +1 -0
quantumgui/ui.py
ADDED
|
@@ -0,0 +1,2142 @@
|
|
|
1
|
+
"""NiceGUI-inspired `ui` namespace for building Material Design 3 interfaces."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from datetime import date, time as dt_time
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any, Callable, Literal, Mapping, Sequence, TypeVar
|
|
8
|
+
|
|
9
|
+
from .core.audit import AuditEntry, AuditLog, CommandHistory
|
|
10
|
+
from .core.data_source import (
|
|
11
|
+
CSVDataSource,
|
|
12
|
+
DataFrameDataSource,
|
|
13
|
+
DataSource,
|
|
14
|
+
DictListDataSource,
|
|
15
|
+
SQLDataSource,
|
|
16
|
+
)
|
|
17
|
+
from .core.draw import ColorSpec, register_font
|
|
18
|
+
from .core.enterprise import (
|
|
19
|
+
Form,
|
|
20
|
+
ShortcutManager,
|
|
21
|
+
Validators,
|
|
22
|
+
call_later as _call_later,
|
|
23
|
+
export_pdf as _export_pdf,
|
|
24
|
+
run_in_background as _run_in_background,
|
|
25
|
+
validators,
|
|
26
|
+
)
|
|
27
|
+
from .core.enterprise_app import (
|
|
28
|
+
AuthContext,
|
|
29
|
+
I18n,
|
|
30
|
+
PreferencesStore,
|
|
31
|
+
Router,
|
|
32
|
+
default_auth,
|
|
33
|
+
)
|
|
34
|
+
from .core.pdf_report import PDFReport, PageFormat, PageOrientation
|
|
35
|
+
from .core.rules import BusinessRule, RuleEngine, RuleReport, RuleResult
|
|
36
|
+
from .core.task_runner import TaskCancelledError, TaskContext, TaskHandle, TaskRunner
|
|
37
|
+
from .core.xlsx_export import export_xlsx as _export_xlsx
|
|
38
|
+
from .core.state import State
|
|
39
|
+
from .core.window import Window, quit_app, run_app, set_main_window as _set_main_window
|
|
40
|
+
from .theme import Color, ShapeToken, Theme, TypographyRole
|
|
41
|
+
from .widgets.enterprise_controls import (
|
|
42
|
+
CurrencyInput,
|
|
43
|
+
DetailDrawer,
|
|
44
|
+
FilterBar,
|
|
45
|
+
NotificationCenter,
|
|
46
|
+
NotificationItem,
|
|
47
|
+
Wizard,
|
|
48
|
+
)
|
|
49
|
+
from .widgets.master_detail import MasterDetail
|
|
50
|
+
from .widgets import (
|
|
51
|
+
Alert,
|
|
52
|
+
AlertSeverity,
|
|
53
|
+
Autocomplete,
|
|
54
|
+
Avatar,
|
|
55
|
+
AvatarGroup,
|
|
56
|
+
Badge,
|
|
57
|
+
BadgeColor,
|
|
58
|
+
BadgeTone,
|
|
59
|
+
BarChart,
|
|
60
|
+
BottomSheet,
|
|
61
|
+
BoxPlotChart,
|
|
62
|
+
Breadcrumbs,
|
|
63
|
+
Button,
|
|
64
|
+
ButtonSize,
|
|
65
|
+
ButtonVariant,
|
|
66
|
+
CalendarEvent,
|
|
67
|
+
CalendarView,
|
|
68
|
+
CandlestickChart,
|
|
69
|
+
Card,
|
|
70
|
+
CardVariant,
|
|
71
|
+
Carousel,
|
|
72
|
+
CarouselItem,
|
|
73
|
+
ChartColorRole,
|
|
74
|
+
Checkbox,
|
|
75
|
+
Chip,
|
|
76
|
+
ChipVariant,
|
|
77
|
+
CodeBlock,
|
|
78
|
+
ColorPicker,
|
|
79
|
+
Column,
|
|
80
|
+
ColumnAlign,
|
|
81
|
+
ColumnType,
|
|
82
|
+
CommandItem,
|
|
83
|
+
CommandPalette,
|
|
84
|
+
CrossAlign,
|
|
85
|
+
DataGrid,
|
|
86
|
+
DataTable,
|
|
87
|
+
GridColAlign,
|
|
88
|
+
GridColType,
|
|
89
|
+
GridColumn,
|
|
90
|
+
TableColumn,
|
|
91
|
+
DatePicker,
|
|
92
|
+
DatePickerVariant,
|
|
93
|
+
DateRangePicker,
|
|
94
|
+
Dialog,
|
|
95
|
+
Divider,
|
|
96
|
+
DonutChart,
|
|
97
|
+
DrawerItem,
|
|
98
|
+
DropZone,
|
|
99
|
+
EmptyState,
|
|
100
|
+
ExpansionPanel,
|
|
101
|
+
FAB,
|
|
102
|
+
FABSize,
|
|
103
|
+
FABVariant,
|
|
104
|
+
FilePicker,
|
|
105
|
+
FunnelChart,
|
|
106
|
+
GanttChart,
|
|
107
|
+
GaugeChart,
|
|
108
|
+
Grid,
|
|
109
|
+
Heatmap,
|
|
110
|
+
HorizontalBarChart,
|
|
111
|
+
IconButton,
|
|
112
|
+
Image,
|
|
113
|
+
ImageFit,
|
|
114
|
+
KPICard,
|
|
115
|
+
KanbanBoard,
|
|
116
|
+
KanbanCard,
|
|
117
|
+
LineChart,
|
|
118
|
+
ListItem,
|
|
119
|
+
ListVariant,
|
|
120
|
+
ListView,
|
|
121
|
+
MaskedInput,
|
|
122
|
+
MainJustify,
|
|
123
|
+
MarkdownView,
|
|
124
|
+
Menu,
|
|
125
|
+
MenuItem,
|
|
126
|
+
MultiLineChart,
|
|
127
|
+
NavigationBar,
|
|
128
|
+
NavigationDrawer,
|
|
129
|
+
NavigationRail,
|
|
130
|
+
NumberInput,
|
|
131
|
+
OTPInput,
|
|
132
|
+
Pagination,
|
|
133
|
+
PresenceStatus,
|
|
134
|
+
ProgressIndicator,
|
|
135
|
+
PropertyGrid,
|
|
136
|
+
PropertyItem,
|
|
137
|
+
RadarChart,
|
|
138
|
+
RadioDirection,
|
|
139
|
+
RadioGroup,
|
|
140
|
+
RangeSlider,
|
|
141
|
+
Rating,
|
|
142
|
+
Row,
|
|
143
|
+
SankeyChart,
|
|
144
|
+
ScatterChart,
|
|
145
|
+
ScrollView,
|
|
146
|
+
SearchBar,
|
|
147
|
+
SegmentedButton,
|
|
148
|
+
Select,
|
|
149
|
+
SelectVariant,
|
|
150
|
+
SignaturePad,
|
|
151
|
+
Skeleton,
|
|
152
|
+
Slider,
|
|
153
|
+
Snackbar,
|
|
154
|
+
Sparkline,
|
|
155
|
+
SplitView,
|
|
156
|
+
StatusBar,
|
|
157
|
+
Stepper,
|
|
158
|
+
Switch,
|
|
159
|
+
Tabs,
|
|
160
|
+
TabsVariant,
|
|
161
|
+
TagInput,
|
|
162
|
+
Text,
|
|
163
|
+
TextAlign,
|
|
164
|
+
TextArea,
|
|
165
|
+
TextColorRole,
|
|
166
|
+
TextField,
|
|
167
|
+
TextFieldVariant,
|
|
168
|
+
TimePicker,
|
|
169
|
+
TimePickerVariant,
|
|
170
|
+
Timeline,
|
|
171
|
+
TimelineItem,
|
|
172
|
+
TopAppBar,
|
|
173
|
+
TreeNode,
|
|
174
|
+
TreeView,
|
|
175
|
+
TreemapChart,
|
|
176
|
+
VectorCanvas,
|
|
177
|
+
WaterfallChart,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
T = TypeVar("T")
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def state(initial: T) -> State[T]:
|
|
184
|
+
"""Create a reactive state container (`ui.state(initial)`)."""
|
|
185
|
+
return State(initial)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def load_font(path: str | Path, alias: str | None = None) -> str:
|
|
189
|
+
"""Load a custom `.ttf` or `.otf` font file and return its family name for `Theme`."""
|
|
190
|
+
return register_font(path, alias=alias)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def window(
|
|
194
|
+
title: str = "QuantumGUI",
|
|
195
|
+
*,
|
|
196
|
+
width: int = 960,
|
|
197
|
+
height: int = 680,
|
|
198
|
+
theme: Theme | None = None,
|
|
199
|
+
resizable: bool = True,
|
|
200
|
+
frameless: bool = False,
|
|
201
|
+
transparent: bool = False,
|
|
202
|
+
always_on_top: bool = False,
|
|
203
|
+
maximized: bool = False,
|
|
204
|
+
fullscreen: bool = False,
|
|
205
|
+
center: bool = True,
|
|
206
|
+
position: tuple[int, int] | None = None,
|
|
207
|
+
min_size: tuple[int, int] | None = None,
|
|
208
|
+
max_size: tuple[int, int] | None = None,
|
|
209
|
+
opacity: float = 1.0,
|
|
210
|
+
icon: str | Path | Any = None,
|
|
211
|
+
titlebar_color: ColorSpec | None = None,
|
|
212
|
+
main: bool = False,
|
|
213
|
+
on_close: Callable[[], bool | None] | None = None,
|
|
214
|
+
on_resize: Callable[[int, int], None] | None = None,
|
|
215
|
+
on_focus: Callable[[bool], None] | None = None,
|
|
216
|
+
on_file_drop: Callable[[list[str]], None] | None = None,
|
|
217
|
+
) -> Window:
|
|
218
|
+
"""Create a customizable native GPU-accelerated Skia window."""
|
|
219
|
+
return Window(
|
|
220
|
+
title=title,
|
|
221
|
+
width=width,
|
|
222
|
+
height=height,
|
|
223
|
+
theme=theme,
|
|
224
|
+
resizable=resizable,
|
|
225
|
+
frameless=frameless,
|
|
226
|
+
transparent=transparent,
|
|
227
|
+
always_on_top=always_on_top,
|
|
228
|
+
maximized=maximized,
|
|
229
|
+
fullscreen=fullscreen,
|
|
230
|
+
center=center,
|
|
231
|
+
position=position,
|
|
232
|
+
min_size=min_size,
|
|
233
|
+
max_size=max_size,
|
|
234
|
+
opacity=opacity,
|
|
235
|
+
icon=icon,
|
|
236
|
+
titlebar_color=titlebar_color,
|
|
237
|
+
main=main,
|
|
238
|
+
on_close=on_close,
|
|
239
|
+
on_resize=on_resize,
|
|
240
|
+
on_focus=on_focus,
|
|
241
|
+
on_file_drop=on_file_drop,
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def set_main_window(win: Window | None) -> Window | None:
|
|
246
|
+
"""Declare `win` as the main window: if it is closed, all secondary windows close and the program exits."""
|
|
247
|
+
return _set_main_window(win)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def quit() -> None:
|
|
251
|
+
"""Close all windows and exit the application cleanly."""
|
|
252
|
+
quit_app()
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
def run(*windows: Window) -> None:
|
|
256
|
+
"""Run one or more native QuantumGUI windows simultaneously."""
|
|
257
|
+
run_app(*windows)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def column(
|
|
261
|
+
*,
|
|
262
|
+
gap: float = 0.0,
|
|
263
|
+
align: CrossAlign = "start",
|
|
264
|
+
justify: MainJustify = "start",
|
|
265
|
+
) -> Column:
|
|
266
|
+
return Column(gap=gap, align=align, justify=justify)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def row(
|
|
270
|
+
*,
|
|
271
|
+
gap: float = 0.0,
|
|
272
|
+
align: CrossAlign = "center",
|
|
273
|
+
justify: MainJustify = "start",
|
|
274
|
+
wrap: bool = False,
|
|
275
|
+
run_gap: float | None = None,
|
|
276
|
+
) -> Row:
|
|
277
|
+
return Row(gap=gap, align=align, justify=justify, wrap=wrap, run_gap=run_gap)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def card(
|
|
281
|
+
*,
|
|
282
|
+
variant: CardVariant = "filled",
|
|
283
|
+
gap: float = 12.0,
|
|
284
|
+
align: CrossAlign = "stretch",
|
|
285
|
+
padding: float | tuple[float, float] | tuple[float, float, float, float] = 16.0,
|
|
286
|
+
on_click: Callable[[], None] | None = None,
|
|
287
|
+
) -> Card:
|
|
288
|
+
return Card(variant=variant, gap=gap, align=align, padding=padding, on_click=on_click)
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def divider(*, vertical: bool = False, inset: float = 0.0) -> Divider:
|
|
292
|
+
return Divider(vertical=vertical, inset=inset)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def list_view(
|
|
296
|
+
*,
|
|
297
|
+
dividers: bool = True,
|
|
298
|
+
divider_inset: float = 16.0,
|
|
299
|
+
variant: ListVariant = "outlined",
|
|
300
|
+
) -> ListView:
|
|
301
|
+
return ListView(dividers=dividers, divider_inset=divider_inset, variant=variant)
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def list_item(
|
|
305
|
+
headline: str,
|
|
306
|
+
*,
|
|
307
|
+
supporting_text: str | None = None,
|
|
308
|
+
overline: str | None = None,
|
|
309
|
+
leading_icon: str | None = None,
|
|
310
|
+
leading_avatar: Any = None,
|
|
311
|
+
leading_image: Any = None,
|
|
312
|
+
trailing_text: str | None = None,
|
|
313
|
+
trailing_icon: str | None = None,
|
|
314
|
+
selected: bool = False,
|
|
315
|
+
disabled: bool = False,
|
|
316
|
+
on_click: Callable[[], None] | None = None,
|
|
317
|
+
) -> ListItem:
|
|
318
|
+
return ListItem(
|
|
319
|
+
headline,
|
|
320
|
+
supporting_text=supporting_text,
|
|
321
|
+
overline=overline,
|
|
322
|
+
leading_icon=leading_icon,
|
|
323
|
+
leading_avatar=leading_avatar,
|
|
324
|
+
leading_image=leading_image,
|
|
325
|
+
trailing_text=trailing_text,
|
|
326
|
+
trailing_icon=trailing_icon,
|
|
327
|
+
selected=selected,
|
|
328
|
+
disabled=disabled,
|
|
329
|
+
on_click=on_click,
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def text(
|
|
334
|
+
content: str | State[str] | Callable[[], str],
|
|
335
|
+
*,
|
|
336
|
+
role: TypographyRole = "body_medium",
|
|
337
|
+
color: TextColorRole | ColorSpec = "on_surface",
|
|
338
|
+
size: float | None = None,
|
|
339
|
+
weight: int | None = None,
|
|
340
|
+
align: TextAlign = "left",
|
|
341
|
+
underline: bool = False,
|
|
342
|
+
) -> Text:
|
|
343
|
+
return Text(content, role=role, color=color, size=size, weight=weight, align=align, underline=underline)
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
def button(
|
|
347
|
+
label: str,
|
|
348
|
+
*,
|
|
349
|
+
variant: ButtonVariant = "filled",
|
|
350
|
+
size: ButtonSize = "medium",
|
|
351
|
+
icon: str | None = None,
|
|
352
|
+
disabled: bool = False,
|
|
353
|
+
on_click: Callable[[], None] | None = None,
|
|
354
|
+
) -> Button:
|
|
355
|
+
return Button(label, variant=variant, size=size, icon=icon, disabled=disabled, on_click=on_click)
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def icon_button(
|
|
359
|
+
icon: str,
|
|
360
|
+
*,
|
|
361
|
+
variant: Literal["standard", "filled", "tonal", "outlined"] = "standard",
|
|
362
|
+
disabled: bool = False,
|
|
363
|
+
on_click: Callable[[], None] | None = None,
|
|
364
|
+
) -> IconButton:
|
|
365
|
+
return IconButton(icon, variant=variant, disabled=disabled, on_click=on_click)
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
def fab(
|
|
369
|
+
icon: str = "add",
|
|
370
|
+
*,
|
|
371
|
+
label: str | None = None,
|
|
372
|
+
variant: FABVariant = "primary",
|
|
373
|
+
size: FABSize = "medium",
|
|
374
|
+
disabled: bool = False,
|
|
375
|
+
on_click: Callable[[], None] | None = None,
|
|
376
|
+
) -> FAB:
|
|
377
|
+
return FAB(icon, label=label, variant=variant, size=size, disabled=disabled, on_click=on_click)
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def top_app_bar(
|
|
381
|
+
title: str,
|
|
382
|
+
*,
|
|
383
|
+
subtitle: str | None = None,
|
|
384
|
+
leading_icon: str | None = None,
|
|
385
|
+
on_leading_click: Callable[[], None] | None = None,
|
|
386
|
+
variant: Literal["small", "center_aligned"] = "small",
|
|
387
|
+
) -> TopAppBar:
|
|
388
|
+
return TopAppBar(
|
|
389
|
+
title,
|
|
390
|
+
subtitle=subtitle,
|
|
391
|
+
leading_icon=leading_icon,
|
|
392
|
+
on_leading_click=on_leading_click,
|
|
393
|
+
variant=variant,
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
def navigation_rail(
|
|
398
|
+
items: Sequence[tuple[str, str]],
|
|
399
|
+
*,
|
|
400
|
+
selected: int = 0,
|
|
401
|
+
bind: State[int] | None = None,
|
|
402
|
+
on_change: Callable[[int], None] | None = None,
|
|
403
|
+
) -> NavigationRail:
|
|
404
|
+
return NavigationRail(items, selected=selected, bind=bind, on_change=on_change)
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def navigation_bar(
|
|
408
|
+
items: Sequence[tuple[str, str]],
|
|
409
|
+
*,
|
|
410
|
+
selected: int = 0,
|
|
411
|
+
bind: State[int] | None = None,
|
|
412
|
+
on_change: Callable[[int], None] | None = None,
|
|
413
|
+
) -> NavigationBar:
|
|
414
|
+
return NavigationBar(items, selected=selected, bind=bind, on_change=on_change)
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
def navigation_drawer(
|
|
418
|
+
items: Sequence[DrawerItem | tuple[str, str] | tuple[str, str, str | int] | str],
|
|
419
|
+
*,
|
|
420
|
+
title: str | None = None,
|
|
421
|
+
selected: int = 0,
|
|
422
|
+
modal: bool = True,
|
|
423
|
+
width: float = 300.0,
|
|
424
|
+
bind: State[int] | None = None,
|
|
425
|
+
on_change: Callable[[int], None] | None = None,
|
|
426
|
+
window: Window | None = None,
|
|
427
|
+
) -> NavigationDrawer:
|
|
428
|
+
return NavigationDrawer(
|
|
429
|
+
items,
|
|
430
|
+
title=title,
|
|
431
|
+
selected=selected,
|
|
432
|
+
modal=modal,
|
|
433
|
+
width=width,
|
|
434
|
+
bind=bind,
|
|
435
|
+
on_change=on_change,
|
|
436
|
+
window=window,
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
def scroll_view(
|
|
441
|
+
*,
|
|
442
|
+
gap: float = 0.0,
|
|
443
|
+
align: CrossAlign = "stretch",
|
|
444
|
+
show_scrollbar: bool = True,
|
|
445
|
+
wheel_step: float = 44.0,
|
|
446
|
+
) -> ScrollView:
|
|
447
|
+
return ScrollView(gap=gap, align=align, show_scrollbar=show_scrollbar, wheel_step=wheel_step)
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
def tabs(
|
|
451
|
+
items: Sequence[str | tuple[str, str]],
|
|
452
|
+
*,
|
|
453
|
+
selected: int = 0,
|
|
454
|
+
variant: TabsVariant = "primary",
|
|
455
|
+
bind: State[int] | None = None,
|
|
456
|
+
on_change: Callable[[int], None] | None = None,
|
|
457
|
+
) -> Tabs:
|
|
458
|
+
return Tabs(items, selected=selected, variant=variant, bind=bind, on_change=on_change)
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
def table_column(
|
|
462
|
+
title: str,
|
|
463
|
+
*,
|
|
464
|
+
type: ColumnType = "text",
|
|
465
|
+
align: ColumnAlign | None = None,
|
|
466
|
+
width: float | None = None,
|
|
467
|
+
sortable: bool = True,
|
|
468
|
+
prefix: str = "",
|
|
469
|
+
suffix: str = "",
|
|
470
|
+
decimals: int = 2,
|
|
471
|
+
date_format: str = "%d/%m/%Y",
|
|
472
|
+
time_format: str = "%H:%M",
|
|
473
|
+
badge_colors: dict[str, BadgeTone] | None = None,
|
|
474
|
+
formatter: Callable[[Any], str] | None = None,
|
|
475
|
+
) -> TableColumn:
|
|
476
|
+
return TableColumn(
|
|
477
|
+
title=title,
|
|
478
|
+
type=type,
|
|
479
|
+
align=align,
|
|
480
|
+
width=width,
|
|
481
|
+
sortable=sortable,
|
|
482
|
+
prefix=prefix,
|
|
483
|
+
suffix=suffix,
|
|
484
|
+
decimals=decimals,
|
|
485
|
+
date_format=date_format,
|
|
486
|
+
time_format=time_format,
|
|
487
|
+
badge_colors=badge_colors or {},
|
|
488
|
+
formatter=formatter,
|
|
489
|
+
)
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
def data_table(
|
|
493
|
+
columns: Sequence[str | TableColumn] | None = None,
|
|
494
|
+
rows: Sequence[Sequence[Any]] | None = None,
|
|
495
|
+
*,
|
|
496
|
+
source: Any = None,
|
|
497
|
+
column_overrides: Mapping[str, TableColumn] | None = None,
|
|
498
|
+
sortable: bool = True,
|
|
499
|
+
selectable: bool = True,
|
|
500
|
+
striped: bool = False,
|
|
501
|
+
show_dividers: bool = True,
|
|
502
|
+
header_bg: ColorSpec | None = None,
|
|
503
|
+
row_height: float | None = None,
|
|
504
|
+
on_row_click: Callable[[int, list[Any]], None] | None = None,
|
|
505
|
+
) -> DataTable:
|
|
506
|
+
return DataTable(
|
|
507
|
+
columns,
|
|
508
|
+
rows,
|
|
509
|
+
source=source,
|
|
510
|
+
column_overrides=column_overrides,
|
|
511
|
+
sortable=sortable,
|
|
512
|
+
selectable=selectable,
|
|
513
|
+
striped=striped,
|
|
514
|
+
show_dividers=show_dividers,
|
|
515
|
+
header_bg=header_bg,
|
|
516
|
+
row_height=row_height,
|
|
517
|
+
on_row_click=on_row_click,
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
def date_picker(
|
|
522
|
+
label: str = "Fecha",
|
|
523
|
+
*,
|
|
524
|
+
value: date | None = None,
|
|
525
|
+
variant: DatePickerVariant = "outlined",
|
|
526
|
+
supporting_text: str | None = None,
|
|
527
|
+
error_text: str | None = None,
|
|
528
|
+
disabled: bool = False,
|
|
529
|
+
bind: State[date | None] | None = None,
|
|
530
|
+
on_change: Callable[[date], None] | None = None,
|
|
531
|
+
) -> DatePicker:
|
|
532
|
+
return DatePicker(
|
|
533
|
+
label,
|
|
534
|
+
value=value,
|
|
535
|
+
variant=variant,
|
|
536
|
+
supporting_text=supporting_text,
|
|
537
|
+
error_text=error_text,
|
|
538
|
+
disabled=disabled,
|
|
539
|
+
bind=bind,
|
|
540
|
+
on_change=on_change,
|
|
541
|
+
)
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
def time_picker(
|
|
545
|
+
label: str = "Hora",
|
|
546
|
+
*,
|
|
547
|
+
value: dt_time | None = None,
|
|
548
|
+
use_24h: bool = True,
|
|
549
|
+
variant: TimePickerVariant = "outlined",
|
|
550
|
+
supporting_text: str | None = None,
|
|
551
|
+
error_text: str | None = None,
|
|
552
|
+
disabled: bool = False,
|
|
553
|
+
bind: State[dt_time | None] | None = None,
|
|
554
|
+
on_change: Callable[[dt_time], None] | None = None,
|
|
555
|
+
) -> TimePicker:
|
|
556
|
+
return TimePicker(
|
|
557
|
+
label,
|
|
558
|
+
value=value,
|
|
559
|
+
use_24h=use_24h,
|
|
560
|
+
variant=variant,
|
|
561
|
+
supporting_text=supporting_text,
|
|
562
|
+
error_text=error_text,
|
|
563
|
+
disabled=disabled,
|
|
564
|
+
bind=bind,
|
|
565
|
+
on_change=on_change,
|
|
566
|
+
)
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
def dialog(
|
|
570
|
+
title: str,
|
|
571
|
+
*,
|
|
572
|
+
icon: str | None = None,
|
|
573
|
+
width: float = 420.0,
|
|
574
|
+
dismissible: bool = True,
|
|
575
|
+
window: Window | None = None,
|
|
576
|
+
) -> Dialog:
|
|
577
|
+
return Dialog(title, icon=icon, width=width, dismissible=dismissible, window=window)
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
def snackbar(
|
|
581
|
+
message: str,
|
|
582
|
+
*,
|
|
583
|
+
action: str | None = None,
|
|
584
|
+
on_action: Callable[[], None] | None = None,
|
|
585
|
+
duration: float = 3.5,
|
|
586
|
+
auto_show: bool = True,
|
|
587
|
+
window: Window | None = None,
|
|
588
|
+
) -> Snackbar:
|
|
589
|
+
sb = Snackbar(message, action=action, on_action=on_action, duration=duration, window=window)
|
|
590
|
+
if auto_show:
|
|
591
|
+
sb.show()
|
|
592
|
+
return sb
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
def progress(
|
|
596
|
+
*,
|
|
597
|
+
value: float | None = None,
|
|
598
|
+
variant: Literal["linear", "circular"] = "linear",
|
|
599
|
+
bind: State[float | None] | None = None,
|
|
600
|
+
) -> ProgressIndicator:
|
|
601
|
+
return ProgressIndicator(value=value, variant=variant, bind=bind)
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
def image(
|
|
605
|
+
source: Any,
|
|
606
|
+
*,
|
|
607
|
+
fit: ImageFit = "cover",
|
|
608
|
+
radius: ShapeToken | float = "medium",
|
|
609
|
+
) -> Image:
|
|
610
|
+
return Image(source, fit=fit, radius=radius)
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
def badge(
|
|
614
|
+
value: str | int | None = None,
|
|
615
|
+
*,
|
|
616
|
+
color: BadgeColor = "error",
|
|
617
|
+
) -> Badge:
|
|
618
|
+
return Badge(value, color=color)
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
def segmented_button(
|
|
622
|
+
options: Sequence[str],
|
|
623
|
+
*,
|
|
624
|
+
selected: str | set[str] | None = None,
|
|
625
|
+
multi_select: bool = False,
|
|
626
|
+
disabled: bool = False,
|
|
627
|
+
bind: State[Any] | None = None,
|
|
628
|
+
on_change: Callable[[Any], None] | None = None,
|
|
629
|
+
) -> SegmentedButton:
|
|
630
|
+
return SegmentedButton(
|
|
631
|
+
options,
|
|
632
|
+
selected=selected,
|
|
633
|
+
multi_select=multi_select,
|
|
634
|
+
disabled=disabled,
|
|
635
|
+
bind=bind,
|
|
636
|
+
on_change=on_change,
|
|
637
|
+
)
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
def search_bar(
|
|
641
|
+
placeholder: str = "Buscar...",
|
|
642
|
+
*,
|
|
643
|
+
value: str = "",
|
|
644
|
+
variant: Literal["filled", "outlined", "elevated"] = "filled",
|
|
645
|
+
leading_icon: str = "search",
|
|
646
|
+
disabled: bool = False,
|
|
647
|
+
bind: State[str] | None = None,
|
|
648
|
+
on_change: Callable[[str], None] | None = None,
|
|
649
|
+
on_submit: Callable[[str], None] | None = None,
|
|
650
|
+
) -> SearchBar:
|
|
651
|
+
return SearchBar(
|
|
652
|
+
placeholder,
|
|
653
|
+
value=value,
|
|
654
|
+
variant=variant,
|
|
655
|
+
leading_icon=leading_icon,
|
|
656
|
+
disabled=disabled,
|
|
657
|
+
bind=bind,
|
|
658
|
+
on_change=on_change,
|
|
659
|
+
on_submit=on_submit,
|
|
660
|
+
)
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
def bottom_sheet(
|
|
664
|
+
title: str | None = None,
|
|
665
|
+
*,
|
|
666
|
+
max_width: float = 640.0,
|
|
667
|
+
dismissible: bool = True,
|
|
668
|
+
window: Window | None = None,
|
|
669
|
+
) -> BottomSheet:
|
|
670
|
+
return BottomSheet(title, max_width=max_width, dismissible=dismissible, window=window)
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
def menu(
|
|
674
|
+
items: Sequence[MenuItem | tuple[str, Callable[[], None]] | tuple[str, str, Callable[[], None]]],
|
|
675
|
+
*,
|
|
676
|
+
width: float = 220.0,
|
|
677
|
+
window: Window | None = None,
|
|
678
|
+
) -> Menu:
|
|
679
|
+
return Menu(items, width=width, window=window)
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
def kpi_card(
|
|
683
|
+
title: str,
|
|
684
|
+
value: str,
|
|
685
|
+
*,
|
|
686
|
+
delta: str | None = None,
|
|
687
|
+
positive: bool = True,
|
|
688
|
+
sparkline: Sequence[float] | None = None,
|
|
689
|
+
icon: str | None = None,
|
|
690
|
+
variant: Literal["elevated", "filled", "outlined"] = "elevated",
|
|
691
|
+
) -> KPICard:
|
|
692
|
+
return KPICard(
|
|
693
|
+
title,
|
|
694
|
+
value,
|
|
695
|
+
delta=delta,
|
|
696
|
+
positive=positive,
|
|
697
|
+
sparkline=sparkline,
|
|
698
|
+
icon=icon,
|
|
699
|
+
variant=variant,
|
|
700
|
+
)
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
def line_chart(
|
|
704
|
+
labels: Sequence[str],
|
|
705
|
+
values: Sequence[float],
|
|
706
|
+
*,
|
|
707
|
+
title: str | None = None,
|
|
708
|
+
color: ChartColorRole | Color = "primary",
|
|
709
|
+
smooth: bool = True,
|
|
710
|
+
area: bool = True,
|
|
711
|
+
show_points: bool = True,
|
|
712
|
+
chart_height: float = 230.0,
|
|
713
|
+
) -> LineChart:
|
|
714
|
+
return LineChart(
|
|
715
|
+
labels,
|
|
716
|
+
values,
|
|
717
|
+
title=title,
|
|
718
|
+
color=color,
|
|
719
|
+
smooth=smooth,
|
|
720
|
+
area=area,
|
|
721
|
+
show_points=show_points,
|
|
722
|
+
chart_height=chart_height,
|
|
723
|
+
)
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
def bar_chart(
|
|
727
|
+
labels: Sequence[str],
|
|
728
|
+
values: Sequence[float],
|
|
729
|
+
*,
|
|
730
|
+
title: str | None = None,
|
|
731
|
+
color: ChartColorRole | Color = "primary",
|
|
732
|
+
chart_height: float = 230.0,
|
|
733
|
+
) -> BarChart:
|
|
734
|
+
return BarChart(labels, values, title=title, color=color, chart_height=chart_height)
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
def donut_chart(
|
|
738
|
+
items: Sequence[tuple[str, float]],
|
|
739
|
+
*,
|
|
740
|
+
title: str | None = None,
|
|
741
|
+
center_label: str | None = None,
|
|
742
|
+
thickness: float = 26.0,
|
|
743
|
+
chart_height: float = 230.0,
|
|
744
|
+
) -> DonutChart:
|
|
745
|
+
return DonutChart(
|
|
746
|
+
items,
|
|
747
|
+
title=title,
|
|
748
|
+
center_label=center_label,
|
|
749
|
+
thickness=thickness,
|
|
750
|
+
chart_height=chart_height,
|
|
751
|
+
)
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
def gauge_chart(
|
|
755
|
+
value: float,
|
|
756
|
+
*,
|
|
757
|
+
min: float = 0.0,
|
|
758
|
+
max: float = 100.0,
|
|
759
|
+
title: str | None = None,
|
|
760
|
+
unit: str = "%",
|
|
761
|
+
subtitle: str | None = None,
|
|
762
|
+
color: ChartColorRole | Color = "primary",
|
|
763
|
+
thickness: float = 18.0,
|
|
764
|
+
chart_height: float = 210.0,
|
|
765
|
+
) -> GaugeChart:
|
|
766
|
+
return GaugeChart(
|
|
767
|
+
value,
|
|
768
|
+
min=min,
|
|
769
|
+
max=max,
|
|
770
|
+
title=title,
|
|
771
|
+
unit=unit,
|
|
772
|
+
subtitle=subtitle,
|
|
773
|
+
color=color,
|
|
774
|
+
thickness=thickness,
|
|
775
|
+
chart_height=chart_height,
|
|
776
|
+
)
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
def multi_line_chart(
|
|
780
|
+
labels: Sequence[str],
|
|
781
|
+
series: Mapping[str, Sequence[float]],
|
|
782
|
+
*,
|
|
783
|
+
title: str | None = None,
|
|
784
|
+
smooth: bool = True,
|
|
785
|
+
chart_height: float = 240.0,
|
|
786
|
+
) -> MultiLineChart:
|
|
787
|
+
return MultiLineChart(labels, series, title=title, smooth=smooth, chart_height=chart_height)
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
def heatmap(
|
|
791
|
+
matrix: Sequence[Sequence[float]],
|
|
792
|
+
*,
|
|
793
|
+
x_labels: Sequence[str] | None = None,
|
|
794
|
+
y_labels: Sequence[str] | None = None,
|
|
795
|
+
title: str | None = None,
|
|
796
|
+
color: ChartColorRole | Color = "primary",
|
|
797
|
+
chart_height: float = 220.0,
|
|
798
|
+
) -> Heatmap:
|
|
799
|
+
return Heatmap(
|
|
800
|
+
matrix,
|
|
801
|
+
x_labels=x_labels,
|
|
802
|
+
y_labels=y_labels,
|
|
803
|
+
title=title,
|
|
804
|
+
color=color,
|
|
805
|
+
chart_height=chart_height,
|
|
806
|
+
)
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
def radar_chart(
|
|
810
|
+
axes: Sequence[str],
|
|
811
|
+
series: Mapping[str, Sequence[float]],
|
|
812
|
+
*,
|
|
813
|
+
max_value: float = 100.0,
|
|
814
|
+
title: str | None = None,
|
|
815
|
+
chart_height: float = 240.0,
|
|
816
|
+
) -> RadarChart:
|
|
817
|
+
return RadarChart(axes, series, max_value=max_value, title=title, chart_height=chart_height)
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
def scatter_chart(
|
|
821
|
+
points: Sequence[tuple],
|
|
822
|
+
*,
|
|
823
|
+
title: str | None = None,
|
|
824
|
+
color: ChartColorRole | Color = "primary",
|
|
825
|
+
chart_height: float = 230.0,
|
|
826
|
+
) -> ScatterChart:
|
|
827
|
+
return ScatterChart(points, title=title, color=color, chart_height=chart_height)
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
def horizontal_bar_chart(
|
|
831
|
+
labels: Sequence[str],
|
|
832
|
+
values: Sequence[float],
|
|
833
|
+
*,
|
|
834
|
+
title: str | None = None,
|
|
835
|
+
color: ChartColorRole | Color = "primary",
|
|
836
|
+
show_values: bool = True,
|
|
837
|
+
chart_height: float = 220.0,
|
|
838
|
+
) -> HorizontalBarChart:
|
|
839
|
+
return HorizontalBarChart(
|
|
840
|
+
labels,
|
|
841
|
+
values,
|
|
842
|
+
title=title,
|
|
843
|
+
color=color,
|
|
844
|
+
show_values=show_values,
|
|
845
|
+
chart_height=chart_height,
|
|
846
|
+
)
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
def funnel_chart(
|
|
850
|
+
stages: Sequence[tuple[str, float]],
|
|
851
|
+
*,
|
|
852
|
+
title: str | None = None,
|
|
853
|
+
color: ChartColorRole | Color = "primary",
|
|
854
|
+
chart_height: float = 230.0,
|
|
855
|
+
) -> FunnelChart:
|
|
856
|
+
return FunnelChart(stages, title=title, color=color, chart_height=chart_height)
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
def candlestick_chart(
|
|
860
|
+
candles: Sequence[tuple[str, float, float, float, float]],
|
|
861
|
+
*,
|
|
862
|
+
title: str | None = None,
|
|
863
|
+
chart_height: float = 240.0,
|
|
864
|
+
) -> CandlestickChart:
|
|
865
|
+
return CandlestickChart(candles, title=title, chart_height=chart_height)
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
def gantt_chart(
|
|
869
|
+
tasks: Sequence[tuple],
|
|
870
|
+
*,
|
|
871
|
+
title: str | None = None,
|
|
872
|
+
unit: str = "Día",
|
|
873
|
+
chart_height: float = 230.0,
|
|
874
|
+
) -> GanttChart:
|
|
875
|
+
return GanttChart(tasks, title=title, unit=unit, chart_height=chart_height)
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
def tree_view(
|
|
879
|
+
nodes: Sequence[TreeNode],
|
|
880
|
+
*,
|
|
881
|
+
on_select: Callable[[TreeNode], None] | None = None,
|
|
882
|
+
) -> TreeView:
|
|
883
|
+
return TreeView(nodes, on_select=on_select)
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
def pagination(
|
|
887
|
+
total_pages: int,
|
|
888
|
+
*,
|
|
889
|
+
page: int = 1,
|
|
890
|
+
max_visible: int = 5,
|
|
891
|
+
bind: State[int] | None = None,
|
|
892
|
+
on_change: Callable[[int], None] | None = None,
|
|
893
|
+
) -> Pagination:
|
|
894
|
+
return Pagination(total_pages, page=page, max_visible=max_visible, bind=bind, on_change=on_change)
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
def expansion_panel(
|
|
898
|
+
title: str,
|
|
899
|
+
*,
|
|
900
|
+
subtitle: str | None = None,
|
|
901
|
+
icon: str | None = None,
|
|
902
|
+
expanded: bool = False,
|
|
903
|
+
on_toggle: Callable[[bool], None] | None = None,
|
|
904
|
+
) -> ExpansionPanel:
|
|
905
|
+
return ExpansionPanel(title, subtitle=subtitle, icon=icon, expanded=expanded, on_toggle=on_toggle)
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
def skeleton(
|
|
909
|
+
*,
|
|
910
|
+
width: float | None = None,
|
|
911
|
+
height: float = 18.0,
|
|
912
|
+
shape: ShapeToken | float = "small",
|
|
913
|
+
) -> Skeleton:
|
|
914
|
+
return Skeleton(width=width, height=height, shape=shape)
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
def text_area(
|
|
918
|
+
label: str,
|
|
919
|
+
*,
|
|
920
|
+
variant: Literal["outlined", "filled"] = "outlined",
|
|
921
|
+
value: str = "",
|
|
922
|
+
rows: int = 4,
|
|
923
|
+
placeholder: str = "",
|
|
924
|
+
supporting_text: str | None = None,
|
|
925
|
+
error_text: str | None = None,
|
|
926
|
+
max_length: int | None = None,
|
|
927
|
+
disabled: bool = False,
|
|
928
|
+
bind: State[str] | None = None,
|
|
929
|
+
on_change: Callable[[str], None] | None = None,
|
|
930
|
+
) -> TextArea:
|
|
931
|
+
return TextArea(
|
|
932
|
+
label,
|
|
933
|
+
variant=variant,
|
|
934
|
+
value=value,
|
|
935
|
+
rows=rows,
|
|
936
|
+
placeholder=placeholder,
|
|
937
|
+
supporting_text=supporting_text,
|
|
938
|
+
error_text=error_text,
|
|
939
|
+
max_length=max_length,
|
|
940
|
+
disabled=disabled,
|
|
941
|
+
bind=bind,
|
|
942
|
+
on_change=on_change,
|
|
943
|
+
)
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
def range_slider(
|
|
947
|
+
*,
|
|
948
|
+
start: float = 20.0,
|
|
949
|
+
end: float = 80.0,
|
|
950
|
+
min: float = 0.0,
|
|
951
|
+
max: float = 100.0,
|
|
952
|
+
step: float | None = None,
|
|
953
|
+
disabled: bool = False,
|
|
954
|
+
bind: State[tuple[float, float]] | None = None,
|
|
955
|
+
on_change: Callable[[tuple[float, float]], None] | None = None,
|
|
956
|
+
) -> RangeSlider:
|
|
957
|
+
return RangeSlider(
|
|
958
|
+
start=start,
|
|
959
|
+
end=end,
|
|
960
|
+
min=min,
|
|
961
|
+
max=max,
|
|
962
|
+
step=step,
|
|
963
|
+
disabled=disabled,
|
|
964
|
+
bind=bind,
|
|
965
|
+
on_change=on_change,
|
|
966
|
+
)
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
def number_input(
|
|
970
|
+
label: str,
|
|
971
|
+
*,
|
|
972
|
+
variant: Literal["outlined", "filled"] = "outlined",
|
|
973
|
+
value: float = 0,
|
|
974
|
+
min: float | None = None,
|
|
975
|
+
max: float | None = None,
|
|
976
|
+
step: float = 1,
|
|
977
|
+
decimals: int = 0,
|
|
978
|
+
disabled: bool = False,
|
|
979
|
+
bind: State[float] | None = None,
|
|
980
|
+
on_change: Callable[[float], None] | None = None,
|
|
981
|
+
) -> NumberInput:
|
|
982
|
+
return NumberInput(
|
|
983
|
+
label,
|
|
984
|
+
variant=variant,
|
|
985
|
+
value=value,
|
|
986
|
+
min=min,
|
|
987
|
+
max=max,
|
|
988
|
+
step=step,
|
|
989
|
+
decimals=decimals,
|
|
990
|
+
disabled=disabled,
|
|
991
|
+
bind=bind,
|
|
992
|
+
on_change=on_change,
|
|
993
|
+
)
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
def color_picker(
|
|
997
|
+
label: str = "Color",
|
|
998
|
+
*,
|
|
999
|
+
variant: Literal["outlined", "filled"] = "outlined",
|
|
1000
|
+
value: str = "#6750A4",
|
|
1001
|
+
disabled: bool = False,
|
|
1002
|
+
bind: State[str] | None = None,
|
|
1003
|
+
on_change: Callable[[str], None] | None = None,
|
|
1004
|
+
) -> ColorPicker:
|
|
1005
|
+
return ColorPicker(label, variant=variant, value=value, disabled=disabled, bind=bind, on_change=on_change)
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
def file_picker(
|
|
1009
|
+
label: str = "Archivo",
|
|
1010
|
+
*,
|
|
1011
|
+
variant: Literal["outlined", "filled"] = "outlined",
|
|
1012
|
+
mode: Literal["open", "save", "folder"] = "open",
|
|
1013
|
+
filetypes: Sequence[tuple[str, str]] = (("Todos los archivos", "*.*"),),
|
|
1014
|
+
value: str = "",
|
|
1015
|
+
disabled: bool = False,
|
|
1016
|
+
bind: State[str] | None = None,
|
|
1017
|
+
on_change: Callable[[str], None] | None = None,
|
|
1018
|
+
) -> FilePicker:
|
|
1019
|
+
return FilePicker(
|
|
1020
|
+
label,
|
|
1021
|
+
variant=variant,
|
|
1022
|
+
mode=mode,
|
|
1023
|
+
filetypes=filetypes,
|
|
1024
|
+
value=value,
|
|
1025
|
+
disabled=disabled,
|
|
1026
|
+
bind=bind,
|
|
1027
|
+
on_change=on_change,
|
|
1028
|
+
)
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
def grid(*, columns: int = 3, gap: float = 16.0, row_gap: float | None = None) -> Grid:
|
|
1032
|
+
return Grid(columns=columns, gap=gap, row_gap=row_gap)
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
def split_view(
|
|
1036
|
+
*,
|
|
1037
|
+
ratio: float = 0.35,
|
|
1038
|
+
min_ratio: float = 0.15,
|
|
1039
|
+
max_ratio: float = 0.85,
|
|
1040
|
+
height: float = 260.0,
|
|
1041
|
+
) -> SplitView:
|
|
1042
|
+
return SplitView(ratio=ratio, min_ratio=min_ratio, max_ratio=max_ratio, height=height)
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
def switch(
|
|
1046
|
+
*,
|
|
1047
|
+
value: bool = False,
|
|
1048
|
+
label: str | None = None,
|
|
1049
|
+
show_icon: bool = True,
|
|
1050
|
+
disabled: bool = False,
|
|
1051
|
+
bind: State[bool] | None = None,
|
|
1052
|
+
on_change: Callable[[bool], None] | None = None,
|
|
1053
|
+
) -> Switch:
|
|
1054
|
+
return Switch(
|
|
1055
|
+
value=value,
|
|
1056
|
+
label=label,
|
|
1057
|
+
show_icon=show_icon,
|
|
1058
|
+
disabled=disabled,
|
|
1059
|
+
bind=bind,
|
|
1060
|
+
on_change=on_change,
|
|
1061
|
+
)
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
def checkbox(
|
|
1065
|
+
*,
|
|
1066
|
+
value: bool | None = False,
|
|
1067
|
+
label: str | None = None,
|
|
1068
|
+
tristate: bool = False,
|
|
1069
|
+
error: bool = False,
|
|
1070
|
+
disabled: bool = False,
|
|
1071
|
+
bind: State[bool | None] | None = None,
|
|
1072
|
+
on_change: Callable[[bool | None], None] | None = None,
|
|
1073
|
+
) -> Checkbox:
|
|
1074
|
+
return Checkbox(
|
|
1075
|
+
value=value,
|
|
1076
|
+
label=label,
|
|
1077
|
+
tristate=tristate,
|
|
1078
|
+
error=error,
|
|
1079
|
+
disabled=disabled,
|
|
1080
|
+
bind=bind,
|
|
1081
|
+
on_change=on_change,
|
|
1082
|
+
)
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
def radio_group(
|
|
1086
|
+
options: Sequence[str],
|
|
1087
|
+
*,
|
|
1088
|
+
value: str | None = None,
|
|
1089
|
+
direction: RadioDirection = "vertical",
|
|
1090
|
+
gap: float = 8.0,
|
|
1091
|
+
disabled: bool = False,
|
|
1092
|
+
bind: State[str | None] | None = None,
|
|
1093
|
+
on_change: Callable[[str], None] | None = None,
|
|
1094
|
+
) -> RadioGroup:
|
|
1095
|
+
return RadioGroup(
|
|
1096
|
+
options,
|
|
1097
|
+
value=value,
|
|
1098
|
+
direction=direction,
|
|
1099
|
+
gap=gap,
|
|
1100
|
+
disabled=disabled,
|
|
1101
|
+
bind=bind,
|
|
1102
|
+
on_change=on_change,
|
|
1103
|
+
)
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
def slider(
|
|
1107
|
+
*,
|
|
1108
|
+
value: float = 50.0,
|
|
1109
|
+
min: float = 0.0,
|
|
1110
|
+
max: float = 100.0,
|
|
1111
|
+
step: float | None = None,
|
|
1112
|
+
label: bool = True,
|
|
1113
|
+
disabled: bool = False,
|
|
1114
|
+
bind: State[float] | None = None,
|
|
1115
|
+
on_change: Callable[[float], None] | None = None,
|
|
1116
|
+
) -> Slider:
|
|
1117
|
+
return Slider(
|
|
1118
|
+
value=value,
|
|
1119
|
+
min=min,
|
|
1120
|
+
max=max,
|
|
1121
|
+
step=step,
|
|
1122
|
+
label=label,
|
|
1123
|
+
disabled=disabled,
|
|
1124
|
+
bind=bind,
|
|
1125
|
+
on_change=on_change,
|
|
1126
|
+
)
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
def select(
|
|
1130
|
+
label: str,
|
|
1131
|
+
options: Sequence[str],
|
|
1132
|
+
*,
|
|
1133
|
+
variant: SelectVariant = "outlined",
|
|
1134
|
+
value: str | None = None,
|
|
1135
|
+
placeholder: str = "",
|
|
1136
|
+
supporting_text: str | None = None,
|
|
1137
|
+
error_text: str | None = None,
|
|
1138
|
+
leading_icon: str | None = None,
|
|
1139
|
+
disabled: bool = False,
|
|
1140
|
+
bind: State[str | None] | None = None,
|
|
1141
|
+
on_change: Callable[[str], None] | None = None,
|
|
1142
|
+
) -> Select:
|
|
1143
|
+
return Select(
|
|
1144
|
+
label,
|
|
1145
|
+
options,
|
|
1146
|
+
variant=variant,
|
|
1147
|
+
value=value,
|
|
1148
|
+
placeholder=placeholder,
|
|
1149
|
+
supporting_text=supporting_text,
|
|
1150
|
+
error_text=error_text,
|
|
1151
|
+
leading_icon=leading_icon,
|
|
1152
|
+
disabled=disabled,
|
|
1153
|
+
bind=bind,
|
|
1154
|
+
on_change=on_change,
|
|
1155
|
+
)
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
def chip(
|
|
1159
|
+
label: str,
|
|
1160
|
+
*,
|
|
1161
|
+
variant: ChipVariant = "filter",
|
|
1162
|
+
selected: bool = False,
|
|
1163
|
+
elevated: bool = False,
|
|
1164
|
+
icon: str | None = None,
|
|
1165
|
+
closable: bool = False,
|
|
1166
|
+
disabled: bool = False,
|
|
1167
|
+
bind: State[bool] | None = None,
|
|
1168
|
+
on_click: Callable[[bool], None] | None = None,
|
|
1169
|
+
on_close: Callable[[], None] | None = None,
|
|
1170
|
+
) -> Chip:
|
|
1171
|
+
return Chip(
|
|
1172
|
+
label,
|
|
1173
|
+
variant=variant,
|
|
1174
|
+
selected=selected,
|
|
1175
|
+
elevated=elevated,
|
|
1176
|
+
icon=icon,
|
|
1177
|
+
closable=closable,
|
|
1178
|
+
disabled=disabled,
|
|
1179
|
+
bind=bind,
|
|
1180
|
+
on_click=on_click,
|
|
1181
|
+
on_close=on_close,
|
|
1182
|
+
)
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
def text_field(
|
|
1186
|
+
label: str,
|
|
1187
|
+
*,
|
|
1188
|
+
variant: TextFieldVariant = "outlined",
|
|
1189
|
+
value: str = "",
|
|
1190
|
+
placeholder: str = "",
|
|
1191
|
+
supporting_text: str | None = None,
|
|
1192
|
+
error_text: str | None = None,
|
|
1193
|
+
leading_icon: str | None = None,
|
|
1194
|
+
trailing_icon: str | None = None,
|
|
1195
|
+
prefix: str | None = None,
|
|
1196
|
+
suffix: str | None = None,
|
|
1197
|
+
password: bool = False,
|
|
1198
|
+
max_length: int | None = None,
|
|
1199
|
+
disabled: bool = False,
|
|
1200
|
+
bind: State[str] | None = None,
|
|
1201
|
+
on_change: Callable[[str], None] | None = None,
|
|
1202
|
+
on_submit: Callable[[str], None] | None = None,
|
|
1203
|
+
) -> TextField:
|
|
1204
|
+
return TextField(
|
|
1205
|
+
label,
|
|
1206
|
+
variant=variant,
|
|
1207
|
+
value=value,
|
|
1208
|
+
placeholder=placeholder,
|
|
1209
|
+
supporting_text=supporting_text,
|
|
1210
|
+
error_text=error_text,
|
|
1211
|
+
leading_icon=leading_icon,
|
|
1212
|
+
trailing_icon=trailing_icon,
|
|
1213
|
+
prefix=prefix,
|
|
1214
|
+
suffix=suffix,
|
|
1215
|
+
password=password,
|
|
1216
|
+
max_length=max_length,
|
|
1217
|
+
disabled=disabled,
|
|
1218
|
+
bind=bind,
|
|
1219
|
+
on_change=on_change,
|
|
1220
|
+
on_submit=on_submit,
|
|
1221
|
+
)
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
def masked_input(
|
|
1225
|
+
label: str,
|
|
1226
|
+
mask: str,
|
|
1227
|
+
*,
|
|
1228
|
+
variant: TextFieldVariant = "outlined",
|
|
1229
|
+
value: str = "",
|
|
1230
|
+
placeholder: str = "",
|
|
1231
|
+
supporting_text: str | None = None,
|
|
1232
|
+
error_text: str | None = None,
|
|
1233
|
+
leading_icon: str | None = None,
|
|
1234
|
+
trailing_icon: str | None = None,
|
|
1235
|
+
uppercase: bool = True,
|
|
1236
|
+
disabled: bool = False,
|
|
1237
|
+
bind: State[str] | None = None,
|
|
1238
|
+
on_change: Callable[[str], None] | None = None,
|
|
1239
|
+
on_submit: Callable[[str], None] | None = None,
|
|
1240
|
+
) -> MaskedInput:
|
|
1241
|
+
return MaskedInput(
|
|
1242
|
+
label,
|
|
1243
|
+
mask,
|
|
1244
|
+
variant=variant,
|
|
1245
|
+
value=value,
|
|
1246
|
+
placeholder=placeholder,
|
|
1247
|
+
supporting_text=supporting_text,
|
|
1248
|
+
error_text=error_text,
|
|
1249
|
+
leading_icon=leading_icon,
|
|
1250
|
+
trailing_icon=trailing_icon,
|
|
1251
|
+
uppercase=uppercase,
|
|
1252
|
+
disabled=disabled,
|
|
1253
|
+
bind=bind,
|
|
1254
|
+
on_change=on_change,
|
|
1255
|
+
on_submit=on_submit,
|
|
1256
|
+
)
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
def form(*, on_submit: Callable[[dict[str, Any]], None] | None = None) -> Form:
|
|
1260
|
+
"""Create a declarative Enterprise Form validator (`ui.form(on_submit=...)`)."""
|
|
1261
|
+
return Form(on_submit=on_submit)
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
def background(
|
|
1265
|
+
task: Callable[[], Any],
|
|
1266
|
+
*,
|
|
1267
|
+
on_done: Callable[[Any], None] | None = None,
|
|
1268
|
+
on_error: Callable[[Exception], None] | None = None,
|
|
1269
|
+
window: Window | None = None,
|
|
1270
|
+
):
|
|
1271
|
+
"""Run `task` on a background thread and invoke `on_done`/`on_error` safely on the UI thread."""
|
|
1272
|
+
return _run_in_background(task, on_done=on_done, on_error=on_error, window=window)
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
def call_later(delay_seconds: float, callback: Callable[[], None]):
|
|
1276
|
+
"""Run `callback` safely on the main UI thread after `delay_seconds`."""
|
|
1277
|
+
return _call_later(delay_seconds, callback)
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
def export_pdf(
|
|
1281
|
+
target: Any,
|
|
1282
|
+
path: str | Path | None = None,
|
|
1283
|
+
*,
|
|
1284
|
+
page_size: str | tuple[float, float] | None = None,
|
|
1285
|
+
margin: float = 24.0,
|
|
1286
|
+
) -> Path | bytes:
|
|
1287
|
+
"""Export any `Window` or `Widget` to a crisp vector PDF via Skia's native PDF backend."""
|
|
1288
|
+
return _export_pdf(target, path, page_size=page_size, margin=margin)
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
def grid_column(
|
|
1292
|
+
title: str,
|
|
1293
|
+
*,
|
|
1294
|
+
type: GridColType = "text",
|
|
1295
|
+
width: float | None = None,
|
|
1296
|
+
align: GridColAlign | None = None,
|
|
1297
|
+
sortable: bool = True,
|
|
1298
|
+
editable: bool = True,
|
|
1299
|
+
aggregate: Literal["sum", "avg", "count", "min", "max"] | None = None,
|
|
1300
|
+
prefix: str = "",
|
|
1301
|
+
suffix: str = "",
|
|
1302
|
+
decimals: int = 2,
|
|
1303
|
+
badge_colors: dict[str, BadgeTone] | None = None,
|
|
1304
|
+
) -> GridColumn:
|
|
1305
|
+
"""Define a typed, editable, aggregatable column for `ui.data_grid`."""
|
|
1306
|
+
return GridColumn(
|
|
1307
|
+
title=title,
|
|
1308
|
+
type=type,
|
|
1309
|
+
width=width,
|
|
1310
|
+
align=align,
|
|
1311
|
+
sortable=sortable,
|
|
1312
|
+
editable=editable,
|
|
1313
|
+
aggregate=aggregate,
|
|
1314
|
+
prefix=prefix,
|
|
1315
|
+
suffix=suffix,
|
|
1316
|
+
decimals=decimals,
|
|
1317
|
+
badge_colors=badge_colors or {},
|
|
1318
|
+
)
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
def sql_source(
|
|
1322
|
+
connection: str | Path | Any,
|
|
1323
|
+
*,
|
|
1324
|
+
table: str | None = None,
|
|
1325
|
+
query: str | None = None,
|
|
1326
|
+
params: Sequence[Any] = (),
|
|
1327
|
+
primary_key: str | None = None,
|
|
1328
|
+
auto_commit: bool = True,
|
|
1329
|
+
) -> SQLDataSource:
|
|
1330
|
+
"""Create a direct SQL DataSource from a SQLite path, DB-API 2.0 connection, or SQLAlchemy engine."""
|
|
1331
|
+
return SQLDataSource(
|
|
1332
|
+
connection,
|
|
1333
|
+
table=table,
|
|
1334
|
+
query=query,
|
|
1335
|
+
params=params,
|
|
1336
|
+
primary_key=primary_key,
|
|
1337
|
+
auto_commit=auto_commit,
|
|
1338
|
+
)
|
|
1339
|
+
|
|
1340
|
+
|
|
1341
|
+
def csv_source(
|
|
1342
|
+
path: str | Path,
|
|
1343
|
+
*,
|
|
1344
|
+
delimiter: str = ",",
|
|
1345
|
+
encoding: str = "utf-8-sig",
|
|
1346
|
+
) -> CSVDataSource:
|
|
1347
|
+
"""Create a zero-dependency CSV DataSource with automatic numeric/bool column inference."""
|
|
1348
|
+
return CSVDataSource(path, delimiter=delimiter, encoding=encoding)
|
|
1349
|
+
|
|
1350
|
+
|
|
1351
|
+
def data_grid(
|
|
1352
|
+
columns: Sequence[str | GridColumn] | None = None,
|
|
1353
|
+
rows: Sequence[Sequence[Any]] | None = None,
|
|
1354
|
+
*,
|
|
1355
|
+
source: Any = None,
|
|
1356
|
+
column_overrides: Mapping[str, GridColumn] | None = None,
|
|
1357
|
+
page_size: int | None = None,
|
|
1358
|
+
virtualized: bool = True,
|
|
1359
|
+
height: float = 360.0,
|
|
1360
|
+
row_height: float = 40.0,
|
|
1361
|
+
searchable: bool = True,
|
|
1362
|
+
editable: bool = False,
|
|
1363
|
+
striped: bool = True,
|
|
1364
|
+
show_totals: bool | None = None,
|
|
1365
|
+
header_bg: ColorSpec | None = None,
|
|
1366
|
+
on_row_click: Callable[[int, list[Any]], None] | None = None,
|
|
1367
|
+
on_cell_edit: Callable[[int, int, Any, Any], None] | None = None,
|
|
1368
|
+
) -> DataGrid:
|
|
1369
|
+
"""Create a virtualized Enterprise DataGrid supporting `source=`, `page_size=`, and `virtualized=`."""
|
|
1370
|
+
return DataGrid(
|
|
1371
|
+
columns,
|
|
1372
|
+
rows,
|
|
1373
|
+
source=source,
|
|
1374
|
+
column_overrides=column_overrides,
|
|
1375
|
+
page_size=page_size,
|
|
1376
|
+
virtualized=virtualized,
|
|
1377
|
+
height=height,
|
|
1378
|
+
row_height=row_height,
|
|
1379
|
+
searchable=searchable,
|
|
1380
|
+
editable=editable,
|
|
1381
|
+
striped=striped,
|
|
1382
|
+
show_totals=show_totals,
|
|
1383
|
+
header_bg=header_bg,
|
|
1384
|
+
on_row_click=on_row_click,
|
|
1385
|
+
on_cell_edit=on_cell_edit,
|
|
1386
|
+
)
|
|
1387
|
+
|
|
1388
|
+
|
|
1389
|
+
def auth(
|
|
1390
|
+
*,
|
|
1391
|
+
user: str | None = None,
|
|
1392
|
+
roles: Sequence[str] = (),
|
|
1393
|
+
permissions: Sequence[str] = (),
|
|
1394
|
+
) -> AuthContext:
|
|
1395
|
+
"""Create a reactive RBAC `AuthContext` (or configure `ui.default_auth`)."""
|
|
1396
|
+
return AuthContext(user=user, roles=roles, permissions=permissions)
|
|
1397
|
+
|
|
1398
|
+
|
|
1399
|
+
def i18n(
|
|
1400
|
+
locale: str = "es",
|
|
1401
|
+
translations: Mapping[str, Mapping[str, str]] | None = None,
|
|
1402
|
+
*,
|
|
1403
|
+
fallback_locale: str = "es",
|
|
1404
|
+
) -> I18n:
|
|
1405
|
+
"""Create a reactive internationalization & regional formatting instance."""
|
|
1406
|
+
return I18n(locale=locale, translations=translations, fallback_locale=fallback_locale)
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
def router(
|
|
1410
|
+
*,
|
|
1411
|
+
initial: str = "/",
|
|
1412
|
+
auth: AuthContext | None = None,
|
|
1413
|
+
on_denied: Callable[[str], None] | None = None,
|
|
1414
|
+
) -> Router:
|
|
1415
|
+
"""Create a desktop SPA Router with history, `:param` matching, and RBAC guards."""
|
|
1416
|
+
return Router(initial=initial, auth=auth, on_denied=on_denied)
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
def preferences(app_name: str = "quantumgui_app", *, path: str | Path | None = None) -> PreferencesStore:
|
|
1420
|
+
"""Create a JSON-backed user preferences store (theme, locale, geometry, settings)."""
|
|
1421
|
+
return PreferencesStore(app_name=app_name, path=path)
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
def rule_engine(*, auth: AuthContext | None = None) -> RuleEngine:
|
|
1425
|
+
"""Create a reactive Business Rules Engine (`ui.rule_engine`)."""
|
|
1426
|
+
return RuleEngine(auth=auth)
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
def audit_log(
|
|
1430
|
+
storage: str | Path | Any = None,
|
|
1431
|
+
*,
|
|
1432
|
+
auth: AuthContext | None = None,
|
|
1433
|
+
) -> AuditLog:
|
|
1434
|
+
"""Create an Enterprise Audit Trail (`ui.audit_log`) backed by memory, JSONL, or SQLite."""
|
|
1435
|
+
return AuditLog(storage, auth=auth)
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
def history(*, max_depth: int = 100) -> CommandHistory:
|
|
1439
|
+
"""Create an Undo/Redo Command History stack (`ui.history`) with `Ctrl+Z` / `Ctrl+Y` support."""
|
|
1440
|
+
return CommandHistory(max_depth=max_depth)
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
def pdf_report(
|
|
1444
|
+
title: str = "Reporte",
|
|
1445
|
+
*,
|
|
1446
|
+
subtitle: str = "",
|
|
1447
|
+
page_size: PageFormat = "A4",
|
|
1448
|
+
orientation: PageOrientation = "portrait",
|
|
1449
|
+
margin: float = 38.0,
|
|
1450
|
+
theme: Theme | None = None,
|
|
1451
|
+
) -> PDFReport:
|
|
1452
|
+
"""Create a multi-page native Skia vector PDF report / invoice builder (`ui.pdf_report`)."""
|
|
1453
|
+
return PDFReport(
|
|
1454
|
+
title,
|
|
1455
|
+
subtitle=subtitle,
|
|
1456
|
+
page_size=page_size,
|
|
1457
|
+
orientation=orientation,
|
|
1458
|
+
margin=margin,
|
|
1459
|
+
theme=theme,
|
|
1460
|
+
)
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
def task_runner(*, max_workers: int = 2) -> TaskRunner:
|
|
1464
|
+
"""Create an Enterprise background task queue with progress reporting and cancellation."""
|
|
1465
|
+
return TaskRunner(max_workers=max_workers)
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
def currency_input(
|
|
1469
|
+
label: str = "Importe",
|
|
1470
|
+
*,
|
|
1471
|
+
amount: float = 0.0,
|
|
1472
|
+
currency: str = "$",
|
|
1473
|
+
decimals: int = 2,
|
|
1474
|
+
thousands_sep: str = ".",
|
|
1475
|
+
decimal_sep: str = ",",
|
|
1476
|
+
i18n: I18n | None = None,
|
|
1477
|
+
allow_negative: bool = True,
|
|
1478
|
+
min_amount: float | None = None,
|
|
1479
|
+
max_amount: float | None = None,
|
|
1480
|
+
variant: TextFieldVariant = "outlined",
|
|
1481
|
+
supporting_text: str | None = None,
|
|
1482
|
+
error_text: str | None = None,
|
|
1483
|
+
disabled: bool = False,
|
|
1484
|
+
bind: State[float] | None = None,
|
|
1485
|
+
on_change: Callable[[float], None] | None = None,
|
|
1486
|
+
) -> CurrencyInput:
|
|
1487
|
+
"""Create a regional Material Design 3 CurrencyInput with formatted display and `.amount` binding."""
|
|
1488
|
+
return CurrencyInput(
|
|
1489
|
+
label,
|
|
1490
|
+
amount=amount,
|
|
1491
|
+
currency=currency,
|
|
1492
|
+
decimals=decimals,
|
|
1493
|
+
thousands_sep=thousands_sep,
|
|
1494
|
+
decimal_sep=decimal_sep,
|
|
1495
|
+
i18n=i18n,
|
|
1496
|
+
allow_negative=allow_negative,
|
|
1497
|
+
min_amount=min_amount,
|
|
1498
|
+
max_amount=max_amount,
|
|
1499
|
+
variant=variant,
|
|
1500
|
+
supporting_text=supporting_text,
|
|
1501
|
+
error_text=error_text,
|
|
1502
|
+
disabled=disabled,
|
|
1503
|
+
bind=bind,
|
|
1504
|
+
on_change=on_change,
|
|
1505
|
+
)
|
|
1506
|
+
|
|
1507
|
+
|
|
1508
|
+
def filter_bar(
|
|
1509
|
+
facets: dict[str, Sequence[str]] | None = None,
|
|
1510
|
+
*,
|
|
1511
|
+
placeholder: str = "Buscar...",
|
|
1512
|
+
on_filter: Callable[[dict[str, Any]], None] | None = None,
|
|
1513
|
+
) -> FilterBar:
|
|
1514
|
+
"""Create a combined Enterprise FilterBar with search, facets, active chips & Clear All."""
|
|
1515
|
+
return FilterBar(facets, placeholder=placeholder, on_filter=on_filter)
|
|
1516
|
+
|
|
1517
|
+
|
|
1518
|
+
def wizard(
|
|
1519
|
+
*,
|
|
1520
|
+
on_finish: Callable[[], None] | None = None,
|
|
1521
|
+
on_step_change: Callable[[int], None] | None = None,
|
|
1522
|
+
prev_label: str = "Anterior",
|
|
1523
|
+
next_label: str = "Siguiente",
|
|
1524
|
+
finish_label: str = "Finalizar",
|
|
1525
|
+
) -> Wizard:
|
|
1526
|
+
"""Create a multi-step Enterprise Wizard with per-step validation and navigation."""
|
|
1527
|
+
return Wizard(
|
|
1528
|
+
on_finish=on_finish,
|
|
1529
|
+
on_step_change=on_step_change,
|
|
1530
|
+
prev_label=prev_label,
|
|
1531
|
+
next_label=next_label,
|
|
1532
|
+
finish_label=finish_label,
|
|
1533
|
+
)
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
def detail_drawer(
|
|
1537
|
+
title: str = "Detalle",
|
|
1538
|
+
*,
|
|
1539
|
+
subtitle: str = "",
|
|
1540
|
+
width: float = 400.0,
|
|
1541
|
+
save_label: str = "Guardar",
|
|
1542
|
+
cancel_label: str = "Cancelar",
|
|
1543
|
+
on_save: Callable[[], bool | None] | None = None,
|
|
1544
|
+
on_close: Callable[[], None] | None = None,
|
|
1545
|
+
window: Window | None = None,
|
|
1546
|
+
) -> DetailDrawer:
|
|
1547
|
+
"""Create a right-docked M3 Inspector/Edit DetailDrawer overlay with Save/Cancel footer."""
|
|
1548
|
+
return DetailDrawer(
|
|
1549
|
+
title,
|
|
1550
|
+
subtitle=subtitle,
|
|
1551
|
+
width=width,
|
|
1552
|
+
save_label=save_label,
|
|
1553
|
+
cancel_label=cancel_label,
|
|
1554
|
+
on_save=on_save,
|
|
1555
|
+
on_close=on_close,
|
|
1556
|
+
window=window,
|
|
1557
|
+
)
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
def notification_center(
|
|
1561
|
+
*,
|
|
1562
|
+
title: str = "Notificaciones",
|
|
1563
|
+
max_items: int = 100,
|
|
1564
|
+
height: float = 300.0,
|
|
1565
|
+
on_select: Callable[[NotificationItem], None] | None = None,
|
|
1566
|
+
) -> NotificationCenter:
|
|
1567
|
+
"""Create a persistent Enterprise NotificationCenter with unread count badge & severity filters."""
|
|
1568
|
+
return NotificationCenter(title=title, max_items=max_items, height=height, on_select=on_select)
|
|
1569
|
+
|
|
1570
|
+
|
|
1571
|
+
def export_xlsx(
|
|
1572
|
+
path: str | Path,
|
|
1573
|
+
headers: Sequence[str],
|
|
1574
|
+
rows: Sequence[Sequence[Any]],
|
|
1575
|
+
*,
|
|
1576
|
+
sheet_name: str = "Datos",
|
|
1577
|
+
totals: Sequence[Any] | None = None,
|
|
1578
|
+
) -> Path:
|
|
1579
|
+
"""Export tabular headers and rows directly to a native Excel `.xlsx` file (zero dependencies)."""
|
|
1580
|
+
return _export_xlsx(path, headers, rows, sheet_name=sheet_name, totals=totals)
|
|
1581
|
+
|
|
1582
|
+
|
|
1583
|
+
def master_detail(
|
|
1584
|
+
master_source: Any,
|
|
1585
|
+
detail_source: Any,
|
|
1586
|
+
*,
|
|
1587
|
+
master_key: str = "id",
|
|
1588
|
+
detail_foreign_key: str = "master_id",
|
|
1589
|
+
master_title: str = "Maestro",
|
|
1590
|
+
detail_title: str = "Detalle",
|
|
1591
|
+
master_height: float = 240.0,
|
|
1592
|
+
detail_height: float = 220.0,
|
|
1593
|
+
page_size: int | None = 100,
|
|
1594
|
+
virtualized: bool = True,
|
|
1595
|
+
editable: bool = False,
|
|
1596
|
+
master_overrides: Mapping[str, GridColumn] | None = None,
|
|
1597
|
+
detail_overrides: Mapping[str, GridColumn] | None = None,
|
|
1598
|
+
detail_loader: Callable[[dict[str, Any]], Sequence[Sequence[Any]]] | None = None,
|
|
1599
|
+
on_master_select: Callable[[dict[str, Any], list[list[Any]]], None] | None = None,
|
|
1600
|
+
) -> MasterDetail:
|
|
1601
|
+
"""Create a reactive Enterprise Master-Detail ERP layout syncing two `DataGrid`s."""
|
|
1602
|
+
return MasterDetail(
|
|
1603
|
+
master_source,
|
|
1604
|
+
detail_source,
|
|
1605
|
+
master_key=master_key,
|
|
1606
|
+
detail_foreign_key=detail_foreign_key,
|
|
1607
|
+
master_title=master_title,
|
|
1608
|
+
detail_title=detail_title,
|
|
1609
|
+
master_height=master_height,
|
|
1610
|
+
detail_height=detail_height,
|
|
1611
|
+
page_size=page_size,
|
|
1612
|
+
virtualized=virtualized,
|
|
1613
|
+
editable=editable,
|
|
1614
|
+
master_overrides=master_overrides,
|
|
1615
|
+
detail_overrides=detail_overrides,
|
|
1616
|
+
detail_loader=detail_loader,
|
|
1617
|
+
on_master_select=on_master_select,
|
|
1618
|
+
)
|
|
1619
|
+
|
|
1620
|
+
|
|
1621
|
+
def autocomplete(
|
|
1622
|
+
label: str,
|
|
1623
|
+
options: Sequence[str],
|
|
1624
|
+
*,
|
|
1625
|
+
value: str = "",
|
|
1626
|
+
variant: Literal["outlined", "filled"] = "outlined",
|
|
1627
|
+
placeholder: str = "",
|
|
1628
|
+
max_suggestions: int = 6,
|
|
1629
|
+
disabled: bool = False,
|
|
1630
|
+
bind: State[str] | None = None,
|
|
1631
|
+
on_change: Callable[[str], None] | None = None,
|
|
1632
|
+
) -> Autocomplete:
|
|
1633
|
+
return Autocomplete(
|
|
1634
|
+
label,
|
|
1635
|
+
options,
|
|
1636
|
+
value=value,
|
|
1637
|
+
variant=variant,
|
|
1638
|
+
placeholder=placeholder,
|
|
1639
|
+
max_suggestions=max_suggestions,
|
|
1640
|
+
disabled=disabled,
|
|
1641
|
+
bind=bind,
|
|
1642
|
+
on_change=on_change,
|
|
1643
|
+
)
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
def tag_input(
|
|
1647
|
+
label: str = "Etiquetas",
|
|
1648
|
+
*,
|
|
1649
|
+
tags: Sequence[str] = (),
|
|
1650
|
+
placeholder: str = "Escribe y pulsa Enter...",
|
|
1651
|
+
variant: Literal["outlined", "filled"] = "outlined",
|
|
1652
|
+
max_tags: int | None = None,
|
|
1653
|
+
disabled: bool = False,
|
|
1654
|
+
bind: State[list[str]] | None = None,
|
|
1655
|
+
on_change: Callable[[list[str]], None] | None = None,
|
|
1656
|
+
) -> TagInput:
|
|
1657
|
+
return TagInput(
|
|
1658
|
+
label,
|
|
1659
|
+
tags=tags,
|
|
1660
|
+
placeholder=placeholder,
|
|
1661
|
+
variant=variant,
|
|
1662
|
+
max_tags=max_tags,
|
|
1663
|
+
disabled=disabled,
|
|
1664
|
+
bind=bind,
|
|
1665
|
+
on_change=on_change,
|
|
1666
|
+
)
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
def otp_input(
|
|
1670
|
+
*,
|
|
1671
|
+
length: int = 6,
|
|
1672
|
+
value: str = "",
|
|
1673
|
+
password: bool = False,
|
|
1674
|
+
digits_only: bool = True,
|
|
1675
|
+
disabled: bool = False,
|
|
1676
|
+
bind: State[str] | None = None,
|
|
1677
|
+
on_change: Callable[[str], None] | None = None,
|
|
1678
|
+
on_complete: Callable[[str], None] | None = None,
|
|
1679
|
+
) -> OTPInput:
|
|
1680
|
+
return OTPInput(
|
|
1681
|
+
length=length,
|
|
1682
|
+
value=value,
|
|
1683
|
+
password=password,
|
|
1684
|
+
digits_only=digits_only,
|
|
1685
|
+
disabled=disabled,
|
|
1686
|
+
bind=bind,
|
|
1687
|
+
on_change=on_change,
|
|
1688
|
+
on_complete=on_complete,
|
|
1689
|
+
)
|
|
1690
|
+
|
|
1691
|
+
|
|
1692
|
+
def rating(
|
|
1693
|
+
*,
|
|
1694
|
+
value: float = 0.0,
|
|
1695
|
+
max_stars: int = 5,
|
|
1696
|
+
allow_half: bool = False,
|
|
1697
|
+
star_size: float = 28.0,
|
|
1698
|
+
disabled: bool = False,
|
|
1699
|
+
bind: State[float] | None = None,
|
|
1700
|
+
on_change: Callable[[float], None] | None = None,
|
|
1701
|
+
) -> Rating:
|
|
1702
|
+
return Rating(
|
|
1703
|
+
value=value,
|
|
1704
|
+
max_stars=max_stars,
|
|
1705
|
+
allow_half=allow_half,
|
|
1706
|
+
star_size=star_size,
|
|
1707
|
+
disabled=disabled,
|
|
1708
|
+
bind=bind,
|
|
1709
|
+
on_change=on_change,
|
|
1710
|
+
)
|
|
1711
|
+
|
|
1712
|
+
|
|
1713
|
+
def date_range_picker(
|
|
1714
|
+
label: str = "Rango de fechas",
|
|
1715
|
+
*,
|
|
1716
|
+
start: date | None = None,
|
|
1717
|
+
end: date | None = None,
|
|
1718
|
+
variant: Literal["outlined", "filled"] = "outlined",
|
|
1719
|
+
disabled: bool = False,
|
|
1720
|
+
bind: State[tuple[date | None, date | None]] | None = None,
|
|
1721
|
+
on_change: Callable[[tuple[date | None, date | None]], None] | None = None,
|
|
1722
|
+
) -> DateRangePicker:
|
|
1723
|
+
return DateRangePicker(
|
|
1724
|
+
label,
|
|
1725
|
+
start=start,
|
|
1726
|
+
end=end,
|
|
1727
|
+
variant=variant,
|
|
1728
|
+
disabled=disabled,
|
|
1729
|
+
bind=bind,
|
|
1730
|
+
on_change=on_change,
|
|
1731
|
+
)
|
|
1732
|
+
|
|
1733
|
+
|
|
1734
|
+
def drop_zone(
|
|
1735
|
+
title: str = "Haz clic para seleccionar archivos",
|
|
1736
|
+
*,
|
|
1737
|
+
subtitle: str = "PNG, PDF, CSV o XLSX",
|
|
1738
|
+
files: Sequence[str] = (),
|
|
1739
|
+
filetypes: Sequence[tuple[str, str]] = (("Todos los archivos", "*.*"),),
|
|
1740
|
+
multiple: bool = True,
|
|
1741
|
+
disabled: bool = False,
|
|
1742
|
+
bind: State[list[str]] | None = None,
|
|
1743
|
+
on_change: Callable[[list[str]], None] | None = None,
|
|
1744
|
+
) -> DropZone:
|
|
1745
|
+
return DropZone(
|
|
1746
|
+
title,
|
|
1747
|
+
subtitle=subtitle,
|
|
1748
|
+
files=files,
|
|
1749
|
+
filetypes=filetypes,
|
|
1750
|
+
multiple=multiple,
|
|
1751
|
+
disabled=disabled,
|
|
1752
|
+
bind=bind,
|
|
1753
|
+
on_change=on_change,
|
|
1754
|
+
)
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
def signature_pad(
|
|
1758
|
+
*,
|
|
1759
|
+
label: str = "Firma",
|
|
1760
|
+
height: float = 150.0,
|
|
1761
|
+
stroke_width: float = 2.4,
|
|
1762
|
+
disabled: bool = False,
|
|
1763
|
+
on_change: Callable[[], None] | None = None,
|
|
1764
|
+
) -> SignaturePad:
|
|
1765
|
+
return SignaturePad(
|
|
1766
|
+
label=label,
|
|
1767
|
+
height=height,
|
|
1768
|
+
stroke_width=stroke_width,
|
|
1769
|
+
disabled=disabled,
|
|
1770
|
+
on_change=on_change,
|
|
1771
|
+
)
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
def breadcrumbs(
|
|
1775
|
+
items: Sequence[str],
|
|
1776
|
+
*,
|
|
1777
|
+
separator: str = "›",
|
|
1778
|
+
on_select: Callable[[int, str], None] | None = None,
|
|
1779
|
+
) -> Breadcrumbs:
|
|
1780
|
+
return Breadcrumbs(items, separator=separator, on_select=on_select)
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
def stepper(
|
|
1784
|
+
steps: Sequence[str],
|
|
1785
|
+
*,
|
|
1786
|
+
current: int = 0,
|
|
1787
|
+
error_step: int | None = None,
|
|
1788
|
+
clickable: bool = True,
|
|
1789
|
+
bind: State[int] | None = None,
|
|
1790
|
+
on_change: Callable[[int], None] | None = None,
|
|
1791
|
+
) -> Stepper:
|
|
1792
|
+
return Stepper(steps, current=current, error_step=error_step, clickable=clickable, bind=bind, on_change=on_change)
|
|
1793
|
+
|
|
1794
|
+
|
|
1795
|
+
def timeline(items: Sequence[TimelineItem]) -> Timeline:
|
|
1796
|
+
return Timeline(items)
|
|
1797
|
+
|
|
1798
|
+
|
|
1799
|
+
def command_palette(
|
|
1800
|
+
commands: Sequence[CommandItem],
|
|
1801
|
+
*,
|
|
1802
|
+
placeholder: str = "Escribe un comando o busca...",
|
|
1803
|
+
width: float = 520.0,
|
|
1804
|
+
window: Window | None = None,
|
|
1805
|
+
) -> CommandPalette:
|
|
1806
|
+
return CommandPalette(commands, placeholder=placeholder, width=width, window=window)
|
|
1807
|
+
|
|
1808
|
+
|
|
1809
|
+
def calendar_view(
|
|
1810
|
+
events: Sequence[CalendarEvent] = (),
|
|
1811
|
+
*,
|
|
1812
|
+
year: int | None = None,
|
|
1813
|
+
month: int | None = None,
|
|
1814
|
+
height: float = 380.0,
|
|
1815
|
+
on_day_click: Callable[[date], None] | None = None,
|
|
1816
|
+
on_event_click: Callable[[CalendarEvent], None] | None = None,
|
|
1817
|
+
) -> CalendarView:
|
|
1818
|
+
return CalendarView(
|
|
1819
|
+
events,
|
|
1820
|
+
year=year,
|
|
1821
|
+
month=month,
|
|
1822
|
+
height=height,
|
|
1823
|
+
on_day_click=on_day_click,
|
|
1824
|
+
on_event_click=on_event_click,
|
|
1825
|
+
)
|
|
1826
|
+
|
|
1827
|
+
|
|
1828
|
+
def kanban_board(
|
|
1829
|
+
columns: dict[str, list[KanbanCard]],
|
|
1830
|
+
*,
|
|
1831
|
+
height: float = 340.0,
|
|
1832
|
+
on_move: Callable[[KanbanCard, str, str], None] | None = None,
|
|
1833
|
+
) -> KanbanBoard:
|
|
1834
|
+
return KanbanBoard(columns, height=height, on_move=on_move)
|
|
1835
|
+
|
|
1836
|
+
|
|
1837
|
+
def property_grid(
|
|
1838
|
+
items: Sequence[PropertyItem],
|
|
1839
|
+
*,
|
|
1840
|
+
on_change: Callable[[str, Any], None] | None = None,
|
|
1841
|
+
) -> PropertyGrid:
|
|
1842
|
+
return PropertyGrid(items, on_change=on_change)
|
|
1843
|
+
|
|
1844
|
+
|
|
1845
|
+
def alert(
|
|
1846
|
+
title: str,
|
|
1847
|
+
*,
|
|
1848
|
+
message: str = "",
|
|
1849
|
+
severity: AlertSeverity = "info",
|
|
1850
|
+
action_label: str | None = None,
|
|
1851
|
+
on_action: Callable[[], None] | None = None,
|
|
1852
|
+
closable: bool = False,
|
|
1853
|
+
on_close: Callable[[], None] | None = None,
|
|
1854
|
+
) -> Alert:
|
|
1855
|
+
return Alert(
|
|
1856
|
+
title,
|
|
1857
|
+
message=message,
|
|
1858
|
+
severity=severity,
|
|
1859
|
+
action_label=action_label,
|
|
1860
|
+
on_action=on_action,
|
|
1861
|
+
closable=closable,
|
|
1862
|
+
on_close=on_close,
|
|
1863
|
+
)
|
|
1864
|
+
|
|
1865
|
+
|
|
1866
|
+
def avatar(
|
|
1867
|
+
name: str = "",
|
|
1868
|
+
*,
|
|
1869
|
+
image: Any = None,
|
|
1870
|
+
diameter: float = 42.0,
|
|
1871
|
+
status: PresenceStatus | None = None,
|
|
1872
|
+
) -> Avatar:
|
|
1873
|
+
return Avatar(name, image=image, diameter=diameter, status=status)
|
|
1874
|
+
|
|
1875
|
+
|
|
1876
|
+
def avatar_group(
|
|
1877
|
+
names: Sequence[str],
|
|
1878
|
+
*,
|
|
1879
|
+
max_visible: int = 4,
|
|
1880
|
+
diameter: float = 38.0,
|
|
1881
|
+
) -> AvatarGroup:
|
|
1882
|
+
return AvatarGroup(names, max_visible=max_visible, diameter=diameter)
|
|
1883
|
+
|
|
1884
|
+
|
|
1885
|
+
def empty_state(
|
|
1886
|
+
title: str,
|
|
1887
|
+
*,
|
|
1888
|
+
description: str = "",
|
|
1889
|
+
icon: str = "search",
|
|
1890
|
+
action_label: str | None = None,
|
|
1891
|
+
on_action: Callable[[], None] | None = None,
|
|
1892
|
+
) -> EmptyState:
|
|
1893
|
+
return EmptyState(title, description=description, icon=icon, action_label=action_label, on_action=on_action)
|
|
1894
|
+
|
|
1895
|
+
|
|
1896
|
+
def status_bar(
|
|
1897
|
+
left: Sequence[str] = (),
|
|
1898
|
+
*,
|
|
1899
|
+
right: Sequence[str] = (),
|
|
1900
|
+
status_dot: PresenceStatus | None = "online",
|
|
1901
|
+
) -> StatusBar:
|
|
1902
|
+
return StatusBar(left, right=right, status_dot=status_dot)
|
|
1903
|
+
|
|
1904
|
+
|
|
1905
|
+
def carousel(
|
|
1906
|
+
items: Sequence[CarouselItem],
|
|
1907
|
+
*,
|
|
1908
|
+
index: int = 0,
|
|
1909
|
+
height: float = 190.0,
|
|
1910
|
+
on_change: Callable[[int], None] | None = None,
|
|
1911
|
+
) -> Carousel:
|
|
1912
|
+
return Carousel(items, index=index, height=height, on_change=on_change)
|
|
1913
|
+
|
|
1914
|
+
|
|
1915
|
+
def code_block(
|
|
1916
|
+
code: str,
|
|
1917
|
+
*,
|
|
1918
|
+
language: str = "python",
|
|
1919
|
+
show_line_numbers: bool = True,
|
|
1920
|
+
) -> CodeBlock:
|
|
1921
|
+
return CodeBlock(code, language=language, show_line_numbers=show_line_numbers)
|
|
1922
|
+
|
|
1923
|
+
|
|
1924
|
+
def markdown_view(markdown: str) -> MarkdownView:
|
|
1925
|
+
return MarkdownView(markdown)
|
|
1926
|
+
|
|
1927
|
+
|
|
1928
|
+
def vector_canvas(
|
|
1929
|
+
on_draw: Callable[[Any, Any, Theme], None],
|
|
1930
|
+
*,
|
|
1931
|
+
width: float = 420.0,
|
|
1932
|
+
height: float = 200.0,
|
|
1933
|
+
on_click: Callable[[float, float], None] | None = None,
|
|
1934
|
+
) -> VectorCanvas:
|
|
1935
|
+
return VectorCanvas(on_draw, width=width, height=height, on_click=on_click)
|
|
1936
|
+
|
|
1937
|
+
|
|
1938
|
+
def treemap_chart(
|
|
1939
|
+
items: Sequence[tuple[str, float]],
|
|
1940
|
+
*,
|
|
1941
|
+
title: str | None = None,
|
|
1942
|
+
chart_height: float = 230.0,
|
|
1943
|
+
) -> TreemapChart:
|
|
1944
|
+
return TreemapChart(items, title=title, chart_height=chart_height)
|
|
1945
|
+
|
|
1946
|
+
|
|
1947
|
+
def sankey_chart(
|
|
1948
|
+
flows: Sequence[tuple[str, str, float]],
|
|
1949
|
+
*,
|
|
1950
|
+
title: str | None = None,
|
|
1951
|
+
chart_height: float = 230.0,
|
|
1952
|
+
) -> SankeyChart:
|
|
1953
|
+
return SankeyChart(flows, title=title, chart_height=chart_height)
|
|
1954
|
+
|
|
1955
|
+
|
|
1956
|
+
def waterfall_chart(
|
|
1957
|
+
steps: Sequence[tuple[str, float] | tuple[str, float, bool]],
|
|
1958
|
+
*,
|
|
1959
|
+
title: str | None = None,
|
|
1960
|
+
chart_height: float = 230.0,
|
|
1961
|
+
) -> WaterfallChart:
|
|
1962
|
+
return WaterfallChart(steps, title=title, chart_height=chart_height)
|
|
1963
|
+
|
|
1964
|
+
|
|
1965
|
+
def box_plot_chart(
|
|
1966
|
+
series: Sequence[tuple[str, float, float, float, float, float]],
|
|
1967
|
+
*,
|
|
1968
|
+
title: str | None = None,
|
|
1969
|
+
color: ChartColorRole | Color = "primary",
|
|
1970
|
+
chart_height: float = 230.0,
|
|
1971
|
+
) -> BoxPlotChart:
|
|
1972
|
+
return BoxPlotChart(series, title=title, color=color, chart_height=chart_height)
|
|
1973
|
+
|
|
1974
|
+
|
|
1975
|
+
def sparkline(
|
|
1976
|
+
values: Sequence[float],
|
|
1977
|
+
*,
|
|
1978
|
+
color: ChartColorRole | Color = "primary",
|
|
1979
|
+
area: bool = True,
|
|
1980
|
+
width: float = 140.0,
|
|
1981
|
+
height: float = 36.0,
|
|
1982
|
+
) -> Sparkline:
|
|
1983
|
+
return Sparkline(values, color=color, area=area, width=width, height=height)
|
|
1984
|
+
|
|
1985
|
+
|
|
1986
|
+
__all__ = [
|
|
1987
|
+
"Alert",
|
|
1988
|
+
"AuthContext",
|
|
1989
|
+
"Autocomplete",
|
|
1990
|
+
"Avatar",
|
|
1991
|
+
"AvatarGroup",
|
|
1992
|
+
"BoxPlotChart",
|
|
1993
|
+
"Breadcrumbs",
|
|
1994
|
+
"CalendarEvent",
|
|
1995
|
+
"CalendarView",
|
|
1996
|
+
"Carousel",
|
|
1997
|
+
"CarouselItem",
|
|
1998
|
+
"CodeBlock",
|
|
1999
|
+
"Color",
|
|
2000
|
+
"CommandItem",
|
|
2001
|
+
"CommandPalette",
|
|
2002
|
+
"DataGrid",
|
|
2003
|
+
"DateRangePicker",
|
|
2004
|
+
"DrawerItem",
|
|
2005
|
+
"DropZone",
|
|
2006
|
+
"EmptyState",
|
|
2007
|
+
"Form",
|
|
2008
|
+
"GridColumn",
|
|
2009
|
+
"I18n",
|
|
2010
|
+
"KanbanBoard",
|
|
2011
|
+
"KanbanCard",
|
|
2012
|
+
"MarkdownView",
|
|
2013
|
+
"MaskedInput",
|
|
2014
|
+
"MenuItem",
|
|
2015
|
+
"OTPInput",
|
|
2016
|
+
"PreferencesStore",
|
|
2017
|
+
"PropertyGrid",
|
|
2018
|
+
"PropertyItem",
|
|
2019
|
+
"Rating",
|
|
2020
|
+
"Router",
|
|
2021
|
+
"SankeyChart",
|
|
2022
|
+
"ShortcutManager",
|
|
2023
|
+
"SignaturePad",
|
|
2024
|
+
"Sparkline",
|
|
2025
|
+
"State",
|
|
2026
|
+
"StatusBar",
|
|
2027
|
+
"Stepper",
|
|
2028
|
+
"TagInput",
|
|
2029
|
+
"Theme",
|
|
2030
|
+
"Timeline",
|
|
2031
|
+
"TimelineItem",
|
|
2032
|
+
"TreeNode",
|
|
2033
|
+
"TreemapChart",
|
|
2034
|
+
"Validators",
|
|
2035
|
+
"VectorCanvas",
|
|
2036
|
+
"WaterfallChart",
|
|
2037
|
+
"alert",
|
|
2038
|
+
"auth",
|
|
2039
|
+
"autocomplete",
|
|
2040
|
+
"avatar",
|
|
2041
|
+
"avatar_group",
|
|
2042
|
+
"background",
|
|
2043
|
+
"badge",
|
|
2044
|
+
"bar_chart",
|
|
2045
|
+
"bottom_sheet",
|
|
2046
|
+
"box_plot_chart",
|
|
2047
|
+
"breadcrumbs",
|
|
2048
|
+
"button",
|
|
2049
|
+
"calendar_view",
|
|
2050
|
+
"call_later",
|
|
2051
|
+
"candlestick_chart",
|
|
2052
|
+
"card",
|
|
2053
|
+
"carousel",
|
|
2054
|
+
"checkbox",
|
|
2055
|
+
"chip",
|
|
2056
|
+
"code_block",
|
|
2057
|
+
"color_picker",
|
|
2058
|
+
"column",
|
|
2059
|
+
"command_palette",
|
|
2060
|
+
"data_grid",
|
|
2061
|
+
"data_table",
|
|
2062
|
+
"date_picker",
|
|
2063
|
+
"date_range_picker",
|
|
2064
|
+
"default_auth",
|
|
2065
|
+
"dialog",
|
|
2066
|
+
"divider",
|
|
2067
|
+
"donut_chart",
|
|
2068
|
+
"drop_zone",
|
|
2069
|
+
"empty_state",
|
|
2070
|
+
"expansion_panel",
|
|
2071
|
+
"export_pdf",
|
|
2072
|
+
"fab",
|
|
2073
|
+
"file_picker",
|
|
2074
|
+
"form",
|
|
2075
|
+
"funnel_chart",
|
|
2076
|
+
"gantt_chart",
|
|
2077
|
+
"gauge_chart",
|
|
2078
|
+
"grid",
|
|
2079
|
+
"grid_column",
|
|
2080
|
+
"heatmap",
|
|
2081
|
+
"horizontal_bar_chart",
|
|
2082
|
+
"i18n",
|
|
2083
|
+
"icon_button",
|
|
2084
|
+
"image",
|
|
2085
|
+
"kanban_board",
|
|
2086
|
+
"kpi_card",
|
|
2087
|
+
"line_chart",
|
|
2088
|
+
"list_item",
|
|
2089
|
+
"list_view",
|
|
2090
|
+
"load_font",
|
|
2091
|
+
"markdown_view",
|
|
2092
|
+
"masked_input",
|
|
2093
|
+
"menu",
|
|
2094
|
+
"multi_line_chart",
|
|
2095
|
+
"navigation_bar",
|
|
2096
|
+
"navigation_drawer",
|
|
2097
|
+
"navigation_rail",
|
|
2098
|
+
"number_input",
|
|
2099
|
+
"otp_input",
|
|
2100
|
+
"pagination",
|
|
2101
|
+
"preferences",
|
|
2102
|
+
"progress",
|
|
2103
|
+
"property_grid",
|
|
2104
|
+
"radar_chart",
|
|
2105
|
+
"radio_group",
|
|
2106
|
+
"range_slider",
|
|
2107
|
+
"rating",
|
|
2108
|
+
"router",
|
|
2109
|
+
"row",
|
|
2110
|
+
"run",
|
|
2111
|
+
"sankey_chart",
|
|
2112
|
+
"scatter_chart",
|
|
2113
|
+
"scroll_view",
|
|
2114
|
+
"search_bar",
|
|
2115
|
+
"segmented_button",
|
|
2116
|
+
"select",
|
|
2117
|
+
"signature_pad",
|
|
2118
|
+
"skeleton",
|
|
2119
|
+
"slider",
|
|
2120
|
+
"snackbar",
|
|
2121
|
+
"sparkline",
|
|
2122
|
+
"split_view",
|
|
2123
|
+
"state",
|
|
2124
|
+
"status_bar",
|
|
2125
|
+
"stepper",
|
|
2126
|
+
"switch",
|
|
2127
|
+
"table_column",
|
|
2128
|
+
"tabs",
|
|
2129
|
+
"tag_input",
|
|
2130
|
+
"text",
|
|
2131
|
+
"text_area",
|
|
2132
|
+
"text_field",
|
|
2133
|
+
"time_picker",
|
|
2134
|
+
"timeline",
|
|
2135
|
+
"top_app_bar",
|
|
2136
|
+
"tree_view",
|
|
2137
|
+
"treemap_chart",
|
|
2138
|
+
"validators",
|
|
2139
|
+
"vector_canvas",
|
|
2140
|
+
"waterfall_chart",
|
|
2141
|
+
"window",
|
|
2142
|
+
]
|