-
Notifications
You must be signed in to change notification settings - Fork 10
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
20 changed files
with
305 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
'@modelscope-studio/legacy-waterfall-gallery': patch | ||
'@modelscope-studio/legacy-multimodal-input': patch | ||
'@modelscope-studio/legacy-lifecycle': patch | ||
'@modelscope-studio/legacy-markdown': patch | ||
'@modelscope-studio/legacy-compiled': patch | ||
'@modelscope-studio/legacy-chatbot': patch | ||
'@modelscope-studio/legacy-flow': patch | ||
'@modelscope-studio/lint-config': patch | ||
'@modelscope-studio/changelog': patch | ||
'@modelscope-studio/antd': patch | ||
'@modelscope-studio/base': patch | ||
'@modelscope-studio/frontend': patch | ||
'modelscope_studio': patch | ||
--- | ||
|
||
fix: auto_loading & cloned node |
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,8 @@ | ||
# AutoComplete | ||
|
||
Autocomplete function of input field. See [Ant Design](https://ant.design/components/auto-complete/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> | ||
<demo name="lookup_patterns" title="Lookup-Patterns"></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,8 @@ | ||
# AutoComplete | ||
|
||
Autocomplete function of input field. See [Ant Design](https://ant.design/components/auto-complete/) for more information. | ||
|
||
## Examples | ||
|
||
<demo name="basic"></demo> | ||
<demo name="lookup_patterns" title="Lookup-Patterns"></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,32 @@ | ||
import gradio as gr | ||
|
||
import modelscope_studio.components.antd as antd | ||
import modelscope_studio.components.base as ms | ||
|
||
|
||
def on_search(e: gr.EventData): | ||
text = e._data["payload"][0] | ||
domains = ["gmail.com", "163.com", "qq.com"] | ||
if not text or "@" in text: | ||
return gr.update(options=[]) | ||
return gr.update(options=[{ | ||
"value": f"{text}@{domain}", | ||
"label": f"{text}@{domain}" | ||
} for domain in domains]) | ||
|
||
|
||
with gr.Blocks() as demo: | ||
with ms.Application(): | ||
with antd.ConfigProvider(): | ||
auto_complete = antd.AutoComplete(placeholder="Typing here...", | ||
elem_style=dict(width=200)) | ||
antd.Divider("Customize Input Component") | ||
with antd.AutoComplete() as customize_auto_complete: | ||
with ms.Slot("children"): | ||
antd.Input.Textarea(placeholder="Typing here...") | ||
auto_complete.search(on_search, outputs=[auto_complete]) | ||
customize_auto_complete.search(on_search, | ||
outputs=[customize_auto_complete]) | ||
|
||
if __name__ == "__main__": | ||
demo.queue().launch() |
57 changes: 57 additions & 0 deletions
57
docs/components/antd/auto_complete/demos/lookup_patterns.py
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,57 @@ | ||
import gradio as gr | ||
|
||
import modelscope_studio.components.antd as antd | ||
import modelscope_studio.components.base as ms | ||
|
||
|
||
def Title(title: str): | ||
with antd.Flex(align="center", justify="space-between"): | ||
ms.Span(title) | ||
|
||
antd.Button("more", | ||
type="link", | ||
href="https://www.google.com/search?q=antd", | ||
href_target="_blank") | ||
|
||
|
||
def AutoCompleteSubOption(title: str, count: int): | ||
with antd.AutoComplete.Option(value=title): | ||
with ms.Slot("label"): | ||
with antd.Flex(align="center", justify="space-between"): | ||
ms.Text(title) | ||
with ms.Span(): | ||
antd.Icon("UserOutlined") | ||
ms.Text(count) | ||
|
||
|
||
with gr.Blocks() as demo: | ||
with ms.Application(): | ||
with antd.ConfigProvider(): | ||
with antd.AutoComplete(elem_style=dict(width=250), | ||
size="large", | ||
popup_match_select_width=500): | ||
with ms.Slot("children"): | ||
antd.Input.Search(size="large", | ||
placeholder="Typing here...") | ||
with ms.Slot("options"): | ||
with antd.AutoComplete.Option(): | ||
with ms.Slot("label"): | ||
Title("Libraries") | ||
with ms.Slot("options"): | ||
AutoCompleteSubOption("Ant Design", 10000) | ||
AutoCompleteSubOption('AntDesign UI', 10600) | ||
with antd.AutoComplete.Option(): | ||
with ms.Slot("label"): | ||
Title("Solutions") | ||
with ms.Slot("options"): | ||
AutoCompleteSubOption('AntDesign UI FAQ', 60100) | ||
AutoCompleteSubOption('AntDesign FAQ', 30010) | ||
with antd.AutoComplete.Option(): | ||
with ms.Slot("label"): | ||
Title("Articles") | ||
with ms.Slot("options"): | ||
AutoCompleteSubOption('AntDesign design language', | ||
100000) | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Select | ||
|
||
A dropdown menu for displaying choices. See [Ant Design](https://ant.design/components/select/) 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 @@ | ||
# Select | ||
|
||
A dropdown menu for displaying choices. See [Ant Design](https://ant.design/components/select/) 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,50 @@ | ||
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"): | ||
antd.Select(elem_style=dict(width=200), | ||
allow_clear=True, | ||
options=[ | ||
{ | ||
"value": 'jack', | ||
"label": 'Jack' | ||
}, | ||
{ | ||
"value": 'lucy', | ||
"label": 'Lucy' | ||
}, | ||
{ | ||
"value": 'Yiminghe', | ||
"label": 'yiminghe' | ||
}, | ||
{ | ||
"value": 'disabled', | ||
"label": 'Disabled', | ||
"disabled": True | ||
}, | ||
]) | ||
# custom label | ||
with antd.Select( | ||
elem_style=dict(width=200), | ||
mode="multiple", | ||
): | ||
with antd.Select.Option(value="jack"): | ||
with ms.Slot("label"): | ||
antd.Tag("Jack", color="red") | ||
with antd.Select.Option(value="lucy"): | ||
with ms.Slot("label"): | ||
antd.Tag("Lucy", color="green") | ||
with antd.Select.Option(value="Yiminghe"): | ||
with ms.Slot("label"): | ||
antd.Tag("Yiminghe", color="blue") | ||
with antd.Select.Option(value="disabled", disabled=True): | ||
with ms.Slot("label"): | ||
antd.Tag("Disabled", color="gray") | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { sveltify } from '@svelte-preprocess-react'; | ||
import { Flex as AFlex, type GetProps } from 'antd'; | ||
|
||
export const Flex = sveltify<GetProps<typeof AFlex>>((props) => { | ||
return <AFlex {...props} />; | ||
}); | ||
export const Flex = sveltify<GetProps<typeof AFlex>>( | ||
({ children, ...props }) => { | ||
return <AFlex {...props}>{children}</AFlex>; | ||
} | ||
); | ||
|
||
export default Flex; |
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.