muyun.my 4dd2eefc90 fix
2020-09-22 11:10:17 +08:00

84 lines
1.7 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.

## 低代码引擎 - 数据源面板插件
对页面的数据源进行管理(新建,编辑,导入)。
一个 pluginProps 的例子
```
{
importPlugins: [
{
name: 'code',
title: '源码',
content: DataSourceImportPluginCode,
},
],
dataSourceTypes: [
{
type: 'mopen',
schema: {
type: 'object',
properties: {
options: {
type: 'object',
properties: {
uri: {
title: 'api',
},
v: {
title: 'v',
type: 'string',
},
appKey: {
title: 'appKey',
type: 'string',
},
},
},
},
},
},
],
}
```
## 数据源类型定义
内置 fetchmtopjsonp 类型,支持传入自定义类型。
```
type DataSourceType = {
type: string;
optionsSchema: JSONSchema6
};
```
数据源类型需要在集团规范约束下扩展。目前只允许在 options 下添加扩展字段。
比如 mtop 类型,需要添加 options.v (版本)字段。
## 导入插件
默认支持源码导入,可以传入自定义插件。
```
interface DataSourcePaneImportPlugin {
name: string;
title: string;
component: React.ReactNode;
componentProps?: DataSourcePaneImportPluginCustomProps;
}
interface DataSourcePaneImportPluginComponentProps {
onImport?: (dataSourceList: DataSourceConfig[]) => void;
onCancel?: () => void;
dataSourceTypes?: DataSourceType[];
}
interface DataSourcePaneImportPluginCustomProps extends DataSourcePaneImportPluginComponentProps {
[customPropName: string]: any;
}
```