ztxkutils 2.10.66-2 → 2.10.66-20

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 (89) hide show
  1. package/dist/authority-e6bde99f.js +423 -0
  2. package/dist/fileOperation.d.ts +19 -0
  3. package/dist/fileOperation.js +58 -16
  4. package/dist/i18next.d.ts +2 -0
  5. package/dist/i18next.js +2380 -0
  6. package/dist/index.js +2 -2
  7. package/dist/reqUrl-3792afcd.js +82 -0
  8. package/dist/reqUrl-787dd9e5.js +82 -0
  9. package/dist/reqUrl-ea7ef876.js +83 -0
  10. package/dist/reqUrl.js +1 -1
  11. package/dist/request-0cc024b1.js +2917 -0
  12. package/dist/{request-dc69f021.js → request-4c29d6de.js} +14 -9
  13. package/dist/request-ba8abf99.js +2902 -0
  14. package/dist/request-ef290b9a.js +2838 -0
  15. package/dist/request.js +1 -1
  16. package/dist/tools-09a4d620.js +2445 -0
  17. package/dist/tools-0ca888cd.js +2473 -0
  18. package/dist/validate-6e735536.js +79 -0
  19. package/dist/zti18n-cli/bin/index.d.ts +2 -0
  20. package/dist/zti18n-cli/index.d.ts +1 -0
  21. package/dist/zti18n-cli/src/command/collect.d.ts +2 -0
  22. package/dist/zti18n-cli/src/command/convert.d.ts +2 -0
  23. package/dist/zti18n-cli/src/command/convert2.d.ts +2 -0
  24. package/dist/zti18n-cli/src/command/initFileConf.d.ts +2 -0
  25. package/dist/zti18n-cli/src/command/publish.d.ts +2 -0
  26. package/dist/zti18n-cli/src/conf/BaseConf.d.ts +8 -0
  27. package/dist/zti18n-cli/src/conf/FileConf.d.ts +6 -0
  28. package/dist/zti18n-cli/src/index.d.ts +1 -0
  29. package/dist/zti18n-cli/src/translate/google.d.ts +2 -0
  30. package/dist/zti18n-cli/src/utils/isChinese.d.ts +2 -0
  31. package/dist/zti18n-cli/src/utils/log.d.ts +4 -0
  32. package/dist/zti18n-cli/src/utils/mergeOptions.d.ts +24 -0
  33. package/dist/zti18n-cli/src/utils/reactOptions.d.ts +21 -0
  34. package/dist/zti18n-cli/src/utils/vueOptions.d.ts +17 -0
  35. package/dist/zti18n-core/index.d.ts +2 -0
  36. package/dist/zti18n-core/src/index.d.ts +8 -0
  37. package/dist/zti18n-core/src/plugin/reactIntlToReactIntlUniversal.d.ts +19 -0
  38. package/dist/zti18n-core/src/plugin/reactIntlUniversalToDi18n.d.ts +9 -0
  39. package/dist/zti18n-core/src/transform/defaultPkMap.d.ts +75 -0
  40. package/dist/zti18n-core/src/transform/transformHtml.d.ts +5 -0
  41. package/dist/zti18n-core/src/transform/transformJs.d.ts +5 -0
  42. package/dist/zti18n-core/src/transform/transformPug.d.ts +5 -0
  43. package/dist/zti18n-core/src/transform/transformReactIntlToReactIntlUniversal.d.ts +2 -0
  44. package/dist/zti18n-core/src/transform/transformReactIntlUniveralToDi18n.d.ts +2 -0
  45. package/dist/zti18n-core/src/transform/transformToDi18n.d.ts +5 -0
  46. package/dist/zti18n-core/src/transform/transformTs.d.ts +5 -0
  47. package/dist/zti18n-core/src/transform/transformVue.d.ts +5 -0
  48. package/dist/zti18n-core/src/transform/transformZeroToDi18n.d.ts +2 -0
  49. package/dist/zti18n-core/src/translate/google.d.ts +2 -0
  50. package/dist/zti18n-core/src/utils/constants.d.ts +3 -0
  51. package/dist/zti18n-core/src/utils/getIgnoreLines.d.ts +2 -0
  52. package/dist/zti18n-core/src/utils/isChinese.d.ts +2 -0
  53. package/dist/zti18n-core/src/utils/log.d.ts +4 -0
  54. package/package.json +41 -4
  55. package/zti18n-cli/bin/index.js +3 -0
  56. package/zti18n-cli/index.js +23 -0
  57. package/zti18n-cli/src/command/collect.js +351 -0
  58. package/zti18n-cli/src/command/convert.js +17 -0
  59. package/zti18n-cli/src/command/convert2.js +35 -0
  60. package/zti18n-cli/src/command/initFileConf.js +133 -0
  61. package/zti18n-cli/src/command/publish.js +24 -0
  62. package/zti18n-cli/src/conf/BaseConf.js +21 -0
  63. package/zti18n-cli/src/conf/FileConf.js +116 -0
  64. package/zti18n-cli/src/index.js +75 -0
  65. package/zti18n-cli/src/translate/google.js +6 -0
  66. package/zti18n-cli/src/utils/isChinese.js +3 -0
  67. package/zti18n-cli/src/utils/log.js +8 -0
  68. package/zti18n-cli/src/utils/mergeOptions.js +45 -0
  69. package/zti18n-cli/src/utils/reactOptions.js +73 -0
  70. package/zti18n-cli/src/utils/vueOptions.js +69 -0
  71. package/zti18n-core/index.js +1 -0
  72. package/zti18n-core/src/index.js +5 -0
  73. package/zti18n-core/src/plugin/reactIntlToReactIntlUniversal.js +224 -0
  74. package/zti18n-core/src/plugin/reactIntlUniversalToDi18n.js +64 -0
  75. package/zti18n-core/src/transform/defaultPkMap.js +79 -0
  76. package/zti18n-core/src/transform/transformHtml.js +271 -0
  77. package/zti18n-core/src/transform/transformJs.js +488 -0
  78. package/zti18n-core/src/transform/transformPug.js +272 -0
  79. package/zti18n-core/src/transform/transformReactIntlToReactIntlUniversal.js +96 -0
  80. package/zti18n-core/src/transform/transformReactIntlUniveralToDi18n.js +90 -0
  81. package/zti18n-core/src/transform/transformToDi18n.js +22 -0
  82. package/zti18n-core/src/transform/transformTs.js +41 -0
  83. package/zti18n-core/src/transform/transformVue.js +126 -0
  84. package/zti18n-core/src/transform/transformZeroToDi18n.js +105 -0
  85. package/zti18n-core/src/translate/google.js +6 -0
  86. package/zti18n-core/src/utils/constants.js +3 -0
  87. package/zti18n-core/src/utils/getIgnoreLines.js +14 -0
  88. package/zti18n-core/src/utils/isChinese.js +3 -0
  89. package/zti18n-core/src/utils/log.js +8 -0
@@ -0,0 +1,423 @@
1
+ /**
2
+ * base64.ts
3
+ *
4
+ * Licensed under the BSD 3-Clause License.
5
+ * http://opensource.org/licenses/BSD-3-Clause
6
+ *
7
+ * References:
8
+ * http://en.wikipedia.org/wiki/Base64
9
+ *
10
+ * @author Dan Kogai (https://github.com/dankogai)
11
+ */
12
+ const _hasatob = typeof atob === 'function';
13
+ const _hasbtoa = typeof btoa === 'function';
14
+ const _hasBuffer = typeof Buffer === 'function';
15
+ const _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined;
16
+ const _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined;
17
+ const b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
18
+ const b64chs = [...b64ch];
19
+ const b64tab = ((a) => {
20
+ let tab = {};
21
+ a.forEach((c, i) => tab[c] = i);
22
+ return tab;
23
+ })(b64chs);
24
+ const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
25
+ const _fromCC = String.fromCharCode.bind(String);
26
+ const _U8Afrom = typeof Uint8Array.from === 'function'
27
+ ? Uint8Array.from.bind(Uint8Array)
28
+ : (it, fn = (x) => x) => new Uint8Array(Array.prototype.slice.call(it, 0).map(fn));
29
+ const _mkUriSafe = (src) => src
30
+ .replace(/[+\/]/g, (m0) => m0 == '+' ? '-' : '_')
31
+ .replace(/=+$/m, '');
32
+ const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, '');
33
+ /**
34
+ * polyfill version of `btoa`
35
+ */
36
+ const btoaPolyfill = (bin) => {
37
+ // console.log('polyfilled');
38
+ let u32, c0, c1, c2, asc = '';
39
+ const pad = bin.length % 3;
40
+ for (let i = 0; i < bin.length;) {
41
+ if ((c0 = bin.charCodeAt(i++)) > 255 ||
42
+ (c1 = bin.charCodeAt(i++)) > 255 ||
43
+ (c2 = bin.charCodeAt(i++)) > 255)
44
+ throw new TypeError('invalid character found');
45
+ u32 = (c0 << 16) | (c1 << 8) | c2;
46
+ asc += b64chs[u32 >> 18 & 63]
47
+ + b64chs[u32 >> 12 & 63]
48
+ + b64chs[u32 >> 6 & 63]
49
+ + b64chs[u32 & 63];
50
+ }
51
+ return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
52
+ };
53
+ /**
54
+ * does what `window.btoa` of web browsers do.
55
+ * @param {String} bin binary string
56
+ * @returns {string} Base64-encoded string
57
+ */
58
+ const _btoa = _hasbtoa ? (bin) => btoa(bin)
59
+ : _hasBuffer ? (bin) => Buffer.from(bin, 'binary').toString('base64')
60
+ : btoaPolyfill;
61
+ const _fromUint8Array = _hasBuffer
62
+ ? (u8a) => Buffer.from(u8a).toString('base64')
63
+ : (u8a) => {
64
+ // cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326
65
+ const maxargs = 0x1000;
66
+ let strs = [];
67
+ for (let i = 0, l = u8a.length; i < l; i += maxargs) {
68
+ strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
69
+ }
70
+ return _btoa(strs.join(''));
71
+ };
72
+ // This trick is found broken https://github.com/dankogai/js-base64/issues/130
73
+ // const utob = (src: string) => unescape(encodeURIComponent(src));
74
+ // reverting good old fationed regexp
75
+ const cb_utob = (c) => {
76
+ if (c.length < 2) {
77
+ var cc = c.charCodeAt(0);
78
+ return cc < 0x80 ? c
79
+ : cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6))
80
+ + _fromCC(0x80 | (cc & 0x3f)))
81
+ : (_fromCC(0xe0 | ((cc >>> 12) & 0x0f))
82
+ + _fromCC(0x80 | ((cc >>> 6) & 0x3f))
83
+ + _fromCC(0x80 | (cc & 0x3f)));
84
+ }
85
+ else {
86
+ var cc = 0x10000
87
+ + (c.charCodeAt(0) - 0xD800) * 0x400
88
+ + (c.charCodeAt(1) - 0xDC00);
89
+ return (_fromCC(0xf0 | ((cc >>> 18) & 0x07))
90
+ + _fromCC(0x80 | ((cc >>> 12) & 0x3f))
91
+ + _fromCC(0x80 | ((cc >>> 6) & 0x3f))
92
+ + _fromCC(0x80 | (cc & 0x3f)));
93
+ }
94
+ };
95
+ const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
96
+ /**
97
+ * @deprecated should have been internal use only.
98
+ * @param {string} src UTF-8 string
99
+ * @returns {string} UTF-16 string
100
+ */
101
+ const utob = (u) => u.replace(re_utob, cb_utob);
102
+ //
103
+ const _encode = _hasBuffer
104
+ ? (s) => Buffer.from(s, 'utf8').toString('base64')
105
+ : _TE
106
+ ? (s) => _fromUint8Array(_TE.encode(s))
107
+ : (s) => _btoa(utob(s));
108
+ /**
109
+ * converts a UTF-8-encoded string to a Base64 string.
110
+ * @param {boolean} [urlsafe] if `true` make the result URL-safe
111
+ * @returns {string} Base64 string
112
+ */
113
+ const encode = (src, urlsafe = false) => urlsafe
114
+ ? _mkUriSafe(_encode(src))
115
+ : _encode(src);
116
+ // This trick is found broken https://github.com/dankogai/js-base64/issues/130
117
+ // const btou = (src: string) => decodeURIComponent(escape(src));
118
+ // reverting good old fationed regexp
119
+ const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
120
+ const cb_btou = (cccc) => {
121
+ switch (cccc.length) {
122
+ case 4:
123
+ var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
124
+ | ((0x3f & cccc.charCodeAt(1)) << 12)
125
+ | ((0x3f & cccc.charCodeAt(2)) << 6)
126
+ | (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000;
127
+ return (_fromCC((offset >>> 10) + 0xD800)
128
+ + _fromCC((offset & 0x3FF) + 0xDC00));
129
+ case 3:
130
+ return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12)
131
+ | ((0x3f & cccc.charCodeAt(1)) << 6)
132
+ | (0x3f & cccc.charCodeAt(2)));
133
+ default:
134
+ return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6)
135
+ | (0x3f & cccc.charCodeAt(1)));
136
+ }
137
+ };
138
+ /**
139
+ * @deprecated should have been internal use only.
140
+ * @param {string} src UTF-16 string
141
+ * @returns {string} UTF-8 string
142
+ */
143
+ const btou = (b) => b.replace(re_btou, cb_btou);
144
+ /**
145
+ * polyfill version of `atob`
146
+ */
147
+ const atobPolyfill = (asc) => {
148
+ // console.log('polyfilled');
149
+ asc = asc.replace(/\s+/g, '');
150
+ if (!b64re.test(asc))
151
+ throw new TypeError('malformed base64.');
152
+ asc += '=='.slice(2 - (asc.length & 3));
153
+ let u24, bin = '', r1, r2;
154
+ for (let i = 0; i < asc.length;) {
155
+ u24 = b64tab[asc.charAt(i++)] << 18
156
+ | b64tab[asc.charAt(i++)] << 12
157
+ | (r1 = b64tab[asc.charAt(i++)]) << 6
158
+ | (r2 = b64tab[asc.charAt(i++)]);
159
+ bin += r1 === 64 ? _fromCC(u24 >> 16 & 255)
160
+ : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255)
161
+ : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
162
+ }
163
+ return bin;
164
+ };
165
+ /**
166
+ * does what `window.atob` of web browsers do.
167
+ * @param {String} asc Base64-encoded string
168
+ * @returns {string} binary string
169
+ */
170
+ const _atob = _hasatob ? (asc) => atob(_tidyB64(asc))
171
+ : _hasBuffer ? (asc) => Buffer.from(asc, 'base64').toString('binary')
172
+ : atobPolyfill;
173
+ //
174
+ const _toUint8Array = _hasBuffer
175
+ ? (a) => _U8Afrom(Buffer.from(a, 'base64'))
176
+ : (a) => _U8Afrom(_atob(a), c => c.charCodeAt(0));
177
+ //
178
+ const _decode = _hasBuffer
179
+ ? (a) => Buffer.from(a, 'base64').toString('utf8')
180
+ : _TD
181
+ ? (a) => _TD.decode(_toUint8Array(a))
182
+ : (a) => btou(_atob(a));
183
+ const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == '-' ? '+' : '/'));
184
+ /**
185
+ * converts a Base64 string to a UTF-8 string.
186
+ * @param {String} src Base64 string. Both normal and URL-safe are supported
187
+ * @returns {string} UTF-8 string
188
+ */
189
+ const decode = (src) => _decode(_unURI(src));
190
+
191
+ function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r(t)}}function n(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n("Invalid token specified");var o=!0===(r=r||{}).header?0:1;try{return JSON.parse(t(e.split(".")[o]))}catch(e){throw new n("Invalid token specified: "+e.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";
192
+
193
+ /**
194
+ * @description 权限相关操作
195
+ */
196
+ // 获取token
197
+ var getToken = function () {
198
+ try {
199
+ if (window.localStorage.getItem('system-token')) {
200
+ return window.localStorage.getItem('system-token');
201
+ }
202
+ else {
203
+ return false;
204
+ }
205
+ }
206
+ catch (err) {
207
+ return false;
208
+ }
209
+ };
210
+ // 获取refreshToken
211
+ var getRefreshToken = function () {
212
+ try {
213
+ if (window.localStorage.getItem('system-refresh-token')) {
214
+ return window.localStorage.getItem('system-refresh-token');
215
+ }
216
+ else {
217
+ return false;
218
+ }
219
+ }
220
+ catch (err) {
221
+ return false;
222
+ }
223
+ };
224
+ // 获取是否第三方登录
225
+ var getOAuth2 = function () {
226
+ try {
227
+ if (window.localStorage.getItem('system-oauth2')) {
228
+ return window.localStorage.getItem('system-oauth2');
229
+ }
230
+ else {
231
+ return false;
232
+ }
233
+ }
234
+ catch (err) {
235
+ return false;
236
+ }
237
+ };
238
+ // 设置token
239
+ var setToken = function (token) {
240
+ try {
241
+ window.localStorage.setItem('system-token', token);
242
+ }
243
+ catch (err) {
244
+ return false;
245
+ }
246
+ };
247
+ var removeToken = function () {
248
+ try {
249
+ window.localStorage.removeItem('system-token');
250
+ }
251
+ catch (err) {
252
+ return false;
253
+ }
254
+ };
255
+ // 设置refreshToken
256
+ var setRefreshToken = function (token) {
257
+ try {
258
+ window.localStorage.setItem('system-refresh-token', token);
259
+ }
260
+ catch (err) {
261
+ return false;
262
+ }
263
+ };
264
+ var removeRefreshToken = function () {
265
+ try {
266
+ window.localStorage.removeItem('system-refresh-token');
267
+ }
268
+ catch (err) {
269
+ return false;
270
+ }
271
+ };
272
+ // 设置第三方登录
273
+ var setOAuth2 = function () {
274
+ try {
275
+ window.localStorage.setItem('system-oauth2', '1');
276
+ }
277
+ catch (err) {
278
+ return false;
279
+ }
280
+ };
281
+ var removeOAuth2 = function () {
282
+ try {
283
+ window.localStorage.removeItem('system-oauth2');
284
+ }
285
+ catch (err) {
286
+ return false;
287
+ }
288
+ };
289
+ // 对用户名密码进行加密/解密处理
290
+ var aesEncrypt = function (str) {
291
+ return encode(str);
292
+ };
293
+ var aesDecrypt = function (str) {
294
+ if (str) {
295
+ return decode(str);
296
+ }
297
+ else {
298
+ return str;
299
+ }
300
+ };
301
+ /**按钮权限级别 */
302
+ var BTN_AUTHS = {
303
+ add: 'add',
304
+ update: 'update',
305
+ check: 'check',
306
+ detail: 'detail',
307
+ unfreeze: 'unfreeze',
308
+ frozen: 'frozen',
309
+ cancelLation: 'cancelLation',
310
+ cancelSubmit: 'cancelSubmit',
311
+ submitApprove: 'submitApprove', // 提交审核
312
+ };
313
+ /**判断是否有当前按钮的权限 */
314
+ var isBtnAuth = function (userBtns, code) {
315
+ if (typeof code === 'boolean') {
316
+ return code;
317
+ }
318
+ if (!Array.isArray(userBtns)) {
319
+ return false;
320
+ }
321
+ return userBtns.some(function (userBtn) { return (userBtn === null || userBtn === void 0 ? void 0 : userBtn.code) === code; });
322
+ };
323
+ /**设置最后一次访问的路由 */
324
+ var setLastUrlPath = function (pathname) {
325
+ try {
326
+ window.localStorage.setItem('last-url-path', pathname);
327
+ }
328
+ catch (err) {
329
+ return false;
330
+ }
331
+ };
332
+ var getLastUrlPath = function () {
333
+ try {
334
+ if (window.localStorage.getItem('last-url-path')) {
335
+ return window.localStorage.getItem('last-url-path');
336
+ }
337
+ else {
338
+ return false;
339
+ }
340
+ }
341
+ catch (err) {
342
+ return false;
343
+ }
344
+ };
345
+ /**返回是否在乾坤下启动 */
346
+ var isQiankun = function () { return window.__POWERED_BY_QIANKUN__; };
347
+ /** jwt解析 */
348
+ var jwtDecode = function (str) {
349
+ try {
350
+ return o(str);
351
+ }
352
+ catch (err) {
353
+ //
354
+ }
355
+ };
356
+ /**
357
+ * 设置菜单id
358
+ * menuId: 菜单id
359
+ * menuPath:菜单对应的路由
360
+ */
361
+ var setMenuId = function (menuId, menuPath) {
362
+ try {
363
+ window.sessionStorage.setItem('CURRENT_MENU_ID', menuId);
364
+ window.sessionStorage.setItem('CURRENT_MENU_PATH', menuPath);
365
+ }
366
+ catch (err) {
367
+ //
368
+ }
369
+ };
370
+ var getMenuIdInfo = function () {
371
+ var _a, _b, _c;
372
+ var obj = {};
373
+ try {
374
+ var pathname = window.location.pathname;
375
+ obj.CURRENT_MENU_ID = window.sessionStorage.getItem('CURRENT_MENU_ID');
376
+ obj.CURRENT_MENU_PATH = window.sessionStorage.getItem('CURRENT_MENU_PATH');
377
+ if (pathname === obj.CURRENT_MENU_PATH) {
378
+ obj.IS_CURRENT_MENU = true;
379
+ }
380
+ else {
381
+ var firstIndex = (_b = (_a = obj.CURRENT_MENU_PATH) === null || _a === void 0 ? void 0 : _a.indexOf) === null || _b === void 0 ? void 0 : _b.call(_a, ':');
382
+ var resultPathname = obj.CURRENT_MENU_PATH;
383
+ if (firstIndex !== -1) {
384
+ resultPathname = (_c = obj.CURRENT_MENU_PATH) === null || _c === void 0 ? void 0 : _c.substr(0, firstIndex);
385
+ }
386
+ if (pathname.indexOf(resultPathname) !== -1) {
387
+ obj.IS_CURRENT_MENU = true;
388
+ }
389
+ else {
390
+ obj.IS_CURRENT_MENU = false;
391
+ }
392
+ }
393
+ }
394
+ catch (err) {
395
+ //
396
+ }
397
+ return obj;
398
+ };
399
+
400
+ var authority = /*#__PURE__*/Object.freeze({
401
+ __proto__: null,
402
+ getToken: getToken,
403
+ getRefreshToken: getRefreshToken,
404
+ getOAuth2: getOAuth2,
405
+ setToken: setToken,
406
+ removeToken: removeToken,
407
+ setRefreshToken: setRefreshToken,
408
+ removeRefreshToken: removeRefreshToken,
409
+ setOAuth2: setOAuth2,
410
+ removeOAuth2: removeOAuth2,
411
+ aesEncrypt: aesEncrypt,
412
+ aesDecrypt: aesDecrypt,
413
+ BTN_AUTHS: BTN_AUTHS,
414
+ isBtnAuth: isBtnAuth,
415
+ setLastUrlPath: setLastUrlPath,
416
+ getLastUrlPath: getLastUrlPath,
417
+ isQiankun: isQiankun,
418
+ jwtDecode: jwtDecode,
419
+ setMenuId: setMenuId,
420
+ getMenuIdInfo: getMenuIdInfo
421
+ });
422
+
423
+ export { BTN_AUTHS as B, getRefreshToken as a, setRefreshToken as b, authority as c, getOAuth2 as d, removeRefreshToken as e, setOAuth2 as f, getToken as g, removeOAuth2 as h, isQiankun as i, aesEncrypt as j, aesDecrypt as k, isBtnAuth as l, setLastUrlPath as m, getLastUrlPath as n, jwtDecode as o, setMenuId as p, getMenuIdInfo as q, removeToken as r, setToken as s };
@@ -73,4 +73,23 @@ export declare function createOriginalUrl(fileUrl: string, fileId: string, other
73
73
  * @param {string} scale 缩略倍数
74
74
  */
75
75
  export declare function createThumbnailUrl(apiUrl: string, fileId: string, scale: number, otherOption?: any): string;
76
+ /**
77
+ * 附件预览的文件id加密
78
+ * @param fileId
79
+ * @returns
80
+ */
81
+ export declare function encodeFileIdByPreview(fileId: string): string;
82
+ /**
83
+ * 附件预览的文件id加密
84
+ * @param fileId
85
+ * @returns
86
+ */
87
+ export declare function encodeFileIdByDownload(fileId: string): string;
88
+ /**
89
+ * 附件预览的文件id加密。加密后只encode一次
90
+ * 用在那些通过body传参的业务里
91
+ * @param fileId
92
+ * @returns
93
+ */
94
+ export declare function encodeOneFileIdByDownload(fileId: string): string;
76
95
  export {};
@@ -11,7 +11,7 @@ import 'crypto';
11
11
  */
12
12
  function downloadFile(apiUrl, fileId, fileName, otherOption) {
13
13
  // 给附件id加密
14
- fileId = encodeURIComponent(crypto.encrypt(fileId));
14
+ fileId = encodeFileIdByDownload(fileId);
15
15
  var xhr = new XMLHttpRequest();
16
16
  var token = '';
17
17
  var addWaterMark = 'true';
@@ -27,7 +27,10 @@ function downloadFile(apiUrl, fileId, fileName, otherOption) {
27
27
  var _apiUrl = apiUrl.endsWith('/')
28
28
  ? apiUrl.slice(0, apiUrl.length - 1)
29
29
  : apiUrl;
30
- xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + addWaterMark, true);
30
+ var isLegalWaterMark = typeof addWaterMark === 'boolean' ||
31
+ addWaterMark === 'true' ||
32
+ addWaterMark === 'false';
33
+ xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + (isLegalWaterMark ? addWaterMark : true), true);
31
34
  xhr.responseType = 'blob';
32
35
  xhr.onload = function () {
33
36
  if (xhr.status === 200 || xhr.status === 201) {
@@ -47,14 +50,17 @@ function downloadFile(apiUrl, fileId, fileName, otherOption) {
47
50
  }
48
51
  function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
49
52
  // 给附件id加密
50
- fileId = encodeURIComponent(crypto.encrypt(fileId));
53
+ fileId = encodeFileIdByDownload(fileId);
51
54
  var _a = otherOption || {}, authToken = _a.authToken, callbackAfter = _a.callbackAfter, callbackError = _a.callbackError, _b = _a.addWaterMark, addWaterMark = _b === void 0 ? true : _b;
52
55
  var xhr = new XMLHttpRequest();
53
56
  var token = getToken() || authToken;
54
57
  var _apiUrl = apiUrl.endsWith('/')
55
58
  ? apiUrl.slice(0, apiUrl.length - 1)
56
59
  : apiUrl;
57
- xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + addWaterMark, true);
60
+ var isLegalWaterMark = typeof addWaterMark === 'boolean' ||
61
+ addWaterMark === 'true' ||
62
+ addWaterMark === 'false';
63
+ xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + (isLegalWaterMark ? addWaterMark : true), true);
58
64
  xhr.responseType = 'blob';
59
65
  xhr.onload = function () {
60
66
  if (xhr.status === 200 || xhr.status === 201) {
@@ -84,7 +90,7 @@ function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
84
90
  */
85
91
  function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
86
92
  // 给附件id加密
87
- fileIds = encodeURIComponent(crypto.encrypt(fileIds));
93
+ fileIds = encodeFileIdByDownload(fileIds);
88
94
  var _a = otherOption || {}, authToken = _a.authToken, zipName = _a.zipName, _b = _a.addWaterMark, addWaterMark = _b === void 0 ? true : _b, callbackAfter = _a.callbackAfter, callbackError = _a.callbackError;
89
95
  var xhr = new XMLHttpRequest();
90
96
  var token = getToken() || authToken;
@@ -116,7 +122,14 @@ function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
116
122
  };
117
123
  xhr.setRequestHeader('Zmdms-Auth', token || '');
118
124
  xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
119
- xhr.send("attachIds=" + fileIds + "&fileNames=" + fileNames + "&zipName=" + zipName + "&addWaterMark=" + addWaterMark);
125
+ var isLegalWaterMark = typeof addWaterMark === 'boolean' ||
126
+ addWaterMark === 'true' ||
127
+ addWaterMark === 'false';
128
+ // 不传附件名
129
+ xhr.send("attachIds=" + fileIds + "&zipName=" + zipName + "&addWaterMark=" + (isLegalWaterMark ? addWaterMark : true));
130
+ // xhr.send(
131
+ // `attachIds=${fileIds}&fileNames=${fileNames}&zipName=${zipName}&addWaterMark=${addWaterMark}`
132
+ // );
120
133
  }
121
134
  /**
122
135
  * @description 公共文件下载,并重命名
@@ -126,7 +139,7 @@ function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
126
139
  */
127
140
  function downloadPublicFile(apiUrl, fileId, fileName, otherOption) {
128
141
  // 给附件id加密
129
- fileId = encodeURIComponent(crypto.encrypt(fileId));
142
+ // fileId = encodeURIComponent(crypto.encrypt(fileId));
130
143
  var _a = otherOption || {}, callbackAfter = _a.callbackAfter, callbackError = _a.callbackError;
131
144
  var xhr = new XMLHttpRequest();
132
145
  var _apiUrl = apiUrl.endsWith('/')
@@ -164,7 +177,8 @@ function downloadPublicFile(apiUrl, fileId, fileName, otherOption) {
164
177
  */
165
178
  function createDownloadUrl(apiUrl, fileId, authToken) {
166
179
  // 给附件id加密
167
- fileId = encodeURIComponent(crypto.encrypt(fileId));
180
+ // fileId = encodeURIComponent(crypto.encrypt(fileId));
181
+ fileId = encodeFileIdByDownload(fileId);
168
182
  var token = getToken() || authToken;
169
183
  var _apiUrl = apiUrl.endsWith('/')
170
184
  ? apiUrl.slice(0, apiUrl.length - 1)
@@ -178,7 +192,8 @@ function createDownloadUrl(apiUrl, fileId, authToken) {
178
192
  */
179
193
  function createDownloadUrlNoBase(fileId, authToken) {
180
194
  // 给附件id加密
181
- fileId = encodeURIComponent(crypto.encrypt(fileId));
195
+ // fileId = encodeURIComponent(crypto.encrypt(fileId));
196
+ fileId = encodeFileIdByDownload(fileId);
182
197
  var token = getToken() || authToken;
183
198
  return "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token;
184
199
  }
@@ -189,7 +204,7 @@ function createDownloadUrlNoBase(fileId, authToken) {
189
204
  */
190
205
  function createPublicDownloadUrl(apiUrl, fileId) {
191
206
  // 给附件id加密
192
- fileId = encodeURIComponent(crypto.encrypt(fileId));
207
+ // fileId = encodeURIComponent(crypto.encrypt(fileId));
193
208
  var _apiUrl = apiUrl.endsWith('/')
194
209
  ? apiUrl.slice(0, apiUrl.length - 1)
195
210
  : apiUrl;
@@ -203,8 +218,9 @@ function createPublicDownloadUrl(apiUrl, fileId) {
203
218
  * @param {string} fileName 文件名
204
219
  */
205
220
  function previewFile(fileUrl, fileId, otherOption) {
221
+ var preFileId = fileId;
206
222
  // 给附件id加密
207
- fileId = encodeURIComponent(crypto.encrypt(fileId));
223
+ fileId = encodeFileIdByPreview(fileId);
208
224
  var token = '';
209
225
  if (typeof otherOption === 'object') {
210
226
  token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authToken);
@@ -224,7 +240,7 @@ function previewFile(fileUrl, fileId, otherOption) {
224
240
  : fileUrl;
225
241
  if (titleName) {
226
242
  var lastPointIndex = titleName.lastIndexOf('.');
227
- var preTitleName = titleName.substring(0, lastPointIndex) + ("-" + fileId);
243
+ var preTitleName = titleName.substring(0, lastPointIndex) + ("-" + preFileId);
228
244
  var suffixTitleName = titleName.substring(lastPointIndex + 1);
229
245
  titleName = suffixTitleName
230
246
  ? preTitleName + "." + suffixTitleName
@@ -244,7 +260,7 @@ function previewFile(fileUrl, fileId, otherOption) {
244
260
  */
245
261
  function batchPreviewFile(fileUrl, fileId, otherOption) {
246
262
  // 给附件id加密
247
- fileId = encodeURIComponent(crypto.encrypt(fileId));
263
+ fileId = encodeFileIdByPreview(fileId);
248
264
  var token = '';
249
265
  if (typeof otherOption === 'object') {
250
266
  token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authToken);
@@ -276,8 +292,9 @@ function batchPreviewFile(fileUrl, fileId, otherOption) {
276
292
  * @param {string} fileType 文件类型
277
293
  */
278
294
  function createOriginalUrl(fileUrl, fileId, otherOption) {
295
+ var preFileId = fileId;
279
296
  // 给附件id加密
280
- fileId = encodeURIComponent(crypto.encrypt(fileId));
297
+ fileId = encodeFileIdByPreview(fileId);
281
298
  var token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authTOken);
282
299
  var titleName = dangerouslySetXss(otherOption === null || otherOption === void 0 ? void 0 : otherOption.titleName);
283
300
  try {
@@ -291,7 +308,7 @@ function createOriginalUrl(fileUrl, fileId, otherOption) {
291
308
  : fileUrl;
292
309
  if (titleName) {
293
310
  var lastPointIndex = titleName.lastIndexOf('.');
294
- var preTitleName = titleName.substring(0, lastPointIndex) + ("-" + fileId);
311
+ var preTitleName = titleName.substring(0, lastPointIndex) + ("-" + preFileId);
295
312
  var suffixTitleName = titleName.substring(lastPointIndex + 1);
296
313
  titleName = suffixTitleName
297
314
  ? preTitleName + "." + suffixTitleName
@@ -314,6 +331,31 @@ function createThumbnailUrl(apiUrl, fileId, scale, otherOption) {
314
331
  : apiUrl;
315
332
  var token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authTOken);
316
333
  return _apiUrl + "/api/zmdms-resource/oss/endpoint/thumbnail/" + fileId + "?scale=" + scale + "&Zmdms-Auth=bearer " + token;
334
+ }
335
+ /**
336
+ * 附件预览的文件id加密
337
+ * @param fileId
338
+ * @returns
339
+ */
340
+ function encodeFileIdByPreview(fileId) {
341
+ return encodeURIComponent(crypto.encrypt(fileId));
342
+ }
343
+ /**
344
+ * 附件预览的文件id加密
345
+ * @param fileId
346
+ * @returns
347
+ */
348
+ function encodeFileIdByDownload(fileId) {
349
+ return encodeURIComponent(encodeURIComponent(crypto.encrypt(fileId)));
350
+ }
351
+ /**
352
+ * 附件预览的文件id加密。加密后只encode一次
353
+ * 用在那些通过body传参的业务里
354
+ * @param fileId
355
+ * @returns
356
+ */
357
+ function encodeOneFileIdByDownload(fileId) {
358
+ return encodeURIComponent(crypto.encrypt(fileId));
317
359
  }
318
360
 
319
- export { batchDownloadFileCallBack, batchPreviewFile, createDownloadUrl, createDownloadUrlNoBase, createOriginalUrl, createPublicDownloadUrl, createThumbnailUrl, downloadFile, downloadFileCallBack, downloadPublicFile, previewFile };
361
+ export { batchDownloadFileCallBack, batchPreviewFile, createDownloadUrl, createDownloadUrlNoBase, createOriginalUrl, createPublicDownloadUrl, createThumbnailUrl, downloadFile, downloadFileCallBack, downloadPublicFile, encodeFileIdByDownload, encodeFileIdByPreview, encodeOneFileIdByDownload, previewFile };
@@ -0,0 +1,2 @@
1
+ import i18next from 'i18next';
2
+ export default i18next;