@gct-paas/core 0.1.4-dev.11 → 0.1.4-dev.13

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 (142) hide show
  1. package/dist/index.esm.min.js +4522 -0
  2. package/es/constants/core.mjs +5 -4
  3. package/es/constants/default-date-type/default-date-type.mjs +73 -21
  4. package/es/constants/editor-register/editor-register.mjs +17 -5
  5. package/es/constants/expression-type/BuiltOperators.mjs +152 -147
  6. package/es/constants/expression-type/FunctionKeys.mjs +75 -79
  7. package/es/constants/expression-type/editor.mjs +10 -3
  8. package/es/constants/expression-type/function.mjs +602 -613
  9. package/es/constants/expression-type/index.mjs +111 -113
  10. package/es/constants/expression-type/modeCfg.mjs +256 -263
  11. package/es/constants/expression-type/variable.mjs +43 -39
  12. package/es/constants/form-container-type/form-container-type.mjs +17 -5
  13. package/es/constants/index.d.ts +1 -0
  14. package/es/constants/index.mjs +31 -10
  15. package/es/constants/page-designer/model.mjs +15 -5
  16. package/es/constants/page-designer/regex.d.ts +2 -0
  17. package/es/constants/page-designer/regex.mjs +5 -0
  18. package/es/create-app-vue.mjs +15 -9
  19. package/es/enums/app-designer/index.d.ts +19 -0
  20. package/es/enums/app-designer/index.mjs +131 -63
  21. package/es/enums/appEnum.mjs +681 -360
  22. package/es/enums/appStateEnum.mjs +17 -10
  23. package/es/enums/authActionEnum.mjs +63 -51
  24. package/es/enums/breakpointEnum.mjs +27 -26
  25. package/es/enums/cacheEnum.mjs +22 -21
  26. package/es/enums/designEnum.mjs +110 -71
  27. package/es/enums/developer-center/integration.mjs +7 -6
  28. package/es/enums/exceptionEnum.mjs +21 -17
  29. package/es/enums/expressionEnum.d.ts +1 -1
  30. package/es/enums/expressionEnum.mjs +81 -74
  31. package/es/enums/globalEnum.mjs +59 -36
  32. package/es/enums/httpEnum.mjs +71 -61
  33. package/es/enums/index.mjs +44 -14
  34. package/es/enums/menuEnum.mjs +42 -38
  35. package/es/enums/page-designer/designer.mjs +403 -407
  36. package/es/enums/page-designer/index.d.ts +1 -0
  37. package/es/enums/page-designer/index.mjs +5 -0
  38. package/es/enums/page-designer/layout.d.ts +12 -0
  39. package/es/enums/page-designer/layout.mjs +17 -0
  40. package/es/enums/page-designer/panel.mjs +341 -213
  41. package/es/enums/page-designer/toolkit.mjs +13 -12
  42. package/es/enums/page-designer/widget.mjs +425 -338
  43. package/es/enums/pageEnum.mjs +14 -13
  44. package/es/enums/plugin-enum.mjs +23 -7
  45. package/es/enums/processEnum.mjs +95 -60
  46. package/es/enums/roleEnum.mjs +7 -6
  47. package/es/enums/sizeEnum.d.ts +18 -0
  48. package/es/enums/sizeEnum.mjs +28 -8
  49. package/es/global/gct/gct.mjs +84 -96
  50. package/es/global/index.mjs +1 -0
  51. package/es/hooks/index.mjs +4 -0
  52. package/es/hooks/use-app-inst/use-app-inst.mjs +11 -5
  53. package/es/hooks/use-modal/use-modal.mjs +16 -10
  54. package/es/hooks/use-sub-app-utils/use-sub-app-utils.mjs +43 -23
  55. package/es/hooks/useCopyToClipboard.mjs +50 -50
  56. package/es/index.mjs +125 -114
  57. package/es/interface/i-pinia-state/i-global-state.d.ts +0 -11
  58. package/es/locale/index.mjs +50 -57
  59. package/es/modules/env-manager/env-manager.const.mjs +16 -8
  60. package/es/modules/env-manager/env-manager.d.ts +2 -0
  61. package/es/modules/env-manager/env-manager.interface.d.ts +2 -0
  62. package/es/modules/env-manager/env-manager.interface.mjs +14 -7
  63. package/es/modules/env-manager/env-manager.mjs +108 -107
  64. package/es/modules/error-handler/error-handler.const.mjs +11 -16
  65. package/es/modules/error-handler/error-strategy.mjs +199 -175
  66. package/es/modules/error-handler/index.mjs +120 -106
  67. package/es/modules/mqtt/constants/mqtt.const.mjs +21 -24
  68. package/es/modules/mqtt/enums/mqtt-status.enum.mjs +23 -9
  69. package/es/modules/mqtt/index.mjs +4 -0
  70. package/es/modules/mqtt/mqtt-client.mjs +228 -261
  71. package/es/modules/mqtt/mqtt-manager.mjs +117 -77
  72. package/es/modules/platform-config/constants/index.mjs +4 -0
  73. package/es/modules/platform-config/constants/login.const.mjs +48 -45
  74. package/es/modules/platform-config/constants/org.const.mjs +57 -52
  75. package/es/modules/platform-config/constants/theme.const.mjs +11 -4
  76. package/es/modules/platform-config/constants/watermark.const.mjs +17 -12
  77. package/es/modules/platform-config/enums/deploy.enum.mjs +13 -6
  78. package/es/modules/platform-config/enums/login.enum.mjs +29 -15
  79. package/es/modules/platform-config/enums/platform.enum.mjs +16 -13
  80. package/es/modules/platform-config/index.mjs +9 -0
  81. package/es/modules/platform-config/store.mjs +68 -79
  82. package/es/modules/platform-config/useBasicSetting.mjs +47 -35
  83. package/es/modules/platform-config/useDeploySetting.mjs +29 -21
  84. package/es/modules/platform-config/useLoginSetting.mjs +151 -173
  85. package/es/modules/platform-config/useOrgSetting.mjs +63 -62
  86. package/es/modules/platform-config/useProjectSetting.mjs +14 -6
  87. package/es/modules/platform-config/useSecuritySetting.mjs +68 -56
  88. package/es/modules/platform-config/useThemeSetting.mjs +78 -59
  89. package/es/modules/platform-config/useWatermarkSetting.mjs +37 -23
  90. package/es/modules/user-stores/index.mjs +3 -0
  91. package/es/modules/user-stores/store/permission.store.mjs +27 -36
  92. package/es/modules/user-stores/store/tenant.store.mjs +20 -22
  93. package/es/modules/user-stores/store/user.store.mjs +94 -117
  94. package/es/router/index.mjs +25 -28
  95. package/es/setup-app.mjs +23 -39
  96. package/es/state/global-pinia-state/global-pinia-state.d.ts +0 -6
  97. package/es/state/global-pinia-state/global-pinia-state.mjs +43 -71
  98. package/es/state/index.mjs +1 -0
  99. package/es/store/global-store.mjs +50 -72
  100. package/es/store/index.mjs +25 -19
  101. package/es/types/index.d.ts +7 -0
  102. package/es/utils/axios/interceptors.mjs +21 -17
  103. package/es/utils/cache-adapter/cache-adapter.mjs +61 -56
  104. package/es/utils/css-loader/css-loader.d.ts +36 -0
  105. package/es/utils/css-loader/css-loader.mjs +82 -0
  106. package/es/utils/design/design.mjs +18 -12
  107. package/es/utils/deviceFingerprint.mjs +77 -63
  108. package/es/utils/dictionary/dictionary.mjs +142 -145
  109. package/es/utils/file/base64Conver.mjs +35 -30
  110. package/es/utils/file/download.mjs +94 -98
  111. package/es/utils/file/parser.d.ts +3 -0
  112. package/es/utils/file/parser.mjs +29 -0
  113. package/es/utils/i18n/index.mjs +14 -3
  114. package/es/utils/index.d.ts +3 -1
  115. package/es/utils/index.mjs +32 -0
  116. package/es/utils/is-sort-filed/is-sort-filed.mjs +42 -37
  117. package/es/utils/linked-list/linked-list.mjs +115 -118
  118. package/es/utils/linked-node/linked-node.mjs +41 -31
  119. package/es/utils/lowcode/utils.mjs +13 -18
  120. package/es/utils/lowcode/validate.mjs +20 -26
  121. package/es/utils/mitt/mitt.mjs +4 -4
  122. package/es/utils/model-loader/model-loader.mjs +280 -325
  123. package/es/utils/namespace/namespace.mjs +178 -164
  124. package/es/utils/openUtil/index.mjs +2 -0
  125. package/es/utils/openUtil/modal/modal.mjs +72 -79
  126. package/es/utils/openUtil/overlay-container/overlay-container.mjs +144 -138
  127. package/es/utils/permission.mjs +33 -37
  128. package/es/utils/plugin-static-resource/plugin-static-resource.mjs +46 -42
  129. package/es/utils/style/index.mjs +94 -138
  130. package/es/utils/tools/tools.mjs +86 -54
  131. package/es/utils/treeHelper/treeHelper.mjs +205 -233
  132. package/es/utils/uploader/uploader.mjs +81 -115
  133. package/es/utils/useUUid.mjs +79 -87
  134. package/es/utils/util.mjs +55 -35
  135. package/es/utils/uuid/uuid.d.ts +2 -0
  136. package/es/utils/uuid/uuid.mjs +33 -43
  137. package/es/utils/validate.mjs +15 -19
  138. package/es/utils/value-helper/value-helper.mjs +113 -98
  139. package/package.json +9 -18
  140. package/dist/index.esm.min.mjs +0 -18322
  141. package/dist/index.min.cjs +0 -393
  142. package/dist/index.system.min.js +0 -393
@@ -1,146 +1,143 @@
1
- class DictionaryUtil {
2
- /**
3
- * 代码表配置
4
- *
5
- * @author zhanghanrui
6
- * @date 2024-03-27 13:03:59
7
- * @private
8
- * @type {Map<string, IDictionary>}
9
- */
10
- configs = /* @__PURE__ */ new Map();
11
- /**
12
- * 已经加载的代码表缓存
13
- *
14
- * @author zhanghanrui
15
- * @date 2024-03-27 13:03:14
16
- * @private
17
- * @type {Map<string, IDictionaryItem[]>}
18
- */
19
- cache = /* @__PURE__ */ new Map();
20
- /**
21
- * 获取代码表配置
22
- *
23
- * @author zhanghanrui
24
- * @date 2024-04-02 13:04:32
25
- * @param {string} tag
26
- * @return {*} {(IDictionary | undefined)}
27
- */
28
- getConfig(tag) {
29
- return this.configs.get(tag);
30
- }
31
- /**
32
- * 注册写的代码表配置
33
- *
34
- * @author zhanghanrui
35
- * @date 2024-03-27 13:03:17
36
- * @param {IDictionary} config
37
- */
38
- register(config) {
39
- this.configs.set(config.tag, config);
40
- if (config.items) {
41
- this.cache.set(config.tag, config.items);
42
- }
43
- }
44
- /**
45
- * 取消注册代码表
46
- *
47
- * @author zhanghanrui
48
- * @date 2024-03-27 13:03:58
49
- * @param {string} tag
50
- */
51
- unregister(tag) {
52
- this.configs.delete(tag);
53
- this.cache.delete(tag);
54
- }
55
- /**
56
- * 获取代码表配置
57
- *
58
- * @author zhanghanrui
59
- * @date 2024-03-27 13:03:06
60
- * @param {string} codeTag
61
- * @return {*} {IDictionaryItem[]}
62
- */
63
- get(codeTag) {
64
- return this.cache.get(codeTag) || [];
65
- }
66
- /**
67
- * 动态请求代码表
68
- *
69
- * @author zhanghanrui
70
- * @date 2024-03-27 13:03:14
71
- * @param {string} codeTag
72
- * @param {IParams} [params]
73
- * @return {*} {Promise<IDictionaryItem[]>}
74
- */
75
- async asyncGet(codeTag, params) {
76
- const config = this.configs.get(codeTag);
77
- if (!config) {
78
- return [];
79
- }
80
- if (config.mode === "static") {
81
- return this.getByConfig(config);
82
- }
83
- if (config.mode === "async") {
84
- if (this.cache.has(codeTag)) {
85
- return this.cache.get(codeTag) || [];
86
- }
87
- return this.asyncGetByConfig(config, params);
88
- }
89
- return [];
90
- }
91
- /**
92
- * 根据配置获取代码表
93
- *
94
- * @author zhanghanrui
95
- * @date 2024-04-02 21:04:25
96
- * @param {IDictionary} config
97
- * @return {*} {IDictionaryItem[]}
98
- */
99
- getByConfig(config) {
100
- return config.items || [];
101
- }
102
- /**
103
- * 根据配置获取异步代码表
104
- *
105
- * @author zhanghanrui
106
- * @date 2024-04-02 21:04:00
107
- * @param {IDictionary} config
108
- * @param {IParams} [params={}]
109
- * @return {*} {Promise<IDictionaryItem[]>}
110
- */
111
- async asyncGetByConfig(config, params = {}) {
112
- if (config.fetch) {
113
- const items = await config.fetch(params || {});
114
- if (items) {
115
- const [key, value] = config.keys || ["name", "id"];
116
- return this.deepFormat(items, key, value);
117
- }
118
- }
119
- return [];
120
- }
121
- /**
122
- * 递归格式化代码表
123
- *
124
- * @author zhanghanrui
125
- * @date 2024-04-02 22:04:03
126
- * @protected
127
- * @param {IData[]} items
128
- * @param {string} key
129
- * @param {string} value
130
- * @return {*} {IDictionaryItem[]}
131
- */
132
- deepFormat(items, key, value) {
133
- return items.map((item) => {
134
- const config = {
135
- label: item[key],
136
- value: item[value]
137
- };
138
- if (item.children && item.children.length > 0) {
139
- config.options = this.deepFormat(item.children, key, value);
140
- }
141
- return config;
142
- });
143
- }
144
- }
145
-
1
+ //#region src/utils/dictionary/dictionary.ts
2
+ /**
3
+ * 数据字典工具类
4
+ *
5
+ * @export
6
+ * @class DictionaryService
7
+ */
8
+ var DictionaryUtil = class {
9
+ /**
10
+ * 代码表配置
11
+ *
12
+ * @author zhanghanrui
13
+ * @date 2024-03-27 13:03:59
14
+ * @private
15
+ * @type {Map<string, IDictionary>}
16
+ */
17
+ configs = /* @__PURE__ */ new Map();
18
+ /**
19
+ * 已经加载的代码表缓存
20
+ *
21
+ * @author zhanghanrui
22
+ * @date 2024-03-27 13:03:14
23
+ * @private
24
+ * @type {Map<string, IDictionaryItem[]>}
25
+ */
26
+ cache = /* @__PURE__ */ new Map();
27
+ /**
28
+ * 获取代码表配置
29
+ *
30
+ * @author zhanghanrui
31
+ * @date 2024-04-02 13:04:32
32
+ * @param {string} tag
33
+ * @return {*} {(IDictionary | undefined)}
34
+ */
35
+ getConfig(tag) {
36
+ return this.configs.get(tag);
37
+ }
38
+ /**
39
+ * 注册写的代码表配置
40
+ *
41
+ * @author zhanghanrui
42
+ * @date 2024-03-27 13:03:17
43
+ * @param {IDictionary} config
44
+ */
45
+ register(config) {
46
+ this.configs.set(config.tag, config);
47
+ if (config.items) this.cache.set(config.tag, config.items);
48
+ }
49
+ /**
50
+ * 取消注册代码表
51
+ *
52
+ * @author zhanghanrui
53
+ * @date 2024-03-27 13:03:58
54
+ * @param {string} tag
55
+ */
56
+ unregister(tag) {
57
+ this.configs.delete(tag);
58
+ this.cache.delete(tag);
59
+ }
60
+ /**
61
+ * 获取代码表配置
62
+ *
63
+ * @author zhanghanrui
64
+ * @date 2024-03-27 13:03:06
65
+ * @param {string} codeTag
66
+ * @return {*} {IDictionaryItem[]}
67
+ */
68
+ get(codeTag) {
69
+ return this.cache.get(codeTag) || [];
70
+ }
71
+ /**
72
+ * 动态请求代码表
73
+ *
74
+ * @author zhanghanrui
75
+ * @date 2024-03-27 13:03:14
76
+ * @param {string} codeTag
77
+ * @param {IParams} [params]
78
+ * @return {*} {Promise<IDictionaryItem[]>}
79
+ */
80
+ async asyncGet(codeTag, params) {
81
+ const config = this.configs.get(codeTag);
82
+ if (!config) return [];
83
+ if (config.mode === "static") return this.getByConfig(config);
84
+ if (config.mode === "async") {
85
+ if (this.cache.has(codeTag)) return this.cache.get(codeTag) || [];
86
+ return this.asyncGetByConfig(config, params);
87
+ }
88
+ return [];
89
+ }
90
+ /**
91
+ * 根据配置获取代码表
92
+ *
93
+ * @author zhanghanrui
94
+ * @date 2024-04-02 21:04:25
95
+ * @param {IDictionary} config
96
+ * @return {*} {IDictionaryItem[]}
97
+ */
98
+ getByConfig(config) {
99
+ return config.items || [];
100
+ }
101
+ /**
102
+ * 根据配置获取异步代码表
103
+ *
104
+ * @author zhanghanrui
105
+ * @date 2024-04-02 21:04:00
106
+ * @param {IDictionary} config
107
+ * @param {IParams} [params={}]
108
+ * @return {*} {Promise<IDictionaryItem[]>}
109
+ */
110
+ async asyncGetByConfig(config, params = {}) {
111
+ if (config.fetch) {
112
+ const items = await config.fetch(params || {});
113
+ if (items) {
114
+ const [key, value] = config.keys || ["name", "id"];
115
+ return this.deepFormat(items, key, value);
116
+ }
117
+ }
118
+ return [];
119
+ }
120
+ /**
121
+ * 递归格式化代码表
122
+ *
123
+ * @author zhanghanrui
124
+ * @date 2024-04-02 22:04:03
125
+ * @protected
126
+ * @param {IData[]} items
127
+ * @param {string} key
128
+ * @param {string} value
129
+ * @return {*} {IDictionaryItem[]}
130
+ */
131
+ deepFormat(items, key, value) {
132
+ return items.map((item) => {
133
+ const config = {
134
+ label: item[key],
135
+ value: item[value]
136
+ };
137
+ if (item.children && item.children.length > 0) config.options = this.deepFormat(item.children, key, value);
138
+ return config;
139
+ });
140
+ }
141
+ };
142
+ //#endregion
146
143
  export { DictionaryUtil };
@@ -1,35 +1,40 @@
1
+ //#region src/utils/file/base64Conver.ts
2
+ /**
3
+ * @description: base64 to blob
4
+ */
1
5
  function dataURLtoBlob(base64Buf) {
2
- const arr = base64Buf.split(",");
3
- const typeItem = arr[0];
4
- const mime = typeItem.match(/:(.*?);/)[1];
5
- const bstr = window.atob(arr[1]);
6
- let n = bstr.length;
7
- const u8arr = new Uint8Array(n);
8
- while (n > 0) {
9
- n -= 1;
10
- u8arr[n] = bstr.charCodeAt(n);
11
- }
12
- return new Blob([u8arr], { type: mime });
6
+ const arr = base64Buf.split(",");
7
+ const mime = arr[0].match(/:(.*?);/)[1];
8
+ const bstr = window.atob(arr[1]);
9
+ let n = bstr.length;
10
+ const u8arr = new Uint8Array(n);
11
+ while (n > 0) {
12
+ n -= 1;
13
+ u8arr[n] = bstr.charCodeAt(n);
14
+ }
15
+ return new Blob([u8arr], { type: mime });
13
16
  }
17
+ /**
18
+ * img url to base64
19
+ * @param url
20
+ */
14
21
  function urlToBase64(url, mineType) {
15
- return new Promise((resolve, reject) => {
16
- let canvas = document.createElement("CANVAS");
17
- const ctx = canvas.getContext("2d");
18
- const img = new Image();
19
- img.crossOrigin = "";
20
- img.onload = function() {
21
- if (!canvas || !ctx) {
22
- return reject();
23
- }
24
- canvas.height = img.height;
25
- canvas.width = img.width;
26
- ctx.drawImage(img, 0, 0);
27
- const dataURL = canvas.toDataURL(mineType || "image/png");
28
- canvas = null;
29
- resolve(dataURL);
30
- };
31
- img.src = url;
32
- });
22
+ return new Promise((resolve, reject) => {
23
+ let canvas = document.createElement("CANVAS");
24
+ const ctx = canvas.getContext("2d");
25
+ const img = new Image();
26
+ img.crossOrigin = "";
27
+ img.onload = function() {
28
+ if (!canvas || !ctx) return reject();
29
+ canvas.height = img.height;
30
+ canvas.width = img.width;
31
+ ctx.drawImage(img, 0, 0);
32
+ const dataURL = canvas.toDataURL(mineType || "image/png");
33
+ canvas = null;
34
+ resolve(dataURL);
35
+ };
36
+ img.src = url;
37
+ });
33
38
  }
34
-
39
+ //#endregion
35
40
  export { dataURLtoBlob, urlToBase64 };
@@ -1,107 +1,103 @@
1
- import 'qs';
2
- import 'lodash-es';
3
- import '../mitt/mitt.mjs';
4
- import '../../enums/app-designer/index.mjs';
5
- import '../../enums/page-designer/designer.mjs';
6
- import '../../enums/breakpointEnum.mjs';
7
- import '../../constants/expression-type/modeCfg.mjs';
8
- import '../../constants/expression-type/BuiltOperators.mjs';
9
- import '../../constants/expression-type/function.mjs';
10
- import '../../constants/expression-type/variable.mjs';
11
- import 'vue';
12
- import 'qx-util';
13
- import 'path-browserify';
14
- import '../uuid/uuid.mjs';
15
- import 'axios';
16
- import '@fingerprintjs/fingerprintjs';
17
- import { openWindow } from '../util.mjs';
18
- import '../useUUid.mjs';
19
- import { dataURLtoBlob, urlToBase64 } from './base64Conver.mjs';
20
- import dayjs from 'dayjs';
21
- import '../permission.mjs';
22
-
1
+ import { openWindow } from "../util.mjs";
2
+ import { dataURLtoBlob, urlToBase64 } from "./base64Conver.mjs";
3
+ import "../index.mjs";
4
+ import dayjs from "dayjs";
5
+ //#region src/utils/file/download.ts
6
+ /**
7
+ * Download online pictures
8
+ * @param url
9
+ * @param filename
10
+ * @param mime
11
+ * @param bom
12
+ */
23
13
  function downloadByOnlineUrl(url, filename, mime, bom) {
24
- urlToBase64(url).then((base64) => {
25
- downloadByBase64(base64, filename, mime, bom);
26
- });
14
+ urlToBase64(url).then((base64) => {
15
+ downloadByBase64(base64, filename, mime, bom);
16
+ });
27
17
  }
18
+ /**
19
+ * Download pictures based on base64
20
+ * @param buf
21
+ * @param filename
22
+ * @param mime
23
+ * @param bom
24
+ */
28
25
  function downloadByBase64(buf, filename, mime, bom) {
29
- const base64Buf = dataURLtoBlob(buf);
30
- downloadByData(base64Buf, { filename, mime, bom });
26
+ downloadByData(dataURLtoBlob(buf), {
27
+ filename,
28
+ mime,
29
+ bom
30
+ });
31
31
  }
32
32
  function uploaderFiles({ multiple = false, accept = "*" } = {}) {
33
- const input = document.createElement("input");
34
- input.type = "file";
35
- input.multiple = !!multiple;
36
- input.accept = accept;
37
- input.click();
38
- return new Promise((resolve, reject) => {
39
- input.onchange = async () => {
40
- const filelist = input.files || [];
41
- resolve(Object.values(filelist));
42
- };
43
- input.onerror = async () => {
44
- reject();
45
- };
46
- });
33
+ const input = document.createElement("input");
34
+ input.type = "file";
35
+ input.multiple = !!multiple;
36
+ input.accept = accept;
37
+ input.click();
38
+ return new Promise((resolve, reject) => {
39
+ input.onchange = async () => {
40
+ const filelist = input.files || [];
41
+ resolve(Object.values(filelist));
42
+ };
43
+ input.onerror = async () => {
44
+ reject();
45
+ };
46
+ });
47
47
  }
48
- function downloadByData(data, {
49
- filename = "file",
50
- timestamp = false,
51
- mime,
52
- bom
53
- }) {
54
- if (timestamp) {
55
- const ext = filename.split(".").pop();
56
- const realName = filename.replace(/\.[^/.]+$/, "");
57
- const timestamp2 = dayjs(/* @__PURE__ */ new Date()).format("YYYYMMDDHHmmss");
58
- filename = `${realName}${timestamp2}.${ext}`;
59
- }
60
- const blobData = typeof bom !== "undefined" ? [bom, data] : [data];
61
- const blob = new Blob(blobData, { type: mime || "application/octet-stream" });
62
- const blobURL = window.URL.createObjectURL(blob);
63
- const tempLink = document.createElement("a");
64
- tempLink.style.display = "none";
65
- tempLink.href = blobURL;
66
- tempLink.setAttribute("download", filename);
67
- if (typeof tempLink.download === "undefined") {
68
- tempLink.setAttribute("target", "_blank");
69
- }
70
- document.body.appendChild(tempLink);
71
- tempLink.click();
72
- document.body.removeChild(tempLink);
73
- window.URL.revokeObjectURL(blobURL);
48
+ /**
49
+ * Download according to the background interface file stream
50
+ * @param {*} data
51
+ * @param {*} opts
52
+ * @param {*} opts.filename 文件名
53
+ * @param {*} opts.timestamp 是否需要在文件名后面自动加上时间戳
54
+ * @param {*} opts.mime
55
+ * @param {*} opts.bom
56
+ */
57
+ function downloadByData(data, { filename = "file", timestamp = false, mime, bom }) {
58
+ if (timestamp) {
59
+ const ext = filename.split(".").pop();
60
+ filename = `${filename.replace(/\.[^/.]+$/, "")}${dayjs(/* @__PURE__ */ new Date()).format("YYYYMMDDHHmmss")}.${ext}`;
61
+ }
62
+ const blobData = typeof bom !== "undefined" ? [bom, data] : [data];
63
+ const blob = new Blob(blobData, { type: mime || "application/octet-stream" });
64
+ const blobURL = window.URL.createObjectURL(blob);
65
+ const tempLink = document.createElement("a");
66
+ tempLink.style.display = "none";
67
+ tempLink.href = blobURL;
68
+ tempLink.setAttribute("download", filename);
69
+ if (typeof tempLink.download === "undefined") tempLink.setAttribute("target", "_blank");
70
+ document.body.appendChild(tempLink);
71
+ tempLink.click();
72
+ document.body.removeChild(tempLink);
73
+ window.URL.revokeObjectURL(blobURL);
74
74
  }
75
- function downloadByUrl({
76
- url,
77
- target = "_blank",
78
- fileName
79
- }) {
80
- const isChrome = window.navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
81
- const isSafari = window.navigator.userAgent.toLowerCase().indexOf("safari") > -1;
82
- if (/(iP)/g.test(window.navigator.userAgent)) {
83
- console.error("Your browser does not support download!");
84
- return false;
85
- }
86
- if (isChrome || isSafari) {
87
- const link = document.createElement("a");
88
- link.href = url;
89
- link.target = target;
90
- if (link.download !== void 0) {
91
- link.download = fileName || url.substring(url.lastIndexOf("/") + 1, url.length);
92
- }
93
- if (document.createEvent) {
94
- const e = document.createEvent("MouseEvents");
95
- e.initEvent("click", true, true);
96
- link.dispatchEvent(e);
97
- return true;
98
- }
99
- }
100
- if (url.indexOf("?") === -1) {
101
- url += "?download";
102
- }
103
- openWindow(url, { target });
104
- return true;
75
+ /**
76
+ * Download file according to file address
77
+ * @param {*} sUrl
78
+ */
79
+ function downloadByUrl({ url, target = "_blank", fileName }) {
80
+ const isChrome = window.navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
81
+ const isSafari = window.navigator.userAgent.toLowerCase().indexOf("safari") > -1;
82
+ if (/(iP)/g.test(window.navigator.userAgent)) {
83
+ console.error("Your browser does not support download!");
84
+ return false;
85
+ }
86
+ if (isChrome || isSafari) {
87
+ const link = document.createElement("a");
88
+ link.href = url;
89
+ link.target = target;
90
+ if (link.download !== void 0) link.download = fileName || url.substring(url.lastIndexOf("/") + 1, url.length);
91
+ if (document.createEvent) {
92
+ const e = document.createEvent("MouseEvents");
93
+ e.initEvent("click", true, true);
94
+ link.dispatchEvent(e);
95
+ return true;
96
+ }
97
+ }
98
+ if (url.indexOf("?") === -1) url += "?download";
99
+ openWindow(url, { target });
100
+ return true;
105
101
  }
106
-
102
+ //#endregion
107
103
  export { downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, uploaderFiles };
@@ -0,0 +1,3 @@
1
+ import { UploadTypeEnum } from '../../enums';
2
+ export declare const sizeParser: (size: number) => string;
3
+ export declare const typeParser: (fileName: string) => "attachment" | "img" | UploadTypeEnum.JPG | UploadTypeEnum.JPEG | UploadTypeEnum.PNG | UploadTypeEnum.BMP | UploadTypeEnum.DOCX | UploadTypeEnum.XLSX | UploadTypeEnum.DOC | UploadTypeEnum.MP4 | UploadTypeEnum.AVI | UploadTypeEnum.PPT | UploadTypeEnum.GIF | "MP4" | "PDF" | "ssl";
@@ -0,0 +1,29 @@
1
+ import { UploadTypeEnum } from "../../enums/sizeEnum.mjs";
2
+ import "../../enums/index.mjs";
3
+ //#region src/utils/file/parser.ts
4
+ var sizeParser = (size) => {
5
+ if (size / 1024 < 1) return (size / 1024).toFixed(2) + "K";
6
+ if (size / 1024 / 10 < 1) return (size / 1024).toFixed(1) + "K";
7
+ if (size / 1024 / 1024 < 1) return (size / 1024).toFixed(0) + "K";
8
+ if (size / 1024 / 1024 / 10 < 1) return (size / 1024 / 1024).toFixed(2) + "M";
9
+ return (size / 1024 / 1024).toFixed(2) + "M";
10
+ };
11
+ var typeParser = (fileName) => {
12
+ const arr = fileName?.split(".") ?? [];
13
+ const type = (arr[arr.length - 1] || "png").toLowerCase();
14
+ if ([
15
+ UploadTypeEnum.PNG,
16
+ UploadTypeEnum.JPG,
17
+ UploadTypeEnum.JPEG,
18
+ UploadTypeEnum.BMP,
19
+ UploadTypeEnum.GIF
20
+ ].includes(type)) return "img";
21
+ if ([UploadTypeEnum.DOCX, UploadTypeEnum.DOC].includes(type)) return UploadTypeEnum.DOC;
22
+ if ([UploadTypeEnum.MP4, UploadTypeEnum.AVI].includes(type)) return "MP4";
23
+ if (type === UploadTypeEnum.PDF) return "PDF";
24
+ if (type === UploadTypeEnum.CER) return "ssl";
25
+ if (Object.values(UploadTypeEnum).includes(type)) return type;
26
+ return "attachment";
27
+ };
28
+ //#endregion
29
+ export { sizeParser, typeParser };
@@ -1,5 +1,16 @@
1
- const t = (...args) => {
2
- return _gct.i18n.global.t(...args);
1
+ //#region src/utils/i18n/index.ts
2
+ /**
3
+ * 多语言转换
4
+ *
5
+ * @author chitanda
6
+ * @date 2025-08-13 13:08:28
7
+ * @export
8
+ * @param {string} key
9
+ * @param {string} [def]
10
+ * @returns {*} {string}
11
+ */
12
+ var t = (...args) => {
13
+ return _gct.i18n.global.t(...args);
3
14
  };
4
-
15
+ //#endregion
5
16
  export { t };
@@ -1,3 +1,4 @@
1
+ export { cssLoader } from './css-loader/css-loader';
1
2
  export { gctMemoizeAsync } from './cache-adapter/cache-adapter';
2
3
  export { DictionaryUtil } from './dictionary/dictionary';
3
4
  export { t } from './i18n';
@@ -14,7 +15,7 @@ export { getToken, setToken, getTenant, getTimezone, isMobile, setTenant, deepMe
14
15
  export * from './uuid/uuid';
15
16
  export * from './value-helper/value-helper';
16
17
  export { interceptors } from './axios/interceptors';
17
- export { getDeviceFingerprint, getPageIdentification, } from './deviceFingerprint';
18
+ export { getDeviceFingerprint, getPageIdentification, getMobileBrowserFingerprint, } from './deviceFingerprint';
18
19
  export { TreeHelper } from './treeHelper/treeHelper';
19
20
  export * from './style';
20
21
  export * from './util';
@@ -24,5 +25,6 @@ export * from './validate';
24
25
  export * from './uploader/uploader';
25
26
  export * from './file/download';
26
27
  export * from './file/base64Conver';
28
+ export * from './file/parser';
27
29
  export * from './design/design';
28
30
  export { permission } from './permission';