@boteteam/utils 0.0.19 → 0.0.20-alpha.0.2

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.
Files changed (41) hide show
  1. package/dist/cjs/CookieUtils.d.ts +3 -0
  2. package/dist/cjs/CookieUtils.js +91 -5
  3. package/dist/cjs/CookieUtils.js.map +2 -2
  4. package/dist/cjs/environment.d.ts +11 -0
  5. package/dist/cjs/environment.js +78 -0
  6. package/dist/cjs/environment.js.map +7 -0
  7. package/dist/cjs/formatModule/formatModuleData.js +13 -13
  8. package/dist/cjs/formatModule/formatModuleData.js.map +2 -2
  9. package/dist/cjs/http.d.ts +40 -0
  10. package/dist/cjs/http.js +295 -0
  11. package/dist/cjs/http.js.map +7 -0
  12. package/dist/cjs/index.d.ts +3 -1
  13. package/dist/cjs/index.js +20 -0
  14. package/dist/cjs/index.js.map +2 -2
  15. package/dist/cjs/pathArgsUtils.js +15 -2
  16. package/dist/cjs/pathArgsUtils.js.map +2 -2
  17. package/dist/cjs/securityUtils.d.ts +0 -3
  18. package/dist/cjs/securityUtils.js +31 -4
  19. package/dist/cjs/securityUtils.js.map +2 -2
  20. package/dist/esm/CookieUtils.d.ts +3 -0
  21. package/dist/esm/CookieUtils.js +170 -5
  22. package/dist/esm/CookieUtils.js.map +1 -1
  23. package/dist/esm/environment.d.ts +11 -0
  24. package/dist/esm/environment.js +56 -0
  25. package/dist/esm/environment.js.map +1 -0
  26. package/dist/esm/formatModule/formatModuleData.js +16 -15
  27. package/dist/esm/formatModule/formatModuleData.js.map +1 -1
  28. package/dist/esm/http.d.ts +40 -0
  29. package/dist/esm/http.js +315 -0
  30. package/dist/esm/http.js.map +1 -0
  31. package/dist/esm/index.d.ts +3 -1
  32. package/dist/esm/index.js +3 -1
  33. package/dist/esm/index.js.map +1 -1
  34. package/dist/esm/pathArgsUtils.js +18 -3
  35. package/dist/esm/pathArgsUtils.js.map +1 -1
  36. package/dist/esm/securityUtils.d.ts +0 -3
  37. package/dist/esm/securityUtils.js +34 -4
  38. package/dist/esm/securityUtils.js.map +1 -1
  39. package/dist/umd/index.min.js +1 -1
  40. package/dist/umd/index.min.js.map +1 -1
  41. package/package.json +5 -4
@@ -2,5 +2,8 @@ declare const CookieUtils: {
2
2
  get(name: string): string | null;
3
3
  set(name: string, value: string, expires?: Date, path?: string, domain?: string, secure?: boolean): void;
4
4
  unset(name: string, path?: string, domain?: string, secure?: boolean): void;
5
+ getAsync(name: string): Promise<string | null>;
6
+ setAsync(name: string, value: string, expires?: Date, path?: string, domain?: string, secure?: boolean): Promise<void>;
7
+ unsetAsync(name: string, path?: string, domain?: string, secure?: boolean): Promise<void>;
5
8
  };
6
9
  export default CookieUtils;
@@ -22,24 +22,57 @@ __export(CookieUtils_exports, {
22
22
  default: () => CookieUtils_default
23
23
  });
24
24
  module.exports = __toCommonJS(CookieUtils_exports);
25
+ var import_environment = require("./environment");
26
+ var getAsyncStorage = () => {
27
+ if ((0, import_environment.isReactNative)()) {
28
+ try {
29
+ return require("@react-native-async-storage/async-storage").default;
30
+ } catch {
31
+ console.warn("AsyncStorage not available in React Native environment");
32
+ return null;
33
+ }
34
+ }
35
+ return null;
36
+ };
25
37
  var CookieUtils = {
26
38
  get(name) {
39
+ if ((0, import_environment.isReactNative)()) {
40
+ const AsyncStorage = getAsyncStorage();
41
+ if (AsyncStorage) {
42
+ return null;
43
+ }
44
+ return null;
45
+ }
46
+ const doc = (0, import_environment.getDocument)();
47
+ if (!doc)
48
+ return null;
27
49
  const cookieName = `${encodeURIComponent(name)}=`;
28
- const cookieStart = document.cookie.indexOf(cookieName);
50
+ const cookieStart = doc.cookie.indexOf(cookieName);
29
51
  let cookieValue = null;
30
52
  let cookieEnd;
31
53
  if (cookieStart > -1) {
32
- cookieEnd = document.cookie.indexOf(";", cookieStart);
54
+ cookieEnd = doc.cookie.indexOf(";", cookieStart);
33
55
  if (cookieEnd === -1) {
34
- cookieEnd = document.cookie.length;
56
+ cookieEnd = doc.cookie.length;
35
57
  }
36
58
  cookieValue = decodeURIComponent(
37
- document.cookie.substring(cookieStart + cookieName.length, cookieEnd)
59
+ doc.cookie.substring(cookieStart + cookieName.length, cookieEnd)
38
60
  );
39
61
  }
40
62
  return cookieValue;
41
63
  },
42
64
  set(name, value, expires, path, domain, secure) {
65
+ if ((0, import_environment.isReactNative)()) {
66
+ const AsyncStorage = getAsyncStorage();
67
+ if (AsyncStorage) {
68
+ AsyncStorage.setItem(`cookie_${name}`, value).catch(console.error);
69
+ return;
70
+ }
71
+ return;
72
+ }
73
+ const doc = (0, import_environment.getDocument)();
74
+ if (!doc)
75
+ return;
43
76
  let cookieText = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
44
77
  if (expires instanceof Date) {
45
78
  cookieText += `; expires=${expires.toUTCString()}`;
@@ -53,10 +86,63 @@ var CookieUtils = {
53
86
  if (secure) {
54
87
  cookieText += "; secure";
55
88
  }
56
- document.cookie = cookieText;
89
+ doc.cookie = cookieText;
57
90
  },
58
91
  unset(name, path, domain, secure) {
92
+ if ((0, import_environment.isReactNative)()) {
93
+ const AsyncStorage = getAsyncStorage();
94
+ if (AsyncStorage) {
95
+ AsyncStorage.removeItem(`cookie_${name}`).catch(console.error);
96
+ return;
97
+ }
98
+ return;
99
+ }
59
100
  this.set(name, "", /* @__PURE__ */ new Date(0), path, domain, secure);
101
+ },
102
+ // React Native 异步版本
103
+ async getAsync(name) {
104
+ if ((0, import_environment.isReactNative)()) {
105
+ const AsyncStorage = getAsyncStorage();
106
+ if (AsyncStorage) {
107
+ try {
108
+ return await AsyncStorage.getItem(`cookie_${name}`);
109
+ } catch {
110
+ return null;
111
+ }
112
+ }
113
+ return null;
114
+ }
115
+ return this.get(name);
116
+ },
117
+ async setAsync(name, value, expires, path, domain, secure) {
118
+ if ((0, import_environment.isReactNative)()) {
119
+ const AsyncStorage = getAsyncStorage();
120
+ if (AsyncStorage) {
121
+ try {
122
+ await AsyncStorage.setItem(`cookie_${name}`, value);
123
+ } catch (error) {
124
+ console.error("Failed to set cookie in React Native:", error);
125
+ }
126
+ return;
127
+ }
128
+ return;
129
+ }
130
+ this.set(name, value, expires, path, domain, secure);
131
+ },
132
+ async unsetAsync(name, path, domain, secure) {
133
+ if ((0, import_environment.isReactNative)()) {
134
+ const AsyncStorage = getAsyncStorage();
135
+ if (AsyncStorage) {
136
+ try {
137
+ await AsyncStorage.removeItem(`cookie_${name}`);
138
+ } catch (error) {
139
+ console.error("Failed to unset cookie in React Native:", error);
140
+ }
141
+ return;
142
+ }
143
+ return;
144
+ }
145
+ this.unset(name, path, domain, secure);
60
146
  }
61
147
  };
62
148
  var CookieUtils_default = CookieUtils;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/CookieUtils.ts"],
4
- "sourcesContent": ["const CookieUtils = {\n get(name: string): string | null {\n const cookieName = `${encodeURIComponent(name)}=`;\n const cookieStart = document.cookie.indexOf(cookieName);\n let cookieValue: string | null = null;\n let cookieEnd: number;\n if (cookieStart > -1) {\n cookieEnd = document.cookie.indexOf(';', cookieStart);\n if (cookieEnd === -1) {\n cookieEnd = document.cookie.length;\n }\n cookieValue = decodeURIComponent(\n document.cookie.substring(cookieStart + cookieName.length, cookieEnd),\n );\n }\n return cookieValue;\n },\n set(\n name: string,\n value: string,\n expires?: Date,\n path?: string,\n domain?: string,\n secure?: boolean,\n ): void {\n let cookieText = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;\n if (expires instanceof Date) {\n cookieText += `; expires=${expires.toUTCString()}`;\n }\n if (path) {\n cookieText += `; path=${path}`;\n }\n if (domain) {\n cookieText += `; domain=${domain}`;\n }\n if (secure) {\n cookieText += '; secure';\n }\n document.cookie = cookieText;\n },\n unset(name: string, path?: string, domain?: string, secure?: boolean): void {\n this.set(name, '', new Date(0), path, domain, secure);\n },\n};\n\nexport default CookieUtils;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAM,cAAc;AAAA,EAClB,IAAI,MAA6B;AAC/B,UAAM,aAAa,GAAG,mBAAmB,IAAI;AAC7C,UAAM,cAAc,SAAS,OAAO,QAAQ,UAAU;AACtD,QAAI,cAA6B;AACjC,QAAI;AACJ,QAAI,cAAc,IAAI;AACpB,kBAAY,SAAS,OAAO,QAAQ,KAAK,WAAW;AACpD,UAAI,cAAc,IAAI;AACpB,oBAAY,SAAS,OAAO;AAAA,MAC9B;AACA,oBAAc;AAAA,QACZ,SAAS,OAAO,UAAU,cAAc,WAAW,QAAQ,SAAS;AAAA,MACtE;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EACA,IACE,MACA,OACA,SACA,MACA,QACA,QACM;AACN,QAAI,aAAa,GAAG,mBAAmB,IAAI,KAAK,mBAAmB,KAAK;AACxE,QAAI,mBAAmB,MAAM;AAC3B,oBAAc,aAAa,QAAQ,YAAY;AAAA,IACjD;AACA,QAAI,MAAM;AACR,oBAAc,UAAU;AAAA,IAC1B;AACA,QAAI,QAAQ;AACV,oBAAc,YAAY;AAAA,IAC5B;AACA,QAAI,QAAQ;AACV,oBAAc;AAAA,IAChB;AACA,aAAS,SAAS;AAAA,EACpB;AAAA,EACA,MAAM,MAAc,MAAe,QAAiB,QAAwB;AAC1E,SAAK,IAAI,MAAM,IAAI,oBAAI,KAAK,CAAC,GAAG,MAAM,QAAQ,MAAM;AAAA,EACtD;AACF;AAEA,IAAO,sBAAQ;",
4
+ "sourcesContent": ["import { getDocument, isReactNative } from './environment';\n\n// React Native 环境下的 Cookie 替代方案\nconst getAsyncStorage = () => {\n if (isReactNative()) {\n try {\n return require('@react-native-async-storage/async-storage').default;\n } catch {\n console.warn('AsyncStorage not available in React Native environment');\n return null;\n }\n }\n return null;\n};\n\nconst CookieUtils = {\n get(name: string): string | null {\n if (isReactNative()) {\n const AsyncStorage = getAsyncStorage();\n if (AsyncStorage) {\n // 在 React Native 中,我们使用 AsyncStorage 来模拟 cookie\n // 注意:这是异步操作,但在同步上下文中调用\n // 实际使用时应该使用异步版本\n return null; // 同步版本返回 null,异步版本需要单独实现\n }\n return null;\n }\n\n const doc = getDocument();\n if (!doc) return null;\n\n const cookieName = `${encodeURIComponent(name)}=`;\n const cookieStart = doc.cookie.indexOf(cookieName);\n let cookieValue: string | null = null;\n let cookieEnd: number;\n if (cookieStart > -1) {\n cookieEnd = doc.cookie.indexOf(';', cookieStart);\n if (cookieEnd === -1) {\n cookieEnd = doc.cookie.length;\n }\n cookieValue = decodeURIComponent(\n doc.cookie.substring(cookieStart + cookieName.length, cookieEnd),\n );\n }\n return cookieValue;\n },\n\n set(\n name: string,\n value: string,\n expires?: Date,\n path?: string,\n domain?: string,\n secure?: boolean,\n ): void {\n if (isReactNative()) {\n const AsyncStorage = getAsyncStorage();\n if (AsyncStorage) {\n // 在 React Native 中存储到 AsyncStorage\n AsyncStorage.setItem(`cookie_${name}`, value).catch(console.error);\n return;\n }\n return;\n }\n\n const doc = getDocument();\n if (!doc) return;\n\n let cookieText = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;\n if (expires instanceof Date) {\n cookieText += `; expires=${expires.toUTCString()}`;\n }\n if (path) {\n cookieText += `; path=${path}`;\n }\n if (domain) {\n cookieText += `; domain=${domain}`;\n }\n if (secure) {\n cookieText += '; secure';\n }\n doc.cookie = cookieText;\n },\n\n unset(name: string, path?: string, domain?: string, secure?: boolean): void {\n if (isReactNative()) {\n const AsyncStorage = getAsyncStorage();\n if (AsyncStorage) {\n // 在 React Native 中从 AsyncStorage 删除\n AsyncStorage.removeItem(`cookie_${name}`).catch(console.error);\n return;\n }\n return;\n }\n\n this.set(name, '', new Date(0), path, domain, secure);\n },\n\n // React Native 异步版本\n async getAsync(name: string): Promise<string | null> {\n if (isReactNative()) {\n const AsyncStorage = getAsyncStorage();\n if (AsyncStorage) {\n try {\n return await AsyncStorage.getItem(`cookie_${name}`);\n } catch {\n return null;\n }\n }\n return null;\n }\n return this.get(name);\n },\n\n async setAsync(\n name: string,\n value: string,\n expires?: Date,\n path?: string,\n domain?: string,\n secure?: boolean,\n ): Promise<void> {\n if (isReactNative()) {\n const AsyncStorage = getAsyncStorage();\n if (AsyncStorage) {\n try {\n await AsyncStorage.setItem(`cookie_${name}`, value);\n } catch (error) {\n console.error('Failed to set cookie in React Native:', error);\n }\n return;\n }\n return;\n }\n this.set(name, value, expires, path, domain, secure);\n },\n\n async unsetAsync(name: string, path?: string, domain?: string, secure?: boolean): Promise<void> {\n if (isReactNative()) {\n const AsyncStorage = getAsyncStorage();\n if (AsyncStorage) {\n try {\n await AsyncStorage.removeItem(`cookie_${name}`);\n } catch (error) {\n console.error('Failed to unset cookie in React Native:', error);\n }\n return;\n }\n return;\n }\n this.unset(name, path, domain, secure);\n },\n};\n\nexport default CookieUtils;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA2C;AAG3C,IAAM,kBAAkB,MAAM;AAC5B,UAAI,kCAAc,GAAG;AACnB,QAAI;AACF,aAAO,QAAQ,2CAA2C,EAAE;AAAA,IAC9D,QAAE;AACA,cAAQ,KAAK,wDAAwD;AACrE,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,IAAM,cAAc;AAAA,EAClB,IAAI,MAA6B;AAC/B,YAAI,kCAAc,GAAG;AACnB,YAAM,eAAe,gBAAgB;AACrC,UAAI,cAAc;AAIhB,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT;AAEA,UAAM,UAAM,gCAAY;AACxB,QAAI,CAAC;AAAK,aAAO;AAEjB,UAAM,aAAa,GAAG,mBAAmB,IAAI;AAC7C,UAAM,cAAc,IAAI,OAAO,QAAQ,UAAU;AACjD,QAAI,cAA6B;AACjC,QAAI;AACJ,QAAI,cAAc,IAAI;AACpB,kBAAY,IAAI,OAAO,QAAQ,KAAK,WAAW;AAC/C,UAAI,cAAc,IAAI;AACpB,oBAAY,IAAI,OAAO;AAAA,MACzB;AACA,oBAA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;AAAA,EAEA,MAAM,SACJ,MACA,OACA,SACA,MACA,QACA,QACe;AACf,YAAI,kCAAc,GAAG;AACnB,YAAM,eAAe,gBAAgB;AACrC,UAAI,cAAc;AAChB,YAAI;AACF,gBAAM,aAAa,QAAQ,UAAU,QAAQ,KAAK;AAAA,QACpD,SAAS,OAAP;AACA,kBAAQ,MAAM,yCAAyC,KAAK;AAAA,QAC9D;AACA;AAAA,MACF;AACA;AAAA,IACF;AACA,SAAK,IAAI,MAAM,OAAO,SAAS,MAAM,QAAQ,MAAM;AAAA,EACrD;AAAA,EAEA,MAAM,WAAW,MAAc,MAAe,QAAiB,QAAiC;AAC9F,YAAI,kCAAc,GAAG;AACnB,YAAM,eAAe,gBAAgB;AACrC,UAAI,cAAc;AAChB,YAAI;AACF,gBAAM,aAAa,WAAW,UAAU,MAAM;AAAA,QAChD,SAAS,OAAP;AACA,kBAAQ,MAAM,2CAA2C,KAAK;AAAA,QAChE;AACA;AAAA,MACF;AACA;AAAA,IACF;AACA,SAAK,MAAM,MAAM,MAAM,QAAQ,MAAM;AAAA,EACvC;AACF;AAEA,IAAO,sBAAQ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 环境检测工具
3
+ * 用于判断当前运行环境,提供跨平台兼容性支持
4
+ */
5
+ export declare const isReactNative: () => boolean;
6
+ export declare const isWeb: () => boolean;
7
+ export declare const isNode: () => boolean;
8
+ export declare const getEnvironment: () => 'web' | 'react-native' | 'node';
9
+ export declare const getWindow: () => Window | null;
10
+ export declare const getDocument: () => Document | null;
11
+ export declare const getLocation: () => Location | null;
@@ -0,0 +1,78 @@
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/environment.ts
20
+ var environment_exports = {};
21
+ __export(environment_exports, {
22
+ getDocument: () => getDocument,
23
+ getEnvironment: () => getEnvironment,
24
+ getLocation: () => getLocation,
25
+ getWindow: () => getWindow,
26
+ isNode: () => isNode,
27
+ isReactNative: () => isReactNative,
28
+ isWeb: () => isWeb
29
+ });
30
+ module.exports = __toCommonJS(environment_exports);
31
+ var isReactNative = () => {
32
+ return typeof global !== "undefined" && global.navigator && global.navigator.product === "ReactNative";
33
+ };
34
+ var isWeb = () => {
35
+ return typeof window !== "undefined" && typeof document !== "undefined" && !isReactNative();
36
+ };
37
+ var isNode = () => {
38
+ return typeof process !== "undefined" && process.versions && Boolean(process.versions.node);
39
+ };
40
+ var getEnvironment = () => {
41
+ if (isReactNative()) {
42
+ return "react-native";
43
+ }
44
+ if (isWeb()) {
45
+ return "web";
46
+ }
47
+ if (isNode()) {
48
+ return "node";
49
+ }
50
+ return "web";
51
+ };
52
+ var getWindow = () => {
53
+ if (isWeb()) {
54
+ return window;
55
+ }
56
+ return null;
57
+ };
58
+ var getDocument = () => {
59
+ if (isWeb()) {
60
+ return document;
61
+ }
62
+ return null;
63
+ };
64
+ var getLocation = () => {
65
+ const win = getWindow();
66
+ return win ? win.location : null;
67
+ };
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ getDocument,
71
+ getEnvironment,
72
+ getLocation,
73
+ getWindow,
74
+ isNode,
75
+ isReactNative,
76
+ isWeb
77
+ });
78
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/environment.ts"],
4
+ "sourcesContent": ["/**\n * 环境检测工具\n * 用于判断当前运行环境,提供跨平台兼容性支持\n */\n\n// 检测是否为 React Native 环境\nexport const isReactNative = (): boolean => {\n return typeof global !== 'undefined' &&\n global.navigator &&\n global.navigator.product === 'ReactNative';\n};\n\n// 检测是否为 Web 环境\nexport const isWeb = (): boolean => {\n return typeof window !== 'undefined' &&\n typeof document !== 'undefined' &&\n !isReactNative();\n};\n\n// 检测是否为 Node.js 环境\nexport const isNode = (): boolean => {\n return typeof process !== 'undefined' &&\n process.versions &&\n Boolean(process.versions.node);\n};\n\n// 获取当前环境类型\nexport const getEnvironment = (): 'web' | 'react-native' | 'node' => {\n if (isReactNative()) {\n return 'react-native';\n }\n if (isWeb()) {\n return 'web';\n }\n if (isNode()) {\n return 'node';\n }\n return 'web'; // 默认返回 web\n};\n\n// 安全地获取 window 对象\nexport const getWindow = (): Window | null => {\n if (isWeb()) {\n return window;\n }\n return null;\n};\n\n// 安全地获取 document 对象\nexport const getDocument = (): Document | null => {\n if (isWeb()) {\n return document;\n }\n return null;\n};\n\n// 安全地获取 location 对象\nexport const getLocation = (): Location | null => {\n const win = getWindow();\n return win ? win.location : null;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,IAAM,gBAAgB,MAAe;AAC1C,SAAO,OAAO,WAAW,eAClB,OAAO,aACP,OAAO,UAAU,YAAY;AACtC;AAGO,IAAM,QAAQ,MAAe;AAClC,SAAO,OAAO,WAAW,eAClB,OAAO,aAAa,eACpB,CAAC,cAAc;AACxB;AAGO,IAAM,SAAS,MAAe;AACnC,SAAO,OAAO,YAAY,eACnB,QAAQ,YACR,QAAQ,QAAQ,SAAS,IAAI;AACtC;AAGO,IAAM,iBAAiB,MAAuC;AACnE,MAAI,cAAc,GAAG;AACnB,WAAO;AAAA,EACT;AACA,MAAI,MAAM,GAAG;AACX,WAAO;AAAA,EACT;AACA,MAAI,OAAO,GAAG;AACZ,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAGO,IAAM,YAAY,MAAqB;AAC5C,MAAI,MAAM,GAAG;AACX,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAGO,IAAM,cAAc,MAAuB;AAChD,MAAI,MAAM,GAAG;AACX,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAGO,IAAM,cAAc,MAAuB;AAChD,QAAM,MAAM,UAAU;AACtB,SAAO,MAAM,IAAI,WAAW;AAC9B;",
6
+ "names": []
7
+ }
@@ -92,6 +92,19 @@ var formatModuleData = ({
92
92
  moduleDataRes.compProps.title = (0, import_helpers.stringPramarsValTransition)(otherCompProps == null ? void 0 : otherCompProps.title, allParametrs);
93
93
  }
94
94
  moduleDataRes.parentCompProps = (parentModuleData == null ? void 0 : parentModuleData.compProps) || {};
95
+ if (compType === "page") {
96
+ if (events && (events == null ? void 0 : events.length) > 0) {
97
+ const onLoadEvent = events.find(
98
+ (item) => (item == null ? void 0 : item.key) === "pageLoad"
99
+ );
100
+ if (onLoadEvent) {
101
+ moduleDataRes.compProps.onLoad = onLoadEvent == null ? void 0 : onLoadEvent.event;
102
+ }
103
+ }
104
+ if (eventFlag) {
105
+ moduleDataRes.compProps.eventFlag = { checked: true };
106
+ }
107
+ }
95
108
  if (["panel", "div", "page"].indexOf(compType) >= 0 && Array.isArray(children) && children.length > 0) {
96
109
  const childs = children.map((item) => {
97
110
  return formatModuleData({
@@ -105,19 +118,6 @@ var formatModuleData = ({
105
118
  });
106
119
  });
107
120
  moduleDataRes.children = childs;
108
- if (compType === "page") {
109
- if (events && (events == null ? void 0 : events.length) > 0) {
110
- const onLoadEvent = events.find(
111
- (item) => (item == null ? void 0 : item.key) === "pageLoad"
112
- );
113
- if (onLoadEvent) {
114
- moduleDataRes.compProps.onLoad = onLoadEvent == null ? void 0 : onLoadEvent.event;
115
- }
116
- }
117
- if (eventFlag) {
118
- moduleDataRes.compProps.eventFlag = { checked: true };
119
- }
120
- }
121
121
  } else {
122
122
  if (otherCompProps && ((_a = Object == null ? void 0 : Object.keys(otherCompProps)) == null ? void 0 : _a.length) > 0) {
123
123
  Object == null ? void 0 : Object.keys(otherCompProps).forEach((compPropKey) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/formatModule/formatModuleData.ts"],
4
- "sourcesContent": ["import 'ses';\nimport { getDataArr } from '../treeUtils';\nimport {\n urlPrefix,\n formatListProps,\n formatTableProps,\n formatCarouselProps,\n formatImageProps,\n formatFormProps,\n formatHighCodeProps,\n formatDescriptionsProps,\n formatLoopProps,\n formatStyleProps,\n formatEchartLineProps,\n formatEchartPieProps,\n formatChartsProps,\n formatStepsProps,\n staticCodeAssemble,\n stringPramarsValTransition,\n} from './helpers';\n\ntype formatModuleProps = {\n moduleData: { [key: string]: any } | null; // 页面配置数据\n parentModuleData?: { [key: string]: any } | null; // 父级配置数据\n pageData?: { [key: string]: any } | null; // 页面组件数据\n parameters?: any; // 入参上下文\n loopItemData?: any; // 循环体数据\n staticCodeList?: { [key: string]: any } | null; // 静态资源数据\n disabled?: boolean;\n};\n\nconst formatModuleData = ({\n moduleData,\n parentModuleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n}: formatModuleProps): { [key: string]: any } | null => {\n let moduleDataRes: { [key: string]: any } = { };\n const allParametrs:{ [key: string]: any } = {\n ...(parameters || {}),\n pageData: pageData || {},\n loopItem: loopItemData || {},\n }; // 把页面数据与入参组装到一起\n const {\n staticCodeMap,\n staticOptionsMap,\n } = staticCodeAssemble(staticCodeList);\n\n if (moduleData) {\n const {\n compProps,\n compType,\n children,\n moduleTitle,\n moduleDescribe,\n id,\n } = moduleData;\n // 组装静态数据映射\n moduleDataRes = {\n ...moduleData,\n key: id,\n disabled,\n compProps: {},\n originModule: moduleData, // 配置moduled的信息\n };\n const {\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n columns: compColumns,\n tableBodyHeight,\n fileProps,\n attrs,\n rowSelection,\n hasSelectAll,\n rowKey,\n fieldName,\n column,\n articleContent,\n eventFlag,\n events,\n ...otherCompProps // 无需处理的属性\n } = compProps || {};\n if (moduleTitle) {\n moduleDataRes.moduleTitle = stringPramarsValTransition(moduleTitle, allParametrs);\n }\n if (moduleDescribe) {\n moduleDataRes.moduleDescribe = stringPramarsValTransition(moduleDescribe, allParametrs);\n }\n if (otherCompProps?.title) {\n moduleDataRes.compProps.title = stringPramarsValTransition(otherCompProps?.title, allParametrs);\n }\n \n moduleDataRes.parentCompProps = parentModuleData?.compProps || {};\n if (\n ['panel', 'div', 'page'].indexOf(compType) >= 0 &&\n Array.isArray(children) &&\n children.length > 0\n ) {\n const childs = children.map((item) => {\n return formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n });\n });\n moduleDataRes.children = childs;\n if (compType === 'page') {\n if (events && events?.length > 0) {\n const onLoadEvent = events.find(\n (item: any) => item?.key === 'pageLoad',\n );\n if (onLoadEvent) {\n moduleDataRes.compProps.onLoad = onLoadEvent?.event;\n }\n }\n if (eventFlag) {\n moduleDataRes.compProps.eventFlag = { checked: true };\n }\n }\n } else {\n if (otherCompProps && Object?.keys(otherCompProps)?.length > 0) {\n Object?.keys(otherCompProps).forEach(compPropKey => {\n if (otherCompProps?.[compPropKey] || typeof otherCompProps?.[compPropKey] === 'number') {\n moduleDataRes.compProps[compPropKey] = otherCompProps?.[compPropKey];\n }\n });\n }\n if (rowSelection) {\n moduleDataRes.compProps.rowSelection = rowSelection;\n if (hasSelectAll && rowSelection?.type === 'checkbox') {\n moduleDataRes.compProps.hasSelectAll = hasSelectAll;\n } else {\n delete moduleDataRes.compProps.hasSelectAll;\n }\n }\n const rowKeyIndexArr = getDataArr(rowKey);\n\n if (Array.isArray(rowKeyIndexArr) && rowKeyIndexArr.length > 0) {\n moduleDataRes.compProps.rowKey = rowKeyIndexArr.slice(-1)?.[0];\n }\n\n if (compType === 'typography') {\n if (articleContent) {\n moduleDataRes.compProps.articleContent = stringPramarsValTransition(articleContent, allParametrs);\n }\n }\n if (compType === 'iframe') {\n moduleDataRes.compProps.url = stringPramarsValTransition(\n otherCompProps?.url,\n allParametrs,\n );\n }\n\n if (compType === 'carousel' && compDataSource && compDataSource?.dataType) {\n const carouselProps = formatCarouselProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...carouselProps,\n };\n }\n if (compType === 'image' && compDataSource && compDataSource?.dataType) {\n const imageProps = formatImageProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...imageProps,\n };\n }\n\n if (compType === 'highCodeComp') {\n const highCodeCompProps = formatHighCodeProps({\n options: { fileProps },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...highCodeCompProps,\n };\n }\n\n if (compType === 'table') {\n const tableProps = formatTableProps({\n options: {\n ...otherCompProps,\n columns: compColumns,\n dataSource: compDataSource,\n attrs,\n tableBodyHeight,\n },\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...tableProps,\n };\n }\n if (compType === 'form') {\n const formProps = formatFormProps({\n options: {\n column,\n children,\n },\n parameters: allParametrs,\n staticCodeMap,\n staticOptionsMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...formProps,\n };\n }\n if (compType === 'descriptions') {\n const descriptionsProps = formatDescriptionsProps({\n options: {\n column,\n attrs,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...descriptionsProps,\n };\n }\n if (compType === 'loop') {\n const loopProps = formatLoopProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n const loopChilds:({[key:string]:any}|null)[] = [];\n if (\n Array.isArray(loopProps?.dataSource) && loopProps?.dataSource?.length > 0 &&\n Array.isArray(children) && children.length > 0\n ) {\n loopProps?.dataSource.forEach((dataItem) => {\n const dataItemKey = moduleDataRes?.compProps?.rowKey && dataItem?.[moduleDataRes?.compProps?.rowKey] ?\n dataItem?.[moduleDataRes?.compProps?.rowKey] : '';\n loopChilds.push({\n id: dataItemKey,\n key: dataItemKey,\n compType: 'loopItem',\n compProps: {},\n originItem: dataItem,\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: typeof dataItem === 'object' ? dataItem : { item: dataItem },\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n });\n } else if (Array.isArray(children) && children.length > 0) {\n loopChilds.push({\n id: '1',\n key: '1',\n compType: 'loopItem',\n compProps: {},\n originItem: {},\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: {},\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n }\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...loopProps,\n column,\n children: loopChilds,\n };\n }\n if (['list', 'card', 'recommendList'].includes(compType)) {\n const resProps = formatListProps({\n options: {\n ...otherCompProps,\n rowKey,\n rowSelection,\n attrs,\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n },\n urlPrefix,\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...resProps,\n };\n }\n if (['echartBar', 'echartLine'].includes(compType)) {\n const echartProps = formatEchartLineProps({\n options: { ...otherCompProps, dataSource: compDataSource },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'echartPie') {\n const echartProps = formatEchartPieProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'charts') {\n const chartsProps = formatChartsProps({\n options: {\n echartsOptions: compProps?.echartsOptions,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...chartsProps,\n };\n }\n }\n if (compType === 'steps') {\n const stepsProps = formatStepsProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...stepsProps,\n };\n }\n moduleDataRes.compProps.style = formatStyleProps(moduleData, parentModuleData);\n // 所有的模版 拼一个组装数据的key值\n if (moduleData?.compProps && fieldName) {\n moduleDataRes.compProps.fieldName = fieldName;\n }\n }\n\n return moduleDataRes;\n};\n\nexport default formatModuleData;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAO;AACP,uBAA2B;AAC3B,qBAiBO;AAYP,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAwD;AAvCxD;AAwCE,MAAI,gBAAwC,CAAE;AAC9C,QAAM,eAAsC;AAAA,IAC1C,GAAI,cAAc,CAAC;AAAA,IACnB,UAAU,YAAY,CAAC;AAAA,IACvB,UAAU,gBAAgB,CAAC;AAAA,EAC7B;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,QAAI,mCAAmB,cAAc;AAErC,MAAI,YAAY;AACd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BAAgB,uCAAW;AAAA,UAC7B;AAAA,UACA,YAAY;AAAA,QACd,CAAC;AAED,sBAAc,YAAY;AAAA,UACxB,GAAI,cAAc,aAAa,CAAC;AAAA,UAChC,GAAG;AAAA,QACL;AAAA,MACF;AAAA,IACF;AACA,QAAI,aAAa,SAAS;AACxB,YAAM,iBAAa,iCAAiB;AAAA,QAClC,SAAS;AAAA,UACP,YAAY;AAAA,UACZ,GAAG;AAAA,QACL;AAAA,QACA,YAAY;AAAA,MACd,CAAC;AACD,oBAAc,YAAY;AAAA,QACxB,GAAI,cAAc,aAAa,CAAC;AAAA,QAChC,GAAG;AAAA,MACL;AAAA,IACF;AACA,kBAAc,UAAU,YAAQ,iCAAiB,YAAY,gBAAgB;AAE7E,SAAI,yCAAY,cAAa,WAAW;AACtC,oBAAc,UAAU,YAAY;AAAA,IACtC;AAAA,EACF;AAEA,SAAO;AACT;AAEA,IAAO,2BAAQ;",
4
+ "sourcesContent": ["import 'ses';\nimport { getDataArr } from '../treeUtils';\nimport {\n urlPrefix,\n formatListProps,\n formatTableProps,\n formatCarouselProps,\n formatImageProps,\n formatFormProps,\n formatHighCodeProps,\n formatDescriptionsProps,\n formatLoopProps,\n formatStyleProps,\n formatEchartLineProps,\n formatEchartPieProps,\n formatChartsProps,\n formatStepsProps,\n staticCodeAssemble,\n stringPramarsValTransition,\n} from './helpers';\n\ntype formatModuleProps = {\n moduleData: { [key: string]: any } | null; // 页面配置数据\n parentModuleData?: { [key: string]: any } | null; // 父级配置数据\n pageData?: { [key: string]: any } | null; // 页面组件数据\n parameters?: any; // 入参上下文\n loopItemData?: any; // 循环体数据\n staticCodeList?: { [key: string]: any } | null; // 静态资源数据\n disabled?: boolean;\n};\n\nconst formatModuleData = ({\n moduleData,\n parentModuleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n}: formatModuleProps): { [key: string]: any } | null => {\n let moduleDataRes: { [key: string]: any } = { };\n const allParametrs:{ [key: string]: any } = {\n ...(parameters || {}),\n pageData: pageData || {},\n loopItem: loopItemData || {},\n }; // 把页面数据与入参组装到一起\n const {\n staticCodeMap,\n staticOptionsMap,\n } = staticCodeAssemble(staticCodeList);\n\n if (moduleData) {\n const {\n compProps,\n compType,\n children,\n moduleTitle,\n moduleDescribe,\n id,\n } = moduleData;\n // 组装静态数据映射\n moduleDataRes = {\n ...moduleData,\n key: id,\n disabled,\n compProps: {},\n originModule: moduleData, // 配置moduled的信息\n };\n const {\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n columns: compColumns,\n tableBodyHeight,\n fileProps,\n attrs,\n rowSelection,\n hasSelectAll,\n rowKey,\n fieldName,\n column,\n articleContent,\n eventFlag,\n events,\n ...otherCompProps // 无需处理的属性\n } = compProps || {};\n if (moduleTitle) {\n moduleDataRes.moduleTitle = stringPramarsValTransition(moduleTitle, allParametrs);\n }\n if (moduleDescribe) {\n moduleDataRes.moduleDescribe = stringPramarsValTransition(moduleDescribe, allParametrs);\n }\n if (otherCompProps?.title) {\n moduleDataRes.compProps.title = stringPramarsValTransition(otherCompProps?.title, allParametrs);\n }\n \n moduleDataRes.parentCompProps = parentModuleData?.compProps || {};\n // 处理page组件的onLoad事件\n if (compType === 'page') {\n if (events && events?.length > 0) {\n const onLoadEvent = events.find(\n (item: any) => item?.key === 'pageLoad',\n );\n if (onLoadEvent) {\n moduleDataRes.compProps.onLoad = onLoadEvent?.event;\n }\n }\n if (eventFlag) {\n moduleDataRes.compProps.eventFlag = { checked: true };\n }\n }\n if (\n ['panel', 'div', 'page'].indexOf(compType) >= 0 &&\n Array.isArray(children) &&\n children.length > 0\n ) {\n const childs = children.map((item) => {\n return formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n });\n });\n moduleDataRes.children = childs;\n } else {\n if (otherCompProps && Object?.keys(otherCompProps)?.length > 0) {\n Object?.keys(otherCompProps).forEach(compPropKey => {\n if (otherCompProps?.[compPropKey] || typeof otherCompProps?.[compPropKey] === 'number') {\n moduleDataRes.compProps[compPropKey] = otherCompProps?.[compPropKey];\n }\n });\n }\n if (rowSelection) {\n moduleDataRes.compProps.rowSelection = rowSelection;\n if (hasSelectAll && rowSelection?.type === 'checkbox') {\n moduleDataRes.compProps.hasSelectAll = hasSelectAll;\n } else {\n delete moduleDataRes.compProps.hasSelectAll;\n }\n }\n const rowKeyIndexArr = getDataArr(rowKey);\n\n if (Array.isArray(rowKeyIndexArr) && rowKeyIndexArr.length > 0) {\n moduleDataRes.compProps.rowKey = rowKeyIndexArr.slice(-1)?.[0];\n }\n\n if (compType === 'typography') {\n if (articleContent) {\n moduleDataRes.compProps.articleContent = stringPramarsValTransition(articleContent, allParametrs);\n }\n }\n if (compType === 'iframe') {\n moduleDataRes.compProps.url = stringPramarsValTransition(\n otherCompProps?.url,\n allParametrs,\n );\n }\n\n if (compType === 'carousel' && compDataSource && compDataSource?.dataType) {\n const carouselProps = formatCarouselProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...carouselProps,\n };\n }\n if (compType === 'image' && compDataSource && compDataSource?.dataType) {\n const imageProps = formatImageProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...imageProps,\n };\n }\n\n if (compType === 'highCodeComp') {\n const highCodeCompProps = formatHighCodeProps({\n options: { fileProps },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...highCodeCompProps,\n };\n }\n\n if (compType === 'table') {\n const tableProps = formatTableProps({\n options: {\n ...otherCompProps,\n columns: compColumns,\n dataSource: compDataSource,\n attrs,\n tableBodyHeight,\n },\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...tableProps,\n };\n }\n if (compType === 'form') {\n const formProps = formatFormProps({\n options: {\n column,\n children,\n },\n parameters: allParametrs,\n staticCodeMap,\n staticOptionsMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...formProps,\n };\n }\n if (compType === 'descriptions') {\n const descriptionsProps = formatDescriptionsProps({\n options: {\n column,\n attrs,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...descriptionsProps,\n };\n }\n if (compType === 'loop') {\n const loopProps = formatLoopProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n const loopChilds:({[key:string]:any}|null)[] = [];\n if (\n Array.isArray(loopProps?.dataSource) && loopProps?.dataSource?.length > 0 &&\n Array.isArray(children) && children.length > 0\n ) {\n loopProps?.dataSource.forEach((dataItem) => {\n const dataItemKey = moduleDataRes?.compProps?.rowKey && dataItem?.[moduleDataRes?.compProps?.rowKey] ?\n dataItem?.[moduleDataRes?.compProps?.rowKey] : '';\n loopChilds.push({\n id: dataItemKey,\n key: dataItemKey,\n compType: 'loopItem',\n compProps: {},\n originItem: dataItem,\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: typeof dataItem === 'object' ? dataItem : { item: dataItem },\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n });\n } else if (Array.isArray(children) && children.length > 0) {\n loopChilds.push({\n id: '1',\n key: '1',\n compType: 'loopItem',\n compProps: {},\n originItem: {},\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: {},\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n }\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...loopProps,\n column,\n children: loopChilds,\n };\n }\n if (['list', 'card', 'recommendList'].includes(compType)) {\n const resProps = formatListProps({\n options: {\n ...otherCompProps,\n rowKey,\n rowSelection,\n attrs,\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n },\n urlPrefix,\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...resProps,\n };\n }\n if (['echartBar', 'echartLine'].includes(compType)) {\n const echartProps = formatEchartLineProps({\n options: { ...otherCompProps, dataSource: compDataSource },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'echartPie') {\n const echartProps = formatEchartPieProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'charts') {\n const chartsProps = formatChartsProps({\n options: {\n echartsOptions: compProps?.echartsOptions,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...chartsProps,\n };\n }\n }\n if (compType === 'steps') {\n const stepsProps = formatStepsProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...stepsProps,\n };\n }\n moduleDataRes.compProps.style = formatStyleProps(moduleData, parentModuleData);\n // 所有的模版 拼一个组装数据的key值\n if (moduleData?.compProps && fieldName) {\n moduleDataRes.compProps.fieldName = fieldName;\n }\n }\n\n return moduleDataRes;\n};\n\nexport default formatModuleData;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAO;AACP,uBAA2B;AAC3B,qBAiBO;AAYP,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,E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Aa,aAAa;AAC5B,cAAM,kBAAc,qCAAqB;AAAA,UACvC,SAAS;AAAA,YACP,YAAY;AAAA,YACZ,GAAG;AAAA,UACL;AAAA,UACA,YAAY;AAAA,QACd,CAAC;AAED,sBAAc,YAAY;AAAA,UACxB,GAAI,cAAc,aAAa,CAAC;AAAA,UAChC,GAAG;AAAA,QACL;AAAA,MACF;AACA,UAAI,aAAa,UAAU;AACzB,cAAM,kBAAc,kCAAkB;AAAA,UACpC,SAAS;AAAA,YACP,gBAAgB,uCAAW;AAAA,UAC7B;AAAA,UACA,YAAY;AAAA,QACd,CAAC;AAED,sBAAc,YAAY;AAAA,UACxB,GAAI,cAAc,aAAa,CAAC;AAAA,UAChC,GAAG;AAAA,QACL;AAAA,MACF;AAAA,IACF;AACA,QAAI,aAAa,SAAS;AACxB,YAAM,iBAAa,iCAAiB;AAAA,QAClC,SAAS;AAAA,UACP,YAAY;AAAA,UACZ,GAAG;AAAA,QACL;AAAA,QACA,YAAY;AAAA,MACd,CAAC;AACD,oBAAc,YAAY;AAAA,QACxB,GAAI,cAAc,aAAa,CAAC;AAAA,QAChC,GAAG;AAAA,MACL;AAAA,IACF;AACA,kBAAc,UAAU,YAAQ,iCAAiB,YAAY,gBAAgB;AAE7E,SAAI,yCAAY,cAAa,WAAW;AACtC,oBAAc,UAAU,YAAY;AAAA,IACtC;AAAA,EACF;AAEA,SAAO;AACT;AAEA,IAAO,2BAAQ;",
6
6
  "names": ["_a", "_b", "_c"]
7
7
  }
@@ -0,0 +1,40 @@
1
+ export declare const tenantIdSessionKey: string;
2
+ /**
3
+ * 构造管理平台或机器人工程的完整访问地址
4
+ * @param url 环境变量中配置的地址
5
+ */
6
+ export declare const getAccessUrl: (url: string | undefined) => string;
7
+ declare const request: {
8
+ getBaseUrl: () => string;
9
+ setUrlPrefix: (prefix: string) => void;
10
+ setTenantId: (tenantId: string) => void;
11
+ getManagerUrl: (route?: string | null) => string;
12
+ getBotUrl: (route?: string | null) => string;
13
+ getBotIconUrl: (tenantId?: string, botId?: string, updatedTime?: string) => string | undefined;
14
+ getSceneIconUrl: (tenantId?: string, sceneId?: string, updatedTime?: string) => string | undefined;
15
+ docChain: {
16
+ referenceDocUrl: ({ tenantId, docId, token, }: {
17
+ [key: string]: string;
18
+ }) => string;
19
+ referenceDocChunkUrl: ({ tenantId, docId, chunkId, token, score, rank, docType, }: {
20
+ [key: string]: string;
21
+ }) => string;
22
+ downloadDocUrl: ({ tenantId, docId, token, isSecurity, }: {
23
+ [key: string]: string | boolean;
24
+ }) => string;
25
+ imageUrl: ({ tenantId, docId, token, path, isSecurity, }: {
26
+ [key: string]: string | boolean;
27
+ }) => string;
28
+ };
29
+ tenantKnowledge: {
30
+ referenceDocUrl: ({ tenantId, docId, token, knowledgeType, docName, }: {
31
+ [key: string]: string;
32
+ }) => string;
33
+ downloadDocUrl: ({ knowledgeType, docId }: {
34
+ [key: string]: string;
35
+ }) => string;
36
+ };
37
+ get: (url: string, cfg: any) => Promise<unknown>;
38
+ post: (url: string, cfg: any) => Promise<unknown>;
39
+ };
40
+ export { request };