mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 09:41:57 +00:00
feat: 🎸 补充对数据源的一些处理
This commit is contained in:
parent
c3fdfe5af2
commit
4572b53f47
@ -16,6 +16,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/am-eslint-config": "*",
|
||||
"@ali/lowcode-types": "^0.8.14",
|
||||
"@ali/my-prettier": "^1.0.0",
|
||||
"@babel/generator": "^7.9.5",
|
||||
"@babel/parser": "^7.9.4",
|
||||
@ -32,7 +33,7 @@
|
||||
"ava": "^1.0.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-loader": "^6.2.2",
|
||||
"ts-node": "^7.0.1",
|
||||
"ts-node": "^8.10.2",
|
||||
"tsconfig-paths": "^3.9.0"
|
||||
},
|
||||
"ava": {
|
||||
|
||||
@ -34,7 +34,6 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
|
||||
linkAfter: [CLASS_DEFINE_CHUNK_NAME.Start],
|
||||
});
|
||||
|
||||
// TODO: 补充数据源的定义
|
||||
next.chunks.push({
|
||||
type: ChunkType.STRING,
|
||||
fileType: cfg.fileType,
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { DataSourceConfig } from '@ali/lowcode-types';
|
||||
|
||||
import { CLASS_DEFINE_CHUNK_NAME, COMMON_CHUNK_NAME } from '../../../const/generator';
|
||||
|
||||
import {
|
||||
@ -7,11 +9,12 @@ import {
|
||||
FileType,
|
||||
ICodeStruct,
|
||||
} from '../../../types';
|
||||
import { isContainerSchema } from '../../../utils/schema';
|
||||
import { RAX_CHUNK_NAME } from './const';
|
||||
|
||||
type PluginConfig = {
|
||||
fileType: string;
|
||||
}
|
||||
};
|
||||
|
||||
const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) => {
|
||||
const cfg: PluginConfig = {
|
||||
@ -51,23 +54,22 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
|
||||
content: `
|
||||
this._dataSourceEngine.reloadDataSource();
|
||||
`,
|
||||
linkAfter: [
|
||||
RAX_CHUNK_NAME.ClassDidMountStart,
|
||||
],
|
||||
linkAfter: [RAX_CHUNK_NAME.ClassDidMountStart],
|
||||
});
|
||||
|
||||
// TODO: 补充数据源的定义
|
||||
const dataSource = isContainerSchema(pre.ir) ? pre.ir.dataSource : null;
|
||||
const dataSourceItems: DataSourceConfig[] = dataSource && dataSource.list || [];
|
||||
|
||||
next.chunks.push({
|
||||
type: ChunkType.STRING,
|
||||
fileType: cfg.fileType,
|
||||
name: CLASS_DEFINE_CHUNK_NAME.InsPrivateMethod,
|
||||
// TODO: 下面的定义应该需要调用 @ali/lowcode-datasource-engine 的方法来搞:
|
||||
content: `
|
||||
_defineDataSourceList() {
|
||||
return [];
|
||||
return ${JSON.stringify(dataSourceItems)};
|
||||
}`,
|
||||
linkAfter: [
|
||||
RAX_CHUNK_NAME.ClassRenderEnd
|
||||
],
|
||||
linkAfter: [RAX_CHUNK_NAME.ClassRenderEnd],
|
||||
});
|
||||
|
||||
return next;
|
||||
|
||||
@ -19,7 +19,8 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => {
|
||||
const ir = next.ir as IProjectInfo;
|
||||
|
||||
const packageJson: IPackageJSON = {
|
||||
name: '@ali/rax-component-demo',
|
||||
name: '@ali/rax-app-demo',
|
||||
private: true,
|
||||
version: '1.0.0',
|
||||
scripts: {
|
||||
build:
|
||||
@ -29,6 +30,7 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => {
|
||||
lint: 'eslint --ext .js --ext .jsx ./',
|
||||
},
|
||||
dependencies: {
|
||||
'@ali/lowcode-datasource-engine': '^0.1.0',
|
||||
rax: '^1.1.0',
|
||||
'rax-app': '^2.0.0',
|
||||
'rax-document': '^0.1.0',
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "@ali/rax-component-demo",
|
||||
"name": "@ali/rax-app-demo",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"build": "rm -f ./dist/miniapp.tar.gz && npm run build:miniapp && cd build/miniapp && tar czf ../../dist/miniapp.tar.gz *",
|
||||
@ -8,6 +9,7 @@
|
||||
"lint": "eslint --ext .js --ext .jsx ./"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-datasource-engine": "^0.1.0",
|
||||
"rax": "^1.1.0",
|
||||
"rax-app": "^2.0.0",
|
||||
"rax-document": "^0.1.0",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user