merging
This commit is contained in:
commit
086f273991
@ -257,15 +257,39 @@ class Cartesian(Recharts):
|
||||
# The key of a group of data which should be unique in an area chart.
|
||||
data_key: Var[Union[str, int]]
|
||||
|
||||
# The id of x-axis which is corresponding to the data.
|
||||
# The id of x-axis which is corresponding to the data. Default: 0
|
||||
x_axis_id: Var[Union[str, int]]
|
||||
|
||||
# The id of y-axis which is corresponding to the data.
|
||||
# The id of y-axis which is corresponding to the data. Default: 0
|
||||
y_axis_id: Var[Union[str, int]]
|
||||
|
||||
# The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional
|
||||
legend_type: Var[LiteralLegendType]
|
||||
|
||||
# If set false, animation of bar will be disabled. Default: True
|
||||
is_animation_active: Var[bool]
|
||||
|
||||
# Specifies when the animation should begin, the unit of this option is ms. Default: 0
|
||||
animation_begin: Var[int]
|
||||
|
||||
# Specifies the duration of animation, the unit of this option is ms. Default: 1500
|
||||
animation_duration: Var[int]
|
||||
|
||||
# The type of easing function. Default: "ease"
|
||||
animation_easing: Var[LiteralAnimationEasing]
|
||||
|
||||
# The unit of data. This option will be used in tooltip.
|
||||
unit: Var[Union[str, int]]
|
||||
|
||||
# The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
|
||||
name: Var[Union[str, int]]
|
||||
|
||||
# The customized event handler of animation start
|
||||
on_animation_start: EventHandler[lambda: []]
|
||||
|
||||
# The customized event handler of animation end
|
||||
on_animation_end: EventHandler[lambda: []]
|
||||
|
||||
# The customized event handler of click on the component in this group
|
||||
on_click: EventHandler[empty_event]
|
||||
|
||||
@ -528,30 +552,33 @@ class Funnel(Recharts):
|
||||
# The source data, in which each element is an object.
|
||||
data: Var[List[Dict[str, Any]]]
|
||||
|
||||
# The key of a group of data which should be unique in an area chart.
|
||||
# The key or getter of a group of data which should be unique in a FunnelChart.
|
||||
data_key: Var[Union[str, int]]
|
||||
|
||||
# The key or getter of a group of data which should be unique in a LineChart.
|
||||
# The key of each sector's name. Default: "name"
|
||||
name_key: Var[str]
|
||||
|
||||
# The type of icon in legend. If set to 'none', no legend item will be rendered.
|
||||
# The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "line"
|
||||
legend_type: Var[LiteralLegendType]
|
||||
|
||||
# If set false, animation of line will be disabled.
|
||||
# If set false, animation of line will be disabled. Default: True
|
||||
is_animation_active: Var[bool]
|
||||
|
||||
# Specifies when the animation should begin, the unit of this option is ms.
|
||||
# Specifies when the animation should begin, the unit of this option is ms. Default: 0
|
||||
animation_begin: Var[int]
|
||||
|
||||
# Specifies the duration of animation, the unit of this option is ms.
|
||||
# Specifies the duration of animation, the unit of this option is ms. Default: 1500
|
||||
animation_duration: Var[int]
|
||||
|
||||
# The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'
|
||||
# The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default "ease"
|
||||
animation_easing: Var[LiteralAnimationEasing]
|
||||
|
||||
# stroke color
|
||||
# Stroke color. Default: rx.color("gray", 3)
|
||||
stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 3))
|
||||
|
||||
# The coordinates of all the trapezoids in the funnel, usually calculated internally.
|
||||
trapezoids: Var[List[Dict[str, Any]]]
|
||||
|
||||
# Valid children components
|
||||
_valid_children: List[str] = ["LabelList", "Cell"]
|
||||
|
||||
@ -593,20 +620,20 @@ class ErrorBar(Recharts):
|
||||
|
||||
alias = "RechartsErrorBar"
|
||||
|
||||
# The direction of error bar. 'x' | 'y' | 'both'
|
||||
# Only used for ScatterChart with error bars in two directions. Only accepts a value of "x" or "y" and makes the error bars lie in that direction.
|
||||
direction: Var[LiteralDirection]
|
||||
|
||||
# The key of a group of data which should be unique in an area chart.
|
||||
data_key: Var[Union[str, int]]
|
||||
|
||||
# The width of the error bar ends.
|
||||
# The width of the error bar ends. Default: 5
|
||||
width: Var[int]
|
||||
|
||||
# The stroke color of error bar.
|
||||
# The stroke color of error bar. Default: rx.color("gray", 8)
|
||||
stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 8))
|
||||
|
||||
# The stroke width of error bar.
|
||||
stroke_width: Var[int]
|
||||
# The stroke width of error bar. Default: 1.5
|
||||
stroke_width: Var[Union[int, float]]
|
||||
|
||||
|
||||
class Reference(Recharts):
|
||||
@ -751,16 +778,16 @@ class ReferenceArea(Recharts):
|
||||
class Grid(Recharts):
|
||||
"""A base class for grid components in Recharts."""
|
||||
|
||||
# The x-coordinate of grid.
|
||||
# The x-coordinate of grid. Default: 0
|
||||
x: Var[int]
|
||||
|
||||
# The y-coordinate of grid.
|
||||
# The y-coordinate of grid. Default: 0
|
||||
y: Var[int]
|
||||
|
||||
# The width of grid.
|
||||
# The width of grid. Default: 0
|
||||
width: Var[int]
|
||||
|
||||
# The height of grid.
|
||||
# The height of grid. Default: 0
|
||||
height: Var[int]
|
||||
|
||||
|
||||
|
@ -95,18 +95,18 @@ class Axis(Recharts):
|
||||
autofocus: Optional[bool] = None,
|
||||
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
||||
on_blur: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[()]] = None,
|
||||
on_context_menu: Optional[EventType[[]]] = None,
|
||||
on_double_click: Optional[EventType[[]]] = None,
|
||||
on_focus: Optional[EventType[[]]] = None,
|
||||
on_mount: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[[]]] = None,
|
||||
on_mouse_enter: Optional[EventType[[]]] = None,
|
||||
on_mouse_leave: Optional[EventType[[]]] = None,
|
||||
on_mouse_move: Optional[EventType[[]]] = None,
|
||||
on_mouse_out: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[()]] = None,
|
||||
on_mouse_enter: Optional[EventType[()]] = None,
|
||||
on_mouse_leave: Optional[EventType[()]] = None,
|
||||
on_mouse_move: Optional[EventType[()]] = None,
|
||||
on_mouse_out: Optional[EventType[()]] = None,
|
||||
on_mouse_over: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[()]] = None,
|
||||
on_scroll: Optional[EventType[[]]] = None,
|
||||
on_unmount: Optional[EventType[[]]] = None,
|
||||
**props,
|
||||
@ -239,18 +239,18 @@ class XAxis(Axis):
|
||||
autofocus: Optional[bool] = None,
|
||||
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
||||
on_blur: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[()]] = None,
|
||||
on_context_menu: Optional[EventType[[]]] = None,
|
||||
on_double_click: Optional[EventType[[]]] = None,
|
||||
on_focus: Optional[EventType[[]]] = None,
|
||||
on_mount: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[[]]] = None,
|
||||
on_mouse_enter: Optional[EventType[[]]] = None,
|
||||
on_mouse_leave: Optional[EventType[[]]] = None,
|
||||
on_mouse_move: Optional[EventType[[]]] = None,
|
||||
on_mouse_out: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[()]] = None,
|
||||
on_mouse_enter: Optional[EventType[()]] = None,
|
||||
on_mouse_leave: Optional[EventType[()]] = None,
|
||||
on_mouse_move: Optional[EventType[()]] = None,
|
||||
on_mouse_out: Optional[EventType[()]] = None,
|
||||
on_mouse_over: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[()]] = None,
|
||||
on_scroll: Optional[EventType[[]]] = None,
|
||||
on_unmount: Optional[EventType[[]]] = None,
|
||||
**props,
|
||||
@ -386,18 +386,18 @@ class YAxis(Axis):
|
||||
autofocus: Optional[bool] = None,
|
||||
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
||||
on_blur: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[()]] = None,
|
||||
on_context_menu: Optional[EventType[[]]] = None,
|
||||
on_double_click: Optional[EventType[[]]] = None,
|
||||
on_focus: Optional[EventType[[]]] = None,
|
||||
on_mount: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[[]]] = None,
|
||||
on_mouse_enter: Optional[EventType[[]]] = None,
|
||||
on_mouse_leave: Optional[EventType[[]]] = None,
|
||||
on_mouse_move: Optional[EventType[[]]] = None,
|
||||
on_mouse_out: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[()]] = None,
|
||||
on_mouse_enter: Optional[EventType[()]] = None,
|
||||
on_mouse_leave: Optional[EventType[()]] = None,
|
||||
on_mouse_move: Optional[EventType[()]] = None,
|
||||
on_mouse_out: Optional[EventType[()]] = None,
|
||||
on_mouse_over: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[()]] = None,
|
||||
on_scroll: Optional[EventType[[]]] = None,
|
||||
on_unmount: Optional[EventType[[]]] = None,
|
||||
**props,
|
||||
@ -646,25 +646,38 @@ class Cartesian(Recharts):
|
||||
],
|
||||
]
|
||||
] = None,
|
||||
is_animation_active: Optional[Union[Var[bool], bool]] = None,
|
||||
animation_begin: Optional[Union[Var[int], int]] = None,
|
||||
animation_duration: Optional[Union[Var[int], int]] = None,
|
||||
animation_easing: Optional[
|
||||
Union[
|
||||
Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"],
|
||||
Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]],
|
||||
]
|
||||
] = None,
|
||||
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||
style: Optional[Style] = None,
|
||||
key: Optional[Any] = None,
|
||||
id: Optional[Any] = None,
|
||||
class_name: Optional[Any] = None,
|
||||
autofocus: Optional[bool] = None,
|
||||
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
||||
on_animation_end: Optional[EventType[[]]] = None,
|
||||
on_animation_start: Optional[EventType[[]]] = None,
|
||||
on_blur: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[()]] = None,
|
||||
on_context_menu: Optional[EventType[[]]] = None,
|
||||
on_double_click: Optional[EventType[[]]] = None,
|
||||
on_focus: Optional[EventType[[]]] = None,
|
||||
on_mount: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[[]]] = None,
|
||||
on_mouse_enter: Optional[EventType[[]]] = None,
|
||||
on_mouse_leave: Optional[EventType[[]]] = None,
|
||||
on_mouse_move: Optional[EventType[[]]] = None,
|
||||
on_mouse_out: Optional[EventType[[]]] = None,
|
||||
on_mouse_over: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[()]] = None,
|
||||
on_mouse_enter: Optional[EventType[()]] = None,
|
||||
on_mouse_leave: Optional[EventType[()]] = None,
|
||||
on_mouse_move: Optional[EventType[()]] = None,
|
||||
on_mouse_out: Optional[EventType[()]] = None,
|
||||
on_mouse_over: Optional[EventType[()]] = None,
|
||||
on_mouse_up: Optional[EventType[()]] = None,
|
||||
on_scroll: Optional[EventType[[]]] = None,
|
||||
on_unmount: Optional[EventType[[]]] = None,
|
||||
**props,
|
||||
@ -675,9 +688,15 @@ class Cartesian(Recharts):
|
||||
*children: The children of the component.
|
||||
layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'
|
||||
data_key: The key of a group of data which should be unique in an area chart.
|
||||
x_axis_id: The id of x-axis which is corresponding to the data.
|
||||
y_axis_id: The id of y-axis which is corresponding to the data.
|
||||
x_axis_id: The id of x-axis which is corresponding to the data. Default: 0
|
||||
y_axis_id: The id of y-axis which is corresponding to the data. Default: 0
|
||||
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional
|
||||
is_animation_active: If set false, animation of bar will be disabled. Default: True
|
||||
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
|
||||
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
|
||||
animation_easing: The type of easing function. Default: "ease"
|
||||
unit: The unit of data. This option will be used in tooltip.
|
||||
name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
@ -794,25 +813,38 @@ class Area(Cartesian):
|
||||
],
|
||||
]
|
||||
] = None,
|
||||
is_animation_active: Optional[Union[Var[bool], bool]] = None,
|
||||
animation_begin: Optional[Union[Var[int], int]] = None,
|
||||
animation_duration: Optional[Union[Var[int], int]] = None,
|
||||
animation_easing: Optional[
|
||||
Union[
|
||||
Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"],
|
||||
Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]],
|
||||
]
|
||||
] = None,
|
||||
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||
style: Optional[Style] = None,
|
||||
key: Optional[Any] = None,
|
||||
id: Optional[Any] = None,
|
||||
class_name: Optional[Any] = None,
|
||||
autofocus: Optional[bool] = None,
|
||||
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
||||
on_animation_end: Optional[EventType[[]]] = None,
|
||||
on_animation_start: Optional[EventType[[]]] = None,
|
||||
on_blur: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[()]] = None,
|
||||
on_context_menu: Optional[EventType[[]]] = None,
|
||||
on_double_click: Optional[EventType[[]]] = None,
|
||||
on_focus: Optional[EventType[[]]] = None,
|
||||
on_mount: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[[]]] = None,
|
||||
on_mouse_enter: Optional[EventType[[]]] = None,
|
||||
on_mouse_leave: Optional[EventType[[]]] = None,
|
||||
on_mouse_move: Optional[EventType[[]]] = None,
|
||||
on_mouse_out: Optional[EventType[[]]] = None,
|
||||
on_mouse_over: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[()]] = None,
|
||||
on_mouse_enter: Optional[EventType[()]] = None,
|
||||
on_mouse_leave: Optional[EventType[()]] = None,
|
||||
on_mouse_move: Optional[EventType[()]] = None,
|
||||
on_mouse_out: Optional[EventType[()]] = None,
|
||||
on_mouse_over: Optional[EventType[()]] = None,
|
||||
on_mouse_up: Optional[EventType[()]] = None,
|
||||
on_scroll: Optional[EventType[[]]] = None,
|
||||
on_unmount: Optional[EventType[[]]] = None,
|
||||
**props,
|
||||
@ -834,9 +866,15 @@ class Area(Cartesian):
|
||||
connect_nulls: Whether to connect a graph area across null points. Default: False
|
||||
layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'
|
||||
data_key: The key of a group of data which should be unique in an area chart.
|
||||
x_axis_id: The id of x-axis which is corresponding to the data.
|
||||
y_axis_id: The id of y-axis which is corresponding to the data.
|
||||
x_axis_id: The id of x-axis which is corresponding to the data. Default: 0
|
||||
y_axis_id: The id of y-axis which is corresponding to the data. Default: 0
|
||||
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional
|
||||
is_animation_active: If set false, animation of bar will be disabled. Default: True
|
||||
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
|
||||
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
|
||||
animation_easing: The type of easing function. Default: "ease"
|
||||
unit: The unit of data. This option will be used in tooltip.
|
||||
name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
@ -909,25 +947,36 @@ class Bar(Cartesian):
|
||||
],
|
||||
]
|
||||
] = None,
|
||||
is_animation_active: Optional[Union[Var[bool], bool]] = None,
|
||||
animation_begin: Optional[Union[Var[int], int]] = None,
|
||||
animation_duration: Optional[Union[Var[int], int]] = None,
|
||||
animation_easing: Optional[
|
||||
Union[
|
||||
Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"],
|
||||
Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]],
|
||||
]
|
||||
] = None,
|
||||
style: Optional[Style] = None,
|
||||
key: Optional[Any] = None,
|
||||
id: Optional[Any] = None,
|
||||
class_name: Optional[Any] = None,
|
||||
autofocus: Optional[bool] = None,
|
||||
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
||||
on_animation_end: Optional[EventType[[]]] = None,
|
||||
on_animation_start: Optional[EventType[[]]] = None,
|
||||
on_blur: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[()]] = None,
|
||||
on_context_menu: Optional[EventType[[]]] = None,
|
||||
on_double_click: Optional[EventType[[]]] = None,
|
||||
on_focus: Optional[EventType[[]]] = None,
|
||||
on_mount: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[[]]] = None,
|
||||
on_mouse_enter: Optional[EventType[[]]] = None,
|
||||
on_mouse_leave: Optional[EventType[[]]] = None,
|
||||
on_mouse_move: Optional[EventType[[]]] = None,
|
||||
on_mouse_out: Optional[EventType[[]]] = None,
|
||||
on_mouse_over: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[()]] = None,
|
||||
on_mouse_enter: Optional[EventType[()]] = None,
|
||||
on_mouse_leave: Optional[EventType[()]] = None,
|
||||
on_mouse_move: Optional[EventType[()]] = None,
|
||||
on_mouse_out: Optional[EventType[()]] = None,
|
||||
on_mouse_over: Optional[EventType[()]] = None,
|
||||
on_mouse_up: Optional[EventType[()]] = None,
|
||||
on_scroll: Optional[EventType[[]]] = None,
|
||||
on_unmount: Optional[EventType[[]]] = None,
|
||||
**props,
|
||||
@ -944,15 +993,19 @@ class Bar(Cartesian):
|
||||
stack_id: The stack id of bar, when two bars have the same value axis and same stack_id, then the two bars are stacked in order.
|
||||
unit: The unit of data. This option will be used in tooltip.
|
||||
min_point_size: The minimal height of a bar in a horizontal BarChart, or the minimal width of a bar in a vertical BarChart. By default, 0 values are not shown. To visualize a 0 (or close to zero) point, set the minimal point size to a pixel value like 3. In stacked bar charts, minPointSize might not be respected for tightly packed values. So we strongly recommend not using this prop in stacked BarCharts.
|
||||
name: The name of data. This option will be used in tooltip and legend to represent a bar. If no value was set to this option, the value of dataKey will be used alternatively.
|
||||
name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
|
||||
bar_size: Size of the bar (if one bar_size is set then a bar_size must be set for all bars)
|
||||
max_bar_size: Max size of the bar
|
||||
radius: If set a value, the option is the radius of all the rounded corners. If set a array, the option are in turn the radiuses of top-left corner, top-right corner, bottom-right corner, bottom-left corner. Default: 0
|
||||
layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'
|
||||
data_key: The key of a group of data which should be unique in an area chart.
|
||||
x_axis_id: The id of x-axis which is corresponding to the data.
|
||||
y_axis_id: The id of y-axis which is corresponding to the data.
|
||||
x_axis_id: The id of x-axis which is corresponding to the data. Default: 0
|
||||
y_axis_id: The id of y-axis which is corresponding to the data. Default: 0
|
||||
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional
|
||||
is_animation_active: If set false, animation of bar will be disabled. Default: True
|
||||
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
|
||||
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
|
||||
animation_easing: The type of easing function. Default: "ease"
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
@ -1067,25 +1120,37 @@ class Line(Cartesian):
|
||||
],
|
||||
]
|
||||
] = None,
|
||||
is_animation_active: Optional[Union[Var[bool], bool]] = None,
|
||||
animation_begin: Optional[Union[Var[int], int]] = None,
|
||||
animation_duration: Optional[Union[Var[int], int]] = None,
|
||||
animation_easing: Optional[
|
||||
Union[
|
||||
Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"],
|
||||
Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]],
|
||||
]
|
||||
] = None,
|
||||
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||
style: Optional[Style] = None,
|
||||
key: Optional[Any] = None,
|
||||
id: Optional[Any] = None,
|
||||
class_name: Optional[Any] = None,
|
||||
autofocus: Optional[bool] = None,
|
||||
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
||||
on_animation_end: Optional[EventType[[]]] = None,
|
||||
on_animation_start: Optional[EventType[[]]] = None,
|
||||
on_blur: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[()]] = None,
|
||||
on_context_menu: Optional[EventType[[]]] = None,
|
||||
on_double_click: Optional[EventType[[]]] = None,
|
||||
on_focus: Optional[EventType[[]]] = None,
|
||||
on_mount: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[[]]] = None,
|
||||
on_mouse_enter: Optional[EventType[[]]] = None,
|
||||
on_mouse_leave: Optional[EventType[[]]] = None,
|
||||
on_mouse_move: Optional[EventType[[]]] = None,
|
||||
on_mouse_out: Optional[EventType[[]]] = None,
|
||||
on_mouse_over: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[()]] = None,
|
||||
on_mouse_enter: Optional[EventType[()]] = None,
|
||||
on_mouse_leave: Optional[EventType[()]] = None,
|
||||
on_mouse_move: Optional[EventType[()]] = None,
|
||||
on_mouse_out: Optional[EventType[()]] = None,
|
||||
on_mouse_over: Optional[EventType[()]] = None,
|
||||
on_mouse_up: Optional[EventType[()]] = None,
|
||||
on_scroll: Optional[EventType[[]]] = None,
|
||||
on_unmount: Optional[EventType[[]]] = None,
|
||||
**props,
|
||||
@ -1107,9 +1172,14 @@ class Line(Cartesian):
|
||||
stroke_dasharray: The pattern of dashes and gaps used to paint the line.
|
||||
layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'
|
||||
data_key: The key of a group of data which should be unique in an area chart.
|
||||
x_axis_id: The id of x-axis which is corresponding to the data.
|
||||
y_axis_id: The id of y-axis which is corresponding to the data.
|
||||
x_axis_id: The id of x-axis which is corresponding to the data. Default: 0
|
||||
y_axis_id: The id of y-axis which is corresponding to the data. Default: 0
|
||||
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional
|
||||
is_animation_active: If set false, animation of bar will be disabled. Default: True
|
||||
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
|
||||
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
|
||||
animation_easing: The type of easing function. Default: "ease"
|
||||
name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
@ -1204,18 +1274,18 @@ class Scatter(Recharts):
|
||||
autofocus: Optional[bool] = None,
|
||||
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
||||
on_blur: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[()]] = None,
|
||||
on_context_menu: Optional[EventType[[]]] = None,
|
||||
on_double_click: Optional[EventType[[]]] = None,
|
||||
on_focus: Optional[EventType[[]]] = None,
|
||||
on_mount: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[[]]] = None,
|
||||
on_mouse_enter: Optional[EventType[[]]] = None,
|
||||
on_mouse_leave: Optional[EventType[[]]] = None,
|
||||
on_mouse_move: Optional[EventType[[]]] = None,
|
||||
on_mouse_out: Optional[EventType[[]]] = None,
|
||||
on_mouse_over: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[()]] = None,
|
||||
on_mouse_enter: Optional[EventType[()]] = None,
|
||||
on_mouse_leave: Optional[EventType[()]] = None,
|
||||
on_mouse_move: Optional[EventType[()]] = None,
|
||||
on_mouse_out: Optional[EventType[()]] = None,
|
||||
on_mouse_over: Optional[EventType[()]] = None,
|
||||
on_mouse_up: Optional[EventType[()]] = None,
|
||||
on_scroll: Optional[EventType[[]]] = None,
|
||||
on_unmount: Optional[EventType[[]]] = None,
|
||||
**props,
|
||||
@ -1301,27 +1371,30 @@ class Funnel(Recharts):
|
||||
]
|
||||
] = None,
|
||||
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
||||
trapezoids: Optional[
|
||||
Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]
|
||||
] = None,
|
||||
style: Optional[Style] = None,
|
||||
key: Optional[Any] = None,
|
||||
id: Optional[Any] = None,
|
||||
class_name: Optional[Any] = None,
|
||||
autofocus: Optional[bool] = None,
|
||||
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
||||
on_animation_end: Optional[EventType[[]]] = None,
|
||||
on_animation_start: Optional[EventType[[]]] = None,
|
||||
on_animation_end: Optional[EventType[()]] = None,
|
||||
on_animation_start: Optional[EventType[()]] = None,
|
||||
on_blur: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[()]] = None,
|
||||
on_context_menu: Optional[EventType[[]]] = None,
|
||||
on_double_click: Optional[EventType[[]]] = None,
|
||||
on_focus: Optional[EventType[[]]] = None,
|
||||
on_mount: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[[]]] = None,
|
||||
on_mouse_enter: Optional[EventType[[]]] = None,
|
||||
on_mouse_leave: Optional[EventType[[]]] = None,
|
||||
on_mouse_move: Optional[EventType[[]]] = None,
|
||||
on_mouse_out: Optional[EventType[[]]] = None,
|
||||
on_mouse_over: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[()]] = None,
|
||||
on_mouse_enter: Optional[EventType[()]] = None,
|
||||
on_mouse_leave: Optional[EventType[()]] = None,
|
||||
on_mouse_move: Optional[EventType[()]] = None,
|
||||
on_mouse_out: Optional[EventType[()]] = None,
|
||||
on_mouse_over: Optional[EventType[()]] = None,
|
||||
on_mouse_up: Optional[EventType[()]] = None,
|
||||
on_scroll: Optional[EventType[[]]] = None,
|
||||
on_unmount: Optional[EventType[[]]] = None,
|
||||
**props,
|
||||
@ -1331,14 +1404,15 @@ class Funnel(Recharts):
|
||||
Args:
|
||||
*children: The children of the component.
|
||||
data: The source data, in which each element is an object.
|
||||
data_key: The key of a group of data which should be unique in an area chart.
|
||||
name_key: The key or getter of a group of data which should be unique in a LineChart.
|
||||
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered.
|
||||
is_animation_active: If set false, animation of line will be disabled.
|
||||
animation_begin: Specifies when the animation should begin, the unit of this option is ms.
|
||||
animation_duration: Specifies the duration of animation, the unit of this option is ms.
|
||||
animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'
|
||||
stroke: stroke color
|
||||
data_key: The key or getter of a group of data which should be unique in a FunnelChart.
|
||||
name_key: The key of each sector's name. Default: "name"
|
||||
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "line"
|
||||
is_animation_active: If set false, animation of line will be disabled. Default: True
|
||||
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
|
||||
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
|
||||
animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default "ease"
|
||||
stroke: Stroke color. Default: rx.color("gray", 3)
|
||||
trapezoids: The coordinates of all the trapezoids in the funnel, usually calculated internally.
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
@ -1358,13 +1432,11 @@ class ErrorBar(Recharts):
|
||||
def create( # type: ignore
|
||||
cls,
|
||||
*children,
|
||||
direction: Optional[
|
||||
Union[Literal["both", "x", "y"], Var[Literal["both", "x", "y"]]]
|
||||
] = None,
|
||||
direction: Optional[Union[Literal["x", "y"], Var[Literal["x", "y"]]]] = None,
|
||||
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||
width: Optional[Union[Var[int], int]] = None,
|
||||
stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None,
|
||||
stroke_width: Optional[Union[Var[int], int]] = None,
|
||||
stroke_width: Optional[Union[Var[Union[float, int]], float, int]] = None,
|
||||
style: Optional[Style] = None,
|
||||
key: Optional[Any] = None,
|
||||
id: Optional[Any] = None,
|
||||
@ -1392,11 +1464,11 @@ class ErrorBar(Recharts):
|
||||
|
||||
Args:
|
||||
*children: The children of the component.
|
||||
direction: The direction of error bar. 'x' | 'y' | 'both'
|
||||
direction: Only used for ScatterChart with error bars in two directions. Only accepts a value of "x" or "y" and makes the error bars lie in that direction.
|
||||
data_key: The key of a group of data which should be unique in an area chart.
|
||||
width: The width of the error bar ends.
|
||||
stroke: The stroke color of error bar.
|
||||
stroke_width: The stroke width of error bar.
|
||||
width: The width of the error bar ends. Default: 5
|
||||
stroke: The stroke color of error bar. Default: rx.color("gray", 8)
|
||||
stroke_width: The stroke width of error bar. Default: 1.5
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
@ -1570,18 +1642,18 @@ class ReferenceDot(Reference):
|
||||
autofocus: Optional[bool] = None,
|
||||
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
||||
on_blur: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[[]]] = None,
|
||||
on_click: Optional[EventType[()]] = None,
|
||||
on_context_menu: Optional[EventType[[]]] = None,
|
||||
on_double_click: Optional[EventType[[]]] = None,
|
||||
on_focus: Optional[EventType[[]]] = None,
|
||||
on_mount: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[[]]] = None,
|
||||
on_mouse_enter: Optional[EventType[[]]] = None,
|
||||
on_mouse_leave: Optional[EventType[[]]] = None,
|
||||
on_mouse_move: Optional[EventType[[]]] = None,
|
||||
on_mouse_out: Optional[EventType[[]]] = None,
|
||||
on_mouse_over: Optional[EventType[[]]] = None,
|
||||
on_mouse_up: Optional[EventType[[]]] = None,
|
||||
on_mouse_down: Optional[EventType[()]] = None,
|
||||
on_mouse_enter: Optional[EventType[()]] = None,
|
||||
on_mouse_leave: Optional[EventType[()]] = None,
|
||||
on_mouse_move: Optional[EventType[()]] = None,
|
||||
on_mouse_out: Optional[EventType[()]] = None,
|
||||
on_mouse_over: Optional[EventType[()]] = None,
|
||||
on_mouse_up: Optional[EventType[()]] = None,
|
||||
on_scroll: Optional[EventType[[]]] = None,
|
||||
on_unmount: Optional[EventType[[]]] = None,
|
||||
**props,
|
||||
@ -1723,10 +1795,10 @@ class Grid(Recharts):
|
||||
|
||||
Args:
|
||||
*children: The children of the component.
|
||||
x: The x-coordinate of grid.
|
||||
y: The y-coordinate of grid.
|
||||
width: The width of grid.
|
||||
height: The height of grid.
|
||||
x: The x-coordinate of grid. Default: 0
|
||||
y: The y-coordinate of grid. Default: 0
|
||||
width: The width of grid. Default: 0
|
||||
height: The height of grid. Default: 0
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
@ -1797,10 +1869,10 @@ class CartesianGrid(Grid):
|
||||
fill_opacity: The opacity of the background used to fill the space between grid lines.
|
||||
stroke_dasharray: The pattern of dashes and gaps used to paint the lines of the grid.
|
||||
stroke: the stroke color of grid. Default: rx.color("gray", 7)
|
||||
x: The x-coordinate of grid.
|
||||
y: The y-coordinate of grid.
|
||||
width: The width of grid.
|
||||
height: The height of grid.
|
||||
x: The x-coordinate of grid. Default: 0
|
||||
y: The y-coordinate of grid. Default: 0
|
||||
width: The width of grid. Default: 0
|
||||
height: The height of grid. Default: 0
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
@ -1881,10 +1953,10 @@ class CartesianAxis(Grid):
|
||||
label: If set a string or a number, default label will be drawn, and the option is content.
|
||||
mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. Default: False
|
||||
tick_margin: The margin between tick line and tick.
|
||||
x: The x-coordinate of grid.
|
||||
y: The y-coordinate of grid.
|
||||
width: The width of grid.
|
||||
height: The height of grid.
|
||||
x: The x-coordinate of grid. Default: 0
|
||||
y: The y-coordinate of grid. Default: 0
|
||||
width: The width of grid. Default: 0
|
||||
height: The height of grid. Default: 0
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
|
@ -158,31 +158,34 @@ class RadialBar(Recharts):
|
||||
|
||||
alias = "RechartsRadialBar"
|
||||
|
||||
# The source data which each element is an object.
|
||||
data: Var[List[Dict[str, Any]]]
|
||||
|
||||
# The key of a group of data which should be unique to show the meaning of angle axis.
|
||||
data_key: Var[Union[str, int]]
|
||||
|
||||
# Min angle of each bar. A positive value between 0 and 360.
|
||||
# Min angle of each bar. A positive value between 0 and 360. Default: 0
|
||||
min_angle: Var[int]
|
||||
|
||||
# Type of legend
|
||||
legend_type: Var[str]
|
||||
# The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect"
|
||||
legend_type: Var[LiteralLegendType]
|
||||
|
||||
# If false set, labels will not be drawn.
|
||||
# If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False
|
||||
label: Var[Union[bool, Dict[str, Any]]]
|
||||
|
||||
# If false set, background sector will not be drawn.
|
||||
# If false set, background sector will not be drawn. Default: False
|
||||
background: Var[Union[bool, Dict[str, Any]]]
|
||||
|
||||
# If set false, animation of radial bars will be disabled. By default true in CSR, and false in SSR
|
||||
# If set false, animation of radial bars will be disabled. Default: True
|
||||
is_animation_active: Var[bool]
|
||||
|
||||
# Specifies when the animation should begin, the unit of this option is ms. By default 0
|
||||
# Specifies when the animation should begin, the unit of this option is ms. Default: 0
|
||||
animation_begin: Var[int]
|
||||
|
||||
# Specifies the duration of animation, the unit of this option is ms. By default 1500
|
||||
# Specifies the duration of animation, the unit of this option is ms. Default 1500
|
||||
animation_duration: Var[int]
|
||||
|
||||
# The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. By default 'ease'
|
||||
# The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default: "ease"
|
||||
animation_easing: Var[LiteralAnimationEasing]
|
||||
|
||||
# Valid children components
|
||||
|
@ -216,9 +216,41 @@ class RadialBar(Recharts):
|
||||
def create( # type: ignore
|
||||
cls,
|
||||
*children,
|
||||
data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None,
|
||||
data_key: Optional[Union[Var[Union[int, str]], int, str]] = None,
|
||||
min_angle: Optional[Union[Var[int], int]] = None,
|
||||
legend_type: Optional[Union[Var[str], str]] = None,
|
||||
legend_type: Optional[
|
||||
Union[
|
||||
Literal[
|
||||
"circle",
|
||||
"cross",
|
||||
"diamond",
|
||||
"line",
|
||||
"none",
|
||||
"plainline",
|
||||
"rect",
|
||||
"square",
|
||||
"star",
|
||||
"triangle",
|
||||
"wye",
|
||||
],
|
||||
Var[
|
||||
Literal[
|
||||
"circle",
|
||||
"cross",
|
||||
"diamond",
|
||||
"line",
|
||||
"none",
|
||||
"plainline",
|
||||
"rect",
|
||||
"square",
|
||||
"star",
|
||||
"triangle",
|
||||
"wye",
|
||||
]
|
||||
],
|
||||
]
|
||||
] = None,
|
||||
label: Optional[
|
||||
Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool]
|
||||
] = None,
|
||||
@ -254,15 +286,16 @@ class RadialBar(Recharts):
|
||||
|
||||
Args:
|
||||
*children: The children of the component.
|
||||
data: The source data which each element is an object.
|
||||
data_key: The key of a group of data which should be unique to show the meaning of angle axis.
|
||||
min_angle: Min angle of each bar. A positive value between 0 and 360.
|
||||
legend_type: Type of legend
|
||||
label: If false set, labels will not be drawn.
|
||||
background: If false set, background sector will not be drawn.
|
||||
is_animation_active: If set false, animation of radial bars will be disabled. By default true in CSR, and false in SSR
|
||||
animation_begin: Specifies when the animation should begin, the unit of this option is ms. By default 0
|
||||
animation_duration: Specifies the duration of animation, the unit of this option is ms. By default 1500
|
||||
animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. By default 'ease'
|
||||
min_angle: Min angle of each bar. A positive value between 0 and 360. Default: 0
|
||||
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect"
|
||||
label: If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False
|
||||
background: If false set, background sector will not be drawn. Default: False
|
||||
is_animation_active: If set false, animation of radial bars will be disabled. Default: True
|
||||
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
|
||||
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default 1500
|
||||
animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default: "ease"
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
|
@ -131,6 +131,6 @@ LiteralAreaType = Literal[
|
||||
"stepBefore",
|
||||
"stepAfter",
|
||||
]
|
||||
LiteralDirection = Literal["x", "y", "both"]
|
||||
LiteralDirection = Literal["x", "y"]
|
||||
LiteralInterval = Literal["preserveStart", "preserveEnd", "preserveStartEnd"]
|
||||
LiteralSyncMethod = Literal["index", "value"]
|
||||
|
@ -202,6 +202,6 @@ LiteralAreaType = Literal[
|
||||
"stepBefore",
|
||||
"stepAfter",
|
||||
]
|
||||
LiteralDirection = Literal["x", "y", "both"]
|
||||
LiteralDirection = Literal["x", "y"]
|
||||
LiteralInterval = Literal["preserveStart", "preserveEnd", "preserveStartEnd"]
|
||||
LiteralSyncMethod = Literal["index", "value"]
|
||||
|
@ -9,6 +9,8 @@ import urllib.parse
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional, Set, Union
|
||||
|
||||
from reflex.utils.exceptions import ConfigError
|
||||
|
||||
try:
|
||||
import pydantic.v1 as pydantic
|
||||
except ModuleNotFoundError:
|
||||
@ -220,6 +222,9 @@ class Config(Base):
|
||||
# Number of gunicorn workers from user
|
||||
gunicorn_workers: Optional[int] = None
|
||||
|
||||
# Indicate which type of state manager to use
|
||||
state_manager_mode: constants.StateManagerMode = constants.StateManagerMode.DISK
|
||||
|
||||
# Maximum expiration lock time for redis state manager
|
||||
redis_lock_expiration: int = constants.Expiration.LOCK
|
||||
|
||||
@ -235,6 +240,9 @@ class Config(Base):
|
||||
Args:
|
||||
*args: The args to pass to the Pydantic init method.
|
||||
**kwargs: The kwargs to pass to the Pydantic init method.
|
||||
|
||||
Raises:
|
||||
ConfigError: If some values in the config are invalid.
|
||||
"""
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@ -248,6 +256,14 @@ class Config(Base):
|
||||
self._non_default_attributes.update(kwargs)
|
||||
self._replace_defaults(**kwargs)
|
||||
|
||||
if (
|
||||
self.state_manager_mode == constants.StateManagerMode.REDIS
|
||||
and not self.redis_url
|
||||
):
|
||||
raise ConfigError(
|
||||
"REDIS_URL is required when using the redis state manager."
|
||||
)
|
||||
|
||||
@property
|
||||
def module(self) -> str:
|
||||
"""Get the module name of the app.
|
||||
|
@ -63,6 +63,7 @@ from .route import (
|
||||
RouteRegex,
|
||||
RouteVar,
|
||||
)
|
||||
from .state import StateManagerMode
|
||||
from .style import Tailwind
|
||||
|
||||
__ALL__ = [
|
||||
@ -115,6 +116,7 @@ __ALL__ = [
|
||||
SETTER_PREFIX,
|
||||
SKIP_COMPILE_ENV_VAR,
|
||||
SocketEvent,
|
||||
StateManagerMode,
|
||||
Tailwind,
|
||||
Templates,
|
||||
CompileVars,
|
||||
|
11
reflex/constants/state.py
Normal file
11
reflex/constants/state.py
Normal file
@ -0,0 +1,11 @@
|
||||
"""State-related constants."""
|
||||
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class StateManagerMode(str, Enum):
|
||||
"""State manager constants."""
|
||||
|
||||
DISK = "disk"
|
||||
MEMORY = "memory"
|
||||
REDIS = "redis"
|
@ -76,6 +76,7 @@ from reflex.utils.exceptions import (
|
||||
DynamicRouteArgShadowsStateVar,
|
||||
EventHandlerShadowsBuiltInStateMethod,
|
||||
ImmutableStateError,
|
||||
InvalidStateManagerMode,
|
||||
LockExpiredError,
|
||||
SetUndefinedStateVarError,
|
||||
StateSchemaMismatchError,
|
||||
@ -1879,13 +1880,8 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
||||
self.dirty_vars.update(self._always_dirty_computed_vars)
|
||||
self._mark_dirty()
|
||||
|
||||
def dictify(value: Any):
|
||||
if dataclasses.is_dataclass(value) and not isinstance(value, type):
|
||||
return dataclasses.asdict(value)
|
||||
return value
|
||||
|
||||
base_vars = {
|
||||
prop_name: dictify(self.get_value(getattr(self, prop_name)))
|
||||
prop_name: self.get_value(getattr(self, prop_name))
|
||||
for prop_name in self.base_vars
|
||||
}
|
||||
if initial and include_computed:
|
||||
@ -2519,20 +2515,30 @@ class StateManager(Base, ABC):
|
||||
Args:
|
||||
state: The state class to use.
|
||||
|
||||
Raises:
|
||||
InvalidStateManagerMode: If the state manager mode is invalid.
|
||||
|
||||
Returns:
|
||||
The state manager (either disk or redis).
|
||||
The state manager (either disk, memory or redis).
|
||||
"""
|
||||
config = get_config()
|
||||
if config.state_manager_mode == constants.StateManagerMode.DISK:
|
||||
return StateManagerMemory(state=state)
|
||||
if config.state_manager_mode == constants.StateManagerMode.MEMORY:
|
||||
return StateManagerDisk(state=state)
|
||||
if config.state_manager_mode == constants.StateManagerMode.REDIS:
|
||||
redis = prerequisites.get_redis()
|
||||
if redis is not None:
|
||||
# make sure expiration values are obtained only from the config object on creation
|
||||
config = get_config()
|
||||
return StateManagerRedis(
|
||||
state=state,
|
||||
redis=redis,
|
||||
token_expiration=config.redis_token_expiration,
|
||||
lock_expiration=config.redis_lock_expiration,
|
||||
)
|
||||
return StateManagerDisk(state=state)
|
||||
raise InvalidStateManagerMode(
|
||||
f"Expected one of: DISK, MEMORY, REDIS, got {config.state_manager_mode}"
|
||||
)
|
||||
|
||||
@abstractmethod
|
||||
async def get_state(self, token: str) -> BaseState:
|
||||
|
@ -394,9 +394,14 @@ class AppHarness:
|
||||
|
||||
def consume_frontend_output():
|
||||
while True:
|
||||
try:
|
||||
line = (
|
||||
self.frontend_process.stdout.readline() # pyright: ignore [reportOptionalMemberAccess]
|
||||
)
|
||||
# catch I/O operation on closed file.
|
||||
except ValueError as e:
|
||||
print(e)
|
||||
break
|
||||
if not line:
|
||||
break
|
||||
print(line)
|
||||
|
@ -5,6 +5,14 @@ class ReflexError(Exception):
|
||||
"""Base exception for all Reflex exceptions."""
|
||||
|
||||
|
||||
class ConfigError(ReflexError):
|
||||
"""Custom exception for config related errors."""
|
||||
|
||||
|
||||
class InvalidStateManagerMode(ReflexError, ValueError):
|
||||
"""Raised when an invalid state manager mode is provided."""
|
||||
|
||||
|
||||
class ReflexRuntimeError(ReflexError, RuntimeError):
|
||||
"""Custom RuntimeError for Reflex."""
|
||||
|
||||
|
@ -545,7 +545,7 @@ class LiteralStringVar(LiteralVar, StringVar):
|
||||
def create(
|
||||
cls,
|
||||
value: str,
|
||||
_var_type: GenericType | None = str,
|
||||
_var_type: GenericType | None = None,
|
||||
_var_data: VarData | None = None,
|
||||
) -> StringVar:
|
||||
"""Create a var from a string value.
|
||||
@ -558,6 +558,9 @@ class LiteralStringVar(LiteralVar, StringVar):
|
||||
Returns:
|
||||
The var.
|
||||
"""
|
||||
# Determine var type in case the value is inherited from str.
|
||||
_var_type = _var_type or type(value) or str
|
||||
|
||||
if REFLEX_VAR_OPENING_TAG in value:
|
||||
strings_and_vals: list[Var | str] = []
|
||||
offset = 0
|
||||
|
@ -1290,19 +1290,19 @@ def test_computed_var_depends_on_parent_non_cached():
|
||||
assert ps.dirty_vars == set()
|
||||
assert cs.dirty_vars == set()
|
||||
|
||||
dict1 = ps.dict()
|
||||
dict1 = json.loads(json_dumps(ps.dict()))
|
||||
assert dict1[ps.get_full_name()] == {
|
||||
"no_cache_v": 1,
|
||||
"router": formatted_router,
|
||||
}
|
||||
assert dict1[cs.get_full_name()] == {"dep_v": 2}
|
||||
dict2 = ps.dict()
|
||||
dict2 = json.loads(json_dumps(ps.dict()))
|
||||
assert dict2[ps.get_full_name()] == {
|
||||
"no_cache_v": 3,
|
||||
"router": formatted_router,
|
||||
}
|
||||
assert dict2[cs.get_full_name()] == {"dep_v": 4}
|
||||
dict3 = ps.dict()
|
||||
dict3 = json.loads(json_dumps(ps.dict()))
|
||||
assert dict3[ps.get_full_name()] == {
|
||||
"no_cache_v": 5,
|
||||
"router": formatted_router,
|
||||
@ -3201,6 +3201,7 @@ import reflex as rx
|
||||
config = rx.Config(
|
||||
app_name="project1",
|
||||
redis_url="redis://localhost:6379",
|
||||
state_manager_mode="redis",
|
||||
{config_items}
|
||||
)
|
||||
"""
|
||||
|
@ -1809,3 +1809,6 @@ def test_to_string_operation():
|
||||
|
||||
assert cast(Var, TestState.email)._var_type == Email
|
||||
assert cast(Var, TestState.optional_email)._var_type == Optional[Email]
|
||||
|
||||
single_var = Var.create(Email())
|
||||
assert single_var._var_type == Email
|
||||
|
Loading…
Reference in New Issue
Block a user