@cloudbase/framework-plugin-low-code 0.6.64 → 0.6.65
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.
|
@@ -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.65",
|
|
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",
|
|
@@ -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
|
+
}
|