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