ex4nicegui 0.2.2__py3-none-any.whl → 0.2.3__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.
ex4nicegui/__init__.py CHANGED
@@ -15,4 +15,4 @@ from ex4nicegui import tools
15
15
  from signe import batch
16
16
 
17
17
 
18
- __version__ = "0.2.2"
18
+ __version__ = "0.2.3"
@@ -26,6 +26,7 @@ from .officials import (
26
26
  UploadBindableUi as upload,
27
27
  UploadResult,
28
28
  DrawerBindableUi as drawer,
29
+ DateBindableUi as date,
29
30
  )
30
31
  from .q_pagination import QPagination as q_pagination
31
32
  from .local_file_picker import local_file_picker
@@ -83,6 +83,10 @@ class BindableUi(Generic[TWidget]):
83
83
  cast(ui.element, self.element).tailwind(*args)
84
84
  return self
85
85
 
86
+ def tooltip(self, text: str) -> Self:
87
+ cast(ui.element, self.element).tooltip(text)
88
+ return self
89
+
86
90
  def add_slot(self, name: str, template: Optional[str] = None):
87
91
  """Add a slot to the element.
88
92
 
@@ -138,6 +142,9 @@ class BindableUi(Generic[TWidget]):
138
142
 
139
143
  return self
140
144
 
145
+ def clear(self) -> None:
146
+ cast(ui.element, self.element).clear()
147
+
141
148
 
142
149
  class SingleValueBindableUi(BindableUi[TWidget], Generic[T, TWidget]):
143
150
  def __init__(self, value: TMaybeRef[T], element: TWidget) -> None:
@@ -350,7 +357,7 @@ class SwitchBindableUi(SingleValueBindableUi[bool, ui.switch]):
350
357
  def _():
351
358
  ele.value = binder.value
352
359
 
353
- ele.on("update:modelValue", onValueChanged, [None], throttle=0)
360
+ ele.on("update:modelValue", onValueChanged, [None], throttle=0) # type: ignore
354
361
 
355
362
  def __init__(
356
363
  self,
@@ -436,6 +443,58 @@ class CheckboxBindableUi(SingleValueBindableUi[bool, ui.checkbox]):
436
443
  return self
437
444
 
438
445
 
446
+ class DateBindableUi(SingleValueBindableUi[Optional[str], ui.date]):
447
+ def __init__(
448
+ self,
449
+ value: TMaybeRef[Optional[str]] = None,
450
+ *,
451
+ mask: TMaybeRef[str] = "YYYY-MM-DD",
452
+ on_change: Optional[Callable[..., Any]] = None,
453
+ ) -> None:
454
+ kws = {
455
+ "value": value,
456
+ "mask": mask,
457
+ "on_change": on_change,
458
+ }
459
+
460
+ value_kws = _convert_kws_ref2value(kws)
461
+
462
+ element = ui.date(**value_kws)
463
+
464
+ super().__init__(value, element)
465
+
466
+ for key, value in kws.items():
467
+ if is_ref(value) and key != "value":
468
+ self.bind_prop(key, value) # type: ignore
469
+
470
+ self._ex_setup()
471
+
472
+ def _ex_setup(self):
473
+ ele = self.element
474
+
475
+ @effect
476
+ def _():
477
+ ele.value = self.value
478
+
479
+ def onModelValueChanged(e):
480
+ self._ref.value = e.args[0] or "" # type: ignore
481
+
482
+ ele.on("update:modelValue", handler=onModelValueChanged)
483
+
484
+ def bind_prop(self, prop: str, ref_ui: ReadonlyRef):
485
+ if prop == "value":
486
+ return self.bind_value(ref_ui)
487
+
488
+ return super().bind_prop(prop, ref_ui)
489
+
490
+ def bind_value(self, ref_ui: ReadonlyRef[bool]):
491
+ @effect
492
+ def _():
493
+ self.element.on_value_change(ref_ui.value)
494
+
495
+ return self
496
+
497
+
439
498
  class InputBindableUi(SingleValueBindableUi[str, ui.input]):
440
499
  def __init__(
441
500
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ex4nicegui
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: ...
5
5
  Home-page:
6
6
  Author: carson_jia
@@ -1,11 +1,11 @@
1
- ex4nicegui/__init__.py,sha256=UXxvXxPADYBauDsMFuUEsJ8iL7v6kZlDC6WNLPmzA1A,337
1
+ ex4nicegui/__init__.py,sha256=py2OXo1AKB2pADiIfSBzsduHaYyDz55ByuxPDDlX3vE,337
2
2
  ex4nicegui/layout/__init__.py,sha256=YoqBfyScFcWBw8EA77HygHMEc1O5AoQuOHLi6GcXtos,31
3
3
  ex4nicegui/layout/gridbox.py,sha256=SWxh62B3q_VrCUNOuVdS1h2SO0zaJy5HFNk1WPNVzAs,2378
4
- ex4nicegui/reactive/__index.py,sha256=S9ws3zkHwtNCsibFvhlK4qqT_xzn_Ym5a3_Ty4dRNDk,1340
4
+ ex4nicegui/reactive/__index.py,sha256=yX7FIlYCaXJz2qaZjcMoOhKsXche3I7kKDPPe0_x3mg,1369
5
5
  ex4nicegui/reactive/__init__.py,sha256=NZUgvItxqqgzHKrt4oGZnxxV9dlEudGiv4J3fhJdvdQ,24
6
6
  ex4nicegui/reactive/drawer.py,sha256=NWMq2gnalpYAU8tT0DwGN5l8n7fuMxTIWxOfr2QvFIA,1356
7
7
  ex4nicegui/reactive/local_file_picker.py,sha256=DWNzm_IP02sY-nZWN6WEWJxlwpABW6tNLZ7HA9E88B4,6093
8
- ex4nicegui/reactive/officials.py,sha256=dWcybZqT6Vsf98HcHW-XDszL6MHj_642wPzAjQXXM1E,41993
8
+ ex4nicegui/reactive/officials.py,sha256=y6M2dj6KcSOl7n09lFx9Igtl3PtC4z4_KP9-po93qGk,43587
9
9
  ex4nicegui/reactive/q_pagination.py,sha256=ITXBrjLnI1a5bz3Rbn7j8lZs9UJaFuMHrM9_FW_V7NA,1217
10
10
  ex4nicegui/reactive/rxui.py,sha256=NZUgvItxqqgzHKrt4oGZnxxV9dlEudGiv4J3fhJdvdQ,24
11
11
  ex4nicegui/reactive/usePagination.py,sha256=IP1NeLxaH3413KTEjtbyuzq0FVdtnKQsTZqM-W7iEgY,2468
@@ -23,11 +23,11 @@ ex4nicegui/tools/debug.py,sha256=HCKlVzhHx5av-983ADgwgMkScKwTreSluLA7uikGYa0,488
23
23
  ex4nicegui/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  ex4nicegui/utils/common.py,sha256=5fsaOkoj-Ild1LGsInZXra66gJLVoVcZGAIG6YOeM6E,430
25
25
  ex4nicegui/utils/signals.py,sha256=Dwvb0Anansa0N1ZH2Ko0yCX9o-QHKbXOYEtvdrtde9g,4807
26
- ex4nicegui-0.2.2.data/data/ECharts/ECharts.js,sha256=ndIGgYm2dztdexPTVX3Eu7NP8pHIO_kcaNpGV861N_k,1581614
27
- ex4nicegui-0.2.2.data/data/UseDraggable/UseDraggable.js,sha256=ogP12fzt-8AHQq1WePA7CzyLvfz2yINTug9rKdTPChw,4857
28
- ex4nicegui-0.2.2.data/data/useMouse/UseMouse.js,sha256=6FjcYozJK5zFwK1kBP8JlfMyTUwKVK3k_0wSdhapaZs,2722
29
- ex4nicegui-0.2.2.dist-info/LICENSE,sha256=0KDDElS2dl-HIsWvbpy8ywbLzJMBFzXLev57LnMIZXs,1094
30
- ex4nicegui-0.2.2.dist-info/METADATA,sha256=mpxcEViKgbYmYP6aoHBS_LWvyomNy-hR6VnUOp3G7Zo,583
31
- ex4nicegui-0.2.2.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
32
- ex4nicegui-0.2.2.dist-info/top_level.txt,sha256=VFwMiO9AFjj5rfLMJwN1ipLRASk9fJXB8tM6DNrpvPQ,11
33
- ex4nicegui-0.2.2.dist-info/RECORD,,
26
+ ex4nicegui-0.2.3.data/data/ECharts/ECharts.js,sha256=ndIGgYm2dztdexPTVX3Eu7NP8pHIO_kcaNpGV861N_k,1581614
27
+ ex4nicegui-0.2.3.data/data/UseDraggable/UseDraggable.js,sha256=ogP12fzt-8AHQq1WePA7CzyLvfz2yINTug9rKdTPChw,4857
28
+ ex4nicegui-0.2.3.data/data/useMouse/UseMouse.js,sha256=6FjcYozJK5zFwK1kBP8JlfMyTUwKVK3k_0wSdhapaZs,2722
29
+ ex4nicegui-0.2.3.dist-info/LICENSE,sha256=0KDDElS2dl-HIsWvbpy8ywbLzJMBFzXLev57LnMIZXs,1094
30
+ ex4nicegui-0.2.3.dist-info/METADATA,sha256=ydzWguup-9thrOK3rmPKTb6sIo1ZoMzHqI32i9FqqjU,583
31
+ ex4nicegui-0.2.3.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
32
+ ex4nicegui-0.2.3.dist-info/top_level.txt,sha256=VFwMiO9AFjj5rfLMJwN1ipLRASk9fJXB8tM6DNrpvPQ,11
33
+ ex4nicegui-0.2.3.dist-info/RECORD,,