Skip to content

Commit

Permalink
Add _input_property to private form models to make them work in controls
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschulz-COL committed Nov 29, 2024
1 parent e4728c4 commit abf149d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions vizro-core/src/vizro/models/_components/form/_text_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from dash import html

try:
from pydantic.v1 import Field
from pydantic.v1 import Field, PrivateAttr
except ImportError: # pragma: no cov
from pydantic import Field
from pydantic import Field, PrivateAttr

from vizro.models import Action, VizroBaseModel
from vizro.models._action._actions_chain import _action_validator_factory
Expand All @@ -32,6 +32,9 @@ class TextArea(VizroBaseModel):
placeholder: str = Field("", description="Default text to display in input field")
actions: list[Action] = []

# Component properties for actions and interactions
_input_property: str = PrivateAttr("value")

# Re-used validators
# TODO: Before making public, consider how actions should be triggered and what the default property should be
# See comment thread: https://github.com/mckinsey/vizro/pull/298#discussion_r1478137654
Expand Down
7 changes: 5 additions & 2 deletions vizro-core/src/vizro/models/_components/form/_user_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from dash import html

try:
from pydantic.v1 import Field
from pydantic.v1 import Field, PrivateAttr
except ImportError: # pragma: no cov
from pydantic import Field
from pydantic import Field, PrivateAttr

from vizro.models import Action, VizroBaseModel
from vizro.models._action._actions_chain import _action_validator_factory
Expand All @@ -32,6 +32,9 @@ class UserInput(VizroBaseModel):
placeholder: str = Field("", description="Default text to display in input field")
actions: list[Action] = []

# Component properties for actions and interactions
_input_property: str = PrivateAttr("value")

# Re-used validators
# TODO: Before making public, consider how actions should be triggered and what the default property should be
# See comment thread: https://github.com/mckinsey/vizro/pull/298#discussion_r1478137654
Expand Down

0 comments on commit abf149d

Please sign in to comment.