mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 22:58:15 +00:00
fix: schema 变更处理
This commit is contained in:
parent
4dd2eefc90
commit
a0e5a266d6
@ -1,5 +1,7 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import { PluginProps } from '@ali/lowcode-types';
|
import { PluginProps, DataSource } from '@ali/lowcode-types';
|
||||||
|
import _get from 'lodash/get';
|
||||||
|
import _set from 'lodash/set';
|
||||||
import { DataSourcePane } from './pane';
|
import { DataSourcePane } from './pane';
|
||||||
import { DataSourcePaneImportPlugin, DataSourceType } from './types';
|
import { DataSourcePaneImportPlugin, DataSourceType } from './types';
|
||||||
import { DataSourceImportPluginCode } from './import-plugins';
|
import { DataSourceImportPluginCode } from './import-plugins';
|
||||||
@ -113,6 +115,18 @@ export default class DataSourcePanePlugin extends PureComponent<DataSourcePanePr
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleSchemaChange = (schema: DataSource) => {
|
||||||
|
const { editor } = this.props;
|
||||||
|
|
||||||
|
if (editor.get('designer')) {
|
||||||
|
const docSchema = editor.get('designer').project.currentDocument.schema;
|
||||||
|
_set(docSchema, 'componentsTree[0].dataSource', schema);
|
||||||
|
debugger;
|
||||||
|
editor.get('designer').project.currentDocument.import(docSchema);
|
||||||
|
console.log('editor schema', editor.get('designer').schema);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { importPlugins, dataSourceTypes = [], editor } = this.props;
|
const { importPlugins, dataSourceTypes = [], editor } = this.props;
|
||||||
const { active } = this.state;
|
const { active } = this.state;
|
||||||
@ -126,6 +140,7 @@ export default class DataSourcePanePlugin extends PureComponent<DataSourcePanePr
|
|||||||
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={defaultSchema}
|
||||||
|
onSchemaChange={this.handleSchemaChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user