custom serializer for data editor props
This commit is contained in:
parent
b10cab04cb
commit
70b76fea21
@ -7,6 +7,7 @@ from reflex.base import Base
|
||||
from reflex.components.component import Component, NoSSRComponent
|
||||
from reflex.components.literals import LiteralRowMarker
|
||||
from reflex.utils import console, format, imports, types
|
||||
from reflex.utils.serializers import serializer
|
||||
from reflex.vars import ImportVar, Var, get_unique_variable_name
|
||||
|
||||
LiteralDataEditorGridColumnIcons = Literal[
|
||||
@ -408,3 +409,16 @@ class DataEditor(NoSSRComponent):
|
||||
|
||||
# except ImportError:
|
||||
# pass
|
||||
|
||||
|
||||
@serializer
|
||||
def serialize_data_editor_prop(prop: DataEditorProp) -> dict:
|
||||
"""The serializer for the data editor theme.
|
||||
|
||||
Args:
|
||||
prop: The prop to serialize.
|
||||
|
||||
Returns:
|
||||
The serialized prop.
|
||||
"""
|
||||
return prop.dict()
|
||||
|
@ -153,7 +153,7 @@ def serialize_primitive(value: Union[bool, int, float, None]) -> str:
|
||||
|
||||
|
||||
@serializer
|
||||
def serialize_base(value: Base) -> dict:
|
||||
def serialize_base(value: Base) -> str:
|
||||
"""Serialize a Base instance.
|
||||
|
||||
Args:
|
||||
@ -162,7 +162,7 @@ def serialize_base(value: Base) -> dict:
|
||||
Returns:
|
||||
The serialized Base.
|
||||
"""
|
||||
return value.dict()
|
||||
return value.json()
|
||||
|
||||
|
||||
@serializer
|
||||
|
Loading…
Reference in New Issue
Block a user