mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
feat: 🎸 与国凯的数据源引擎联调,对齐包名和导出方式
This commit is contained in:
parent
19fabc1760
commit
fea0946150
@ -42,19 +42,22 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
|
||||
|
||||
dataSourceItems.forEach((ds) => {
|
||||
if (!(ds.type in requestHandlersMap) && ds.type !== 'custom') {
|
||||
const handlerName = '__$$' + changeCase.camelCase(ds.type) + 'RequestHandler';
|
||||
const handlerFactoryName = '__$$create' + changeCase.pascal(ds.type) + 'RequestHandler';
|
||||
|
||||
requestHandlersMap[ds.type] = {
|
||||
type: 'JSExpression',
|
||||
value: handlerName + (ds.type === 'urlParams' ? '(this.props.location.search)' : ''),
|
||||
value: handlerFactoryName + (ds.type === 'urlParams' ? '(this.props.location.search)' : '()'),
|
||||
};
|
||||
|
||||
const handlerFactoryExportName = `create${changeCase.pascal(ds.type)}Handler`;
|
||||
const handlerPkgName = `@ali/lowcode-datasource-${changeCase.kebab(ds.type)}-handler`;
|
||||
|
||||
next.chunks.push({
|
||||
type: ChunkType.STRING,
|
||||
fileType: FileType.JSX,
|
||||
name: COMMON_CHUNK_NAME.ExternalDepsImport,
|
||||
content: `
|
||||
import ${handlerName} from '@ali/lowcode-datasource-engine/handlers/${changeCase.kebabCase(ds.type)}';
|
||||
import { ${handlerFactoryExportName} as ${handlerFactoryName} } from '${handlerPkgName}';
|
||||
`,
|
||||
linkAfter: [],
|
||||
});
|
||||
@ -69,7 +72,7 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
|
||||
fileType: FileType.JSX,
|
||||
name: COMMON_CHUNK_NAME.ExternalDepsImport,
|
||||
content: `
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||
`,
|
||||
linkAfter: [],
|
||||
});
|
||||
|
||||
@ -33,7 +33,12 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => {
|
||||
lint: 'eslint --ext .js --ext .jsx ./',
|
||||
},
|
||||
dependencies: {
|
||||
'@ali/lowcode-datasource-engine': '^0.1.0',
|
||||
'@ali/lowcode-datasource-engine': '*',
|
||||
// TODO: 如何动态获取下面这些依赖?
|
||||
'@ali/lowcode-datasource-url-params-handler': '*',
|
||||
'@ali/lowcode-datasource-fetch-handler': '*',
|
||||
'@ali/lowcode-datasource-mtop-handler': '*',
|
||||
'@ali/lowcode-datasource-mopen-handler': '*',
|
||||
'universal-env': '^3.2.0',
|
||||
'intl-messageformat': '^9.3.6',
|
||||
rax: '^1.1.0',
|
||||
|
||||
@ -8,7 +8,11 @@
|
||||
"lint": "eslint --ext .js --ext .jsx ./"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-datasource-engine": "^0.1.0",
|
||||
"@ali/lowcode-datasource-engine": "*",
|
||||
"@ali/lowcode-datasource-url-params-handler": "*",
|
||||
"@ali/lowcode-datasource-fetch-handler": "*",
|
||||
"@ali/lowcode-datasource-mtop-handler": "*",
|
||||
"@ali/lowcode-datasource-mopen-handler": "*",
|
||||
"universal-env": "^3.2.0",
|
||||
"intl-messageformat": "^9.3.6",
|
||||
"rax": "^1.1.0",
|
||||
|
||||
@ -7,7 +7,7 @@ import Page from 'rax-view';
|
||||
|
||||
import Text from 'rax-text';
|
||||
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||
|
||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||
|
||||
|
||||
@ -8,7 +8,11 @@
|
||||
"lint": "eslint --ext .js --ext .jsx ./"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-datasource-engine": "^0.1.0",
|
||||
"@ali/lowcode-datasource-engine": "*",
|
||||
"@ali/lowcode-datasource-url-params-handler": "*",
|
||||
"@ali/lowcode-datasource-fetch-handler": "*",
|
||||
"@ali/lowcode-datasource-mtop-handler": "*",
|
||||
"@ali/lowcode-datasource-mopen-handler": "*",
|
||||
"universal-env": "^3.2.0",
|
||||
"intl-messageformat": "^9.3.6",
|
||||
"rax": "^1.1.0",
|
||||
|
||||
@ -9,11 +9,11 @@ import Text from 'rax-text';
|
||||
|
||||
import Image from 'rax-image';
|
||||
|
||||
import __$$urlParamsRequestHandler from '@ali/lowcode-datasource-engine/handlers/url-params';
|
||||
import { createUrlParamsHandler as __$$createUrlParamsRequestHandler } from '@ali/lowcode-datasource-url-params-handler';
|
||||
|
||||
import __$$fetchRequestHandler from '@ali/lowcode-datasource-engine/handlers/fetch';
|
||||
import { createFetchHandler as __$$createFetchRequestHandler } from '@ali/lowcode-datasource-fetch-handler';
|
||||
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||
|
||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||
|
||||
@ -51,8 +51,8 @@ class Home$$Page extends Component {
|
||||
_dataSourceEngine = __$$createDataSourceEngine(this._dataSourceConfig, this._context, {
|
||||
runtimeConfig: true,
|
||||
requestHandlersMap: {
|
||||
urlParams: __$$urlParamsRequestHandler(this.props.location.search),
|
||||
fetch: __$$fetchRequestHandler,
|
||||
urlParams: __$$createUrlParamsRequestHandler(this.props.location.search),
|
||||
fetch: __$$createFetchRequestHandler(),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -8,7 +8,11 @@
|
||||
"lint": "eslint --ext .js --ext .jsx ./"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-datasource-engine": "^0.1.0",
|
||||
"@ali/lowcode-datasource-engine": "*",
|
||||
"@ali/lowcode-datasource-url-params-handler": "*",
|
||||
"@ali/lowcode-datasource-fetch-handler": "*",
|
||||
"@ali/lowcode-datasource-mtop-handler": "*",
|
||||
"@ali/lowcode-datasource-mopen-handler": "*",
|
||||
"universal-env": "^3.2.0",
|
||||
"intl-messageformat": "^9.3.6",
|
||||
"rax": "^1.1.0",
|
||||
|
||||
@ -11,7 +11,7 @@ import Link from 'rax-link';
|
||||
|
||||
import Image from 'rax-image';
|
||||
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||
|
||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import Link from 'rax-link';
|
||||
|
||||
import Image from 'rax-image';
|
||||
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||
|
||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import Link from 'rax-link';
|
||||
|
||||
import Image from 'rax-image';
|
||||
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||
|
||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||
|
||||
|
||||
@ -8,7 +8,11 @@
|
||||
"lint": "eslint --ext .js --ext .jsx ./"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-datasource-engine": "^0.1.0",
|
||||
"@ali/lowcode-datasource-engine": "*",
|
||||
"@ali/lowcode-datasource-url-params-handler": "*",
|
||||
"@ali/lowcode-datasource-fetch-handler": "*",
|
||||
"@ali/lowcode-datasource-mtop-handler": "*",
|
||||
"@ali/lowcode-datasource-mopen-handler": "*",
|
||||
"universal-env": "^3.2.0",
|
||||
"intl-messageformat": "^9.3.6",
|
||||
"rax": "^1.1.0",
|
||||
|
||||
@ -11,7 +11,7 @@ import Text from 'rax-text';
|
||||
|
||||
import Image from 'rax-image';
|
||||
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||
|
||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||
|
||||
|
||||
@ -8,7 +8,11 @@
|
||||
"lint": "eslint --ext .js --ext .jsx ./"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-datasource-engine": "^0.1.0",
|
||||
"@ali/lowcode-datasource-engine": "*",
|
||||
"@ali/lowcode-datasource-url-params-handler": "*",
|
||||
"@ali/lowcode-datasource-fetch-handler": "*",
|
||||
"@ali/lowcode-datasource-mtop-handler": "*",
|
||||
"@ali/lowcode-datasource-mopen-handler": "*",
|
||||
"universal-env": "^3.2.0",
|
||||
"intl-messageformat": "^9.3.6",
|
||||
"rax": "^1.1.0",
|
||||
|
||||
@ -7,7 +7,7 @@ import Page from 'rax-view';
|
||||
|
||||
import Text from 'rax-text';
|
||||
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine';
|
||||
import { create as __$$createDataSourceEngine } from '@ali/lowcode-datasource-engine/runtime';
|
||||
|
||||
import { isMiniApp as __$$isMiniApp } from 'universal-env';
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user