From 431f3e9be789f4900cbd0439d0817b35e01c3162 Mon Sep 17 00:00:00 2001
From: Col0ring <1561999073@qq.com>
Date: Tue, 10 Dec 2024 14:59:39 +0800
Subject: [PATCH] docs: update
---
.../components/antd/tag/__init__.py | 2 +-
.../antd/tag/checkable_tag/__init__.py | 5 +-
.../components/antd/tooltip/__init__.py | 15 ++--
.../antd/tree/directory_tree/__init__.py | 2 +-
.../components/base/div/__init__.py | 10 ++-
.../components/base/span/__init__.py | 9 +-
.../components/base/text/__init__.py | 3 +-
docs/components/antd/alert/README-zh_CN.md | 7 ++
docs/components/antd/alert/README.md | 7 ++
docs/components/antd/alert/app.py | 6 ++
docs/components/antd/alert/demos/basic.py | 40 +++++++++
.../components/antd/table/demos/pagination.py | 26 ++----
docs/components/antd/tabs/README-zh_CN.md | 8 ++
docs/components/antd/tabs/README.md | 8 ++
docs/components/antd/tabs/app.py | 6 ++
docs/components/antd/tabs/demos/basic.py | 32 +++++++
docs/components/antd/tabs/demos/position.py | 29 +++++++
docs/components/antd/tag/README-zh_CN.md | 8 ++
docs/components/antd/tag/README.md | 8 ++
docs/components/antd/tag/app.py | 6 ++
docs/components/antd/tag/demos/basic.py | 60 ++++++++++++++
.../antd/tag/demos/checkable_tag.py | 19 +++++
docs/components/antd/timeline/README-zh_CN.md | 7 ++
docs/components/antd/timeline/README.md | 7 ++
docs/components/antd/timeline/app.py | 6 ++
docs/components/antd/timeline/demos/basic.py | 41 +++++++++
docs/components/antd/tooltip/README-zh_CN.md | 7 ++
docs/components/antd/tooltip/README.md | 7 ++
docs/components/antd/tooltip/app.py | 6 ++
docs/components/antd/tooltip/demos/basic.py | 17 ++++
docs/components/antd/tree/README-zh_CN.md | 8 ++
docs/components/antd/tree/README.md | 8 ++
docs/components/antd/tree/app.py | 6 ++
docs/components/antd/tree/demos/basic.py | 83 +++++++++++++++++++
.../antd/tree/demos/directory_tree.py | 45 ++++++++++
frontend/antd/segmented/segmented.tsx | 2 +-
frontend/antd/tooltip/Index.svelte | 4 -
.../svelte-preprocess-react/react-slot.tsx | 8 +-
38 files changed, 533 insertions(+), 45 deletions(-)
create mode 100644 docs/components/antd/alert/README-zh_CN.md
create mode 100644 docs/components/antd/alert/README.md
create mode 100644 docs/components/antd/alert/app.py
create mode 100644 docs/components/antd/alert/demos/basic.py
create mode 100644 docs/components/antd/tabs/README-zh_CN.md
create mode 100644 docs/components/antd/tabs/README.md
create mode 100644 docs/components/antd/tabs/app.py
create mode 100644 docs/components/antd/tabs/demos/basic.py
create mode 100644 docs/components/antd/tabs/demos/position.py
create mode 100644 docs/components/antd/tag/README-zh_CN.md
create mode 100644 docs/components/antd/tag/README.md
create mode 100644 docs/components/antd/tag/app.py
create mode 100644 docs/components/antd/tag/demos/basic.py
create mode 100644 docs/components/antd/tag/demos/checkable_tag.py
create mode 100644 docs/components/antd/timeline/README-zh_CN.md
create mode 100644 docs/components/antd/timeline/README.md
create mode 100644 docs/components/antd/timeline/app.py
create mode 100644 docs/components/antd/timeline/demos/basic.py
create mode 100644 docs/components/antd/tooltip/README-zh_CN.md
create mode 100644 docs/components/antd/tooltip/README.md
create mode 100644 docs/components/antd/tooltip/app.py
create mode 100644 docs/components/antd/tooltip/demos/basic.py
create mode 100644 docs/components/antd/tree/README-zh_CN.md
create mode 100644 docs/components/antd/tree/README.md
create mode 100644 docs/components/antd/tree/app.py
create mode 100644 docs/components/antd/tree/demos/basic.py
create mode 100644 docs/components/antd/tree/demos/directory_tree.py
diff --git a/backend/modelscope_studio/components/antd/tag/__init__.py b/backend/modelscope_studio/components/antd/tag/__init__.py
index abc7cfaf..d2298c8d 100644
--- a/backend/modelscope_studio/components/antd/tag/__init__.py
+++ b/backend/modelscope_studio/components/antd/tag/__init__.py
@@ -25,7 +25,7 @@ class AntdTag(ModelScopeLayoutComponent):
def __init__(
self,
- value: str | None = "",
+ value: str | None = None,
props: dict | None = None,
*,
bordered: bool | None = None,
diff --git a/backend/modelscope_studio/components/antd/tag/checkable_tag/__init__.py b/backend/modelscope_studio/components/antd/tag/checkable_tag/__init__.py
index 028c2db8..497f1cee 100644
--- a/backend/modelscope_studio/components/antd/tag/checkable_tag/__init__.py
+++ b/backend/modelscope_studio/components/antd/tag/checkable_tag/__init__.py
@@ -16,7 +16,10 @@ class AntdTagCheckableTag(ModelScopeDataLayoutComponent):
EVENTS = [
EventListener("change",
callback=lambda block: block._internal.update(
- bind_change_event=True))
+ bind_change_event=True)),
+ EventListener("click",
+ callback=lambda block: block._internal.update(
+ bind_click_event=True))
]
def __init__(
diff --git a/backend/modelscope_studio/components/antd/tooltip/__init__.py b/backend/modelscope_studio/components/antd/tooltip/__init__.py
index 26efdb9a..7d1ea634 100644
--- a/backend/modelscope_studio/components/antd/tooltip/__init__.py
+++ b/backend/modelscope_studio/components/antd/tooltip/__init__.py
@@ -22,19 +22,19 @@ class AntdTooltip(ModelScopeLayoutComponent):
def __init__(
self,
- title: str | None = "",
+ title: str | None = None,
props: dict | None = None,
*,
align: dict | None = None,
- arrow: bool | dict | None = True,
- auto_adjust_overflow: bool = True,
+ arrow: bool | dict | None = None,
+ auto_adjust_overflow: bool | None = None,
color: str | None = None,
default_open: bool | None = None,
destroy_tooltip_on_hide: bool | None = None,
fresh: bool | None = None,
get_popup_container: str | None = None,
- mouse_enter_delay: float | int = 0.1,
- mouse_leave_delay: float | int = 0.1,
+ mouse_enter_delay: float | int | None = None,
+ mouse_leave_delay: float | int | None = None,
overlay_class_name: str | None = None,
overlay_style: dict | None = None,
overlay_inner_style: dict | None = None,
@@ -51,9 +51,10 @@ def __init__(
'leftBottom',
'rightTop',
'rightBottom',
- ] = 'top',
+ ] | None = None,
trigger: Literal['hover', 'focus', 'click', 'contextMenu']
- | list[Literal['hover', 'focus', 'click', 'contextMenu']] = 'hover',
+ | list[Literal['hover', 'focus', 'click', 'contextMenu']]
+ | None = None,
open: bool | None = None,
z_index: int | None = None,
root_class_name: str | None = None,
diff --git a/backend/modelscope_studio/components/antd/tree/directory_tree/__init__.py b/backend/modelscope_studio/components/antd/tree/directory_tree/__init__.py
index 0d987747..43a2a72a 100644
--- a/backend/modelscope_studio/components/antd/tree/directory_tree/__init__.py
+++ b/backend/modelscope_studio/components/antd/tree/directory_tree/__init__.py
@@ -150,7 +150,7 @@ def __init__(
@property
def skip_api(self):
- return False
+ return True
def preprocess(self, payload: None) -> None:
return payload
diff --git a/backend/modelscope_studio/components/base/div/__init__.py b/backend/modelscope_studio/components/base/div/__init__.py
index 7fdd1b62..cf4d290d 100644
--- a/backend/modelscope_studio/components/base/div/__init__.py
+++ b/backend/modelscope_studio/components/base/div/__init__.py
@@ -7,6 +7,7 @@
from ....utils.dev import ModelScopeLayoutComponent, resolve_frontend_dir
from ...antd.carousel import AntdCarousel
from ...antd.space import AntdSpace
+from ...antd.tooltip import AntdTooltip
from ..slot import ModelScopeSlot
@@ -65,10 +66,13 @@ def __init__(
as_item=as_item,
elem_style=elem_style,
**kwargs)
-
if self.parent and self._internal and (any(
- isinstance(self.parent, component)
- for component in [AntdCarousel, AntdSpace, ModelScopeSlot])):
+ isinstance(self.parent, component) for component in [
+ AntdCarousel,
+ AntdSpace,
+ AntdTooltip,
+ ModelScopeSlot,
+ ])):
self._internal.update(fragment=True)
self.value = value
self.props = props
diff --git a/backend/modelscope_studio/components/base/span/__init__.py b/backend/modelscope_studio/components/base/span/__init__.py
index eda853d1..7793f5de 100644
--- a/backend/modelscope_studio/components/base/span/__init__.py
+++ b/backend/modelscope_studio/components/base/span/__init__.py
@@ -7,6 +7,7 @@
from ....utils.dev import ModelScopeLayoutComponent, resolve_frontend_dir
from ...antd.carousel import AntdCarousel
from ...antd.space import AntdSpace
+from ...antd.tooltip import AntdTooltip
from ..slot import ModelScopeSlot
@@ -66,8 +67,12 @@ def __init__(
elem_style=elem_style,
**kwargs)
if self.parent and self._internal and (any(
- isinstance(self.parent, component)
- for component in [AntdCarousel, AntdSpace, ModelScopeSlot])):
+ isinstance(self.parent, component) for component in [
+ AntdCarousel,
+ AntdSpace,
+ AntdTooltip,
+ ModelScopeSlot,
+ ])):
self._internal.update(fragment=True)
self.value = value
self.props = props
diff --git a/backend/modelscope_studio/components/base/text/__init__.py b/backend/modelscope_studio/components/base/text/__init__.py
index a13ac3d7..42c50a41 100644
--- a/backend/modelscope_studio/components/base/text/__init__.py
+++ b/backend/modelscope_studio/components/base/text/__init__.py
@@ -5,6 +5,7 @@
from ....utils.dev import ModelScopeComponent, resolve_frontend_dir
from ...antd.carousel import AntdCarousel
from ...antd.space import AntdSpace
+from ...antd.tooltip import AntdTooltip
class ModelScopeText(ModelScopeComponent):
@@ -38,7 +39,7 @@ def __init__(
**kwargs)
if self.parent and self._internal and (any(
isinstance(self.parent, component)
- for component in [AntdCarousel, AntdSpace])):
+ for component in [AntdCarousel, AntdTooltip, AntdSpace])):
self._internal.update(fragment=True)
self.value = value
diff --git a/docs/components/antd/alert/README-zh_CN.md b/docs/components/antd/alert/README-zh_CN.md
new file mode 100644
index 00000000..45047d8f
--- /dev/null
+++ b/docs/components/antd/alert/README-zh_CN.md
@@ -0,0 +1,7 @@
+# Alert
+
+Display warning messages that require attention. See [Ant Design](https://ant.design/components/alert/) for more information.
+
+## Examples
+
+
diff --git a/docs/components/antd/alert/README.md b/docs/components/antd/alert/README.md
new file mode 100644
index 00000000..45047d8f
--- /dev/null
+++ b/docs/components/antd/alert/README.md
@@ -0,0 +1,7 @@
+# Alert
+
+Display warning messages that require attention. See [Ant Design](https://ant.design/components/alert/) for more information.
+
+## Examples
+
+
diff --git a/docs/components/antd/alert/app.py b/docs/components/antd/alert/app.py
new file mode 100644
index 00000000..0018b7c1
--- /dev/null
+++ b/docs/components/antd/alert/app.py
@@ -0,0 +1,6 @@
+from helper.Docs import Docs
+
+docs = Docs(__file__)
+
+if __name__ == "__main__":
+ docs.render().queue().launch()
diff --git a/docs/components/antd/alert/demos/basic.py b/docs/components/antd/alert/demos/basic.py
new file mode 100644
index 00000000..45013540
--- /dev/null
+++ b/docs/components/antd/alert/demos/basic.py
@@ -0,0 +1,40 @@
+import gradio as gr
+
+import modelscope_studio.components.antd as antd
+import modelscope_studio.components.base as ms
+
+data = [{
+ "message": "Success Text",
+ "description":
+ "Success Description Success Description Success Description Success Description",
+ "type": "success"
+}, {
+ "message": "Info Text",
+ "description":
+ "Info Description Info Description Info Description Info Description",
+ "type": "info"
+}, {
+ "message": "Warning Text",
+ "description":
+ "Warning Description Warning Description Warning Description Warning Description",
+ "type": "warning"
+}, {
+ "message": "Error Text",
+ "description":
+ "Error Description Error Description Error Description Error Description",
+ "type": "error"
+}]
+
+with gr.Blocks() as demo:
+ with ms.Application():
+ with antd.ConfigProvider():
+ with antd.Space(direction="vertical"):
+ for item in data:
+ antd.Alert(message=item["message"],
+ description=item["description"],
+ type=item["type"],
+ closable=True,
+ show_icon=True)
+
+if __name__ == "__main__":
+ demo.queue().launch()
diff --git a/docs/components/antd/table/demos/pagination.py b/docs/components/antd/table/demos/pagination.py
index dcbab778..e3963534 100644
--- a/docs/components/antd/table/demos/pagination.py
+++ b/docs/components/antd/table/demos/pagination.py
@@ -3,26 +3,12 @@
import modelscope_studio.components.antd as antd
import modelscope_studio.components.base as ms
-data = [
- {
- "key": '1',
- "name": 'Mike',
- "age": 32,
- "address": '10 Downing Street',
- },
- {
- "key": '2',
- "name": 'John',
- "age": 42,
- "address": '10 Downing Street',
- },
- {
- "key": '3',
- "name": 'Joe',
- "age": 32,
- "address": '10 Downing Street',
- },
-] * 10
+data = [{
+ "key": f"{i}",
+ "name": f'Item {i}',
+ "age": 32,
+ "address": '10 Downing Street',
+} for i in range(20)]
def on_change(e: gr.EventData):
diff --git a/docs/components/antd/tabs/README-zh_CN.md b/docs/components/antd/tabs/README-zh_CN.md
new file mode 100644
index 00000000..82342642
--- /dev/null
+++ b/docs/components/antd/tabs/README-zh_CN.md
@@ -0,0 +1,8 @@
+# Tabs
+
+Tabs make it easy to explore and switch between different views. See [Ant Design](https://ant.design/components/tabs/) for more information.
+
+## Examples
+
+
+
diff --git a/docs/components/antd/tabs/README.md b/docs/components/antd/tabs/README.md
new file mode 100644
index 00000000..82342642
--- /dev/null
+++ b/docs/components/antd/tabs/README.md
@@ -0,0 +1,8 @@
+# Tabs
+
+Tabs make it easy to explore and switch between different views. See [Ant Design](https://ant.design/components/tabs/) for more information.
+
+## Examples
+
+
+
diff --git a/docs/components/antd/tabs/app.py b/docs/components/antd/tabs/app.py
new file mode 100644
index 00000000..0018b7c1
--- /dev/null
+++ b/docs/components/antd/tabs/app.py
@@ -0,0 +1,6 @@
+from helper.Docs import Docs
+
+docs = Docs(__file__)
+
+if __name__ == "__main__":
+ docs.render().queue().launch()
diff --git a/docs/components/antd/tabs/demos/basic.py b/docs/components/antd/tabs/demos/basic.py
new file mode 100644
index 00000000..002b36bf
--- /dev/null
+++ b/docs/components/antd/tabs/demos/basic.py
@@ -0,0 +1,32 @@
+import gradio as gr
+
+import modelscope_studio.components.antd as antd
+import modelscope_studio.components.base as ms
+
+with gr.Blocks() as demo:
+ with ms.Application():
+ with antd.ConfigProvider():
+ with antd.Tabs(default_active_key='1'):
+ with antd.Tabs.Item(key="1", label="Tab1"):
+ ms.Text("Tab 1")
+ with antd.Tabs.Item(key="2", label="Tab2", disabled=True):
+ ms.Text("Tab 2")
+ with antd.Tabs.Item(key="3", label="Tab3"):
+ ms.Text("Tab 3")
+ with ms.Slot("icon"):
+ antd.Icon("AndroidOutlined")
+ antd.Divider("Extra content")
+ with antd.Tabs(default_active_key='1'):
+ with ms.Slot("tabBarExtraContent.left"):
+ antd.Button("Left Extra Action")
+ with ms.Slot("tabBarExtraContent.right"):
+ antd.Button("Right Extra Action")
+ with antd.Tabs.Item(key="1", label="Tab1"):
+ ms.Text("Tab 1")
+ with antd.Tabs.Item(key="2", label="Tab2"):
+ ms.Text("Tab 2")
+ with antd.Tabs.Item(key="3", label="Tab3"):
+ ms.Text("Tab 3")
+
+if __name__ == "__main__":
+ demo.queue().launch()
diff --git a/docs/components/antd/tabs/demos/position.py b/docs/components/antd/tabs/demos/position.py
new file mode 100644
index 00000000..715ba59c
--- /dev/null
+++ b/docs/components/antd/tabs/demos/position.py
@@ -0,0 +1,29 @@
+import gradio as gr
+
+import modelscope_studio.components.antd as antd
+import modelscope_studio.components.base as ms
+
+default_position = "top"
+
+with gr.Blocks() as demo:
+ with ms.Application():
+ with antd.ConfigProvider():
+ with antd.Space():
+ ms.Text("Tab position")
+ position = antd.Radio.Group(
+ value=default_position,
+ option_type="button",
+ options=["top", "left", "right", "bottom"])
+ with antd.Tabs(default_active_key='1') as tabs:
+ with antd.Tabs.Item(key="1", label="Tab1"):
+ ms.Text("Tab 1")
+ with antd.Tabs.Item(key="2", label="Tab2"):
+ ms.Text("Tab 2")
+ with antd.Tabs.Item(key="3", label="Tab3"):
+ ms.Text("Tab 3")
+ position.change(fn=lambda x: gr.update(tab_position=x),
+ inputs=[position],
+ outputs=[tabs])
+
+if __name__ == "__main__":
+ demo.queue().launch()
diff --git a/docs/components/antd/tag/README-zh_CN.md b/docs/components/antd/tag/README-zh_CN.md
new file mode 100644
index 00000000..ff43eb83
--- /dev/null
+++ b/docs/components/antd/tag/README-zh_CN.md
@@ -0,0 +1,8 @@
+# Tag
+
+Used for marking and categorization. See [Ant Design](https://ant.design/components/tag/) for more information.
+
+## Examples
+
+
+
diff --git a/docs/components/antd/tag/README.md b/docs/components/antd/tag/README.md
new file mode 100644
index 00000000..ff43eb83
--- /dev/null
+++ b/docs/components/antd/tag/README.md
@@ -0,0 +1,8 @@
+# Tag
+
+Used for marking and categorization. See [Ant Design](https://ant.design/components/tag/) for more information.
+
+## Examples
+
+
+
diff --git a/docs/components/antd/tag/app.py b/docs/components/antd/tag/app.py
new file mode 100644
index 00000000..0018b7c1
--- /dev/null
+++ b/docs/components/antd/tag/app.py
@@ -0,0 +1,6 @@
+from helper.Docs import Docs
+
+docs = Docs(__file__)
+
+if __name__ == "__main__":
+ docs.render().queue().launch()
diff --git a/docs/components/antd/tag/demos/basic.py b/docs/components/antd/tag/demos/basic.py
new file mode 100644
index 00000000..5be53309
--- /dev/null
+++ b/docs/components/antd/tag/demos/basic.py
@@ -0,0 +1,60 @@
+import gradio as gr
+
+import modelscope_studio.components.antd as antd
+import modelscope_studio.components.base as ms
+
+with gr.Blocks() as demo:
+ with ms.Application():
+ with antd.ConfigProvider():
+ with antd.Space(size="small"):
+ antd.Tag("Tag1")
+ with antd.Tag():
+ antd.Typography.Link(
+ "Link",
+ href=
+ "https://github.com/ant-design/ant-design/issues/1862")
+ antd.Tag('Closeable', close_icon=True)
+ with antd.Tag():
+ with ms.Slot("closeIcon"):
+ antd.Icon("CloseCircleOutlined",
+ elem_style=dict(fontSize=14,
+ marginLeft="4px"))
+ ms.Text("Custom Close Icon")
+ with antd.Divider(orientation="left"):
+ ms.Text("Icon Tag")
+ with antd.Flex(gap=("4px", "0"), wrap=True):
+ with antd.Tag(color="#55acee"):
+ ms.Text("Twitter")
+ with antd.Tag(color="#cd201f"):
+ ms.Text("Youtube")
+ with antd.Tag(color="#3b5999"):
+ ms.Text("Facebook")
+ with antd.Tag(color="#55acee"):
+ ms.Text("LinkedIn")
+
+ with antd.Divider(orientation="left"):
+ ms.Text("Presets Colorful Tag")
+
+ with antd.Flex(gap=("4px", "0"), wrap=True):
+ antd.Tag("magenta", color="magenta")
+ antd.Tag("red", color="red")
+ antd.Tag("volcano", color="volcano")
+ antd.Tag("orange", color="orange")
+ antd.Tag("gold", color="gold")
+ antd.Tag("lime", color="lime")
+ antd.Tag("green", color="green")
+ antd.Tag("cyan", color="cyan")
+ antd.Tag("blue", color="blue")
+ antd.Tag("geekblue", color="geekblue")
+ antd.Tag("purple", color="purple")
+
+ with antd.Divider(orientation="left"):
+ ms.Text("Custom Colorful Tag")
+
+ with antd.Flex(gap="4px 0", wrap=True):
+ antd.Tag("#f50", color="#f50")
+ antd.Tag("#2db7f5", color="#2db7f5")
+ antd.Tag("#87d068", color="#87d068")
+ antd.Tag("#108ee9", color="#108ee9")
+if __name__ == "__main__":
+ demo.queue().launch()
diff --git a/docs/components/antd/tag/demos/checkable_tag.py b/docs/components/antd/tag/demos/checkable_tag.py
new file mode 100644
index 00000000..53f1d8a0
--- /dev/null
+++ b/docs/components/antd/tag/demos/checkable_tag.py
@@ -0,0 +1,19 @@
+import gradio as gr
+
+import modelscope_studio.components.antd as antd
+import modelscope_studio.components.base as ms
+
+default_position = "top"
+
+with gr.Blocks() as demo:
+ with ms.Application():
+ with antd.ConfigProvider():
+ with antd.Flex(gap=4, wrap=True, align="center"):
+ ms.Span("Categories:")
+ antd.Tag.CheckableTag("Movies", value=True)
+ antd.Tag.CheckableTag("Books")
+ antd.Tag.CheckableTag("Music")
+ antd.Tag.CheckableTag("Sports")
+
+if __name__ == "__main__":
+ demo.queue().launch()
diff --git a/docs/components/antd/timeline/README-zh_CN.md b/docs/components/antd/timeline/README-zh_CN.md
new file mode 100644
index 00000000..2c091035
--- /dev/null
+++ b/docs/components/antd/timeline/README-zh_CN.md
@@ -0,0 +1,7 @@
+# Timeline
+
+Vertical display timeline. See [Ant Design](https://ant.design/components/timeline/) for more information.
+
+## Examples
+
+
diff --git a/docs/components/antd/timeline/README.md b/docs/components/antd/timeline/README.md
new file mode 100644
index 00000000..2c091035
--- /dev/null
+++ b/docs/components/antd/timeline/README.md
@@ -0,0 +1,7 @@
+# Timeline
+
+Vertical display timeline. See [Ant Design](https://ant.design/components/timeline/) for more information.
+
+## Examples
+
+
diff --git a/docs/components/antd/timeline/app.py b/docs/components/antd/timeline/app.py
new file mode 100644
index 00000000..0018b7c1
--- /dev/null
+++ b/docs/components/antd/timeline/app.py
@@ -0,0 +1,6 @@
+from helper.Docs import Docs
+
+docs = Docs(__file__)
+
+if __name__ == "__main__":
+ docs.render().queue().launch()
diff --git a/docs/components/antd/timeline/demos/basic.py b/docs/components/antd/timeline/demos/basic.py
new file mode 100644
index 00000000..e10e3d47
--- /dev/null
+++ b/docs/components/antd/timeline/demos/basic.py
@@ -0,0 +1,41 @@
+import gradio as gr
+
+import modelscope_studio.components.antd as antd
+import modelscope_studio.components.base as ms
+
+with gr.Blocks() as demo:
+ with ms.Application():
+ with antd.ConfigProvider():
+ with antd.Timeline():
+ with antd.Timeline.Item():
+ ms.Text("Create a services site 2015-09-01")
+ with antd.Timeline.Item():
+ ms.Text("Solve initial network problems 2015-09-01")
+ with antd.Timeline.Item():
+ ms.Text("Technical testing 2015-09-01")
+ with antd.Timeline.Item():
+ ms.Text("Network problems being solved 2015-09-01")
+ antd.Divider("Alternate")
+ with antd.Timeline(mode="alternate"):
+ with antd.Timeline.Item():
+ ms.Text("Create a services site 2015-09-01")
+ with antd.Timeline.Item(color="green"):
+ ms.Text("Solve initial network problems 2015-09-01")
+ with antd.Timeline.Item():
+ ms.Text(
+ "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo."
+ )
+ with ms.Slot("dot"):
+ antd.Icon("ClockCircleOutlined",
+ elem_style=dict(fontSize=16))
+ with antd.Timeline.Item(color="red"):
+ ms.Text("Network problems being solved 2015-09-01")
+ with antd.Timeline.Item():
+ ms.Text("Create a services site 2015-09-01")
+ with antd.Timeline.Item():
+ with ms.Slot("dot"):
+ antd.Icon("ClockCircleOutlined",
+ elem_style=dict(fontSize=16))
+ ms.Text("Technical testing 2015-09-01")
+if __name__ == "__main__":
+ demo.queue().launch()
diff --git a/docs/components/antd/tooltip/README-zh_CN.md b/docs/components/antd/tooltip/README-zh_CN.md
new file mode 100644
index 00000000..3b1fd261
--- /dev/null
+++ b/docs/components/antd/tooltip/README-zh_CN.md
@@ -0,0 +1,7 @@
+# Tooltip
+
+Simple text popup box. See [Ant Design](https://ant.design/components/tooltip/) for more information.
+
+## Examples
+
+
diff --git a/docs/components/antd/tooltip/README.md b/docs/components/antd/tooltip/README.md
new file mode 100644
index 00000000..3b1fd261
--- /dev/null
+++ b/docs/components/antd/tooltip/README.md
@@ -0,0 +1,7 @@
+# Tooltip
+
+Simple text popup box. See [Ant Design](https://ant.design/components/tooltip/) for more information.
+
+## Examples
+
+
diff --git a/docs/components/antd/tooltip/app.py b/docs/components/antd/tooltip/app.py
new file mode 100644
index 00000000..0018b7c1
--- /dev/null
+++ b/docs/components/antd/tooltip/app.py
@@ -0,0 +1,6 @@
+from helper.Docs import Docs
+
+docs = Docs(__file__)
+
+if __name__ == "__main__":
+ docs.render().queue().launch()
diff --git a/docs/components/antd/tooltip/demos/basic.py b/docs/components/antd/tooltip/demos/basic.py
new file mode 100644
index 00000000..588e8c64
--- /dev/null
+++ b/docs/components/antd/tooltip/demos/basic.py
@@ -0,0 +1,17 @@
+import gradio as gr
+
+import modelscope_studio.components.antd as antd
+import modelscope_studio.components.base as ms
+
+with gr.Blocks() as demo:
+ with ms.Application():
+ with antd.ConfigProvider():
+ with antd.Space(direction="vertical"):
+ with antd.Tooltip(title="prompt text"):
+ ms.Span("Tooltip will show on mouse enter.")
+ with antd.Tooltip():
+ with ms.Slot("title"):
+ antd.Typography.Text("prompt text", type="success")
+ ms.Span("Custom Title")
+if __name__ == "__main__":
+ demo.queue().launch()
diff --git a/docs/components/antd/tree/README-zh_CN.md b/docs/components/antd/tree/README-zh_CN.md
new file mode 100644
index 00000000..9ead8c07
--- /dev/null
+++ b/docs/components/antd/tree/README-zh_CN.md
@@ -0,0 +1,8 @@
+# Tree
+
+Multiple-level structure list. See [Ant Design](https://ant.design/components/tree/) for more information.
+
+## Examples
+
+
+
diff --git a/docs/components/antd/tree/README.md b/docs/components/antd/tree/README.md
new file mode 100644
index 00000000..9ead8c07
--- /dev/null
+++ b/docs/components/antd/tree/README.md
@@ -0,0 +1,8 @@
+# Tree
+
+Multiple-level structure list. See [Ant Design](https://ant.design/components/tree/) for more information.
+
+## Examples
+
+
+
diff --git a/docs/components/antd/tree/app.py b/docs/components/antd/tree/app.py
new file mode 100644
index 00000000..0018b7c1
--- /dev/null
+++ b/docs/components/antd/tree/app.py
@@ -0,0 +1,6 @@
+from helper.Docs import Docs
+
+docs = Docs(__file__)
+
+if __name__ == "__main__":
+ docs.render().queue().launch()
diff --git a/docs/components/antd/tree/demos/basic.py b/docs/components/antd/tree/demos/basic.py
new file mode 100644
index 00000000..02753e00
--- /dev/null
+++ b/docs/components/antd/tree/demos/basic.py
@@ -0,0 +1,83 @@
+import gradio as gr
+
+import modelscope_studio.components.antd as antd
+import modelscope_studio.components.base as ms
+
+tree_data = [{
+ "title":
+ "parent 1",
+ "key":
+ "0-0",
+ "children": [{
+ "title":
+ "parent 1-0",
+ "key":
+ "0-0-0",
+ "disabled":
+ True,
+ "children": [{
+ "title": "leaf",
+ "key": "0-0-0-0",
+ "disableCheckbox": True
+ }, {
+ "title": "leaf",
+ "key": "0-0-0-1"
+ }]
+ }, {
+ "title": "parent 1-1",
+ "key": "0-0-1",
+ "children": [{
+ "title": "sss",
+ "key": "0-0-1-0"
+ }]
+ }]
+}]
+
+with gr.Blocks() as demo:
+ with ms.Application():
+ with antd.ConfigProvider():
+ antd.Tree(elem_style=dict(width="100%"),
+ checkable=True,
+ default_checked_keys=['0-0-0', '0-0-1'],
+ default_selected_keys=['0-0-0', '0-0-1'],
+ default_expanded_keys=['0-0-0', '0-0-1'],
+ tree_data=tree_data)
+ antd.Divider("Custom TreeNode")
+ with antd.Tree(show_line=True,
+ show_icon=True,
+ default_expanded_keys=['parent-1', 'parent-1-0'],
+ elem_style=dict(width=300)):
+ with ms.Slot("treeData"):
+ with antd.Tree.TreeNode(key="parent-1", title="parent 1"):
+ with ms.Slot("icon"):
+ antd.Icon("CarryOutOutlined")
+ with antd.Tree.TreeNode(key="parent-1-0",
+ title="parent 1-0"):
+ with ms.Slot("icon"):
+ antd.Icon("CarryOutOutlined")
+ with antd.Tree.TreeNode(key="leaf1",
+ title="leaf1"):
+ with ms.Slot("icon"):
+ antd.Icon("CarryOutOutlined")
+ with antd.Tree.TreeNode(key="leaf2",
+ title="leaf2"):
+ with ms.Slot("icon"):
+ antd.Icon("CarryOutOutlined")
+ with antd.Tree.TreeNode(key="leaf3",
+ title="leaf3"):
+ with ms.Slot("icon"):
+ antd.Icon("CarryOutOutlined")
+ with antd.Tree.TreeNode(
+ key="parent-1-1",
+ title="parent 1-1",
+ ):
+ with ms.Slot("icon"):
+ antd.Icon("CarryOutOutlined")
+ with antd.Tree.TreeNode(key="leaf11"):
+ with ms.Slot("title"):
+ antd.Typography.Text("leaf11",
+ type="success")
+ with ms.Slot("icon"):
+ antd.Icon("CarryOutOutlined")
+if __name__ == "__main__":
+ demo.queue().launch()
diff --git a/docs/components/antd/tree/demos/directory_tree.py b/docs/components/antd/tree/demos/directory_tree.py
new file mode 100644
index 00000000..515e2587
--- /dev/null
+++ b/docs/components/antd/tree/demos/directory_tree.py
@@ -0,0 +1,45 @@
+import gradio as gr
+
+import modelscope_studio.components.antd as antd
+import modelscope_studio.components.base as ms
+
+tree_data = [{
+ "title":
+ "parent 0",
+ "key":
+ "0-0",
+ "children": [{
+ "title": "leaf 0-0",
+ "key": "0-0-0",
+ "isLeaf": True
+ }, {
+ "title": "leaf 0-1",
+ "key": "0-0-1",
+ "isLeaf": True
+ }]
+}, {
+ "title":
+ "parent 1",
+ "key":
+ "0-1",
+ "children": [{
+ "title": "leaf 1-0",
+ "key": "0-1-0",
+ "isLeaf": True
+ }, {
+ "title": "leaf 1-1",
+ "key": "0-1-1",
+ "isLeaf": True
+ }]
+}]
+
+with gr.Blocks() as demo:
+ with ms.Application():
+ with antd.ConfigProvider():
+ antd.Tree.DirectoryTree(draggable=True,
+ multiple=True,
+ default_expand_all=True,
+ tree_data=tree_data)
+
+if __name__ == "__main__":
+ demo.queue().launch()
diff --git a/frontend/antd/segmented/segmented.tsx b/frontend/antd/segmented/segmented.tsx
index ad6b1e43..0d5255b7 100644
--- a/frontend/antd/segmented/segmented.tsx
+++ b/frontend/antd/segmented/segmented.tsx
@@ -26,7 +26,7 @@ export const Segmented = sveltify<
return (
options ||
renderItems(slotItems, {
- clone: true,
+ clone: false,
})
);
}, [options, slotItems])}
diff --git a/frontend/antd/tooltip/Index.svelte b/frontend/antd/tooltip/Index.svelte
index 7ac8e79c..a31ccfcc 100644
--- a/frontend/antd/tooltip/Index.svelte
+++ b/frontend/antd/tooltip/Index.svelte
@@ -19,7 +19,6 @@
export let _internal: {
layout?: boolean;
} = {};
- export let title = '';
export let as_item: string | undefined;
// gradio properties
export let visible = true;
@@ -36,7 +35,6 @@
elem_classes,
elem_style,
as_item,
- title,
restProps: $$restProps,
});
const slots = getSlots();
@@ -49,7 +47,6 @@
elem_classes,
elem_style,
as_item,
- title,
restProps: $$restProps,
});
@@ -64,7 +61,6 @@
{...$mergedProps.props}
{...bindEvents($mergedProps)}
slots={$slots}
- title={$mergedProps.props.title || $mergedProps.title}
>
diff --git a/frontend/svelte-preprocess-react/react-slot.tsx b/frontend/svelte-preprocess-react/react-slot.tsx
index 3a176c5c..465ee6b3 100644
--- a/frontend/svelte-preprocess-react/react-slot.tsx
+++ b/frontend/svelte-preprocess-react/react-slot.tsx
@@ -152,10 +152,10 @@ export const ReactSlot = forwardRef(
const _hasPortal = render();
if (_hasPortal) {
observer?.disconnect();
- observer?.observe(slot, {
- childList: true,
- subtree: true,
- });
+ // observer?.observe(slot, {
+ // childList: true,
+ // subtree: true,
+ // });
}
});
observer.observe(slot, {