Преглед на файлове

#107: extending properties of upstream quasar components linear & circular progress

Hannes Römer преди 2 години
родител
ревизия
fb15587d45
променени са 2 файла, в които са добавени 26 реда и са изтрити 9 реда
  1. 8 9
      nicegui/elements/progress.py
  2. 18 0
      nicegui/elements/quasarcommponents.py

+ 8 - 9
nicegui/elements/progress.py

@@ -1,6 +1,5 @@
-import justpy as jp
-
 from .float_element import FloatElement
+from .quasarcommponents import QLinearProgressExtended, QCircularProgressExtended
 from ..auto_context import ContextMixin
 
 
@@ -10,13 +9,13 @@ class LinearProgress(FloatElement, ContextMixin):
         """LinearProgress
 
         An element to create a linear progress bar wrapping
-        `Linear Progress <https://quasar.dev/vue-components/linear-progress>`_ component.
+        `Linear Progress <https://v1.quasar.dev/vue-components/linear-progress>`_ component.
 
         :param value: the initial value of the field
         :param target_object: the object to data bind to
         :param target_name: the field name of the data bound object
         """
-        view = jp.QLinearProgress(color='primary', style="height: 6em;", value=value, temp=False)
+        view = QLinearProgressExtended(color='primary', size='1.4rem', value=value, temp=False)
         super().__init__(view, value=value, on_change=None, **kwargs)
         if target_object and target_name:
             self.bind_value_from(target_object=target_object, target_name=target_name)
@@ -29,16 +28,16 @@ class CircularProgress(FloatElement, ContextMixin):
         """CircularProgress
 
         An element to create a linear progress bar wrapping
-        `Circular Progress <https://quasar.dev/vue-components/circular-progress>`_ component.
+        `Circular Progress <https://v1.quasar.dev/vue-components/circular-progress>`_ component.
 
         :param value: the initial value of the field
         :param target_object: the object to data bind to
         :param target_name: the field name of the data bound object
         """
-        view = jp.QCircularProgress(color='primary', value=value, temp=False,
-                                    track_color='grey-4',
-                                    center_color='transparent',
-                                    size='xl', show_value=show_value)
+        view = QCircularProgressExtended(color='primary', value=value, temp=False,
+                                         track_color='grey-4',
+                                         center_color='transparent',
+                                         size='xl', show_value=show_value)
         super().__init__(view, value=value, on_change=None, **kwargs)
         if target_object and target_name:
             self.bind_value_from(target_object=target_object, target_name=target_name)

+ 18 - 0
nicegui/elements/quasarcommponents.py

@@ -0,0 +1,18 @@
+from justpy import parse_dict, QCircularProgress, QLinearProgress
+
+
+@parse_dict
+class QCircularProgressExtended(QCircularProgress):
+
+    def __init__(self, **kwargs):
+        super().__init__(**kwargs)
+        self.prop_list.extend(['instant-feedback'])
+
+
+@parse_dict
+class QLinearProgressExtended(QLinearProgress):
+
+    def __init__(self, **kwargs):
+        super().__init__(**kwargs)
+        # add upstream missing properties
+        self.prop_list.extend(['size'])