@mybricks/to-code-taro 1.1.5 → 1.1.7
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/dist/cjs/core/mybricks/Subject.js +9 -5
- package/dist/cjs/core/mybricks/createJSHandle.js +43 -3
- package/dist/cjs/core/utils/comRefResolver.js +112 -0
- package/dist/cjs/core/utils/event.js +53 -0
- package/dist/cjs/core/utils/hooks.js +71 -29
- package/dist/cjs/core/utils/index.js +3 -0
- package/dist/cjs/core/utils/pageRouter.js +34 -11
- package/dist/cjs/core/utils/slots.js +55 -9
- package/dist/cjs/core/utils/tabbar.js +56 -0
- package/dist/cjs/core/utils/useContext.js +42 -2
- package/dist/cjs/core/utils/with.js +9 -34
- package/dist/cjs/generate/generateTaroProjectJson.js +3 -18
- package/dist/cjs/generate/utils/appConfig.d.ts +1 -1
- package/dist/cjs/generate/utils/appConfig.js +22 -12
- package/dist/cjs/generate/utils/commonDir.js +9 -0
- package/dist/cjs/generate/utils/customTabBar.d.ts +11 -0
- package/dist/cjs/generate/utils/customTabBar.js +73 -0
- package/dist/cjs/generate/utils/fileNode.d.ts +4 -0
- package/dist/cjs/generate/utils/fileNode.js +12 -2
- package/dist/cjs/handleCom.js +15 -16
- package/dist/cjs/handleGlobal.d.ts +1 -1
- package/dist/cjs/handleGlobal.js +6 -0
- package/dist/cjs/handleSlot.js +5 -10
- package/dist/cjs/processors/processScene.js +13 -1
- package/dist/cjs/processors/processSceneLogic.js +2 -6
- package/dist/cjs/taro-template.json +364 -66
- package/dist/cjs/toCodeTaro.d.ts +1 -2
- package/dist/cjs/utils/builder/buildResult.js +1 -2
- package/dist/cjs/utils/common/ImportManager.d.ts +7 -0
- package/dist/cjs/utils/common/ImportManager.js +19 -1
- package/dist/cjs/utils/logic/genJSModules.js +2 -2
- package/dist/cjs/utils/logic/handleProcess.js +59 -13
- package/dist/cjs/utils/templates/index.js +1 -1
- package/dist/cjs/utils/templates/renderManager.js +5 -5
- package/dist/cjs/utils/templates/scene.js +4 -4
- package/dist/esm/core/mybricks/Subject.js +11 -5
- package/dist/esm/core/mybricks/createJSHandle.js +55 -5
- package/dist/esm/core/utils/comRefResolver.js +134 -0
- package/dist/esm/core/utils/event.js +32 -0
- package/dist/esm/core/utils/hooks.js +109 -39
- package/dist/esm/core/utils/index.js +1 -0
- package/dist/esm/core/utils/pageRouter.js +56 -13
- package/dist/esm/core/utils/slots.js +78 -12
- package/dist/esm/core/utils/tabbar.js +47 -0
- package/dist/esm/core/utils/useContext.js +42 -2
- package/dist/esm/core/utils/with.js +19 -53
- package/dist/esm/generate/generateTaroProjectJson.js +2 -20
- package/dist/esm/generate/utils/appConfig.d.ts +1 -1
- package/dist/esm/generate/utils/appConfig.js +28 -9
- package/dist/esm/generate/utils/commonDir.js +13 -0
- package/dist/esm/generate/utils/customTabBar.d.ts +11 -0
- package/dist/esm/generate/utils/customTabBar.js +52 -0
- package/dist/esm/generate/utils/fileNode.d.ts +4 -0
- package/dist/esm/generate/utils/fileNode.js +13 -0
- package/dist/esm/handleCom.js +24 -21
- package/dist/esm/handleGlobal.d.ts +1 -1
- package/dist/esm/handleGlobal.js +6 -1
- package/dist/esm/handleSlot.js +7 -12
- package/dist/esm/processors/processScene.js +23 -3
- package/dist/esm/processors/processSceneLogic.js +3 -5
- package/dist/esm/taro-template.json +364 -66
- package/dist/esm/toCodeTaro.d.ts +1 -2
- package/dist/esm/toCodeTaro.js +1 -1
- package/dist/esm/utils/builder/buildResult.js +1 -2
- package/dist/esm/utils/common/ImportManager.d.ts +7 -0
- package/dist/esm/utils/common/ImportManager.js +42 -14
- package/dist/esm/utils/logic/genJSModules.js +2 -2
- package/dist/esm/utils/logic/handleProcess.js +73 -12
- package/dist/esm/utils/templates/index.js +1 -1
- package/dist/esm/utils/templates/renderManager.js +4 -7
- package/dist/esm/utils/templates/scene.js +2 -2
- package/package.json +1 -1
- package/dist/cjs/core/comlib/Index.js +0 -114
- package/dist/cjs/core/comlib/_AesEncode.js +0 -115
- package/dist/cjs/core/comlib/_BackTo.js +0 -80
- package/dist/cjs/core/comlib/_CallPhone.js +0 -58
- package/dist/cjs/core/comlib/_ChooseFile.js +0 -103
- package/dist/cjs/core/comlib/_ChooseMedia.js +0 -70
- package/dist/cjs/core/comlib/_Connector.js +0 -79
- package/dist/cjs/core/comlib/_ConnectorGlobalHeaders.js +0 -79
- package/dist/cjs/core/comlib/_Format.js +0 -123
- package/dist/cjs/core/comlib/_GetLocation.js +0 -60
- package/dist/cjs/core/comlib/_GetStorage.js +0 -68
- package/dist/cjs/core/comlib/_GetSystemInfo.js +0 -62
- package/dist/cjs/core/comlib/_Modal.js +0 -68
- package/dist/cjs/core/comlib/_OpenCamera.js +0 -73
- package/dist/cjs/core/comlib/_OpenPetalMap.js +0 -49
- package/dist/cjs/core/comlib/_OpenUrl.js +0 -62
- package/dist/cjs/core/comlib/_RemoveStorage.js +0 -68
- package/dist/cjs/core/comlib/_Router.js +0 -100
- package/dist/cjs/core/comlib/_ScanQrcode.js +0 -59
- package/dist/cjs/core/comlib/_SetStorage.js +0 -67
- package/dist/cjs/core/comlib/_Share.js +0 -58
- package/dist/cjs/core/comlib/_ShowToast.js +0 -69
- package/dist/cjs/core/comlib/_TextToSpeech.js +0 -120
- package/dist/cjs/core/comlib/_TimerDebounce.js +0 -72
- package/dist/cjs/core/comlib/_TimerDelay.js +0 -88
- package/dist/cjs/core/comlib/_TimerThrottle.js +0 -75
- package/dist/cjs/core/comlib/_Vibrate.js +0 -60
- package/dist/esm/core/comlib/Index.js +0 -39
- package/dist/esm/core/comlib/_AesEncode.js +0 -85
- package/dist/esm/core/comlib/_BackTo.js +0 -66
- package/dist/esm/core/comlib/_CallPhone.js +0 -30
- package/dist/esm/core/comlib/_ChooseFile.js +0 -81
- package/dist/esm/core/comlib/_ChooseMedia.js +0 -38
- package/dist/esm/core/comlib/_Connector.js +0 -77
- package/dist/esm/core/comlib/_ConnectorGlobalHeaders.js +0 -56
- package/dist/esm/core/comlib/_Format.js +0 -102
- package/dist/esm/core/comlib/_GetLocation.js +0 -26
- package/dist/esm/core/comlib/_GetStorage.js +0 -44
- package/dist/esm/core/comlib/_GetSystemInfo.js +0 -32
- package/dist/esm/core/comlib/_Modal.js +0 -51
- package/dist/esm/core/comlib/_OpenCamera.js +0 -44
- package/dist/esm/core/comlib/_OpenPetalMap.js +0 -28
- package/dist/esm/core/comlib/_OpenUrl.js +0 -36
- package/dist/esm/core/comlib/_RemoveStorage.js +0 -42
- package/dist/esm/core/comlib/_Router.js +0 -113
- package/dist/esm/core/comlib/_ScanQrcode.js +0 -26
- package/dist/esm/core/comlib/_SetStorage.js +0 -40
- package/dist/esm/core/comlib/_Share.js +0 -28
- package/dist/esm/core/comlib/_ShowToast.js +0 -45
- package/dist/esm/core/comlib/_TextToSpeech.js +0 -117
- package/dist/esm/core/comlib/_TimerDebounce.js +0 -66
- package/dist/esm/core/comlib/_TimerDelay.js +0 -79
- package/dist/esm/core/comlib/_TimerThrottle.js +0 -69
- package/dist/esm/core/comlib/_Vibrate.js +0 -34
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/core/comlib/_BackTo.ts
|
|
30
|
-
var BackTo_exports = {};
|
|
31
|
-
__export(BackTo_exports, {
|
|
32
|
-
default: () => BackTo_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(BackTo_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var BackTo_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.back) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const delta = (val == null ? void 0 : val.delta) ?? data.delta ?? 1;
|
|
44
|
-
const animation = (val == null ? void 0 : val.animation) !== void 0 ? val.animation : data.animation ?? true;
|
|
45
|
-
const pages = import_taro.default.getCurrentPages();
|
|
46
|
-
const currentIndex = pages.length - 1;
|
|
47
|
-
if (currentIndex === 0) {
|
|
48
|
-
outputs.onFail("已经是首页,无法返回");
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (delta > currentIndex) {
|
|
52
|
-
outputs.onFail(`页面栈深度不足,无法返回${delta}层`);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (delta === 1) {
|
|
56
|
-
import_taro.default.navigateBack({
|
|
57
|
-
delta: 1,
|
|
58
|
-
animation,
|
|
59
|
-
success: () => outputs.onSuccess({ delta: 1 }),
|
|
60
|
-
fail: (err) => outputs.onFail(err.errMsg || "返回失败")
|
|
61
|
-
});
|
|
62
|
-
} else {
|
|
63
|
-
const targetPage = pages[currentIndex - delta];
|
|
64
|
-
if (targetPage) {
|
|
65
|
-
import_taro.default.navigateBack({
|
|
66
|
-
delta,
|
|
67
|
-
animation,
|
|
68
|
-
success: () => outputs.onSuccess({ delta, targetPage: targetPage.route }),
|
|
69
|
-
fail: (err) => outputs.onFail(err.errMsg || "返回失败")
|
|
70
|
-
});
|
|
71
|
-
} else {
|
|
72
|
-
outputs.onFail("目标页面不存在");
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
} catch (error) {
|
|
76
|
-
console.error("返回操作失败:", error);
|
|
77
|
-
outputs.onFail((error == null ? void 0 : error.message) || "返回操作失败");
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/core/comlib/_CallPhone.ts
|
|
30
|
-
var CallPhone_exports = {};
|
|
31
|
-
__export(CallPhone_exports, {
|
|
32
|
-
default: () => CallPhone_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(CallPhone_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var CallPhone_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.callPhone) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const phoneNumber = typeof val === "string" ? val : (val == null ? void 0 : val.phoneNumber) || data.phoneNumber;
|
|
44
|
-
if (!phoneNumber) {
|
|
45
|
-
outputs.onFail("电话号码不能为空");
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
import_taro.default.makePhoneCall({
|
|
49
|
-
phoneNumber,
|
|
50
|
-
success: () => outputs.onSuccess({ phoneNumber }),
|
|
51
|
-
fail: (err) => outputs.onFail(err.errMsg || "拨打电话失败")
|
|
52
|
-
});
|
|
53
|
-
} catch (error) {
|
|
54
|
-
console.error("拨打电话失败:", error);
|
|
55
|
-
outputs.onFail((error == null ? void 0 : error.message) || "拨打电话失败");
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/core/comlib/_ChooseFile.ts
|
|
30
|
-
var ChooseFile_exports = {};
|
|
31
|
-
__export(ChooseFile_exports, {
|
|
32
|
-
default: () => ChooseFile_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(ChooseFile_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var ChooseFile_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.chooseFile) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
var _a2, _b, _c;
|
|
43
|
-
try {
|
|
44
|
-
const config = {
|
|
45
|
-
accept: (val == null ? void 0 : val.accept) || data.accept || "image/*",
|
|
46
|
-
multiple: (val == null ? void 0 : val.multiple) !== void 0 ? val.multiple : data.multiple || false,
|
|
47
|
-
capture: (val == null ? void 0 : val.capture) || data.capture,
|
|
48
|
-
compressed: (val == null ? void 0 : val.compressed) !== void 0 ? val.compressed : data.compressed,
|
|
49
|
-
maxDuration: (val == null ? void 0 : val.maxDuration) || data.maxDuration,
|
|
50
|
-
camera: (val == null ? void 0 : val.camera) || data.camera
|
|
51
|
-
};
|
|
52
|
-
if ((_a2 = config.accept) == null ? void 0 : _a2.startsWith("image/")) {
|
|
53
|
-
import_taro.default.chooseImage({
|
|
54
|
-
count: config.multiple ? 9 : 1,
|
|
55
|
-
sourceType: config.capture === "album" ? ["album"] : config.capture === "camera" ? ["camera"] : ["album", "camera"],
|
|
56
|
-
success: (res) => {
|
|
57
|
-
outputs.onSuccess({
|
|
58
|
-
type: "image",
|
|
59
|
-
files: res.tempFiles,
|
|
60
|
-
tempFilePaths: res.tempFilePaths
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
fail: (err) => outputs.onFail(err.errMsg || "选择图片失败")
|
|
64
|
-
});
|
|
65
|
-
} else if ((_b = config.accept) == null ? void 0 : _b.startsWith("video/")) {
|
|
66
|
-
import_taro.default.chooseVideo({
|
|
67
|
-
sourceType: config.capture === "album" ? ["album"] : config.capture === "camera" ? ["camera"] : ["album", "camera"],
|
|
68
|
-
compressed: config.compressed,
|
|
69
|
-
maxDuration: config.maxDuration,
|
|
70
|
-
camera: config.camera,
|
|
71
|
-
success: (res) => {
|
|
72
|
-
outputs.onSuccess({
|
|
73
|
-
type: "video",
|
|
74
|
-
file: res
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
fail: (err) => outputs.onFail(err.errMsg || "选择视频失败")
|
|
78
|
-
});
|
|
79
|
-
} else if ((_c = config.accept) == null ? void 0 : _c.startsWith("audio/")) {
|
|
80
|
-
outputs.onFail("小程序暂不支持直接选择音频文件");
|
|
81
|
-
} else {
|
|
82
|
-
if (import_taro.default.chooseMessageFile) {
|
|
83
|
-
import_taro.default.chooseMessageFile({
|
|
84
|
-
count: config.multiple ? 10 : 1,
|
|
85
|
-
type: "file",
|
|
86
|
-
success: (res) => {
|
|
87
|
-
outputs.onSuccess({
|
|
88
|
-
type: "file",
|
|
89
|
-
files: res.tempFiles
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
fail: (err) => outputs.onFail(err.errMsg || "选择文件失败")
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
outputs.onFail("当前环境不支持文件选择");
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
} catch (error) {
|
|
99
|
-
console.error("文件选择失败:", error);
|
|
100
|
-
outputs.onFail((error == null ? void 0 : error.message) || "文件选择失败");
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/core/comlib/_ChooseMedia.ts
|
|
30
|
-
var ChooseMedia_exports = {};
|
|
31
|
-
__export(ChooseMedia_exports, {
|
|
32
|
-
default: () => ChooseMedia_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(ChooseMedia_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var ChooseMedia_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.chooseMedia) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const config = {
|
|
44
|
-
mediaType: (val == null ? void 0 : val.mediaType) || data.mediaType || ["image", "video"],
|
|
45
|
-
sourceType: (val == null ? void 0 : val.sourceType) || data.sourceType || ["album", "camera"],
|
|
46
|
-
count: (val == null ? void 0 : val.count) || data.count || 9,
|
|
47
|
-
sizeType: (val == null ? void 0 : val.sizeType) || data.sizeType || ["original", "compressed"],
|
|
48
|
-
maxDuration: (val == null ? void 0 : val.maxDuration) || data.maxDuration || 10,
|
|
49
|
-
camera: (val == null ? void 0 : val.camera) || data.camera
|
|
50
|
-
};
|
|
51
|
-
import_taro.default.chooseMedia({
|
|
52
|
-
...config,
|
|
53
|
-
success: (res) => {
|
|
54
|
-
var _a2;
|
|
55
|
-
outputs.onSuccess({
|
|
56
|
-
type: res.type,
|
|
57
|
-
tempFiles: res.tempFiles,
|
|
58
|
-
tempFilePaths: res.tempFilePaths || ((_a2 = res.tempFiles) == null ? void 0 : _a2.map((file) => file.tempFilePath))
|
|
59
|
-
});
|
|
60
|
-
},
|
|
61
|
-
fail: (err) => {
|
|
62
|
-
outputs.onFail(err.errMsg || "选择媒体失败");
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
} catch (error) {
|
|
66
|
-
console.error("选择媒体失败:", error);
|
|
67
|
-
outputs.onFail((error == null ? void 0 : error.message) || "选择媒体失败");
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/core/comlib/_Connector.ts
|
|
20
|
-
var Connector_exports = {};
|
|
21
|
-
__export(Connector_exports, {
|
|
22
|
-
default: () => Connector_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(Connector_exports);
|
|
25
|
-
function callCon({ env, data, inputs, outputs, onError }, params = {}) {
|
|
26
|
-
if (data.connector || data.dynamicConfig) {
|
|
27
|
-
try {
|
|
28
|
-
let finnalConnector = {
|
|
29
|
-
...data.connector || {},
|
|
30
|
-
outputSchema: data.outputSchema
|
|
31
|
-
};
|
|
32
|
-
if (data.dynamicConfig) {
|
|
33
|
-
finnalConnector = data.dynamicConfig;
|
|
34
|
-
}
|
|
35
|
-
if (data.timeout) {
|
|
36
|
-
finnalConnector.timeout = data.timeout;
|
|
37
|
-
}
|
|
38
|
-
env.request(finnalConnector, params, {
|
|
39
|
-
...data.connectorConfig || {},
|
|
40
|
-
outputSchema: finnalConnector == null ? void 0 : finnalConnector.outputSchema,
|
|
41
|
-
isMultipleOutputs: true
|
|
42
|
-
}).then((val) => {
|
|
43
|
-
outputs[(val == null ? void 0 : val.__OUTPUT_ID__) ?? "then"](
|
|
44
|
-
(val == null ? void 0 : val.__ORIGIN_RESPONSE__) ?? val
|
|
45
|
-
);
|
|
46
|
-
}).catch((err) => {
|
|
47
|
-
outputs["catch"](err);
|
|
48
|
-
});
|
|
49
|
-
} catch (ex) {
|
|
50
|
-
console.error(ex);
|
|
51
|
-
outputs["catch"](`执行错误 ${ex.message || ex}`);
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
outputs["catch"](`没有选择接口`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function isPlainObject(value) {
|
|
58
|
-
if (typeof value !== "object" || value === null)
|
|
59
|
-
return false;
|
|
60
|
-
let proto = Object.getPrototypeOf(value);
|
|
61
|
-
if (proto === null)
|
|
62
|
-
return true;
|
|
63
|
-
return proto === Object.prototype;
|
|
64
|
-
}
|
|
65
|
-
function Connector_default({ env, data, inputs, outputs, onError }) {
|
|
66
|
-
if (!env.runtime) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (data.immediate) {
|
|
70
|
-
callCon({ env, data, outputs });
|
|
71
|
-
} else {
|
|
72
|
-
inputs["call"]((params) => {
|
|
73
|
-
if (!isPlainObject(params)) {
|
|
74
|
-
params = {};
|
|
75
|
-
}
|
|
76
|
-
callCon({ env, data, outputs, onError }, params);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/core/comlib/_ConnectorGlobalHeaders.ts
|
|
20
|
-
var ConnectorGlobalHeaders_exports = {};
|
|
21
|
-
__export(ConnectorGlobalHeaders_exports, {
|
|
22
|
-
default: () => ConnectorGlobalHeaders_default,
|
|
23
|
-
getGlobalHeaders: () => getGlobalHeaders
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(ConnectorGlobalHeaders_exports);
|
|
26
|
-
var globalHeaders = {};
|
|
27
|
-
var ConnectorGlobalHeaders_default = (context) => {
|
|
28
|
-
var _a, _b, _c;
|
|
29
|
-
const data = context.data;
|
|
30
|
-
const inputs = context.inputs;
|
|
31
|
-
const outputs = context.outputs;
|
|
32
|
-
(_a = inputs.setGlobalHeaders) == null ? void 0 : _a.call(inputs, (val) => {
|
|
33
|
-
try {
|
|
34
|
-
const headers = (val == null ? void 0 : val.headers) || data.headers || {};
|
|
35
|
-
if (Object.keys(headers).length === 0) {
|
|
36
|
-
outputs.onFail("请求头不能为空");
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
globalHeaders = { ...globalHeaders, ...headers };
|
|
40
|
-
outputs.onSuccess({
|
|
41
|
-
globalHeaders: { ...globalHeaders },
|
|
42
|
-
addedHeaders: headers
|
|
43
|
-
});
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.error("设置全局请求头失败:", error);
|
|
46
|
-
outputs.onFail((error == null ? void 0 : error.message) || "设置全局请求头失败");
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
(_b = inputs.getGlobalHeaders) == null ? void 0 : _b.call(inputs, () => {
|
|
50
|
-
try {
|
|
51
|
-
outputs.onSuccess({
|
|
52
|
-
globalHeaders: { ...globalHeaders }
|
|
53
|
-
});
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.error("获取全局请求头失败:", error);
|
|
56
|
-
outputs.onFail((error == null ? void 0 : error.message) || "获取全局请求头失败");
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
(_c = inputs.clearGlobalHeaders) == null ? void 0 : _c.call(inputs, () => {
|
|
60
|
-
try {
|
|
61
|
-
const oldHeaders = { ...globalHeaders };
|
|
62
|
-
globalHeaders = {};
|
|
63
|
-
outputs.onSuccess({
|
|
64
|
-
clearedHeaders: oldHeaders,
|
|
65
|
-
globalHeaders: {}
|
|
66
|
-
});
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.error("清除全局请求头失败:", error);
|
|
69
|
-
outputs.onFail((error == null ? void 0 : error.message) || "清除全局请求头失败");
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
var getGlobalHeaders = () => {
|
|
74
|
-
return { ...globalHeaders };
|
|
75
|
-
};
|
|
76
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
-
0 && (module.exports = {
|
|
78
|
-
getGlobalHeaders
|
|
79
|
-
});
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/core/comlib/_Format.ts
|
|
20
|
-
var Format_exports = {};
|
|
21
|
-
__export(Format_exports, {
|
|
22
|
-
default: () => Format_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(Format_exports);
|
|
25
|
-
var Format_default = (context) => {
|
|
26
|
-
var _a;
|
|
27
|
-
const data = context.data;
|
|
28
|
-
const inputs = context.inputs;
|
|
29
|
-
const outputs = context.outputs;
|
|
30
|
-
(_a = inputs.format) == null ? void 0 : _a.call(inputs, (val) => {
|
|
31
|
-
try {
|
|
32
|
-
const input = (val == null ? void 0 : val.input) !== void 0 ? val.input : data.input;
|
|
33
|
-
const format = (val == null ? void 0 : val.format) || data.format || "string";
|
|
34
|
-
const options = (val == null ? void 0 : val.options) || data.options || {};
|
|
35
|
-
if (input === void 0 || input === null) {
|
|
36
|
-
outputs.onFail("输入值不能为空");
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
let result;
|
|
40
|
-
switch (format) {
|
|
41
|
-
case "json":
|
|
42
|
-
if (typeof input === "string") {
|
|
43
|
-
try {
|
|
44
|
-
result = JSON.parse(input);
|
|
45
|
-
} catch (error) {
|
|
46
|
-
outputs.onFail("JSON解析失败");
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
result = JSON.stringify(input, null, 2);
|
|
51
|
-
}
|
|
52
|
-
break;
|
|
53
|
-
case "string":
|
|
54
|
-
result = String(input);
|
|
55
|
-
break;
|
|
56
|
-
case "number":
|
|
57
|
-
const num = Number(input);
|
|
58
|
-
if (isNaN(num)) {
|
|
59
|
-
outputs.onFail("无法转换为有效数字");
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
result = options.precision !== void 0 ? Number(num.toFixed(options.precision)) : num;
|
|
63
|
-
break;
|
|
64
|
-
case "boolean":
|
|
65
|
-
result = Boolean(input);
|
|
66
|
-
break;
|
|
67
|
-
case "date":
|
|
68
|
-
const date = new Date(input);
|
|
69
|
-
if (isNaN(date.getTime())) {
|
|
70
|
-
outputs.onFail("无效的日期格式");
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (options.dateFormat) {
|
|
74
|
-
const year = date.getFullYear();
|
|
75
|
-
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
76
|
-
const day = String(date.getDate()).padStart(2, "0");
|
|
77
|
-
const hours = String(date.getHours()).padStart(2, "0");
|
|
78
|
-
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
79
|
-
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
80
|
-
result = options.dateFormat.replace("YYYY", year.toString()).replace("MM", month).replace("DD", day).replace("HH", hours).replace("mm", minutes).replace("ss", seconds);
|
|
81
|
-
} else {
|
|
82
|
-
result = date.toISOString();
|
|
83
|
-
}
|
|
84
|
-
break;
|
|
85
|
-
case "base64":
|
|
86
|
-
if (typeof input === "string") {
|
|
87
|
-
try {
|
|
88
|
-
result = decodeURIComponent(escape(atob(input)));
|
|
89
|
-
} catch {
|
|
90
|
-
result = btoa(unescape(encodeURIComponent(input)));
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
outputs.onFail("Base64转换需要字符串输入");
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
break;
|
|
97
|
-
case "urlEncode":
|
|
98
|
-
result = encodeURIComponent(String(input));
|
|
99
|
-
break;
|
|
100
|
-
case "urlDecode":
|
|
101
|
-
try {
|
|
102
|
-
result = decodeURIComponent(String(input));
|
|
103
|
-
} catch (error) {
|
|
104
|
-
outputs.onFail("URL解码失败");
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
break;
|
|
108
|
-
default:
|
|
109
|
-
outputs.onFail(`不支持的格式类型: ${format}`);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
outputs.onSuccess({
|
|
113
|
-
input,
|
|
114
|
-
output: result,
|
|
115
|
-
format,
|
|
116
|
-
options
|
|
117
|
-
});
|
|
118
|
-
} catch (error) {
|
|
119
|
-
console.error("格式化失败:", error);
|
|
120
|
-
outputs.onFail((error == null ? void 0 : error.message) || "格式化失败");
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/core/comlib/_GetLocation.ts
|
|
30
|
-
var GetLocation_exports = {};
|
|
31
|
-
__export(GetLocation_exports, {
|
|
32
|
-
default: () => GetLocation_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(GetLocation_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var GetLocation_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.getLocation) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const locationConfig = {
|
|
44
|
-
type: (val == null ? void 0 : val.type) || data.type || "wgs84",
|
|
45
|
-
altitude: (val == null ? void 0 : val.altitude) !== void 0 ? val.altitude : data.altitude || false,
|
|
46
|
-
timeout: (val == null ? void 0 : val.timeout) || data.timeout || 3e4,
|
|
47
|
-
success: (res) => {
|
|
48
|
-
outputs.onSuccess(res);
|
|
49
|
-
},
|
|
50
|
-
fail: (err) => {
|
|
51
|
-
outputs.onFail(err.errMsg || "获取地理位置失败");
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
import_taro.default.getLocation(locationConfig);
|
|
55
|
-
} catch (error) {
|
|
56
|
-
console.error("获取地理位置失败:", error);
|
|
57
|
-
outputs.onFail((error == null ? void 0 : error.message) || "获取地理位置失败");
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
};
|