reacton 1.2.0__tar.gz → 1.2.1__tar.gz
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.
- {reacton-1.2.0 → reacton-1.2.1}/PKG-INFO +1 -1
- reacton-1.2.1/reacton/_version.py +1 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/core.py +10 -3
- {reacton-1.2.0 → reacton-1.2.1}/reacton/core_test.py +6 -2
- reacton-1.2.0/reacton/_version.py +0 -1
- {reacton-1.2.0 → reacton-1.2.1}/.gitignore +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/LICENSE +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/pyproject.toml +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/react_ipywidgets/__init__.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/react_ipywidgets/core.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/__init__.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/bqplot.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/find.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/find_test.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/generate.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/generate_test.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/ipycanvas.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/ipyvue.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/ipyvuetify.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/ipywidgets.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/logging.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/patch.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/patch_display.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/py.typed +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/rx.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/test.vue +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/test_rx.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/utils.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/utils_test.py +0 -0
- {reacton-1.2.0 → reacton-1.2.1}/reacton/work.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.2.1"
|
|
@@ -535,7 +535,8 @@ class ComponentFunction(Component):
|
|
|
535
535
|
return self.widget_class()(**kwargs)
|
|
536
536
|
|
|
537
537
|
def widget_class(self):
|
|
538
|
-
|
|
538
|
+
parameters = inspect.signature(self.f).parameters
|
|
539
|
+
args = list(parameters.keys())
|
|
539
540
|
listeners = set()
|
|
540
541
|
normal_kwargs = set()
|
|
541
542
|
for name in args:
|
|
@@ -554,7 +555,12 @@ class ComponentFunction(Component):
|
|
|
554
555
|
traits = {}
|
|
555
556
|
|
|
556
557
|
for name in normal_kwargs:
|
|
557
|
-
|
|
558
|
+
if name != "children": # children is a special trait we keep
|
|
559
|
+
if name in normal_kwargs:
|
|
560
|
+
trait = traitlets.Any(default_value=parameters[name].default)
|
|
561
|
+
else:
|
|
562
|
+
trait = traitlets.Any()
|
|
563
|
+
traits[name] = trait
|
|
558
564
|
Container.add_traits(self, **traits)
|
|
559
565
|
for name, value in kwargs.items():
|
|
560
566
|
if name in normal_kwargs:
|
|
@@ -568,7 +574,8 @@ class ComponentFunction(Component):
|
|
|
568
574
|
def _create_el(self):
|
|
569
575
|
kwargs = {}
|
|
570
576
|
for name in normal_kwargs:
|
|
571
|
-
|
|
577
|
+
if name != "children":
|
|
578
|
+
kwargs[name] = getattr(self, name)
|
|
572
579
|
for name in listeners:
|
|
573
580
|
propname = name[3:]
|
|
574
581
|
|
|
@@ -2724,13 +2724,17 @@ def test_implicit_component():
|
|
|
2724
2724
|
|
|
2725
2725
|
def test_create_widget():
|
|
2726
2726
|
@react.component
|
|
2727
|
-
def Test(a: int = 1, label="lala", on_a=None):
|
|
2727
|
+
def Test(a: int = 1, label="lala", on_a=None, children=[]):
|
|
2728
|
+
# adding children shouldn't change the children trait
|
|
2729
|
+
assert children == []
|
|
2728
2730
|
return w.IntSlider(value=a, on_value=on_a, description=label)
|
|
2729
2731
|
|
|
2730
|
-
widget: widgets.Widget = Test.widget(a=1
|
|
2732
|
+
widget: widgets.Widget = Test.widget(a=1) # type: ignore
|
|
2733
|
+
assert widget.trait_metadata("children", "to_json") is not None
|
|
2731
2734
|
mock = unittest.mock.Mock()
|
|
2732
2735
|
widget.trait_names() == ["a", "label"]
|
|
2733
2736
|
widget.observe(mock, "a")
|
|
2737
|
+
assert widget.label == "lala"
|
|
2734
2738
|
widget.a = 2
|
|
2735
2739
|
mock.assert_called_once_with({"name": "a", "old": 1, "new": 2, "owner": widget, "type": "change"})
|
|
2736
2740
|
slider = widget.children[0]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.2.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|