dara-components 1.20.3__py3-none-any.whl → 1.22.1__py3-none-any.whl
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.
- dara/components/__init__.py +2 -1
- dara/components/_assets/__init__.py +30 -0
- dara/components/_assets/auto_js/.gitkeep +0 -0
- dara/components/{umd → _assets/auto_js}/dara.components.umd.js +48820 -43508
- dara/components/_assets/common/bokeh-3.1.1.min.js +690 -0
- dara/components/_assets/common/bokeh-api-3.1.1.min.js +60 -0
- dara/components/_assets/common/bokeh-gl-3.1.1.min.js +67 -0
- dara/components/_assets/common/bokeh-mathjax-3.1.1.min.js +329 -0
- dara/components/_assets/common/bokeh-tables-3.1.1.min.js +132 -0
- dara/components/_assets/common/bokeh-widgets-3.1.1.min.js +129 -0
- dara/components/_assets/common/pixi-filters.min.js +17 -0
- dara/components/_assets/common/pixi.min.js +2214 -0
- dara/components/_assets/common/pixi_viewport.js +1 -0
- dara/components/_assets/common/plotly.min.js +8 -0
- dara/components/common/accordion.py +12 -18
- dara/components/common/anchor.py +6 -5
- dara/components/common/base_component.py +5 -5
- dara/components/common/bullet_list.py +1 -3
- dara/components/common/button.py +11 -6
- dara/components/common/button_bar.py +6 -6
- dara/components/common/card.py +3 -5
- dara/components/common/carousel.py +5 -5
- dara/components/common/checkbox_group.py +8 -8
- dara/components/common/code.py +3 -3
- dara/components/common/component_select_list.py +6 -8
- dara/components/common/datepicker.py +6 -6
- dara/components/common/dropdown_menu.py +9 -9
- dara/components/common/dropzone.py +11 -14
- dara/components/common/form.py +3 -5
- dara/components/common/form_page.py +2 -4
- dara/components/common/grid.py +13 -13
- dara/components/common/heading.py +2 -3
- dara/components/common/icon.py +1 -3
- dara/components/common/if_cmp.py +8 -8
- dara/components/common/input.py +5 -7
- dara/components/common/label.py +3 -5
- dara/components/common/markdown.py +2 -4
- dara/components/common/overlay.py +1 -3
- dara/components/common/progress_bar.py +2 -4
- dara/components/common/radio_group.py +8 -8
- dara/components/common/select.py +10 -10
- dara/components/common/slider.py +11 -11
- dara/components/common/spacer.py +2 -4
- dara/components/common/stack.py +3 -4
- dara/components/common/switch.py +3 -5
- dara/components/common/tabbed_card.py +2 -4
- dara/components/common/table.py +38 -34
- dara/components/common/text.py +3 -5
- dara/components/common/textarea.py +5 -5
- dara/components/common/time_utils.py +1 -2
- dara/components/common/tooltip.py +3 -5
- dara/components/common/utils.py +22 -22
- dara/components/graphs/components/base_graph_component.py +19 -19
- dara/components/graphs/components/causal_graph_viewer.py +2 -4
- dara/components/graphs/components/edge_encoder.py +13 -13
- dara/components/graphs/components/node_hierarchy_builder.py +12 -12
- dara/components/graphs/definitions.py +21 -16
- dara/components/graphs/graph_layout.py +36 -37
- dara/components/plotting/bokeh/bokeh.py +5 -5
- dara/components/plotting/bokeh/utils.py +1 -3
- dara/components/plotting/plotly/plotly.py +9 -13
- dara/components/plotting/plotly/themes.py +3 -3
- dara/components/smart/chat/chat.py +2 -2
- dara/components/smart/chat/config.py +1 -1
- dara/components/smart/chat/types.py +3 -5
- dara/components/smart/code_editor/code_editor.py +2 -2
- dara/components/smart/code_editor/util.py +4 -4
- dara/components/smart/data_slicer/data_slicer.py +4 -6
- dara/components/smart/data_slicer/data_slicer_modal.py +1 -3
- dara/components/smart/data_slicer/extension/data_slicer_filter.py +2 -3
- dara/components/smart/data_slicer/extension/filter_status_button.py +1 -3
- dara/components/smart/data_slicer/utils/core.py +14 -14
- dara/components/smart/data_slicer/utils/data_preview.py +1 -3
- dara/components/smart/hierarchy.py +5 -5
- {dara_components-1.20.3.dist-info → dara_components-1.22.1.dist-info}/METADATA +5 -6
- dara_components-1.22.1.dist-info/RECORD +100 -0
- dara_components-1.22.1.dist-info/entry_points.txt +3 -0
- dara_components-1.20.3.dist-info/RECORD +0 -87
- /dara/components/{umd/style.css → _assets/auto_js/dara.components.css} +0 -0
- {dara_components-1.20.3.dist-info → dara_components-1.22.1.dist-info}/LICENSE +0 -0
- {dara_components-1.20.3.dist-info → dara_components-1.22.1.dist-info}/WHEEL +0 -0
dara/components/common/utils.py
CHANGED
|
@@ -17,7 +17,7 @@ limitations under the License.
|
|
|
17
17
|
|
|
18
18
|
import os
|
|
19
19
|
from enum import Enum
|
|
20
|
-
from typing import Any
|
|
20
|
+
from typing import Any
|
|
21
21
|
|
|
22
22
|
from dara.core.base_definitions import DaraBaseModel as BaseModel
|
|
23
23
|
from dara.core.definitions import ComponentInstanceType
|
|
@@ -26,7 +26,7 @@ from dara.core.definitions import ComponentInstanceType
|
|
|
26
26
|
class ItemBadge(BaseModel):
|
|
27
27
|
"""Add a badge to an item in a list"""
|
|
28
28
|
|
|
29
|
-
color:
|
|
29
|
+
color: str | None = None
|
|
30
30
|
label: str
|
|
31
31
|
|
|
32
32
|
|
|
@@ -35,17 +35,17 @@ class Item(BaseModel):
|
|
|
35
35
|
A class for serializing a list of options for the select to show
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
|
-
badge:
|
|
39
|
-
image:
|
|
38
|
+
badge: ItemBadge | None = None
|
|
39
|
+
image: str | None = None
|
|
40
40
|
label: str
|
|
41
|
-
value:
|
|
41
|
+
value: str | int | float | BaseModel
|
|
42
42
|
|
|
43
43
|
def __init__(
|
|
44
44
|
self,
|
|
45
|
-
value:
|
|
45
|
+
value: str | int | float | BaseModel,
|
|
46
46
|
label: str,
|
|
47
|
-
badge:
|
|
48
|
-
image:
|
|
47
|
+
badge: ItemBadge | None = None,
|
|
48
|
+
image: str | None = None,
|
|
49
49
|
):
|
|
50
50
|
# Handle general enums in the value field
|
|
51
51
|
if isinstance(value, Enum):
|
|
@@ -98,23 +98,23 @@ class CarouselItem(BaseModel):
|
|
|
98
98
|
:param image_width: Optional string containing the width the image should take
|
|
99
99
|
"""
|
|
100
100
|
|
|
101
|
-
title:
|
|
102
|
-
subtitle:
|
|
103
|
-
component:
|
|
104
|
-
image:
|
|
105
|
-
image_alt:
|
|
106
|
-
image_height:
|
|
107
|
-
image_width:
|
|
101
|
+
title: str | None = None
|
|
102
|
+
subtitle: str | None = None
|
|
103
|
+
component: ComponentInstanceType | None = None
|
|
104
|
+
image: str | None = None
|
|
105
|
+
image_alt: str | None = None
|
|
106
|
+
image_height: str | None = None
|
|
107
|
+
image_width: str | None = None
|
|
108
108
|
|
|
109
109
|
def __init__(
|
|
110
110
|
self,
|
|
111
|
-
title:
|
|
112
|
-
subtitle:
|
|
113
|
-
component:
|
|
114
|
-
image:
|
|
115
|
-
image_alt:
|
|
116
|
-
image_height:
|
|
117
|
-
image_width:
|
|
111
|
+
title: str | None = None,
|
|
112
|
+
subtitle: str | None = None,
|
|
113
|
+
component: ComponentInstanceType | None = None,
|
|
114
|
+
image: str | None = None,
|
|
115
|
+
image_alt: str | None = None,
|
|
116
|
+
image_height: str | None = None,
|
|
117
|
+
image_width: str | None = None,
|
|
118
118
|
):
|
|
119
119
|
super().__init__(
|
|
120
120
|
title=title,
|
|
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
|
-
from typing import Any
|
|
18
|
+
from typing import Any
|
|
19
19
|
|
|
20
20
|
from pydantic import ConfigDict, SerializerFunctionWrapHandler, field_serializer
|
|
21
21
|
|
|
@@ -57,24 +57,24 @@ class BaseGraphComponent(StyledComponentInstance):
|
|
|
57
57
|
:param zoom_thresholds: Optional user-defined zoom thresholds. See [ZoomThresholds](../definitions/#zoomthresholds) for more details.
|
|
58
58
|
"""
|
|
59
59
|
|
|
60
|
-
additional_legends:
|
|
61
|
-
allow_selection_when_not_editable:
|
|
62
|
-
available_inputs:
|
|
63
|
-
default_legends:
|
|
64
|
-
disable_edge_add:
|
|
65
|
-
disable_latent_node_add:
|
|
66
|
-
disable_node_removal:
|
|
67
|
-
editable:
|
|
68
|
-
graph_layout:
|
|
69
|
-
non_removable_nodes:
|
|
70
|
-
on_click_edge:
|
|
71
|
-
on_click_node:
|
|
72
|
-
on_update:
|
|
73
|
-
require_focus_to_zoom:
|
|
74
|
-
simultaneous_edge_node_selection:
|
|
75
|
-
tooltip_size:
|
|
76
|
-
verbose_descriptions:
|
|
77
|
-
zoom_thresholds:
|
|
60
|
+
additional_legends: list[GraphLegend] | None = None
|
|
61
|
+
allow_selection_when_not_editable: bool | None = False
|
|
62
|
+
available_inputs: list[str] | None = None
|
|
63
|
+
default_legends: dict[EditorMode | str, list[GraphLegend]] = DEFAULT_LEGENDS
|
|
64
|
+
disable_edge_add: bool | None = None
|
|
65
|
+
disable_latent_node_add: bool | None = None
|
|
66
|
+
disable_node_removal: bool | None = None
|
|
67
|
+
editable: bool | None = False
|
|
68
|
+
graph_layout: GraphLayout | None = FcoseLayout()
|
|
69
|
+
non_removable_nodes: list[str] | None = None
|
|
70
|
+
on_click_edge: Action | None = None
|
|
71
|
+
on_click_node: Action | None = None
|
|
72
|
+
on_update: Action | None = None
|
|
73
|
+
require_focus_to_zoom: bool | None = True
|
|
74
|
+
simultaneous_edge_node_selection: bool | None = False
|
|
75
|
+
tooltip_size: int | None = None
|
|
76
|
+
verbose_descriptions: bool | None = None
|
|
77
|
+
zoom_thresholds: ZoomThresholds | None = None
|
|
78
78
|
|
|
79
79
|
model_config = ConfigDict(
|
|
80
80
|
arbitrary_types_allowed=True,
|
|
@@ -15,8 +15,6 @@ See the License for the specific language governing permissions and
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
|
-
from typing import Optional, Union
|
|
19
|
-
|
|
20
18
|
from pydantic import field_validator, model_validator
|
|
21
19
|
|
|
22
20
|
from cai_causal_graph import CausalGraph, Skeleton
|
|
@@ -248,8 +246,8 @@ class CausalGraphViewer(BaseGraphComponent):
|
|
|
248
246
|
|
|
249
247
|
js_module = '@darajs/components'
|
|
250
248
|
|
|
251
|
-
causal_graph:
|
|
252
|
-
editor_mode:
|
|
249
|
+
causal_graph: CausalGraph | DerivedVariable | Variable | dict | Skeleton
|
|
250
|
+
editor_mode: EditorMode | None = None
|
|
253
251
|
|
|
254
252
|
@field_validator('causal_graph')
|
|
255
253
|
@classmethod
|
|
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
|
-
from typing import Any
|
|
18
|
+
from typing import Any
|
|
19
19
|
|
|
20
20
|
from fastapi.encoders import jsonable_encoder
|
|
21
21
|
from pydantic import (
|
|
@@ -129,18 +129,18 @@ class VisualEdgeEncoder(StyledComponentInstance):
|
|
|
129
129
|
|
|
130
130
|
js_module = '@darajs/components'
|
|
131
131
|
|
|
132
|
-
additional_legends:
|
|
133
|
-
allow_selection_when_not_editable:
|
|
134
|
-
default_legends:
|
|
135
|
-
editable:
|
|
136
|
-
graph_layout:
|
|
137
|
-
initial_constraints:
|
|
138
|
-
nodes:
|
|
139
|
-
on_click_edge:
|
|
140
|
-
on_click_node:
|
|
141
|
-
on_update:
|
|
142
|
-
require_focus_to_zoom:
|
|
143
|
-
tooltip_size:
|
|
132
|
+
additional_legends: list[GraphLegend] | None = None
|
|
133
|
+
allow_selection_when_not_editable: bool | None = False
|
|
134
|
+
default_legends: dict[EditorMode | str, list[GraphLegend]] = DEFAULT_LEGENDS
|
|
135
|
+
editable: bool | None = False
|
|
136
|
+
graph_layout: GraphLayout | None = MarketingLayout()
|
|
137
|
+
initial_constraints: list[EdgeConstraint] | ClientVariable | None = None
|
|
138
|
+
nodes: list[str] | dict[str, Node] | ClientVariable
|
|
139
|
+
on_click_edge: Action | None = None
|
|
140
|
+
on_click_node: Action | None = None
|
|
141
|
+
on_update: Action | None = None
|
|
142
|
+
require_focus_to_zoom: bool | None = True
|
|
143
|
+
tooltip_size: str | None = None
|
|
144
144
|
|
|
145
145
|
model_config = ConfigDict(
|
|
146
146
|
arbitrary_types_allowed=True,
|
|
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
|
-
from typing import Any,
|
|
18
|
+
from typing import Any, ClassVar
|
|
19
19
|
|
|
20
20
|
from pydantic import field_validator
|
|
21
21
|
|
|
@@ -26,17 +26,17 @@ from dara.core.interactivity import ClientVariable
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
class NodeMeta(BaseModel):
|
|
29
|
-
label_size:
|
|
30
|
-
wrap_text:
|
|
31
|
-
label:
|
|
32
|
-
tooltip:
|
|
29
|
+
label_size: int | None = None
|
|
30
|
+
wrap_text: bool | None = None
|
|
31
|
+
label: str | None = None
|
|
32
|
+
tooltip: str | dict[str, str] | None = None
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
class Node(BaseModel):
|
|
36
36
|
name: str
|
|
37
|
-
meta:
|
|
37
|
+
meta: NodeMeta | None = None
|
|
38
38
|
|
|
39
|
-
Meta = NodeMeta
|
|
39
|
+
Meta: ClassVar[type[NodeMeta]] = NodeMeta
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
class NodeHierarchyBuilder(StyledComponentInstance):
|
|
@@ -109,15 +109,15 @@ class NodeHierarchyBuilder(StyledComponentInstance):
|
|
|
109
109
|
js_module = '@darajs/components'
|
|
110
110
|
|
|
111
111
|
editable: bool = True
|
|
112
|
-
nodes:
|
|
113
|
-
node_font_size:
|
|
114
|
-
node_size:
|
|
115
|
-
on_update:
|
|
112
|
+
nodes: list[list[str]] | list[str] | list[Node] | list[list[Node]] | ClientVariable
|
|
113
|
+
node_font_size: int | None = None
|
|
114
|
+
node_size: int | None = None
|
|
115
|
+
on_update: Action | None = None
|
|
116
116
|
wrap_node_text: bool = True
|
|
117
117
|
|
|
118
118
|
@field_validator('nodes')
|
|
119
119
|
@classmethod
|
|
120
|
-
def validate_nodes(cls, nodes: Any) ->
|
|
120
|
+
def validate_nodes(cls, nodes: Any) -> ClientVariable | list[list[str]] | list[list[Node]]:
|
|
121
121
|
if isinstance(nodes, ClientVariable):
|
|
122
122
|
return nodes
|
|
123
123
|
if not isinstance(nodes, list):
|
|
@@ -16,7 +16,7 @@ limitations under the License.
|
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
from enum import Enum
|
|
19
|
-
from typing import ClassVar,
|
|
19
|
+
from typing import ClassVar, Literal
|
|
20
20
|
|
|
21
21
|
from pydantic import Field
|
|
22
22
|
|
|
@@ -49,12 +49,17 @@ class CenterSymbol(str, Enum):
|
|
|
49
49
|
BIDIRECTED = 'bidirected'
|
|
50
50
|
|
|
51
51
|
|
|
52
|
+
EdgeLegendType = type['EdgeLegend']
|
|
53
|
+
SpacerLegendType = type['SpacerLegend']
|
|
54
|
+
NodeLegendType = type['NodeLegend']
|
|
55
|
+
|
|
56
|
+
|
|
52
57
|
class Legend(BaseModel):
|
|
53
58
|
type: str
|
|
54
59
|
|
|
55
|
-
Edge: ClassVar[
|
|
56
|
-
Spacer: ClassVar[
|
|
57
|
-
Node: ClassVar[
|
|
60
|
+
Edge: ClassVar[EdgeLegendType]
|
|
61
|
+
Spacer: ClassVar[SpacerLegendType]
|
|
62
|
+
Node: ClassVar[NodeLegendType]
|
|
58
63
|
|
|
59
64
|
|
|
60
65
|
class SpacerLegend(Legend):
|
|
@@ -65,7 +70,7 @@ class SpacerLegend(Legend):
|
|
|
65
70
|
"""
|
|
66
71
|
|
|
67
72
|
type: Literal['spacer'] = Field(default='spacer', frozen=True) # type: ignore
|
|
68
|
-
label:
|
|
73
|
+
label: str | None = None
|
|
69
74
|
|
|
70
75
|
|
|
71
76
|
class EdgeLegend(Legend):
|
|
@@ -80,11 +85,11 @@ class EdgeLegend(Legend):
|
|
|
80
85
|
"""
|
|
81
86
|
|
|
82
87
|
type: Literal['edge'] = Field(default='edge', frozen=True) # type: ignore
|
|
83
|
-
label:
|
|
84
|
-
arrow_type:
|
|
85
|
-
center_symbol:
|
|
86
|
-
color:
|
|
87
|
-
dash_array:
|
|
88
|
+
label: str | None = None
|
|
89
|
+
arrow_type: ArrowType | None = ArrowType.NORMAL
|
|
90
|
+
center_symbol: CenterSymbol | None = CenterSymbol.NONE
|
|
91
|
+
color: str | None = 'theme.grey5'
|
|
92
|
+
dash_array: str | None = None
|
|
88
93
|
|
|
89
94
|
|
|
90
95
|
class NodeLegend(Legend):
|
|
@@ -97,25 +102,25 @@ class NodeLegend(Legend):
|
|
|
97
102
|
"""
|
|
98
103
|
|
|
99
104
|
type: Literal['node'] = Field(default='node', frozen=True) # type: ignore
|
|
100
|
-
label:
|
|
101
|
-
color:
|
|
102
|
-
highlight_color:
|
|
105
|
+
label: str | None = None
|
|
106
|
+
color: str | None = 'theme.blue4'
|
|
107
|
+
highlight_color: str | None = 'theme.primary'
|
|
103
108
|
|
|
104
109
|
|
|
105
110
|
Legend.Edge = EdgeLegend
|
|
106
111
|
Legend.Spacer = SpacerLegend
|
|
107
112
|
Legend.Node = NodeLegend
|
|
108
113
|
|
|
109
|
-
GraphLegend =
|
|
114
|
+
GraphLegend = EdgeLegend | SpacerLegend | NodeLegend
|
|
110
115
|
|
|
111
|
-
DEFAULT_NODE_LEGENDS:
|
|
116
|
+
DEFAULT_NODE_LEGENDS: list[GraphLegend] = [
|
|
112
117
|
Legend.Node(color='theme.blue1', label='Latent'),
|
|
113
118
|
Legend.Node(color='theme.secondary', label='Target'),
|
|
114
119
|
Legend.Node(label='Other'),
|
|
115
120
|
]
|
|
116
121
|
|
|
117
122
|
# Default legends for each editor mode
|
|
118
|
-
DEFAULT_LEGENDS:
|
|
123
|
+
DEFAULT_LEGENDS: dict[EditorMode | str, list[GraphLegend]] = {
|
|
119
124
|
EditorMode.DEFAULT: DEFAULT_NODE_LEGENDS,
|
|
120
125
|
EditorMode.PAG: [
|
|
121
126
|
*DEFAULT_NODE_LEGENDS,
|
|
@@ -17,7 +17,6 @@ limitations under the License.
|
|
|
17
17
|
|
|
18
18
|
import abc
|
|
19
19
|
from enum import Enum
|
|
20
|
-
from typing import List, Optional, Union
|
|
21
20
|
|
|
22
21
|
from pydantic import Field
|
|
23
22
|
|
|
@@ -49,7 +48,7 @@ class LayeringAlgorithm(Enum):
|
|
|
49
48
|
SIMPLEX = 'simplex'
|
|
50
49
|
|
|
51
50
|
|
|
52
|
-
Number =
|
|
51
|
+
Number = int | float
|
|
53
52
|
|
|
54
53
|
|
|
55
54
|
class GraphLayout(BaseModel, abc.ABC):
|
|
@@ -60,8 +59,8 @@ class GraphLayout(BaseModel, abc.ABC):
|
|
|
60
59
|
:param node_font_size: node font size in pixels
|
|
61
60
|
"""
|
|
62
61
|
|
|
63
|
-
node_size:
|
|
64
|
-
node_font_size:
|
|
62
|
+
node_size: int | None = None
|
|
63
|
+
node_font_size: int | None = None
|
|
65
64
|
|
|
66
65
|
|
|
67
66
|
class TiersConfig(BaseModel):
|
|
@@ -77,8 +76,8 @@ class TiersConfig(BaseModel):
|
|
|
77
76
|
"""
|
|
78
77
|
|
|
79
78
|
group: str
|
|
80
|
-
order_nodes_by:
|
|
81
|
-
rank:
|
|
79
|
+
order_nodes_by: str | None = None
|
|
80
|
+
rank: list[str] | None = None
|
|
82
81
|
|
|
83
82
|
|
|
84
83
|
class TieringLayout(BaseModel):
|
|
@@ -135,8 +134,8 @@ class TieringLayout(BaseModel):
|
|
|
135
134
|
:param orientation: Orientation the tiers are displayed in default is horizontal
|
|
136
135
|
"""
|
|
137
136
|
|
|
138
|
-
tiers:
|
|
139
|
-
orientation:
|
|
137
|
+
tiers: TiersConfig | list[list[str]] | None = None
|
|
138
|
+
orientation: DirectionType | None = DirectionType.HORIZONTAL
|
|
140
139
|
|
|
141
140
|
|
|
142
141
|
class GroupingLayout(BaseModel):
|
|
@@ -170,7 +169,7 @@ class GroupingLayout(BaseModel):
|
|
|
170
169
|
:param group: Path within node to group property which defines the group it belong to,
|
|
171
170
|
"""
|
|
172
171
|
|
|
173
|
-
group:
|
|
172
|
+
group: str | None = None
|
|
174
173
|
|
|
175
174
|
|
|
176
175
|
class CircularLayout(GraphLayout):
|
|
@@ -232,16 +231,16 @@ class FcoseLayout(GraphLayout, TieringLayout, GroupingLayout):
|
|
|
232
231
|
|
|
233
232
|
layout_type: GraphLayoutType = Field(default=GraphLayoutType.FCOSE, frozen=True)
|
|
234
233
|
|
|
235
|
-
edge_elasticity:
|
|
236
|
-
edge_length:
|
|
237
|
-
energy:
|
|
238
|
-
gravity:
|
|
239
|
-
gravity_range:
|
|
240
|
-
high_quality:
|
|
241
|
-
iterations:
|
|
242
|
-
node_repulsion:
|
|
243
|
-
node_separation:
|
|
244
|
-
tier_separation:
|
|
234
|
+
edge_elasticity: Number | None = 0.45
|
|
235
|
+
edge_length: Number | None = 3
|
|
236
|
+
energy: Number | None = 0.1
|
|
237
|
+
gravity: Number | None = 35
|
|
238
|
+
gravity_range: Number | None = 80
|
|
239
|
+
high_quality: bool | None = True
|
|
240
|
+
iterations: int | None = 2500
|
|
241
|
+
node_repulsion: Number | None = 6_500
|
|
242
|
+
node_separation: Number | None = 75
|
|
243
|
+
tier_separation: Number | None = 200
|
|
245
244
|
|
|
246
245
|
|
|
247
246
|
class ForceAtlasLayout(GraphLayout):
|
|
@@ -270,14 +269,14 @@ class ForceAtlasLayout(GraphLayout):
|
|
|
270
269
|
|
|
271
270
|
layout_type: GraphLayoutType = Field(default=GraphLayoutType.FORCE_ATLAS, frozen=True)
|
|
272
271
|
|
|
273
|
-
barnes_hut_optimize:
|
|
274
|
-
edge_weight_influence:
|
|
275
|
-
gravity:
|
|
276
|
-
iterations:
|
|
277
|
-
lin_log_mode:
|
|
278
|
-
outbound_attraction_distribution:
|
|
279
|
-
scaling_ratio:
|
|
280
|
-
strong_gravity_mode:
|
|
272
|
+
barnes_hut_optimize: bool | None = False
|
|
273
|
+
edge_weight_influence: Number | None = 1
|
|
274
|
+
gravity: Number | None = 0.2
|
|
275
|
+
iterations: int | None = 10_000
|
|
276
|
+
lin_log_mode: bool | None = True
|
|
277
|
+
outbound_attraction_distribution: bool | None = True
|
|
278
|
+
scaling_ratio: Number | None = 8
|
|
279
|
+
strong_gravity_mode: bool | None = False
|
|
281
280
|
|
|
282
281
|
|
|
283
282
|
class MarketingLayout(GraphLayout, TieringLayout):
|
|
@@ -291,8 +290,8 @@ class MarketingLayout(GraphLayout, TieringLayout):
|
|
|
291
290
|
"""
|
|
292
291
|
|
|
293
292
|
layout_type: GraphLayoutType = Field(default=GraphLayoutType.MARKETING, frozen=True)
|
|
294
|
-
target_location:
|
|
295
|
-
tier_separation:
|
|
293
|
+
target_location: TargetLocation | None = None
|
|
294
|
+
tier_separation: Number | None = 300
|
|
296
295
|
|
|
297
296
|
|
|
298
297
|
class PlanarLayout(GraphLayout, TieringLayout):
|
|
@@ -308,8 +307,8 @@ class PlanarLayout(GraphLayout, TieringLayout):
|
|
|
308
307
|
"""
|
|
309
308
|
|
|
310
309
|
layout_type: GraphLayoutType = Field(default=GraphLayoutType.PLANAR, frozen=True)
|
|
311
|
-
layering_algorithm:
|
|
312
|
-
orientation:
|
|
310
|
+
layering_algorithm: LayeringAlgorithm | None = LayeringAlgorithm.SIMPLEX
|
|
311
|
+
orientation: DirectionType | None = None
|
|
313
312
|
|
|
314
313
|
|
|
315
314
|
class SpringLayout(GraphLayout, TieringLayout, GroupingLayout):
|
|
@@ -329,9 +328,9 @@ class SpringLayout(GraphLayout, TieringLayout, GroupingLayout):
|
|
|
329
328
|
|
|
330
329
|
layout_type: GraphLayoutType = Field(default=GraphLayoutType.SPRING, frozen=True)
|
|
331
330
|
|
|
332
|
-
collision_force:
|
|
333
|
-
gravity:
|
|
334
|
-
link_force:
|
|
335
|
-
warmup_ticks:
|
|
336
|
-
tier_separation:
|
|
337
|
-
group_repel_strength:
|
|
331
|
+
collision_force: Number | None = 2
|
|
332
|
+
gravity: Number | None = -50
|
|
333
|
+
link_force: Number | None = 5
|
|
334
|
+
warmup_ticks: Number | None = 100
|
|
335
|
+
tier_separation: Number | None = 300
|
|
336
|
+
group_repel_strength: Number | None = 2000
|
|
@@ -16,7 +16,7 @@ limitations under the License.
|
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
from json import dumps
|
|
19
|
-
from typing import Any
|
|
19
|
+
from typing import Any
|
|
20
20
|
|
|
21
21
|
from bokeh.document import Document
|
|
22
22
|
from bokeh.themes import Theme
|
|
@@ -29,7 +29,7 @@ from dara.core.definitions import StyledComponentInstance
|
|
|
29
29
|
SETTINGS = {'THEME': light_theme}
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
def _get_theme(theme_input:
|
|
32
|
+
def _get_theme(theme_input: dict | None):
|
|
33
33
|
if theme_input is not None:
|
|
34
34
|
return Theme(json=theme_input)
|
|
35
35
|
else:
|
|
@@ -52,7 +52,7 @@ class Bokeh(StyledComponentInstance):
|
|
|
52
52
|
js_module = '@darajs/components'
|
|
53
53
|
|
|
54
54
|
document: str
|
|
55
|
-
events:
|
|
55
|
+
events: list[tuple[str, Action]] | None = None
|
|
56
56
|
|
|
57
57
|
model_config = ConfigDict(arbitrary_types_allowed=True, use_enum_values=True)
|
|
58
58
|
|
|
@@ -60,8 +60,8 @@ class Bokeh(StyledComponentInstance):
|
|
|
60
60
|
self,
|
|
61
61
|
figure: Any = None,
|
|
62
62
|
document: Any = None,
|
|
63
|
-
theme:
|
|
64
|
-
events:
|
|
63
|
+
theme: dict | None = None,
|
|
64
|
+
events: list[tuple[str, Action]] | None = None,
|
|
65
65
|
**kwargs,
|
|
66
66
|
):
|
|
67
67
|
"""
|
|
@@ -15,8 +15,6 @@ See the License for the specific language governing permissions and
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
|
-
from typing import Union
|
|
19
|
-
|
|
20
18
|
from bokeh.models import CustomJS
|
|
21
19
|
from bokeh.plotting import figure
|
|
22
20
|
|
|
@@ -37,7 +35,7 @@ def figure_events(fig: figure):
|
|
|
37
35
|
:param
|
|
38
36
|
"""
|
|
39
37
|
|
|
40
|
-
def generate_event(args:
|
|
38
|
+
def generate_event(args: dict | None = None):
|
|
41
39
|
"""
|
|
42
40
|
Generate a CustomJS event with the code, event name and arguments provided
|
|
43
41
|
|
|
@@ -16,7 +16,7 @@ limitations under the License.
|
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
from enum import Enum
|
|
19
|
-
from typing import Any,
|
|
19
|
+
from typing import Any, ClassVar
|
|
20
20
|
|
|
21
21
|
import plotly.graph_objects as go
|
|
22
22
|
import plotly.io as pio
|
|
@@ -80,8 +80,8 @@ class PlotlyEvent(BaseModel):
|
|
|
80
80
|
"""
|
|
81
81
|
|
|
82
82
|
event_name: PlotlyEventName
|
|
83
|
-
actions:
|
|
84
|
-
custom_js:
|
|
83
|
+
actions: list[Action] | None = None
|
|
84
|
+
custom_js: str | None = None
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
class Plotly(StyledComponentInstance):
|
|
@@ -101,12 +101,8 @@ class Plotly(StyledComponentInstance):
|
|
|
101
101
|
fig = px.scatter(df, x='sepal_width', y='sepal_length', color='species', title='Iris Dataset Scatter Plot')
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
def plotly_page():
|
|
105
|
-
return Plotly(figure=fig, min_height=100)
|
|
106
|
-
|
|
107
|
-
|
|
108
104
|
config = ConfigurationBuilder()
|
|
109
|
-
config.add_page(
|
|
105
|
+
config.router.add_page(path='my-plot', content=Plotly(figure=fig, min_height=100))
|
|
110
106
|
```
|
|
111
107
|
|
|
112
108
|
:param figure: A plotly figure
|
|
@@ -116,10 +112,10 @@ class Plotly(StyledComponentInstance):
|
|
|
116
112
|
js_module = '@darajs/components'
|
|
117
113
|
|
|
118
114
|
figure: str
|
|
119
|
-
events:
|
|
115
|
+
events: list[PlotlyEvent] | None = None
|
|
120
116
|
|
|
121
|
-
EventName = PlotlyEventName
|
|
122
|
-
Event = PlotlyEvent
|
|
117
|
+
EventName: ClassVar[type[PlotlyEventName]] = PlotlyEventName
|
|
118
|
+
Event: ClassVar[type[PlotlyEvent]] = PlotlyEvent
|
|
123
119
|
|
|
124
120
|
model_config = ConfigDict(
|
|
125
121
|
arbitrary_types_allowed=True,
|
|
@@ -129,8 +125,8 @@ class Plotly(StyledComponentInstance):
|
|
|
129
125
|
def __init__(
|
|
130
126
|
self,
|
|
131
127
|
figure: Any = None,
|
|
132
|
-
theme:
|
|
133
|
-
events:
|
|
128
|
+
theme: dict | None = None,
|
|
129
|
+
events: list[PlotlyEvent] | None = None,
|
|
134
130
|
**kwargs,
|
|
135
131
|
):
|
|
136
132
|
if theme is None and figure is not None:
|
|
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
|
-
from typing import Any
|
|
18
|
+
from typing import Any
|
|
19
19
|
|
|
20
20
|
from dara.components.plotting.palettes import CategoricalDark10, CategoricalLight10
|
|
21
21
|
from dara.core.visual.themes import dark, light
|
|
@@ -25,7 +25,7 @@ assert light_colors is not None
|
|
|
25
25
|
dark_colors = dark.Dark.colors
|
|
26
26
|
assert dark_colors is not None
|
|
27
27
|
|
|
28
|
-
light_theme:
|
|
28
|
+
light_theme: dict[str, dict[str, Any]] = {
|
|
29
29
|
'layout': {
|
|
30
30
|
'paper_bgcolor': 'rgba(255,255,255,0)', # Set the background color of the plot
|
|
31
31
|
'plot_bgcolor': 'rgba(255,255,255,0)', # Set the background color of the plot area
|
|
@@ -85,7 +85,7 @@ light_theme: Dict[str, Dict[str, Any]] = {
|
|
|
85
85
|
},
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
dark_theme:
|
|
88
|
+
dark_theme: dict[str, dict[str, Any]] = {
|
|
89
89
|
'layout': {
|
|
90
90
|
'paper_bgcolor': 'rgba(255,255,255,0)', # Set the background color of the plot
|
|
91
91
|
'plot_bgcolor': 'rgba(255,255,255,0)', # Set the background color of the plot area
|
|
@@ -50,8 +50,8 @@ class Chat(StyledComponentInstance):
|
|
|
50
50
|
config.add_auth(MultiBasicAuthConfig(users={'user': 'password', 'user2': 'password2'}))
|
|
51
51
|
|
|
52
52
|
# Add a page with a chat component, this can be added anywhere within a page
|
|
53
|
-
config.add_page(
|
|
54
|
-
|
|
53
|
+
config.router.add_page(
|
|
54
|
+
path='chat',
|
|
55
55
|
content=Stack(
|
|
56
56
|
Text('This is a page with a chat'),
|
|
57
57
|
Chat(value=collab_variable),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Copyright (c) 2023 by Impulse Innovations Ltd. Private and confidential. Part of the causaLens product.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from
|
|
5
|
+
from collections.abc import Callable
|
|
6
6
|
|
|
7
7
|
from dara.components.smart.chat.types import NewMessageBody
|
|
8
8
|
from dara.core.definitions import EndpointConfiguration
|