@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,68 +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/_GetStorage.ts
|
|
30
|
-
var GetStorage_exports = {};
|
|
31
|
-
__export(GetStorage_exports, {
|
|
32
|
-
default: () => GetStorage_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(GetStorage_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var GetStorage_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.getStorage) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const key = (val == null ? void 0 : val.key) || data.key;
|
|
44
|
-
const useSync = (val == null ? void 0 : val.sync) !== void 0 ? val.sync : data.sync || false;
|
|
45
|
-
if (!key) {
|
|
46
|
-
outputs.onFail("存储 key 不能为空");
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (useSync) {
|
|
50
|
-
try {
|
|
51
|
-
const value = import_taro.default.getStorageSync(key);
|
|
52
|
-
outputs.onSuccess({ key, value });
|
|
53
|
-
} catch (error) {
|
|
54
|
-
outputs.onFail((error == null ? void 0 : error.message) || "读取本地缓存失败");
|
|
55
|
-
}
|
|
56
|
-
} else {
|
|
57
|
-
import_taro.default.getStorage({
|
|
58
|
-
key,
|
|
59
|
-
success: (res) => outputs.onSuccess({ key, value: res.data }),
|
|
60
|
-
fail: (err) => outputs.onFail(err.errMsg || "读取本地缓存失败")
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
} catch (error) {
|
|
64
|
-
console.error("读取本地缓存失败:", error);
|
|
65
|
-
outputs.onFail((error == null ? void 0 : error.message) || "读取本地缓存失败");
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
};
|
|
@@ -1,62 +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/_GetSystemInfo.ts
|
|
30
|
-
var GetSystemInfo_exports = {};
|
|
31
|
-
__export(GetSystemInfo_exports, {
|
|
32
|
-
default: () => GetSystemInfo_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(GetSystemInfo_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var GetSystemInfo_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.getSystemInfo) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const useSync = (val == null ? void 0 : val.sync) !== void 0 ? val.sync : data.sync || false;
|
|
44
|
-
if (useSync) {
|
|
45
|
-
try {
|
|
46
|
-
const systemInfo = import_taro.default.getSystemInfoSync();
|
|
47
|
-
outputs.onSuccess(systemInfo);
|
|
48
|
-
} catch (error) {
|
|
49
|
-
outputs.onFail((error == null ? void 0 : error.message) || "获取系统信息失败");
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
import_taro.default.getSystemInfo({
|
|
53
|
-
success: (res) => outputs.onSuccess(res),
|
|
54
|
-
fail: (err) => outputs.onFail(err.errMsg || "获取系统信息失败")
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
} catch (error) {
|
|
58
|
-
console.error("获取系统信息失败:", error);
|
|
59
|
-
outputs.onFail((error == null ? void 0 : error.message) || "获取系统信息失败");
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
};
|
|
@@ -1,68 +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/_Modal.ts
|
|
30
|
-
var Modal_exports = {};
|
|
31
|
-
__export(Modal_exports, {
|
|
32
|
-
default: () => Modal_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(Modal_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var Modal_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.show) == null ? void 0 : _a.call(inputs, async (val) => {
|
|
42
|
-
var _a2, _b, _c;
|
|
43
|
-
try {
|
|
44
|
-
const cfg = typeof val === "string" ? { content: val } : val || {};
|
|
45
|
-
const modalConfig = {
|
|
46
|
-
title: cfg.title ?? data.title ?? "",
|
|
47
|
-
content: cfg.content ?? data.content ?? "",
|
|
48
|
-
showCancel: cfg.showCancel ?? data.showCancel ?? true,
|
|
49
|
-
cancelText: cfg.cancelText ?? data.cancelText ?? "取消",
|
|
50
|
-
cancelColor: cfg.cancelColor ?? data.cancelColor,
|
|
51
|
-
confirmText: cfg.confirmText ?? data.confirmText ?? "确认",
|
|
52
|
-
confirmColor: cfg.confirmColor ?? data.confirmColor
|
|
53
|
-
};
|
|
54
|
-
if (cfg.editable !== void 0)
|
|
55
|
-
modalConfig.editable = cfg.editable;
|
|
56
|
-
else if (data.editable !== void 0)
|
|
57
|
-
modalConfig.editable = data.editable;
|
|
58
|
-
const res = await import_taro.default.showModal(modalConfig);
|
|
59
|
-
if (res == null ? void 0 : res.confirm)
|
|
60
|
-
(_a2 = outputs.onConfirm) == null ? void 0 : _a2.call(outputs, res);
|
|
61
|
-
else
|
|
62
|
-
(_b = outputs.onCancel) == null ? void 0 : _b.call(outputs, res);
|
|
63
|
-
} catch (error) {
|
|
64
|
-
console.error("显示 Modal 失败:", error);
|
|
65
|
-
(_c = outputs.onCancel) == null ? void 0 : _c.call(outputs, error);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
};
|
|
@@ -1,73 +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/_OpenCamera.ts
|
|
30
|
-
var OpenCamera_exports = {};
|
|
31
|
-
__export(OpenCamera_exports, {
|
|
32
|
-
default: () => OpenCamera_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(OpenCamera_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var OpenCamera_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.openCamera) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const config = {
|
|
44
|
-
camera: (val == null ? void 0 : val.camera) || data.camera || "back",
|
|
45
|
-
flash: (val == null ? void 0 : val.flash) || data.flash || "auto",
|
|
46
|
-
quality: (val == null ? void 0 : val.quality) || data.quality || "normal"
|
|
47
|
-
};
|
|
48
|
-
import_taro.default.chooseImage({
|
|
49
|
-
count: 1,
|
|
50
|
-
sourceType: ["camera"],
|
|
51
|
-
success: (res) => {
|
|
52
|
-
outputs.onSuccess({
|
|
53
|
-
type: "camera",
|
|
54
|
-
tempFilePath: res.tempFilePaths[0],
|
|
55
|
-
tempFile: res.tempFiles[0],
|
|
56
|
-
config
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
fail: (err) => {
|
|
60
|
-
var _a2;
|
|
61
|
-
if ((_a2 = err.errMsg) == null ? void 0 : _a2.includes("cancel")) {
|
|
62
|
-
outputs.onFail("用户取消拍照");
|
|
63
|
-
} else {
|
|
64
|
-
outputs.onFail(err.errMsg || "打开相机失败");
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
} catch (error) {
|
|
69
|
-
console.error("打开相机失败:", error);
|
|
70
|
-
outputs.onFail((error == null ? void 0 : error.message) || "打开相机失败");
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
};
|
|
@@ -1,49 +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/_OpenPetalMap.ts
|
|
20
|
-
var OpenPetalMap_exports = {};
|
|
21
|
-
__export(OpenPetalMap_exports, {
|
|
22
|
-
default: () => OpenPetalMap_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(OpenPetalMap_exports);
|
|
25
|
-
var OpenPetalMap_default = (context) => {
|
|
26
|
-
var _a;
|
|
27
|
-
const data = context.data;
|
|
28
|
-
const inputs = context.inputs;
|
|
29
|
-
const outputs = context.outputs;
|
|
30
|
-
(_a = inputs.openMap) == null ? void 0 : _a.call(inputs, (val) => {
|
|
31
|
-
try {
|
|
32
|
-
const config = {
|
|
33
|
-
latitude: (val == null ? void 0 : val.latitude) || data.latitude || 39.9093,
|
|
34
|
-
longitude: (val == null ? void 0 : val.longitude) || data.longitude || 116.3974,
|
|
35
|
-
scale: (val == null ? void 0 : val.scale) || data.scale || 16,
|
|
36
|
-
markers: (val == null ? void 0 : val.markers) || data.markers || [],
|
|
37
|
-
showLocation: (val == null ? void 0 : val.showLocation) !== void 0 ? val.showLocation : data.showLocation || true
|
|
38
|
-
};
|
|
39
|
-
outputs.onSuccess({
|
|
40
|
-
type: "map",
|
|
41
|
-
config,
|
|
42
|
-
message: "地图配置已准备就绪,请在页面中使用Map组件显示"
|
|
43
|
-
});
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.error("打开地图失败:", error);
|
|
46
|
-
outputs.onFail((error == null ? void 0 : error.message) || "打开地图失败");
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
};
|
|
@@ -1,62 +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/_OpenUrl.ts
|
|
30
|
-
var OpenUrl_exports = {};
|
|
31
|
-
__export(OpenUrl_exports, {
|
|
32
|
-
default: () => OpenUrl_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(OpenUrl_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var OpenUrl_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.openUrl) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const url = typeof val === "string" ? val : (val == null ? void 0 : val.url) || data.url;
|
|
44
|
-
if (!url) {
|
|
45
|
-
outputs.onFail("URL 地址不能为空");
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (!/^https?:\/\//.test(url)) {
|
|
49
|
-
outputs.onFail("URL 格式不正确,请以 http:// 或 https:// 开头");
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
import_taro.default.navigateTo({
|
|
53
|
-
url: `/pages/webview/index?url=${encodeURIComponent(url)}`,
|
|
54
|
-
success: () => outputs.onSuccess({ url }),
|
|
55
|
-
fail: (err) => outputs.onFail(err.errMsg || "打开链接失败")
|
|
56
|
-
});
|
|
57
|
-
} catch (error) {
|
|
58
|
-
console.error("打开链接失败:", error);
|
|
59
|
-
outputs.onFail((error == null ? void 0 : error.message) || "打开链接失败");
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
};
|
|
@@ -1,68 +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/_RemoveStorage.ts
|
|
30
|
-
var RemoveStorage_exports = {};
|
|
31
|
-
__export(RemoveStorage_exports, {
|
|
32
|
-
default: () => RemoveStorage_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(RemoveStorage_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var RemoveStorage_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.removeStorage) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const key = (val == null ? void 0 : val.key) || data.key;
|
|
44
|
-
const useSync = (val == null ? void 0 : val.sync) !== void 0 ? val.sync : data.sync || false;
|
|
45
|
-
if (!key) {
|
|
46
|
-
outputs.onFail("存储 key 不能为空");
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (useSync) {
|
|
50
|
-
try {
|
|
51
|
-
import_taro.default.removeStorageSync(key);
|
|
52
|
-
outputs.onSuccess({ key });
|
|
53
|
-
} catch (error) {
|
|
54
|
-
outputs.onFail((error == null ? void 0 : error.message) || "移除本地缓存失败");
|
|
55
|
-
}
|
|
56
|
-
} else {
|
|
57
|
-
import_taro.default.removeStorage({
|
|
58
|
-
key,
|
|
59
|
-
success: () => outputs.onSuccess({ key }),
|
|
60
|
-
fail: (err) => outputs.onFail(err.errMsg || "移除本地缓存失败")
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
} catch (error) {
|
|
64
|
-
console.error("移除本地缓存失败:", error);
|
|
65
|
-
outputs.onFail((error == null ? void 0 : error.message) || "移除本地缓存失败");
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
};
|
|
@@ -1,100 +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/_Router.ts
|
|
30
|
-
var Router_exports = {};
|
|
31
|
-
__export(Router_exports, {
|
|
32
|
-
default: () => Router_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(Router_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var Router_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.navigate) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const type = (val == null ? void 0 : val.type) || data.type || "navigateTo";
|
|
44
|
-
const path = (val == null ? void 0 : val.path) || data.path;
|
|
45
|
-
const params = (val == null ? void 0 : val.params) || data.params || {};
|
|
46
|
-
const delta = (val == null ? void 0 : val.delta) || data.delta || 1;
|
|
47
|
-
if (!path && type !== "navigateBack") {
|
|
48
|
-
outputs.onFail("路由路径不能为空");
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
let url = path;
|
|
52
|
-
if (params && Object.keys(params).length > 0) {
|
|
53
|
-
const queryString = Object.entries(params).map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`).join("&");
|
|
54
|
-
url += (url.includes("?") ? "&" : "?") + queryString;
|
|
55
|
-
}
|
|
56
|
-
switch (type) {
|
|
57
|
-
case "navigateTo":
|
|
58
|
-
import_taro.default.navigateTo({
|
|
59
|
-
url,
|
|
60
|
-
success: () => outputs.onSuccess({ type, path: url, params }),
|
|
61
|
-
fail: (err) => outputs.onFail(err.errMsg || "页面跳转失败")
|
|
62
|
-
});
|
|
63
|
-
break;
|
|
64
|
-
case "redirectTo":
|
|
65
|
-
import_taro.default.redirectTo({
|
|
66
|
-
url,
|
|
67
|
-
success: () => outputs.onSuccess({ type, path: url, params }),
|
|
68
|
-
fail: (err) => outputs.onFail(err.errMsg || "页面重定向失败")
|
|
69
|
-
});
|
|
70
|
-
break;
|
|
71
|
-
case "switchTab":
|
|
72
|
-
import_taro.default.switchTab({
|
|
73
|
-
url,
|
|
74
|
-
success: () => outputs.onSuccess({ type, path: url, params }),
|
|
75
|
-
fail: (err) => outputs.onFail(err.errMsg || "切换Tab失败")
|
|
76
|
-
});
|
|
77
|
-
break;
|
|
78
|
-
case "reLaunch":
|
|
79
|
-
import_taro.default.reLaunch({
|
|
80
|
-
url,
|
|
81
|
-
success: () => outputs.onSuccess({ type, path: url, params }),
|
|
82
|
-
fail: (err) => outputs.onFail(err.errMsg || "重启应用失败")
|
|
83
|
-
});
|
|
84
|
-
break;
|
|
85
|
-
case "navigateBack":
|
|
86
|
-
import_taro.default.navigateBack({
|
|
87
|
-
delta,
|
|
88
|
-
success: () => outputs.onSuccess({ type, delta }),
|
|
89
|
-
fail: (err) => outputs.onFail(err.errMsg || "返回失败")
|
|
90
|
-
});
|
|
91
|
-
break;
|
|
92
|
-
default:
|
|
93
|
-
outputs.onFail(`不支持的路由类型: ${type}`);
|
|
94
|
-
}
|
|
95
|
-
} catch (error) {
|
|
96
|
-
console.error("路由跳转失败:", error);
|
|
97
|
-
outputs.onFail((error == null ? void 0 : error.message) || "路由跳转失败");
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
};
|
|
@@ -1,59 +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/_ScanQrcode.ts
|
|
30
|
-
var ScanQrcode_exports = {};
|
|
31
|
-
__export(ScanQrcode_exports, {
|
|
32
|
-
default: () => ScanQrcode_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(ScanQrcode_exports);
|
|
35
|
-
var import_taro = __toESM(require("@tarojs/taro"));
|
|
36
|
-
var ScanQrcode_default = (context) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const data = context.data;
|
|
39
|
-
const inputs = context.inputs;
|
|
40
|
-
const outputs = context.outputs;
|
|
41
|
-
(_a = inputs.scan) == null ? void 0 : _a.call(inputs, (val) => {
|
|
42
|
-
try {
|
|
43
|
-
const scanConfig = {
|
|
44
|
-
onlyFromCamera: (val == null ? void 0 : val.onlyFromCamera) ?? data.onlyFromCamera ?? false,
|
|
45
|
-
scanType: (val == null ? void 0 : val.scanType) ?? data.scanType ?? ["barCode", "qrCode"],
|
|
46
|
-
success: (res) => {
|
|
47
|
-
outputs.onSuccess(res.result || res);
|
|
48
|
-
},
|
|
49
|
-
fail: (err) => {
|
|
50
|
-
outputs.onFail(err.errMsg || "扫码失败");
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
import_taro.default.scanCode(scanConfig);
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.error("扫码失败:", error);
|
|
56
|
-
outputs.onFail((error == null ? void 0 : error.message) || "扫码失败");
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
};
|