@cloudbase/framework-plugin-low-code 0.6.63 → 0.6.66
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/index.js +18 -0
- package/lib/weapps-core/utils/file.d.ts +1 -1
- package/package.json +1 -1
- package/template/html/index.html.ejs +4 -14
- package/template/mp/app/weapps-api.js +3 -1
- package/template/mp/common/util.js +46 -1
- package/template/src/app/global-api.js +4 -1
- package/template/src/utils/formatEnum.js +42 -0
package/lib/index.js
CHANGED
|
@@ -962,6 +962,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
962
962
|
});
|
|
963
963
|
}
|
|
964
964
|
_postProcessAdminPortal() {
|
|
965
|
+
var _a, _b;
|
|
965
966
|
return __awaiter(this, void 0, void 0, function* () {
|
|
966
967
|
const { appId, buildTypeList, mainAppSerializeData, deployOptions, } = this._resolvedInputs;
|
|
967
968
|
if (common_2.buildAsAdminPortalByBuildType(buildTypeList)) {
|
|
@@ -997,6 +998,23 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
997
998
|
catch (e) {
|
|
998
999
|
this.api.logger.error('门户路由注册失败: ', e);
|
|
999
1000
|
}
|
|
1001
|
+
try {
|
|
1002
|
+
if (((_b = (_a = this._resolvedInputs) === null || _a === void 0 ? void 0 : _a.deployOptions) === null || _b === void 0 ? void 0 : _b.mode) === types_1.DEPLOY_MODE.UPLOAD) {
|
|
1003
|
+
yield this.api.cloudbaseManager
|
|
1004
|
+
.commonService('lowcode', '2021-01-08')
|
|
1005
|
+
.call({
|
|
1006
|
+
Action: 'PublishAppCustomUrl',
|
|
1007
|
+
Param: {
|
|
1008
|
+
EnvId: this.api.envId,
|
|
1009
|
+
WeAppId: this._resolvedInputs.appId,
|
|
1010
|
+
},
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
this.api.logger.info('PublishAppCustomUrl成功');
|
|
1014
|
+
}
|
|
1015
|
+
catch (e) {
|
|
1016
|
+
this.api.logger.error('PublishAppCustomUrl失败: ', e);
|
|
1017
|
+
}
|
|
1000
1018
|
}
|
|
1001
1019
|
});
|
|
1002
1020
|
}
|
|
@@ -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": "0.6.
|
|
3
|
+
"version": "0.6.66",
|
|
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",
|
|
@@ -459,20 +459,10 @@
|
|
|
459
459
|
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/ajax/libs/mobx/5.15.7/mobx.umd.js?v=1"
|
|
460
460
|
crossorigin="anonymous"
|
|
461
461
|
></script>
|
|
462
|
-
<script
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
document.write(
|
|
467
|
-
`<script crossorigin="anonymous" src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.8-alpha.7/dist/h5.browser.js?v=1"><\/script>`
|
|
468
|
-
);
|
|
469
|
-
} else {
|
|
470
|
-
document.write(
|
|
471
|
-
`<script crossorigin="anonymous" src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.5/dist/h5.browser.js?v=1"><\/script>`
|
|
472
|
-
);
|
|
473
|
-
}
|
|
474
|
-
})();
|
|
475
|
-
</script>
|
|
462
|
+
<script
|
|
463
|
+
crossorigin="anonymous"
|
|
464
|
+
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.5/dist/h5.browser.js?v=1"
|
|
465
|
+
></script>
|
|
476
466
|
<script>
|
|
477
467
|
// zxing polifill
|
|
478
468
|
if (!this.globalThis) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { observable } from 'mobx'
|
|
2
|
-
import { createComputed, formatDate, getter, setter } from '<%= subLevelPath %>../common/util'
|
|
2
|
+
import { createComputed, formatDate, getter, setter, formatEnum, enumOptions} from '<%= subLevelPath %>../common/util'
|
|
3
3
|
import process from '<%= subLevelPath %>../common/process'
|
|
4
4
|
import { DS_SDK, CLOUD_SDK, createDataset, EXTRA_API } from '<%= subLevelPath %>../datasources/index'
|
|
5
5
|
import appGlobal from '<%= subLevelPath %>../app/app-global'
|
|
@@ -33,6 +33,7 @@ function createGlboalApi() {
|
|
|
33
33
|
//request: sdk.request,
|
|
34
34
|
//getSessionId: sdk.getSessionId,
|
|
35
35
|
},
|
|
36
|
+
enumOptions: enumOptions,
|
|
36
37
|
state: observable(state),
|
|
37
38
|
computed: createComputed(computed),
|
|
38
39
|
common,
|
|
@@ -51,6 +52,7 @@ function createGlboalApi() {
|
|
|
51
52
|
},
|
|
52
53
|
utils: {
|
|
53
54
|
formatDate,
|
|
55
|
+
formatEnum,
|
|
54
56
|
get: getter,
|
|
55
57
|
set: setter,
|
|
56
58
|
_getConfig: function () {
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import { findForItemsOfWidget, mpCompToWidget } from './widget'
|
|
4
4
|
import lodashGet from 'lodash.get';
|
|
5
5
|
import lodashSet from 'lodash.set';
|
|
6
|
-
|
|
6
|
+
import { observable } from 'mobx';
|
|
7
|
+
import { app } from '../app/weapps-api'
|
|
7
8
|
/**
|
|
8
9
|
* Convert abcWordSnd -> abc-word-snd
|
|
9
10
|
*/
|
|
@@ -549,8 +550,52 @@ class CustomDate {
|
|
|
549
550
|
|
|
550
551
|
const dataInstance = new CustomDate();
|
|
551
552
|
export const formatDate = new CustomDate().format.bind(dataInstance);
|
|
553
|
+
|
|
554
|
+
let loading = {};
|
|
555
|
+
export let enumOptions = observable({});
|
|
556
|
+
export function formatEnum(path, optionname) {
|
|
557
|
+
// 判断是单选还是多选
|
|
558
|
+
let isSingle = Array.isArray(path);
|
|
559
|
+
// 获取到options
|
|
560
|
+
let parseOptions = getEnumOptions(optionname);
|
|
561
|
+
if (parseOptions === '') {
|
|
562
|
+
return !isSingle ? path : path.join(',');
|
|
563
|
+
}
|
|
564
|
+
let multiTmp = [];
|
|
565
|
+
let value = !isSingle
|
|
566
|
+
? JSON.parse(parseOptions)?.find((item) => item?.key === path)?.value
|
|
567
|
+
: JSON.parse(parseOptions)
|
|
568
|
+
?.filter((item) => path.some((pathValue) => item?.key === pathValue))
|
|
569
|
+
.map((item) => multiTmp.push(item?.value));
|
|
570
|
+
// 对多选或者单选有不同处理
|
|
571
|
+
return !isSingle ? value : multiTmp?.join(',');
|
|
572
|
+
}
|
|
573
|
+
function getEnumOptions(optionName) {
|
|
574
|
+
if (enumOptions[optionName]) {
|
|
575
|
+
return enumOptions[optionName];
|
|
576
|
+
}
|
|
577
|
+
if (!loading[optionName]) {
|
|
578
|
+
loading[optionName] = true;
|
|
579
|
+
getGeneralOptions(optionName).then((data) => {
|
|
580
|
+
enumOptions[optionName] = data?.Items[0]?.Config;
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
return '';
|
|
584
|
+
}
|
|
585
|
+
export async function getGeneralOptions(optionName) {
|
|
586
|
+
return app.cloud.callWedaApi({
|
|
587
|
+
action: 'DescribeGeneralOptionsDetailList',
|
|
588
|
+
data: {
|
|
589
|
+
PageSize: 1,
|
|
590
|
+
PageIndex: 1,
|
|
591
|
+
LikeNameOrTitle: optionName,
|
|
592
|
+
},
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
|
|
552
596
|
export const utils = {
|
|
553
597
|
formatDate,
|
|
554
598
|
get: getter,
|
|
555
599
|
set: setter,
|
|
600
|
+
formatEnum
|
|
556
601
|
};
|
|
@@ -5,6 +5,7 @@ import store, { subPackageName } from '../store';
|
|
|
5
5
|
import computed from '../store/computed';
|
|
6
6
|
import common from './common';
|
|
7
7
|
import { formatDate } from '../utils/date';
|
|
8
|
+
import { formatEnum, enumOptions } from '../utils/formatEnum';
|
|
8
9
|
import { getter, setter, _isMobile } from '../utils';
|
|
9
10
|
import actionMap from './material-actions';
|
|
10
11
|
import { scanCodeApi } from '../utils/scan-code-action';
|
|
@@ -31,6 +32,7 @@ function createGlboalApi() {
|
|
|
31
32
|
request: sdk.request,
|
|
32
33
|
getSessionId: sdk.getSessionId,
|
|
33
34
|
},
|
|
35
|
+
enumOptions: enumOptions,
|
|
34
36
|
state: store,
|
|
35
37
|
computed: createComputed(computed.global),
|
|
36
38
|
common,
|
|
@@ -45,6 +47,7 @@ function createGlboalApi() {
|
|
|
45
47
|
},
|
|
46
48
|
utils: {
|
|
47
49
|
formatDate,
|
|
50
|
+
formatEnum,
|
|
48
51
|
get: getter,
|
|
49
52
|
set: setter,
|
|
50
53
|
_getConfig: function () {
|
|
@@ -52,7 +55,7 @@ function createGlboalApi() {
|
|
|
52
55
|
},
|
|
53
56
|
getWXContext: function() {
|
|
54
57
|
return Promise.resolve({})
|
|
55
|
-
}
|
|
58
|
+
},
|
|
56
59
|
},
|
|
57
60
|
|
|
58
61
|
// ... other sdk apis & apis from mp
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { observable } from 'mobx';
|
|
2
|
+
let loading = {};
|
|
3
|
+
export let enumOptions = observable({});
|
|
4
|
+
export function formatEnum(path, optionname) {
|
|
5
|
+
// 判断是单选还是多选
|
|
6
|
+
let isSingle = Array.isArray(path);
|
|
7
|
+
// 获取到options
|
|
8
|
+
let parseOptions = getEnumOptions(optionname);
|
|
9
|
+
if (parseOptions === '') {
|
|
10
|
+
return !isSingle ? path : path.join(',');
|
|
11
|
+
}
|
|
12
|
+
let multiTmp = [];
|
|
13
|
+
let value = !isSingle
|
|
14
|
+
? JSON.parse(parseOptions)?.find((item) => item?.key === path)?.value
|
|
15
|
+
: JSON.parse(parseOptions)
|
|
16
|
+
?.filter((item) => path.some((pathValue) => item?.key === pathValue))
|
|
17
|
+
.map((item) => multiTmp.push(item?.value));
|
|
18
|
+
// 对多选或者单选有不同处理
|
|
19
|
+
return !isSingle ? value : multiTmp?.join(',');
|
|
20
|
+
}
|
|
21
|
+
function getEnumOptions(optionName) {
|
|
22
|
+
if (enumOptions[optionName]) {
|
|
23
|
+
return enumOptions[optionName];
|
|
24
|
+
}
|
|
25
|
+
if (!loading[optionName]) {
|
|
26
|
+
loading[optionName] = true;
|
|
27
|
+
getGeneralOptions(optionName).then((data) => {
|
|
28
|
+
enumOptions[optionName] = data?.Items[0]?.Config;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
export async function getGeneralOptions(optionName) {
|
|
34
|
+
return app.cloud.callWedaApi({
|
|
35
|
+
action: 'DescribeGeneralOptionsDetailList',
|
|
36
|
+
data: {
|
|
37
|
+
PageSize: 1,
|
|
38
|
+
PageIndex: 1,
|
|
39
|
+
LikeNameOrTitle: optionName,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|