-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
1,166 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Anchor | ||
|
||
Hyperlinks to scroll on one page. See [Ant Design](https://ant.design/components/anchor/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic" fixed></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Anchor | ||
|
||
Hyperlinks to scroll on one page. See [Ant Design](https://ant.design/components/anchor/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic" fixed></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from helper.Docs import Docs | ||
|
||
docs = Docs(__file__) | ||
|
||
if __name__ == "__main__": | ||
docs.render().queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
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.Row(): | ||
with antd.Col(span=16): | ||
with ms.Div(elem_style=dict(maxHeight="700px", | ||
overflow="auto")): | ||
ms.Div(elem_id="part-1", | ||
elem_style=dict( | ||
height="100vh", | ||
background="rgba(255,0,0,0.02)")) | ||
ms.Div(elem_id="part-2", | ||
elem_style=dict( | ||
height="100vh", | ||
background="rgba(0,255,0,0.02)")) | ||
ms.Div(elem_id="part-3", | ||
elem_style=dict( | ||
height="100vh", | ||
background="rgba(0,0,255,0.02)")) | ||
with antd.Col(span=8): | ||
with antd.Anchor(): | ||
with antd.Anchor.Item(href="#part-1", key="part-1"): | ||
with ms.Slot("title"): | ||
antd.Typography.Title("Part 1") | ||
antd.Anchor.Item(title="Part 2", | ||
href="#part-2", | ||
key="part-2") | ||
antd.Anchor.Item(title="Part 3", | ||
href="#part-3", | ||
key="part-3") | ||
|
||
if __name__ == "__main__": | ||
demo.queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Breadcrumb | ||
|
||
Display the current location within a hierarchy. And allow going back to states higher up in the hierarchy. See [Ant Design](https://ant.design/components/breadcrumb/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Breadcrumb | ||
|
||
Display the current location within a hierarchy. And allow going back to states higher up in the hierarchy. See [Ant Design](https://ant.design/components/breadcrumb/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from helper.Docs import Docs | ||
|
||
docs = Docs(__file__) | ||
|
||
if __name__ == "__main__": | ||
docs.render().queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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.Breadcrumb(): | ||
antd.Breadcrumb.Item(title="Ant Design") | ||
with antd.Breadcrumb.Item(): | ||
with ms.Slot("title"): | ||
antd.Button(type="link", href="#") | ||
with antd.Breadcrumb.Item(): | ||
with ms.Slot("title"): | ||
antd.Button(type="link", href="General") | ||
with ms.Slot("menu.items"): | ||
with antd.Menu.Item(key="1"): | ||
with ms.Slot("label"): | ||
antd.Button( | ||
"General", | ||
type="link", | ||
href="https://modelscope.cn", | ||
href_target="_blank", | ||
) | ||
with antd.Menu.Item(key="2"): | ||
with ms.Slot("label"): | ||
antd.Button( | ||
"Layout", | ||
type="link", | ||
href="https://ant.design/", | ||
href_target="_blank", | ||
) | ||
with antd.Menu.Item(key="3"): | ||
with ms.Slot("label"): | ||
antd.Button( | ||
"Navigation", | ||
type="link", | ||
href="https://www.alipay.com/", | ||
href_target="_blank", | ||
) | ||
antd.Breadcrumb.Item(title="Button") | ||
|
||
if __name__ == "__main__": | ||
demo.queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ConfigProvider | ||
|
||
Provide a uniform configuration support for components. See [Ant Design](https://ant.design/components/config-provider/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ConfigProvider | ||
|
||
Provide a uniform configuration support for components. See [Ant Design](https://ant.design/components/config-provider/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from helper.Docs import Docs | ||
|
||
docs = Docs(__file__) | ||
|
||
if __name__ == "__main__": | ||
docs.render().queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import gradio as gr | ||
|
||
import modelscope_studio.components.antd as antd | ||
import modelscope_studio.components.base as ms | ||
|
||
default_locale = "en_US" | ||
default_direction = 'ltr' | ||
with gr.Blocks() as demo: | ||
with ms.Application(): | ||
with antd.ConfigProvider( | ||
locale=default_locale, | ||
direction=default_direction) as config_provider: | ||
with ms.Div(elem_style=dict(marginBottom=16)): | ||
ms.Span("change locale of components:", | ||
elem_style=dict(marginInlineEnd=16)) | ||
with antd.Radio.Group(value=default_locale) as locale: | ||
with antd.Radio("en_US"): | ||
ms.Text("English") | ||
with antd.Radio("zh_CN"): | ||
ms.Text("中文") | ||
with antd.Radio("jp_JP"): | ||
ms.Text("日本語") | ||
with antd.Radio("kr_KR"): | ||
ms.Text("한국어") | ||
with antd.Space(wrap=True): | ||
antd.DatePicker() | ||
antd.DatePicker.RangePicker() | ||
antd.TimePicker() | ||
antd.TimePicker.RangePicker() | ||
with ms.Div(elem_style=dict(marginBottom=16)): | ||
ms.Span("change direction of components:", | ||
elem_style=dict(marginInlineEnd=16)) | ||
with antd.Radio.Group(value=default_direction) as direction: | ||
with antd.Radio.Button("ltr"): | ||
ms.Text("LTR") | ||
with antd.Radio.Button("rtl"): | ||
ms.Text("RTL") | ||
antd.Input(placeholder="do something...") | ||
locale.change(fn=lambda _locale: gr.update(locale=_locale), | ||
inputs=[locale], | ||
outputs=[config_provider]) | ||
direction.change(fn=lambda _direction: gr.update(direction=_direction), | ||
inputs=[direction], | ||
outputs=[config_provider]) | ||
|
||
if __name__ == "__main__": | ||
demo.queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Dropdown | ||
|
||
A dropdown list. See [Ant Design](https://ant.design/components/dropdown/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Dropdown | ||
|
||
A dropdown list. See [Ant Design](https://ant.design/components/dropdown/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from helper.Docs import Docs | ||
|
||
docs = Docs(__file__) | ||
|
||
if __name__ == "__main__": | ||
docs.render().queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import gradio as gr | ||
|
||
import modelscope_studio.components.antd as antd | ||
import modelscope_studio.components.base as ms | ||
|
||
|
||
def Menu(): | ||
with antd.Menu.Item(key="1"): | ||
with ms.Slot("label"): | ||
antd.Button( | ||
"General", | ||
type="link", | ||
href="https://modelscope.cn", | ||
href_target="_blank", | ||
) | ||
with antd.Menu.Item(key="2"): | ||
with ms.Slot("label"): | ||
antd.Button( | ||
"Layout", | ||
type="link", | ||
href="https://ant.design/", | ||
href_target="_blank", | ||
) | ||
with antd.Menu.Item(key="3"): | ||
with ms.Slot("label"): | ||
antd.Button( | ||
"Navigation", | ||
type="link", | ||
href="https://www.alipay.com/", | ||
href_target="_blank", | ||
) | ||
|
||
|
||
with gr.Blocks() as demo: | ||
with ms.Application(): | ||
with antd.ConfigProvider(): | ||
with antd.Space(): | ||
with antd.Dropdown(): | ||
with antd.Button(type="text"): | ||
with antd.Space(): | ||
ms.Text("Hover me") | ||
antd.Icon("DownOutlined") | ||
with ms.Slot("menu.items"): | ||
Menu() | ||
with antd.Dropdown.Button(danger=True): | ||
ms.Text("Danger") | ||
with ms.Slot("menu.items"): | ||
Menu() | ||
|
||
if __name__ == "__main__": | ||
demo.queue().launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.