@pisell/utils 1.0.70 → 1.0.72

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 (129) hide show
  1. package/README.md +2 -2
  2. package/es/arrayUtils.d.ts +1 -1
  3. package/es/common/index.d.ts +5 -5
  4. package/es/common/index.js +2 -2
  5. package/es/common/stateHelper.d.ts +18 -18
  6. package/es/common/stateHelper.js +15 -15
  7. package/es/common/types.d.ts +28 -28
  8. package/es/componentStorage.d.ts +36 -36
  9. package/es/componentStorage.js +7 -7
  10. package/es/constants/index.d.ts +7 -7
  11. package/es/date.d.ts +28 -28
  12. package/es/date.js +22 -22
  13. package/es/document.d.ts +13 -13
  14. package/es/document.js +7 -7
  15. package/es/escPosPrinter/index.d.ts +9 -9
  16. package/es/firebase/config/index.d.ts +13 -13
  17. package/es/firebase/index.d.ts +28 -28
  18. package/es/format.js +14 -14
  19. package/es/image.d.ts +11 -11
  20. package/es/image.js +5 -5
  21. package/es/index.d.ts +25 -25
  22. package/es/jsBridge/index.js +15 -15
  23. package/es/jsBridge/regDeviceApi.d.ts +15 -15
  24. package/es/jsBridge/regDeviceApi.js +3 -3
  25. package/es/locales.js +15 -15
  26. package/es/log.d.ts +10 -10
  27. package/es/number-input/hooks/index.d.ts +4 -4
  28. package/es/number-input/hooks/index.js +2 -2
  29. package/es/number-input/hooks/useNumberInputState.d.ts +25 -25
  30. package/es/number-input/hooks/useNumberInputState.js +39 -39
  31. package/es/number-input/index.d.ts +14 -14
  32. package/es/number-input/index.js +8 -8
  33. package/es/number-input/types.d.ts +96 -96
  34. package/es/number-input/utils/formatter.d.ts +53 -53
  35. package/es/number-input/utils/formatter.js +37 -37
  36. package/es/number-input/utils/index.d.ts +7 -7
  37. package/es/number-input/utils/index.js +2 -2
  38. package/es/number-input/utils/validation.d.ts +27 -27
  39. package/es/number-input/utils/validation.js +24 -24
  40. package/es/otherUtils.d.ts +48 -48
  41. package/es/otherUtils.js +32 -32
  42. package/es/platform.d.ts +9 -9
  43. package/es/select/hooks/index.d.ts +5 -5
  44. package/es/select/hooks/index.js +2 -2
  45. package/es/select/hooks/useDebouncedSearch.d.ts +20 -20
  46. package/es/select/hooks/useDebouncedSearch.js +17 -17
  47. package/es/select/hooks/useSelectState.d.ts +19 -19
  48. package/es/select/hooks/useSelectState.js +13 -13
  49. package/es/select/index.d.ts +8 -8
  50. package/es/select/index.js +3 -3
  51. package/es/select/types.d.ts +256 -256
  52. package/es/select/utils/filterOptions.d.ts +22 -22
  53. package/es/select/utils/filterOptions.js +16 -16
  54. package/es/select/utils/helpers.d.ts +42 -42
  55. package/es/select/utils/helpers.js +30 -30
  56. package/es/select/utils/index.d.ts +7 -7
  57. package/es/select/utils/index.js +2 -2
  58. package/es/select/utils/sortOptions.d.ts +12 -12
  59. package/es/select/utils/sortOptions.js +8 -8
  60. package/es/select/utils/tagAggregation.d.ts +25 -25
  61. package/es/select/utils/tagAggregation.js +21 -21
  62. package/es/text-input/hooks/index.d.ts +4 -4
  63. package/es/text-input/hooks/index.js +2 -2
  64. package/es/text-input/hooks/useTextInputState.d.ts +24 -24
  65. package/es/text-input/hooks/useTextInputState.js +38 -38
  66. package/es/text-input/index.d.ts +14 -14
  67. package/es/text-input/index.js +9 -9
  68. package/es/text-input/types.d.ts +56 -56
  69. package/es/text-input/utils/index.d.ts +5 -5
  70. package/es/text-input/utils/index.js +2 -2
  71. package/es/text-input/utils/validation.d.ts +23 -23
  72. package/es/text-input/utils/validation.js +20 -20
  73. package/es/typeUtils.d.ts +42 -42
  74. package/es/typeUtils.js +26 -26
  75. package/es/walletValidity.d.ts +44 -44
  76. package/es/walletValidity.js +85 -85
  77. package/lib/arrayUtils.d.ts +1 -1
  78. package/lib/common/index.d.ts +5 -5
  79. package/lib/common/stateHelper.d.ts +18 -18
  80. package/lib/common/types.d.ts +28 -28
  81. package/lib/componentStorage.d.ts +36 -36
  82. package/lib/constants/index.d.ts +7 -7
  83. package/lib/date.d.ts +28 -28
  84. package/lib/document.d.ts +13 -13
  85. package/lib/escPosPrinter/index.d.ts +9 -9
  86. package/lib/firebase/config/index.d.ts +13 -13
  87. package/lib/firebase/index.d.ts +28 -28
  88. package/lib/image.d.ts +11 -11
  89. package/lib/index.d.ts +25 -25
  90. package/lib/jsBridge/regDeviceApi.d.ts +15 -15
  91. package/lib/log.d.ts +10 -10
  92. package/lib/number-input/hooks/index.d.ts +4 -4
  93. package/lib/number-input/hooks/useNumberInputState.d.ts +25 -25
  94. package/lib/number-input/index.d.ts +14 -14
  95. package/lib/number-input/types.d.ts +96 -96
  96. package/lib/number-input/utils/formatter.d.ts +53 -53
  97. package/lib/number-input/utils/index.d.ts +7 -7
  98. package/lib/number-input/utils/validation.d.ts +27 -27
  99. package/lib/otherUtils.d.ts +48 -48
  100. package/lib/platform.d.ts +9 -9
  101. package/lib/select/hooks/index.d.ts +5 -5
  102. package/lib/select/hooks/useDebouncedSearch.d.ts +20 -20
  103. package/lib/select/hooks/useSelectState.d.ts +19 -19
  104. package/lib/select/index.d.ts +8 -8
  105. package/lib/select/types.d.ts +256 -256
  106. package/lib/select/utils/filterOptions.d.ts +22 -22
  107. package/lib/select/utils/helpers.d.ts +42 -42
  108. package/lib/select/utils/index.d.ts +7 -7
  109. package/lib/select/utils/sortOptions.d.ts +12 -12
  110. package/lib/select/utils/tagAggregation.d.ts +25 -25
  111. package/lib/text-input/hooks/index.d.ts +4 -4
  112. package/lib/text-input/hooks/useTextInputState.d.ts +24 -24
  113. package/lib/text-input/index.d.ts +14 -14
  114. package/lib/text-input/types.d.ts +56 -56
  115. package/lib/text-input/utils/index.d.ts +5 -5
  116. package/lib/text-input/utils/validation.d.ts +23 -23
  117. package/lib/typeUtils.d.ts +42 -42
  118. package/lib/walletValidity.d.ts +44 -44
  119. package/package.json +1 -1
  120. package/es/format.d.ts +0 -28
  121. package/es/jsBridge/index.d.ts +0 -22
  122. package/es/jsBridge/types.d.ts +0 -149
  123. package/es/locales.d.ts +0 -9
  124. package/es/miniRedux.d.ts +0 -16
  125. package/lib/format.d.ts +0 -28
  126. package/lib/jsBridge/index.d.ts +0 -22
  127. package/lib/jsBridge/types.d.ts +0 -149
  128. package/lib/locales.d.ts +0 -9
  129. package/lib/miniRedux.d.ts +0 -16
@@ -1,53 +1,53 @@
1
- /**
2
- * 数值格式化工具函数
3
- */
4
- /**
5
- * 格式化选项
6
- */
7
- export interface NumberFormatOptions {
8
- /** 小数精度 */
9
- precision?: number;
10
- /** 是否使用千分位分隔符 */
11
- useGrouping?: boolean;
12
- /** 自定义格式化函数 */
13
- formatter?: (value: number | null) => string;
14
- }
15
- /**
16
- * 格式化数值
17
- *
18
- * @param value 数值
19
- * @param options 格式化选项
20
- * @returns 格式化后的字符串,null 时返回 null
21
- *
22
- * @example
23
- * formatNumber(1234.567, { precision: 2, useGrouping: true })
24
- * // 返回: "1,234.57"
25
- *
26
- * @example
27
- * formatNumber(1234, { precision: 0, useGrouping: true })
28
- * // 返回: "1,234"
29
- */
30
- export declare function formatNumber(value: number | null | undefined, options?: NumberFormatOptions): string | null;
31
- /**
32
- * 添加千分位分隔符
33
- *
34
- * @param value 数值
35
- * @returns 添加千分位后的字符串
36
- *
37
- * @example
38
- * addThousandsSeparator(1234567)
39
- * // 返回: "1,234,567"
40
- */
41
- export declare function addThousandsSeparator(value: number): string;
42
- /**
43
- * 格式化精度
44
- *
45
- * @param value 数值
46
- * @param precision 小数位数
47
- * @returns 格式化后的数值
48
- *
49
- * @example
50
- * formatPrecision(1.2345, 2)
51
- * // 返回: 1.23
52
- */
53
- export declare function formatPrecision(value: number, precision: number): number;
1
+ /**
2
+ * 数值格式化工具函数
3
+ */
4
+ /**
5
+ * 格式化选项
6
+ */
7
+ export interface NumberFormatOptions {
8
+ /** 小数精度 */
9
+ precision?: number;
10
+ /** 是否使用千分位分隔符 */
11
+ useGrouping?: boolean;
12
+ /** 自定义格式化函数 */
13
+ formatter?: (value: number | null) => string;
14
+ }
15
+ /**
16
+ * 格式化数值
17
+ *
18
+ * @param value 数值
19
+ * @param options 格式化选项
20
+ * @returns 格式化后的字符串,null 时返回 null
21
+ *
22
+ * @example
23
+ * formatNumber(1234.567, { precision: 2, useGrouping: true })
24
+ * // 返回: "1,234.57"
25
+ *
26
+ * @example
27
+ * formatNumber(1234, { precision: 0, useGrouping: true })
28
+ * // 返回: "1,234"
29
+ */
30
+ export declare function formatNumber(value: number | null | undefined, options?: NumberFormatOptions): string | null;
31
+ /**
32
+ * 添加千分位分隔符
33
+ *
34
+ * @param value 数值
35
+ * @returns 添加千分位后的字符串
36
+ *
37
+ * @example
38
+ * addThousandsSeparator(1234567)
39
+ * // 返回: "1,234,567"
40
+ */
41
+ export declare function addThousandsSeparator(value: number): string;
42
+ /**
43
+ * 格式化精度
44
+ *
45
+ * @param value 数值
46
+ * @param precision 小数位数
47
+ * @returns 格式化后的数值
48
+ *
49
+ * @example
50
+ * formatPrecision(1.2345, 2)
51
+ * // 返回: 1.23
52
+ */
53
+ export declare function formatPrecision(value: number, precision: number): number;
@@ -1,25 +1,25 @@
1
- /**
2
- * 数值格式化工具函数
1
+ /**
2
+ * 数值格式化工具函数
3
3
  */
4
4
 
5
- /**
6
- * 格式化选项
5
+ /**
6
+ * 格式化选项
7
7
  */
8
8
 
9
- /**
10
- * 格式化数值
11
- *
12
- * @param value 数值
13
- * @param options 格式化选项
14
- * @returns 格式化后的字符串,null 时返回 null
15
- *
16
- * @example
17
- * formatNumber(1234.567, { precision: 2, useGrouping: true })
18
- * // 返回: "1,234.57"
19
- *
20
- * @example
21
- * formatNumber(1234, { precision: 0, useGrouping: true })
22
- * // 返回: "1,234"
9
+ /**
10
+ * 格式化数值
11
+ *
12
+ * @param value 数值
13
+ * @param options 格式化选项
14
+ * @returns 格式化后的字符串,null 时返回 null
15
+ *
16
+ * @example
17
+ * formatNumber(1234.567, { precision: 2, useGrouping: true })
18
+ * // 返回: "1,234.57"
19
+ *
20
+ * @example
21
+ * formatNumber(1234, { precision: 0, useGrouping: true })
22
+ * // 返回: "1,234"
23
23
  */
24
24
  export function formatNumber(value) {
25
25
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -50,15 +50,15 @@ export function formatNumber(value) {
50
50
  return String(value);
51
51
  }
52
52
 
53
- /**
54
- * 添加千分位分隔符
55
- *
56
- * @param value 数值
57
- * @returns 添加千分位后的字符串
58
- *
59
- * @example
60
- * addThousandsSeparator(1234567)
61
- * // 返回: "1,234,567"
53
+ /**
54
+ * 添加千分位分隔符
55
+ *
56
+ * @param value 数值
57
+ * @returns 添加千分位后的字符串
58
+ *
59
+ * @example
60
+ * addThousandsSeparator(1234567)
61
+ * // 返回: "1,234,567"
62
62
  */
63
63
  export function addThousandsSeparator(value) {
64
64
  return value.toLocaleString('zh-CN', {
@@ -66,16 +66,16 @@ export function addThousandsSeparator(value) {
66
66
  });
67
67
  }
68
68
 
69
- /**
70
- * 格式化精度
71
- *
72
- * @param value 数值
73
- * @param precision 小数位数
74
- * @returns 格式化后的数值
75
- *
76
- * @example
77
- * formatPrecision(1.2345, 2)
78
- * // 返回: 1.23
69
+ /**
70
+ * 格式化精度
71
+ *
72
+ * @param value 数值
73
+ * @param precision 小数位数
74
+ * @returns 格式化后的数值
75
+ *
76
+ * @example
77
+ * formatPrecision(1.2345, 2)
78
+ * // 返回: 1.23
79
79
  */
80
80
  export function formatPrecision(value, precision) {
81
81
  return Number(value.toFixed(precision));
@@ -1,7 +1,7 @@
1
- /**
2
- * 数值输入工具函数导出
3
- */
4
- export { validateValue } from './validation';
5
- export { getDisplayState } from '../../common';
6
- export { formatNumber, addThousandsSeparator, formatPrecision } from './formatter';
7
- export type { NumberFormatOptions } from './formatter';
1
+ /**
2
+ * 数值输入工具函数导出
3
+ */
4
+ export { validateValue } from './validation';
5
+ export { getDisplayState } from '../../common';
6
+ export { formatNumber, addThousandsSeparator, formatPrecision } from './formatter';
7
+ export type { NumberFormatOptions } from './formatter';
@@ -1,5 +1,5 @@
1
- /**
2
- * 数值输入工具函数导出
1
+ /**
2
+ * 数值输入工具函数导出
3
3
  */
4
4
 
5
5
  export { validateValue } from "./validation";
@@ -1,27 +1,27 @@
1
- import type { BaseNumberInputProps, ValidationResult } from '../types';
2
- /**
3
- * 校验数值输入
4
- *
5
- * 按照优先级执行校验规则:
6
- * 1. 必填校验(required)
7
- * 2. 最小值校验(min)
8
- * 3. 最大值校验(max)
9
- * 4. 自定义校验函数(validator)
10
- *
11
- * @param value 待校验的值
12
- * @param props 校验配置
13
- * @returns 校验结果对象,包含 isValid 和 errors
14
- *
15
- * @example
16
- * validateValue(10, { required: true, min: 0, max: 100 })
17
- * // { isValid: true, errors: [] }
18
- *
19
- * @example
20
- * validateValue(null, { required: true })
21
- * // { isValid: false, errors: ['此字段为必填项'] }
22
- *
23
- * @example
24
- * validateValue(150, { min: 0, max: 100 })
25
- * // { isValid: false, errors: ['不能大于 100'] }
26
- */
27
- export declare function validateValue(value: number | null | undefined, props: BaseNumberInputProps): ValidationResult;
1
+ import type { BaseNumberInputProps, ValidationResult } from '../types';
2
+ /**
3
+ * 校验数值输入
4
+ *
5
+ * 按照优先级执行校验规则:
6
+ * 1. 必填校验(required)
7
+ * 2. 最小值校验(min)
8
+ * 3. 最大值校验(max)
9
+ * 4. 自定义校验函数(validator)
10
+ *
11
+ * @param value 待校验的值
12
+ * @param props 校验配置
13
+ * @returns 校验结果对象,包含 isValid 和 errors
14
+ *
15
+ * @example
16
+ * validateValue(10, { required: true, min: 0, max: 100 })
17
+ * // { isValid: true, errors: [] }
18
+ *
19
+ * @example
20
+ * validateValue(null, { required: true })
21
+ * // { isValid: false, errors: ['此字段为必填项'] }
22
+ *
23
+ * @example
24
+ * validateValue(150, { min: 0, max: 100 })
25
+ * // { isValid: false, errors: ['不能大于 100'] }
26
+ */
27
+ export declare function validateValue(value: number | null | undefined, props: BaseNumberInputProps): ValidationResult;
@@ -1,27 +1,27 @@
1
- /**
2
- * 校验数值输入
3
- *
4
- * 按照优先级执行校验规则:
5
- * 1. 必填校验(required)
6
- * 2. 最小值校验(min)
7
- * 3. 最大值校验(max)
8
- * 4. 自定义校验函数(validator)
9
- *
10
- * @param value 待校验的值
11
- * @param props 校验配置
12
- * @returns 校验结果对象,包含 isValid 和 errors
13
- *
14
- * @example
15
- * validateValue(10, { required: true, min: 0, max: 100 })
16
- * // { isValid: true, errors: [] }
17
- *
18
- * @example
19
- * validateValue(null, { required: true })
20
- * // { isValid: false, errors: ['此字段为必填项'] }
21
- *
22
- * @example
23
- * validateValue(150, { min: 0, max: 100 })
24
- * // { isValid: false, errors: ['不能大于 100'] }
1
+ /**
2
+ * 校验数值输入
3
+ *
4
+ * 按照优先级执行校验规则:
5
+ * 1. 必填校验(required)
6
+ * 2. 最小值校验(min)
7
+ * 3. 最大值校验(max)
8
+ * 4. 自定义校验函数(validator)
9
+ *
10
+ * @param value 待校验的值
11
+ * @param props 校验配置
12
+ * @returns 校验结果对象,包含 isValid 和 errors
13
+ *
14
+ * @example
15
+ * validateValue(10, { required: true, min: 0, max: 100 })
16
+ * // { isValid: true, errors: [] }
17
+ *
18
+ * @example
19
+ * validateValue(null, { required: true })
20
+ * // { isValid: false, errors: ['此字段为必填项'] }
21
+ *
22
+ * @example
23
+ * validateValue(150, { min: 0, max: 100 })
24
+ * // { isValid: false, errors: ['不能大于 100'] }
25
25
  */
26
26
  export function validateValue(value, props) {
27
27
  var errors = [];
@@ -1,48 +1,48 @@
1
- /**
2
- * @title: 判断是否无痕模式
3
- * @description:
4
- * @return: *
5
- * @Author: shengjie.zuo
6
- * @Date: 2024-09-4 09:58:22
7
- */
8
- export declare const detectIncognito: () => Promise<{
9
- isPrivate: boolean;
10
- browserName: string;
11
- } | {
12
- isPrivate: boolean;
13
- }>;
14
- /**
15
- * @Description: 生成唯一id
16
- * @Author: wzw
17
- * @Date: 2020-12-01 14:20:29
18
- * @param {*}
19
- * @return {*}
20
- */
21
- export declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
22
- /**
23
- * @title: 对数组进行增|删
24
- * @description: 用于多选选中和取消选中的处理
25
- * @param {any} list
26
- * @param {any} item
27
- * @param {string} key
28
- * @return {*}
29
- * @Author: zhiwei.Wang
30
- * @Date: 2023-12-19 16:44
31
- */
32
- export declare const changeArray: <T>(list: T[] | undefined, item: T, key?: string) => T[];
33
- /**
34
- * @title: 判断某个字段是否在列表内
35
- * @description:
36
- * @param {*} T
37
- * @param {boolean} param2
38
- * @return {*}
39
- * @Author: zhiwei.Wang
40
- * @Date: 2023-12-19 16:54
41
- */
42
- export declare const getItemByArray: <T>(list: T[] | undefined, item: T, key?: string) => boolean;
43
- export declare const createArray: (length: number, returnItem: any) => unknown[];
44
- /**
45
- * 根据对象内容生成唯一id
46
- * @param obj
47
- */
48
- export declare const generateUniqueIdByObj: (obj: Record<string, any>) => any;
1
+ /**
2
+ * @title: 判断是否无痕模式
3
+ * @description:
4
+ * @return: *
5
+ * @Author: shengjie.zuo
6
+ * @Date: 2024-09-4 09:58:22
7
+ */
8
+ export declare const detectIncognito: () => Promise<{
9
+ isPrivate: boolean;
10
+ browserName: string;
11
+ } | {
12
+ isPrivate: boolean;
13
+ }>;
14
+ /**
15
+ * @Description: 生成唯一id
16
+ * @Author: wzw
17
+ * @Date: 2020-12-01 14:20:29
18
+ * @param {*}
19
+ * @return {*}
20
+ */
21
+ export declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
22
+ /**
23
+ * @title: 对数组进行增|删
24
+ * @description: 用于多选选中和取消选中的处理
25
+ * @param {any} list
26
+ * @param {any} item
27
+ * @param {string} key
28
+ * @return {*}
29
+ * @Author: zhiwei.Wang
30
+ * @Date: 2023-12-19 16:44
31
+ */
32
+ export declare const changeArray: <T>(list: T[] | undefined, item: T, key?: string) => T[];
33
+ /**
34
+ * @title: 判断某个字段是否在列表内
35
+ * @description:
36
+ * @param {*} T
37
+ * @param {boolean} param2
38
+ * @return {*}
39
+ * @Author: zhiwei.Wang
40
+ * @Date: 2023-12-19 16:54
41
+ */
42
+ export declare const getItemByArray: <T>(list: T[] | undefined, item: T, key?: string) => boolean;
43
+ export declare const createArray: (length: number, returnItem: any) => unknown[];
44
+ /**
45
+ * 根据对象内容生成唯一id
46
+ * @param obj
47
+ */
48
+ export declare const generateUniqueIdByObj: (obj: Record<string, any>) => any;
package/es/otherUtils.js CHANGED
@@ -8,12 +8,12 @@ import md5 from "crypto-js/md5";
8
8
  import enc from "crypto-js/enc-hex";
9
9
  import { detectIncognito as originDetectIncognito } from "detectincognitojs";
10
10
 
11
- /**
12
- * @title: 判断是否无痕模式
13
- * @description:
14
- * @return: *
15
- * @Author: shengjie.zuo
16
- * @Date: 2024-09-4 09:58:22
11
+ /**
12
+ * @title: 判断是否无痕模式
13
+ * @description:
14
+ * @return: *
15
+ * @Author: shengjie.zuo
16
+ * @Date: 2024-09-4 09:58:22
17
17
  */
18
18
  export var detectIncognito = /*#__PURE__*/function () {
19
19
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -52,12 +52,12 @@ export var detectIncognito = /*#__PURE__*/function () {
52
52
  };
53
53
  }();
54
54
 
55
- /**
56
- * @Description: 生成唯一id
57
- * @Author: wzw
58
- * @Date: 2020-12-01 14:20:29
59
- * @param {*}
60
- * @return {*}
55
+ /**
56
+ * @Description: 生成唯一id
57
+ * @Author: wzw
58
+ * @Date: 2020-12-01 14:20:29
59
+ * @param {*}
60
+ * @return {*}
61
61
  */
62
62
  export var getUniqueId = function getUniqueId() {
63
63
  var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
@@ -65,15 +65,15 @@ export var getUniqueId = function getUniqueId() {
65
65
  return prefix + (Math.random() + '').replace(/\D/g, '').substring(0, maxLength);
66
66
  };
67
67
 
68
- /**
69
- * @title: 对数组进行增|删
70
- * @description: 用于多选选中和取消选中的处理
71
- * @param {any} list
72
- * @param {any} item
73
- * @param {string} key
74
- * @return {*}
75
- * @Author: zhiwei.Wang
76
- * @Date: 2023-12-19 16:44
68
+ /**
69
+ * @title: 对数组进行增|删
70
+ * @description: 用于多选选中和取消选中的处理
71
+ * @param {any} list
72
+ * @param {any} item
73
+ * @param {string} key
74
+ * @return {*}
75
+ * @Author: zhiwei.Wang
76
+ * @Date: 2023-12-19 16:44
77
77
  */
78
78
  export var changeArray = function changeArray() {
79
79
  var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
@@ -104,14 +104,14 @@ export var changeArray = function changeArray() {
104
104
  return _list;
105
105
  };
106
106
 
107
- /**
108
- * @title: 判断某个字段是否在列表内
109
- * @description:
110
- * @param {*} T
111
- * @param {boolean} param2
112
- * @return {*}
113
- * @Author: zhiwei.Wang
114
- * @Date: 2023-12-19 16:54
107
+ /**
108
+ * @title: 判断某个字段是否在列表内
109
+ * @description:
110
+ * @param {*} T
111
+ * @param {boolean} param2
112
+ * @return {*}
113
+ * @Author: zhiwei.Wang
114
+ * @Date: 2023-12-19 16:54
115
115
  */
116
116
  export var getItemByArray = function getItemByArray() {
117
117
  var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
@@ -130,9 +130,9 @@ export var createArray = function createArray(length, returnItem) {
130
130
  return Array.from(new Array(length)).map(returnItem);
131
131
  };
132
132
 
133
- /**
134
- * 根据对象内容生成唯一id
135
- * @param obj
133
+ /**
134
+ * 根据对象内容生成唯一id
135
+ * @param obj
136
136
  */
137
137
  export var generateUniqueIdByObj = function generateUniqueIdByObj(obj) {
138
138
  var jsonString = JSON.stringify(obj);
package/es/platform.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export declare const isIpad: () => boolean;
2
- export declare const isMobile: () => boolean;
3
- export declare const isAndroid: () => boolean;
4
- export declare const isIos: () => boolean;
5
- export declare const checkEnv: () => number;
6
- export declare const isWx: () => boolean;
7
- export declare const isIOS: () => boolean;
8
- export declare const isWxApp: () => boolean;
9
- export declare const isSafari: () => boolean;
1
+ export declare const isIpad: () => boolean;
2
+ export declare const isMobile: () => boolean;
3
+ export declare const isAndroid: () => boolean;
4
+ export declare const isIos: () => boolean;
5
+ export declare const checkEnv: () => number;
6
+ export declare const isWx: () => boolean;
7
+ export declare const isIOS: () => boolean;
8
+ export declare const isWxApp: () => boolean;
9
+ export declare const isSafari: () => boolean;
@@ -1,5 +1,5 @@
1
- /**
2
- * Select Hooks 导出
3
- */
4
- export { useSelectState, useMultipleSelectState } from './useSelectState';
5
- export { useDebouncedSearch } from './useDebouncedSearch';
1
+ /**
2
+ * Select Hooks 导出
3
+ */
4
+ export { useSelectState, useMultipleSelectState } from './useSelectState';
5
+ export { useDebouncedSearch } from './useDebouncedSearch';
@@ -1,5 +1,5 @@
1
- /**
2
- * Select Hooks 导出
1
+ /**
2
+ * Select Hooks 导出
3
3
  */
4
4
 
5
5
  export { useSelectState, useMultipleSelectState } from "./useSelectState";
@@ -1,20 +1,20 @@
1
- /**
2
- * 防抖搜索 Hook
3
- * 对用户输入进行防抖处理,避免频繁触发搜索
4
- */
5
- /**
6
- * 防抖搜索 Hook
7
- * @template T 值的类型
8
- * @param initialValue 初始值
9
- * @param delay 防抖延迟时间(毫秒)
10
- * @param callback 防抖后的回调函数
11
- * @returns [防抖后的值, 设置值函数]
12
- *
13
- * @example
14
- * ```tsx
15
- * const [debouncedSearch, setSearchInput] = useDebouncedSearch('', 300, (text) => {
16
- * console.log('搜索关键词:', text);
17
- * });
18
- * ```
19
- */
20
- export declare function useDebouncedSearch<T = string>(initialValue: T, delay: number, callback?: (value: T) => void): [T, (value: T) => void];
1
+ /**
2
+ * 防抖搜索 Hook
3
+ * 对用户输入进行防抖处理,避免频繁触发搜索
4
+ */
5
+ /**
6
+ * 防抖搜索 Hook
7
+ * @template T 值的类型
8
+ * @param initialValue 初始值
9
+ * @param delay 防抖延迟时间(毫秒)
10
+ * @param callback 防抖后的回调函数
11
+ * @returns [防抖后的值, 设置值函数]
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const [debouncedSearch, setSearchInput] = useDebouncedSearch('', 300, (text) => {
16
+ * console.log('搜索关键词:', text);
17
+ * });
18
+ * ```
19
+ */
20
+ export declare function useDebouncedSearch<T = string>(initialValue: T, delay: number, callback?: (value: T) => void): [T, (value: T) => void];
@@ -4,27 +4,27 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- /**
8
- * 防抖搜索 Hook
9
- * 对用户输入进行防抖处理,避免频繁触发搜索
7
+ /**
8
+ * 防抖搜索 Hook
9
+ * 对用户输入进行防抖处理,避免频繁触发搜索
10
10
  */
11
11
 
12
12
  import { useState, useEffect } from 'react';
13
13
 
14
- /**
15
- * 防抖搜索 Hook
16
- * @template T 值的类型
17
- * @param initialValue 初始值
18
- * @param delay 防抖延迟时间(毫秒)
19
- * @param callback 防抖后的回调函数
20
- * @returns [防抖后的值, 设置值函数]
21
- *
22
- * @example
23
- * ```tsx
24
- * const [debouncedSearch, setSearchInput] = useDebouncedSearch('', 300, (text) => {
25
- * console.log('搜索关键词:', text);
26
- * });
27
- * ```
14
+ /**
15
+ * 防抖搜索 Hook
16
+ * @template T 值的类型
17
+ * @param initialValue 初始值
18
+ * @param delay 防抖延迟时间(毫秒)
19
+ * @param callback 防抖后的回调函数
20
+ * @returns [防抖后的值, 设置值函数]
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * const [debouncedSearch, setSearchInput] = useDebouncedSearch('', 300, (text) => {
25
+ * console.log('搜索关键词:', text);
26
+ * });
27
+ * ```
28
28
  */
29
29
  export function useDebouncedSearch(initialValue, delay, callback) {
30
30
  // 实时值(用户输入)