@cloudbase/framework-plugin-low-code 1.0.3-beta.9 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/builder/mp/lowcode.d.ts.map +1 -1
- package/lib/builder/mp/lowcode.js +3 -7
- package/lib/builder/service/builder/generate.d.ts.map +1 -1
- package/lib/builder/service/builder/generate.js +3 -0
- package/lib/generator/core/generate.d.ts.map +1 -1
- package/lib/generator/core/generate.js +11 -17
- package/lib/utils/dataSource.d.ts +4 -0
- package/lib/utils/dataSource.d.ts.map +1 -1
- package/lib/utils/dataSource.js +27 -12
- package/lib/weapps-core/utils/file.d.ts +1 -1
- package/package.json +3 -3
- package/template/src/app/common.js +0 -13
- package/template/src/app/global-api.js +0 -132
- package/template/src/app/handlers.js +0 -13
- package/template/src/app/material-actions.js +0 -16
- package/template/src/app/mountAppApis.js +0 -25
- package/template/src/app/mountMpApis.js +0 -4
- package/template/src/datasources/config.js.tpl +0 -27
- package/template/src/datasources/dataset-profiles.js.tpl +0 -5
- package/template/src/datasources/datasource-profiles.js.tpl +0 -4
- package/template/src/datasources/index.js.tpl +0 -27
- package/template/src/handlers/FieldMiddleware/renderer.jsx +0 -536
- package/template/src/handlers/HotAreas.js +0 -36
- package/template/src/handlers/PositionHandler.jsx +0 -8
- package/template/src/handlers/actionHandler/utils.js +0 -154
- package/template/src/handlers/componentEventActionEmitter.js +0 -29
- package/template/src/handlers/componentNodeMap.js +0 -24
- package/template/src/handlers/controller.js +0 -5
- package/template/src/handlers/emitComponentEvent.js +0 -8
- package/template/src/handlers/eventListener/componentEventListener.js +0 -15
- package/template/src/handlers/eventListener/hotAreaEventListener.js +0 -32
- package/template/src/handlers/eventListener/index.js +0 -29
- package/template/src/handlers/eventListener/pageEventListener.js +0 -11
- package/template/src/handlers/eventListener/types.js +0 -32
- package/template/src/handlers/hooks/index.js +0 -15
- package/template/src/handlers/initWebEnv.js +0 -4
- package/template/src/handlers/injectStyle.js +0 -14
- package/template/src/handlers/instanceMap.js +0 -39
- package/template/src/handlers/lifecycle.js +0 -222
- package/template/src/handlers/render.jsx +0 -170
- package/template/src/handlers/utils/common.js +0 -298
- package/template/src/handlers/utils/eventProxy.js +0 -64
- package/template/src/handlers/utils/events.js +0 -8
- package/template/src/handlers/utils/index.js +0 -4
- package/template/src/handlers/utils/widgets.js +0 -307
- package/template/src/index.jsx +0 -185
- package/template/src/index.less +0 -119
- package/template/src/libraries/default-lib/wx_yypt_report_v2.js +0 -441
- package/template/src/pages/app.tpl +0 -200
- package/template/src/pages/composite.tpl +0 -171
- package/template/src/router/index.tpl +0 -29
- package/template/src/store/computed.js +0 -11
- package/template/src/store/index.js +0 -40
- package/template/src/utils/formatEnum.js +0 -42
- package/template/src/utils/history.js +0 -66
- package/template/src/utils/index.js +0 -82
- package/template/src/utils/kbone.js +0 -18
- package/template/src/utils/monitor-jssdk.min.js +0 -763
- package/template/src/utils/request.js +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lowcode.d.ts","sourceRoot":"","sources":["../../../src/builder/mp/lowcode.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,UAAU,EAEV,oBAAoB,EAErB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,wBAAsB,cAAc,CAClC,GAAG,EAAE,UAAU,EACf,cAAc,EAAE,MAAM,EACtB,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,oBAAoB,CAAA;CAAO,EAC5E,SAAS,CAAC,EAAE,EAAE,EACd,GAAG,CAAC,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"lowcode.d.ts","sourceRoot":"","sources":["../../../src/builder/mp/lowcode.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,UAAU,EAEV,oBAAoB,EAErB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,wBAAsB,cAAc,CAClC,GAAG,EAAE,UAAU,EACf,cAAc,EAAE,MAAM,EACtB,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,oBAAoB,CAAA;CAAO,EAC5E,SAAS,CAAC,EAAE,EAAE,EACd,GAAG,CAAC,EAAE,aAAa,iBAwCpB"}
|
|
@@ -24,12 +24,8 @@ function writeCode2file(mod, lowcodeRootDir, opts = {}, themeCode, ctx) {
|
|
|
24
24
|
let code = mod.code;
|
|
25
25
|
if (mod.type !== 'style' && mod.type !== 'theme') {
|
|
26
26
|
if (appDir) {
|
|
27
|
-
const baseDir = path_1.default
|
|
28
|
-
|
|
29
|
-
.replace(/\\/g, '/');
|
|
30
|
-
const relativeRoot = (ctx === null || ctx === void 0 ? void 0 : ctx.isMixMode) && ctx.rootPath
|
|
31
|
-
? path_1.default.relative(ctx.rootPath, '') + '/'
|
|
32
|
-
: '';
|
|
27
|
+
const baseDir = path_1.default.relative(path_1.default.dirname(file), appDir).replace(/\\/g, '/');
|
|
28
|
+
const relativeRoot = (ctx === null || ctx === void 0 ? void 0 : ctx.isMixMode) && ctx.rootPath ? path_1.default.relative(ctx.rootPath, '') + '/' : '';
|
|
33
29
|
let weappsApiPrefix = `import { app, process } from '${relativeRoot}${baseDir}/app/weapps-api';\nconst $app = app;`;
|
|
34
30
|
if (pageId !== 'global') {
|
|
35
31
|
weappsApiPrefix += `\nimport { $page } from '${baseDir}/pages/${pageId}/api'`;
|
|
@@ -37,7 +33,7 @@ function writeCode2file(mod, lowcodeRootDir, opts = {}, themeCode, ctx) {
|
|
|
37
33
|
code = weappsApiPrefix + '\n' + code;
|
|
38
34
|
}
|
|
39
35
|
else {
|
|
40
|
-
code = `import process from '${mod.type === 'handler-fn' ? '../' : ''}../../../../common/process'\nimport app from '${mod.type === 'handler-fn' ? '../' : ''}../../../../
|
|
36
|
+
code = `import process from '${mod.type === 'handler-fn' ? '../' : ''}../../../../common/process'\nimport { app } from '${mod.type === 'handler-fn' ? '../' : ''}../../../../app/weapps-api';\nconst $app = app;\n${code.replace(/\$comp/g, weapps_core_1.COMPONENT_API_PREFIX)}`;
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
39
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/builder/service/builder/generate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAGxD,OAAO,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,EAEjB,oBAAoB,EACpB,eAAe,EAEf,aAAa,EAEb,kBAAkB,EAWlB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAY9B,OAAO,EAIL,SAAS,EACT,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGxF,MAAM,WAAW,cAAe,SAAQ,kBAAkB;CAAG;AAE7D,wBAAsB,wBAAwB,CAAC,cAAc,EAAE,kBAAkB,EAAE,EAAE,WAAW,EAAE,MAAM,iBAuBvG;AAED,wBAAsB,qBAAqB,CAAC,SAAS,oBAAa,EAAE,WAAW,EAAE,MAAM,iBAYtF;AAED,wBAAsB,sBAAsB,CAC1C,gBAAgB,EAAE,aAAa,EAAE,EACjC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,6BAAsB,EAClC,SAAS;iBACM,OAAO;eACT,GAAG;aAIf,EACD,aAAa,EAAE,GAAG,EAAE,iBAOrB;AAED,wBAAsB,yBAAyB,CAC7C,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,6BAAsB,EAClC,SAAS;iBACM,OAAO;eACT,GAAG;aAIf,EACD,aAAa,EAAE,GAAG,EAAE,iBAuFrB;AAED,wBAAgB,+BAA+B,CAC7C,eAAe,EAAE,oBAAoB,EACrC,iBAAiB,EAAE,aAAa,EAAE,EAClC,mBAAmB,GAAE,cAAc,EAAO,EAC1C,gBAAgB,GAAE,cAAc,EAAO;;;EAwBxC;AAED,wBAAgB,mBAAmB,CACjC,eAAe,GAAE,eAAe,EAAO,EACvC,YAAY,GAAE,aAAa,EAAO,EAClC,gBAAgB,GAAE,cAAc,EAAO,oBAqBxC;AAED,UAAU,gBAAiB,SAAQ,aAAa;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED,wBAAgB,2BAA2B,CACzC,iBAAiB,KAAA,EACjB,gBAAgB,KAAA,EAChB,iBAAiB,EAAE,gBAAgB,EAAE,QAuBtC;AAED,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,MAAM,EACjB,mBAAmB,EAAE,cAAc,EAAE,EACrC,iBAAiB,EAAE,gBAAgB,EAAE,QAmBtC;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,cAAc,EAAE,UAWlE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,4BAElC;AAED,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,oBAAoB,EACrC,WAAW,UAAQ,EACnB,iBAAiB,GAAE,kBAAuB,EAC1C,YAAY,CAAC,EAAE,MAAM;;;;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/builder/service/builder/generate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAGxD,OAAO,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,EAEjB,oBAAoB,EACpB,eAAe,EAEf,aAAa,EAEb,kB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AE,EACpC,WAAW,EAAE,MAAM,EACnB,QAAQ,SAAK,EACb,aAAa,GAAE,SAAS,EAAO,iBAiChC;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,iBAkCvF;AAED,wBAAsB,iCAAiC,CAAC,eAAe,EAAE,aAAa,EAAE,EAAE,WAAW,EAAE,MAAM,iBA+D5G;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,aAAa,EAAE,EAC7B,MAAM,EAAE,MAAM,EACd,QAAQ,KAAA,EACR,UAAU,EAAE,WAAW,EACvB,aAAa,EAAE,SAAS,EAAE,EAC1B,SAAS,KAAA,iBAoFV"}
|
|
@@ -359,6 +359,9 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
359
359
|
if (!Array.isArray(syncProp)) {
|
|
360
360
|
syncPropArr = [syncProp];
|
|
361
361
|
}
|
|
362
|
+
else {
|
|
363
|
+
syncPropArr = syncProp;
|
|
364
|
+
}
|
|
362
365
|
syncPropArr.forEach(({ changeEvent, valueFromEvent }) => {
|
|
363
366
|
xProps.listenerInstances.unshift({
|
|
364
367
|
trigger: changeEvent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/generator/core/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGV,oBAAoB,EAEpB,iBAAiB,EACjB,aAAa,EACb,aAAa,EAGb,kBAAkB,EAIlB,UAAU,EACV,UAAU,EACV,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/generator/core/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGV,oBAAoB,EAEpB,iBAAiB,EACjB,aAAa,EACb,aAAa,EAGb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W,EAAE,YAAY,EACzB,QAAQ,EAAE,MAAM,iBA4DjB;AAmBD,wBAAsB,mBAAmB,CAIvC,MAAM,EAAE,MAAM,EAId,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,GAAG,EACf,WAAW,EAAE,YAAY,EACzB,SAAS,EAAE,OAAO,EAClB,cAAc,EAAE,kBAAkB,EAAE,EACpC,aAAa,EAAE,UAAU,EAAE,EAC3B,UAAU,EAAE,WAAW,EAIvB,MAAM,EAAE,MAAM,iBAwEf"}
|
|
@@ -64,8 +64,7 @@ function getGenericCompFromDep(dependencies = []) {
|
|
|
64
64
|
compLib.components.forEach((component) => {
|
|
65
65
|
(0, util_1.deepDealComponentSchemaJson)(Object.values(component.componentInstances)[0], (componentSchema) => {
|
|
66
66
|
if (componentSchema === null || componentSchema === void 0 ? void 0 : componentSchema.genericComp) {
|
|
67
|
-
genericCompMap[`${component.materialName}:${component.name}`] =
|
|
68
|
-
componentSchema.genericComp;
|
|
67
|
+
genericCompMap[`${component.materialName}:${component.name}`] = componentSchema.genericComp;
|
|
69
68
|
}
|
|
70
69
|
});
|
|
71
70
|
});
|
|
@@ -81,7 +80,7 @@ function generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependen
|
|
|
81
80
|
const dstDir = path_1.default.join(appBuildDir, 'src', rootPath ? `packages/${rootPath}` : '');
|
|
82
81
|
const { componentSchemaJson, data, style } = pageInstance;
|
|
83
82
|
const genericCompMap = getGenericCompFromDep(dependencies);
|
|
84
|
-
const { originComponentList, originActionList
|
|
83
|
+
const { originComponentList, originActionList } = getOriginComponentAndActionList(componentSchemaJson, dependencies, [], [], genericCompMap);
|
|
85
84
|
const componentInfo = yield (0, util_1.getComponentsInfo)(appBuildDir, dependencies, fileCodeMap);
|
|
86
85
|
const { widgets, dataBinds, componentSchema } = getComponentSchemaString(componentSchemaJson, false, componentInfo);
|
|
87
86
|
const pageClass = [rootPath, pageInstance.id].filter(Boolean).join('-');
|
|
@@ -115,7 +114,7 @@ function getOriginComponentAndActionList(componentSchema, dependencies, originCo
|
|
|
115
114
|
if (fieldSchema.isObject()) {
|
|
116
115
|
const { 'x-props': xProps } = fieldSchema;
|
|
117
116
|
if (xProps) {
|
|
118
|
-
const { listenerInstances, sourceKey
|
|
117
|
+
const { listenerInstances, sourceKey } = xProps;
|
|
119
118
|
if (genericCompMap[sourceKey]) {
|
|
120
119
|
const genericProps = genericCompMap[sourceKey];
|
|
121
120
|
const genericComp = xProps.data[genericProps.propName];
|
|
@@ -220,9 +219,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
220
219
|
}
|
|
221
220
|
if (!isSlot(schema) && schema.key) {
|
|
222
221
|
const parentSchema = schema.parent;
|
|
223
|
-
compWidgets[schema.key] = Object.assign(Object.assign({}, data), { style: (0, weapps_core_1.toCssStyle)(commonStyle), classList: classNameList, widgetType: sourceKey, _parentId: isSlot(parentSchema)
|
|
224
|
-
? (_f = parentSchema.parent) === null || _f === void 0 ? void 0 : _f.key
|
|
225
|
-
: parentSchema.key });
|
|
222
|
+
compWidgets[schema.key] = Object.assign(Object.assign({}, data), { style: (0, weapps_core_1.toCssStyle)(commonStyle), classList: classNameList, widgetType: sourceKey, _parentId: isSlot(parentSchema) ? (_f = parentSchema.parent) === null || _f === void 0 ? void 0 : _f.key : parentSchema.key });
|
|
226
223
|
if (dataBinds.length > 0) {
|
|
227
224
|
compDataBinds[schema.key] = generateDataBinds(dataBinds, isComposite);
|
|
228
225
|
}
|
|
@@ -256,8 +253,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
256
253
|
if (propsVaule && Array.isArray(propsVaule)) {
|
|
257
254
|
propsVaule.map((block) => {
|
|
258
255
|
var _a, _b;
|
|
259
|
-
const blockInstance = (block === null || block === void 0 ? void 0 : block.selectableBlock) &&
|
|
260
|
-
((_b = (_a = block === null || block === void 0 ? void 0 : block.selectableBlock) === null || _a === void 0 ? void 0 : _a['x-props']) === null || _b === void 0 ? void 0 : _b.listenerInstances);
|
|
256
|
+
const blockInstance = (block === null || block === void 0 ? void 0 : block.selectableBlock) && ((_b = (_a = block === null || block === void 0 ? void 0 : block.selectableBlock) === null || _a === void 0 ? void 0 : _a['x-props']) === null || _b === void 0 ? void 0 : _b.listenerInstances);
|
|
261
257
|
if (blockInstance) {
|
|
262
258
|
block.selectableBlock['x-props'].listenerInstances = generateListnerInstances(blockInstance, isComposite);
|
|
263
259
|
}
|
|
@@ -284,8 +280,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
284
280
|
if (xProps['dataBinds'] && xProps['dataBinds'].length === 0) {
|
|
285
281
|
delete xProps['dataBinds'];
|
|
286
282
|
}
|
|
287
|
-
if (xProps['listenerInstances'] &&
|
|
288
|
-
xProps['listenerInstances'].length === 0) {
|
|
283
|
+
if (xProps['listenerInstances'] && xProps['listenerInstances'].length === 0) {
|
|
289
284
|
delete xProps['listenerInstances'];
|
|
290
285
|
}
|
|
291
286
|
if (xProps['data']) {
|
|
@@ -313,6 +308,9 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
313
308
|
if (!Array.isArray(syncProp)) {
|
|
314
309
|
syncPropArr = [syncProp];
|
|
315
310
|
}
|
|
311
|
+
else {
|
|
312
|
+
syncPropArr = syncProp;
|
|
313
|
+
}
|
|
316
314
|
syncPropArr.forEach(({ changeEvent, valueFromEvent }) => {
|
|
317
315
|
xProps.listenerInstances.unshift({
|
|
318
316
|
trigger: changeEvent,
|
|
@@ -499,9 +497,7 @@ function generateRouterFile(allAppDataList, appBuildDir, basename = '', fileCode
|
|
|
499
497
|
const pageFilePath = rootPath ? `/src/packages/${rootPath}/` : '/src/';
|
|
500
498
|
pageInstanceList.map((pageInstance) => {
|
|
501
499
|
const pageId = [rootPath, pageInstance.id].filter((i) => !!i).join('_');
|
|
502
|
-
const pagePath = rootPath
|
|
503
|
-
? `${rootPath}/${pageInstance.id}`
|
|
504
|
-
: `${pageInstance.id}`;
|
|
500
|
+
const pagePath = rootPath ? `${rootPath}/${pageInstance.id}` : `${pageInstance.id}`;
|
|
505
501
|
if (pageInstance.isHome && !rootPath) {
|
|
506
502
|
homePageId = pageId;
|
|
507
503
|
routerRenders.push(`<Redirect from="/" exact to="/${pageId}"/>`);
|
|
@@ -545,9 +541,7 @@ function writeLowCodeFiles(appData, appBuildDir, fileCodeMap, rootPath) {
|
|
|
545
541
|
yield Promise.all(appData.codeModules.map((m) => writeCode2file(m, 'global')));
|
|
546
542
|
yield Promise.all(appData.pageInstanceList.map((page) => __awaiter(this, void 0, void 0, function* () {
|
|
547
543
|
(0, style_1.generateDefaultStyle)(page);
|
|
548
|
-
yield page.codeModules
|
|
549
|
-
.filter((m) => m.name !== '____index____')
|
|
550
|
-
.forEach((m) => writeCode2file(m, page.id, page));
|
|
544
|
+
yield page.codeModules.filter((m) => m.name !== '____index____').forEach((m) => writeCode2file(m, page.id, page));
|
|
551
545
|
})));
|
|
552
546
|
function writeCode2file(mod, pageId, page) {
|
|
553
547
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IWebRuntimeAppData } from 'src/weapps-core';
|
|
1
2
|
export declare const CLOUD_FUNCTION_TYPE = "cloud-function";
|
|
2
3
|
export declare const EXTERNAL_FUNCTION_TYPE = "http";
|
|
3
4
|
export declare const DATABASE_TYPE = "database";
|
|
@@ -8,6 +9,9 @@ export declare function mergeDependencies(...pkgs: any[]): {};
|
|
|
8
9
|
export declare function lowercaseKey(obj: any, deep?: boolean): any;
|
|
9
10
|
export declare function standardizeDataSource(ds: any): any;
|
|
10
11
|
export declare function getDatasourceProfiles(datasources: any): any;
|
|
12
|
+
export declare function getDataVarProfiles(appData: IWebRuntimeAppData): {
|
|
13
|
+
$global: any[];
|
|
14
|
+
};
|
|
11
15
|
export declare function getDatasetProfiles(mainAppData: {
|
|
12
16
|
dataset?: any;
|
|
13
17
|
rootPath?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataSource.d.ts","sourceRoot":"","sources":["../../src/utils/dataSource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataSource.d.ts","sourceRoot":"","sources":["../../src/utils/dataSource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAiB,MAAM,iBAAiB,CAAC;AAMpE,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AACpD,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAC7C,eAAO,MAAM,aAAa,aAAa,CAAC;AAMxC,wBAAgB,yBAAyB,CAAC,UAAU,KAAA,EAAE,IAAI,KAAA,UAGzD;AAED,wBAAgB,4BAA4B,CAAC,KAAK,KAAA,EAAE,UAAU,KAAA,EAAE,IAAI,KAAA,UAGnE;AAMD,wBAAgB,yBAAyB,CAAC,QAAQ,KAAA,EAAE,IAAI,KAAA,iBAIvD;AAMD,wBAAgB,iBAAiB,CAAC,GAAG,IAAI,OAAA,MAexC;AAmBD,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,GAAG,CAU1D;AAOD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,GAAG,OA6C5C;AAOD,wBAAgB,qBAAqB,CAAC,WAAW,KAAA,OAehD;AAOD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB;;EAU7D;AAiCD,wBAAgB,kBAAkB,CAChC,WAAW,EAAE;IACX,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,EAAE,CAAC;CACxC,EACD,IAAI,CAAC,EAAE;IACL,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,EAAE,CAAC;CACxC,EAAE,MAiBJ"}
|
package/lib/utils/dataSource.js
CHANGED
|
@@ -3,27 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getDatasetProfiles = exports.getDatasourceProfiles = exports.standardizeDataSource = exports.lowercaseKey = exports.mergeDependencies = exports.getDatasourceDatabaseName = exports.getAppDatasourceResourceName = exports.getDatasourceResourceName = exports.DATABASE_TYPE = exports.EXTERNAL_FUNCTION_TYPE = exports.CLOUD_FUNCTION_TYPE = void 0;
|
|
6
|
+
exports.getDatasetProfiles = exports.getDataVarProfiles = exports.getDatasourceProfiles = exports.standardizeDataSource = exports.lowercaseKey = exports.mergeDependencies = exports.getDatasourceDatabaseName = exports.getAppDatasourceResourceName = exports.getDatasourceResourceName = exports.DATABASE_TYPE = exports.EXTERNAL_FUNCTION_TYPE = exports.CLOUD_FUNCTION_TYPE = void 0;
|
|
7
7
|
const merge_package_json_1 = __importDefault(require("merge-package-json"));
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const util_1 = require("
|
|
11
|
-
const
|
|
8
|
+
const types_1 = require("../types");
|
|
9
|
+
const expression_1 = require("@cloudbase/cals/lib/parser/expression");
|
|
10
|
+
const util_1 = require("../builder/mp/util");
|
|
11
|
+
const config_1 = require("../builder/config");
|
|
12
12
|
exports.CLOUD_FUNCTION_TYPE = 'cloud-function';
|
|
13
13
|
exports.EXTERNAL_FUNCTION_TYPE = 'http';
|
|
14
14
|
exports.DATABASE_TYPE = 'database';
|
|
15
15
|
function getDatasourceResourceName(datasrouce, mode) {
|
|
16
|
-
let suffix = mode ===
|
|
16
|
+
let suffix = mode === types_1.DEPLOY_MODE.PREVIEW ? `-preview` : '';
|
|
17
17
|
return `lcap-${datasrouce.id}-${datasrouce.name}${suffix}`;
|
|
18
18
|
}
|
|
19
19
|
exports.getDatasourceResourceName = getDatasourceResourceName;
|
|
20
20
|
function getAppDatasourceResourceName(appId, datasrouce, mode) {
|
|
21
|
-
let suffix = mode ===
|
|
21
|
+
let suffix = mode === types_1.DEPLOY_MODE.PREVIEW ? `-preview` : '';
|
|
22
22
|
return `lcap-${datasrouce.id}-${datasrouce.name}-${appId}${suffix}`;
|
|
23
23
|
}
|
|
24
24
|
exports.getAppDatasourceResourceName = getAppDatasourceResourceName;
|
|
25
25
|
function getDatasourceDatabaseName(dsConfig, mode) {
|
|
26
|
-
return dsConfig.type === exports.DATABASE_TYPE
|
|
26
|
+
return dsConfig.type === exports.DATABASE_TYPE
|
|
27
|
+
? getDatasourceResourceName(dsConfig, mode)
|
|
28
|
+
: null;
|
|
27
29
|
}
|
|
28
30
|
exports.getDatasourceDatabaseName = getDatasourceDatabaseName;
|
|
29
31
|
function mergeDependencies(...pkgs) {
|
|
@@ -33,7 +35,9 @@ function mergeDependencies(...pkgs) {
|
|
|
33
35
|
const formated = getDependencies(pkg);
|
|
34
36
|
for (let key in formated.dependencies) {
|
|
35
37
|
formated.dependencies[key] =
|
|
36
|
-
formated.dependencies[key] === '*' && ((_a = acc === null || acc === void 0 ? void 0 : acc.dependencies) === null || _a === void 0 ? void 0 : _a[key]) === '*'
|
|
38
|
+
formated.dependencies[key] === '*' && ((_a = acc === null || acc === void 0 ? void 0 : acc.dependencies) === null || _a === void 0 ? void 0 : _a[key]) === '*'
|
|
39
|
+
? 'latest'
|
|
40
|
+
: formated.dependencies[key];
|
|
37
41
|
}
|
|
38
42
|
const merged = (0, merge_package_json_1.default)(formated, acc);
|
|
39
43
|
return JSON.parse(merged);
|
|
@@ -109,6 +113,17 @@ function getDatasourceProfiles(datasources) {
|
|
|
109
113
|
})) || []);
|
|
110
114
|
}
|
|
111
115
|
exports.getDatasourceProfiles = getDatasourceProfiles;
|
|
116
|
+
function getDataVarProfiles(appData) {
|
|
117
|
+
const result = {
|
|
118
|
+
$global: (appData.vars && appData.vars.data) || [],
|
|
119
|
+
};
|
|
120
|
+
appData.pageInstanceList.forEach((pageInstance) => {
|
|
121
|
+
let p = pageInstance;
|
|
122
|
+
result[p.id] = (p.vars && p.vars.data) || [];
|
|
123
|
+
});
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
exports.getDataVarProfiles = getDataVarProfiles;
|
|
112
127
|
function _generateDynamicDataset(dataset) {
|
|
113
128
|
var _a;
|
|
114
129
|
let { state } = dataset;
|
|
@@ -121,13 +136,13 @@ function _generateDynamicDataset(dataset) {
|
|
|
121
136
|
let processed = {};
|
|
122
137
|
for (let paramKey in params) {
|
|
123
138
|
let bind = params[paramKey];
|
|
124
|
-
if (!bind.type || bind.type ===
|
|
139
|
+
if (!bind.type || bind.type === expression_1.PropBindType.static) {
|
|
125
140
|
let value = bind.value;
|
|
126
|
-
processed[paramKey] = `${
|
|
141
|
+
processed[paramKey] = `${config_1.REPLACE_SIGN}(app, $page) => (${typeof value === 'string' ? `'${value}'` : JSON.stringify(value)})${config_1.REPLACE_SIGN}`;
|
|
127
142
|
}
|
|
128
143
|
else {
|
|
129
144
|
let jsExp = (0, util_1.generateDataBind)(bind);
|
|
130
|
-
processed[paramKey] = `${
|
|
145
|
+
processed[paramKey] = `${config_1.REPLACE_SIGN}(app, $page) => (\n${jsExp || 'undefined'}\n)${config_1.REPLACE_SIGN}`;
|
|
131
146
|
}
|
|
132
147
|
}
|
|
133
148
|
config.initMethod.params = processed;
|
|
@@ -6,7 +6,7 @@ export declare function originJsonToFileList(appData: IWeAppData): (import("../t
|
|
|
6
6
|
code: string;
|
|
7
7
|
pageId: string;
|
|
8
8
|
})[];
|
|
9
|
-
export declare function getExtByType(type: CodeType): ".
|
|
9
|
+
export declare function getExtByType(type: CodeType): ".less" | ".js" | ".json";
|
|
10
10
|
export declare function HACK_FIX_LOWCODE_IN(code?: string): string;
|
|
11
11
|
export declare function HACK_FIX_LOWCODE_OUT(code?: string): string;
|
|
12
12
|
//# sourceMappingURL=file.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/framework-plugin-low-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@cloudbase/cals": "^0.4.
|
|
40
|
+
"@cloudbase/cals": "^0.4.7",
|
|
41
41
|
"@cloudbase/framework-core": "^1.8.16",
|
|
42
42
|
"@cloudbase/framework-plugin-auth": "^1.8.16",
|
|
43
43
|
"@cloudbase/framework-plugin-mp": "1.9.5-beta.0",
|
|
44
44
|
"@cloudbase/framework-plugin-website": "^1.8.17",
|
|
45
|
-
"@cloudbase/lowcode-builder": "^1.0.
|
|
45
|
+
"@cloudbase/lowcode-builder": "^1.0.33",
|
|
46
46
|
"@formily/react-schema-renderer": "1.1.7",
|
|
47
47
|
"archiver": "^4.0.1",
|
|
48
48
|
"compressing": "^1.4.0",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<% mods.forEach((mod) => {%>
|
|
2
|
-
import * as <%= mod %> from '../lowcode/common/<%= mod %>'<%}) %>
|
|
3
|
-
|
|
4
|
-
function getModule(targetModule) {
|
|
5
|
-
if(targetModule.__esModule) {
|
|
6
|
-
return targetModule.default ? targetModule.default : targetModule
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
<% mods.forEach((mod) => {%>
|
|
12
|
-
<%= mod %>: getModule(<%= mod %>),<%}) %>
|
|
13
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import * as sdk from '@tcwd/weapps-sdk';
|
|
2
|
-
import {
|
|
3
|
-
createWebApp,
|
|
4
|
-
_ACTIONS_KEY as ACTIONS_KEY,
|
|
5
|
-
_ROUTER_KEY as ROUTER_KEY,
|
|
6
|
-
} from '@cloudbase/weda-client';
|
|
7
|
-
import { createComputed } from 'utils';
|
|
8
|
-
import { createDataset } from '../datasources';
|
|
9
|
-
import store, { subPackageName } from '../store';
|
|
10
|
-
import computed from '../store/computed';
|
|
11
|
-
import common from './common';
|
|
12
|
-
import { formatEnum, enumOptions } from '../utils/formatEnum';
|
|
13
|
-
import { _isMobile } from '../utils';
|
|
14
|
-
import actionMap from './material-actions';
|
|
15
|
-
import { get as lodashGet } from 'lodash';
|
|
16
|
-
|
|
17
|
-
const mainAppKey = '__weappsMainApp';
|
|
18
|
-
const appGlobal = process.env.isMiniprogram ? getApp() : window;
|
|
19
|
-
|
|
20
|
-
export const app = createGlboalApi();
|
|
21
|
-
export const $page = createPageApi();
|
|
22
|
-
|
|
23
|
-
function createGlboalApi() {
|
|
24
|
-
const webApp = createWebApp({
|
|
25
|
-
id: '<%= appId %>',
|
|
26
|
-
domain: '<%= domain %>',
|
|
27
|
-
appConfig: <%= appConfig %>,
|
|
28
|
-
});
|
|
29
|
-
const globalAPI = {
|
|
30
|
-
id: '<%= appId %>',
|
|
31
|
-
domain: '<%= domain %>',
|
|
32
|
-
formActions: {},
|
|
33
|
-
pages: {},
|
|
34
|
-
session: {
|
|
35
|
-
// configure: sdk.configure,
|
|
36
|
-
// request: sdk.request,
|
|
37
|
-
// getSessionId: sdk.getSessionId,
|
|
38
|
-
},
|
|
39
|
-
state: store,
|
|
40
|
-
computed: createComputed(computed.global),
|
|
41
|
-
common,
|
|
42
|
-
invoke(params) {
|
|
43
|
-
return $page.invokeComponentMethod(params);
|
|
44
|
-
},
|
|
45
|
-
...webApp,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
globalAPI.__internal__.enumOptions = enumOptions;
|
|
49
|
-
globalAPI.utils.formatEnum = formatEnum;
|
|
50
|
-
globalAPI.utils._getConfig = () => {
|
|
51
|
-
console.warn('deprecated app.utils._getConfig');
|
|
52
|
-
return globalAPI.__internal__.getConfig();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const dataset = createDataset('$global');
|
|
56
|
-
globalAPI.dataset = dataset;
|
|
57
|
-
globalAPI.state.dataset = dataset;
|
|
58
|
-
globalAPI.setState = (userSetState) => {
|
|
59
|
-
Object.keys(userSetState).forEach((keyPath) => {
|
|
60
|
-
globalAPI.utils.set(globalAPI.dataset.state, keyPath, userSetState[keyPath]);
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
if (subPackageName) {
|
|
64
|
-
// is sub app
|
|
65
|
-
globalAPI.mainApp = appGlobal[mainAppKey];
|
|
66
|
-
} else {
|
|
67
|
-
// is mainApp
|
|
68
|
-
appGlobal.app = globalAPI;
|
|
69
|
-
appGlobal[mainAppKey] = globalAPI;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// 挂运营平台上报对象到app里
|
|
73
|
-
globalAPI.yyptReport = appGlobal.yyptReport;
|
|
74
|
-
|
|
75
|
-
// # expose some sdk modules
|
|
76
|
-
const sdkModsIncluded = ['flow', 'getPageOptions', 'getLaunchOptions'];
|
|
77
|
-
sdkModsIncluded.forEach((key) => {
|
|
78
|
-
globalAPI[key] = sdk[key];
|
|
79
|
-
});
|
|
80
|
-
return globalAPI;
|
|
81
|
-
}
|
|
82
|
-
function createPageApi() {
|
|
83
|
-
const $page = {
|
|
84
|
-
state: {},
|
|
85
|
-
computed: {},
|
|
86
|
-
handler: {},
|
|
87
|
-
props: {},
|
|
88
|
-
widgets: {},
|
|
89
|
-
// 页面数据源变量存储位置
|
|
90
|
-
dataVar: {},
|
|
91
|
-
};
|
|
92
|
-
$page.invokeComponentMethod = ({ component, method, params }) => {
|
|
93
|
-
const widgetData = lodashGet($page.widgets, component);
|
|
94
|
-
if (Array.isArray(widgetData)) {
|
|
95
|
-
throw new Error('调用方法失败:id为' + component + '的组件拥有多个实例');
|
|
96
|
-
// widgetData.forEach(widget => {
|
|
97
|
-
// if(!widget._methods[method]) {
|
|
98
|
-
// throw new Error('NOT_FOUND')
|
|
99
|
-
// } else {
|
|
100
|
-
// actions.push(widget._methods[method])
|
|
101
|
-
// }
|
|
102
|
-
// })
|
|
103
|
-
} else {
|
|
104
|
-
if (!widgetData._methods[method] || typeof widgetData._methods[method] != 'function') {
|
|
105
|
-
throw new Error('调用方法失败:未找到id为' + component + '下的方法' + method);
|
|
106
|
-
}
|
|
107
|
-
return widgetData._methods[method](params);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
return $page;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// 分app 和 wx 挂载app
|
|
114
|
-
export const mountAPIs = (sdks) => {
|
|
115
|
-
Object.keys(sdks).forEach((item) => {
|
|
116
|
-
let action = sdks[item];
|
|
117
|
-
if(item === 'showModal') {
|
|
118
|
-
const OFFICIAL_COMPONENT_LIB = 'gsd-h5-react';
|
|
119
|
-
const showModal = actionMap[OFFICIAL_COMPONENT_LIB]?.showModal;
|
|
120
|
-
if (!_isMobile() && showModal) {
|
|
121
|
-
action = function (params) {
|
|
122
|
-
return showModal({ data: params });
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
app[item] = action;
|
|
126
|
-
}
|
|
127
|
-
else if (!(item in ACTIONS_KEY) && !(item in ROUTER_KEY)) {
|
|
128
|
-
app[item] = action;
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
return app;
|
|
132
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<%for(const pageId in pageModules) {
|
|
2
|
-
pageModules[pageId].filter(mod => mod.type === 'handler-fn' && mod.name !== '____index____').forEach(mod => {%>
|
|
3
|
-
import <%= pageId%>_<%= mod.name%> from '../lowcode/<%= pageId%>/handler/<%= mod.name%>'<%
|
|
4
|
-
})
|
|
5
|
-
}%>
|
|
6
|
-
|
|
7
|
-
<% for(const pageId in pageModules) {%>
|
|
8
|
-
export const $$_<%=pageId %> = {<%
|
|
9
|
-
pageModules[pageId].filter(mod => mod.type === 'handler-fn' && mod.name !== '____index____').forEach(mod => {%>
|
|
10
|
-
['<%= mod.name%>']: <%= pageId%>_<%= mod.name%>,<%
|
|
11
|
-
}) %>
|
|
12
|
-
}
|
|
13
|
-
<%}%>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Imports all material actions
|
|
2
|
-
<% materials.map((material,index) => { if(material.entries && material.entries.actions){ %>
|
|
3
|
-
import * as <%= _.camelCase(material.name)%>Actions_<%= index%> from 'libraries/<%=material.name%>@<%= material.version %>/<%=material.entries.actions%>';
|
|
4
|
-
<% } else if(material.entries && material.entries.entry) {%>
|
|
5
|
-
import <%= _.camelCase(material.name)%>_<%= index%> from 'libraries/<%=material.name%>@<%= material.version %>/<%=material.entries.entry%>';
|
|
6
|
-
const <%= _.camelCase(material.name)%>Actions_<%= index%> = <%= _.camelCase(material.name)%>_<%= index%>.actions
|
|
7
|
-
<% } else { (material.actions || []).map(act => {%>
|
|
8
|
-
import <%= _.camelCase(material.name)%>_<%=act.name%> from 'libraries/<%=material.name%>@<%= material.version %>/actions/<%= act.name %>'
|
|
9
|
-
<% }) }}) %>
|
|
10
|
-
export default {
|
|
11
|
-
<% materials.map((material, index) => {
|
|
12
|
-
%> ['<%= material.name%>']:<% if(material.entries && (material.entries.entry || material.entries.actions)){ %> <%=_.camelCase(material.name)%>Actions_<%= index%>,
|
|
13
|
-
<% }else{ %> {<% (material.actions || []).map(act => { %>
|
|
14
|
-
['<%= act.name%>']: <%= _.camelCase(material.name)%>_<%=act.name%>,<%})%>
|
|
15
|
-
},
|
|
16
|
-
<%}}) %>}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { mountAPIs } from './global-api';
|
|
2
|
-
import sdk from '@tcwd/weapps-sdk/lib/app-h5-sdk';
|
|
3
|
-
|
|
4
|
-
mountAPIs(sdk);
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 适配 wx.navigateTo 用法
|
|
8
|
-
*/
|
|
9
|
-
function navigateTo({ url }) {
|
|
10
|
-
let paths = url.split('?');
|
|
11
|
-
let result = /pages\/([0-9a-zA-z_]+)\/index/.exec(paths[0]);
|
|
12
|
-
let hash = '';
|
|
13
|
-
if (result.length > 1) {
|
|
14
|
-
hash = `/${result[0]}`;
|
|
15
|
-
}
|
|
16
|
-
let path = `/${hash}`;
|
|
17
|
-
location.hash = `${path}${paths[1] ? `?${paths[1]}` : ''}`;
|
|
18
|
-
}
|
|
19
|
-
if (process.env.isApp) {
|
|
20
|
-
window.wx = {
|
|
21
|
-
...(window.wx || {}),
|
|
22
|
-
...sdk,
|
|
23
|
-
navigateTo,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import dataSourceProfiles from './datasource-profiles'
|
|
2
|
-
import datasetProfiles from './dataset-profiles'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 数据源基本配置
|
|
6
|
-
*/
|
|
7
|
-
export default {
|
|
8
|
-
/** 当前是否处于正式发布模式 */
|
|
9
|
-
isProd: <%= isProd %>,
|
|
10
|
-
/** 低码应用ID */
|
|
11
|
-
appID: '<%= appID %>',
|
|
12
|
-
/** 云开发环境ID */
|
|
13
|
-
envID: '<%= envID %>',
|
|
14
|
-
/** 应用端ID */
|
|
15
|
-
tcbClientId: '<%= clientID %>',
|
|
16
|
-
/** 数据源描述对象数组 */
|
|
17
|
-
dataSourceProfiles: dataSourceProfiles,
|
|
18
|
-
/**
|
|
19
|
-
* 新的dataset变量配置对象
|
|
20
|
-
* key 为页面ID(全局为$global), val 为变量配置数组
|
|
21
|
-
*/
|
|
22
|
-
datasetProfiles: datasetProfiles,
|
|
23
|
-
/**
|
|
24
|
-
* 是否开启私有化
|
|
25
|
-
*/
|
|
26
|
-
isPrivate: window._isPrivate || false
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { _WEDA_CLOUD_SDK as WEDA_CLOUD_SDK } from '@cloudbase/weda-client'
|
|
2
|
-
import config from './config';
|
|
3
|
-
|
|
4
|
-
const {
|
|
5
|
-
setConfig,
|
|
6
|
-
initTcb,
|
|
7
|
-
createDataset,
|
|
8
|
-
createStateDataSourceVar,
|
|
9
|
-
generateParamsParser,
|
|
10
|
-
EXTRA_API,
|
|
11
|
-
CLOUD_SDK,
|
|
12
|
-
DS_SDK
|
|
13
|
-
} = WEDA_CLOUD_SDK
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
createDataset,
|
|
17
|
-
createStateDataSourceVar,
|
|
18
|
-
generateParamsParser,
|
|
19
|
-
EXTRA_API,
|
|
20
|
-
CLOUD_SDK,
|
|
21
|
-
DS_SDK,
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
setConfig(config);
|
|
25
|
-
<% if(!isXPage){ %>
|
|
26
|
-
initTcb();
|
|
27
|
-
<%}%>
|