This commit is contained in:
muyun.my 2020-10-22 20:34:41 +08:00
parent 9a0a448778
commit 2d64a839ac
3 changed files with 13 additions and 9 deletions

View File

@ -2,4 +2,8 @@
[https://yuque.antfin-inc.com/ali-lowcode/docs/ip4awq](插件开发文档)。 [https://yuque.antfin-inc.com/ali-lowcode/docs/ip4awq](插件开发文档)。
本地开发需要在 v14.4.0 的 node 环境下进行。 [lowcode 组件库文档](https://fusion.alibaba-inc.com/22117/design/style/icon?themeid=4579)。
[搭建协议](https://yuque.antfin-inc.com/mo/spec/spec-low-code-building-schema)。
本地开发需要在 v14.4.0 的 node 环境下能完成 setup

View File

@ -1,6 +1,6 @@
{ {
"name": "@ali/lowcode-plugin-datasource-pane", "name": "@ali/lowcode-plugin-datasource-pane",
"version": "0.1.0-beta.3", "version": "0.1.0-beta.6",
"description": "低代码引擎数据源面板", "description": "低代码引擎数据源面板",
"main": "lib/index.js", "main": "lib/index.js",
"files": [ "files": [
@ -31,7 +31,7 @@
}, },
"dependencies": { "dependencies": {
"@alib/build-scripts": "^0.1.3", "@alib/build-scripts": "^0.1.3",
"@ali/lowcode-editor-setters": "^1.0.7-0", "@ali/lowcode-editor-setters": "^1.0.8-0",
"@alifd/next": "^1.20.28", "@alifd/next": "^1.20.28",
"@formily/next": "^1.3.2", "@formily/next": "^1.3.2",
"@formily/next-components": "^1.3.2", "@formily/next-components": "^1.3.2",
@ -43,7 +43,7 @@
"styled-components": "^5.2.0", "styled-components": "^5.2.0",
"traverse": "^0.6.6" "traverse": "^0.6.6"
}, },
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-plugin-datasource-pane@0.1.0-beta.1/build/index.html", "homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-plugin-datasource-pane@0.1.0-beta.6/build/index.html",
"publishConfig": { "publishConfig": {
"registry": "https://registry.npm.alibaba-inc.com" "registry": "https://registry.npm.alibaba-inc.com"
} }

View File

@ -120,10 +120,10 @@ export default class DataSourcePanePlugin extends PureComponent<DataSourcePanePr
// @TODO 姿势是否最优? // @TODO 姿势是否最优?
if (editor.get('designer')) { if (editor.get('designer')) {
const docSchema = editor.get('designer').project.currentDocument.schema; const docSchema = editor.get('designer').project.getSchema();
_set(docSchema, 'componentsTree[0].dataSource', schema); _set(docSchema, 'componentsTree[0].dataSource', schema);
editor.get('designer').project.currentDocument.import(docSchema); editor.get('designer').project.load(docSchema, true);
console.log('editor schema', editor.get('designer').schema); // console.log('check datasorce save result', editor.get('designer').project.getSchema());
} }
}; };
@ -133,13 +133,13 @@ export default class DataSourcePanePlugin extends PureComponent<DataSourcePanePr
if (!active) return null; if (!active) return null;
const defaultSchema = editor.get('designer').project?.currentDocument?.schema?.dataSource ?? {}; const projectSchema = editor.get('designer').project.getSchema() ?? {};
return ( return (
<DataSourcePane <DataSourcePane
importPlugins={BUILTIN_IMPORT_PLUGINS.concat(importPlugins)} importPlugins={BUILTIN_IMPORT_PLUGINS.concat(importPlugins)}
dataSourceTypes={BUILTIN_DATASOURCE_TYPES.concat(dataSourceTypes)} dataSourceTypes={BUILTIN_DATASOURCE_TYPES.concat(dataSourceTypes)}
defaultSchema={defaultSchema} defaultSchema={_get(projectSchema, 'componentsTree[0].dataSource')}
onSchemaChange={this.handleSchemaChange} onSchemaChange={this.handleSchemaChange}
/> />
); );