@cloudbase/framework-plugin-low-code 0.6.28 → 0.6.31
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/service/builder/generate.d.ts.map +1 -1
- package/lib/builder/service/builder/generate.js +9 -6
- package/lib/builder/types/common.d.ts +1 -1
- package/lib/builder/types/common.d.ts.map +1 -1
- package/lib/builder/types/common.js +1 -0
- package/lib/generator/types/common.d.ts +3 -1
- package/lib/generator/types/common.d.ts.map +1 -1
- package/lib/generator/types/common.js +6 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +66 -67
- package/lib/weapps-core/types/style.d.ts +1 -2
- package/lib/weapps-core/types/style.d.ts.map +1 -1
- package/lib/weapps-core/utils/style.d.ts +1 -1
- package/lib/weapps-core/utils/style.d.ts.map +1 -1
- package/package.json +1 -1
- package/template/mp/component/index.js +6 -2
- package/template/mp/page/index.js +6 -2
- package/template/src/datasources/{index.js → index.js.tpl} +2 -0
- package/template/src/handlers/FieldMiddleware/renderer.jsx +11 -6
- package/template/src/handlers/actionHandler/utils.js +41 -17
- package/template/src/handlers/utils/common.js +1 -1
- package/template/src/utils/history.js +4 -10
|
@@ -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;AAgB9B,OAAO,
|
|
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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AChC,qBAAqB,EAAE,MAAM,EAAE,QA0BhC;AAED,wBAAsB,kBAAkB,CACtC,cAAc,EAAE,kBAAkB,EAAE,EACpC,WAAW,EAAE,MAAM,EACnB,QAAQ,SAAK,EACb,aAAa,GAAE,SAAS,EAAO,iBA0ChC;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,MAAM,iBAuCpB;AAED,wBAAsB,iCAAiC,CACrD,eAAe,EAAE,aAAa,EAAE,EAChC,WAAW,EAAE,MAAM,iBA6EpB;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,iBAqFV"}
|
|
@@ -78,7 +78,7 @@ function generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependen
|
|
|
78
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
79
|
const fixedDependencies = dependencies;
|
|
80
80
|
const { componentSchemaJson, pluginInstances, listenerInstances: pageListenerInstances, style: PageStyle, data, } = pageInstance;
|
|
81
|
-
const { originComponentList, originActionList } = getOriginComponentAndActionList(componentSchemaJson, fixedDependencies);
|
|
81
|
+
const { originComponentList, originActionList, } = getOriginComponentAndActionList(componentSchemaJson, fixedDependencies);
|
|
82
82
|
const componentsMeta = yield util_1.getComponentsInfo(appBuildDir, dependencies);
|
|
83
83
|
const originPluginList = getOriginPluginList(pluginInstances, dependencies);
|
|
84
84
|
pullActionToListByInstances(pageListenerInstances, originActionList, fixedDependencies);
|
|
@@ -146,7 +146,7 @@ function getOriginComponentAndActionList(componentSchema, fixedDependencies, ori
|
|
|
146
146
|
if (fieldSchema.isObject()) {
|
|
147
147
|
const { 'x-props': xProps } = fieldSchema;
|
|
148
148
|
if (xProps) {
|
|
149
|
-
const { listenerInstances, sourceKey } = xProps;
|
|
149
|
+
const { listenerInstances, sourceKey, } = xProps;
|
|
150
150
|
pullComponentToListByInstance(sourceKey, originComponentList, fixedDependencies);
|
|
151
151
|
pullActionToListByInstances(listenerInstances, originActionList, fixedDependencies);
|
|
152
152
|
}
|
|
@@ -303,8 +303,7 @@ function getComponentSchemaString(componentSchema, isComposite = false, componen
|
|
|
303
303
|
var _a, _b;
|
|
304
304
|
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);
|
|
305
305
|
if (blockInstance) {
|
|
306
|
-
block.selectableBlock['x-props'].listenerInstances =
|
|
307
|
-
generateListnerInstances(blockInstance, isComposite);
|
|
306
|
+
block.selectableBlock['x-props'].listenerInstances = generateListnerInstances(blockInstance, isComposite);
|
|
308
307
|
}
|
|
309
308
|
return block;
|
|
310
309
|
});
|
|
@@ -543,7 +542,7 @@ function getPluginImportStringArr(plugins, pluginImportStringArr = []) {
|
|
|
543
542
|
exports.getPluginImportStringArr = getPluginImportStringArr;
|
|
544
543
|
function getComponentImportStringArr(components, componentImportStringArr = []) {
|
|
545
544
|
components.map((component) => __awaiter(this, void 0, void 0, function* () {
|
|
546
|
-
const { name, materialName, materialVersion, variableName, entries } = component;
|
|
545
|
+
const { name, materialName, materialVersion, variableName, entries, } = component;
|
|
547
546
|
let importString = '';
|
|
548
547
|
if (entries === null || entries === void 0 ? void 0 : entries.components) {
|
|
549
548
|
importString = `import { ${name} as ${lodash_1.default.upperFirst(variableName)} } from '${path_1.default.posix.join(`libraries/${materialName}@${materialVersion}`, entries === null || entries === void 0 ? void 0 : entries.components)}'`;
|
|
@@ -585,7 +584,7 @@ function getActionImportStringArr(originActionList, actionImportStringArr = [])
|
|
|
585
584
|
}
|
|
586
585
|
exports.getActionImportStringArr = getActionImportStringArr;
|
|
587
586
|
function pushActionToImportStringArr(listenerInstance, actionImportStringArr) {
|
|
588
|
-
const { name, materialName, materialVersion, variableName, entries } = listenerInstance;
|
|
587
|
+
const { name, materialName, materialVersion, variableName, entries, } = listenerInstance;
|
|
589
588
|
const componentsLibVariableName = util_3.camelcase(`${materialName}`);
|
|
590
589
|
const importString = (entries === null || entries === void 0 ? void 0 : entries.actions) ? `import { ${name} as ${variableName} } from '${path_1.default.posix.join(`libraries/${materialName}@${materialVersion}`, entries === null || entries === void 0 ? void 0 : entries.actions)}'`
|
|
591
590
|
: (entries === null || entries === void 0 ? void 0 : entries.entry) ? `const { ${name}: ${variableName} } = ${componentsLibVariableName}.actions`
|
|
@@ -742,6 +741,9 @@ function generateCodeFromTpl(appData, appBuildDir, dependencies, appKey, rootPat
|
|
|
742
741
|
.filter((m) => m.type === 'normal-module' && m.name !== '____index____')
|
|
743
742
|
.map((m) => m.name),
|
|
744
743
|
},
|
|
744
|
+
'datasources/index.js.tpl': {
|
|
745
|
+
isXPage: common_1.buildAsXPageByBuildType(buildTypeList),
|
|
746
|
+
},
|
|
745
747
|
'datasources/config.js.tpl': {
|
|
746
748
|
appID: appKey,
|
|
747
749
|
envID: appData.envId,
|
|
@@ -755,6 +757,7 @@ function generateCodeFromTpl(appData, appBuildDir, dependencies, appKey, rootPat
|
|
|
755
757
|
},
|
|
756
758
|
'handlers/utils/common.js': {
|
|
757
759
|
isAdminPortal: common_1.buildAsAdminPortalByBuildType(buildTypeList),
|
|
760
|
+
isXPage: common_1.buildAsXPageByBuildType(buildTypeList),
|
|
758
761
|
},
|
|
759
762
|
};
|
|
760
763
|
if (!rootPath) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BuildType, GenerateMpType, WebpackModeType, WebpackBuildCallBack, IPackageJson, buildAsWebByBuildType, buildAsAdminPortalByBuildType, IAppUsedComp, IUsedComps, ISyncProp, IComponentInputProps, IFileCodeMap, } from '../../generator/types/common';
|
|
1
|
+
export { BuildType, GenerateMpType, WebpackModeType, WebpackBuildCallBack, IPackageJson, buildAsWebByBuildType, buildAsAdminPortalByBuildType, buildAsXPageByBuildType, IAppUsedComp, IUsedComps, ISyncProp, IComponentInputProps, IFileCodeMap, } from '../../generator/types/common';
|
|
2
2
|
import { IComponentMeta, ICompositedComponent } from 'src/weapps-core';
|
|
3
3
|
export declare type IComponentsInfoMap = {
|
|
4
4
|
[componentSourceKey: string]: ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/builder/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,EACrB,6BAA6B,EAC7B,YAAY,EACZ,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,YAAY,GACb,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,oBAAY,kBAAkB,GAAG;IAC/B,CAAC,kBAAkB,EAAE,MAAM,GACvB,CAAC;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,GAAG;QAAE,WAAW,EAAE,KAAK,CAAA;KAAE,CAAC,GACnD,CAAC,oBAAoB,GAAG;QAAE,WAAW,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;CACpD,CAAC"}
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/builder/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,EACrB,6BAA6B,EAC7B,uBAAuB,EACvB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,YAAY,GACb,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,oBAAY,kBAAkB,GAAG;IAC/B,CAAC,kBAAkB,EAAE,MAAM,GACvB,CAAC;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,GAAG;QAAE,WAAW,EAAE,KAAK,CAAA;KAAE,CAAC,GACnD,CAAC,oBAAoB,GAAG;QAAE,WAAW,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;CACpD,CAAC"}
|
|
@@ -3,3 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var common_1 = require("../../generator/types/common");
|
|
4
4
|
Object.defineProperty(exports, "buildAsWebByBuildType", { enumerable: true, get: function () { return common_1.buildAsWebByBuildType; } });
|
|
5
5
|
Object.defineProperty(exports, "buildAsAdminPortalByBuildType", { enumerable: true, get: function () { return common_1.buildAsAdminPortalByBuildType; } });
|
|
6
|
+
Object.defineProperty(exports, "buildAsXPageByBuildType", { enumerable: true, get: function () { return common_1.buildAsXPageByBuildType; } });
|
|
@@ -6,7 +6,8 @@ export declare const enum BuildType {
|
|
|
6
6
|
MP = "mp",
|
|
7
7
|
APP = "app",
|
|
8
8
|
WECHAT_H5 = "wxH5",
|
|
9
|
-
WECHAT_WORK_H5 = "qywxH5"
|
|
9
|
+
WECHAT_WORK_H5 = "qywxH5",
|
|
10
|
+
XPAGE_PC = "xPagePC"
|
|
10
11
|
}
|
|
11
12
|
export declare const enum GenerateMpType {
|
|
12
13
|
APP = "app",
|
|
@@ -36,6 +37,7 @@ export interface IPackageJson {
|
|
|
36
37
|
}
|
|
37
38
|
export declare const buildAsWebByBuildType: (buildTypeList?: BuildType[]) => boolean;
|
|
38
39
|
export declare const buildAsAdminPortalByBuildType: (buildTypeList?: BuildType[]) => boolean;
|
|
40
|
+
export declare const buildAsXPageByBuildType: (buildTypeList?: BuildType[]) => boolean;
|
|
39
41
|
export interface IAppUsedComp {
|
|
40
42
|
rootPath: string;
|
|
41
43
|
usedComps: IUsedComps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/generator/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,0BAAkB,SAAS;IACzB,EAAE,OAAO;IACT,YAAY,gBAAgB;IAC5B,GAAG,QAAQ;IACX,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,SAAS,SAAS;IAClB,cAAc,WAAW;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/generator/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,0BAAkB,SAAS;IACzB,EAAE,OAAO;IACT,YAAY,gBAAgB;IAC5B,GAAG,QAAQ;IACX,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,SAAS,SAAS;IAClB,cAAc,WAAW;IACzB,QAAQ,YAAY;CACrB;AAED,0BAAkB,cAAc;IAC9B,GAAG,QAAQ;IACX,UAAU,eAAe;CAC1B;AAED,0BAAkB,eAAe;IAC/B,IAAI,KAAK;IACT,UAAU,eAAe;CAC1B;AAED,oBAAY,oBAAoB,GAAG,CACjC,GAAG,EAAE,GAAG,EACR,MAAM,CAAC,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAA;CAAE,KAC/D,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,EAAE;QACZ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;IACF,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,mBAAmB,SAAS,EAAE,YAU/D,CAAC;AAEF,eAAO,MAAM,6BAA6B,mBACzB,SAAS,EAAE,YAG3B,CAAC;AAEF,eAAO,MAAM,uBAAuB,mBAAmB,SAAS,EAAE,YAEjE,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,UAAU,CAAC;CACvB;AACD,oBAAY,UAAU,GAAG;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAE5D,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB;AACD,oBAAY,oBAAoB,GAAG;IACjC,CAAC,aAAa,EAAE,MAAM,GAAG;QACvB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,EAAE,CAAC;KAC7C,CAAC;CACH,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,CAAC,kBAAkB,EAAE,MAAM,GACvB,CAAC,cAAc,GAAG;QAAE,WAAW,EAAE,KAAK,CAAA;KAAE,CAAC,GACzC,CAAC,oBAAoB,GAAG;QAAE,WAAW,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,CAAC,QAAQ,EAAE,MAAM,GAAG;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildAsAdminPortalByBuildType = exports.buildAsWebByBuildType = void 0;
|
|
3
|
+
exports.buildAsXPageByBuildType = exports.buildAsAdminPortalByBuildType = exports.buildAsWebByBuildType = void 0;
|
|
4
4
|
exports.buildAsWebByBuildType = (buildTypeList = []) => {
|
|
5
5
|
return (buildTypeList.includes("web") ||
|
|
6
6
|
buildTypeList.includes("pc") ||
|
|
7
7
|
buildTypeList.includes("adminPortal") ||
|
|
8
8
|
buildTypeList.includes("app") ||
|
|
9
9
|
buildTypeList.includes("qywxH5") ||
|
|
10
|
-
buildTypeList.includes("wxH5")
|
|
10
|
+
buildTypeList.includes("wxH5") ||
|
|
11
|
+
buildTypeList.includes("xPagePC"));
|
|
11
12
|
};
|
|
12
13
|
exports.buildAsAdminPortalByBuildType = (buildTypeList = []) => {
|
|
13
14
|
return buildTypeList.includes("adminPortal");
|
|
14
15
|
};
|
|
16
|
+
exports.buildAsXPageByBuildType = (buildTypeList = []) => {
|
|
17
|
+
return buildTypeList.includes("xPagePC");
|
|
18
|
+
};
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AACpD,OAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAUrE,OAAO,EACL,SAAS,EAET,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AACpD,OAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAUrE,OAAO,EACL,SAAS,EAET,cAAc,EAIf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAWvD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAgB,MAAM,SAAS,CAAC;AAK7D,e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OAAO;IA6FP,MAAM;IAwGN,mBAAmB,CAAC,KAAK,KAAA,EAAE,KAAK,GAAE,OAAe;IAgBjD,eAAe,CAAC,KAAK,KAAA,EAAE,KAAK,GAAE,OAAe;IAqBnD,eAAe,CAAC,OAAO,KAAA;IAIjB,gBAAgB;IA4HhB,2BAA2B;IAuE3B,UAAU;IAwBV,OAAO,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA;IAejB,uBAAuB;IA2CvB,yBAAyB;CAyFhC;AAgCD,eAAO,MAAM,MAAM,sBAAgB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -81,7 +81,6 @@ const DEFAULT_INPUTS = {
|
|
|
81
81
|
dependencies: [],
|
|
82
82
|
plugins: [],
|
|
83
83
|
operationService: {},
|
|
84
|
-
publicPath: './',
|
|
85
84
|
extraData: { isComposite: false, compProps: {} },
|
|
86
85
|
mpAppId: '',
|
|
87
86
|
mpDeployPrivateKey: process.env.mpDeployPrivateKey || '',
|
|
@@ -124,31 +123,35 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
124
123
|
if (!this._resolvedInputs.mainAppSerializeData.mpPkgUrl) {
|
|
125
124
|
this._resolvedInputs.mainAppSerializeData = cals_1.deserializePlatformApp(cals, { dependencies: this._resolvedInputs.dependencies });
|
|
126
125
|
if ((_a = cals.extra) === null || _a === void 0 ? void 0 : _a.miniprogramPlugins) {
|
|
127
|
-
this._resolvedInputs.mainAppSerializeData.miniprogramPlugins =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
126
|
+
this._resolvedInputs.mainAppSerializeData.miniprogramPlugins = cals.extra.miniprogramPlugins.map((plugin) => {
|
|
127
|
+
var _a;
|
|
128
|
+
return Object.assign(Object.assign({}, plugin), { componentConfigs: ((_a = plugin.componentConfigs) === null || _a === void 0 ? void 0 : _a.map((component) => {
|
|
129
|
+
const { data, events, meta = {} } = component, restComponent = __rest(component, ["data", "events", "meta"]);
|
|
130
|
+
const processedCompoennt = Object.assign(Object.assign({}, restComponent), { meta: {
|
|
131
|
+
desc: (meta === null || meta === void 0 ? void 0 : meta.desc) || (meta === null || meta === void 0 ? void 0 : meta.description),
|
|
132
|
+
} });
|
|
133
|
+
if (data) {
|
|
134
|
+
processedCompoennt['dataForm'] = data.properties;
|
|
135
|
+
}
|
|
136
|
+
if (events) {
|
|
137
|
+
processedCompoennt['emitEvents'] = events === null || events === void 0 ? void 0 : events.map((event) => ({
|
|
138
|
+
eventName: event.name,
|
|
139
|
+
name: event.title,
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
return processedCompoennt;
|
|
143
|
+
})) || [] });
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (this._resolvedInputs.buildTypeList.includes("app") ||
|
|
147
|
+
this._resolvedInputs.buildTypeList.includes("xPagePC") ||
|
|
148
|
+
this._resolvedInputs.buildTypeList.includes("adminPortal")) {
|
|
149
|
+
this._resolvedInputs.mainAppSerializeData.historyType =
|
|
150
|
+
types_1.HISTORY_TYPE.HASH;
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
else {
|
|
150
|
-
this._resolvedInputs.mainAppSerializeData =
|
|
151
|
-
common_1.processPkgUrlCals2WeappData(cals);
|
|
154
|
+
this._resolvedInputs.mainAppSerializeData = common_1.processPkgUrlCals2WeappData(cals);
|
|
152
155
|
}
|
|
153
156
|
}
|
|
154
157
|
if (!((_b = this._resolvedInputs.mainAppSerializeData) === null || _b === void 0 ? void 0 : _b.envId)) {
|
|
@@ -164,7 +167,9 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
164
167
|
? `app/${appId}${((_c = this._resolvedInputs.deployOptions) === null || _c === void 0 ? void 0 : _c.mode) !== types_1.DEPLOY_MODE.UPLOAD
|
|
165
168
|
? '-preview'
|
|
166
169
|
: ''}`
|
|
167
|
-
:
|
|
170
|
+
: common_2.buildAsXPageByBuildType(this._resolvedInputs.buildTypeList)
|
|
171
|
+
? '/'
|
|
172
|
+
: path;
|
|
168
173
|
appConfig.window = window;
|
|
169
174
|
this._resolvedInputs.mainAppSerializeData.appConfig = appConfig;
|
|
170
175
|
this._resolvedInputs.subAppSerializeDataList = [];
|
|
@@ -173,7 +178,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
173
178
|
}
|
|
174
179
|
}
|
|
175
180
|
else {
|
|
176
|
-
const { mpAppId, mpDeployPrivateKey, deployOptions } = this._resolvedInputs;
|
|
181
|
+
const { mpAppId, mpDeployPrivateKey, deployOptions, } = this._resolvedInputs;
|
|
177
182
|
if (deployOptions.mpAppId === undefined) {
|
|
178
183
|
deployOptions.mpAppId = mpAppId;
|
|
179
184
|
}
|
|
@@ -296,7 +301,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
296
301
|
return __awaiter(this, void 0, void 0, function* () {
|
|
297
302
|
let { logger } = this.api;
|
|
298
303
|
const staticDir = path_1.default.resolve(__dirname, '../../../static');
|
|
299
|
-
let { debug, mainAppSerializeData, subAppSerializeDataList, dependencies, appId, buildTypeList, generateMpType, generateMpPath, plugins,
|
|
304
|
+
let { debug, mainAppSerializeData, subAppSerializeDataList, dependencies, appId, buildTypeList, generateMpType, generateMpPath, plugins, extraData = { isComposite: false, compProps: {} }, calsVersion, } = this._resolvedInputs;
|
|
300
305
|
const webpackMode = ((_a = this._resolvedInputs.deployOptions) === null || _a === void 0 ? void 0 : _a.mode) === types_1.DEPLOY_MODE.UPLOAD
|
|
301
306
|
? "production"
|
|
302
307
|
: "";
|
|
@@ -327,40 +332,44 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
327
332
|
throw e;
|
|
328
333
|
}
|
|
329
334
|
const domain = ((_b = this._website) === null || _b === void 0 ? void 0 : _b.cdnDomain) || ((_c = mainAppSerializeData.extra) === null || _c === void 0 ? void 0 : _c.domain);
|
|
330
|
-
if (common_2.buildAsWebByBuildType(buildTypeList)
|
|
331
|
-
this._resolvedInputs.deployOptions.mode === types_1.DEPLOY_MODE.UPLOAD) {
|
|
335
|
+
if (common_2.buildAsWebByBuildType(buildTypeList)) {
|
|
332
336
|
let { appConfig = {} } = mainAppSerializeData;
|
|
333
337
|
let { window = {} } = appConfig;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
338
|
+
if (common_2.buildAsXPageByBuildType(buildTypeList)) {
|
|
339
|
+
window.publicPath = `https://${domain}${this._getWebRootPath()}`;
|
|
340
|
+
}
|
|
341
|
+
else if (this._resolvedInputs.deployOptions.mode === types_1.DEPLOY_MODE.UPLOAD) {
|
|
342
|
+
try {
|
|
343
|
+
const { Data = {} } = yield this.api.cloudbaseManager
|
|
344
|
+
.commonService('lowcode', '2021-01-08')
|
|
345
|
+
.call({
|
|
346
|
+
Action: 'DescribeAppCustomUrls',
|
|
347
|
+
Param: {
|
|
348
|
+
EnvId: this.api.envId,
|
|
349
|
+
IgnorePublished: true,
|
|
350
|
+
WeAppId: appId,
|
|
351
|
+
},
|
|
352
|
+
});
|
|
353
|
+
this.api.logger.debug('DescribeAppCustomUrls:', (_d = Data === null || Data === void 0 ? void 0 : Data.Items) === null || _d === void 0 ? void 0 : _d[0]);
|
|
354
|
+
this._gatewayConfig = (_e = Data === null || Data === void 0 ? void 0 : Data.Items) === null || _e === void 0 ? void 0 : _e[0];
|
|
355
|
+
if (this._gatewayConfig) {
|
|
356
|
+
const path = this._gatewayConfig.Path;
|
|
357
|
+
window.publicPath = `https://${domain}${this._getWebRootPath()}`;
|
|
358
|
+
if (!common_2.buildAsAdminPortalByBuildType(buildTypeList)) {
|
|
359
|
+
window.basename = path;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
catch (e) {
|
|
364
|
+
this.api.logger.error('路由失败', e, {
|
|
340
365
|
EnvId: this.api.envId,
|
|
341
366
|
IgnorePublished: true,
|
|
342
367
|
WeAppId: appId,
|
|
343
|
-
}
|
|
344
|
-
});
|
|
345
|
-
this.api.logger.debug('DescribeAppCustomUrls:', (_d = Data === null || Data === void 0 ? void 0 : Data.Items) === null || _d === void 0 ? void 0 : _d[0]);
|
|
346
|
-
this._gatewayConfig = (_e = Data === null || Data === void 0 ? void 0 : Data.Items) === null || _e === void 0 ? void 0 : _e[0];
|
|
347
|
-
if (this._gatewayConfig) {
|
|
348
|
-
const path = this._gatewayConfig.Path;
|
|
349
|
-
window.publicPath = `https://${domain}${this._getWebRootPath()}`;
|
|
350
|
-
if (!common_2.buildAsAdminPortalByBuildType(buildTypeList)) {
|
|
351
|
-
window.basename = path;
|
|
352
|
-
}
|
|
353
|
-
appConfig.window = window;
|
|
354
|
-
this._resolvedInputs.mainAppSerializeData.appConfig = appConfig;
|
|
368
|
+
});
|
|
355
369
|
}
|
|
356
370
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
EnvId: this.api.envId,
|
|
360
|
-
IgnorePublished: true,
|
|
361
|
-
WeAppId: appId,
|
|
362
|
-
});
|
|
363
|
-
}
|
|
371
|
+
appConfig.window = window;
|
|
372
|
+
this._resolvedInputs.mainAppSerializeData.appConfig = appConfig;
|
|
364
373
|
}
|
|
365
374
|
try {
|
|
366
375
|
if (!debug) {
|
|
@@ -376,7 +385,6 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
376
385
|
dependencies,
|
|
377
386
|
appKey: appId,
|
|
378
387
|
nodeModulesPath,
|
|
379
|
-
publicPath,
|
|
380
388
|
buildTypeList,
|
|
381
389
|
runtime: this._resolvedInputs.runtime,
|
|
382
390
|
ignoreInstall: this._resolvedInputs.ignoreInstall,
|
|
@@ -396,7 +404,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
396
404
|
try {
|
|
397
405
|
const { appConfig = {} } = mainAppSerializeData;
|
|
398
406
|
const { publicPath = '' } = (appConfig === null || appConfig === void 0 ? void 0 : appConfig.window) || {};
|
|
399
|
-
const { outDir = '', timeElapsed = 0, plugins
|
|
407
|
+
const { outDir = '', timeElapsed = 0, plugins } = result || {};
|
|
400
408
|
if (buildTypeList.includes("mp")) {
|
|
401
409
|
miniAppDir = outDir;
|
|
402
410
|
}
|
|
@@ -816,12 +824,6 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
816
824
|
const [_, bucket, region, cosKey] = matched;
|
|
817
825
|
this.api.logger.debug(`解析持久化地址`, matched);
|
|
818
826
|
if (bucket && region && cosKey) {
|
|
819
|
-
console.log({
|
|
820
|
-
Bucket: bucket,
|
|
821
|
-
Region: region,
|
|
822
|
-
Key: cosKey,
|
|
823
|
-
Body: fs_extra_1.default.createReadStream(zipPath),
|
|
824
|
-
});
|
|
825
827
|
yield new Promise((resolve, reject) => {
|
|
826
828
|
cos.putObject({
|
|
827
829
|
Bucket: bucket,
|
|
@@ -875,7 +877,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
875
877
|
}
|
|
876
878
|
_postProcessAdminPortal() {
|
|
877
879
|
return __awaiter(this, void 0, void 0, function* () {
|
|
878
|
-
const { appId, buildTypeList, mainAppSerializeData, deployOptions } = this._resolvedInputs;
|
|
880
|
+
const { appId, buildTypeList, mainAppSerializeData, deployOptions, } = this._resolvedInputs;
|
|
879
881
|
if (common_2.buildAsAdminPortalByBuildType(buildTypeList)) {
|
|
880
882
|
try {
|
|
881
883
|
const isPreview = (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.PREVIEW;
|
|
@@ -921,14 +923,11 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
921
923
|
let { Domains: domainList } = yield hostingService.tcbCheckResource({
|
|
922
924
|
domains,
|
|
923
925
|
});
|
|
924
|
-
let historyType = ((_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.historyType)
|
|
925
|
-
this._resolvedInputs.buildTypeList.includes("app") ||
|
|
926
|
-
this._resolvedInputs.buildTypeList.includes("adminPortal")
|
|
927
|
-
? types_1.HISTORY_TYPE.HASH
|
|
926
|
+
let historyType = ((_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.historyType) ? types_1.HISTORY_TYPE.HASH
|
|
928
927
|
: '';
|
|
929
928
|
if (this._website) {
|
|
930
929
|
if (!historyType || historyType === types_1.HISTORY_TYPE.BROWSER) {
|
|
931
|
-
let { WebsiteConfiguration } = yield hostingService.getWebsiteConfig();
|
|
930
|
+
let { WebsiteConfiguration, } = yield hostingService.getWebsiteConfig();
|
|
932
931
|
let path = this._getWebRootPath();
|
|
933
932
|
let rules = (WebsiteConfiguration.RoutingRules || []).reduce((arr, rule) => {
|
|
934
933
|
let meta = {};
|
|
@@ -2,8 +2,7 @@ export declare type PX = string;
|
|
|
2
2
|
export declare type Percent = number;
|
|
3
3
|
export declare type Color = string;
|
|
4
4
|
export declare type URL = string;
|
|
5
|
-
|
|
6
|
-
export declare type CSSProperties = Properties<string | number>;
|
|
5
|
+
export declare type CSSProperties = any;
|
|
7
6
|
export interface ICommonStyle {
|
|
8
7
|
size?: ISizeStyle;
|
|
9
8
|
transform?: ITransformStyle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/weapps-core/types/style.ts"],"names":[],"mappings":"AAAA,oBAAY,EAAE,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/weapps-core/types/style.ts"],"names":[],"mappings":"AAAA,oBAAY,EAAE,GAAG,MAAM,CAAC;AACxB,oBAAY,OAAO,GAAG,MAAM,CAAC;AAC7B,oBAAY,KAAK,GAAG,MAAM,CAAC;AAC3B,oBAAY,GAAG,GAAG,MAAM,CAAC;AAMzB,oBAAY,aAAa,GAA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,EAAE,EAAE,CAAC;IACZ,IAAI,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -8,7 +8,7 @@ export declare function toCssStyle(commonStyle?: ICommonStyle, options?: {
|
|
|
8
8
|
export declare function removeInvalidStyleFormValue(styleForm?: ICommonStyle): ICommonStyle;
|
|
9
9
|
export declare function translateStyleToRpx(style?: CSSProperties): CSSProperties;
|
|
10
10
|
export declare function translateStyleToRem(style?: CSSProperties): CSSProperties;
|
|
11
|
-
export declare function translateStyleByHandler(style:
|
|
11
|
+
export declare function translateStyleByHandler(style: any, handler: (p: string) => string): {};
|
|
12
12
|
export declare function toREM(cssLen: number | string): string;
|
|
13
13
|
export declare function toRPX(cssLen: number | string): string;
|
|
14
14
|
export declare function removeWrapperBadEffectStyle(commonStyle?: CSSProperties): CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/weapps-core/utils/style.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAqBvD,wBAAgB,UAAU,CACxB,WAAW,GAAE,YAAiB,EAC9B,OAAO,GAAE;IACP,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACoD,GACrE,aAAa,CAwSf;AAED,wBAAgB,2BAA2B,CACzC,SAAS,GAAE,YAAiB,GAC3B,YAAY,CAcd;AAgED,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,aAAkB,GAAG,aAAa,CAE5E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,aAAkB,GAAG,aAAa,CAE5E;AAED,wBAAgB,uBAAuB,CACrC,KAAK,
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/weapps-core/utils/style.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAqBvD,wBAAgB,UAAU,CACxB,WAAW,GAAE,YAAiB,EAC9B,OAAO,GAAE;IACP,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACoD,GACrE,aAAa,CAwSf;AAED,wBAAgB,2BAA2B,CACzC,SAAS,GAAE,YAAiB,GAC3B,YAAY,CAcd;AAgED,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,aAAkB,GAAG,aAAa,CAE5E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,aAAkB,GAAG,aAAa,CAE5E;AAED,wBAAgB,uBAAuB,CACrC,KAAK,KAAoB,EACzB,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,MAW/B;AA0BD,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAiBrD;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAcrD;AAED,wBAAgB,2BAA2B,CACzC,WAAW,GAAE,aAAkB,GAC9B,aAAa,CAgBf;AAED,wBAAgB,sBAAsB,CACpC,WAAW,GAAE,aAAkB,GAC9B,aAAa,CAuBf;AAED,wBAAgB,SAAS,CACvB,KAAK,EAAE,aAAa,EACpB,SAAS,SAAqB,UAS/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/framework-plugin-low-code",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.31",
|
|
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",
|
|
@@ -24,7 +24,9 @@ const evtListeners = {<% Object.entries(eventHandlers).map(([handlerName, listen
|
|
|
24
24
|
key: '<%= l.key %>',
|
|
25
25
|
handler: <% if (l.type == 'rematch') {%> _handler<%= l.handler %> <%} else {%> <%= l.handler %> <%} %>,
|
|
26
26
|
data: <%= stringifyObj(l.data, {depth: null}) %>,
|
|
27
|
-
boundData: {<% Object.entries(l.boundData).map(([prop, expr])=>{%>'<%= prop %>':(lists, forItems, event, $context) => {const $for=forItems; return
|
|
27
|
+
boundData: {<% Object.entries(l.boundData).map(([prop, expr])=>{%>'<%= prop %>':(lists, forItems, event, $context) => {const $for=forItems; return (
|
|
28
|
+
<%= expr %>
|
|
29
|
+
)},
|
|
28
30
|
<%}) %>}
|
|
29
31
|
},<%})%>
|
|
30
32
|
],<%})%>
|
|
@@ -52,7 +54,9 @@ const handler = {<% handlers.forEach(h => {%>
|
|
|
52
54
|
|
|
53
55
|
const dataBinds = {<% Object.entries(dataBinds).map(([id, widgetBinds])=>{%>
|
|
54
56
|
<%= id %>: { <% Object.entries(widgetBinds).map(([prop, expr]) => { %>
|
|
55
|
-
<%= prop %>: function (lists, forItems, event, $context) {const $for=forItems; return
|
|
57
|
+
<%= prop %>: function (lists, forItems, event, $context) {const $for=forItems; return (
|
|
58
|
+
<%= expr %>
|
|
59
|
+
); },<% }) %>
|
|
56
60
|
},<%}) %>
|
|
57
61
|
}
|
|
58
62
|
|
|
@@ -19,14 +19,18 @@ const evtListeners = {<% Object.entries(eventHanlders).map(([handlerName, listen
|
|
|
19
19
|
key: '<%= l.key %>',
|
|
20
20
|
handler: <% if (l.type === 'rematch') {%> handlers.<%= l.handler %> <%} else if (l.type == 'material') {%> function(...args) { return require('../../materials/<%= l.handlerModule %>/actions/<%= l.handler %>/index').default(...args) } <%} else {%> <%= l.handler %> <%} %>,
|
|
21
21
|
data: <%= stringifyObj(l.data, {depth: null}) %>,
|
|
22
|
-
boundData: {<% Object.entries(l.boundData).map(([prop, expr])=>{%>'<%= prop %>':(lists, forItems, event, $context) => {const $for = forItems; return
|
|
22
|
+
boundData: {<% Object.entries(l.boundData).map(([prop, expr])=>{%>'<%= prop %>':(lists, forItems, event, $context) => {const $for = forItems; return (
|
|
23
|
+
<%= expr %>
|
|
24
|
+
)},
|
|
23
25
|
<%}) %>}
|
|
24
26
|
},<%})%>
|
|
25
27
|
],<%})%>
|
|
26
28
|
}
|
|
27
29
|
const dataBinds = {<% Object.entries(dataBinds).map(([id, widgetBinds])=>{%>
|
|
28
30
|
<%= id %>: { <% Object.entries(widgetBinds).map(([prop, expr]) => { %>
|
|
29
|
-
<%= prop %>: function (lists, forItems, event, $context) {const $for = forItems; return
|
|
31
|
+
<%= prop %>: function (lists, forItems, event, $context) {const $for = forItems; return (
|
|
32
|
+
<%= expr %>
|
|
33
|
+
); },<% }) %>
|
|
30
34
|
},<%}) %>
|
|
31
35
|
}
|
|
32
36
|
|
|
@@ -63,7 +63,7 @@ export const CompRenderer = observer(function (props) {
|
|
|
63
63
|
|
|
64
64
|
// 组件最终用于执行的事件函数
|
|
65
65
|
const emit = useCallback(
|
|
66
|
-
(trigger,
|
|
66
|
+
(trigger, eventDetail, forItems, scopeContext) => {
|
|
67
67
|
const listeners = listenerInstances || [];
|
|
68
68
|
|
|
69
69
|
// 如果是数据容器,则将传过来的data,赋值给容器上下文context
|
|
@@ -83,7 +83,7 @@ export const CompRenderer = observer(function (props) {
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
event = { detail:
|
|
86
|
+
let event = { detail: eventDetail, name: trigger };
|
|
87
87
|
forItems = {
|
|
88
88
|
...forItems,
|
|
89
89
|
forIndexes: getForIndexes(forItems, widgetsData),
|
|
@@ -105,14 +105,14 @@ export const CompRenderer = observer(function (props) {
|
|
|
105
105
|
|
|
106
106
|
// 选区最终用于执行的事件函数
|
|
107
107
|
const emitSB = useCallback(
|
|
108
|
-
(trigger,
|
|
108
|
+
(trigger, eventDetail, forItems, scopeContext, fieldData) => {
|
|
109
109
|
const listeners =
|
|
110
110
|
indexRef?.current !== undefined &&
|
|
111
111
|
typeRef?.current &&
|
|
112
112
|
fieldData?.[typeRef.current]?.[indexRef.current]?.selectableBlock?.[
|
|
113
113
|
'x-props'
|
|
114
114
|
]?.listenerInstances;
|
|
115
|
-
event = { detail:
|
|
115
|
+
let event = { detail: eventDetail, name: trigger };
|
|
116
116
|
forItems = {
|
|
117
117
|
...forItems,
|
|
118
118
|
forIndexes: getForIndexes(forItems, widgetsData),
|
|
@@ -164,7 +164,9 @@ export const CompRenderer = observer(function (props) {
|
|
|
164
164
|
try {
|
|
165
165
|
// 绑定了 for 变量,但计算值错误时,应当空数组兜底
|
|
166
166
|
forList =
|
|
167
|
-
dataBinds &&
|
|
167
|
+
dataBinds &&
|
|
168
|
+
dataBinds._waFor &&
|
|
169
|
+
(dataBinds._waFor(parentForItems, undefined, context) || []);
|
|
168
170
|
} catch (e) {
|
|
169
171
|
// 计算值出错则使用空数组兜底
|
|
170
172
|
forList = [];
|
|
@@ -305,7 +307,10 @@ export const CompRenderer = observer(function (props) {
|
|
|
305
307
|
|
|
306
308
|
return (
|
|
307
309
|
<Field
|
|
308
|
-
data={{
|
|
310
|
+
data={{
|
|
311
|
+
...fieldData,
|
|
312
|
+
_selectableBlockEvents: _selectableBlockEventsWithItem,
|
|
313
|
+
}}
|
|
309
314
|
id={compId}
|
|
310
315
|
{...componentProps}
|
|
311
316
|
emit={emitWithForItems}
|
|
@@ -11,31 +11,44 @@ export function getMetaInfoBySourceKey(sourceKey) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export function emitEvent(
|
|
14
|
+
export function emitEvent(
|
|
15
|
+
trigger,
|
|
16
|
+
listeners = [],
|
|
17
|
+
args,
|
|
18
|
+
scopeContext = {},
|
|
19
|
+
context
|
|
20
|
+
) {
|
|
15
21
|
const targetListeners = listeners.filter((l) => l.trigger === trigger);
|
|
16
22
|
targetListeners.forEach(async (listener) => {
|
|
17
23
|
// 当前非捕获Event,再判断冒泡行为
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
listener.noPropagation
|
|
21
|
-
) {
|
|
22
|
-
args?.customEventData?.detail?.stopPropagation();
|
|
24
|
+
if (!args?.event?.isCapturePhase && listener.noPropagation) {
|
|
25
|
+
args?.customEventData?.stopPropagation();
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
// 判断捕获的执行,只有执行的捕获与配置的捕获一致时。才会执行。
|
|
26
29
|
if (
|
|
27
30
|
(listener?.isCapturePhase || false) ===
|
|
28
|
-
(args?.customEventData?.
|
|
31
|
+
(args?.customEventData?.isCapturePhase || false)
|
|
29
32
|
) {
|
|
30
33
|
try {
|
|
31
34
|
const res = await invokeListener(listener, args, scopeContext, context);
|
|
32
35
|
const eventName = `${listener.key}.success`;
|
|
33
36
|
const event = {
|
|
34
|
-
detail:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
detail:
|
|
38
|
+
typeof res === 'object' && res !== null && !Array.isArray(res)
|
|
39
|
+
? {
|
|
40
|
+
...res,
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated 历史bug
|
|
43
|
+
* value,origin,isCapturePhase
|
|
44
|
+
*/
|
|
45
|
+
value: res,
|
|
46
|
+
origin: args.event,
|
|
47
|
+
isCapturePhase: !!args.event?.isCapturePhase,
|
|
48
|
+
}
|
|
49
|
+
: res,
|
|
50
|
+
origin: args.event,
|
|
51
|
+
isCapturePhase: !!args.event?.isCapturePhase,
|
|
39
52
|
name: eventName,
|
|
40
53
|
};
|
|
41
54
|
emitEvent(
|
|
@@ -49,14 +62,22 @@ export function emitEvent(trigger, listeners = [], args, scopeContext = {}, cont
|
|
|
49
62
|
scopeContext,
|
|
50
63
|
context
|
|
51
64
|
);
|
|
65
|
+
if (res) {
|
|
66
|
+
console.warn(
|
|
67
|
+
`@deprecated 事件编排中后续事件(${eventName}) event.detail.value.xxx 已废弃,建议使用 event.detail 直接访问前一动作返回值`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
52
70
|
} catch (e) {
|
|
53
71
|
const eventName = `${listener.key}.fail`;
|
|
72
|
+
try {
|
|
73
|
+
e.value = e;
|
|
74
|
+
e.origin = args.event;
|
|
75
|
+
e.isCapturePhase = !!args.event?.isCapturePhase;
|
|
76
|
+
} catch (e) {}
|
|
54
77
|
const event = {
|
|
55
|
-
detail:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
isCapturePhase: !!args.event?.isCapturePhase,
|
|
59
|
-
},
|
|
78
|
+
detail: e,
|
|
79
|
+
origin: args.event,
|
|
80
|
+
isCapturePhase: !!args.event?.isCapturePhase,
|
|
60
81
|
name: eventName,
|
|
61
82
|
};
|
|
62
83
|
emitEvent(
|
|
@@ -70,6 +91,9 @@ export function emitEvent(trigger, listeners = [], args, scopeContext = {}, cont
|
|
|
70
91
|
scopeContext,
|
|
71
92
|
context
|
|
72
93
|
);
|
|
94
|
+
console.warn(
|
|
95
|
+
`@deprecated 事件编排中后续事件(${eventName}) event.detail.value.xxx 已废弃,建议使用 event.detail 直接访问前一动作返回值`
|
|
96
|
+
);
|
|
73
97
|
// 之前 invoke 内部catch 了错误,不会抛错
|
|
74
98
|
// throw e
|
|
75
99
|
}
|
|
@@ -146,7 +146,7 @@ export function getStaticResourceAttribute(staticUrl) {
|
|
|
146
146
|
**/
|
|
147
147
|
const _AUTH_CACHE_MAP = {}
|
|
148
148
|
export async function checkAuth(app, appId, pageId) {
|
|
149
|
-
<% if(isAdminPortal){ %>return true;<% } %>
|
|
149
|
+
<% if(isAdminPortal||isXPage){ %>return true;<% } %>
|
|
150
150
|
const cacheKey = `${appId}-${pageId}`
|
|
151
151
|
if(_AUTH_CACHE_MAP[cacheKey] !== undefined) {
|
|
152
152
|
return _AUTH_CACHE_MAP[cacheKey]
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import { createHashHistory, createBrowserHistory } from 'history';
|
|
2
|
-
let history;
|
|
3
|
-
window._WEAPPS_HISTORY = history;
|
|
4
|
-
|
|
5
|
-
function removeS(path) {
|
|
6
|
-
if (path && path[0] === '/') {
|
|
7
|
-
return path.slice(1);
|
|
8
|
-
}
|
|
9
|
-
return path;
|
|
10
|
-
}
|
|
11
2
|
|
|
12
3
|
// if (!process.env.isMiniprogram) {
|
|
13
4
|
const createHistory =
|
|
@@ -16,11 +7,14 @@ const createHistory =
|
|
|
16
7
|
process.env.historyType === 'HASH'
|
|
17
8
|
? createHashHistory
|
|
18
9
|
: createBrowserHistory;
|
|
19
|
-
|
|
10
|
+
|
|
11
|
+
let history = createHistory({
|
|
20
12
|
basename: '', // The base URL of the app (see below)
|
|
21
13
|
forceRefresh: false, // Set true to force full page refreshes
|
|
22
14
|
keyLength: 6, // The length of location.key
|
|
23
15
|
});
|
|
16
|
+
window._WEAPPS_HISTORY = history;
|
|
17
|
+
|
|
24
18
|
// } else {
|
|
25
19
|
// history = {
|
|
26
20
|
// push(path) {
|