@obr-fe/utils 0.0.5 → 1.0.5

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 (110) hide show
  1. package/README.MD +1 -1
  2. package/dist/array.d.ts +13 -29
  3. package/dist/array.js +1 -1
  4. package/dist/array.mjs +1 -1
  5. package/dist/base.d.ts +43 -29
  6. package/dist/base.js +1 -1
  7. package/dist/base.mjs +1 -1
  8. package/dist/chunk-2VDM4TPP.mjs +1 -0
  9. package/dist/chunk-3FEUM3RZ.mjs +1 -0
  10. package/dist/chunk-44EYU7QJ.mjs +1 -0
  11. package/dist/chunk-BLMP4PDT.mjs +1 -0
  12. package/dist/chunk-CN5BBOAB.mjs +1 -0
  13. package/dist/chunk-DKKF6DRJ.mjs +1 -0
  14. package/dist/chunk-E4SEMOGO.mjs +1 -0
  15. package/dist/chunk-G6V6TMDC.mjs +1 -0
  16. package/dist/chunk-HOXWKSQ2.mjs +1 -0
  17. package/dist/chunk-INFFTHYR.mjs +1 -0
  18. package/dist/chunk-K7XCTXKT.mjs +1 -0
  19. package/dist/chunk-OBAHJOMO.mjs +1 -0
  20. package/dist/{chunk-OTVWATFI.mjs → chunk-ORMY4OU2.mjs} +1 -1
  21. package/dist/chunk-PE3DNHCL.mjs +1 -0
  22. package/dist/chunk-PZZCLSIF.mjs +1 -0
  23. package/dist/chunk-QHZ3NUSL.mjs +1 -0
  24. package/dist/chunk-SAXMBV46.mjs +1 -0
  25. package/dist/chunk-SHNMDODE.mjs +1 -0
  26. package/dist/chunk-TQ5GXPYB.mjs +1 -0
  27. package/dist/chunk-VJPERUBQ.mjs +1 -0
  28. package/dist/chunk-WBQAMGXK.mjs +0 -0
  29. package/dist/chunk-WN7L4HYY.mjs +1 -0
  30. package/dist/dom/base.d.ts +3 -3
  31. package/dist/dom/base.js +1 -1
  32. package/dist/dom/base.mjs +1 -1
  33. package/dist/dom/css.js +1 -1
  34. package/dist/dom/css.mjs +1 -1
  35. package/dist/dom/find-dom-node.d.ts +1 -1
  36. package/dist/dom/find-dom-node.js +1 -1
  37. package/dist/dom/find-dom-node.mjs +1 -1
  38. package/dist/dom/iframe.d.ts +57 -0
  39. package/dist/dom/iframe.js +1 -0
  40. package/dist/dom/iframe.mjs +1 -0
  41. package/dist/dom/index.d.ts +5 -0
  42. package/dist/dom/index.js +1 -1
  43. package/dist/dom/index.mjs +1 -1
  44. package/dist/dom/storage.d.ts +20 -0
  45. package/dist/dom/storage.js +1 -0
  46. package/dist/dom/storage.mjs +1 -0
  47. package/dist/dom/style-checker.js +1 -1
  48. package/dist/dom/style-checker.mjs +1 -1
  49. package/dist/dom/style-names.js +1 -1
  50. package/dist/dom/style-names.mjs +1 -1
  51. package/dist/file.d.ts +2 -2
  52. package/dist/file.js +1 -1
  53. package/dist/file.mjs +1 -1
  54. package/dist/index.d.ts +10 -4
  55. package/dist/index.js +1 -1
  56. package/dist/index.mjs +1 -1
  57. package/dist/object.d.ts +11 -10
  58. package/dist/object.js +1 -1
  59. package/dist/object.mjs +1 -1
  60. package/dist/other.d.ts +23 -14
  61. package/dist/other.js +1 -1
  62. package/dist/other.mjs +1 -1
  63. package/dist/request/constant.d.ts +10 -0
  64. package/dist/request/constant.js +1 -0
  65. package/dist/request/constant.mjs +1 -0
  66. package/dist/request/handler.d.ts +10 -0
  67. package/dist/request/handler.js +1 -0
  68. package/dist/request/handler.mjs +1 -0
  69. package/dist/request/index.d.ts +4 -0
  70. package/dist/request/index.js +1 -0
  71. package/dist/request/index.mjs +1 -0
  72. package/dist/request/request.d.ts +89 -0
  73. package/dist/request/request.js +1 -0
  74. package/dist/request/request.mjs +1 -0
  75. package/dist/request/utils/cancel.d.ts +23 -0
  76. package/dist/request/utils/cancel.js +1 -0
  77. package/dist/request/utils/cancel.mjs +1 -0
  78. package/dist/request/utils/file.d.ts +6 -0
  79. package/dist/request/utils/file.js +1 -0
  80. package/dist/request/utils/file.mjs +1 -0
  81. package/dist/request/utils/format.d.ts +11 -0
  82. package/dist/request/utils/format.js +1 -0
  83. package/dist/request/utils/format.mjs +1 -0
  84. package/dist/safe-next-tick.d.ts +1 -1
  85. package/dist/safe-next-tick.js +1 -1
  86. package/dist/safe-next-tick.mjs +1 -1
  87. package/dist/types.d.ts +164 -0
  88. package/dist/types.js +1 -0
  89. package/dist/types.mjs +1 -0
  90. package/dist/vue/hooks/clipboard.d.ts +1 -1
  91. package/dist/vue/hooks/clipboard.js +1 -1
  92. package/dist/vue/hooks/clipboard.mjs +1 -1
  93. package/dist/vue/index.js +1 -1
  94. package/dist/vue/index.mjs +1 -1
  95. package/package.json +35 -32
  96. package/dist/chunk-4CSXS5HE.mjs +0 -1
  97. package/dist/chunk-AHENZTBD.mjs +0 -1
  98. package/dist/chunk-BM65Z3BA.mjs +0 -1
  99. package/dist/chunk-BTRFNTUR.mjs +0 -1
  100. package/dist/chunk-CV5ABO6S.mjs +0 -1
  101. package/dist/chunk-GQNODP36.mjs +0 -1
  102. package/dist/chunk-LHBVJBCG.mjs +0 -1
  103. package/dist/chunk-LZM3K4ZI.mjs +0 -1
  104. package/dist/chunk-PPOXYBWE.mjs +0 -1
  105. package/dist/chunk-PWYR6CSX.mjs +0 -1
  106. package/dist/chunk-UOQ77YOD.mjs +0 -1
  107. package/dist/document.d.ts +0 -24
  108. package/dist/document.js +0 -1
  109. package/dist/document.mjs +0 -1
  110. /package/dist/{chunk-QWDRQX5J.mjs → chunk-CYMHFZIC.mjs} +0 -0
package/README.MD CHANGED
@@ -1 +1 @@
1
- [文档地址](http://119.163.195.34:10010/fe-docs/obr-utils/)
1
+ [文档地址](https://dev-fe.oberyun.com/fe-docs/obr-utils/)
package/dist/array.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { ObjectDataType } from './base.js';
1
+ import { TreeItemType, ObjectDataType, BaseOptionType } from './types.js';
2
+ import 'axios';
2
3
 
3
4
  /**
4
5
  * @description: 字符串元组
@@ -20,24 +21,7 @@ declare const tupleNum: <T extends number[]>(...args: T) => T;
20
21
  * @return {*}
21
22
  * @autor: 刘 相卿
22
23
  */
23
- declare const toArray: <T>(val: T) => T[];
24
- /**
25
- * @description: 选项类型
26
- * @return {*}
27
- * @autor: 刘 相卿
28
- */
29
- interface BaseOptionType extends ObjectDataType {
30
- label: string;
31
- value: string | number;
32
- }
33
- /**
34
- * @description: 树形结构数据类型
35
- * @autor: 刘 相卿
36
- */
37
- interface TreeItemType extends ObjectDataType {
38
- label?: string;
39
- children?: TreeItemType[];
40
- }
24
+ declare function toArray<T>(val: T): T[];
41
25
  /**
42
26
  * @description: 数组转树型结构数据
43
27
  * @param {any[]} data
@@ -47,7 +31,7 @@ interface TreeItemType extends ObjectDataType {
47
31
  * @return {TreeItemType[]} 树型数据
48
32
  * @autor: 刘 相卿
49
33
  */
50
- declare const array2tree: <T = TreeItemType>(data?: ObjectDataType[], id?: string, pid?: string, children?: string) => T[];
34
+ declare function array2tree<T = TreeItemType>(data?: ObjectDataType[], id?: string, pid?: string, children?: string): T[];
51
35
  /**
52
36
  * @description: 对象数组转换为选项数组
53
37
  * @param {ObjectDataType[]} array
@@ -55,17 +39,17 @@ declare const array2tree: <T = TreeItemType>(data?: ObjectDataType[], id?: strin
55
39
  * @return {BaseOptionType[]}
56
40
  * @autor: 刘 相卿
57
41
  */
58
- declare const array2option: (array: ObjectDataType[], alias: {
42
+ declare function array2option(array: ObjectDataType[], alias: {
59
43
  label: string;
60
44
  value: string;
61
- }) => BaseOptionType[];
45
+ }): BaseOptionType[];
62
46
  /**
63
47
  * @description: 删除数组中的空元素
64
48
  * @param {T[]} array
65
49
  * @return {*}
66
50
  * @autor: 刘 相卿
67
51
  */
68
- declare const deleteEmptyElement: <T>(array: T[]) => T[];
52
+ declare function deleteEmptyElement<T>(array: T[]): T[];
69
53
  /**
70
54
  * @description: 根据给定的值集合,查找树型结构数据中符合条件的元素
71
55
  * @param {TreeItemType[]} array 树型数组
@@ -74,10 +58,10 @@ declare const deleteEmptyElement: <T>(array: T[]) => T[];
74
58
  * @return {*}
75
59
  * @autor: 刘 相卿
76
60
  */
77
- declare const getElementsByValues: (array: TreeItemType[] | undefined, values: (string | number)[], alias?: {
61
+ declare function getElementsByValues(array: TreeItemType[] | undefined, values: (string | number)[], alias?: {
78
62
  value?: string;
79
63
  children?: string;
80
- }) => ObjectDataType[];
64
+ }): ObjectDataType[];
81
65
  /**
82
66
  * @description: 将树型结构数组拉平为一维数组
83
67
  * @param {TreeItemType[]} data 树型数组
@@ -86,7 +70,7 @@ declare const getElementsByValues: (array: TreeItemType[] | undefined, values: (
86
70
  * @return {TreeItemType[]}
87
71
  * @autor: 刘 相卿
88
72
  */
89
- declare const tree2array: (data?: TreeItemType[], alias?: string) => ObjectDataType[];
73
+ declare function tree2array(data?: TreeItemType[], alias?: string): ObjectDataType[];
90
74
  /**
91
75
  * @description: 根据对象数组中的keys去重
92
76
  * @param {ObjectDataType[]} array 原数组
@@ -94,7 +78,7 @@ declare const tree2array: (data?: TreeItemType[], alias?: string) => ObjectDataT
94
78
  * @return {T[]}
95
79
  * @autor: 刘 相卿
96
80
  */
97
- declare const uniqueArrayByKeys: <T = ObjectDataType>(array: T[], keys: (keyof T)[]) => T[];
81
+ declare function uniqueArrayByKeys<T = ObjectDataType>(array: T[], keys: (keyof T)[]): T[];
98
82
  /**
99
83
  * @description: 删除简单数组中的符合规则的元素,并返回新数组
100
84
  * @param {(number|string|boolean)[]} array 原数组
@@ -102,7 +86,7 @@ declare const uniqueArrayByKeys: <T = ObjectDataType>(array: T[], keys: (keyof T
102
86
  * @return {*} (number|string|boolean)[]
103
87
  * @autor: 刘 相卿
104
88
  */
105
- declare const deleteElement: (array: (number | string | boolean)[], values?: (number | string | boolean)[]) => (number | string | boolean)[];
89
+ declare function deleteElement(array: (number | string | boolean)[], values?: (number | string | boolean)[]): (number | string | boolean)[];
106
90
  /**
107
91
  * @description: 删除数组中的符合规则的元素,并返回新数组
108
92
  * @param {any[]} array 原数组
@@ -110,6 +94,6 @@ declare const deleteElement: (array: (number | string | boolean)[], values?: (nu
110
94
  * @return {*}
111
95
  * @autor: 刘 相卿
112
96
  */
113
- declare const deleteElementPro: (array: any[], rules?: any[]) => any[];
97
+ declare function deleteElementPro(array: any[], rules?: any[]): any[];
114
98
 
115
99
  export { array2option, array2tree, deleteElement, deleteElementPro, deleteEmptyElement, getElementsByValues, toArray, tree2array, tuple, tupleNum, uniqueArrayByKeys };
package/dist/array.js CHANGED
@@ -1 +1 @@
1
- "use strict";var x=Object.create;var p=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var E=(e,n)=>{for(var t in n)p(e,t,{get:n[t],enumerable:!0})},f=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of j(n))!h.call(e,o)&&o!==t&&p(e,o,{get:()=>n[o],enumerable:!(s=O(n,o))||s.enumerable});return e};var u=(e,n,t)=>(t=e!=null?x(D(e)):{},f(n||!e||!e.__esModule?p(t,"default",{value:e,enumerable:!0}):t,e)),w=e=>f(p({},"__esModule",{value:!0}),e);var M={};E(M,{array2option:()=>S,array2tree:()=>K,deleteElement:()=>V,deleteElementPro:()=>$,deleteEmptyElement:()=>F,getElementsByValues:()=>g,toArray:()=>B,tree2array:()=>I,tuple:()=>A,tupleNum:()=>N,uniqueArrayByKeys:()=>P});module.exports=w(M);var l=e=>typeof e=="number";var b=e=>Object.prototype.toString.call(e)==="[object Object]";var c=e=>e==null||e===""||typeof e=="number"&&isNaN(e),m=e=>!e||Object.getOwnPropertyNames(e).length===0;var T=u(require("lodash.clonedeep")),k=u(require("lodash.debounce")),R=u(require("lodash.merge")),v=u(require("lodash.clone"));var d=(e={})=>Object.entries(e).reduce((n,[t,s])=>(c(s)||(n[t]=s),n),{});var A=(...e)=>e,N=(...e)=>e,B=e=>Array.isArray(e)?e:[e],K=(e=[],n="id",t="pid",s="children")=>{let o=[],i={},a=(0,T.default)(e);for(let r=0;r<a.length;r++)i[a[r][n]]=a[r];for(let r=0;r<a.length;r++)i[a[r][t]]&&a[r][n]!==a[r][t]?(i[a[r][t]][s]||(i[a[r][t]][s]=[]),i[a[r][t]][s].push(a[r])):o.push(a[r]);return o},S=(e,n)=>e.map(t=>({label:t[n.label],value:t[n.value]})),F=e=>e.filter(n=>!c(n)),g=(e=[],n,t)=>{let s={value:"value",children:"children",...d(t)},o=[],[i]=n,a=e.find(r=>r[s.value]===i);if(!c(i)&&!c(a)){let{[s.children]:r,...y}=a;return o.concat(y,...g(r??[],n.slice(1),s))}return o},I=(e=[],n="children")=>{let t=[],s=(o,i)=>{o.forEach(a=>{let{[i]:r,...y}=a;t.push(y),r&&s(r,i)})};return s(e,n),t},P=(e,n)=>e.reduce((s,o)=>(s.find(a=>n.every(r=>a[r]===o[r]))||s.push(o),s),[]),V=(e,n=[])=>e.filter(t=>!n.includes(t)),$=(e,n=[])=>e.filter(t=>!n.some(o=>b(o)&&b(t)?m(o)?m(t):Object.entries(o).every(([i,a])=>a===t[i]):l(o)&&isNaN(o)?l(t)&&isNaN(t):t===o));0&&(module.exports={array2option,array2tree,deleteElement,deleteElementPro,deleteEmptyElement,getElementsByValues,toArray,tree2array,tuple,tupleNum,uniqueArrayByKeys});
1
+ "use strict";var d=Object.create;var u=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var w=(e,n)=>{for(var t in n)u(e,t,{get:n[t],enumerable:!0})},m=(e,n,t,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of j(n))!h.call(e,o)&&o!==t&&u(e,o,{get:()=>n[o],enumerable:!(a=x(n,o))||a.enumerable});return e};var p=(e,n,t)=>(t=e!=null?d(D(e)):{},m(n||!e||!e.__esModule?u(t,"default",{value:e,enumerable:!0}):t,e)),E=e=>m(u({},"__esModule",{value:!0}),e);var L={};w(L,{array2option:()=>P,array2tree:()=>K,deleteElement:()=>M,deleteElementPro:()=>U,deleteEmptyElement:()=>B,getElementsByValues:()=>O,toArray:()=>S,tree2array:()=>F,tuple:()=>A,tupleNum:()=>v,uniqueArrayByKeys:()=>I});module.exports=E(L);var l=e=>typeof e=="number";var f=e=>Object.prototype.toString.call(e)==="[object Object]";function c(e){return e==null||e===""||typeof e=="number"&&Number.isNaN(e)}function T(e){return!e||Object.getOwnPropertyNames(e).length===0}var b=p(require("lodash.clonedeep")),N=p(require("lodash.debounce")),k=p(require("lodash.merge")),R=p(require("lodash.clone"));function g(e={}){return Object.entries(e).reduce((n,[t,a])=>(c(a)||(n[t]=a),n),{})}var A=(...e)=>e,v=(...e)=>e;function S(e){return Array.isArray(e)?e:[e]}function K(e=[],n="id",t="pid",a="children"){let o=[],i={},s=(0,b.default)(e);for(let r=0;r<s.length;r++)i[s[r][n]]=s[r];for(let r=0;r<s.length;r++)i[s[r][t]]&&s[r][n]!==s[r][t]?(i[s[r][t]][a]||(i[s[r][t]][a]=[]),i[s[r][t]][a].push(s[r])):o.push(s[r]);return o}function P(e,n){return e.map(t=>({label:t[n.label],value:t[n.value]}))}function B(e){return e.filter(n=>!c(n))}function O(e=[],n,t){let a={value:"value",children:"children",...g(t)},o=[],[i]=n,s=e.find(r=>r[a.value]===i);if(!c(i)&&!c(s)){let{[a.children]:r,...y}=s;return o.concat(y,...O(r??[],n.slice(1),a))}return o}function F(e=[],n="children"){let t=[],a=(o,i)=>{o.forEach(s=>{let{[i]:r,...y}=s;t.push(y),r&&a(r,i)})};return a(e,n),t}function I(e,n){return e.reduce((a,o)=>(a.find(s=>n.every(r=>s[r]===o[r]))||a.push(o),a),[])}function M(e,n=[]){return e.filter(t=>!n.includes(t))}function U(e,n=[]){return e.filter(t=>!n.some(o=>f(o)&&f(t)?T(o)?T(t):Object.entries(o).every(([i,s])=>s===t[i]):l(o)&&Number.isNaN(o)?l(t)&&Number.isNaN(t):t===o))}0&&(module.exports={array2option,array2tree,deleteElement,deleteElementPro,deleteEmptyElement,getElementsByValues,toArray,tree2array,tuple,tupleNum,uniqueArrayByKeys});
package/dist/array.mjs CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-LHBVJBCG.mjs";import"./chunk-SO3V4S32.mjs";import"./chunk-LZM3K4ZI.mjs";import"./chunk-PWYR6CSX.mjs";export{e as array2option,d as array2tree,j as deleteElement,k as deleteElementPro,f as deleteEmptyElement,g as getElementsByValues,c as toArray,h as tree2array,a as tuple,b as tupleNum,i as uniqueArrayByKeys};
1
+ import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-3FEUM3RZ.mjs";import"./chunk-SO3V4S32.mjs";import"./chunk-QHZ3NUSL.mjs";import"./chunk-OBAHJOMO.mjs";export{e as array2option,d as array2tree,j as deleteElement,k as deleteElementPro,f as deleteEmptyElement,g as getElementsByValues,c as toArray,h as tree2array,a as tuple,b as tupleNum,i as uniqueArrayByKeys};
package/dist/base.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { ObjectDataType, DataType } from './types.js';
2
+ import 'axios';
3
+
1
4
  /**
2
5
  * @description: 判断是否为string类型
3
6
  * @param {unknown} val
@@ -18,7 +21,7 @@ declare const isNumber: (val: unknown) => val is number;
18
21
  * @return {*}
19
22
  * @autor: 刘 相卿
20
23
  */
21
- declare const isBoolean: (val: unknown) => val is boolean;
24
+ declare function isBoolean(val: unknown): val is boolean;
22
25
  /**
23
26
  * @description: 判断是否为函数类型
24
27
  * @param {unknown} val
@@ -32,21 +35,21 @@ declare const isFunction: (val: unknown) => val is Function;
32
35
  * @return {*}
33
36
  * @autor: 刘 相卿
34
37
  */
35
- declare const isArray: (val: unknown) => val is any[];
38
+ declare const isArray: <T>(val: unknown) => val is T[];
36
39
  /**
37
40
  * @description: 判断是否为undefined类型
38
41
  * @param {unknown} val
39
42
  * @return {*}
40
43
  * @autor: 刘 相卿
41
44
  */
42
- declare const isUndefined: (val: unknown) => val is undefined;
45
+ declare function isUndefined(val: unknown): val is undefined;
43
46
  /**
44
47
  * @description: 判断参数已定义且不为空
45
48
  * @param {*} T
46
49
  * @return {*}
47
50
  * @autor: 刘 相卿
48
51
  */
49
- declare const isDef: <T = any>(val?: T | undefined) => val is T;
52
+ declare const isDef: <T = any>(val?: T | undefined) => val is NonNullable<T>;
50
53
  /**
51
54
  * @description: 是否为null
52
55
  * @param {unknown} val
@@ -64,62 +67,52 @@ declare const isSymbol: (val: unknown) => val is symbol;
64
67
  /**
65
68
  * @description: 是否为对象类型
66
69
  * @param {unknown} val
67
- * @param {*} any
68
70
  * @return {*}
69
71
  * @autor: 刘 相卿
70
72
  */
71
- declare const isObject: (val: unknown) => val is Record<any, any>;
73
+ declare const isObjectDataType: <T extends ObjectDataType<any, string> = ObjectDataType<any, string>>(val: unknown) => val is T;
74
+ declare const isObject: (val: unknown) => val is object;
72
75
  /**
73
76
  * @description: 是否为日期类型
74
77
  * @param {unknown} val
75
78
  * @return {*}
76
79
  * @autor: 刘 相卿
77
80
  */
78
- declare const isDate: (val: unknown) => val is Date;
81
+ declare function isDate(val: unknown): val is Date;
79
82
  /**
80
83
  * @description: 是否为原始类型
81
84
  * @return {*}
82
85
  * @autor: 刘 相卿
83
86
  */
84
- declare const isBaseType: (val: unknown) => val is string | number | boolean | symbol | null | undefined;
87
+ declare function isBaseType(val: unknown): boolean;
85
88
  /**
86
89
  * @description: 是否为url
87
90
  * @param {string} val
88
91
  * @return {*}
89
92
  * @autor: 刘 相卿
90
93
  */
91
- declare const isUrl: (val: string) => boolean;
92
- /**
93
- * @description: 数据类型
94
- * @autor: 刘 相卿
95
- */
96
- type DataType = 'set' | 'map' | 'function' | 'object' | 'array' | 'undefined' | 'null' | 'number' | 'symbol' | 'string' | 'boolean' | 'regexp' | 'date' | 'bigint' | 'blob' | 'formdata';
97
- /**
98
- * @description: 基础对象类型
99
- * @autor: 刘 相卿
100
- */
101
- type ObjectDataType = Record<string, any>;
94
+ declare function isUrl(val: string): boolean;
102
95
  /**
103
96
  * @description: 判断是否未null或者undefined
104
97
  * @param {unknown} value
105
98
  * @return {*}
106
99
  * @autor: 刘 相卿
107
100
  */
108
- declare const isEmpty: (value: unknown, undefinedValue?: boolean) => boolean;
101
+ declare function isEmpty(value: unknown, undefinedValue?: boolean): boolean;
109
102
  /**
110
103
  * @description: 判断是否为空值
111
104
  * @param {unknown} value
112
105
  * @return {boolean}
113
106
  * @autor: 刘 相卿
114
107
  */
115
- declare const isEmptyValue: (value: unknown) => boolean;
108
+ declare function isEmptyValue(value: unknown): boolean;
116
109
  /**
117
110
  * @description: 判断是否为空对象
118
111
  * @param {ObjectDataType} object
119
112
  * @return {*}
120
113
  * @autor: 刘 相卿
121
114
  */
122
- declare const isEmptyObject: (object: ObjectDataType) => boolean;
115
+ declare function isEmptyObject(object: ObjectDataType): boolean;
123
116
  /**
124
117
  * @description: 判断是否为空数组
125
118
  * @param {any} data
@@ -133,21 +126,21 @@ declare function isEmptyArray(data?: any[]): boolean;
133
126
  * @return {boolean}
134
127
  * @autor: 刘 相卿
135
128
  */
136
- declare const isMeaninglessArray: (data?: any[]) => boolean;
129
+ declare function isMeaninglessArray(data?: any[]): boolean;
137
130
  /**
138
131
  * @description: 获取数据类型
139
132
  * @param {any} data
140
133
  * @return {DataType} 数据类型字符串
141
134
  * @autor: 刘 相卿
142
135
  */
143
- declare const getDataType: (data: any) => DataType;
136
+ declare function getDataType(data: any): DataType;
144
137
  /**
145
138
  * @description: 根据url获取文件类型
146
139
  * @param {string} fileUrl
147
140
  * @return {*}
148
141
  * @autor: 刘 相卿
149
142
  */
150
- declare const getFileType: (fileUrl: string) => string;
143
+ declare function getFileType(fileUrl: string): string;
151
144
  /**
152
145
  * @description: 替换最后一个匹配的字符串
153
146
  * @param {string} str
@@ -156,7 +149,7 @@ declare const getFileType: (fileUrl: string) => string;
156
149
  * @return {*}
157
150
  * @autor: 刘 相卿
158
151
  */
159
- declare const replaceLastMatch: (str: string, char: string, target: string) => string;
152
+ declare function replaceLastMatch(str: string, char: string, target: string): string;
160
153
  /**
161
154
  * @description: 替换所有匹配的字符串
162
155
  * @param {string} str
@@ -165,13 +158,34 @@ declare const replaceLastMatch: (str: string, char: string, target: string) => s
165
158
  * @return {*}
166
159
  * @autor: 刘 相卿
167
160
  */
168
- declare const replaceMatch: (str: string, reg: RegExp, target: string) => string;
161
+ declare function replaceMatch(str: string, reg: RegExp, target: string): string;
169
162
  /**
170
163
  * @description: 将数字转化为正数
171
164
  * @param {number} value
172
165
  * @return {*}
173
166
  * @autor: 刘 相卿
174
167
  */
175
- declare const formatPositiveNumber: (value: number) => number;
168
+ declare function formatPositiveNumber(value: number): number;
169
+ /**
170
+ * @description: JSON字符串转换为JSON对象/数组
171
+ * @param {string} str JSON字符串
172
+ * @return {T}
173
+ * @autor: 刘 相卿
174
+ */
175
+ declare function string2json<T>(str: string, defaultValue?: T): T;
176
+ /**
177
+ * @description: JSON对象转换为JSON字符串
178
+ * @param {any} json
179
+ * @return {string}
180
+ * @autor: 刘 相卿
181
+ */
182
+ declare function json2string(json: any): string;
183
+ /**
184
+ * @description: 生成随机字符串
185
+ * @param {number} length 随机字符串长度 默认长度为10
186
+ * @return {*}
187
+ * @autor: 刘 相卿
188
+ */
189
+ declare function uuid(length?: number): string;
176
190
 
177
- export { ObjectDataType, formatPositiveNumber, getDataType, getFileType, isArray, isBaseType, isBoolean, isDate, isDef, isEmpty, isEmptyArray, isEmptyObject, isEmptyValue, isFunction, isMeaninglessArray, isNull, isNumber, isObject, isString, isSymbol, isUndefined, isUrl, replaceLastMatch, replaceMatch };
191
+ export { formatPositiveNumber, getDataType, getFileType, isArray, isBaseType, isBoolean, isDate, isDef, isEmpty, isEmptyArray, isEmptyObject, isEmptyValue, isFunction, isMeaninglessArray, isNull, isNumber, isObject, isObjectDataType, isString, isSymbol, isUndefined, isUrl, json2string, replaceLastMatch, replaceMatch, string2json, uuid };
package/dist/base.js CHANGED
@@ -1 +1 @@
1
- "use strict";var r=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var f=(n,t)=>{for(var e in t)r(n,e,{get:t[e],enumerable:!0})},d=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of x(t))!m.call(n,o)&&o!==e&&r(n,o,{get:()=>t[o],enumerable:!(s=g(t,o))||s.enumerable});return n};var w=n=>d(r({},"__esModule",{value:!0}),n);var B={};f(B,{formatPositiveNumber:()=>$,getDataType:()=>S,getFileType:()=>F,isArray:()=>j,isBaseType:()=>A,isBoolean:()=>a,isDate:()=>O,isDef:()=>T,isEmpty:()=>E,isEmptyArray:()=>b,isEmptyObject:()=>N,isEmptyValue:()=>u,isFunction:()=>k,isMeaninglessArray:()=>R,isNull:()=>l,isNumber:()=>p,isObject:()=>D,isString:()=>i,isSymbol:()=>y,isUndefined:()=>c,isUrl:()=>h,replaceLastMatch:()=>M,replaceMatch:()=>U});module.exports=w(B);var i=n=>typeof n=="string",p=n=>typeof n=="number",a=n=>typeof n=="boolean",k=n=>typeof n=="function",j=n=>Array.isArray(n),c=n=>typeof n>"u",T=n=>typeof n<"u",l=n=>n===null,y=n=>typeof n=="symbol",D=n=>Object.prototype.toString.call(n)==="[object Object]",O=n=>Object.prototype.toString.call(n)==="[object Date]",A=n=>i(n)||p(n)||a(n)||y(n)||c(n)||l(n),h=n=>/^(https?|mailto|tel|file):/.test(n),E=(n,t=!0)=>t&&n===void 0||n===null||n==="null",u=n=>n==null||n===""||typeof n=="number"&&isNaN(n),N=n=>!n||Object.getOwnPropertyNames(n).length===0;function b(n=[]){return Array.isArray(n)&&!n.length}var R=(n=[])=>Array.isArray(n)?b(n)||n.every(t=>u(t)):!1,S=n=>Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),F=n=>(n.match(/\.([^.]+)$/)?.[1]??"\u672A\u77E5").toUpperCase(),M=(n,t,e)=>n.replace(new RegExp("(.*)"+t),`$1${e}`),U=(n,t,e)=>n.replace(new RegExp(t,"g"),e),$=n=>n&&n>0?n:0;0&&(module.exports={formatPositiveNumber,getDataType,getFileType,isArray,isBaseType,isBoolean,isDate,isDef,isEmpty,isEmptyArray,isEmptyObject,isEmptyValue,isFunction,isMeaninglessArray,isNull,isNumber,isObject,isString,isSymbol,isUndefined,isUrl,replaceLastMatch,replaceMatch});
1
+ "use strict";var i=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var j=(t,n)=>{for(var e in n)i(t,e,{get:n[e],enumerable:!0})},w=(t,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of m(n))!T.call(t,r)&&r!==e&&i(t,r,{get:()=>n[r],enumerable:!(o=x(n,r))||o.enumerable});return t};var h=t=>w(i({},"__esModule",{value:!0}),t);var P={};j(P,{formatPositiveNumber:()=>$,getDataType:()=>F,getFileType:()=>L,isArray:()=>a,isBaseType:()=>N,isBoolean:()=>p,isDate:()=>d,isDef:()=>k,isEmpty:()=>S,isEmptyArray:()=>g,isEmptyObject:()=>E,isEmptyValue:()=>b,isFunction:()=>O,isMeaninglessArray:()=>M,isNull:()=>l,isNumber:()=>c,isObject:()=>f,isObjectDataType:()=>D,isString:()=>s,isSymbol:()=>y,isUndefined:()=>u,isUrl:()=>A,json2string:()=>C,replaceLastMatch:()=>R,replaceMatch:()=>U,string2json:()=>B,uuid:()=>J});module.exports=h(P);var s=t=>typeof t=="string",c=t=>typeof t=="number";function p(t){return typeof t=="boolean"}var O=t=>typeof t=="function",a=t=>Array.isArray(t);function u(t){return typeof t>"u"}var k=t=>typeof t<"u",l=t=>t===null,y=t=>typeof t=="symbol",D=t=>Object.prototype.toString.call(t)==="[object Object]",f=t=>Object.prototype.toString.call(t)==="[object Object]";function d(t){return Object.prototype.toString.call(t)==="[object Date]"}function N(t){return s(t)||c(t)||p(t)||y(t)||u(t)||l(t)}function A(t){return/^(?:https?|mailto|tel|file):/.test(t)}function S(t,n=!0){return n&&t===void 0||t===null||t==="null"}function b(t){return t==null||t===""||typeof t=="number"&&Number.isNaN(t)}function E(t){return!t||Object.getOwnPropertyNames(t).length===0}function g(t=[]){return Array.isArray(t)&&!t.length}function M(t=[]){return Array.isArray(t)?g(t)||t.every(n=>b(n)):!1}function F(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function L(t){return(t.match(/\.([^.]+)$/)?.[1]??"\u672A\u77E5").toUpperCase()}function R(t,n,e){return t.replace(new RegExp(`(.*)${n}`),`$1${e}`)}function U(t,n,e){return t.replace(new RegExp(n,"g"),e)}function $(t){return t&&t>0?t:0}function B(t,n){let e=null;try{t&&s(t)&&(e=JSON.parse(t))}catch{n?e=n:e={}}return e}function C(t){let n="";try{n&&(a(t)||f(t))&&(n=JSON.stringify(n))}catch{n=""}return n}function J(t=10){let n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="",o=n.length;for(let r=0;r<t;r++)e+=n.charAt(Math.floor(Math.random()*o));return e}0&&(module.exports={formatPositiveNumber,getDataType,getFileType,isArray,isBaseType,isBoolean,isDate,isDef,isEmpty,isEmptyArray,isEmptyObject,isEmptyValue,isFunction,isMeaninglessArray,isNull,isNumber,isObject,isObjectDataType,isString,isSymbol,isUndefined,isUrl,json2string,replaceLastMatch,replaceMatch,string2json,uuid});
package/dist/base.mjs CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w}from"./chunk-PWYR6CSX.mjs";export{w as formatPositiveNumber,s as getDataType,t as getFileType,e as isArray,l as isBaseType,c as isBoolean,k as isDate,g as isDef,n as isEmpty,q as isEmptyArray,p as isEmptyObject,o as isEmptyValue,d as isFunction,r as isMeaninglessArray,h as isNull,b as isNumber,j as isObject,a as isString,i as isSymbol,f as isUndefined,m as isUrl,u as replaceLastMatch,v as replaceMatch};
1
+ import{A,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-OBAHJOMO.mjs";export{x as formatPositiveNumber,t as getDataType,u as getFileType,e as isArray,m as isBaseType,c as isBoolean,l as isDate,g as isDef,o as isEmpty,r as isEmptyArray,q as isEmptyObject,p as isEmptyValue,d as isFunction,s as isMeaninglessArray,h as isNull,b as isNumber,k as isObject,j as isObjectDataType,a as isString,i as isSymbol,f as isUndefined,n as isUrl,z as json2string,v as replaceLastMatch,w as replaceMatch,y as string2json,A as uuid};
@@ -0,0 +1 @@
1
+ import{a as p}from"./chunk-VJPERUBQ.mjs";import{a as g,b as E,c as i}from"./chunk-PZZCLSIF.mjs";import{a as d,e as c}from"./chunk-G6V6TMDC.mjs";import{b as m,c as u,e as y}from"./chunk-44EYU7QJ.mjs";import{c as f}from"./chunk-SO3V4S32.mjs";var T=new Map;function b(t){let r={},e=t.split("?")[1];return e&&e.split("&").forEach(n=>{let[a="",s=""]=n.split("=");r[a]=s}),r}function h(t,r){T.get(c)&&!r.whiteUrl?.().includes(t.url??"")&&u(t,!0);let e=f({},t),[n=""]=(e.url??"").split("?"),a=g(f({},b(e.url??""),e.params));r.allowNullValue||(a=E(a)),e.url=n,e.params=a,e.headers?.["Content-Type"]||f(e.headers,{"Content-Type":"application/json;charset=utf-8"});let{token:s}=r;if(s?.key&&s.get()){let o={[s.key]:s.get()};f(e.headers,o)}else s?.key&&e.headers&&Reflect.deleteProperty(e.headers,s.key);return r.allowCancel&&(u(e),m(e)),r.beforeRequest?r.beforeRequest(e):e}function R(t,r,e){let n={type:t,content:r,options:e};if(t==="REQUEST"&&r.code===401){if(y(),e[401])return e[401](r)}else{if(t==="CANCEL"&&e.cancel)return e.cancel(n);if(e.error)return e.error(n)}return Promise.reject(n)}async function D(t,r){let{data:e,config:n}=t,a=e,s=n;if(r.afterRequest){let{data:l,config:C}=r.afterRequest(t,r);a=l,s=C}let o=f({},d,r.alias?.());if(u(t.config),a[o.code]===401)return R("REQUEST",i(a,o),r);if(T.delete(c),s.responseType==="blob"){let l=await p(a);return l.code===200?i(l,o):R("REQUEST",l,r)}else return a[o.code]===r.successCode?Promise.resolve(i(a,o)):R("REQUEST",i(a,o),r)}export{T as a,b,h as c,R as d,D as e};
@@ -0,0 +1 @@
1
+ import{a as y}from"./chunk-SO3V4S32.mjs";import{h as m}from"./chunk-QHZ3NUSL.mjs";import{b as c,j as p,p as u,q as T}from"./chunk-OBAHJOMO.mjs";var h=(...t)=>t,x=(...t)=>t;function O(t){return Array.isArray(t)?t:[t]}function j(t=[],o="id",r="pid",s="children"){let a=[],i={},n=y(t);for(let e=0;e<n.length;e++)i[n[e][o]]=n[e];for(let e=0;e<n.length;e++)i[n[e][r]]&&n[e][o]!==n[e][r]?(i[n[e][r]][s]||(i[n[e][r]][s]=[]),i[n[e][r]][s].push(n[e])):a.push(n[e]);return a}function D(t,o){return t.map(r=>({label:r[o.label],value:r[o.value]}))}function E(t){return t.filter(o=>!u(o))}function f(t=[],o,r){let s={value:"value",children:"children",...m(r)},a=[],[i]=o,n=t.find(e=>e[s.value]===i);if(!u(i)&&!u(n)){let{[s.children]:e,...l}=n;return a.concat(l,...f(e??[],o.slice(1),s))}return a}function v(t=[],o="children"){let r=[],s=(a,i)=>{a.forEach(n=>{let{[i]:e,...l}=n;r.push(l),e&&s(e,i)})};return s(t,o),r}function N(t,o){return t.reduce((s,a)=>(s.find(n=>o.every(e=>n[e]===a[e]))||s.push(a),s),[])}function I(t,o=[]){return t.filter(r=>!o.includes(r))}function A(t,o=[]){return t.filter(r=>!o.some(a=>p(a)&&p(r)?T(a)?T(r):Object.entries(a).every(([i,n])=>n===r[i]):c(a)&&Number.isNaN(a)?c(r)&&Number.isNaN(r):r===a))}export{h as a,x as b,O as c,j as d,D as e,E as f,f as g,v as h,N as i,I as j,A as k};
@@ -0,0 +1 @@
1
+ import c from"axios";var t=new Map;function l(e){let{url:o,method:n,params:r,data:s,headers:p}=e,a=s,d=r;typeof s=="string"&&(a=JSON.parse(s)),typeof r=="string"&&(d=JSON.parse(r));let i=[],f=p?.["X-Cancel-Rule"];return f==="path"?i=[`\u8BF7\u6C42\u8DEF\u5F84:${o}`]:f==="method"?i=[`\u8BF7\u6C42\u8DEF\u5F84:${o}`,`\u8BF7\u6C42\u65B9\u6CD5:${n}`]:i=[`\u8BF7\u6C42\u8DEF\u5F84:${o}`,`\u8BF7\u6C42\u65B9\u6CD5:${n}`,`\u8BF7\u6C42PARAMS:${JSON.stringify(d)}`,`\u8BF7\u6C42DATA:${JSON.stringify(a)}`],i.join(";")}function g(e){if(!e.headers?.neverCancel){let o=l(e);e.cancelToken=new c.CancelToken(n=>{t.has(o)||t.set(o,n)})}}function u(e,o=!1){if(!e.headers?.["X-Never-Cancel"]||o){let n=l(e);if(t.has(n)){let r=t.get(n);r&&r(n),t.delete(n)}}}function A(e){u(e),g(e)}function x(){Array.from(t.keys()).forEach(e=>{t.get(e)&&t.get(e)(e),t.delete(e)})}export{t as a,g as b,u as c,A as d,x as e};
@@ -0,0 +1 @@
1
+ import{a as P,b as v,c as O}from"./chunk-WN7L4HYY.mjs";import{c as L}from"./chunk-SO3V4S32.mjs";import{A as m,k as S}from"./chunk-OBAHJOMO.mjs";function b(a,u){let l=a,d={timeout:5e3,allowPostOrigins:"",allowReceiveOrigins:""},w=()=>{d=L({},d,u)},e=new Map,o=()=>{if(l&&l?.contentWindow)return!0;throw new Error("iframe content not load!")},i=(t,s="default")=>({uuid:m(10),type:s,content:t}),f=t=>{if((d.allowReceiveOrigins?.split(",")??[]).some(n=>n==="*"||n===t.origin)){let n=t.data;n.uuid&&e.has(n.uuid)&&e.set(n.uuid,n.content)}},F=(t,s)=>{o();let n=s??l.src,g=d.allowPostOrigins?.split(",")??[];if(n&&g.some(c=>c==="*"||n.includes(c)))e.set(t.uuid,null),l.contentWindow?.postMessage(t,n);else throw new Error(`iframe[${n}]\u4E0D\u5728[configs.allowPostOrigins]\u8303\u56F4\u5185!`)},p=(t,s)=>new Promise((g,c)=>{try{let r=S(t)&&t.uuid?t:i(t);if(F(r,s),r.uuid)e.set(r.uuid,null);else throw new Error("\u6D88\u606F\u53D1\u9001\u5931\u8D25");let y=0,M=setInterval(()=>{let I=e.get(r.uuid);if(I!==null){clearInterval(M),e.delete(r.uuid),g(I);return}if(y+=10,y>=d.timeout)throw clearInterval(M),new Error("\u6D88\u606F\u56DE\u4F20\u8D85\u65F6!")},10)}catch(r){c(r)}}),T=async(t,s,n)=>{let g=null;try{let c=i(s,t);g=await p(c,n)}catch{g=null}return g},E=(t="",s)=>T("LocalStorage",t,s),h=(t="",s)=>T("SessionStorage",t,s),C=(t="",s)=>T("Cookie",t,s),D=()=>{o(),window.addEventListener("message",f)};return{load:()=>(w(),new Promise(t=>{l.onload=()=>{t(!0)},D()})),post:p,destory:()=>{window.removeEventListener("message",f)},getLocalStorage:E,getSessionStorage:h,getCookie:C,messageFormat:i}}async function G(a,u,l){if(window.top===window.self)throw new Error(`\u9875\u9762[${location.origin}]\u975Eiframe\u5D4C\u5165\u65B9\u5F0F, \u4E0D\u5141\u8BB8\u63A5\u6536message!`);if((l?.split(",")??[]).some(w=>w==="*"||w===a.origin)){let w=["default","LocalStorage","SessionStorage","Cookie"],e=a.data;if(e&&e.uuid&&w.includes(e.type)){let o=null;try{if(e.type==="LocalStorage"){let i=P(e.content?[e.content]:[]);e.content?o=i?.[e.content]:o=i}else if(e.type==="SessionStorage"){let i=v(e.content?[e.content]:[]);e.content?o=i?.[e.content]:o=i}else if(e.type==="Cookie"){let i=O(e.content?[e.content]:[]);e.content?o=i?.[e.content]:o=i}else u?o=await u(e.content):o=null;o===null&&(o=void 0)}catch{o=null}window.top&&window.top.postMessage({...e,content:o},a.origin)}}}function H(a,u){window.top&&window.top!==window.self&&window.top.postMessage({uuid:m(),content:a},u??window.top.origin)}export{b as a,G as b,H as c};
@@ -0,0 +1 @@
1
+ import{c as h,d as q,e as A}from"./chunk-2VDM4TPP.mjs";import{d as u,e as T,f as d}from"./chunk-PZZCLSIF.mjs";import{d as R}from"./chunk-G6V6TMDC.mjs";import{c as O,e as b}from"./chunk-44EYU7QJ.mjs";import{c}from"./chunk-SO3V4S32.mjs";import{b as g,f as l}from"./chunk-QHZ3NUSL.mjs";import{e as y,k as f}from"./chunk-OBAHJOMO.mjs";import P,{isCancel as x}from"axios";var C=class{options;instance;constructor(e){this.options=c({},R,e),this.instance=this.setupInterceptors(this.options)}setupInterceptors(e){let s=P.create(g(e,["basePath","allowCancel","allowNullValue","successCode","whiteUrl","alias","token","beforeRequest","afterRequest",401,"cancel","error"]));return s.interceptors.request.use(t=>h(t,this.options)),s.interceptors.response.use(t=>A(t,this.options),t=>q(x(t)?"CANCEL":"ERROR",t,this.options)),s}fetchLocalFile(e){return fetch((this.options.basePath??"")+e)}async get(e,s={},t){let{data:a}=await this.instance.get(e,{...t,params:s});return a}async post(e,s={},t){let{data:a}=await this.instance.post(e,s,t);return a}async postForm(e,s={},t){let a=l(s),{data:o}=await this.instance.post(e,a,c({},{headers:{"Content-Type":"multipart/form-data"},...t}));return o}async getPageRecords(e,s={},t={},a="GET",o,i){let n=a.toUpperCase()==="GET",r={...T(t,o),...s},{data:p}=await this.instance.request({...i,url:e,method:a,params:n?r:{...T(t,o)},data:n?{}:r});return d(p,o)}async getOptions(e,s={},t="GET",a,o,i=!0){let n=t.toUpperCase()==="GET",{data:r=[]}=await this.instance.request({...o,url:e,method:t,params:s,data:n?{}:s});if(y(r))return u(r,a,i);if(f(r)){let p=Object.entries(r).map(m=>({label:m[1],value:m[0]}));return u(p,void 0,i)}return[]}cancel(e){O(e,!0)}request(e){return this.instance.request(e)}destory(){b(),this.instance=null}};export{C as a};
@@ -0,0 +1 @@
1
+ function d(l){let e=l?.vnode?.el||l&&(l.$el||l);for(;e&&!e.tagName;)e=e.nextSibling;return e}var o=d;export{o as a};
@@ -0,0 +1 @@
1
+ import{a as o}from"./chunk-KGXCJWE5.mjs";function i(n){if(o()&&window.document.documentElement){let t=Array.isArray(n)?n:[n],{documentElement:r}=window.document;return t.some(e=>e in r.style)}return!1}function s(n,t){if(!i(n))return!1;let r=document.createElement("div"),e=r.style[n];return r.style[n]=t,r.style[n]!==e}function a(n,t){return!Array.isArray(n)&&t!==void 0?s(n,t):i(n)}export{a};
@@ -0,0 +1 @@
1
+ var e={data:"data",code:"code",msg:"msg"},a={label:"label",value:"value",json:"json"},s={pageSize:"pageSize",pageNo:"pageNo",total:"total",records:"records"},o={baseURL:"",timeout:60*1e3,basePath:"",allowCancel:!1,allowNullValue:!0,successCode:200,whiteUrl:()=>[],alias:()=>e,token:{key:"x-access-token",get:()=>""}},t=401;export{e as a,a as b,s as c,o as d,t as e};
@@ -0,0 +1 @@
1
+ export*from"axios";
@@ -0,0 +1 @@
1
+ function i(e){e&&e.parentNode?.removeChild(e)}function s(e,r){let t=e.slice(1);return`rgba(${[Number.parseInt(`0x${t.slice(0,2)}`),Number.parseInt(`0x${t.slice(2,4)}`),Number.parseInt(`0x${t.slice(4,6)}`),r].toString()})`}function u(e,r){return e[r]??e.default}function c(e){return e.toString().replace(/\d+/,r=>r.replace(/(\d)(?=(\d{3})+$)/g,t=>`${t},`))}function a(e,...r){return new Promise((t,n)=>{if(typeof e!="function")return n(new Error("usePromise\u4F20\u5165\u7684\u7B2C\u4E00\u4E2A\u53C2\u6570\u5FC5\u987B\u4E3A\u51FD\u6570!"));try{let o=e(...r);o instanceof Promise?o.then(t,n):t(o)}catch(o){n(o)}})}async function p(e){return new Promise(r=>{fetch(e,{method:"HEAD"}).then(t=>{try{let n=t.headers.get("content-type")||"";r(n)}catch{r("")}}).catch(()=>{r("")})})}export{i as a,s as b,u as c,c as d,a as e,p as f};
@@ -0,0 +1 @@
1
+ import{d as o}from"./chunk-OBAHJOMO.mjs";async function n(e=0){return new Promise(i=>{let t=setTimeout(()=>{i(!0),clearTimeout(t)},e)})}async function a(e,i){await n(i?.delay),e&&o(e)&&e()}export{n as a,a as b};
@@ -0,0 +1 @@
1
+ var i=t=>typeof t=="string",s=t=>typeof t=="number";function c(t){return typeof t=="boolean"}var g=t=>typeof t=="function",p=t=>Array.isArray(t);function a(t){return typeof t>"u"}var x=t=>typeof t<"u",u=t=>t===null,l=t=>typeof t=="symbol",m=t=>Object.prototype.toString.call(t)==="[object Object]",y=t=>Object.prototype.toString.call(t)==="[object Object]";function T(t){return Object.prototype.toString.call(t)==="[object Date]"}function j(t){return i(t)||s(t)||c(t)||l(t)||a(t)||u(t)}function w(t){return/^(?:https?|mailto|tel|file):/.test(t)}function h(t,n=!0){return n&&t===void 0||t===null||t==="null"}function f(t){return t==null||t===""||typeof t=="number"&&Number.isNaN(t)}function O(t){return!t||Object.getOwnPropertyNames(t).length===0}function b(t=[]){return Array.isArray(t)&&!t.length}function k(t=[]){return Array.isArray(t)?b(t)||t.every(n=>f(n)):!1}function D(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function d(t){return(t.match(/\.([^.]+)$/)?.[1]??"\u672A\u77E5").toUpperCase()}function N(t,n,e){return t.replace(new RegExp(`(.*)${n}`),`$1${e}`)}function A(t,n,e){return t.replace(new RegExp(n,"g"),e)}function S(t){return t&&t>0?t:0}function E(t,n){let e=null;try{t&&i(t)&&(e=JSON.parse(t))}catch{n?e=n:e={}}return e}function M(t){let n="";try{n&&(p(t)||y(t))&&(n=JSON.stringify(n))}catch{n=""}return n}function F(t=10){let n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="",r=n.length;for(let o=0;o<t;o++)e+=n.charAt(Math.floor(Math.random()*r));return e}export{i as a,s as b,c,g as d,p as e,a as f,x as g,u as h,l as i,m as j,y as k,T as l,j as m,w as n,h as o,f as p,O as q,b as r,k as s,D as t,d as u,N as v,A as w,S as x,E as y,M as z,F as A};
@@ -1 +1 @@
1
- import{a as r,e as o,j as c}from"./chunk-PWYR6CSX.mjs";function f(s){let n={},t=s.split(";");for(let e of t){if(!e)continue;let i=e.split(":");i[0]&&(n[i[0]]=i[1])}return n}function y(...s){if(s.length<1)return;let n={};for(let t of s)if(t)if(r(t))Object.assign(n,f(t));else if(o(t)){let e=y(...t);e&&Object.assign(n,e)}else c(t)&&Object.assign(n,t);return n}export{y as a};
1
+ import{a as r,e as o,k as c}from"./chunk-OBAHJOMO.mjs";function f(s){let n={},t=s.split(";");for(let e of t){if(!e)continue;let i=e.split(":");i[0]&&(n[i[0]]=i[1])}return n}function y(...s){if(s.length<1)return;let n={};for(let t of s)if(t)if(r(t))Object.assign(n,f(t));else if(o(t)){let e=y(...t);e&&Object.assign(n,e)}else c(t)&&Object.assign(n,t);return n}export{y as a};
@@ -0,0 +1 @@
1
+ function u(t){document.title=t}function i(t,e=1920,r=1080){let o=document.documentElement.clientWidth||document.body.clientWidth||e,n=window.screen.height||document.body.clientHeight||e,c=e/r;return o/n/c*t}function d(){let t=document.querySelectorAll("[style*=z-index]"),e=0;return t.forEach(r=>{let o=window.getComputedStyle(r).zIndex;if(o!=="auto"){let n=Number.parseInt(o,10);!Number.isNaN(n)&&n>e&&(e=n)}}),e+1}export{u as a,i as b,d as c};
@@ -0,0 +1 @@
1
+ import{a as O,b as c,c as n}from"./chunk-G6V6TMDC.mjs";import{i as g}from"./chunk-3FEUM3RZ.mjs";import{a as l,b as i,c as T,j as u,p as f}from"./chunk-OBAHJOMO.mjs";function A(a={}){return Object.keys(a).sort().reduce((t,e)=>(t[e]=a[e],t),{})}function d(a={}){return Object.keys(a).reduce((s,t)=>{let e=a[t];return f(e)||(i(e)&&String(e).length>=15?s[t]=String(e):s[t]=e),s},{})}function S(a,s=O){let{code:t="code",data:e="data",msg:r="msg"}=s;return{data:a[e],msg:a[r],code:a[t]}}function b(a,s=c,t=!0){let{label:e="label",value:r="value",json:m="json"}=s,y=a.reduce((p,o)=>(u(o)?p.push({label:o[e],value:o[r],json:o[m]??o}):(i(o)||l(o)||T(o))&&p.push({label:o,value:o,json:{}}),p),[]);return t?g(y,["value"]):y}function j(a={pageSize:10,pageNo:1},s=n){return Object.keys(a).reduce((t,e)=>(t[s[e]]=a[e],t),{})}function v(a,s=n){let{records:t="records",total:e="total"}=s;return{records:a[t]??[],total:a[e]??0}}export{A as a,d as b,S as c,b as d,j as e,v as f};
@@ -0,0 +1 @@
1
+ import{a as i,p as o}from"./chunk-OBAHJOMO.mjs";function p(t,e=[],r){if(t==null)return r||t;let a=Object.getOwnPropertyNames(t).reduce((s,c)=>(e.includes(c)&&(s[c]=t[c]),s),{});return Object.assign(a,r)}function y(t,e=[],r){if(t==null)return r||t;let a=Object.getOwnPropertyNames(t).reduce((s,c)=>(e.includes(c)||(s[c]=t[c]),s),{});return Object.assign(a,r)}function f(t={},e=!0){let r=Object.keys(t).sort();return e||r.reverse(),r.reduce((n,a)=>(n[a]=t[a],n),{})}function O(t={}){return Object.entries(t).reduce((e,[r,n])=>(o(n)||e.push(`${r}=${n}`),e),[]).join("&")}function d(t){if(!i(t))return{};let e=t.trim();if(e[0]==="?")e=e.slice(1);else if(e.indexOf("http")===0)try{let n=new URL(e);e=n.search?n.search.slice(1):""}catch(n){console.error("\u4F20\u5165\u7684[url]\u683C\u5F0F\u9519\u8BEF: ",n)}if(!e)return{};let r=new URLSearchParams(e);return Array.from(r.entries()).reduce((n,[a,s])=>(n[a]=s,n),{})}function T(t={}){let e=new FormData;return Object.entries(t).forEach(([r,n])=>{e.append(r,n)}),e}function j(t){let e={};for(let[r,n]of t.entries())e[r]=n;return e}function b(t={}){return Object.entries(t).reduce((e,[r,n])=>(o(n)||(e[r]=n),e),{})}function D(t,e){return Object.keys(e).reduce((r,n)=>(r[n]=t[n],r),{})}function m(t,e){return e.every(r=>Reflect.has(t,r))}function x(t,e){return Object.entries(e).reduce((r,[n,a])=>(r[n]=t[a],r),{})}export{p as a,y as b,f as c,O as d,d as e,T as f,j as g,b as h,D as i,m as j,x as k};
@@ -0,0 +1 @@
1
+ var i=/margin|padding|width|height|max|min|offset/,l={left:!0,top:!0},r={cssFloat:1,styleFloat:1,float:1};function s(e){return e.nodeType===1?e.ownerDocument.defaultView.getComputedStyle(e,null):{}}function u(e,t,n){if(t=t.toLowerCase(),n==="auto"){if(t==="height")return e.offsetHeight;if(t==="width")return e.offsetWidth}return t in l||(l[t]=i.test(t)),l[t]?Number.parseFloat(n)||0:n}function f(e,t){let n=arguments.length,o=s(e);return t=r[t]?"cssFloat"in e.style?"cssFloat":"styleFloat":t,n===1?o:u(e,t,o[t]||e.style[t])}function d(e,t,n){let o=arguments.length;if(t=r[t]?"cssFloat"in e.style?"cssFloat":"styleFloat":t,o===3)return typeof n=="number"&&i.test(t)&&(n=`${n}px`),e.style[t]=n,n;for(let c in t)t.hasOwnProperty(c)&&d(e,c,t[c]);return s(e)}function m(e){return e===document.body?document.documentElement.clientWidth:e.offsetWidth}function g(e){return e===document.body?window.innerHeight||document.documentElement.clientHeight:e.offsetHeight}function h(){let e=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),t=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:e,height:t}}function a(){let e=document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{width:e,height:t}}function y(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function p(e){let t=e.getBoundingClientRect(),n=document.documentElement;return{left:t.left+(window.pageXOffset||n.scrollLeft)-(n.clientLeft||document.body.clientLeft||0),top:t.top+(window.pageYOffset||n.scrollTop)-(n.clientTop||document.body.clientTop||0)}}export{f as a,d as b,m as c,g as d,h as e,a as f,y as g,p as h};
@@ -0,0 +1 @@
1
+ function l(n,c=4){let u=[],i=1048576*c,e=0;for(;e<n.size;){let s=n.slice(e,e+i);u.push({file:s,size:s.size,index:e/i}),e+=i}return u}export{l as a};
@@ -0,0 +1 @@
1
+ import{a as o}from"./chunk-6DX7ZFGR.mjs";import{ref as n,unref as p}from"vue";function l(t=3e3){let e=n(!1);return{copied:e,copy:r=>{let i=p(r);o(i).then(()=>{e.value=!0;let f=setTimeout(()=>{e.value=!1,clearTimeout(f)},t)})}}}export{l as a};
@@ -0,0 +1 @@
1
+ function o(e){return new Promise(s=>{let a=new FileReader;a.readAsText(e);let t={code:200,data:null,msg:""};a.onloadend=()=>{e.type==="application/json"?t=JSON.parse(a.result):t.data=e,s(t)}})}export{o as a};
File without changes
@@ -0,0 +1 @@
1
+ function s(r=[]){return localStorage?r.length?r.reduce((t,e)=>(t[e]=localStorage.getItem(e),t),{}):Object.keys(localStorage).reduce((t,e)=>(t[e]=localStorage.getItem(e),t),{}):r.length===1?null:{}}function l(r=[]){return sessionStorage?sessionStorage?r.length?r.reduce((t,e)=>(t[e]=sessionStorage.getItem(e),t),{}):Object.keys(sessionStorage).reduce((t,e)=>(t[e]=sessionStorage.getItem(e),t),{}):null:r.length===1?null:{}}function c(r=[]){if(document.cookie){let t=document.cookie.split("; ").reduce((e,n)=>{let[o="",a=""]=n.split("=").map(decodeURIComponent);return e[o]=a,e},{});return r.length?r.reduce((e,n)=>(e[n]=t[n],e),{}):t}else return r.length===1?null:{}}export{s as a,l as b,c};
@@ -4,7 +4,7 @@
4
4
  * @return {*}
5
5
  * @autor: 刘 相卿
6
6
  */
7
- declare const setDocumentTitle: (title: string) => void;
7
+ declare function setDocumentTitle(title: string): void;
8
8
  /**
9
9
  * @description: 动态计算px
10
10
  * @param {number} px 原始px数值
@@ -13,12 +13,12 @@ declare const setDocumentTitle: (title: string) => void;
13
13
  * @return {*}
14
14
  * @autor: 刘 相卿
15
15
  */
16
- declare const getPx: (px: number, width?: number, height?: number) => number;
16
+ declare function getPx(px: number, width?: number, height?: number): number;
17
17
  /**
18
18
  * @description: 获取页面中最大的z-index并+1
19
19
  * @return {number} zIndex 最大的index
20
20
  * @autor: 刘 相卿
21
21
  */
22
- declare const getMaxZIndex: () => number;
22
+ declare function getMaxZIndex(): number;
23
23
 
24
24
  export { getMaxZIndex, getPx, setDocumentTitle };
package/dist/dom/base.js CHANGED
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var m=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},l=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of i(e))!s.call(t,n)&&n!==o&&c(t,n,{get:()=>e[n],enumerable:!(r=u(e,n))||r.enumerable});return t};var x=t=>l(c({},"__esModule",{value:!0}),t);var p={};m(p,{getMaxZIndex:()=>g,getPx:()=>b,setDocumentTitle:()=>a});module.exports=x(p);var a=t=>{document.title=t},b=(t,e=1920,o=1080)=>{let r=document.documentElement.clientWidth||document.body.clientWidth||e,n=window.screen.height||document.body.clientHeight||e,d=e/o;return r/n/d*t},g=()=>{let t=document.querySelectorAll("[style*=z-index]"),e=0;return t.forEach(o=>{let r=window.getComputedStyle(o).zIndex;if(r!=="auto"){let n=parseInt(r,10);!isNaN(n)&&n>e&&(e=n)}}),e+1};0&&(module.exports={getMaxZIndex,getPx,setDocumentTitle});
1
+ "use strict";var c=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},s=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of d(e))!m.call(t,n)&&n!==o&&c(t,n,{get:()=>e[n],enumerable:!(r=i(e,n))||r.enumerable});return t};var x=t=>s(c({},"__esModule",{value:!0}),t);var g={};l(g,{getMaxZIndex:()=>f,getPx:()=>a,setDocumentTitle:()=>b});module.exports=x(g);function b(t){document.title=t}function a(t,e=1920,o=1080){let r=document.documentElement.clientWidth||document.body.clientWidth||e,n=window.screen.height||document.body.clientHeight||e,u=e/o;return r/n/u*t}function f(){let t=document.querySelectorAll("[style*=z-index]"),e=0;return t.forEach(o=>{let r=window.getComputedStyle(o).zIndex;if(r!=="auto"){let n=Number.parseInt(r,10);!Number.isNaN(n)&&n>e&&(e=n)}}),e+1}0&&(module.exports={getMaxZIndex,getPx,setDocumentTitle});
package/dist/dom/base.mjs CHANGED
@@ -1 +1 @@
1
- var d=t=>{document.title=t},u=(t,e=1920,r=1080)=>{let o=document.documentElement.clientWidth||document.body.clientWidth||e,n=window.screen.height||document.body.clientHeight||e,c=e/r;return o/n/c*t},i=()=>{let t=document.querySelectorAll("[style*=z-index]"),e=0;return t.forEach(r=>{let o=window.getComputedStyle(r).zIndex;if(o!=="auto"){let n=parseInt(o,10);!isNaN(n)&&n>e&&(e=n)}}),e+1};export{i as getMaxZIndex,u as getPx,d as setDocumentTitle};
1
+ import{a,b,c}from"../chunk-PE3DNHCL.mjs";export{c as getMaxZIndex,b as getPx,a as setDocumentTitle};
package/dist/dom/css.js CHANGED
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var h=(e,t)=>{for(var n in t)l(e,n,{get:t[n],enumerable:!0})},a=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of m(t))!g.call(e,o)&&o!==n&&l(e,o,{get:()=>t[o],enumerable:!(c=f(t,o))||c.enumerable});return e};var y=e=>a(l({},"__esModule",{value:!0}),e);var F={};h(F,{getClientSize:()=>T,getCss:()=>x,getDocSize:()=>H,getOffset:()=>L,getOuterHeight:()=>E,getOuterWidth:()=>w,getScroll:()=>b,setCss:()=>d});module.exports=y(F);var r=/margin|padding|width|height|max|min|offset/,i={left:!0,top:!0},s={cssFloat:1,styleFloat:1,float:1};function u(e){return e.nodeType===1?e.ownerDocument.defaultView.getComputedStyle(e,null):{}}function p(e,t,n){if(t=t.toLowerCase(),n==="auto"){if(t==="height")return e.offsetHeight;if(t==="width")return e.offsetWidth}return t in i||(i[t]=r.test(t)),i[t]?parseFloat(n)||0:n}function x(e,t){let n=arguments.length,c=u(e);return t=s[t]?"cssFloat"in e.style?"cssFloat":"styleFloat":t,n===1?c:p(e,t,c[t]||e.style[t])}function d(e,t,n){let c=arguments.length;if(t=s[t]?"cssFloat"in e.style?"cssFloat":"styleFloat":t,c===3)return typeof n=="number"&&r.test(t)&&(n=`${n}px`),e.style[t]=n,n;for(let o in t)t.hasOwnProperty(o)&&d(e,o,t[o]);return u(e)}function w(e){return e===document.body?document.documentElement.clientWidth:e.offsetWidth}function E(e){return e===document.body?window.innerHeight||document.documentElement.clientHeight:e.offsetHeight}function H(){let e=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),t=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:e,height:t}}function T(){let e=document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{width:e,height:t}}function b(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function L(e){let t=e.getBoundingClientRect(),n=document.documentElement;return{left:t.left+(window.pageXOffset||n.scrollLeft)-(n.clientLeft||document.body.clientLeft||0),top:t.top+(window.pageYOffset||n.scrollTop)-(n.clientTop||document.body.clientTop||0)}}0&&(module.exports={getClientSize,getCss,getDocSize,getOffset,getOuterHeight,getOuterWidth,getScroll,setCss});
1
+ "use strict";var l=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var h=(e,t)=>{for(var n in t)l(e,n,{get:t[n],enumerable:!0})},a=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of m(t))!g.call(e,o)&&o!==n&&l(e,o,{get:()=>t[o],enumerable:!(c=f(t,o))||c.enumerable});return e};var y=e=>a(l({},"__esModule",{value:!0}),e);var F={};h(F,{getClientSize:()=>H,getCss:()=>x,getDocSize:()=>b,getOffset:()=>L,getOuterHeight:()=>E,getOuterWidth:()=>w,getScroll:()=>T,setCss:()=>d});module.exports=y(F);var r=/margin|padding|width|height|max|min|offset/,i={left:!0,top:!0},s={cssFloat:1,styleFloat:1,float:1};function u(e){return e.nodeType===1?e.ownerDocument.defaultView.getComputedStyle(e,null):{}}function p(e,t,n){if(t=t.toLowerCase(),n==="auto"){if(t==="height")return e.offsetHeight;if(t==="width")return e.offsetWidth}return t in i||(i[t]=r.test(t)),i[t]?Number.parseFloat(n)||0:n}function x(e,t){let n=arguments.length,c=u(e);return t=s[t]?"cssFloat"in e.style?"cssFloat":"styleFloat":t,n===1?c:p(e,t,c[t]||e.style[t])}function d(e,t,n){let c=arguments.length;if(t=s[t]?"cssFloat"in e.style?"cssFloat":"styleFloat":t,c===3)return typeof n=="number"&&r.test(t)&&(n=`${n}px`),e.style[t]=n,n;for(let o in t)t.hasOwnProperty(o)&&d(e,o,t[o]);return u(e)}function w(e){return e===document.body?document.documentElement.clientWidth:e.offsetWidth}function E(e){return e===document.body?window.innerHeight||document.documentElement.clientHeight:e.offsetHeight}function b(){let e=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),t=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:e,height:t}}function H(){let e=document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{width:e,height:t}}function T(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function L(e){let t=e.getBoundingClientRect(),n=document.documentElement;return{left:t.left+(window.pageXOffset||n.scrollLeft)-(n.clientLeft||document.body.clientLeft||0),top:t.top+(window.pageYOffset||n.scrollTop)-(n.clientTop||document.body.clientTop||0)}}0&&(module.exports={getClientSize,getCss,getDocSize,getOffset,getOuterHeight,getOuterWidth,getScroll,setCss});
package/dist/dom/css.mjs CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h}from"../chunk-UOQ77YOD.mjs";export{f as getClientSize,a as getCss,e as getDocSize,h as getOffset,d as getOuterHeight,c as getOuterWidth,g as getScroll,b as setCss};
1
+ import{a,b,c,d,e,f,g,h}from"../chunk-SAXMBV46.mjs";export{f as getClientSize,a as getCss,e as getDocSize,h as getOffset,d as getOuterHeight,c as getOuterWidth,g as getScroll,b as setCss};
@@ -1,3 +1,3 @@
1
- declare const findDOMNode: (instance: any) => any;
1
+ declare function findDOMNode(instance: any): any;
2
2
 
3
3
  export { findDOMNode as default };
@@ -1 +1 @@
1
- "use strict";var t=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var u=(l,e)=>{for(var o in e)t(l,o,{get:e[o],enumerable:!0})},x=(l,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of g(e))!n.call(l,d)&&d!==o&&t(l,d,{get:()=>e[d],enumerable:!(r=f(e,d))||r.enumerable});return l};var N=l=>x(t({},"__esModule",{value:!0}),l);var h={};u(h,{default:()=>b});module.exports=N(h);var a=l=>{let e=l?.vnode?.el||l&&(l.$el||l);for(;e&&!e.tagName;)e=e.nextSibling;return e},b=a;
1
+ "use strict";var t=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var r=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var g=(l,e)=>{for(var o in e)t(l,o,{get:e[o],enumerable:!0})},i=(l,e,o,f)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of r(e))!u.call(l,d)&&d!==o&&t(l,d,{get:()=>e[d],enumerable:!(f=n(e,d))||f.enumerable});return l};var x=l=>i(t({},"__esModule",{value:!0}),l);var b={};g(b,{default:()=>a});module.exports=x(b);function N(l){let e=l?.vnode?.el||l&&(l.$el||l);for(;e&&!e.tagName;)e=e.nextSibling;return e}var a=N;
@@ -1 +1 @@
1
- import{a}from"../chunk-AHENZTBD.mjs";export{a as default};
1
+ import{a}from"../chunk-DKKF6DRJ.mjs";export{a as default};
@@ -0,0 +1,57 @@
1
+ type AllowMessageType = 'default' | 'LocalStorage' | 'SessionStorage' | 'Cookie';
2
+ /**
3
+ * @description: 配置类型
4
+ * @param {number} timeout 消息回传超时时间(单位毫秒 默认5000ms)
5
+ * @param {string} allowPostOrigins 允许发送消息的origin 多个用半角逗号分隔[,] 默认为空
6
+ * @param {string} allowReceiveOrigins 允许接收消息的origin 多个用半角逗号分隔[,](永远都不会接收自己页面的message) 默认为空
7
+ * @autor: 刘 相卿
8
+ */
9
+ interface IFrameUtilConfig {
10
+ timeout?: number;
11
+ allowPostOrigins?: string;
12
+ allowReceiveOrigins?: string;
13
+ }
14
+ interface IFrameMessageDataType<T = any> {
15
+ uuid: string;
16
+ type: AllowMessageType;
17
+ content: T;
18
+ }
19
+ /**
20
+ * @description: iframe消息发送hook
21
+ * 应用于父页面
22
+ * 父页面必须通过发消息才能与嵌套的iframe建立通信
23
+ * 不可直接调用iframe的内容
24
+ * @param {HTMLIFrameElement} element
25
+ * @param {IFrameUtilConfig} configs 可选项
26
+ * @return {*}
27
+ * @autor: 刘 相卿
28
+ */
29
+ declare function iframePostHook(element: HTMLIFrameElement, configs?: IFrameUtilConfig): {
30
+ load: () => Promise<boolean>;
31
+ post: <T = any>(data: T | IFrameMessageDataType<T>, origin?: string) => Promise<T>;
32
+ destory: () => void;
33
+ getLocalStorage: <T_1>(key?: string, origin?: string) => Promise<T_1 | null>;
34
+ getSessionStorage: <T_2>(key?: string, origin?: string) => Promise<T_2 | null>;
35
+ getCookie: <T_3>(key?: string, origin?: string) => Promise<T_3 | null>;
36
+ messageFormat: <T_4 = any>(content: T_4, type?: AllowMessageType) => IFrameMessageDataType<T_4>;
37
+ };
38
+ /**
39
+ * @description: iframe消息接收hook
40
+ * 应用于以frame方式嵌入的页面 非iframe嵌入方式不可使用
41
+ * @param {IFrameUtilConfig} messageEvent
42
+ * @param {(data: any) => T | Promise<T>} callback 可选项
43
+ * @param {IFrameUtilConfig} allowOrigins 允许接收消息的origin 多个用半角逗号分隔[,](永远都不会接收自己页面的message)
44
+ * @return {*}
45
+ * @autor: 刘 相卿
46
+ */
47
+ declare function iframeReceiveHook<T = any>(messageEvent: MessageEvent<IFrameMessageDataType<any>>, callback?: (data: any) => T | Promise<T>, allowOrigins?: string): Promise<void>;
48
+ /**
49
+ * @description: 向父级发送消息
50
+ * @param {any} content
51
+ * @param {string} origin
52
+ * @return {*}
53
+ * @autor: 刘 相卿
54
+ */
55
+ declare function postMessage2Top(content: any, origin?: string): void;
56
+
57
+ export { AllowMessageType, IFrameMessageDataType, IFrameUtilConfig, iframePostHook, iframeReceiveHook, postMessage2Top };
@@ -0,0 +1 @@
1
+ "use strict";var N=Object.create;var y=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var $=(e,n)=>{for(var t in n)y(e,t,{get:n[t],enumerable:!0})},D=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of F(n))!U.call(e,s)&&s!==t&&y(e,s,{get:()=>n[s],enumerable:!(i=R(n,s))||i.enumerable});return e};var m=(e,n,t)=>(t=e!=null?N(C(e)):{},D(n||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e)),G=e=>D(y({},"__esModule",{value:!0}),e);var q={};$(q,{iframePostHook:()=>J,iframeReceiveHook:()=>W,postMessage2Top:()=>_});module.exports=G(q);var j=e=>Object.prototype.toString.call(e)==="[object Object]";function T(e=10){let n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="",i=n.length;for(let s=0;s<e;s++)t+=n.charAt(Math.floor(Math.random()*i));return t}var H=m(require("lodash.clonedeep")),V=m(require("lodash.debounce")),w=m(require("lodash.merge")),B=m(require("lodash.clone"));function M(e=[]){return localStorage?e.length?e.reduce((n,t)=>(n[t]=localStorage.getItem(t),n),{}):Object.keys(localStorage).reduce((n,t)=>(n[t]=localStorage.getItem(t),n),{}):e.length===1?null:{}}function I(e=[]){return sessionStorage?sessionStorage?e.length?e.reduce((n,t)=>(n[t]=sessionStorage.getItem(t),n),{}):Object.keys(sessionStorage).reduce((n,t)=>(n[t]=sessionStorage.getItem(t),n),{}):null:e.length===1?null:{}}function L(e=[]){if(document.cookie){let n=document.cookie.split("; ").reduce((t,i)=>{let[s="",o=""]=i.split("=").map(decodeURIComponent);return t[s]=o,t},{});return e.length?e.reduce((t,i)=>(t[i]=n[i],t),{}):n}else return e.length===1?null:{}}function J(e,n){let t=e,i={timeout:5e3,allowPostOrigins:"",allowReceiveOrigins:""},s=()=>{i=(0,w.default)({},i,n)},o=new Map,a=()=>{if(t&&t?.contentWindow)return!0;throw new Error("iframe content not load!")},u=(r,c="default")=>({uuid:T(10),type:c,content:r}),b=r=>{if((i.allowReceiveOrigins?.split(",")??[]).some(l=>l==="*"||l===r.origin)){let l=r.data;l.uuid&&o.has(l.uuid)&&o.set(l.uuid,l.content)}},P=(r,c)=>{a();let l=c??t.src,p=i.allowPostOrigins?.split(",")??[];if(l&&p.some(f=>f==="*"||l.includes(f)))o.set(r.uuid,null),t.contentWindow?.postMessage(r,l);else throw new Error(`iframe[${l}]\u4E0D\u5728[configs.allowPostOrigins]\u8303\u56F4\u5185!`)},x=(r,c)=>new Promise((p,f)=>{try{let g=j(r)&&r.uuid?r:u(r);if(P(g,c),g.uuid)o.set(g.uuid,null);else throw new Error("\u6D88\u606F\u53D1\u9001\u5931\u8D25");let O=0,S=setInterval(()=>{let h=o.get(g.uuid);if(h!==null){clearInterval(S),o.delete(g.uuid),p(h);return}if(O+=10,O>=i.timeout)throw clearInterval(S),new Error("\u6D88\u606F\u56DE\u4F20\u8D85\u65F6!")},10)}catch(g){f(g)}}),d=async(r,c,l)=>{let p=null;try{let f=u(c,r);p=await x(f,l)}catch{p=null}return p},k=(r="",c)=>d("LocalStorage",r,c),v=(r="",c)=>d("SessionStorage",r,c),A=(r="",c)=>d("Cookie",r,c),E=()=>{a(),window.addEventListener("message",b)};return{load:()=>(s(),new Promise(r=>{t.onload=()=>{r(!0)},E()})),post:x,destory:()=>{window.removeEventListener("message",b)},getLocalStorage:k,getSessionStorage:v,getCookie:A,messageFormat:u}}async function W(e,n,t){if(window.top===window.self)throw new Error(`\u9875\u9762[${location.origin}]\u975Eiframe\u5D4C\u5165\u65B9\u5F0F, \u4E0D\u5141\u8BB8\u63A5\u6536message!`);if((t?.split(",")??[]).some(s=>s==="*"||s===e.origin)){let s=["default","LocalStorage","SessionStorage","Cookie"],o=e.data;if(o&&o.uuid&&s.includes(o.type)){let a=null;try{if(o.type==="LocalStorage"){let u=M(o.content?[o.content]:[]);o.content?a=u?.[o.content]:a=u}else if(o.type==="SessionStorage"){let u=I(o.content?[o.content]:[]);o.content?a=u?.[o.content]:a=u}else if(o.type==="Cookie"){let u=L(o.content?[o.content]:[]);o.content?a=u?.[o.content]:a=u}else n?a=await n(o.content):a=null;a===null&&(a=void 0)}catch{a=null}window.top&&window.top.postMessage({...o,content:a},e.origin)}}}function _(e,n){window.top&&window.top!==window.self&&window.top.postMessage({uuid:T(),content:e},n??window.top.origin)}0&&(module.exports={iframePostHook,iframeReceiveHook,postMessage2Top});
@@ -0,0 +1 @@
1
+ import{a,b,c}from"../chunk-BLMP4PDT.mjs";import"../chunk-WN7L4HYY.mjs";import"../chunk-SO3V4S32.mjs";import"../chunk-OBAHJOMO.mjs";export{a as iframePostHook,b as iframeReceiveHook,c as postMessage2Top};