zmdms-utils 0.0.74 → 0.0.75

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 (84) hide show
  1. package/package.json +1 -1
  2. package/publish.py +12 -0
  3. package/src/locales/i18n.ts +18 -18
  4. package/src/locales/index.ts +8 -8
  5. package/src/locales/t-in-non-react.ts +65 -65
  6. package/src/locales/t-options.ts +24 -24
  7. package/src/locales/use-translation.ts +76 -76
  8. package/src/math.ts +6 -1
  9. package/dist/es/_virtual/_commonjsHelpers.js +0 -3
  10. package/dist/es/_virtual/_tslib.js +0 -87
  11. package/dist/es/_virtual/decimal.js +0 -7
  12. package/dist/es/_virtual/parseTimeTest.js +0 -3
  13. package/dist/es/_virtual/test.js +0 -3
  14. package/dist/es/auth.d.ts +0 -9
  15. package/dist/es/auth.js +0 -49
  16. package/dist/es/baseUrl.d.ts +0 -23
  17. package/dist/es/baseUrl.js +0 -50
  18. package/dist/es/canvas.d.ts +0 -6
  19. package/dist/es/canvas.js +0 -14
  20. package/dist/es/common.d.ts +0 -81
  21. package/dist/es/common.js +0 -304
  22. package/dist/es/constants.d.ts +0 -20
  23. package/dist/es/constants.js +0 -33
  24. package/dist/es/crypto.d.ts +0 -51
  25. package/dist/es/crypto.js +0 -97
  26. package/dist/es/file.d.ts +0 -127
  27. package/dist/es/file.js +0 -373
  28. package/dist/es/htmlToPdf.d.ts +0 -44
  29. package/dist/es/htmlToPdf.js +0 -84
  30. package/dist/es/locales/i18n.d.ts +0 -15
  31. package/dist/es/locales/t-in-non-react.d.ts +0 -17
  32. package/dist/es/locales/t-options.d.ts +0 -7
  33. package/dist/es/locales/use-translation.d.ts +0 -42
  34. package/dist/es/mainApp.d.ts +0 -36
  35. package/dist/es/mainApp.js +0 -44
  36. package/dist/es/math.d.ts +0 -29
  37. package/dist/es/math.js +0 -142
  38. package/dist/es/microAppCreator.d.ts +0 -46
  39. package/dist/es/microAppCreator.js +0 -89
  40. package/dist/es/node_modules/decimal.js/decimal.js +0 -4896
  41. package/dist/es/node_modules/decimal.js/decimal2.js +0 -4930
  42. package/dist/es/node_modules/html-parse-stringify/dist/html-parse-stringify.module.js +0 -5
  43. package/dist/es/node_modules/i18next/dist/esm/i18next.js +0 -2242
  44. package/dist/es/node_modules/js-base64/base64.js +0 -273
  45. package/dist/es/node_modules/jwt-decode/build/jwt-decode.esm.js +0 -3
  46. package/dist/es/node_modules/mitt/dist/mitt.js +0 -3
  47. package/dist/es/node_modules/pinyin-pro/dist/index.js +0 -12627
  48. package/dist/es/node_modules/react-i18next/dist/es/Trans.js +0 -47
  49. package/dist/es/node_modules/react-i18next/dist/es/TransWithoutContext.js +0 -312
  50. package/dist/es/node_modules/react-i18next/dist/es/context.js +0 -18
  51. package/dist/es/node_modules/react-i18next/dist/es/defaults.js +0 -21
  52. package/dist/es/node_modules/react-i18next/dist/es/i18nInstance.js +0 -7
  53. package/dist/es/node_modules/react-i18next/dist/es/initReactI18next.js +0 -12
  54. package/dist/es/node_modules/react-i18next/dist/es/unescape.js +0 -27
  55. package/dist/es/node_modules/react-i18next/dist/es/useTranslation.js +0 -112
  56. package/dist/es/node_modules/react-i18next/dist/es/utils.js +0 -63
  57. package/dist/es/node_modules/void-elements/index.js +0 -23
  58. package/dist/es/parseTime.d.ts +0 -29
  59. package/dist/es/parseTime.js +0 -189
  60. package/dist/es/parseTimeTest.js +0 -2
  61. package/dist/es/passwordValidate.d.ts +0 -9
  62. package/dist/es/passwordValidate.js +0 -169
  63. package/dist/es/pdf.d.ts +0 -49
  64. package/dist/es/pdf.js +0 -176
  65. package/dist/es/pinyin.js +0 -1
  66. package/dist/es/print.d.ts +0 -23
  67. package/dist/es/print.js +0 -43
  68. package/dist/es/qiankunUtils.d.ts +0 -13
  69. package/dist/es/qiankunUtils.js +0 -32
  70. package/dist/es/request.d.ts +0 -87
  71. package/dist/es/request.js +0 -308
  72. package/dist/es/src/locales/i18n.js +0 -16
  73. package/dist/es/src/locales/t-in-non-react.js +0 -54
  74. package/dist/es/src/locales/t-options.js +0 -20
  75. package/dist/es/src/locales/use-translation.js +0 -60
  76. package/dist/es/src/parseTimeTest.js +0 -288
  77. package/dist/es/src/test.js +0 -245
  78. package/dist/es/test.js +0 -2
  79. package/dist/es/validate.d.ts +0 -26
  80. package/dist/es/validate.js +0 -47
  81. package/dist/es/water.d.ts +0 -53
  82. package/dist/es/water.js +0 -88
  83. package/dist/index.d.ts +0 -26
  84. package/dist/index.js +0 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-utils",
3
- "version": "0.0.74",
3
+ "version": "0.0.75",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/publish.py ADDED
@@ -0,0 +1,12 @@
1
+ import os
2
+
3
+ os.system('yarn')
4
+ os.system('npm config set registry https://registry.npmjs.org')
5
+ os.system('yarn config set registry https://registry.yarnpkg.com')
6
+ os.system('npm config set proxy http://127.0.0.1:7890')
7
+ os.system('yarn build')
8
+ os.system('npm publish')
9
+ os.system('npm config set registry https://registry.npmmirror.com')
10
+ os.system('yarn config set registry https://registry.npmmirror.com')
11
+ os.system('npm config rm proxy')
12
+
@@ -1,18 +1,18 @@
1
- import i18next from "i18next";
2
- import { initReactI18next } from "react-i18next";
3
-
4
- type InitOptions = Parameters<typeof i18next.init>;
5
-
6
- /**
7
- * 初始化逻辑
8
- * - 本函数主要用于初始化 i18next 实例,同时使用 react-i18next 插件进行 react 组件的支持
9
- * - 本函数的调用时机,一般是在项目的入口文件中进行调用,如 src/main.tsx 中
10
- * @param options 参数 同i18next.init 第一个参数
11
- * @param callback 参数 同i18next.init 第二个参数
12
- * @returns
13
- */
14
- function initLocale(options: InitOptions[0], callback?: InitOptions[1]) {
15
- return i18next.use(initReactI18next).init(options, callback);
16
- }
17
-
18
- export { initLocale, i18next as i18n };
1
+ import i18next from "i18next";
2
+ import { initReactI18next } from "react-i18next";
3
+
4
+ type InitOptions = Parameters<typeof i18next.init>;
5
+
6
+ /**
7
+ * 初始化逻辑
8
+ * - 本函数主要用于初始化 i18next 实例,同时使用 react-i18next 插件进行 react 组件的支持
9
+ * - 本函数的调用时机,一般是在项目的入口文件中进行调用,如 src/main.tsx 中
10
+ * @param options 参数 同i18next.init 第一个参数
11
+ * @param callback 参数 同i18next.init 第二个参数
12
+ * @returns
13
+ */
14
+ function initLocale(options: InitOptions[0], callback?: InitOptions[1]) {
15
+ return i18next.use(initReactI18next).init(options, callback);
16
+ }
17
+
18
+ export { initLocale, i18next as i18n };
@@ -1,8 +1,8 @@
1
- // i18n实例 及 初始化方法
2
- export { i18n, initLocale } from "./i18n";
3
-
4
- // 代理的 useTranslation 函数
5
- export { useTranslation, Trans } from "./use-translation";
6
-
7
- // 导出 t 函数(应对在非 react 组件环境下进行使用的场景)
8
- export { safeT } from "./t-in-non-react";
1
+ // i18n实例 及 初始化方法
2
+ export { i18n, initLocale } from "./i18n";
3
+
4
+ // 代理的 useTranslation 函数
5
+ export { useTranslation, Trans } from "./use-translation";
6
+
7
+ // 导出 t 函数(应对在非 react 组件环境下进行使用的场景)
8
+ export { safeT } from "./t-in-non-react";
@@ -1,65 +1,65 @@
1
- /**
2
- * t 函数封装:
3
- * - 本文件的几个 t 函数,主要用于弥补一些在 React 组件之外使用的场景
4
- * - 常规情况下,在 react 组件中,更加推荐的是使用 react-i18next 包中的 t 函数,即 const { t } = useTranslate(); 形式
5
- */
6
- import { i18n } from "./i18n";
7
- import type { TOpionsEx } from "./t-options";
8
- import { getTFuncArgs } from "./t-options";
9
-
10
- /** 包裹一层 try-catch 的 t 函数 */
11
- const tryT = (
12
- key: string,
13
- defaultValueOrOptions: string | TOpionsEx
14
- ): string => {
15
- const { defaultValue, options } = getTFuncArgs(defaultValueOrOptions);
16
- if (!key) {
17
- // 情况1:键名为空,返回默认值或键名
18
- console.error(
19
- `tryT: 请不要传入空 key 值进行 i18n.t 函数执行,这将会导致直接返回空字符串!`
20
- );
21
- return defaultValue || key;
22
- }
23
- if (!i18n.exists(key)) {
24
- // 情况2:键名不存在,返回默认值或键名
25
- console.error(
26
- `tryT: i18n-key '${key}' 不存在,请检查对应的 @/locales/resources/locales/xx.json 中是否存在对应值`
27
- );
28
- return defaultValue || key;
29
- }
30
- try {
31
- // 情况3:尝试执行 i18n.t 函数
32
- return i18n.t(key, options);
33
- } catch (err) {
34
- // 情况4:执行 i18n.t 函数异常,返回默认值或键名
35
- console.error(`tryT: i18n.t key=${key} 函数执行异常:err=`, err);
36
- return defaultValue || key;
37
- }
38
- };
39
-
40
- /**
41
- * 同步版本的 i18n.t 函数(应对在 react 组件外使用的翻译函数)
42
- * - 如果 i18n 未初始化,则返回默认值或键名
43
- * - 如果 i18n 初始化后,键名不存在,则返回默认值或键名
44
- * - 其他正常情况(已经初始化+键名存在),则返回翻译值
45
- * @description 本函数为在非 react 组件中使用的翻译函数;(在react中请求使用 useTranslate() 返回的 t 函数)
46
- * @param {string} key
47
- * @param {TOpionsEx|string} defaultValue 必填值
48
- * @returns {string}
49
- * @example
50
- * const txt = t('someLocaleKey', '兜底默认值');
51
- */
52
- export function safeT(
53
- key: string,
54
- defaultValueOrOptions: string | TOpionsEx
55
- ): string {
56
- if (i18n.isInitialized) {
57
- return tryT(key, defaultValueOrOptions);
58
- }
59
- // 异常情况:没有初始化完成时,返回默认值
60
- const { defaultValue } = getTFuncArgs(defaultValueOrOptions);
61
- console.warn(
62
- `safeT: i18n is not initialized. Returning defaultValue(${defaultValue}) or origin key (${key}).`
63
- );
64
- return defaultValue || key;
65
- }
1
+ /**
2
+ * t 函数封装:
3
+ * - 本文件的几个 t 函数,主要用于弥补一些在 React 组件之外使用的场景
4
+ * - 常规情况下,在 react 组件中,更加推荐的是使用 react-i18next 包中的 t 函数,即 const { t } = useTranslate(); 形式
5
+ */
6
+ import { i18n } from "./i18n";
7
+ import type { TOpionsEx } from "./t-options";
8
+ import { getTFuncArgs } from "./t-options";
9
+
10
+ /** 包裹一层 try-catch 的 t 函数 */
11
+ const tryT = (
12
+ key: string,
13
+ defaultValueOrOptions: string | TOpionsEx
14
+ ): string => {
15
+ const { defaultValue, options } = getTFuncArgs(defaultValueOrOptions);
16
+ if (!key) {
17
+ // 情况1:键名为空,返回默认值或键名
18
+ console.error(
19
+ `tryT: 请不要传入空 key 值进行 i18n.t 函数执行,这将会导致直接返回空字符串!`
20
+ );
21
+ return defaultValue || key;
22
+ }
23
+ if (!i18n.exists(key)) {
24
+ // 情况2:键名不存在,返回默认值或键名
25
+ console.error(
26
+ `tryT: i18n-key '${key}' 不存在,请检查对应的 @/locales/resources/locales/xx.json 中是否存在对应值`
27
+ );
28
+ return defaultValue || key;
29
+ }
30
+ try {
31
+ // 情况3:尝试执行 i18n.t 函数
32
+ return i18n.t(key, options);
33
+ } catch (err) {
34
+ // 情况4:执行 i18n.t 函数异常,返回默认值或键名
35
+ console.error(`tryT: i18n.t key=${key} 函数执行异常:err=`, err);
36
+ return defaultValue || key;
37
+ }
38
+ };
39
+
40
+ /**
41
+ * 同步版本的 i18n.t 函数(应对在 react 组件外使用的翻译函数)
42
+ * - 如果 i18n 未初始化,则返回默认值或键名
43
+ * - 如果 i18n 初始化后,键名不存在,则返回默认值或键名
44
+ * - 其他正常情况(已经初始化+键名存在),则返回翻译值
45
+ * @description 本函数为在非 react 组件中使用的翻译函数;(在react中请求使用 useTranslate() 返回的 t 函数)
46
+ * @param {string} key
47
+ * @param {TOpionsEx|string} defaultValue 必填值
48
+ * @returns {string}
49
+ * @example
50
+ * const txt = t('someLocaleKey', '兜底默认值');
51
+ */
52
+ export function safeT(
53
+ key: string,
54
+ defaultValueOrOptions: string | TOpionsEx
55
+ ): string {
56
+ if (i18n.isInitialized) {
57
+ return tryT(key, defaultValueOrOptions);
58
+ }
59
+ // 异常情况:没有初始化完成时,返回默认值
60
+ const { defaultValue } = getTFuncArgs(defaultValueOrOptions);
61
+ console.warn(
62
+ `safeT: i18n is not initialized. Returning defaultValue(${defaultValue}) or origin key (${key}).`
63
+ );
64
+ return defaultValue || key;
65
+ }
@@ -1,24 +1,24 @@
1
- "use strict";
2
- import type { TOptions } from "i18next";
3
-
4
- export interface TOpionsEx extends TOptions {
5
- defaultValue: string; // 必须填值
6
- }
7
-
8
- /**
9
- * 获取 t 函数的参数
10
- * @param {string | TOpionsEx} defaultValueOrOptions 默认值或者选项
11
- * @returns { {defaultValue: string, options: TOpionsEx} } 默认值和选项
12
- */
13
- export function getTFuncArgs(defaultValueOrOptions: string | TOpionsEx) {
14
- let options: TOpionsEx | null = null;
15
- let defaultValue = "";
16
- if (typeof defaultValueOrOptions === "string") {
17
- defaultValue = defaultValueOrOptions;
18
- options = { defaultValue };
19
- } else {
20
- options = defaultValueOrOptions;
21
- defaultValue = options.defaultValue;
22
- }
23
- return { defaultValue, options };
24
- }
1
+ "use strict";
2
+ import type { TOptions } from "i18next";
3
+
4
+ export interface TOpionsEx extends TOptions {
5
+ defaultValue: string; // 必须填值
6
+ }
7
+
8
+ /**
9
+ * 获取 t 函数的参数
10
+ * @param {string | TOpionsEx} defaultValueOrOptions 默认值或者选项
11
+ * @returns { {defaultValue: string, options: TOpionsEx} } 默认值和选项
12
+ */
13
+ export function getTFuncArgs(defaultValueOrOptions: string | TOpionsEx) {
14
+ let options: TOpionsEx | null = null;
15
+ let defaultValue = "";
16
+ if (typeof defaultValueOrOptions === "string") {
17
+ defaultValue = defaultValueOrOptions;
18
+ options = { defaultValue };
19
+ } else {
20
+ options = defaultValueOrOptions;
21
+ defaultValue = options.defaultValue;
22
+ }
23
+ return { defaultValue, options };
24
+ }
@@ -1,76 +1,76 @@
1
- import { useTranslation, Trans } from "react-i18next";
2
- import type { TOpionsEx } from "./t-options";
3
- import { getTFuncArgs } from "./t-options";
4
-
5
- type Prams = Parameters<typeof useTranslation>;
6
- type NS = Prams[0];
7
- type Options = Prams[1];
8
-
9
- type EnhanceTFunc = (
10
- key: string,
11
- defaultValueOrOptions: string | TOpionsEx
12
- ) => string;
13
-
14
- /**
15
- * 这里只是简单代理一下useTranslation,方便后续扩展或添加其他逻辑
16
- * @param ns 命名空间 大多数情况下都不需要传入这个参数,除非你用到了命名空间。
17
- * @param options 其他参数 大多数情况下,都不需要关注这个参数。
18
- * options.keyPrefix 为所有翻译键添加前缀
19
- * // JSON 文件:{ "greeting": { "welcome": "Welcome" } }
20
- * const { t } = useTranslation('common', { keyPrefix: 'greeting' });
21
- * // 使用时省略前缀
22
- * t('welcome'); // 等价于 t('greeting:welcome')
23
- * @returns { t, i18n, ready }
24
- * t: 翻译方法
25
- * i18n: i18next实例 访问 i18next 的完整 API(如切换语言、加载命名空间)
26
- * i18n.changeLanguage('zh-CN'); 使用它切换语言,可以触发组件渲染。但是当前项目中是使用全局刷新的模式,来更新语言的。
27
- * ready: 是否加载完成
28
- */
29
- function useZtTranslation(ns?: NS, options?: Options) {
30
- const { t: _tOld, i18n, ready } = useTranslation(ns, options);
31
-
32
- // 扩展t方法,用于处理嵌套的翻译键
33
- const tEnhance: EnhanceTFunc = (key, defaultValueOrOptions) => {
34
- const { defaultValue, options } = getTFuncArgs(defaultValueOrOptions);
35
-
36
- if (!key) {
37
- // 情况1:键名为空,返回默认值或键名
38
- console.error(
39
- `tEnhance: 请不要传入空 key 值进行 t 函数执行,这将会导致直接返回空字符串!`
40
- );
41
- return defaultValue || key;
42
- }
43
- if (!i18n.exists(key)) {
44
- // 情况2:键名不存在,返回默认值或键名
45
- console.error(
46
- `tEnhance: i18n-key '${key}' 不存在,请检查对应的 @/locales/resources/locales/xx.json 中是否存在对应值`
47
- );
48
- return defaultValue || key;
49
- }
50
- try {
51
- return _tOld(key, options);
52
- } catch (error) {
53
- console.warn(`tEnhance: t 函数执行异常,请检查! key=${key}, err=`, error);
54
- return defaultValue || key || "unknown";
55
- }
56
- };
57
-
58
- return {
59
- /**
60
- * t函数的使用方式:基本上使用1、2两种方式就可以了。
61
- * 1、t('key') // 基础用法
62
- * 2、t('greeting', { name: 'John' }); // 对应 JSON: "greeting": "Hello {{name}}"
63
- * 3、t('auth:login'); // 显式指定命名空间
64
- *
65
- * 关于t函数的第二个参数的说明。
66
- * 为了防止一些异常情况,翻译失败。可以传入一个默认值。这个默认值就是原本的中文就行。
67
- * 1、t('key', '默认值');
68
- * 2、t('key', { defaultValue: '默认值', ...otherOptions });
69
- */
70
- t: tEnhance,
71
- i18n,
72
- ready,
73
- };
74
- }
75
-
76
- export { useZtTranslation as useTranslation, Trans };
1
+ import { useTranslation, Trans } from "react-i18next";
2
+ import type { TOpionsEx } from "./t-options";
3
+ import { getTFuncArgs } from "./t-options";
4
+
5
+ type Prams = Parameters<typeof useTranslation>;
6
+ type NS = Prams[0];
7
+ type Options = Prams[1];
8
+
9
+ type EnhanceTFunc = (
10
+ key: string,
11
+ defaultValueOrOptions: string | TOpionsEx
12
+ ) => string;
13
+
14
+ /**
15
+ * 这里只是简单代理一下useTranslation,方便后续扩展或添加其他逻辑
16
+ * @param ns 命名空间 大多数情况下都不需要传入这个参数,除非你用到了命名空间。
17
+ * @param options 其他参数 大多数情况下,都不需要关注这个参数。
18
+ * options.keyPrefix 为所有翻译键添加前缀
19
+ * // JSON 文件:{ "greeting": { "welcome": "Welcome" } }
20
+ * const { t } = useTranslation('common', { keyPrefix: 'greeting' });
21
+ * // 使用时省略前缀
22
+ * t('welcome'); // 等价于 t('greeting:welcome')
23
+ * @returns { t, i18n, ready }
24
+ * t: 翻译方法
25
+ * i18n: i18next实例 访问 i18next 的完整 API(如切换语言、加载命名空间)
26
+ * i18n.changeLanguage('zh-CN'); 使用它切换语言,可以触发组件渲染。但是当前项目中是使用全局刷新的模式,来更新语言的。
27
+ * ready: 是否加载完成
28
+ */
29
+ function useZtTranslation(ns?: NS, options?: Options) {
30
+ const { t: _tOld, i18n, ready } = useTranslation(ns, options);
31
+
32
+ // 扩展t方法,用于处理嵌套的翻译键
33
+ const tEnhance: EnhanceTFunc = (key, defaultValueOrOptions) => {
34
+ const { defaultValue, options } = getTFuncArgs(defaultValueOrOptions);
35
+
36
+ if (!key) {
37
+ // 情况1:键名为空,返回默认值或键名
38
+ console.error(
39
+ `tEnhance: 请不要传入空 key 值进行 t 函数执行,这将会导致直接返回空字符串!`
40
+ );
41
+ return defaultValue || key;
42
+ }
43
+ if (!i18n.exists(key)) {
44
+ // 情况2:键名不存在,返回默认值或键名
45
+ console.error(
46
+ `tEnhance: i18n-key '${key}' 不存在,请检查对应的 @/locales/resources/locales/xx.json 中是否存在对应值`
47
+ );
48
+ return defaultValue || key;
49
+ }
50
+ try {
51
+ return _tOld(key, options);
52
+ } catch (error) {
53
+ console.warn(`tEnhance: t 函数执行异常,请检查! key=${key}, err=`, error);
54
+ return defaultValue || key || "unknown";
55
+ }
56
+ };
57
+
58
+ return {
59
+ /**
60
+ * t函数的使用方式:基本上使用1、2两种方式就可以了。
61
+ * 1、t('key') // 基础用法
62
+ * 2、t('greeting', { name: 'John' }); // 对应 JSON: "greeting": "Hello {{name}}"
63
+ * 3、t('auth:login'); // 显式指定命名空间
64
+ *
65
+ * 关于t函数的第二个参数的说明。
66
+ * 为了防止一些异常情况,翻译失败。可以传入一个默认值。这个默认值就是原本的中文就行。
67
+ * 1、t('key', '默认值');
68
+ * 2、t('key', { defaultValue: '默认值', ...otherOptions });
69
+ */
70
+ t: tEnhance,
71
+ i18n,
72
+ ready,
73
+ };
74
+ }
75
+
76
+ export { useZtTranslation as useTranslation, Trans };
package/src/math.ts CHANGED
@@ -113,7 +113,12 @@ export function exactRound(num: numType, ratio: number) {
113
113
  return 0;
114
114
  // return (0).toFixed(ratio);
115
115
  }
116
- return new Decimal(num).toFixed(ratio);
116
+ let value = new Decimal(num).toFixed(ratio);
117
+ // 设置exactRound去掉小数位后面的0
118
+ if ((window as any).__EXACT_ROUND_TYPE__ === "TRIM_ZEROS") {
119
+ value = Number(value);
120
+ }
121
+ return value;
117
122
  // return Number(num).toFixed(ratio);
118
123
  } catch (err) {
119
124
  return num;
@@ -1,3 +0,0 @@
1
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
-
3
- export { commonjsGlobal };
@@ -1,87 +0,0 @@
1
- /******************************************************************************
2
- Copyright (c) Microsoft Corporation.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
-
16
- var __assign = function() {
17
- __assign = Object.assign || function __assign(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
-
27
- function __rest(s, e) {
28
- var t = {};
29
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
30
- t[p] = s[p];
31
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
32
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
34
- t[p[i]] = s[p[i]];
35
- }
36
- return t;
37
- }
38
-
39
- function __awaiter(thisArg, _arguments, P, generator) {
40
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41
- return new (P || (P = Promise))(function (resolve, reject) {
42
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
43
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
44
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
45
- step((generator = generator.apply(thisArg, _arguments || [])).next());
46
- });
47
- }
48
-
49
- function __generator(thisArg, body) {
50
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
51
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
52
- function verb(n) { return function (v) { return step([n, v]); }; }
53
- function step(op) {
54
- if (f) throw new TypeError("Generator is already executing.");
55
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
56
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
57
- if (y = 0, t) op = [op[0] & 2, t.value];
58
- switch (op[0]) {
59
- case 0: case 1: t = op; break;
60
- case 4: _.label++; return { value: op[1], done: false };
61
- case 5: _.label++; y = op[1]; op = [0]; continue;
62
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
63
- default:
64
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
65
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
66
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
67
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
68
- if (t[2]) _.ops.pop();
69
- _.trys.pop(); continue;
70
- }
71
- op = body.call(thisArg, _);
72
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
73
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
74
- }
75
- }
76
-
77
- function __spreadArray(to, from, pack) {
78
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
79
- if (ar || !(i in from)) {
80
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
81
- ar[i] = from[i];
82
- }
83
- }
84
- return to.concat(ar || Array.prototype.slice.call(from));
85
- }
86
-
87
- export { __assign, __awaiter, __generator, __rest, __spreadArray };
@@ -1,7 +0,0 @@
1
- var decimalExports = {};
2
- var decimal = {
3
- get exports(){ return decimalExports; },
4
- set exports(v){ decimalExports = v; },
5
- };
6
-
7
- export { decimal as __module, decimalExports as exports };
@@ -1,3 +0,0 @@
1
- var parseTimeTest = {};
2
-
3
- export { parseTimeTest as __exports };
@@ -1,3 +0,0 @@
1
- var test = {};
2
-
3
- export { test as __exports };
package/dist/es/auth.d.ts DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * 权限相关
3
- */
4
- declare function getToken(): string | null;
5
- declare function setToken(token: string): void;
6
- declare function removeToken(): void;
7
- declare function parseToken(token?: string): unknown;
8
-
9
- export { getToken, parseToken, removeToken, setToken };
package/dist/es/auth.js DELETED
@@ -1,49 +0,0 @@
1
- import o from './node_modules/jwt-decode/build/jwt-decode.esm.js';
2
-
3
- /**
4
- * 权限相关
5
- */
6
- function getToken() {
7
- try {
8
- return window.localStorage.getItem("system-token");
9
- }
10
- catch (err) {
11
- console.error("获取token失败", err);
12
- return "";
13
- }
14
- }
15
- function setToken(token) {
16
- try {
17
- window.localStorage.setItem("system-token", token);
18
- }
19
- catch (err) {
20
- console.error("设置token失败", err);
21
- }
22
- }
23
- function removeToken() {
24
- try {
25
- window.localStorage.removeItem("system-token");
26
- }
27
- catch (err) {
28
- console.error("设置token失败", err);
29
- }
30
- }
31
- function parseToken(token) {
32
- var t = token;
33
- if (!t) {
34
- t = getToken();
35
- }
36
- if (t) {
37
- try {
38
- return o(t);
39
- }
40
- catch (err) {
41
- console.log("解析失败", err);
42
- return null;
43
- }
44
- }
45
- // 没有token
46
- return null;
47
- }
48
-
49
- export { getToken, parseToken, removeToken, setToken };
@@ -1,23 +0,0 @@
1
- interface IOptions {
2
- /** 环境变量key值 */
3
- envKey: string;
4
- /** api地址的前缀key */
5
- apiKey: string;
6
- /** 附件服务器前缀key */
7
- fileKey: string;
8
- /** 退出登录默认的key */
9
- logoutKey: string;
10
- /** 数字中心各个环境key值 */
11
- cicomsKey?: string;
12
- /** 外网服务器前缀key值 */
13
- outKey?: string;
14
- }
15
- declare function getBaseUrl(processObj: any, options?: IOptions): {
16
- API_URL: any;
17
- CICOMS_API_URL: any;
18
- FILE_URL: any;
19
- OUTHR_DOMAIN: any;
20
- LOGOUT_URL: any;
21
- };
22
-
23
- export { getBaseUrl };