instaui 0.1.4__py3-none-any.whl → 0.1.6__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.
- instaui/arco/__init__.py +191 -0
- instaui/arco/_settings.py +25 -0
- instaui/arco/_use_tools/locale.py +50 -0
- instaui/arco/component_types.py +1019 -0
- instaui/arco/components/_utils.py +22 -0
- instaui/arco/components/affix.py +29 -0
- instaui/arco/components/alert.py +42 -0
- instaui/arco/components/anchor.py +42 -0
- instaui/arco/components/auto_complete.py +96 -0
- instaui/arco/components/avatar.py +55 -0
- instaui/arco/components/back_top.py +14 -0
- instaui/arco/components/badge.py +14 -0
- instaui/arco/components/breadcrumb.py +14 -0
- instaui/arco/components/button.py +43 -0
- instaui/arco/components/calendar.py +47 -0
- instaui/arco/components/card.py +14 -0
- instaui/arco/components/carousel.py +33 -0
- instaui/arco/components/cascader.py +111 -0
- instaui/arco/components/checkbox.py +32 -0
- instaui/arco/components/collapse.py +31 -0
- instaui/arco/components/color_picker.py +45 -0
- instaui/arco/components/comment.py +14 -0
- instaui/arco/components/config_provider.py +13 -0
- instaui/arco/components/date_picker.py +111 -0
- instaui/arco/components/descriptions.py +14 -0
- instaui/arco/components/divider.py +13 -0
- instaui/arco/components/drawer.py +98 -0
- instaui/arco/components/dropdown.py +45 -0
- instaui/arco/components/empty.py +14 -0
- instaui/arco/components/form.py +55 -0
- instaui/arco/components/icon.py +17 -0
- instaui/arco/components/image.py +33 -0
- instaui/arco/components/input.py +102 -0
- instaui/arco/components/input_number.py +97 -0
- instaui/arco/components/input_password.py +38 -0
- instaui/arco/components/input_search.py +37 -0
- instaui/arco/components/input_tag.py +110 -0
- instaui/arco/components/layout.py +13 -0
- instaui/arco/components/layout_content.py +6 -0
- instaui/arco/components/layout_footer.py +6 -0
- instaui/arco/components/layout_header.py +6 -0
- instaui/arco/components/layout_sider.py +53 -0
- instaui/arco/components/link.py +36 -0
- instaui/arco/components/list.py +68 -0
- instaui/arco/components/mention.py +97 -0
- instaui/arco/components/menu.py +88 -0
- instaui/arco/components/modal.py +97 -0
- instaui/arco/components/overflow_list.py +29 -0
- instaui/arco/components/page_header.py +29 -0
- instaui/arco/components/pagination.py +45 -0
- instaui/arco/components/pop_confirm.py +58 -0
- instaui/arco/components/popover.py +32 -0
- instaui/arco/components/progress.py +14 -0
- instaui/arco/components/radio.py +40 -0
- instaui/arco/components/radio_group.py +42 -0
- instaui/arco/components/rate.py +45 -0
- instaui/arco/components/resize_box.py +62 -0
- instaui/arco/components/result.py +14 -0
- instaui/arco/components/select.py +179 -0
- instaui/arco/components/skeleton.py +14 -0
- instaui/arco/components/slider.py +38 -0
- instaui/arco/components/space.py +14 -0
- instaui/arco/components/spin.py +14 -0
- instaui/arco/components/split.py +76 -0
- instaui/arco/components/statistic.py +14 -0
- instaui/arco/components/steps.py +32 -0
- instaui/arco/components/switch.py +57 -0
- instaui/arco/components/tab_pane.py +12 -0
- instaui/arco/components/table.py +276 -0
- instaui/arco/components/tabs.py +101 -0
- instaui/arco/components/tag.py +42 -0
- instaui/arco/components/textarea.py +84 -0
- instaui/arco/components/time_picker.py +76 -0
- instaui/arco/components/timeline.py +14 -0
- instaui/arco/components/tooltip.py +29 -0
- instaui/arco/components/transfer.py +58 -0
- instaui/arco/components/tree.py +120 -0
- instaui/arco/components/tree_select.py +86 -0
- instaui/arco/components/trigger.py +58 -0
- instaui/arco/components/typography.py +142 -0
- instaui/arco/components/upload.py +71 -0
- instaui/arco/components/verification_code.py +58 -0
- instaui/arco/components/watermark.py +14 -0
- instaui/arco/locales/__init__.py +4 -0
- instaui/arco/locales/_index.py +31 -0
- instaui/arco/locales/en_us.py +227 -0
- instaui/arco/locales/zh_cn.py +224 -0
- instaui/arco/setup.py +36 -0
- instaui/arco/static/instaui-arco.css +1 -0
- instaui/arco/static/instaui-arco.js +55771 -0
- instaui/arco/types.py +24 -0
- instaui/components/column.py +10 -2
- instaui/components/echarts/echarts.js +128 -0
- instaui/components/echarts/echarts.py +194 -0
- instaui/components/echarts/static/echarts.esm.min.js +45 -0
- instaui/components/element.py +50 -6
- instaui/components/grid.py +81 -0
- instaui/components/html/__init__.py +30 -19
- instaui/components/html/_preset.py +4 -0
- instaui/components/html/heading.py +51 -0
- instaui/components/html/range.py +3 -0
- instaui/components/html/select.py +13 -31
- instaui/components/html/table.py +36 -0
- instaui/components/markdown/static/github-markdown.css +1 -1
- instaui/components/markdown/static/marked.esm.js +0 -1
- instaui/components/row.py +8 -7
- instaui/components/shiki_code/shiki_code.js +126 -0
- instaui/components/shiki_code/shiki_code.py +99 -0
- instaui/components/shiki_code/static/langs/css.mjs +5 -0
- instaui/components/shiki_code/static/langs/markdown.mjs +5 -0
- instaui/components/shiki_code/static/langs/python.mjs +5 -0
- instaui/components/shiki_code/static/langs/shell.mjs +2 -0
- instaui/components/shiki_code/static/langs/shellscript.mjs +5 -0
- instaui/components/shiki_code/static/shiki-core.js +5784 -0
- instaui/components/shiki_code/static/shiki-style.css +179 -0
- instaui/components/shiki_code/static/shiki-transformers.js +461 -0
- instaui/components/shiki_code/static/themes/vitesse-dark.mjs +2 -0
- instaui/components/shiki_code/static/themes/vitesse-light.mjs +2 -0
- instaui/components/value_element.py +7 -3
- instaui/consts.py +2 -1
- instaui/event/js_event.py +1 -0
- instaui/event/web_event.py +6 -7
- instaui/experimental/link_sql/__init__.py +3 -0
- instaui/experimental/link_sql/_base.py +23 -0
- instaui/experimental/link_sql/_duckdb.py +221 -0
- instaui/experimental/link_sql/_types.py +15 -0
- instaui/experimental/link_sql/data_source.js +50 -0
- instaui/fastapi_server/debug_mode_router.py +1 -1
- instaui/fastapi_server/server.py +4 -12
- instaui/handlers/event_handler.py +3 -1
- instaui/handlers/watch_handler.py +4 -0
- instaui/html_tools.py +41 -4
- instaui/runtime/_app.py +37 -3
- instaui/runtime/_link_manager.py +89 -0
- instaui/runtime/resource.py +19 -9
- instaui/runtime/scope.py +28 -7
- instaui/shadcn_classless/_index.py +42 -0
- instaui/shadcn_classless/static/shadcn-classless.css +403 -0
- instaui/static/insta-ui.css +1 -1
- instaui/static/insta-ui.esm-browser.prod.js +3663 -3658
- instaui/static/insta-ui.js.map +1 -1
- instaui/static/instaui-tools-browser.js +511 -0
- instaui/static/templates/debug/sse.html +1 -1
- instaui/static/templates/webview.html +78 -0
- instaui/tailwind/__init__.py +6 -0
- instaui/tailwind/_index.py +24 -0
- instaui/{static/tailwindcss.min.js → tailwind/static/tailwindcss-v3.min.js} +62 -62
- instaui/tailwind/static/tailwindcss-v4.min.js +8 -0
- instaui/template/_utils.py +23 -0
- instaui/template/webview_template.py +50 -0
- instaui/ui/__init__.py +8 -2
- instaui/ui/__init__.pyi +7 -1
- instaui/ui_functions/ui_page.py +1 -1
- instaui/vars/data.py +7 -7
- instaui/vars/element_ref.py +2 -4
- instaui/vars/event_context.py +4 -0
- instaui/vars/js_computed.py +6 -8
- instaui/vars/ref.py +6 -6
- instaui/vars/vue_computed.py +6 -7
- instaui/vars/web_computed.py +31 -32
- instaui/watch/vue_watch.py +23 -7
- instaui/watch/web_watch.py +5 -6
- instaui/webview/__init__.py +1 -0
- instaui/webview/_utils.py +8 -0
- instaui/webview/api.py +72 -0
- instaui/webview/func.py +114 -0
- instaui/webview/index.py +162 -0
- instaui/webview/resource.py +172 -0
- instaui/zero/func.py +19 -12
- instaui/zero/scope.py +29 -28
- {instaui-0.1.4.dist-info → instaui-0.1.6.dist-info}/METADATA +6 -2
- instaui-0.1.6.dist-info/RECORD +286 -0
- instaui/components/highlight_code/code.js +0 -63
- instaui/components/highlight_code/code.py +0 -117
- instaui/components/highlight_code/static/core.min.js +0 -307
- instaui/components/highlight_code/static/languages/css.min.js +0 -31
- instaui/components/highlight_code/static/languages/javascript.min.js +0 -81
- instaui/components/highlight_code/static/languages/json.min.js +0 -8
- instaui/components/highlight_code/static/languages/python-repl.min.js +0 -5
- instaui/components/highlight_code/static/languages/python.min.js +0 -42
- instaui/components/highlight_code/static/languages/shell.min.js +0 -5
- instaui/components/highlight_code/static/styles/default.min.css +0 -9
- instaui/components/highlight_code/static/styles/github-dark-dimmed.min.css +0 -9
- instaui/components/highlight_code/static/styles/github-dark.min.css +0 -10
- instaui/components/highlight_code/static/styles/github.min.css +0 -10
- instaui/daisyui/__init__.py +0 -20
- instaui/daisyui/_index.py +0 -15
- instaui/daisyui/button.py +0 -38
- instaui/daisyui/checkbox.py +0 -17
- instaui/daisyui/static/daisyui.css +0 -1
- instaui/daisyui/static/themes.css +0 -1
- instaui/handlers/computed_handler.py +0 -42
- instaui/handlers/config_handler.py +0 -13
- instaui/ui/__build_init.py +0 -73
- instaui/vars/_utils.py +0 -12
- instaui-0.1.4.dist-info/RECORD +0 -179
- {instaui-0.1.4.dist-info → instaui-0.1.6.dist-info}/LICENSE +0 -0
- {instaui-0.1.4.dist-info → instaui-0.1.6.dist-info}/WHEEL +0 -0
instaui/arco/types.py
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
from typing import Any, Dict, Literal
|
2
|
+
|
3
|
+
|
4
|
+
TLocale = Literal[
|
5
|
+
"zh-CN",
|
6
|
+
"en-US",
|
7
|
+
"ja-JP",
|
8
|
+
"zh-TW",
|
9
|
+
"pt-PT",
|
10
|
+
"es-ES",
|
11
|
+
"id-ID",
|
12
|
+
"fr-FR",
|
13
|
+
"de-DE",
|
14
|
+
"ko-KR",
|
15
|
+
"it-IT",
|
16
|
+
"ms-MY",
|
17
|
+
"th-TH",
|
18
|
+
"vi-VN",
|
19
|
+
"km-KH",
|
20
|
+
"ar-EG",
|
21
|
+
"ru-RU",
|
22
|
+
]
|
23
|
+
|
24
|
+
TCustomizeLocale = Dict[str, Any]
|
instaui/components/column.py
CHANGED
@@ -2,12 +2,20 @@ from __future__ import annotations
|
|
2
2
|
from typing import Literal
|
3
3
|
from instaui.components.element import Element
|
4
4
|
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.vars.js_computed import JsComputed
|
5
6
|
|
6
7
|
|
7
8
|
class Column(Element):
|
8
|
-
def __init__(self):
|
9
|
+
def __init__(self, *, inline: TMaybeRef[bool] = False):
|
9
10
|
super().__init__("div")
|
10
|
-
|
11
|
+
|
12
|
+
flex = JsComputed(
|
13
|
+
inputs=[inline], code="inline => inline? 'inline-flex' : 'flex'"
|
14
|
+
)
|
15
|
+
|
16
|
+
self.style("flex-direction: column;gap:var(--insta-column-gap)").style(
|
17
|
+
{"display": flex}
|
18
|
+
)
|
11
19
|
|
12
20
|
def gap(self, value: TMaybeRef[str]) -> Column:
|
13
21
|
return self.style({"gap": value})
|
@@ -0,0 +1,128 @@
|
|
1
|
+
import { h, onMounted, shallowRef, watch } from "vue";
|
2
|
+
import * as echarts from 'echarts';
|
3
|
+
|
4
|
+
|
5
|
+
export default {
|
6
|
+
props: ['option', 'theme', 'initOptions', 'resizeOption', 'updateOptions', 'chartEvents', 'zrEvents'],
|
7
|
+
setup(props, { attrs, emit }) {
|
8
|
+
const root = shallowRef();
|
9
|
+
const chartIns = shallowRef();
|
10
|
+
|
11
|
+
onMounted(() => {
|
12
|
+
init(root, chartIns, props);
|
13
|
+
autoResize(root, chartIns, props);
|
14
|
+
|
15
|
+
setOption(root, chartIns, props);
|
16
|
+
setChartEvents(root, chartIns, emit, props);
|
17
|
+
})
|
18
|
+
|
19
|
+
watch(() => props.option, (newVal, oldVal) => {
|
20
|
+
|
21
|
+
setOption(root, chartIns, props);
|
22
|
+
|
23
|
+
}, { deep: true })
|
24
|
+
|
25
|
+
|
26
|
+
return () => {
|
27
|
+
return h("div", { ...attrs, ref: root })
|
28
|
+
};
|
29
|
+
}
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
|
34
|
+
function init(root, chartIns, props) {
|
35
|
+
if (!root.value) {
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
|
39
|
+
chartIns.value = echarts.init(
|
40
|
+
root.value,
|
41
|
+
props.theme,
|
42
|
+
props.initOptions,
|
43
|
+
)
|
44
|
+
}
|
45
|
+
|
46
|
+
|
47
|
+
function setOption(root, chartIns, props) {
|
48
|
+
if (!chartIns.value) {
|
49
|
+
init(root, chartIns, props);
|
50
|
+
} else {
|
51
|
+
chartIns.value.setOption(props.option, props.updateOptions || {});
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
function autoResize(root, chartIns, props) {
|
57
|
+
|
58
|
+
watch(() => props.resizeOption, (resizeOption, _, onCleanup) => {
|
59
|
+
|
60
|
+
let ro = null;
|
61
|
+
|
62
|
+
if (resizeOption) {
|
63
|
+
const { offsetWidth, offsetHeight } = root.value;
|
64
|
+
const { throttle = 100 } = resizeOption;
|
65
|
+
|
66
|
+
let isInitialResize = false;
|
67
|
+
const callback = () => {
|
68
|
+
chartIns.value.resize()
|
69
|
+
}
|
70
|
+
const resizeCallback = throttle ? echarts.throttle(callback, throttle) : callback;
|
71
|
+
|
72
|
+
ro = new ResizeObserver(() => {
|
73
|
+
|
74
|
+
if (!isInitialResize) {
|
75
|
+
isInitialResize = true;
|
76
|
+
if (
|
77
|
+
root.offsetWidth === offsetWidth &&
|
78
|
+
root.offsetHeight === offsetHeight
|
79
|
+
) {
|
80
|
+
return;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
resizeCallback();
|
84
|
+
})
|
85
|
+
|
86
|
+
ro.observe(root.value);
|
87
|
+
}
|
88
|
+
|
89
|
+
onCleanup(() => {
|
90
|
+
if (ro) {
|
91
|
+
ro.disconnect();
|
92
|
+
ro = null;
|
93
|
+
}
|
94
|
+
});
|
95
|
+
|
96
|
+
}, { deep: true, immediate: true })
|
97
|
+
|
98
|
+
}
|
99
|
+
|
100
|
+
|
101
|
+
function setChartEvents(root, chartIns, emit, props) {
|
102
|
+
|
103
|
+
const { chartEvents, zrEvents } = props;
|
104
|
+
|
105
|
+
if (chartEvents) {
|
106
|
+
chartEvents.forEach(event => {
|
107
|
+
chartIns.value.on(event, (...args) => {
|
108
|
+
const eventArgs = args[0]
|
109
|
+
delete eventArgs['event']
|
110
|
+
delete eventArgs['$vars']
|
111
|
+
|
112
|
+
emit(`chart:${event}`, ...args)
|
113
|
+
});
|
114
|
+
})
|
115
|
+
}
|
116
|
+
|
117
|
+
if (zrEvents) {
|
118
|
+
zrEvents.forEach(event => {
|
119
|
+
chartIns.value.getZr().on(event, (...args) => emit(`zr:${event}`, ...args));
|
120
|
+
})
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
}
|
128
|
+
|
@@ -0,0 +1,194 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
from typing import Dict, Literal, Optional, Set, Union
|
3
|
+
from typing_extensions import TypedDict
|
4
|
+
from instaui import ui
|
5
|
+
from instaui.event.event_mixin import EventMixin
|
6
|
+
|
7
|
+
_STATIC_DIR = Path(__file__).parent / "static"
|
8
|
+
_ECHARTS_JS_FILE = _STATIC_DIR / "echarts.esm.min.js"
|
9
|
+
|
10
|
+
|
11
|
+
_IMPORT_MAPS = {
|
12
|
+
"echarts": _ECHARTS_JS_FILE,
|
13
|
+
}
|
14
|
+
|
15
|
+
|
16
|
+
TEChartsEvent = Literal[
|
17
|
+
"highlight",
|
18
|
+
"downplay",
|
19
|
+
"selectchanged",
|
20
|
+
"legendselectchanged",
|
21
|
+
"legendselected",
|
22
|
+
"legendunselected",
|
23
|
+
"legendselectall",
|
24
|
+
"legendinverseselect",
|
25
|
+
"legendscroll",
|
26
|
+
"datazoom",
|
27
|
+
"datarangeselected",
|
28
|
+
"timelinechanged",
|
29
|
+
"timelineplaychanged",
|
30
|
+
"restore",
|
31
|
+
"dataviewchanged",
|
32
|
+
"magictypechanged",
|
33
|
+
"geoselectchanged",
|
34
|
+
"geoselected",
|
35
|
+
"geounselected",
|
36
|
+
"axisareaselected",
|
37
|
+
"brush",
|
38
|
+
"brushEnd",
|
39
|
+
"brushselected",
|
40
|
+
"globalcursortaken",
|
41
|
+
"rendered",
|
42
|
+
"finished",
|
43
|
+
"click",
|
44
|
+
"dblclick",
|
45
|
+
"mouseover",
|
46
|
+
"mouseout",
|
47
|
+
"mousemove",
|
48
|
+
"mousedown",
|
49
|
+
"mouseup",
|
50
|
+
"globalout",
|
51
|
+
"contextmenu",
|
52
|
+
]
|
53
|
+
|
54
|
+
|
55
|
+
TZRenderEvent = Literal[
|
56
|
+
"click", "mousedown", "mouseup", "mousewheel", "dblclick", "contextmenu"
|
57
|
+
]
|
58
|
+
|
59
|
+
|
60
|
+
class TResizeOptions(TypedDict, total=False):
|
61
|
+
throttle: int
|
62
|
+
|
63
|
+
|
64
|
+
class TInitOptions(TypedDict, total=False):
|
65
|
+
devicePixelRatio: int
|
66
|
+
renderer: Literal["canvas", "svg"]
|
67
|
+
width: Union[int, str]
|
68
|
+
height: Union[int, str]
|
69
|
+
locale: str
|
70
|
+
pointerSize: int
|
71
|
+
|
72
|
+
|
73
|
+
class ECharts(
|
74
|
+
ui.element,
|
75
|
+
esm="./echarts.js",
|
76
|
+
externals=_IMPORT_MAPS,
|
77
|
+
):
|
78
|
+
"""ECharts component
|
79
|
+
|
80
|
+
Example usage:
|
81
|
+
.. code-block:: python
|
82
|
+
|
83
|
+
opts = {
|
84
|
+
"title": {"text": "ECharts Getting Started Example"},
|
85
|
+
"tooltip": {},
|
86
|
+
"legend": {"data": ["sales"]},
|
87
|
+
"xAxis": {
|
88
|
+
"data": ["Shirts", "Cardigans", "Chiffons", "Pants", "Heels", "Socks"]
|
89
|
+
},
|
90
|
+
"yAxis": {},
|
91
|
+
"series": [{"name": "sales", "type": "bar", "data": [5, 20, 36, 10, 10, 20]}],
|
92
|
+
}
|
93
|
+
|
94
|
+
ui.echarts(opts)
|
95
|
+
|
96
|
+
"""
|
97
|
+
|
98
|
+
def __init__(
|
99
|
+
self,
|
100
|
+
option: ui.TMaybeRef[Dict],
|
101
|
+
*,
|
102
|
+
theme: Optional[Union[Path, str, Dict]] = None,
|
103
|
+
init_options: Optional[TInitOptions] = None,
|
104
|
+
update_options: Optional[Dict] = None,
|
105
|
+
resize_options: Optional[TResizeOptions] = None,
|
106
|
+
):
|
107
|
+
"""Create an ECharts component
|
108
|
+
|
109
|
+
Args:
|
110
|
+
option (ui.TMaybeRef[Dict]): Chart option.
|
111
|
+
theme (Optional[Union[Path, str, Dict]], optional): Theme file or object. Defaults to None.
|
112
|
+
init_options (Optional[TInitOptions], optional): Chart initialization options. Defaults to None.
|
113
|
+
update_options (Optional[Dict], optional): Chart update options. Defaults to None.
|
114
|
+
resize_options (Optional[TResizeOptions], optional): Chart resize options. Defaults to None.
|
115
|
+
|
116
|
+
Example usage:
|
117
|
+
|
118
|
+
resize_options:
|
119
|
+
|
120
|
+
.. code-block:: python
|
121
|
+
ui.echarts(opts, resize_options={"throttle": 100})
|
122
|
+
|
123
|
+
chart event:
|
124
|
+
.. code-block:: python
|
125
|
+
opts = ui.state(
|
126
|
+
{
|
127
|
+
"title": {"text": "ECharts Getting Started Example"},
|
128
|
+
"tooltip": {},
|
129
|
+
"legend": {"data": ["sales"]},
|
130
|
+
"xAxis": {
|
131
|
+
"data": ["Shirts", "Cardigans", "Chiffons", "Pants", "Heels", "Socks"]
|
132
|
+
},
|
133
|
+
"yAxis": {},
|
134
|
+
"series": [
|
135
|
+
{"name": "sales", "type": "bar", "data": [5, 20, 36, 10, 10, 20]}
|
136
|
+
],
|
137
|
+
}
|
138
|
+
)
|
139
|
+
|
140
|
+
msg = ui.state("Click the bars in the chart.")
|
141
|
+
|
142
|
+
@ui.event(inputs=[ui.event_context.e()], outputs=[msg])
|
143
|
+
def click(arg):
|
144
|
+
return f'You clicked on "{arg["name"]}"'
|
145
|
+
|
146
|
+
ui.content(msg)
|
147
|
+
ui.echarts(opts).on_chart("click", click)
|
148
|
+
|
149
|
+
"""
|
150
|
+
|
151
|
+
super().__init__()
|
152
|
+
self._chart_events: Set[str] = set()
|
153
|
+
self._zr_events: Set[str] = set()
|
154
|
+
self.props({"option": option})
|
155
|
+
|
156
|
+
if init_options:
|
157
|
+
self.props({"initOptions": init_options})
|
158
|
+
|
159
|
+
if update_options:
|
160
|
+
self.props({"updateOptions": update_options})
|
161
|
+
|
162
|
+
if theme:
|
163
|
+
if isinstance(theme, (str, Path)):
|
164
|
+
raise NotImplementedError("Theme file not supported yet")
|
165
|
+
else:
|
166
|
+
self.props({"theme": theme})
|
167
|
+
|
168
|
+
self.props({"resizeOption": resize_options or {}})
|
169
|
+
|
170
|
+
self.style("width: 100%; height: 100%;min-width:0;")
|
171
|
+
|
172
|
+
def on_chart(
|
173
|
+
self,
|
174
|
+
event_name: TEChartsEvent,
|
175
|
+
handler: EventMixin,
|
176
|
+
):
|
177
|
+
self._chart_events.add(event_name)
|
178
|
+
return self.on(f"chart:{event_name}", handler)
|
179
|
+
|
180
|
+
def on_zr(self, event_name: TZRenderEvent, handler: EventMixin):
|
181
|
+
self._zr_events.add(event_name)
|
182
|
+
return self.on(f"zr:{event_name}", handler)
|
183
|
+
|
184
|
+
def _to_json_dict(self):
|
185
|
+
data = super()._to_json_dict()
|
186
|
+
props = data.get("props", {})
|
187
|
+
|
188
|
+
if self._chart_events:
|
189
|
+
props["chartEvents"] = list(self._chart_events)
|
190
|
+
|
191
|
+
if self._zr_events:
|
192
|
+
props["zrEvents"] = list(self._zr_events)
|
193
|
+
|
194
|
+
return data
|