@gx-design-vue/pro-utils 0.1.4 → 0.2.0-alpha.1

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 (171) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -2
  3. package/dist/array/index.d.ts +5 -0
  4. package/dist/array/index.js +6 -0
  5. package/dist/array/slice.d.ts +11 -0
  6. package/dist/array/slice.js +29 -0
  7. package/dist/array/sort.d.ts +41 -0
  8. package/dist/array/sort.js +65 -0
  9. package/dist/array/tree.d.ts +83 -0
  10. package/dist/array/tree.js +157 -0
  11. package/dist/array/unique.d.ts +12 -0
  12. package/dist/array/unique.js +14 -0
  13. package/dist/base64/index.d.ts +26 -0
  14. package/dist/base64/index.js +106 -0
  15. package/dist/class/index.d.ts +2 -0
  16. package/dist/class/index.js +3 -0
  17. package/dist/class/prefix.d.ts +25 -0
  18. package/dist/class/prefix.js +15 -0
  19. package/dist/clone/cloneDeep.d.ts +30 -0
  20. package/dist/clone/cloneDeep.js +35 -0
  21. package/dist/clone/cloneDeepWith.d.ts +14 -0
  22. package/dist/clone/cloneDeepWith.js +150 -0
  23. package/dist/clone/getTag.d.ts +10 -0
  24. package/dist/clone/getTag.js +13 -0
  25. package/dist/clone/index.d.ts +3 -0
  26. package/dist/clone/index.js +4 -0
  27. package/dist/clone/symbols.d.ts +10 -0
  28. package/dist/clone/symbols.js +13 -0
  29. package/dist/clone/tags.d.ts +47 -0
  30. package/dist/clone/tags.js +48 -0
  31. package/dist/dom/event.d.ts +21 -0
  32. package/dist/dom/event.js +26 -0
  33. package/dist/dom/index.d.ts +5 -0
  34. package/dist/dom/index.js +6 -0
  35. package/dist/dom/measure.d.ts +19 -0
  36. package/dist/dom/measure.js +42 -0
  37. package/dist/dom/raf.d.ts +14 -0
  38. package/dist/dom/raf.js +44 -0
  39. package/dist/dom/scroll.d.ts +20 -0
  40. package/dist/dom/scroll.js +97 -0
  41. package/dist/file/config.d.ts +13 -0
  42. package/dist/file/config.js +81 -0
  43. package/dist/file/convert.d.ts +41 -0
  44. package/dist/file/convert.js +69 -0
  45. package/dist/file/index.d.ts +5 -0
  46. package/dist/file/index.js +6 -0
  47. package/dist/file/media.d.ts +35 -0
  48. package/dist/file/media.js +161 -0
  49. package/dist/file/type.d.ts +25 -0
  50. package/dist/file/type.js +58 -0
  51. package/dist/function/copy.d.ts +12 -0
  52. package/dist/function/copy.js +13 -0
  53. package/dist/function/getValue.d.ts +12 -0
  54. package/dist/function/getValue.js +19 -0
  55. package/dist/function/index.d.ts +5 -0
  56. package/dist/function/index.js +6 -0
  57. package/dist/function/object.d.ts +24 -0
  58. package/dist/function/object.js +33 -0
  59. package/dist/function/run.d.ts +11 -0
  60. package/dist/function/run.js +15 -0
  61. package/dist/index.d.ts +59 -26
  62. package/dist/index.js +61 -0
  63. package/dist/is/base64.d.ts +17 -0
  64. package/dist/is/base64.js +27 -0
  65. package/dist/is/browser.d.ts +9 -0
  66. package/dist/is/browser.js +14 -0
  67. package/dist/is/deepEqual.d.ts +13 -0
  68. package/dist/is/deepEqual.js +62 -0
  69. package/dist/is/device.d.ts +21 -0
  70. package/dist/is/device.js +37 -0
  71. package/dist/is/equal.d.ts +12 -0
  72. package/dist/is/equal.js +34 -0
  73. package/dist/is/img.d.ts +10 -0
  74. package/dist/is/img.js +13 -0
  75. package/dist/is/index.d.ts +16 -0
  76. package/dist/is/index.js +17 -0
  77. package/dist/is/nil.d.ts +17 -0
  78. package/dist/is/nil.js +22 -0
  79. package/dist/is/plainObject.d.ts +17 -0
  80. package/dist/is/plainObject.js +30 -0
  81. package/dist/is/primitive.d.ts +10 -0
  82. package/dist/is/primitive.js +13 -0
  83. package/dist/is/server.d.ts +9 -0
  84. package/dist/is/server.js +10 -0
  85. package/dist/is/type.d.ts +60 -0
  86. package/dist/is/type.js +84 -0
  87. package/dist/is/typedArray.d.ts +30 -0
  88. package/dist/is/typedArray.js +33 -0
  89. package/dist/is/unsafeProperty.d.ts +10 -0
  90. package/dist/is/unsafeProperty.js +18 -0
  91. package/dist/is/url.d.ts +10 -0
  92. package/dist/is/url.js +20 -0
  93. package/dist/is/valid.d.ts +17 -0
  94. package/dist/is/valid.js +23 -0
  95. package/dist/merge/index.d.ts +19 -5
  96. package/dist/merge/index.js +42 -0
  97. package/dist/merge/mergeWith.d.ts +12 -0
  98. package/dist/merge/mergeWith.js +31 -0
  99. package/dist/merge/useDeepMege.d.ts +46 -0
  100. package/dist/merge/useDeepMege.js +56 -0
  101. package/dist/number/chinese.d.ts +10 -0
  102. package/dist/number/chinese.js +46 -0
  103. package/dist/number/format.d.ts +27 -0
  104. package/dist/number/format.js +72 -0
  105. package/dist/number/index.d.ts +3 -0
  106. package/dist/number/index.js +4 -0
  107. package/dist/object/classNames.d.ts +10 -0
  108. package/dist/object/classNames.js +30 -0
  109. package/dist/object/index.d.ts +5 -0
  110. package/dist/object/index.js +6 -0
  111. package/dist/object/omitBoolean.d.ts +10 -0
  112. package/dist/object/omitBoolean.js +13 -0
  113. package/dist/object/omitUndefined.d.ts +12 -0
  114. package/dist/object/omitUndefined.js +18 -0
  115. package/dist/object/omitUndefinedAndEmptyArr.d.ts +10 -0
  116. package/dist/object/omitUndefinedAndEmptyArr.js +19 -0
  117. package/dist/pro-utils.esm.js +948 -0
  118. package/dist/pro-utils.js +1 -0
  119. package/dist/string/duration.d.ts +10 -0
  120. package/dist/string/duration.js +25 -0
  121. package/dist/string/empty.d.ts +14 -0
  122. package/dist/string/empty.js +26 -0
  123. package/dist/string/index.d.ts +5 -0
  124. package/dist/string/index.js +6 -0
  125. package/dist/string/nanoid.d.ts +9 -0
  126. package/dist/string/nanoid.js +32 -0
  127. package/dist/string/uuid.d.ts +34 -0
  128. package/dist/string/uuid.js +57 -0
  129. package/dist/table/column.d.ts +27 -0
  130. package/dist/table/column.js +42 -0
  131. package/dist/table/index.d.ts +3 -0
  132. package/dist/table/index.js +4 -0
  133. package/dist/table/page.d.ts +13 -0
  134. package/dist/table/page.js +23 -0
  135. package/dist/typing.d.ts +262 -0
  136. package/dist/typing.js +1 -0
  137. package/dist/vue/index.d.ts +2 -0
  138. package/dist/vue/index.js +3 -0
  139. package/dist/vue/slots.d.ts +56 -0
  140. package/dist/vue/slots.js +89 -0
  141. package/package.json +45 -64
  142. package/dist/classNames/index.d.ts +0 -2
  143. package/dist/components/FieldLabel/index.d.ts +0 -77
  144. package/dist/components/FieldLabel/index.less +0 -107
  145. package/dist/components/LabelIconTip/index.d.ts +0 -20
  146. package/dist/components/LabelIconTip/index.less +0 -38
  147. package/dist/design/ant-design-theme.less +0 -4
  148. package/dist/design/ant-design-vue.less +0 -1
  149. package/dist/design/config.less +0 -2
  150. package/dist/isBrowser/index.d.ts +0 -1
  151. package/dist/isDeepEqualReact/index.d.ts +0 -1
  152. package/dist/isServer.d.ts +0 -2
  153. package/dist/omitBoolean/index.d.ts +0 -6
  154. package/dist/omitUndefined/index.d.ts +0 -5
  155. package/dist/pro-utils.es.js +0 -1044
  156. package/dist/pro-utils.umd.js +0 -1
  157. package/dist/proUtils.less +0 -4
  158. package/dist/scroll/easings.d.ts +0 -1
  159. package/dist/scroll/getScroll.d.ts +0 -2
  160. package/dist/scroll/index.d.ts +0 -4
  161. package/dist/scroll/raf.d.ts +0 -9
  162. package/dist/scroll/scrollTo.d.ts +0 -10
  163. package/dist/scroll/throttleByAnimationFrame.d.ts +0 -5
  164. package/dist/slots/index.d.ts +0 -9
  165. package/dist/style/index.less +0 -2
  166. package/dist/style.css +0 -1
  167. package/dist/style.less +0 -3
  168. package/dist/typings/index.d.ts +0 -30
  169. package/dist/utils/config.d.ts +0 -8
  170. package/dist/utils/index.d.ts +0 -208
  171. package/dist/utils/validate.d.ts +0 -25
@@ -0,0 +1,24 @@
1
+ //#region src/function/object.d.ts
2
+ /**
3
+ * 获取对象的 Symbol 属性
4
+ *
5
+ * @param object - 目标对象
6
+ * @returns Symbol 属性数组
7
+ */
8
+ declare function getSymbols(object: any): symbol[];
9
+ /**
10
+ * 遍历对象属性
11
+ *
12
+ * @param obj - 目标对象
13
+ * @param callback - 回调函数
14
+ */
15
+ declare function forInObject<T extends object>(obj: T, callback: (key: keyof T, value: T[keyof T]) => void): void;
16
+ /**
17
+ * 获取对象的所有键
18
+ *
19
+ * @param obj - 目标对象
20
+ * @returns 键数组
21
+ */
22
+ declare function keysOf<T extends object>(obj: T): (keyof T)[];
23
+ //#endregion
24
+ export { forInObject, getSymbols, keysOf };
@@ -0,0 +1,33 @@
1
+ //#region src/function/object.ts
2
+ /**
3
+ * 获取对象的 Symbol 属性
4
+ *
5
+ * @param object - 目标对象
6
+ * @returns Symbol 属性数组
7
+ */
8
+ function getSymbols(object) {
9
+ return Object.getOwnPropertySymbols(object);
10
+ }
11
+ /**
12
+ * 遍历对象属性
13
+ *
14
+ * @param obj - 目标对象
15
+ * @param callback - 回调函数
16
+ */
17
+ function forInObject(obj, callback) {
18
+ Object.keys(obj).forEach((key) => {
19
+ callback(key, obj[key]);
20
+ });
21
+ }
22
+ /**
23
+ * 获取对象的所有键
24
+ *
25
+ * @param obj - 目标对象
26
+ * @returns 键数组
27
+ */
28
+ function keysOf(obj) {
29
+ return Object.keys(obj);
30
+ }
31
+
32
+ //#endregion
33
+ export { forInObject, getSymbols, keysOf };
@@ -0,0 +1,11 @@
1
+ //#region src/function/run.d.ts
2
+ /**
3
+ * 如果值是函数则执行它,否则返回值
4
+ *
5
+ * @param valueEnum - 值或函数
6
+ * @param rest - 函数参数
7
+ * @returns 执行结果或原值
8
+ */
9
+ declare function runFunction<T extends any[]>(valueEnum: any, ...rest: T): any;
10
+ //#endregion
11
+ export { runFunction };
@@ -0,0 +1,15 @@
1
+ //#region src/function/run.ts
2
+ /**
3
+ * 如果值是函数则执行它,否则返回值
4
+ *
5
+ * @param valueEnum - 值或函数
6
+ * @param rest - 函数参数
7
+ * @returns 执行结果或原值
8
+ */
9
+ function runFunction(valueEnum, ...rest) {
10
+ if (typeof valueEnum === "function") return valueEnum(...rest);
11
+ return valueEnum;
12
+ }
13
+
14
+ //#endregion
15
+ export { runFunction };
package/dist/index.d.ts CHANGED
@@ -1,26 +1,59 @@
1
- import './design/config.less';
2
- import './design/ant-design-theme.less';
3
- import './design/ant-design-vue.less';
4
- import './style/index.less';
5
- import './proUtils.less';
6
- import './style.less';
7
- import isServer from './isServer';
8
- import { isScroll, getScrollContainer, isInContainer } from './scroll';
9
- import classNames from './classNames';
10
- import scrollTo from './scroll/scrollTo';
11
- import getScroll from './scroll/getScroll';
12
- import throttleByAnimationFrame from './scroll/throttleByAnimationFrame';
13
- import FieldLabel, { type FieldLabelProps } from './components/FieldLabel';
14
- import LabelIconTip, { type LabelTooltipType } from './components/LabelIconTip';
15
- import globalConfig from './utils/config';
16
- export * from './merge';
17
- export * from './isDeepEqualReact';
18
- export * from './isBrowser';
19
- export * from './omitBoolean';
20
- export * from './omitUndefined';
21
- export * from './slots';
22
- export * from './utils';
23
- export * from './utils/validate';
24
- export * from './typings';
25
- export type { LabelTooltipType, FieldLabelProps };
26
- export { isServer, globalConfig, FieldLabel, classNames, LabelIconTip, isScroll, isInContainer, getScrollContainer, scrollTo, getScroll, throttleByAnimationFrame };
1
+ import { arraySlice } from "./array/slice.js";
2
+ import { compareArray, compareArraySort, compareArrayTimeSort, compareTime } from "./array/sort.js";
3
+ import { AlignType, BasicTablePageConfig, Breakpoint, CustomRender, DeepPartial, EmptyEmit, ExtendIfDefined, Fn, LimitDeepPartial, MediaOptions, Nullable, OmitUndefined, RecordType, SemanticClassNames, SemanticStyles, SizeType, VueNode, WithFalse, WithIfDefault, WithRequired } from "./typing.js";
4
+ import { filterTree, findSourceByTree, findValueAndAncestors, getArrayLast, getLevelData, getMaxFloor, getSortIndex, treeData } from "./array/tree.js";
5
+ import { arrayUnique } from "./array/unique.js";
6
+ import "./array/index.js";
7
+ import { PrefixCls, getPrefixCls } from "./class/prefix.js";
8
+ import { cloneDeep } from "./clone/cloneDeep.js";
9
+ import { cloneDeepWith, cloneDeepWithImpl, copyProperties } from "./clone/cloneDeepWith.js";
10
+ import { off, on } from "./dom/event.js";
11
+ import { getTextWidth } from "./dom/measure.js";
12
+ import wrapperRaf from "./dom/raf.js";
13
+ import { ScrollToOptions, easeInOutCubic, getScroll, getScrollContainer, isInContainer, isScroll, isWindow, scrollTo } from "./dom/scroll.js";
14
+ import "./dom/index.js";
15
+ import { fileTypes } from "./file/config.js";
16
+ import { blobToDataURL, dataURLtoBlob, dataURLtoFile, getBase64, getBlobUrl } from "./file/convert.js";
17
+ import { generateVideoPicture, getMediaInfos, getVideoCoverPicture } from "./file/media.js";
18
+ import { checkFileType, getFileSuffix, getVideoFileUrl } from "./file/type.js";
19
+ import "./file/index.js";
20
+ import { deepCopy } from "./function/copy.js";
21
+ import { getValueFromObjectByKey } from "./function/getValue.js";
22
+ import { forInObject, getSymbols, keysOf } from "./function/object.js";
23
+ import { runFunction } from "./function/run.js";
24
+ import "./function/index.js";
25
+ import { isBase64, isDataURLBase64 } from "./is/base64.js";
26
+ import { isBrowser } from "./is/browser.js";
27
+ import { isDeepEqualReact } from "./is/deepEqual.js";
28
+ import { isMobile, isTablet, isWindowsOs } from "./is/device.js";
29
+ import { isEqual } from "./is/equal.js";
30
+ import { isImg } from "./is/img.js";
31
+ import { isNil, isNotNil } from "./is/nil.js";
32
+ import { isObjectWithSymbols, isPlainObject } from "./is/plainObject.js";
33
+ import { isPrimitive } from "./is/primitive.js";
34
+ import { isServer } from "./is/server.js";
35
+ import { is, isArray, isBoolean, isFunction, isJSONStr, isNumber, isObject, isString } from "./is/type.js";
36
+ import { isTypedArray } from "./is/typedArray.js";
37
+ import { isUnsafeProperty } from "./is/unsafeProperty.js";
38
+ import { isUrl } from "./is/url.js";
39
+ import { convertValueBoolean, isValid } from "./is/valid.js";
40
+ import { useDeepMerge } from "./merge/useDeepMege.js";
41
+ import { mergeWith } from "./merge/mergeWith.js";
42
+ import { deepMerge, merge } from "./merge/index.js";
43
+ import { toChinesNum } from "./number/chinese.js";
44
+ import { formatNumber, toConvertNumberShow } from "./number/format.js";
45
+ import classNames from "./object/classNames.js";
46
+ import { omitBoolean } from "./object/omitBoolean.js";
47
+ import { omitUndefined } from "./object/omitUndefined.js";
48
+ import { omitUndefinedAndEmptyArr } from "./object/omitUndefinedAndEmptyArr.js";
49
+ import "./object/index.js";
50
+ import { formatDuration } from "./string/duration.js";
51
+ import { handleEmptyField } from "./string/empty.js";
52
+ import { nanoid } from "./string/nanoid.js";
53
+ import { getRandomNumber } from "./string/uuid.js";
54
+ import { genColumnKey, handleShowIndex } from "./table/column.js";
55
+ import { handleCurrentPage } from "./table/page.js";
56
+ import "./table/index.js";
57
+ import { RenderResult, SlotsPropsResult, filterEmpty, getKeys, getSlot, getSlotVNode, getSlotsChildren, getSlotsProps, isEmptyElement, slotRender } from "./vue/slots.js";
58
+ import "./vue/index.js";
59
+ export { AlignType, BasicTablePageConfig, Breakpoint, CustomRender, DeepPartial, EmptyEmit, ExtendIfDefined, Fn, LimitDeepPartial, MediaOptions, Nullable, OmitUndefined, PrefixCls, RecordType, RenderResult, ScrollToOptions, SemanticClassNames, SemanticStyles, SizeType, SlotsPropsResult, VueNode, WithFalse, WithIfDefault, WithRequired, arraySlice, arrayUnique, blobToDataURL, checkFileType, classNames, cloneDeep, cloneDeepWith, cloneDeepWithImpl, compareArray, compareArraySort, compareArrayTimeSort, compareTime, convertValueBoolean, copyProperties, dataURLtoBlob, dataURLtoFile, deepCopy, deepMerge, easeInOutCubic, fileTypes, filterEmpty, filterTree, findSourceByTree, findValueAndAncestors, forInObject, formatDuration, formatNumber, genColumnKey, generateVideoPicture, getArrayLast, getBase64, getBlobUrl, getFileSuffix, getKeys, getLevelData, getMaxFloor, getMediaInfos, getPrefixCls, getRandomNumber, getScroll, getScrollContainer, getSlot, getSlotVNode, getSlotsChildren, getSlotsProps, getSortIndex, getSymbols, getTextWidth, getValueFromObjectByKey, getVideoCoverPicture, getVideoFileUrl, handleCurrentPage, handleEmptyField, handleShowIndex, is, isArray, isBase64, isBoolean, isBrowser, isDataURLBase64, isDeepEqualReact, isEmptyElement, isEqual, isFunction, isImg, isInContainer, isJSONStr, isMobile, isNil, isNotNil, isNumber, isObject, isObjectWithSymbols, isPlainObject, isPrimitive, isScroll, isServer, isString, isTablet, isTypedArray, isUnsafeProperty, isUrl, isValid, isWindow, isWindowsOs, keysOf, merge, mergeWith, nanoid, off, omitBoolean, omitUndefined, omitUndefinedAndEmptyArr, on, wrapperRaf as raf, runFunction, scrollTo, slotRender, toChinesNum, toConvertNumberShow, treeData, useDeepMerge };
package/dist/index.js ADDED
@@ -0,0 +1,61 @@
1
+ import { isBase64, isDataURLBase64 } from "./is/base64.js";
2
+ import { isBrowser } from "./is/browser.js";
3
+ import { isDeepEqualReact } from "./is/deepEqual.js";
4
+ import { isMobile, isTablet, isWindowsOs } from "./is/device.js";
5
+ import { isEqual } from "./is/equal.js";
6
+ import { isImg } from "./is/img.js";
7
+ import { isNil, isNotNil } from "./is/nil.js";
8
+ import { forInObject, getSymbols, keysOf } from "./function/object.js";
9
+ import { is, isArray, isBoolean, isFunction, isJSONStr, isNumber, isObject, isString } from "./is/type.js";
10
+ import { isObjectWithSymbols, isPlainObject } from "./is/plainObject.js";
11
+ import { isPrimitive } from "./is/primitive.js";
12
+ import { isServer } from "./is/server.js";
13
+ import { isTypedArray } from "./is/typedArray.js";
14
+ import { isUnsafeProperty } from "./is/unsafeProperty.js";
15
+ import { isUrl } from "./is/url.js";
16
+ import { convertValueBoolean, isValid } from "./is/valid.js";
17
+ import "./is/index.js";
18
+ import { arraySlice } from "./array/slice.js";
19
+ import { compareArray, compareArraySort, compareArrayTimeSort, compareTime } from "./array/sort.js";
20
+ import { filterTree, findSourceByTree, findValueAndAncestors, getArrayLast, getLevelData, getMaxFloor, getSortIndex, treeData } from "./array/tree.js";
21
+ import { arrayUnique } from "./array/unique.js";
22
+ import "./array/index.js";
23
+ import { getPrefixCls } from "./class/prefix.js";
24
+ import { cloneDeepWith, cloneDeepWithImpl, copyProperties } from "./clone/cloneDeepWith.js";
25
+ import { cloneDeep } from "./clone/cloneDeep.js";
26
+ import "./clone/index.js";
27
+ import { off, on } from "./dom/event.js";
28
+ import { getTextWidth } from "./dom/measure.js";
29
+ import wrapperRaf from "./dom/raf.js";
30
+ import { easeInOutCubic, getScroll, getScrollContainer, isInContainer, isScroll, isWindow, scrollTo } from "./dom/scroll.js";
31
+ import "./dom/index.js";
32
+ import { fileTypes } from "./file/config.js";
33
+ import { blobToDataURL, dataURLtoBlob, dataURLtoFile, getBase64, getBlobUrl } from "./file/convert.js";
34
+ import { checkFileType, getFileSuffix, getVideoFileUrl } from "./file/type.js";
35
+ import { generateVideoPicture, getMediaInfos, getVideoCoverPicture } from "./file/media.js";
36
+ import "./file/index.js";
37
+ import { deepCopy } from "./function/copy.js";
38
+ import { getValueFromObjectByKey } from "./function/getValue.js";
39
+ import { runFunction } from "./function/run.js";
40
+ import { mergeWith } from "./merge/mergeWith.js";
41
+ import { useDeepMerge } from "./merge/useDeepMege.js";
42
+ import { deepMerge, merge } from "./merge/index.js";
43
+ import { toChinesNum } from "./number/chinese.js";
44
+ import { formatNumber, toConvertNumberShow } from "./number/format.js";
45
+ import "./number/index.js";
46
+ import classNames_default from "./object/classNames.js";
47
+ import { omitBoolean } from "./object/omitBoolean.js";
48
+ import { omitUndefined } from "./object/omitUndefined.js";
49
+ import { omitUndefinedAndEmptyArr } from "./object/omitUndefinedAndEmptyArr.js";
50
+ import "./object/index.js";
51
+ import { formatDuration } from "./string/duration.js";
52
+ import { handleEmptyField } from "./string/empty.js";
53
+ import { nanoid } from "./string/nanoid.js";
54
+ import { getRandomNumber } from "./string/uuid.js";
55
+ import { genColumnKey, handleShowIndex } from "./table/column.js";
56
+ import { handleCurrentPage } from "./table/page.js";
57
+ import "./table/index.js";
58
+ import { filterEmpty, getKeys, getSlot, getSlotVNode, getSlotsChildren, getSlotsProps, isEmptyElement, slotRender } from "./vue/slots.js";
59
+ import "./vue/index.js";
60
+
61
+ export { arraySlice, arrayUnique, blobToDataURL, checkFileType, classNames_default as classNames, cloneDeep, cloneDeepWith, cloneDeepWithImpl, compareArray, compareArraySort, compareArrayTimeSort, compareTime, convertValueBoolean, copyProperties, dataURLtoBlob, dataURLtoFile, deepCopy, deepMerge, easeInOutCubic, fileTypes, filterEmpty, filterTree, findSourceByTree, findValueAndAncestors, forInObject, formatDuration, formatNumber, genColumnKey, generateVideoPicture, getArrayLast, getBase64, getBlobUrl, getFileSuffix, getKeys, getLevelData, getMaxFloor, getMediaInfos, getPrefixCls, getRandomNumber, getScroll, getScrollContainer, getSlot, getSlotVNode, getSlotsChildren, getSlotsProps, getSortIndex, getSymbols, getTextWidth, getValueFromObjectByKey, getVideoCoverPicture, getVideoFileUrl, handleCurrentPage, handleEmptyField, handleShowIndex, is, isArray, isBase64, isBoolean, isBrowser, isDataURLBase64, isDeepEqualReact, isEmptyElement, isEqual, isFunction, isImg, isInContainer, isJSONStr, isMobile, isNil, isNotNil, isNumber, isObject, isObjectWithSymbols, isPlainObject, isPrimitive, isScroll, isServer, isString, isTablet, isTypedArray, isUnsafeProperty, isUrl, isValid, isWindow, isWindowsOs, keysOf, merge, mergeWith, nanoid, off, omitBoolean, omitUndefined, omitUndefinedAndEmptyArr, on, wrapperRaf as raf, runFunction, scrollTo, slotRender, toChinesNum, toConvertNumberShow, treeData, useDeepMerge };
@@ -0,0 +1,17 @@
1
+ //#region src/is/base64.d.ts
2
+ /**
3
+ * 判断是否为 base64 编码的字符串
4
+ *
5
+ * @param str - 要判断的字符串
6
+ * @returns 是否为 base64 编码
7
+ */
8
+ declare function isBase64(str?: string): boolean;
9
+ /**
10
+ * 判断是否为 Data URL 格式的 base64 字符串
11
+ *
12
+ * @param str - 要判断的字符串
13
+ * @returns 是否为 Data URL 格式的 base64
14
+ */
15
+ declare function isDataURLBase64(str: string): boolean;
16
+ //#endregion
17
+ export { isBase64, isDataURLBase64 };
@@ -0,0 +1,27 @@
1
+ //#region src/is/base64.ts
2
+ /**
3
+ * 判断是否为 base64 编码的字符串
4
+ *
5
+ * @param str - 要判断的字符串
6
+ * @returns 是否为 base64 编码
7
+ */
8
+ function isBase64(str = "") {
9
+ if (str && [
10
+ "data:image/",
11
+ "data:video/",
12
+ "data:audio/"
13
+ ].find((item) => str.includes(item))) return true;
14
+ return false;
15
+ }
16
+ /**
17
+ * 判断是否为 Data URL 格式的 base64 字符串
18
+ *
19
+ * @param str - 要判断的字符串
20
+ * @returns 是否为 Data URL 格式的 base64
21
+ */
22
+ function isDataURLBase64(str) {
23
+ return typeof str === "string" && /^data:(?:image|video|audio)\/[A-Za-z]+;base64,[A-Za-z0-9+/=]+$/.test(str);
24
+ }
25
+
26
+ //#endregion
27
+ export { isBase64, isDataURLBase64 };
@@ -0,0 +1,9 @@
1
+ //#region src/is/browser.d.ts
2
+ /**
3
+ * 检查是否为浏览器环境
4
+ *
5
+ * @returns 是否为浏览器
6
+ */
7
+ declare function isBrowser(): boolean;
8
+ //#endregion
9
+ export { isBrowser };
@@ -0,0 +1,14 @@
1
+ //#region src/is/browser.ts
2
+ const isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
3
+ /**
4
+ * 检查是否为浏览器环境
5
+ *
6
+ * @returns 是否为浏览器
7
+ */
8
+ function isBrowser() {
9
+ if (process.env.NODE_ENV === "TEST") return true;
10
+ return typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.matchMedia !== "undefined" && !isNode;
11
+ }
12
+
13
+ //#endregion
14
+ export { isBrowser };
@@ -0,0 +1,13 @@
1
+ //#region src/is/deepEqual.d.ts
2
+ /**
3
+ * React 深度比较
4
+ *
5
+ * @param a - 第一个值
6
+ * @param b - 第二个值
7
+ * @param ignoreKeys - 忽略的键
8
+ * @param debug - 是否调试
9
+ * @returns 是否相等
10
+ */
11
+ declare function isDeepEqualReact(a: any, b: any, ignoreKeys?: string[], debug?: boolean): boolean;
12
+ //#endregion
13
+ export { isDeepEqualReact };
@@ -0,0 +1,62 @@
1
+ //#region src/is/deepEqual.ts
2
+ /**
3
+ * React 深度比较
4
+ *
5
+ * @param a - 第一个值
6
+ * @param b - 第二个值
7
+ * @param ignoreKeys - 忽略的键
8
+ * @param debug - 是否调试
9
+ * @returns 是否相等
10
+ */
11
+ function isDeepEqualReact(a, b, ignoreKeys, debug) {
12
+ if (a === b) return true;
13
+ if (a && b && typeof a === "object" && typeof b === "object") {
14
+ if (a.constructor !== b.constructor) return false;
15
+ let length;
16
+ let i;
17
+ if (Array.isArray(a)) {
18
+ length = a.length;
19
+ if (length != b.length) return false;
20
+ for (i = length; i-- !== 0;) if (!isDeepEqualReact(a[i], b[i], ignoreKeys, debug)) return false;
21
+ return true;
22
+ }
23
+ if (a instanceof Map && b instanceof Map) {
24
+ if (a.size !== b.size) return false;
25
+ for (i of a.entries()) if (!b.has(i[0])) return false;
26
+ for (i of a.entries()) if (!isDeepEqualReact(i[1], b.get(i[0]), ignoreKeys, debug)) return false;
27
+ return true;
28
+ }
29
+ if (a instanceof Set && b instanceof Set) {
30
+ if (a.size !== b.size) return false;
31
+ for (i of a.entries()) if (!b.has(i[0])) return false;
32
+ return true;
33
+ }
34
+ if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
35
+ length = a.length;
36
+ if (length != b.length) return false;
37
+ for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false;
38
+ return true;
39
+ }
40
+ if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
41
+ if (a.valueOf !== Object.prototype.valueOf && a.valueOf) return a.valueOf() === b.valueOf();
42
+ if (a.toString !== Object.prototype.toString && a.toString) return a.toString() === b.toString();
43
+ const keys = Object.keys(a);
44
+ length = keys.length;
45
+ if (length !== Object.keys(b).length) return false;
46
+ for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
47
+ for (i = length; i-- !== 0;) {
48
+ const key = keys[i];
49
+ if (ignoreKeys?.includes(key)) continue;
50
+ if (key === "_owner" && a.$$typeof) continue;
51
+ if (!isDeepEqualReact(a[key], b[key], ignoreKeys, debug)) {
52
+ if (debug) console.log(key);
53
+ return false;
54
+ }
55
+ }
56
+ return true;
57
+ }
58
+ return a !== a && b !== b;
59
+ }
60
+
61
+ //#endregion
62
+ export { isDeepEqualReact };
@@ -0,0 +1,21 @@
1
+ //#region src/is/device.d.ts
2
+ /**
3
+ * 判断是否为移动端
4
+ *
5
+ * @returns 是否为移动端
6
+ */
7
+ declare function isMobile(): boolean;
8
+ /**
9
+ * 判断是否为平板
10
+ *
11
+ * @returns 是否为平板
12
+ */
13
+ declare function isTablet(): boolean;
14
+ /**
15
+ * 检查当前运行环境是否为 Windows OS
16
+ *
17
+ * @returns 是否为 Windows 系统
18
+ */
19
+ declare function isWindowsOs(): boolean;
20
+ //#endregion
21
+ export { isMobile, isTablet, isWindowsOs };
@@ -0,0 +1,37 @@
1
+ //#region src/is/device.ts
2
+ /**
3
+ * 判断是否为移动端
4
+ *
5
+ * @returns 是否为移动端
6
+ */
7
+ function isMobile() {
8
+ const userAgent = navigator.userAgent || navigator.vendor;
9
+ if (/iPhone/.test(userAgent)) return true;
10
+ if (/Android/.test(userAgent) && /Mobile/.test(userAgent)) return true;
11
+ if (/Windows Phone/.test(userAgent)) return true;
12
+ if (/Mobile/.test(userAgent) && !isTablet()) return true;
13
+ return false;
14
+ }
15
+ /**
16
+ * 判断是否为平板
17
+ *
18
+ * @returns 是否为平板
19
+ */
20
+ function isTablet() {
21
+ const userAgent = navigator.userAgent || navigator.vendor;
22
+ if (/iPad/.test(userAgent)) return true;
23
+ if (/Macintosh/.test(userAgent) && "ontouchend" in document) return true;
24
+ if (/Android/.test(userAgent) && !/Mobile/.test(userAgent)) return true;
25
+ return false;
26
+ }
27
+ /**
28
+ * 检查当前运行环境是否为 Windows OS
29
+ *
30
+ * @returns 是否为 Windows 系统
31
+ */
32
+ function isWindowsOs() {
33
+ return /windows|win32/i.test(navigator.userAgent);
34
+ }
35
+
36
+ //#endregion
37
+ export { isMobile, isTablet, isWindowsOs };
@@ -0,0 +1,12 @@
1
+ //#region src/is/equal.d.ts
2
+ /**
3
+ * 深度比较两个对象
4
+ *
5
+ * @param obj1 - 第一个对象
6
+ * @param obj2 - 第二个对象
7
+ * @param shallow - 是否浅比较
8
+ * @returns 是否相等
9
+ */
10
+ declare function isEqual(obj1: any, obj2: any, shallow?: boolean): boolean;
11
+ //#endregion
12
+ export { isEqual };
@@ -0,0 +1,34 @@
1
+ //#region src/is/equal.ts
2
+ /**
3
+ * 深度比较两个对象
4
+ *
5
+ * @param obj1 - 第一个对象
6
+ * @param obj2 - 第二个对象
7
+ * @param shallow - 是否浅比较
8
+ * @returns 是否相等
9
+ */
10
+ function isEqual(obj1, obj2, shallow = false) {
11
+ const refSet = /* @__PURE__ */ new Set();
12
+ function deepEqual(a, b, level = 1) {
13
+ if (refSet.has(a)) return false;
14
+ if (a === b) return true;
15
+ if (shallow && level > 1) return false;
16
+ refSet.add(a);
17
+ const newLevel = level + 1;
18
+ if (Array.isArray(a)) {
19
+ if (!Array.isArray(b) || a.length !== b.length) return false;
20
+ for (let i = 0; i < a.length; i++) if (!deepEqual(a[i], b[i], newLevel)) return false;
21
+ return true;
22
+ }
23
+ if (a && b && typeof a === "object" && typeof b === "object") {
24
+ const keys = Object.keys(a);
25
+ if (keys.length !== Object.keys(b).length) return false;
26
+ return keys.every((key) => deepEqual(a[key], b[key], newLevel));
27
+ }
28
+ return false;
29
+ }
30
+ return deepEqual(obj1, obj2);
31
+ }
32
+
33
+ //#endregion
34
+ export { isEqual };
@@ -0,0 +1,10 @@
1
+ //#region src/is/img.d.ts
2
+ /**
3
+ * 判断是否是图片链接
4
+ *
5
+ * @param path - 图片路径
6
+ * @returns 是否为图片
7
+ */
8
+ declare function isImg(path: string): boolean;
9
+ //#endregion
10
+ export { isImg };
package/dist/is/img.js ADDED
@@ -0,0 +1,13 @@
1
+ //#region src/is/img.ts
2
+ /**
3
+ * 判断是否是图片链接
4
+ *
5
+ * @param path - 图片路径
6
+ * @returns 是否为图片
7
+ */
8
+ function isImg(path) {
9
+ return /\w.(?:png|jpg|jpeg|svg|webp|gif|bmp)$/i.test(path);
10
+ }
11
+
12
+ //#endregion
13
+ export { isImg };
@@ -0,0 +1,16 @@
1
+ import { isBase64, isDataURLBase64 } from "./base64.js";
2
+ import { isBrowser } from "./browser.js";
3
+ import { isDeepEqualReact } from "./deepEqual.js";
4
+ import { isMobile, isTablet, isWindowsOs } from "./device.js";
5
+ import { isEqual } from "./equal.js";
6
+ import { isImg } from "./img.js";
7
+ import { isNil, isNotNil } from "./nil.js";
8
+ import { isObjectWithSymbols, isPlainObject } from "./plainObject.js";
9
+ import { isPrimitive } from "./primitive.js";
10
+ import { isServer } from "./server.js";
11
+ import { is, isArray, isBoolean, isFunction, isJSONStr, isNumber, isObject, isString } from "./type.js";
12
+ import { isTypedArray } from "./typedArray.js";
13
+ import { isUnsafeProperty } from "./unsafeProperty.js";
14
+ import { isUrl } from "./url.js";
15
+ import { convertValueBoolean, isValid } from "./valid.js";
16
+ export { convertValueBoolean, is, isArray, isBase64, isBoolean, isBrowser, isDataURLBase64, isDeepEqualReact, isEqual, isFunction, isImg, isJSONStr, isMobile, isNil, isNotNil, isNumber, isObject, isObjectWithSymbols, isPlainObject, isPrimitive, isServer, isString, isTablet, isTypedArray, isUnsafeProperty, isUrl, isValid, isWindowsOs };
@@ -0,0 +1,17 @@
1
+ import { isBase64, isDataURLBase64 } from "./base64.js";
2
+ import { isBrowser } from "./browser.js";
3
+ import { isDeepEqualReact } from "./deepEqual.js";
4
+ import { isMobile, isTablet, isWindowsOs } from "./device.js";
5
+ import { isEqual } from "./equal.js";
6
+ import { isImg } from "./img.js";
7
+ import { isNil, isNotNil } from "./nil.js";
8
+ import { is, isArray, isBoolean, isFunction, isJSONStr, isNumber, isObject, isString } from "./type.js";
9
+ import { isObjectWithSymbols, isPlainObject } from "./plainObject.js";
10
+ import { isPrimitive } from "./primitive.js";
11
+ import { isServer } from "./server.js";
12
+ import { isTypedArray } from "./typedArray.js";
13
+ import { isUnsafeProperty } from "./unsafeProperty.js";
14
+ import { isUrl } from "./url.js";
15
+ import { convertValueBoolean, isValid } from "./valid.js";
16
+
17
+ export { convertValueBoolean, is, isArray, isBase64, isBoolean, isBrowser, isDataURLBase64, isDeepEqualReact, isEqual, isFunction, isImg, isJSONStr, isMobile, isNil, isNotNil, isNumber, isObject, isObjectWithSymbols, isPlainObject, isPrimitive, isServer, isString, isTablet, isTypedArray, isUnsafeProperty, isUrl, isValid, isWindowsOs };
@@ -0,0 +1,17 @@
1
+ //#region src/is/nil.d.ts
2
+ /**
3
+ * 判断值是否为 null 或 undefined
4
+ *
5
+ * @param val - 要判断的值
6
+ * @returns 是否为 null 或 undefined
7
+ */
8
+ declare function isNil<T>(val: T): val is Extract<T, null | undefined>;
9
+ /**
10
+ * 判断值是否不为 null 且不为 undefined
11
+ *
12
+ * @param val - 要判断的值
13
+ * @returns 是否不为 null 且不为 undefined
14
+ */
15
+ declare function isNotNil<T>(val: T): val is Exclude<T, null | undefined>;
16
+ //#endregion
17
+ export { isNil, isNotNil };
package/dist/is/nil.js ADDED
@@ -0,0 +1,22 @@
1
+ //#region src/is/nil.ts
2
+ /**
3
+ * 判断值是否为 null 或 undefined
4
+ *
5
+ * @param val - 要判断的值
6
+ * @returns 是否为 null 或 undefined
7
+ */
8
+ function isNil(val) {
9
+ return val === null || val === void 0;
10
+ }
11
+ /**
12
+ * 判断值是否不为 null 且不为 undefined
13
+ *
14
+ * @param val - 要判断的值
15
+ * @returns 是否不为 null 且不为 undefined
16
+ */
17
+ function isNotNil(val) {
18
+ return val !== null && val !== void 0;
19
+ }
20
+
21
+ //#endregion
22
+ export { isNil, isNotNil };
@@ -0,0 +1,17 @@
1
+ //#region src/is/plainObject.d.ts
2
+ /**
3
+ * 判断是否为纯对象(plain object)
4
+ *
5
+ * @param value - 要判断的值
6
+ * @returns 是否为纯对象
7
+ */
8
+ declare function isPlainObject(value: unknown): value is Record<string, unknown>;
9
+ /**
10
+ * 检查对象是否有 Symbol 属性
11
+ *
12
+ * @param value - 要检查的值
13
+ * @returns 是否有 Symbol 属性
14
+ */
15
+ declare function isObjectWithSymbols(value: unknown): boolean;
16
+ //#endregion
17
+ export { isObjectWithSymbols, isPlainObject };
@@ -0,0 +1,30 @@
1
+ import { getSymbols } from "../function/object.js";
2
+ import { isObject } from "./type.js";
3
+
4
+ //#region src/is/plainObject.ts
5
+ /**
6
+ * 判断是否为纯对象(plain object)
7
+ *
8
+ * @param value - 要判断的值
9
+ * @returns 是否为纯对象
10
+ */
11
+ function isPlainObject(value) {
12
+ if (!isObject(value)) return false;
13
+ const proto = Object.getPrototypeOf(value);
14
+ if (proto === null) return true;
15
+ const ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
16
+ return typeof ctor === "function" && ctor instanceof ctor && Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object);
17
+ }
18
+ /**
19
+ * 检查对象是否有 Symbol 属性
20
+ *
21
+ * @param value - 要检查的值
22
+ * @returns 是否有 Symbol 属性
23
+ */
24
+ function isObjectWithSymbols(value) {
25
+ if (!isObject(value)) return false;
26
+ return getSymbols(value).length > 0;
27
+ }
28
+
29
+ //#endregion
30
+ export { isObjectWithSymbols, isPlainObject };