instaui 0.1.15__py2.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/__init__.py +9 -0
- instaui/_helper/observable_helper.py +45 -0
- 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 +182 -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/boot_info.py +43 -0
- instaui/common/jsonable.py +37 -0
- instaui/components/__init__.py +0 -0
- instaui/components/column.py +26 -0
- instaui/components/component.py +47 -0
- instaui/components/content.py +34 -0
- instaui/components/directive.py +55 -0
- instaui/components/element.py +573 -0
- instaui/components/grid.py +213 -0
- instaui/components/html/__init__.py +49 -0
- instaui/components/html/_mixins.py +34 -0
- instaui/components/html/_preset.py +4 -0
- instaui/components/html/button.py +38 -0
- instaui/components/html/checkbox.py +35 -0
- instaui/components/html/date.py +28 -0
- instaui/components/html/div.py +7 -0
- instaui/components/html/form.py +7 -0
- instaui/components/html/heading.py +51 -0
- instaui/components/html/input.py +28 -0
- instaui/components/html/label.py +21 -0
- instaui/components/html/li.py +17 -0
- instaui/components/html/link.py +31 -0
- instaui/components/html/number.py +34 -0
- instaui/components/html/paragraph.py +29 -0
- instaui/components/html/range.py +48 -0
- instaui/components/html/select.py +69 -0
- instaui/components/html/span.py +19 -0
- instaui/components/html/table.py +36 -0
- instaui/components/html/textarea.py +28 -0
- instaui/components/html/ul.py +20 -0
- instaui/components/label.py +5 -0
- instaui/components/markdown/markdown.js +33 -0
- instaui/components/markdown/markdown.py +41 -0
- instaui/components/markdown/static/github-markdown.css +12 -0
- instaui/components/markdown/static/marked.esm.js +2579 -0
- instaui/components/match.py +108 -0
- instaui/components/row.py +17 -0
- 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/slot.py +81 -0
- instaui/components/transition_group.py +9 -0
- instaui/components/value_element.py +52 -0
- instaui/components/vfor.py +142 -0
- instaui/components/vif.py +42 -0
- instaui/consts.py +23 -0
- instaui/dependencies/component_dependency.py +22 -0
- instaui/dependencies/plugin_dependency.py +28 -0
- instaui/event/event_mixin.py +12 -0
- instaui/event/js_event.py +82 -0
- instaui/event/vue_event.py +66 -0
- instaui/event/web_event.py +123 -0
- instaui/experimental/__init__.py +3 -0
- instaui/experimental/debug.py +48 -0
- instaui/extra_libs/_echarts.py +3 -0
- instaui/extra_libs/_import_error.py +9 -0
- instaui/extra_libs/_mermaid.py +3 -0
- instaui/extra_libs/_shiki_code.py +3 -0
- instaui/fastapi_server/_utils.py +42 -0
- instaui/fastapi_server/_uvicorn.py +37 -0
- instaui/fastapi_server/debug_mode_router.py +60 -0
- instaui/fastapi_server/dependency_router.py +28 -0
- instaui/fastapi_server/event_router.py +58 -0
- instaui/fastapi_server/middlewares.py +19 -0
- instaui/fastapi_server/request_context.py +19 -0
- instaui/fastapi_server/resource.py +30 -0
- instaui/fastapi_server/server.py +308 -0
- instaui/fastapi_server/watch_router.py +53 -0
- instaui/handlers/_utils.py +88 -0
- instaui/handlers/event_handler.py +60 -0
- instaui/handlers/watch_handler.py +61 -0
- instaui/html_tools.py +94 -0
- instaui/inject.py +33 -0
- instaui/js/__init__.py +4 -0
- instaui/js/js_output.py +15 -0
- instaui/js/lambda_func.py +35 -0
- instaui/launch_collector.py +52 -0
- instaui/page_info.py +13 -0
- instaui/runtime/__init__.py +29 -0
- instaui/runtime/_app.py +234 -0
- instaui/runtime/_inner_helper.py +9 -0
- instaui/runtime/_link_manager.py +89 -0
- instaui/runtime/context.py +47 -0
- instaui/runtime/dataclass.py +30 -0
- instaui/runtime/resource.py +65 -0
- instaui/runtime/scope.py +133 -0
- instaui/runtime/ui_state_scope.py +15 -0
- instaui/settings/__init__.py +4 -0
- instaui/settings/__settings.py +13 -0
- instaui/shadcn_classless/_index.py +42 -0
- instaui/shadcn_classless/static/shadcn-classless.css +403 -0
- instaui/skip.py +12 -0
- instaui/spa_router/__init__.py +26 -0
- instaui/spa_router/_components.py +35 -0
- instaui/spa_router/_file_base_utils.py +273 -0
- instaui/spa_router/_functions.py +122 -0
- instaui/spa_router/_install.py +11 -0
- instaui/spa_router/_route_model.py +117 -0
- instaui/spa_router/_router_box.py +40 -0
- instaui/spa_router/_router_output.py +22 -0
- instaui/spa_router/_router_param_var.py +51 -0
- instaui/spa_router/_types.py +4 -0
- instaui/spa_router/templates/page_routes +60 -0
- instaui/static/insta-ui.css +1 -0
- instaui/static/insta-ui.esm-browser.prod.js +3717 -0
- instaui/static/insta-ui.ico +0 -0
- instaui/static/insta-ui.js.map +1 -0
- instaui/static/instaui-tools-browser.js +511 -0
- instaui/static/templates/debug/sse.html +117 -0
- instaui/static/templates/web.html +74 -0
- instaui/static/templates/webview.html +78 -0
- instaui/static/templates/zero.html +71 -0
- instaui/static/vue.esm-browser.prod.js +9 -0
- instaui/static/vue.global.prod.js +9 -0
- instaui/static/vue.runtime.esm-browser.prod.js +5 -0
- instaui/systems/file_system.py +6 -0
- instaui/systems/func_system.py +119 -0
- instaui/systems/js_system.py +22 -0
- instaui/systems/module_system.py +46 -0
- instaui/systems/pydantic_system.py +27 -0
- instaui/systems/string_system.py +10 -0
- instaui/tailwind/__init__.py +6 -0
- instaui/tailwind/_index.py +24 -0
- instaui/tailwind/static/tailwindcss-v3.min.js +62 -0
- instaui/tailwind/static/tailwindcss-v4.min.js +8 -0
- instaui/template/__init__.py +4 -0
- instaui/template/_utils.py +23 -0
- instaui/template/env.py +7 -0
- instaui/template/web_template.py +49 -0
- instaui/template/webview_template.py +48 -0
- instaui/template/zero_template.py +105 -0
- instaui/ui/__init__.py +144 -0
- instaui/ui/__init__.pyi +149 -0
- instaui/ui/events.py +25 -0
- instaui/ui_functions/input_slient_data.py +16 -0
- instaui/ui_functions/server.py +15 -0
- instaui/ui_functions/str_format.py +36 -0
- instaui/ui_functions/ui_page.py +16 -0
- instaui/ui_functions/ui_types.py +13 -0
- instaui/ui_functions/url_location.py +33 -0
- instaui/vars/_types.py +8 -0
- instaui/vars/data.py +68 -0
- instaui/vars/element_ref.py +40 -0
- instaui/vars/event_context.py +49 -0
- instaui/vars/event_extend.py +0 -0
- instaui/vars/js_computed.py +117 -0
- instaui/vars/mixin_types/common_type.py +5 -0
- instaui/vars/mixin_types/element_binding.py +16 -0
- instaui/vars/mixin_types/observable.py +7 -0
- instaui/vars/mixin_types/pathable.py +14 -0
- instaui/vars/mixin_types/py_binding.py +13 -0
- instaui/vars/mixin_types/str_format_binding.py +8 -0
- instaui/vars/mixin_types/var_type.py +5 -0
- instaui/vars/path_var.py +90 -0
- instaui/vars/ref.py +103 -0
- instaui/vars/slot_prop.py +46 -0
- instaui/vars/state.py +97 -0
- instaui/vars/types.py +24 -0
- instaui/vars/vfor_item.py +204 -0
- instaui/vars/vue_computed.py +81 -0
- instaui/vars/web_computed.py +209 -0
- instaui/vars/web_view_computed.py +1 -0
- instaui/version.py +3 -0
- instaui/watch/_types.py +4 -0
- instaui/watch/_utils.py +3 -0
- instaui/watch/js_watch.py +110 -0
- instaui/watch/vue_watch.py +77 -0
- instaui/watch/web_watch.py +181 -0
- instaui/webview/__init__.py +2 -0
- instaui/webview/_utils.py +8 -0
- instaui/webview/api.py +72 -0
- instaui/webview/func.py +114 -0
- instaui/webview/index.py +161 -0
- instaui/webview/resource.py +172 -0
- instaui/zero/__init__.py +3 -0
- instaui/zero/func.py +123 -0
- instaui/zero/scope.py +109 -0
- instaui-0.1.15.dist-info/METADATA +152 -0
- instaui-0.1.15.dist-info/RECORD +283 -0
- instaui-0.1.15.dist-info/WHEEL +5 -0
- instaui-0.1.15.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
|
10
|
+
class Pagination(Element):
|
11
|
+
def __init__(
|
12
|
+
self,
|
13
|
+
current_value: typing.Optional[TMaybeRef[int]] = None,
|
14
|
+
**kwargs: Unpack[component_types.TPagination],
|
15
|
+
):
|
16
|
+
super().__init__("a-pagination")
|
17
|
+
|
18
|
+
try_setup_vmodel(self, current_value, prop_name="current")
|
19
|
+
self.props(handle_props(kwargs)) # type: ignore
|
20
|
+
|
21
|
+
def on_change(
|
22
|
+
self,
|
23
|
+
handler: EventMixin,
|
24
|
+
*,
|
25
|
+
extends: typing.Optional[typing.List] = None,
|
26
|
+
):
|
27
|
+
self.on(
|
28
|
+
"change",
|
29
|
+
handler,
|
30
|
+
extends=extends,
|
31
|
+
)
|
32
|
+
return self
|
33
|
+
|
34
|
+
def on_page_size_change(
|
35
|
+
self,
|
36
|
+
handler: EventMixin,
|
37
|
+
*,
|
38
|
+
extends: typing.Optional[typing.List] = None,
|
39
|
+
):
|
40
|
+
self.on(
|
41
|
+
"page-size-change",
|
42
|
+
handler,
|
43
|
+
extends=extends,
|
44
|
+
)
|
45
|
+
return self
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
|
10
|
+
class PopConfirm(Element):
|
11
|
+
def __init__(
|
12
|
+
self,
|
13
|
+
popup_visible_value: typing.Optional[TMaybeRef[str]] = None,
|
14
|
+
**kwargs: Unpack[component_types.TPopconfirm],
|
15
|
+
):
|
16
|
+
super().__init__("a-popconfirm")
|
17
|
+
|
18
|
+
try_setup_vmodel(self, popup_visible_value, prop_name="popup-visible")
|
19
|
+
self.props(handle_props(kwargs)) # type: ignore
|
20
|
+
|
21
|
+
def on_popup_visible_change(
|
22
|
+
self,
|
23
|
+
handler: EventMixin,
|
24
|
+
*,
|
25
|
+
extends: typing.Optional[typing.List] = None,
|
26
|
+
):
|
27
|
+
self.on(
|
28
|
+
"popup-visible-change",
|
29
|
+
handler,
|
30
|
+
extends=extends,
|
31
|
+
)
|
32
|
+
return self
|
33
|
+
|
34
|
+
def on_ok(
|
35
|
+
self,
|
36
|
+
handler: EventMixin,
|
37
|
+
*,
|
38
|
+
extends: typing.Optional[typing.List] = None,
|
39
|
+
):
|
40
|
+
self.on(
|
41
|
+
"ok",
|
42
|
+
handler,
|
43
|
+
extends=extends,
|
44
|
+
)
|
45
|
+
return self
|
46
|
+
|
47
|
+
def on_cancel(
|
48
|
+
self,
|
49
|
+
handler: EventMixin,
|
50
|
+
*,
|
51
|
+
extends: typing.Optional[typing.List] = None,
|
52
|
+
):
|
53
|
+
self.on(
|
54
|
+
"cancel",
|
55
|
+
handler,
|
56
|
+
extends=extends,
|
57
|
+
)
|
58
|
+
return self
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.vars.types import TMaybeRef
|
4
|
+
from instaui.components.element import Element
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
|
10
|
+
class Popover(Element):
|
11
|
+
def __init__(
|
12
|
+
self,
|
13
|
+
popup_visible_value: typing.Optional[TMaybeRef[str]] = None,
|
14
|
+
**kwargs: Unpack[component_types.TPopover],
|
15
|
+
):
|
16
|
+
super().__init__("a-popover")
|
17
|
+
|
18
|
+
try_setup_vmodel(self, popup_visible_value, prop_name="popup-visible")
|
19
|
+
self.props(handle_props(kwargs)) # type: ignore
|
20
|
+
|
21
|
+
def on_popup_visible_change(
|
22
|
+
self,
|
23
|
+
handler: EventMixin,
|
24
|
+
*,
|
25
|
+
extends: typing.Optional[typing.List] = None,
|
26
|
+
):
|
27
|
+
self.on(
|
28
|
+
"popup-visible-change",
|
29
|
+
handler,
|
30
|
+
extends=extends,
|
31
|
+
)
|
32
|
+
return self
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from typing_extensions import Unpack
|
2
|
+
from instaui.components.element import Element
|
3
|
+
from instaui.arco import component_types
|
4
|
+
from ._utils import handle_props
|
5
|
+
|
6
|
+
|
7
|
+
class Progress(Element):
|
8
|
+
def __init__(
|
9
|
+
self,
|
10
|
+
**kwargs: Unpack[component_types.TProgress],
|
11
|
+
):
|
12
|
+
super().__init__("a-progress")
|
13
|
+
|
14
|
+
self.props(handle_props(kwargs)) # type: ignore
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
import pydantic
|
4
|
+
from instaui.components.element import Element
|
5
|
+
from instaui.vars.types import TMaybeRef
|
6
|
+
from instaui.vars.state import StateModel
|
7
|
+
from instaui.arco import component_types
|
8
|
+
from instaui.event.event_mixin import EventMixin
|
9
|
+
from ._utils import handle_props, try_setup_vmodel
|
10
|
+
|
11
|
+
|
12
|
+
class Radio(Element):
|
13
|
+
def __init__(
|
14
|
+
self,
|
15
|
+
value: typing.Optional[TMaybeRef[typing.Union[str, int, bool, float]]] = None,
|
16
|
+
**kwargs: Unpack[component_types.TRadio],
|
17
|
+
):
|
18
|
+
super().__init__("a-radio")
|
19
|
+
|
20
|
+
self.props({"value": value})
|
21
|
+
self.props(handle_props(kwargs)) # type: ignore
|
22
|
+
|
23
|
+
def on_change(
|
24
|
+
self,
|
25
|
+
handler: EventMixin,
|
26
|
+
*,
|
27
|
+
extends: typing.Optional[typing.List] = None,
|
28
|
+
):
|
29
|
+
self.on(
|
30
|
+
"change",
|
31
|
+
handler,
|
32
|
+
extends=extends,
|
33
|
+
)
|
34
|
+
return self
|
35
|
+
|
36
|
+
|
37
|
+
class RadioOption(StateModel):
|
38
|
+
label: str
|
39
|
+
value: typing.Union[str, int]
|
40
|
+
disabled: bool = pydantic.Field(default=False)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack, TypedDict
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.event.event_mixin import EventMixin
|
6
|
+
from ._utils import handle_props, try_setup_vmodel
|
7
|
+
from .radio import RadioOption
|
8
|
+
|
9
|
+
|
10
|
+
class TRadioGroup(TypedDict, total=False):
|
11
|
+
model_value: typing.Union[str, int, bool]
|
12
|
+
default_value: typing.Union[str, int, bool]
|
13
|
+
type: typing.Literal["radio", "button"]
|
14
|
+
size: typing.Literal["mini", "small", "medium", "large"]
|
15
|
+
options: typing.List[typing.Union[str, int, RadioOption]]
|
16
|
+
direction: typing.Literal["horizontal", "vertical"]
|
17
|
+
disabled: bool
|
18
|
+
|
19
|
+
|
20
|
+
class RadioGroup(Element):
|
21
|
+
def __init__(
|
22
|
+
self,
|
23
|
+
value: typing.Optional[TMaybeRef[typing.Union[str, int, bool, float]]] = None,
|
24
|
+
**kwargs: Unpack[TRadioGroup],
|
25
|
+
):
|
26
|
+
super().__init__("a-radio-group")
|
27
|
+
|
28
|
+
try_setup_vmodel(self, value)
|
29
|
+
self.props(handle_props(kwargs)) # type: ignore
|
30
|
+
|
31
|
+
def on_change(
|
32
|
+
self,
|
33
|
+
handler: EventMixin,
|
34
|
+
*,
|
35
|
+
extends: typing.Optional[typing.List] = None,
|
36
|
+
):
|
37
|
+
self.on(
|
38
|
+
"change",
|
39
|
+
handler,
|
40
|
+
extends=extends,
|
41
|
+
)
|
42
|
+
return self
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
|
10
|
+
class Rate(Element):
|
11
|
+
def __init__(
|
12
|
+
self,
|
13
|
+
value: typing.Optional[TMaybeRef[typing.Union[int, float]]] = None,
|
14
|
+
**kwargs: Unpack[component_types.TRate],
|
15
|
+
):
|
16
|
+
super().__init__("a-rate")
|
17
|
+
|
18
|
+
try_setup_vmodel(self, value)
|
19
|
+
self.props(handle_props(kwargs)) # type: ignore
|
20
|
+
|
21
|
+
def on_change(
|
22
|
+
self,
|
23
|
+
handler: EventMixin,
|
24
|
+
*,
|
25
|
+
extends: typing.Optional[typing.List] = None,
|
26
|
+
):
|
27
|
+
self.on(
|
28
|
+
"change",
|
29
|
+
handler,
|
30
|
+
extends=extends,
|
31
|
+
)
|
32
|
+
return self
|
33
|
+
|
34
|
+
def on_hover_change(
|
35
|
+
self,
|
36
|
+
handler: EventMixin,
|
37
|
+
*,
|
38
|
+
extends: typing.Optional[typing.List] = None,
|
39
|
+
):
|
40
|
+
self.on(
|
41
|
+
"hover-change",
|
42
|
+
handler,
|
43
|
+
extends=extends,
|
44
|
+
)
|
45
|
+
return self
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
_TResizeBoxSizeValue = typing.Union[int, float]
|
10
|
+
|
11
|
+
|
12
|
+
class ResizeBox(Element):
|
13
|
+
def __init__(
|
14
|
+
self,
|
15
|
+
width_value: typing.Optional[TMaybeRef[_TResizeBoxSizeValue]] = None,
|
16
|
+
height_value: typing.Optional[TMaybeRef[_TResizeBoxSizeValue]] = None,
|
17
|
+
**kwargs: Unpack[component_types.TResizebox],
|
18
|
+
):
|
19
|
+
super().__init__("a-resize-box")
|
20
|
+
|
21
|
+
try_setup_vmodel(self, width_value, prop_name="width")
|
22
|
+
try_setup_vmodel(self, height_value, prop_name="height")
|
23
|
+
self.props(handle_props(kwargs)) # type: ignore
|
24
|
+
|
25
|
+
def on_moving_start(
|
26
|
+
self,
|
27
|
+
handler: EventMixin,
|
28
|
+
*,
|
29
|
+
extends: typing.Optional[typing.List] = None,
|
30
|
+
):
|
31
|
+
self.on(
|
32
|
+
"moving-start",
|
33
|
+
handler,
|
34
|
+
extends=extends,
|
35
|
+
)
|
36
|
+
return self
|
37
|
+
|
38
|
+
def on_moving(
|
39
|
+
self,
|
40
|
+
handler: EventMixin,
|
41
|
+
*,
|
42
|
+
extends: typing.Optional[typing.List] = None,
|
43
|
+
):
|
44
|
+
self.on(
|
45
|
+
"moving",
|
46
|
+
handler,
|
47
|
+
extends=extends,
|
48
|
+
)
|
49
|
+
return self
|
50
|
+
|
51
|
+
def on_moving_end(
|
52
|
+
self,
|
53
|
+
handler: EventMixin,
|
54
|
+
*,
|
55
|
+
extends: typing.Optional[typing.List] = None,
|
56
|
+
):
|
57
|
+
self.on(
|
58
|
+
"moving-end",
|
59
|
+
handler,
|
60
|
+
extends=extends,
|
61
|
+
)
|
62
|
+
return self
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from typing_extensions import Unpack
|
2
|
+
from instaui.components.element import Element
|
3
|
+
from instaui.arco import component_types
|
4
|
+
from ._utils import handle_props
|
5
|
+
|
6
|
+
|
7
|
+
class Result(Element):
|
8
|
+
def __init__(
|
9
|
+
self,
|
10
|
+
**kwargs: Unpack[component_types.TResult],
|
11
|
+
):
|
12
|
+
super().__init__("a-result")
|
13
|
+
|
14
|
+
self.props(handle_props(kwargs)) # type: ignore
|
@@ -0,0 +1,182 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
from collections.abc import Sequence
|
3
|
+
import typing
|
4
|
+
from typing_extensions import Unpack
|
5
|
+
from instaui.vars.types import TMaybeRef
|
6
|
+
from instaui import ui
|
7
|
+
from instaui.components.element import Element
|
8
|
+
from instaui.vars.mixin_types.observable import ObservableMixin
|
9
|
+
from instaui.arco import component_types
|
10
|
+
from instaui.event.event_mixin import EventMixin
|
11
|
+
from ._utils import handle_props, try_setup_vmodel
|
12
|
+
|
13
|
+
|
14
|
+
_TSelectValue = typing.Union[str, int, typing.Sequence[str], typing.Sequence[int]]
|
15
|
+
|
16
|
+
_OPTIONS_TRANSLATE_JS: typing.Final = r"""(options)=>{
|
17
|
+
if (Array.isArray(options)){
|
18
|
+
const obj = {};
|
19
|
+
options.forEach(item => {
|
20
|
+
obj[item] = item;
|
21
|
+
});
|
22
|
+
return obj;
|
23
|
+
}
|
24
|
+
return options;
|
25
|
+
}
|
26
|
+
"""
|
27
|
+
|
28
|
+
|
29
|
+
class Select(Element):
|
30
|
+
def __init__(
|
31
|
+
self,
|
32
|
+
options: TMaybeRef[typing.Union[typing.Sequence, typing.Dict]],
|
33
|
+
value: typing.Optional[TMaybeRef[_TSelectValue]] = None,
|
34
|
+
**kwargs: Unpack[component_types.TSelect],
|
35
|
+
):
|
36
|
+
super().__init__("a-select")
|
37
|
+
|
38
|
+
if isinstance(options, ObservableMixin):
|
39
|
+
options = ui.js_computed(inputs=[options], code=_OPTIONS_TRANSLATE_JS)
|
40
|
+
else:
|
41
|
+
options = (
|
42
|
+
{str(i): str(i) for i in options}
|
43
|
+
if isinstance(options, Sequence)
|
44
|
+
else options
|
45
|
+
)
|
46
|
+
|
47
|
+
with self.add_slot("default"):
|
48
|
+
with ui.vfor.from_dict(options) as item: # type: ignore
|
49
|
+
Select.Option(item.dict_value).props(
|
50
|
+
{"value": item.dict_key, "label": item.dict_value}
|
51
|
+
)
|
52
|
+
|
53
|
+
try_setup_vmodel(self, value)
|
54
|
+
self.props(handle_props(kwargs)) # type: ignore
|
55
|
+
|
56
|
+
class Option(Element):
|
57
|
+
def __init__(
|
58
|
+
self,
|
59
|
+
text: typing.Optional[TMaybeRef[str]] = None,
|
60
|
+
):
|
61
|
+
super().__init__("a-option")
|
62
|
+
|
63
|
+
if text is not None:
|
64
|
+
with self:
|
65
|
+
ui.content(text)
|
66
|
+
|
67
|
+
def on_change(
|
68
|
+
self,
|
69
|
+
handler: EventMixin,
|
70
|
+
*,
|
71
|
+
extends: typing.Optional[typing.List] = None,
|
72
|
+
):
|
73
|
+
self.on(
|
74
|
+
"change",
|
75
|
+
handler,
|
76
|
+
extends=extends,
|
77
|
+
)
|
78
|
+
return self
|
79
|
+
|
80
|
+
def on_input_value_change(
|
81
|
+
self,
|
82
|
+
handler: EventMixin,
|
83
|
+
*,
|
84
|
+
extends: typing.Optional[typing.List] = None,
|
85
|
+
):
|
86
|
+
self.on(
|
87
|
+
"input-value-change",
|
88
|
+
handler,
|
89
|
+
extends=extends,
|
90
|
+
)
|
91
|
+
return self
|
92
|
+
|
93
|
+
def on_popup_visible_change(
|
94
|
+
self,
|
95
|
+
handler: EventMixin,
|
96
|
+
*,
|
97
|
+
extends: typing.Optional[typing.List] = None,
|
98
|
+
):
|
99
|
+
self.on(
|
100
|
+
"popup-visible-change",
|
101
|
+
handler,
|
102
|
+
extends=extends,
|
103
|
+
)
|
104
|
+
return self
|
105
|
+
|
106
|
+
def on_clear(
|
107
|
+
self,
|
108
|
+
handler: EventMixin,
|
109
|
+
*,
|
110
|
+
extends: typing.Optional[typing.List] = None,
|
111
|
+
):
|
112
|
+
self.on(
|
113
|
+
"clear",
|
114
|
+
handler,
|
115
|
+
extends=extends,
|
116
|
+
)
|
117
|
+
return self
|
118
|
+
|
119
|
+
def on_remove(
|
120
|
+
self,
|
121
|
+
handler: EventMixin,
|
122
|
+
*,
|
123
|
+
extends: typing.Optional[typing.List] = None,
|
124
|
+
):
|
125
|
+
self.on(
|
126
|
+
"remove",
|
127
|
+
handler,
|
128
|
+
extends=extends,
|
129
|
+
)
|
130
|
+
return self
|
131
|
+
|
132
|
+
def on_search(
|
133
|
+
self,
|
134
|
+
handler: EventMixin,
|
135
|
+
*,
|
136
|
+
extends: typing.Optional[typing.List] = None,
|
137
|
+
):
|
138
|
+
self.on(
|
139
|
+
"search",
|
140
|
+
handler,
|
141
|
+
extends=extends,
|
142
|
+
)
|
143
|
+
return self
|
144
|
+
|
145
|
+
def on_dropdown_scroll(
|
146
|
+
self,
|
147
|
+
handler: EventMixin,
|
148
|
+
*,
|
149
|
+
extends: typing.Optional[typing.List] = None,
|
150
|
+
):
|
151
|
+
self.on(
|
152
|
+
"dropdown-scroll",
|
153
|
+
handler,
|
154
|
+
extends=extends,
|
155
|
+
)
|
156
|
+
return self
|
157
|
+
|
158
|
+
def on_dropdown_reach_bottom(
|
159
|
+
self,
|
160
|
+
handler: EventMixin,
|
161
|
+
*,
|
162
|
+
extends: typing.Optional[typing.List] = None,
|
163
|
+
):
|
164
|
+
self.on(
|
165
|
+
"dropdown-reach-bottom",
|
166
|
+
handler,
|
167
|
+
extends=extends,
|
168
|
+
)
|
169
|
+
return self
|
170
|
+
|
171
|
+
def on_exceed_limit(
|
172
|
+
self,
|
173
|
+
handler: EventMixin,
|
174
|
+
*,
|
175
|
+
extends: typing.Optional[typing.List] = None,
|
176
|
+
):
|
177
|
+
self.on(
|
178
|
+
"exceed-limit",
|
179
|
+
handler,
|
180
|
+
extends=extends,
|
181
|
+
)
|
182
|
+
return self
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from typing_extensions import Unpack
|
2
|
+
from instaui.components.element import Element
|
3
|
+
from instaui.arco import component_types
|
4
|
+
from ._utils import handle_props
|
5
|
+
|
6
|
+
|
7
|
+
class Skeleton(Element):
|
8
|
+
def __init__(
|
9
|
+
self,
|
10
|
+
**kwargs: Unpack[component_types.TSkeleton],
|
11
|
+
):
|
12
|
+
super().__init__("a-skeleton")
|
13
|
+
|
14
|
+
self.props(handle_props(kwargs)) # type: ignore
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
_TSliderValue = typing.Union[int, float, typing.List[int], typing.List[float]]
|
10
|
+
|
11
|
+
|
12
|
+
class Slider(Element):
|
13
|
+
def __init__(
|
14
|
+
self,
|
15
|
+
value: typing.Optional[
|
16
|
+
TMaybeRef[
|
17
|
+
typing.Union[_TSliderValue, typing.Tuple[_TSliderValue, _TSliderValue]]
|
18
|
+
]
|
19
|
+
] = None,
|
20
|
+
**kwargs: Unpack[component_types.TSlider],
|
21
|
+
):
|
22
|
+
super().__init__("a-slider")
|
23
|
+
|
24
|
+
try_setup_vmodel(self, value)
|
25
|
+
self.props(handle_props(kwargs)) # type: ignore
|
26
|
+
|
27
|
+
def on_change(
|
28
|
+
self,
|
29
|
+
handler: EventMixin,
|
30
|
+
*,
|
31
|
+
extends: typing.Optional[typing.List] = None,
|
32
|
+
):
|
33
|
+
self.on(
|
34
|
+
"change",
|
35
|
+
handler,
|
36
|
+
extends=extends,
|
37
|
+
)
|
38
|
+
return self
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from typing_extensions import Unpack
|
2
|
+
from instaui.components.element import Element
|
3
|
+
from instaui.arco import component_types
|
4
|
+
from ._utils import handle_props
|
5
|
+
|
6
|
+
|
7
|
+
class Space(Element):
|
8
|
+
def __init__(
|
9
|
+
self,
|
10
|
+
**kwargs: Unpack[component_types.TSpace],
|
11
|
+
):
|
12
|
+
super().__init__("a-space")
|
13
|
+
|
14
|
+
self.props(handle_props(kwargs)) # type: ignore
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from typing_extensions import Unpack
|
2
|
+
from instaui.components.element import Element
|
3
|
+
from instaui.arco import component_types
|
4
|
+
from ._utils import handle_props
|
5
|
+
|
6
|
+
|
7
|
+
class Spin(Element):
|
8
|
+
def __init__(
|
9
|
+
self,
|
10
|
+
**kwargs: Unpack[component_types.TSpin],
|
11
|
+
):
|
12
|
+
super().__init__("a-spin")
|
13
|
+
|
14
|
+
self.props(handle_props(kwargs)) # type: ignore
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import typing
|
2
|
+
from typing_extensions import Unpack
|
3
|
+
from instaui.components.element import Element
|
4
|
+
from instaui.vars.types import TMaybeRef
|
5
|
+
from instaui.arco import component_types
|
6
|
+
from instaui.event.event_mixin import EventMixin
|
7
|
+
from ._utils import handle_props, try_setup_vmodel
|
8
|
+
|
9
|
+
|
10
|
+
class Split(Element):
|
11
|
+
def __init__(
|
12
|
+
self,
|
13
|
+
size_value: typing.Optional[TMaybeRef[typing.Union[int, float, str]]] = None,
|
14
|
+
**kwargs: Unpack[component_types.TSplit],
|
15
|
+
):
|
16
|
+
"""Split element.
|
17
|
+
|
18
|
+
|
19
|
+
Example:
|
20
|
+
.. code-block:: python
|
21
|
+
with arco.split(direction="vertical").props("max=0.8 min=0.2") as split:
|
22
|
+
with split.first():
|
23
|
+
html.paragraph("first")
|
24
|
+
with split.second():
|
25
|
+
html.paragraph("second")
|
26
|
+
"""
|
27
|
+
|
28
|
+
super().__init__("a-split")
|
29
|
+
|
30
|
+
try_setup_vmodel(self, size_value, prop_name="size")
|
31
|
+
self.props(handle_props(kwargs)) # type: ignore
|
32
|
+
|
33
|
+
def first(self):
|
34
|
+
return self.add_slot("first")
|
35
|
+
|
36
|
+
def second(self):
|
37
|
+
return self.add_slot("second")
|
38
|
+
|
39
|
+
def on_move_start(
|
40
|
+
self,
|
41
|
+
handler: EventMixin,
|
42
|
+
*,
|
43
|
+
extends: typing.Optional[typing.List] = None,
|
44
|
+
):
|
45
|
+
self.on(
|
46
|
+
"move-start",
|
47
|
+
handler,
|
48
|
+
extends=extends,
|
49
|
+
)
|
50
|
+
return self
|
51
|
+
|
52
|
+
def on_moving(
|
53
|
+
self,
|
54
|
+
handler: EventMixin,
|
55
|
+
*,
|
56
|
+
extends: typing.Optional[typing.List] = None,
|
57
|
+
):
|
58
|
+
self.on(
|
59
|
+
"moving",
|
60
|
+
handler,
|
61
|
+
extends=extends,
|
62
|
+
)
|
63
|
+
return self
|
64
|
+
|
65
|
+
def on_move_end(
|
66
|
+
self,
|
67
|
+
handler: EventMixin,
|
68
|
+
*,
|
69
|
+
extends: typing.Optional[typing.List] = None,
|
70
|
+
):
|
71
|
+
self.on(
|
72
|
+
"move-end",
|
73
|
+
handler,
|
74
|
+
extends=extends,
|
75
|
+
)
|
76
|
+
return self
|