tachybase_todo/packages/client/src/plugin-manager/index.md
2022-02-10 12:06:48 +08:00

60 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
nav:
path: /client
group:
path: /client
---
# PluginManager
## PluginManagerProvider
## PluginManager.Toolbar
插件管理器的工具栏,用于便捷的展示所有插件,不常用的可折叠显示。
<code src="./demos/demo1.tsx"/>
## PluginManager.Toolbar.Item
工具栏项,各个插件都可以配置自己的 `PluginManager.Toolbar.Item`
- `icon` pin 时,只显示 icon
- `title` pin 时title 以 tooltip 的方式显示
最简单的示例
```tsx | pure
Plugin1.ToolbarItem = () => {
return (
<PluginManager.Toolbar.Item
icon={<DatabaseOutlined />}
title={'Plugin1'}
onClick={() => {
alert('Plugin1');
}}
/>
);
};
```
弹出抽屉
```tsx | pure
Plugin2.ToolbarItem = () => {
const [visible, setVisible] = useState(false);
return (
<ActionContext.Provider value={{ visible, setVisible }}>
<PluginManager.Toolbar.Item
icon={<VerifiedOutlined />}
title={'Plugin2'}
onClick={() => {
setVisible(true);
}}
/>
<SchemaComponent scope={{ useCloseAction }} schema={schema} />
</ActionContext.Provider>
);
};
```