@cloudbase/lowcode-builder 1.0.13-alpha.0 → 1.0.15
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/config/index.d.ts +1 -1
- package/lib/builder/config/index.js +1 -1
- package/lib/builder/mp/lowcode.js +4 -8
- package/lib/builder/mp/wxml.js +5 -4
- package/lib/builder.web.js +13 -21
- package/package.json +5 -5
- package/template/html/index.html.ejs +1 -1
- package/template/mp/app/weapps-api.js +14 -14
- package/template/mp/common/util.js +43 -2
- package/template/mp/common/weapp-component.js +2 -2
- package/template/mp/common/weapp-page.js +11 -9
- package/template/mp/page/api.js +1 -1
- package/template/mp/page/index.js +0 -1
- package/dist/builder.web.js +0 -79
|
@@ -11,7 +11,7 @@ export declare const builderTemplateURL = "https://comp-public-1303824488.cos.ap
|
|
|
11
11
|
* miniprogram的代码,IDE插件后续会提供端功能
|
|
12
12
|
* 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488®ion=ap-shanghai&path=%252Flcap-builder%252F
|
|
13
13
|
*/
|
|
14
|
-
export declare const miniprogramURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/
|
|
14
|
+
export declare const miniprogramURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm_20220722.zip";
|
|
15
15
|
/**
|
|
16
16
|
* miniprogram_npm存放目录。IDE插件builder用到
|
|
17
17
|
*/
|
|
@@ -48,7 +48,7 @@ exports.builderTemplateURL = 'https://comp-public-1303824488.cos.ap-shanghai.myq
|
|
|
48
48
|
* miniprogram的代码,IDE插件后续会提供端功能
|
|
49
49
|
* 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488®ion=ap-shanghai&path=%252Flcap-builder%252F
|
|
50
50
|
*/
|
|
51
|
-
exports.miniprogramURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/
|
|
51
|
+
exports.miniprogramURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm_20220722.zip';
|
|
52
52
|
/**
|
|
53
53
|
* miniprogram_npm存放目录。IDE插件builder用到
|
|
54
54
|
*/
|
|
@@ -15,25 +15,21 @@ async function writeCode2file(mod, lowcodeRootDir, opts = {}, themeCode, ctx) {
|
|
|
15
15
|
if (mod.type !== 'style' && mod.type !== 'theme') {
|
|
16
16
|
if (appDir) {
|
|
17
17
|
// Generate app lowcode
|
|
18
|
-
const baseDir = path_1.default
|
|
19
|
-
.relative(path_1.default.dirname(file), appDir)
|
|
20
|
-
.replace(/\\/g, '/');
|
|
18
|
+
const baseDir = path_1.default.relative(path_1.default.dirname(file), appDir).replace(/\\/g, '/');
|
|
21
19
|
// 子包混合模式需要添加相对索引到根目录
|
|
22
|
-
const relativeRoot = (ctx === null || ctx === void 0 ? void 0 : ctx.isMixMode) && ctx.rootPath
|
|
23
|
-
? path_1.default.relative(ctx.rootPath, '') + '/'
|
|
24
|
-
: '';
|
|
20
|
+
const relativeRoot = (ctx === null || ctx === void 0 ? void 0 : ctx.isMixMode) && ctx.rootPath ? path_1.default.relative(ctx.rootPath, '') + '/' : '';
|
|
25
21
|
let weappsApiPrefix = [
|
|
26
22
|
`import { app, process } from '${relativeRoot}${baseDir}/app/weapps-api';`,
|
|
27
23
|
'const $app = app;',
|
|
28
24
|
]; // windows compatibility
|
|
29
25
|
if (pageId !== 'global') {
|
|
30
|
-
weappsApiPrefix.push(`import { $page } from '${
|
|
26
|
+
weappsApiPrefix.push(`import { $page } from '${baseDir}/pages/${pageId}/api'`);
|
|
31
27
|
}
|
|
32
28
|
code = `${weappsApiPrefix.join('\n')}\n${code}`;
|
|
33
29
|
}
|
|
34
30
|
else {
|
|
35
31
|
// Generate component lowcode
|
|
36
|
-
code = `import process from '${mod.type === 'handler-fn' ? '../' : ''}../../../../common/process'\nimport app from '${mod.type === 'handler-fn' ? '../' : ''}../../../../common/weapp-sdk'
|
|
32
|
+
code = `import process from '${mod.type === 'handler-fn' ? '../' : ''}../../../../common/process'\nimport app from '${mod.type === 'handler-fn' ? '../' : ''}../../../../common/weapp-sdk';\nconst $app = app;\n${code.replace(/\$comp/g, weapps_core_1.COMPONENT_API_PREFIX)}`;
|
|
37
33
|
}
|
|
38
34
|
}
|
|
39
35
|
else {
|
package/lib/builder/mp/wxml.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getUsedComponents = exports.getMpEventHanlderName = exports.generateWxml = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const weapps_core_1 = require("@cloudbase/lowcode-generator/lib/weapps-core");
|
|
8
9
|
const xml_js_1 = require("xml-js");
|
|
9
10
|
const mp_1 = require("@cloudbase/lowcode-generator/lib/generator/config/mp");
|
|
10
11
|
const materials_1 = require("./materials");
|
|
@@ -54,7 +55,7 @@ function generateWxml(widgets, docTag, wxmlDataPrefix, ctx, usingComponents, com
|
|
|
54
55
|
function createXml(widgets, parent = null, parentForNodes = []) {
|
|
55
56
|
var _a, _b, _c, _d, _e, _f;
|
|
56
57
|
const elements = [];
|
|
57
|
-
for (const id
|
|
58
|
+
for (const id in widgets) {
|
|
58
59
|
const { xComponent, xProps, properties, xIndex, genericComp } = widgets[id];
|
|
59
60
|
const { data: data0 = {}, listeners = [], directives = {}, staticResourceAttribute = ['src'] } = xProps || {};
|
|
60
61
|
const data = { ...data0 };
|
|
@@ -130,8 +131,8 @@ function generateWxml(widgets, docTag, wxmlDataPrefix, ctx, usingComponents, com
|
|
|
130
131
|
name: tagName,
|
|
131
132
|
attributes: {
|
|
132
133
|
id: idAttr,
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
'bind:attached': '__mnt__',
|
|
135
|
+
'bind:detached': '__unmnt__',
|
|
135
136
|
style: `{{${attrPrefix}.style}}`,
|
|
136
137
|
[(0, mp_1.getClassAttrName)(tagName)]: `{{${attrPrefix}.className}}`,
|
|
137
138
|
},
|
|
@@ -352,7 +353,7 @@ function getUsedComponents(widgets, usedCmps = {}) {
|
|
|
352
353
|
exports.getUsedComponents = getUsedComponents;
|
|
353
354
|
function getAttrBind(dVale, widgetBind, isStaticResource) {
|
|
354
355
|
const { type, value } = dVale;
|
|
355
|
-
const attrVal = widgetBind;
|
|
356
|
+
const attrVal = type === weapps_core_1.PropBindType.prop ? value : widgetBind;
|
|
356
357
|
return isStaticResource ? `{{wxsUtils._getStaticResourceAttribute(${attrVal})}}` : `{{${attrVal}}}`;
|
|
357
358
|
}
|
|
358
359
|
function getGenericCompTagName(propName) {
|